//MT 17/04/97 sauvegarde et chargement des ZA & ZAList //bbb 14/03/97 tout #include "stdafx.h" #include "ACP_Base.h" #include "ITF.h" #include "TAC.h" #include "IncMEC.h" #define D_State_Define #include "IncGAM.h" #undef D_State_Define #include "GLI.h" #include "DPT.h" #include "TFA.h" // Family dll include #include "CPA_Nll.hpp" #include "_Ainterf.hpp" #include "EDACstrg.hpp" //================================================================================ //================================================================================ //================================================================================ // CONSTANTS //================================================================================ #define C_szNamesListLevelSection "AddToNamesList" #define C_szNamesListSubSection "NamesList" #define C_szListSubSection "AddENL" #define C_szNameEntry "AddName" #define C_szObjectsListEntry "ObjectsList" #define C_szZAEntry "ZA" #define C_szDefaultZAEntry "DefaultZA" #define C_szZAListEntry "ZAList" //================================================================================ //================================================================================ CPA_tdoNameList::CPA_tdoNameList ( //EdActors_EditorActor *p_oCreatorEditorActor, CString csObjectType, CPA_BaseObject *p_oOwner, BOOL bSectionExist, CString csName ) : CPA_SaveObject( g_pclInterface, //creating dll csObjectType, E_ss_Responsible, p_oOwner ) { char szFileName[SCR_CV_ui_Cfg_MaxLenName]; char szReferencedSectionName[SCR_CV_ui_Cfg_MaxLenName]; char *p_cPoint; char *p_cSlash; GetEditor()->SetMainWorld(p_oOwner->GetEditor()->GetMainWorld()); // Main Section strcpy( szFileName, p_oOwner -> fn_p_szGetName() ); strcat( szFileName, "\\" ); strcat( szFileName, p_oOwner -> fn_p_szGetName() ); strcat( szFileName, ".enl" ); SCR_fn_v_RdL0_ComputeSectionName( szReferencedSectionName, szFileName, M_MAKECHAR(g_c_csActorScriptNamesListSectionName), "" ); SetSectionData ( this ) ; SetCallBackSave ( m_fnv_CallBackSave ) ; SetDataPath ( fn_szGetFamiliesDataPath() ) ; SetReferencedSectionName ( szReferencedSectionName ) ; // Name if ( fn_eRename (csName ) != E_mc_None) SetDefaultValidName ( ) ; SetExistingSection ( bSectionExist ) ; fn_vUpdateSectionName(); // Names Section SCR_fn_v_RdL0_ComputeSectionName( szFileName, (char*)(LPCTSTR)GetReferencedSectionName(), C_szNamesListSubSection, NULL ); m_p_oNamesSection = new CPA_SectionObject( szFileName, fn_szGetFamiliesDataPath(), m_fnv_CallBackSaveNamesList ); m_p_oNamesSection -> SetSectionData( this ); m_p_oNamesSection -> SetExistingSection( SCR_fn_c_RdL0_IsSectionExists( M_MAKECHAR( m_p_oNamesSection -> GetCompleteSectionName() ) ) ); // // Level Section fn_zsGetActualLevelFilename( szFileName, "" ); p_cSlash = strrchr( szFileName, '\\' ); p_cPoint = strrchr( szFileName, '.' ); sprintf( p_cPoint, "\\Families\\%s\\%s.enl", p_oOwner -> fn_p_szGetName(), p_oOwner -> fn_p_szGetName() ); SCR_fn_v_RdL0_ComputeSectionName( szReferencedSectionName, p_cSlash+1, C_szNamesListLevelSection, fn_p_szGetName() ); m_p_oLevelSection = new CPA_SectionObject( szReferencedSectionName, fn_szGetLevelsDataPath(), /*m_fnv_CallBackSaveOnLevel*/m_fnv_CallBackSave ); m_p_oLevelSection -> SetSectionData( this ); m_p_oLevelSection -> SetExistingSection( SCR_fn_c_RdL0_IsSectionExists( M_MAKECHAR( m_p_oLevelSection -> GetCompleteSectionName() ) ) ); // if ( fn_bCanBeNotified ( ) && ! fn_bSectionExists ( ) ) fn_vNotifySave ( ) ; //m_p_oCreatorEditorActor = p_oCreatorEditorActor; m_pEdtListHandler=new EdtListHandler (); m_pEdtListHandler->fn_vSetNameList(this); m_bDisplayChildObjectLists = TRUE; m_p_oDefaultZA = NULL; } //================================================================================ CPA_tdoNameList::~CPA_tdoNameList() { delete m_pEdtListHandler; delete m_p_oLevelSection; } /*========================================================== Function name: fn_bNameListHasAVirgeField Description: returns true if the name list has any vierge field Input: pointer to the name list Output: returns true or false Author: Yann Le Tensorer Date: february 12, 1997 Revision: ==========================================================*/ BOOL CPA_tdoNameList::m_bHasAVirgeField() { return ( m_ulGetNumberOfVirgeFields() >= 1 ); } /*========================================================== Function name: fn_bNameListHasACommonField Description: returns true if the name list has any common field Input: pointer to the name list Output: returns true or false Author: Yann Le Tensorer Date: february 12, 1997 Revision: ==========================================================*/ BOOL CPA_tdoNameList::m_bHasACommonField() { return ( m_ulGetNumberOfVirgeFields() < GetCount() ); } /*========================================================== Function name: fn_ulGetNumberOfVirgeFields Description: returns the number of virge fields Input: pointer to the name list Output: returns the number of virge field in name list Author: Yann Le Tensorer Date: february 24, 1997 Revision: ==========================================================*/ unsigned long CPA_tdoNameList::m_ulGetNumberOfVirgeFields() { tdoObjectName *Name; POSITION pos; unsigned long ulRetValue; if (this == NULL) return 0; ulRetValue=0; pos = GetHeadPosition(); while (pos!=0) { Name = GetNext(pos); if (Name->m_eGetShareMode() == E_sm_Virge) ulRetValue ++; } return ulRetValue; } //================================================================================ //================================================================================ //================================================================================ // CallBack Loading //================================================================================ //================================================================================ //================================================================================ // load main section (common) SCR_tde_Anl_ReturnValue CPA_tdoNameList::m_fne_CallBackLoad( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction ) { CPA_Family *p_oOwnerFamily; CPA_tdoNameList *p_tdoNameList; //EdActors_EditorActor *p_oCreatorEditorActor; BOOL bSaveOnLevel; SCR_M_RdL0_GetContextLong(0, 0, CPA_Family*, p_oOwnerFamily); switch (_eAction) { case SCR_EA_Anl_BeginSection: ASSERT( p_oOwnerFamily ); bSaveOnLevel = p_oOwnerFamily -> GetEditor() -> GetMainWorld() -> GetInterface() -> fn_bIsLoadingWorld(); p_oOwnerFamily -> GetEditor() -> GetMainWorld() -> GetInterface() -> SetLoadingWorld( TRUE ); p_tdoNameList = new CPA_tdoNameList(_ap_szParams[0], p_oOwnerFamily, TRUE, _p_szName); // set SCR_M_RdL0_SetSectionLong( 0, 0, p_tdoNameList ); SCR_M_RdL0_SetSectionLong( 0, 1, bSaveOnLevel ); SCR_M_RdL0_SetContextLong( 1, 0, p_tdoNameList ); break; case SCR_EA_Anl_EndSection: // get current CPA_tdoNameList SCR_M_RdL0_GetSectionLong(0, 0, CPA_tdoNameList*, p_tdoNameList); // get current LoadingWorld State SCR_M_RdL0_GetSectionLong(0, 1, BOOL, bSaveOnLevel); // if no default ZA, select first (if exists) if( p_tdoNameList -> m_p_oDefaultZA == NULL ) { CPA_List oList; long lNbFound = p_tdoNameList -> GetMainWorld() -> fn_lFindObjects( &oList, "", C_szZATypeName, p_tdoNameList ); if( lNbFound> 0 ) p_tdoNameList -> m_p_oDefaultZA = oList . GetHead(); } // load level section if( p_tdoNameList -> m_p_oLevelSection -> fn_bSectionExists() ) { SCR_M_RdL0_SetContextLong( 1, 0, p_tdoNameList ); SCR_fnp_st_RdL0_AnalyseSection( M_MAKECHAR( p_tdoNameList -> m_p_oLevelSection -> GetCompleteSectionName() ), SCR_CDF_uw_Anl_Normal ); } // p_tdoNameList -> GetEditor() -> GetMainWorld() -> GetInterface() -> SetLoadingWorld( bSaveOnLevel ); break; } return SCR_ERV_Anl_NormalReturn; } //================================================================================ //================================================================================ // load main section (level) SCR_tde_Anl_ReturnValue CPA_tdoNameList::m_fne_CallBackLoadOnLevel( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction ) { CPA_tdoNameList *p_tdoNameList; SCR_M_RdL0_GetContextLong(0, 0, CPA_tdoNameList*, p_tdoNameList); switch (_eAction) { case SCR_EA_Anl_BeginSection: ASSERT( p_tdoNameList ); SCR_M_RdL0_SetContextLong( 1, 0, p_tdoNameList ); break; case SCR_EA_Anl_Entry: break; case SCR_EA_Anl_EndSection: break; } return SCR_ERV_Anl_NormalReturn; } //================================================================================ //================================================================================ // load Names List section (common) SCR_tde_Anl_ReturnValue CPA_tdoNameList::m_fne_CallBackLoadNamesList( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction ) { CPA_tdoNameList *p_tdoNameList; SCR_M_RdL0_GetContextLong(0, 0, CPA_tdoNameList*, p_tdoNameList); switch (_eAction) { case SCR_EA_Anl_BeginSection: break; case SCR_EA_Anl_Entry: // create tdoObjectName if( !strcmpi(_p_szName, C_szNameEntry) ) { tdeShareMode eMode = (tdeShareMode) atoi( _ap_szParams[1] ); tdoObjectName *p_oObjName = new tdoObjectName( p_tdoNameList, _ap_szParams[0], eMode ); p_tdoNameList -> AddTail( p_oObjName ); } break; case SCR_EA_Anl_EndSection: break; } return SCR_ERV_Anl_NormalReturn; } //================================================================================ //================================================================================ // load AddENL subsection (common && level) SCR_tde_Anl_ReturnValue CPA_tdoNameList::m_fne_CallBackLoadSubSection( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction ) { CPA_tdoNameList *p_tdoNameList; SCR_M_RdL0_GetContextLong(0, 0, CPA_tdoNameList*, p_tdoNameList); switch (_eAction) { case SCR_EA_Anl_BeginSection: ASSERT( p_tdoNameList ); break; case SCR_EA_Anl_Entry: if ( !strcmpi(_p_szName, C_szObjectsListEntry) ) { if (p_tdoNameList -> GetType () != C_szWayNameListType) { p_tdoNameList -> m_fnp_oCreateNewZoneList( _ap_szParams [0] ); } } else if ( !strcmpi(_p_szName, C_szDefaultZAEntry) ) { p_tdoNameList -> m_p_oDefaultZA = p_tdoNameList -> m_fnp_oCreateNewZA( _ap_szParams[0] ); } else if ( !strcmpi(_p_szName, C_szZAEntry) ) { p_tdoNameList -> m_fnp_oCreateNewZA( _ap_szParams[0] ); } else if ( !strcmpi(_p_szName, C_szZAListEntry) ) { p_tdoNameList -> m_fnp_oCreateNewZAList( _ap_szParams[0] ); } break; case SCR_EA_Anl_EndSection: break; } return SCR_ERV_Anl_NormalReturn; } //================================================================================ //================================================================================ //================================================================================ //================================================================================ //================================================================================ //================================================================================ // CallBack Saving //================================================================================ //================================================================================ //================================================================================ // save main section (Common && Level) void CPA_tdoNameList::m_fnv_CallBackSave( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData, SCR_tde_Ntfy_Action _eAction) { CPA_tdoNameList *p_tdoNameList = (CPA_tdoNameList*)_p_vData; char szActionName[SCR_CV_ui_Cfg_MaxLenName]; char szIdName[SCR_CV_ui_Cfg_MaxLenName]; char szSectionName[SCR_CV_ui_Cfg_MaxLenName]; // construct section name SCR_fn_v_RdL0_SplitSectionName( _p_szSectionName, NULL, szActionName, szIdName ); SCR_fn_v_RdL0_ComputeSectionName( szSectionName, NULL, szActionName, szIdName ); switch ( _eAction ) { case SCR_EA_Ntfy_AddSection: case SCR_EA_Ntfy_RebuildSection: // save begin section SCR_M_SvL0_SaveBeginSection( _p_stFile, szSectionName, SCR_CC_C_Cfg_NoChar ); SCR_fn_v_SvL0_SaveParameters_MP( _p_stFile, SCR_EF_SvL0_Normal, 1, p_tdoNameList -> fn_p_szGetType() ); // End Section SCR_M_SvL0_SaveBlankLine( _p_stFile ) ; SCR_M_SvL0_SaveEndSection( _p_stFile, SCR_CC_C_Cfg_EOL ) ; SCR_M_SvL0_SaveBlankLine( _p_stFile ) ; // update SectionObject if( ! stricmp( szActionName, C_szNamesListLevelSection ) ) p_tdoNameList -> m_p_oLevelSection -> fn_vSectionSaved(); else p_tdoNameList -> fn_vSectionSaved(); break; case SCR_EA_Ntfy_DeleteSection: // update SectionObject if( ! stricmp( szActionName, C_szNamesListLevelSection ) ) p_tdoNameList -> m_p_oLevelSection -> fn_vSectionDeleted(); else p_tdoNameList -> fn_vSectionDeleted(); break; } } //================================================================================ // save Names List Section (common) void CPA_tdoNameList::m_fnv_CallBackSaveNamesList( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData, SCR_tde_Ntfy_Action _eAction) { CPA_tdoNameList *p_tdoNameList = (CPA_tdoNameList*)_p_vData; POSITION stPos; switch ( _eAction ) { case SCR_EA_Ntfy_AddSection: case SCR_EA_Ntfy_RebuildSection: // indent subsection SCR_g_ui_SvL0_IndentationLevel++; // save begin section SCR_M_SvL0_SaveBeginSection( _p_stFile, C_szNamesListSubSection, SCR_CC_C_Cfg_EOL ); // save entries stPos = p_tdoNameList -> GetHeadPosition () ; while ( stPos ) { tdoObjectName *p_oObjName = p_tdoNameList -> GetNext ( stPos ) ; SCR_M_SvL0_SaveEntry( _p_stFile, C_szNameEntry, SCR_CC_C_Cfg_NoChar ); SCR_fn_v_SvL0_SaveParameters_MP( _p_stFile, SCR_EF_SvL0_Scanf, 3, "%s,%d", p_oObjName -> fn_p_szGetName(), (int)p_oObjName -> m_eGetShareMode() ); } // End Section SCR_M_SvL0_SaveEndSection( _p_stFile, SCR_CC_C_Cfg_EOL ) ; p_tdoNameList -> m_p_oNamesSection -> fn_vSectionSaved(); // restore indent SCR_g_ui_SvL0_IndentationLevel--; break; case SCR_EA_Ntfy_DeleteSection: p_tdoNameList -> m_p_oNamesSection -> fn_vSectionDeleted(); break; } } //================================================================================ //================================================================================ // save AddENL subsections (common && level ) void CPA_tdoNameList::m_fnv_CallBackSaveAddENL( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData, SCR_tde_Ntfy_Action _eAction) { CPA_SaveObject *p_oSaveObject = (CPA_SaveObject*) _p_vData; CPA_tdoNameList *p_tdoNameList = (CPA_tdoNameList*) p_oSaveObject -> GetOwner(); char szSectionName[SCR_CV_ui_Cfg_MaxLenName]; char szActionName[SCR_CV_ui_Cfg_MaxLenName]; char szIdName[SCR_CV_ui_Cfg_MaxLenName]; switch ( _eAction ) { case SCR_EA_Ntfy_AddSection: // go to end of main section SCR_fn_v_SvL1_ToEndSection( _p_stFile ); SCR_fn_v_SvL1_ToPrevLine( _p_stFile ); case SCR_EA_Ntfy_RebuildSection: // indent subsection SCR_g_ui_SvL0_IndentationLevel++; // construct section name SCR_fn_v_RdL0_SplitSectionName( _p_szSectionName, NULL, szActionName, szIdName ) ; SCR_fn_v_RdL0_ComputeSectionName( szSectionName, NULL, szActionName, szIdName ) ; // save begin section SCR_M_SvL0_SaveBeginSection( _p_stFile, szSectionName, SCR_CC_C_Cfg_EOL ); // entry if( p_oSaveObject -> fn_bIsOfType( C_szZATypeName ) ) { if( p_oSaveObject == p_tdoNameList -> m_p_oDefaultZA ) { SCR_M_SvL0_SaveEntry( _p_stFile, C_szDefaultZAEntry, SCR_CC_C_Cfg_NoChar ); } else { SCR_M_SvL0_SaveEntry( _p_stFile, C_szZAEntry, SCR_CC_C_Cfg_NoChar ); } } else if( p_oSaveObject -> fn_bIsOfType( C_szZAListTypeName ) ) { SCR_M_SvL0_SaveEntry( _p_stFile, C_szZAListEntry, SCR_CC_C_Cfg_NoChar ); } else { SCR_M_SvL0_SaveEntry( _p_stFile, C_szObjectsListEntry, SCR_CC_C_Cfg_NoChar ); } SCR_fn_v_SvL0_SaveParameters_MP( _p_stFile, SCR_EF_SvL0_Normal, 1, M_MAKECHAR( p_oSaveObject -> GetReferencedSectionName() ) ); // end section SCR_M_SvL0_SaveEndSection( _p_stFile, SCR_CC_C_Cfg_EOL ) ; // restore indent SCR_g_ui_SvL0_IndentationLevel--; break; } } // MT 13/06/97 } //================================================================================ //bbb 03/03/97 { //find the index of the element in the list with the specified name short CPA_tdoNameList::m_wGetIndexOfName(CString csNameToFind) { POSITION xPos = GetHeadPosition(); tdoObjectName *p_oObjectName; short wIndex = 0; while ( xPos ) { p_oObjectName = GetNext(xPos); if ( !csNameToFind.CompareNoCase(p_oObjectName->GetName()) ) //bbb 24/03/97 return wIndex; wIndex ++; } return CB_ERR; } //bbb 03/03/97 } //bbb 21/03/97 { //================================================================================ BOOL CPA_tdoNameList::m_bIsNameValid(CString csName) { return !g_pclInterface->GetMainWorld()->fn_bExist(csName, "", this); //bbb 04/04/97 } //bbb 21/03/97 } //================================================================================ void CPA_tdoNameList::StaticInit() { SCR_fn_v_RdL0_RegisterCallback( M_MAKECHAR(g_c_csActorScriptNamesListSectionName), CPA_tdoNameList::m_fne_CallBackLoad, SCR_CRC_c_RdL0_ForSection); SCR_fn_v_RdL0_RegisterCallback( C_szNamesListLevelSection, CPA_tdoNameList::m_fne_CallBackLoadOnLevel, SCR_CRC_c_RdL0_ForSection); SCR_fn_v_RdL0_RegisterCallback( C_szListSubSection, CPA_tdoNameList::m_fne_CallBackLoadSubSection, SCR_CRC_c_RdL0_ForSection); SCR_fn_v_RdL0_RegisterCallback( C_szNamesListSubSection, CPA_tdoNameList::m_fne_CallBackLoadNamesList, SCR_CRC_c_RdL0_ForSection); } //================================================================================ EdtList *CPA_tdoNameList::m_fnp_oCreateNewZoneList(char* _szSectionName) { EdtList *pEdtList = NULL; void *p_vEngineList = NULL; char szLinkName[SCR_CV_ui_Cfg_MaxLenName]; char szName[SCR_CV_ui_Cfg_MaxLenName]; SCR_tdst_Link_Table *pLinkTable; SCR_tdst_Link_Value *pLinkValue; // We get the link table for the list of zones pLinkTable = & g_st3DOSLinkTable . stZDXList; // construct Complete Name strcpy (szLinkName, fn_szGetZdxDataPath() ); strcat (szLinkName, "\\" ); strcat( szLinkName, _szSectionName ); // We search the section name of the zone list and it MUST exist pLinkValue = SCR_fnp_st_Link_SearchKey (pLinkTable , szLinkName); // If not in the link table, we analyse the section, and then it MUST be in the link table if (pLinkValue) p_vEngineList = (void *) SCR_M_ul_Link_GetValue (pLinkValue); else { SCR_tdst_Cxt_Values * pContextValue = SCR_fnp_st_RdL0_AnalyseSection (_szSectionName , SCR_CDF_uw_Anl_Normal); p_vEngineList = (void *) SCR_M_ul_RdL0_ExtractLongValue (pContextValue , 0); } // Create the EdtList SCR_fn_v_RdL0_SplitSectionName (_szSectionName,NULL,NULL,szName); pEdtList = m_pEdtListHandler -> fn_poCreateEdtList( this, szName, p_vEngineList, TRUE); return pEdtList; } //================================================================================ CPA_SaveObject *CPA_tdoNameList::m_fnp_oCreateNewZA(char* _szSectionName) { CPA_DLLBase *p_oActionDLL = (CPA_DLLBase*)GetMainWorld() -> GetToolDLLWithName( C_szDLLActionName ); if( p_oActionDLL ) { tdstLoadInfo stLoadInfo; stLoadInfo . m_p_oNameList = this; stLoadInfo . m_szName = _szSectionName; return (CPA_SaveObject*)p_oActionDLL -> OnQueryAction( GetEditor(), C_uiLoadZA, (LPARAM) & stLoadInfo ); } return NULL; } //================================================================================ CPA_SaveObject *CPA_tdoNameList::m_fnp_oCreateNewZAList(char* _szSectionName) { CPA_DLLBase *p_oActionDLL = (CPA_DLLBase*)GetMainWorld() -> GetToolDLLWithName( C_szDLLActionName ); if( p_oActionDLL ) { tdstLoadInfo stLoadInfo; stLoadInfo . m_p_oNameList = this; stLoadInfo . m_szName = _szSectionName; return (CPA_SaveObject*)p_oActionDLL -> OnQueryAction( GetEditor(), C_uiLoadZAList, (LPARAM) & stLoadInfo ); } return NULL; } //================================================================================ tdeMissingCriteria CPA_tdoNameList::fn_eCheckUnicity( const CString csNewName ) { CPA_BaseObject *p_oFamily = GetOwner(); CPA_List oList; long lNbObjects; if (csNewName.IsEmpty()) return E_mc_NoName; // // search NamesList with same name on invalid objects lNbObjects = GetInvalidObjectList() -> fn_lFindObjects( & oList, csNewName, GetType() ); if( lNbObjects > 0 ) // find objects with same name { // search object with same owner POSITION xPos = oList . GetHeadPosition(); while( xPos ) { CPA_BaseObject* p_oNamesList = oList . GetNext( xPos ); if( p_oNamesList -> GetOwner() == p_oFamily ) { // find one object, invalid name return ( E_mc_OwnerUnicity ); } } } oList . RemoveAll(); // search NamesList with same name on valid objects lNbObjects = GetBaseObjectList() -> fn_lFindObjects( & oList, csNewName, GetType() ); if( lNbObjects > 0 ) { // find objects with same name // search object with same family POSITION xPos = oList . GetHeadPosition(); while( xPos ) { CPA_BaseObject* p_oNamesList = oList . GetNext( xPos ); if( p_oNamesList -> GetOwner() == p_oFamily ) { // find one object, invalid name return ( E_mc_OwnerUnicity ); } } } // ok return ( E_mc_None ); } //================================================================================ void CPA_tdoNameList::fn_vNotifySave() { CPA_SaveObject::fn_vNotifySave(); } //================================================================================ void CPA_tdoNameList::fn_vNotifyUnSave() { CPA_SaveObject::fn_vNotifyUnSave(); m_p_oLevelSection -> fn_vDeleteSection(); } //================================================================================ void CPA_tdoNameList::fn_vNotifyRestore() { CPA_SaveObject::fn_vNotifyRestore(); m_p_oLevelSection -> fn_vRestoreSection(); } //================================================================================ void CPA_tdoNameList::fn_vNotifyRename() { char szFileName[SCR_CV_ui_Cfg_MaxLenName]; char szReferencedSectionName[SCR_CV_ui_Cfg_MaxLenName]; char *p_cPoint; char *p_cSlash; CPA_SaveObject::fn_vNotifyRename(); // Names Section SCR_fn_v_RdL0_ComputeSectionName( szReferencedSectionName, (char*)(LPCTSTR)GetReferencedSectionName(), C_szNamesListSubSection, NULL ); m_p_oNamesSection -> fn_vRenameSection( szReferencedSectionName ); // Level section fn_zsGetActualLevelFilename( szFileName, "" ); p_cSlash = strrchr( szFileName, '\\' ); // = "\LevelName." p_cPoint = strrchr( szFileName, '.' ); // = "." sprintf( p_cPoint, "\\Families\\%s\\%s.enl", GetOwner() -> fn_p_szGetName(), GetOwner() -> fn_p_szGetName() ); SCR_fn_v_RdL0_ComputeSectionName( szReferencedSectionName, p_cSlash+1, C_szNamesListLevelSection, fn_p_szGetName() ); // p_cPoint = "\Families\FamilyName\FamilyName.enl\..." // p_cSlash = "\LevelName\Families\FamilyName\FamilyName.enl\..." m_p_oLevelSection -> fn_vRenameSection( szReferencedSectionName ); } //================================================================================ void CPA_tdoNameList::fn_vUpdateReference (CPA_SaveObject *pReferencedObject) { char szSectionName[SCR_CV_ui_Cfg_MaxLenName]; BOOL bOnLevel = FALSE; if( pReferencedObject == this ) { m_p_oNamesSection -> fn_vWriteSection(); return; } // construct name if( pReferencedObject -> fn_bIsOfType( C_szZATypeName ) || pReferencedObject -> fn_bIsOfType( C_szZAListTypeName ) ) { // save to Common File SCR_fn_v_RdL0_ComputeSectionName( szSectionName, (char*)(LPCTSTR)GetCompleteSectionName(), C_szListSubSection, pReferencedObject -> fn_p_szGetType() ); } else { // Way List or Zone List with virge fields if( fn_bIsOfType( C_szWayNameListType ) ) { // save to Levels File SCR_fn_v_RdL0_ComputeSectionName( szSectionName, (char*)(LPCTSTR)m_p_oLevelSection -> GetCompleteSectionName(), C_szListSubSection, fn_p_szGetType() ); bOnLevel = TRUE; } else if (m_bHasAVirgeField()) { if (pReferencedObject->fn_bIsOfType(C_szEdtListTypeName) && m_bHasACommonField() && ((EdtList *)pReferencedObject)->fn_bForModelOnly()) { // save to _Common File SCR_fn_v_RdL0_ComputeSectionName( szSectionName, (char*)(LPCTSTR)GetCompleteSectionName(), C_szListSubSection, fn_p_szGetType() ); } else { // save to Levels File SCR_fn_v_RdL0_ComputeSectionName( szSectionName, (char*)(LPCTSTR)m_p_oLevelSection -> GetCompleteSectionName(), C_szListSubSection, fn_p_szGetType() ); bOnLevel = TRUE; } } else { // save to _Common File SCR_fn_v_RdL0_ComputeSectionName( szSectionName, (char*)(LPCTSTR)GetCompleteSectionName(), C_szListSubSection, fn_p_szGetType() ); } } strcat( szSectionName, "___" ); strcat( szSectionName, pReferencedObject -> fn_p_szGetName() ); if( pReferencedObject -> fn_bIsValid() ) { // notify main section on level file if( bOnLevel && ! m_p_oLevelSection -> fn_bSectionExists() ) m_p_oLevelSection -> fn_vWriteSection ( ) ; // notify AddOrRebuild SCR_fn_v_SvL1_RegisterNotify(szSectionName, m_fnv_CallBackSaveAddENL, pReferencedObject, SCR_EA_Ntfy_AddOrRebuildSection); } else { // notify delete if exists SCR_fn_v_SvL1_RegisterNotify(szSectionName, m_fnv_CallBackSaveAddENL, pReferencedObject, SCR_EA_Ntfy_DeleteIfExists); } } //================================================================================ //================================================================================ //================================================================================ //================================================================================ tdoObjectName::tdoObjectName( CPA_BaseObject *p_oOwner, //the owner name list CString csName /* = "" */, tdeShareMode eMode /* = E_sm_None */ ) : CPA_BaseObject( g_pclInterface, //creating dll g_c_csObjectNameType, //type p_oOwner //owner ) { if ( fn_eRename (csName ) != E_mc_None) SetDefaultUniqueName ( ) ; m_eShareMode = eMode; } //================================================================================ tdoObjectName::tdoObjectName(tdoObjectName *p_oOriginalName) : CPA_BaseObject( g_pclInterface, //creating dll g_c_csObjectNameType, //type p_oOriginalName->GetOwner() //owner ) { CString csName = p_oOriginalName->GetName(); if ( fn_eRename (csName ) != E_mc_None) SetDefaultUniqueName ( ) ; m_eShareMode = p_oOriginalName->m_eShareMode; } //================================================================================ tdoObjectName &tdoObjectName::operator =(CString &r_csString) { fn_eRename(r_csString); return *this; }