// Ini file handling // // Implementation for methods of EDACDoc.hpp // // YB //////////////////////////////////////////////////// #include "StdAfx.h" #include "_AInterf.hpp" #include "EDACDoc.hpp" #include "EDACDgIf.hpp" #include "EDACStrg.hpp" #include "EDACVwAc.hpp" #include "EDACVwMS.hpp" #include "EDACGlob.hpp" #include "EDACActr.hpp" #include "EDACCnst.hpp" //External Modules #include "ErO.h" //End of External Modules #undef CPA_WANTS_IMPORT #undef CPA_EXPORT #define CPA_WANTS_EXPORT #include "_Actors.hpp" #undef CPA_WANTS_EXPORT #define CPA_WANTS_IMPORT ///////////////////////////////////// // Ini file implementation // ///////////////////////////////////// #define C_EdActors_IniSection_Instances "Instances" #define C_EdActors_IniEntry_DisplayModelFields "DisplayModelFields" #define C_EdActors_IniEntry_DisplayUnallocatedMS "DisplayUnallocatedMS" #define C_EdActors_IniEntry_AskForNewInstanceName "AskForNewInstanceName" #define C_EdActors_IniSection_Models "Models" #define C_EdActors_IniEntry_ConfirmAllocation "ConfirmAllocation" #define C_EdActors_IniEntry_ConfirmUnallocation "ConfirmUnallocation" #define C_EdActors_IniSection_Watch "Watch Window" #define C_EdActors_IniEntry_ConfirmSuppression "ConfirmSuppression" #define C_EdActors_IniEntry_AlwaysVisible "AlwaysVisible" #define C_EdActors_IniSection_General "General" #define C_EdActors_IniEntry_SynchroList "SynchroList" #define C_EdActors_IniEntry_GetUnloadedModels "GetUnloadedModels" #define C_EdActors_IniEntry_RestoreGroup "RestoreGroup" #define C_EdActors_IniSection_Help "Help" #define C_EdActors_IniEntry_HelpOnActiveView "HelpOnActiveView" #define C_EdActors_IniSection_Colors "Colors" #define C_EdActors_IniEntry_ColFieldInstText "ColFieldInstText" #define C_EdActors_IniEntry_ColFieldInitialText "ColFieldInitialText" #define C_EdActors_IniEntry_ColFieldCurrentText "ColFieldCurrentText" #define C_EdActors_IniEntry_ColFieldInstBG "ColFieldInstBG" #define C_EdActors_IniEntry_ColFieldInitialBG "ColFieldInitialBG" #define C_EdActors_IniEntry_ColFieldCurrentBG "ColFieldCurrentBG" #define C_EdActors_IniEntry_ColFieldModelText "ColFieldModelText" #define C_EdActors_IniEntry_ColFieldModelBG "ColFieldModelBG" #define C_EdActors_IniEntry_ColFamilyText "ColFamilyText" #define C_EdActors_IniEntry_ColFamilyBG "ColFamilyBG" #define C_EdActors_IniEntry_ColInWatchText "ColInWatchText" #define C_EdActors_IniEntry_ColInWatchBG "ColInWatchBG" #define C_EdActors_IniEntry_ColNameText "ColNameText" #define C_EdActors_IniEntry_ColNameBG "ColNameBG" #define C_EdActors_IniEntry_ColModelText "ColModelText" #define C_EdActors_IniEntry_ColModelBG "ColModelBG" //*************************************************************************** BOOL EdActors_MyDocument::m_fn_bReadIniFile() { CFile file; if ( !file.Open(m_csIniFileName, CFile::modeRead) ) { CString csMessage = CString("The 'Ini' file """) + C_szActorsIniFileName; csMessage += """ can't be found in directory '"; csMessage += m_csIniFileName.Left(m_csIniFileName.ReverseFind('\\')); csMessage += "'\nParameters are set as default ones. They will be saved when you quit."; EdActors_InformationDialog dial(&g_oBaseFrame, csMessage); dial.DoModal(); return FALSE; } else { file.Close(); BOOL bReturn = TRUE; //Reads Instances pref. m_bMustDisplayModelFieldsInInstance = (GetPrivateProfileInt(C_EdActors_IniSection_Instances, C_EdActors_IniEntry_DisplayModelFields, m_bMustDisplayModelFieldsInInstance, LPCTSTR(m_csIniFileName)) != 0); m_bMustDisplayUnallocatedMS = (GetPrivateProfileInt(C_EdActors_IniSection_Instances, C_EdActors_IniEntry_DisplayUnallocatedMS, m_bMustDisplayUnallocatedMS, LPCTSTR(m_csIniFileName)) != 0); m_bAskForNewInstanceName = (GetPrivateProfileInt(C_EdActors_IniSection_Instances, C_EdActors_IniEntry_AskForNewInstanceName, m_bMustDisplayUnallocatedMS, LPCTSTR(m_csIniFileName)) != 0); //Reads Models pref. m_bMustConfirmAllocation = (GetPrivateProfileInt(C_EdActors_IniSection_Models, C_EdActors_IniEntry_ConfirmAllocation, m_bMustConfirmAllocation, LPCTSTR(m_csIniFileName)) != 0); m_bMustConfirmUnallocation = (GetPrivateProfileInt( C_EdActors_IniSection_Models, C_EdActors_IniEntry_ConfirmUnallocation, m_bMustConfirmUnallocation, LPCTSTR(m_csIniFileName)) != 0); //Reads Watch pref. m_bMustConfirmWatchSuppression = (GetPrivateProfileInt( C_EdActors_IniSection_Watch, C_EdActors_IniEntry_ConfirmSuppression, m_bMustConfirmWatchSuppression, LPCTSTR(m_csIniFileName)) != 0); m_bWatchAlwaysVisible = (GetPrivateProfileInt(C_EdActors_IniSection_Watch, C_EdActors_IniEntry_AlwaysVisible, m_bWatchAlwaysVisible, LPCTSTR(m_csIniFileName)) != 0); //Reads General pref. m_bMustSynchronizeDialogListWithEdition = (GetPrivateProfileInt(C_EdActors_IniSection_General, C_EdActors_IniEntry_SynchroList, m_bMustSynchronizeDialogListWithEdition, LPCTSTR(m_csIniFileName)) != 0); m_bProposeUnloadedModels = (GetPrivateProfileInt( C_EdActors_IniSection_General, C_EdActors_IniEntry_GetUnloadedModels, m_bProposeUnloadedModels, LPCTSTR(m_csIniFileName)) != 0); m_bRestoreGroup = (GetPrivateProfileInt(C_EdActors_IniSection_General, C_EdActors_IniEntry_RestoreGroup, m_bRestoreGroup, LPCTSTR(m_csIniFileName)) != 0); //Reads Help pref. m_bMustDisplayHelpOnActiveView = (GetPrivateProfileInt( C_EdActors_IniSection_Help, C_EdActors_IniEntry_HelpOnActiveView, 1, LPCTSTR(m_csIniFileName)) != 0); //Reads colors if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldInstText, (void *)(&m_pub_colref_FieldInstanceTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldInstBG, (void *)(&m_pub_colref_FieldInstanceBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldInitialText, (void *)(&m_pub_colref_FieldInitialTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldInitialBG, (void *)(&m_pub_colref_FieldInitialBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldCurrentText, (void *)(&m_pub_colref_FieldCurrentTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldCurrentBG, (void *)(&m_pub_colref_FieldCurrentBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldModelText, (void *)(&m_pub_colref_FieldModelTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldModelBG, (void *)(&m_pub_colref_FieldModelBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFamilyText, (void *)(&m_pub_colref_FamilyTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFamilyBG, (void *)(&m_pub_colref_FamilyBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColInWatchText, (void *)(&m_pub_colref_InWatchFieldTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColInWatchBG, (void *)(&m_pub_colref_InWatchFieldBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColNameText, (void *)(&m_pub_colref_NameTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColNameBG, (void *)(&m_pub_colref_NameBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColModelText, (void *)(&m_pub_colref_ModelTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = GetPrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColModelBG, (void *)(&m_pub_colref_ModelBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); return bReturn; } } //*************************************************************************** BOOL EdActors_MyDocument::m_fn_bWriteIniFile() { BOOL bReturn = TRUE; //Writes Instances pref. if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bMustDisplayModelFieldsInInstance); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Instances, C_EdActors_IniEntry_DisplayModelFields, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bMustDisplayUnallocatedMS); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Instances, C_EdActors_IniEntry_DisplayUnallocatedMS, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bAskForNewInstanceName); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Instances, C_EdActors_IniEntry_AskForNewInstanceName, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } //Writes Models pref. if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bMustConfirmAllocation); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Models, C_EdActors_IniEntry_ConfirmAllocation, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bMustConfirmUnallocation); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Models, C_EdActors_IniEntry_ConfirmUnallocation, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } //Writes Watch pref. if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bMustConfirmWatchSuppression); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Watch, C_EdActors_IniEntry_ConfirmSuppression, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bWatchAlwaysVisible); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Watch, C_EdActors_IniEntry_AlwaysVisible, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } //Writes General pref. if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bMustSynchronizeDialogListWithEdition); bReturn = WritePrivateProfileString(C_EdActors_IniSection_General, C_EdActors_IniEntry_SynchroList, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bProposeUnloadedModels); bReturn = WritePrivateProfileString(C_EdActors_IniSection_General, C_EdActors_IniEntry_GetUnloadedModels, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bRestoreGroup); bReturn = WritePrivateProfileString(C_EdActors_IniSection_General, C_EdActors_IniEntry_RestoreGroup, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } //Writes Help pref. if ( bReturn ) { CString csStringToWrite; csStringToWrite.Format("%ld", (long)m_bMustDisplayHelpOnActiveView); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Help, C_EdActors_IniEntry_HelpOnActiveView, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } //Writes colors if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldInstText, (void *)(&m_pub_colref_FieldInstanceTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldInstBG, (void *)(&m_pub_colref_FieldInstanceBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldInitialText, (void *)(&m_pub_colref_FieldInitialTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldInitialBG, (void *)(&m_pub_colref_FieldInitialBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldCurrentText, (void *)(&m_pub_colref_FieldCurrentTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldCurrentBG, (void *)(&m_pub_colref_FieldCurrentBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldModelText, (void *)(&m_pub_colref_FieldModelTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFieldModelBG, (void *)(&m_pub_colref_FieldModelBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFamilyText, (void *)(&m_pub_colref_FamilyTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColFamilyBG, (void *)(&m_pub_colref_FamilyBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColInWatchText, (void *)(&m_pub_colref_InWatchFieldTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColInWatchBG, (void *)(&m_pub_colref_InWatchFieldBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColNameText, (void *)(&m_pub_colref_NameTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColNameBG, (void *)(&m_pub_colref_NameBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColModelText, (void *)(&m_pub_colref_ModelTextColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); if ( bReturn ) bReturn = WritePrivateProfileStruct(C_EdActors_IniSection_Colors, C_EdActors_IniEntry_ColModelBG, (void *)(&m_pub_colref_ModelBackgroundColor), sizeof(COLORREF), LPCTSTR(m_csIniFileName)); //Displays a message if ( bReturn ) EDACTORS_fn_vGiveProgressInfo("Actors Editor >>> Ini file updated"); return bReturn; } //*************************************************************************** //*************************************************************************** //*************************************************************************** //*************************************************************************** /////////////////////////////////////////////// // Ini file implementation : dimensions // /////////////////////////////////////////////// #define C_EdActors_IniSection_Dimensions "Dimensions" #define C_EdActors_IniEntry_ListHeight "ListHeight" #define C_EdActors_IniEntry_ControlHeight "ControlHeight" #define C_EdActors_IniEntry_MSHeight "MSHeight" #define C_EdActors_IniEntry_ModelHeight "ModelHeight" #define C_EdActors_IniEntry_AIHeight "AIHeight" #define C_EdActors_IniEntry_CharacEditorWidth "CharacEditorWidth" #define C_EdActors_IniSection_CurrentValues "CurrentSettings" #define C_EdActors_IniEntry_CurrentDisplayed "DisplayCurrent" #define C_EdActors_IniEntry_InitialDisplayed "DisplayInitial" #define C_EdActors_IniEntry_IAActivated "IAActivated" #define C_EdActors_IniEntry_VariablesActivated "VariablesActivated" #define C_EdActors_IniEntry_WatchActivated "WatchActivated" #define C_EdActors_IniEntry_LinksVisible "LinksVisible" #define C_EdActors_IniSection_DialogList "DialogList" #define C_EdActors_IniEntry_Mode "CurrentMode" #define C_EdActors_IniEntry_TreeMustShowUnloadedObjects "TreeMustShowUnloadedObjects" #define C_EdActors_IniEntry_TreeMustShowOnlyFamiliesWithModels "TreeMustShowOnlyFamiliesWithModels" //*************************************************************************** BOOL EdActors_MyDocument::m_pri_fn_bSaveDimensions() { BOOL bReturn = TRUE; CString csStringToWrite; m_pri_fn_vGetEditorCurrentSettings(); if ( bReturn ) { csStringToWrite.Format("%ld", m_ulListViewHeight); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_ListHeight, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", m_ulControlViewHeight); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_ControlHeight, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", m_ulMSViewHeight); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_MSHeight, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", m_ulModelViewHeight); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_ModelHeight, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", m_ulAIViewHeight); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_AIHeight, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", m_ulCharacEditorWidth); bReturn = WritePrivateProfileString(C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_CharacEditorWidth, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } /* if ( bReturn ) { csStringToWrite.Format("%ld", (long)m_ucCurrentDataLevel); bReturn = WritePrivateProfileString(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_CurrentLevel, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } */ if ( bReturn ) { csStringToWrite.Format("%ld", (long)m_bIAActivated); bReturn = WritePrivateProfileString(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_IAActivated, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", (long)m_bVariablesActivated); bReturn = WritePrivateProfileString(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_VariablesActivated, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", (long)m_bDisplayCurrentValue); bReturn = WritePrivateProfileString(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_CurrentDisplayed, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", (long)m_bDisplayInitialValue); bReturn = WritePrivateProfileString(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_InitialDisplayed, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", (long)m_bWatchActivated); bReturn = WritePrivateProfileString(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_WatchActivated, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", (long)m_pub_bMustShowLinks); bReturn = WritePrivateProfileString(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_LinksVisible, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite = m_pclDialogList->GetCurrentType(); bReturn = WritePrivateProfileString(C_EdActors_IniSection_DialogList, C_EdActors_IniEntry_Mode, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", (long)g_pclInterface->m_pri_bTreeMustShowUnloadedObjects); bReturn = WritePrivateProfileString(C_EdActors_IniSection_DialogList, C_EdActors_IniEntry_TreeMustShowUnloadedObjects, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } if ( bReturn ) { csStringToWrite.Format("%ld", (long)g_pclInterface->m_pri_bTreeMustOnlyShowFamiliesWithModels); bReturn = WritePrivateProfileString(C_EdActors_IniSection_DialogList, C_EdActors_IniEntry_TreeMustShowOnlyFamiliesWithModels, LPCTSTR(csStringToWrite), LPCTSTR(m_csIniFileName)); } //Saves Fields in Watch Window if ( bReturn ) bReturn = m_pri_fn_bSaveFieldsInWatch(); //Displays a message if ( bReturn ) EDACTORS_fn_vGiveProgressInfo("Actors Editor >>> Ini file updated"); return bReturn; } //*************************************************************************** BOOL EdActors_MyDocument::m_pri_fn_bLoadDimensions() { CFile file; if ( !file.Open(m_csIniFileName, CFile::modeRead) ) return FALSE; else { file.Close(); BOOL bReturn = TRUE; m_ulListViewHeight = GetPrivateProfileInt(C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_ListHeight, m_ulListViewHeight, LPCTSTR(m_csIniFileName)); m_ulControlViewHeight = GetPrivateProfileInt( C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_ControlHeight, m_ulControlViewHeight, LPCTSTR(m_csIniFileName)); m_ulMSViewHeight = GetPrivateProfileInt(C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_MSHeight, m_ulMSViewHeight, LPCTSTR(m_csIniFileName)); m_ulModelViewHeight = GetPrivateProfileInt( C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_ModelHeight, m_ulModelViewHeight, LPCTSTR(m_csIniFileName)); m_ulAIViewHeight = GetPrivateProfileInt(C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_AIHeight, m_ulAIViewHeight, LPCTSTR(m_csIniFileName)); m_ulCharacEditorWidth = GetPrivateProfileInt( C_EdActors_IniSection_Dimensions, C_EdActors_IniEntry_CharacEditorWidth, m_ulCharacEditorWidth, LPCTSTR(m_csIniFileName)); /* m_ucCurrentDataLevel = GetPrivateProfileInt(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_CurrentLevel, m_ucCurrentDataLevel, LPCTSTR(m_csIniFileName)); */ m_bIAActivated = GetPrivateProfileInt(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_IAActivated, m_bIAActivated, LPCTSTR(m_csIniFileName)); m_bVariablesActivated = GetPrivateProfileInt(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_VariablesActivated, m_bVariablesActivated, LPCTSTR(m_csIniFileName)); m_bDisplayCurrentValue = GetPrivateProfileInt(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_CurrentDisplayed, m_bDisplayCurrentValue, LPCTSTR(m_csIniFileName)); m_bDisplayInitialValue = GetPrivateProfileInt(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_InitialDisplayed, m_bDisplayInitialValue, LPCTSTR(m_csIniFileName)); m_bWatchActivated = GetPrivateProfileInt( C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_WatchActivated, m_bWatchActivated, LPCTSTR(m_csIniFileName)); m_pub_bMustShowLinks = GetPrivateProfileInt(C_EdActors_IniSection_CurrentValues, C_EdActors_IniEntry_LinksVisible, m_pub_bMustShowLinks, LPCTSTR(m_csIniFileName)); char a_256cBuffer[256]; GetPrivateProfileString(C_EdActors_IniSection_DialogList, C_EdActors_IniEntry_Mode, EDAC_C_szModelsList, a_256cBuffer, 256, LPCTSTR(m_csIniFileName)); m_csInitDialogListType = a_256cBuffer; m_pri_bTreeMustShowUnloadedObjects = GetPrivateProfileInt(C_EdActors_IniSection_DialogList, C_EdActors_IniEntry_TreeMustShowUnloadedObjects, m_pri_bTreeMustShowUnloadedObjects, LPCTSTR(m_csIniFileName)); m_pri_bTreeMustOnlyShowFamiliesWithModels = GetPrivateProfileInt( C_EdActors_IniSection_DialogList, C_EdActors_IniEntry_TreeMustShowOnlyFamiliesWithModels, m_pri_bTreeMustOnlyShowFamiliesWithModels, LPCTSTR(m_csIniFileName)); return bReturn; } } //*************************************************************************** void EdActors_MyDocument::m_pri_fn_vGetEditorCurrentSettings() { //Gets views heights m_ulListViewHeight = g_pclInterface->m_pclCaracMainFrame->GetPaneSize(C_ROW_INDEX_LISTS); m_ulControlViewHeight = g_pclInterface->m_pclCaracMainFrame->GetPaneSize(C_ROW_INDEX_CONTROL); m_ulMSViewHeight = g_pclInterface->m_pclCaracMainFrame->GetPaneSize(C_ROW_INDEX_MINI_STRUC); m_ulModelViewHeight = g_pclInterface->GetInterface()->GetModelFrame()->m_oCurPos.bottom - g_pclInterface->GetInterface()->GetModelFrame()->m_oCurPos.top; if(m_pclActorsView &&((CButton *)(m_pclActorsView->GetDlgItem(IDC_CHECK_IA)))->GetCheck()) m_ulAIViewHeight = g_oFrameGest.ma_p_oWinArray[2][3]->m_oCurPos.bottom - g_oFrameGest.ma_p_oWinArray[2][3]->m_oCurPos.top; //Gets Charac frame width CRect crFrameRect; g_pclInterface->m_pclCaracMainFrame->GetClientRect(crFrameRect); m_ulCharacEditorWidth = crFrameRect.Width() - 1; //"-1" because FRMBase adds 1 to initial Width //IA is activated ? m_bIAActivated = ((CButton *)m_pclActorsView->GetDlgItem(IDC_CHECK_IA))->GetCheck(); m_bVariablesActivated = ((CButton *)m_pclActorsView->GetDlgItem(IDC_CHECK_VAR))->GetCheck(); //Watch Window is activated ? m_bWatchActivated = FALSE; // m_bWatchActivated = g_pclInterface->m_pclWatchWindow->m_bIsVisible; } //*************************************************************************** //*************************************************************************** // To save/load fields in Watch // // Uses Scripts tu automatize the Load process BOOL EdActors_MyDocument::m_pri_fn_bSaveFieldsInWatch() { BOOL bReturn = FALSE; /* if ( g_pclInterface->m_pclWatchWindow != NULL ) { //Gets Watch Data list CList *pclWatchDataList = &g_pclInterface->m_pclWatchWindow->m_clWatchDataList; ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Saving fields which are into Watch Window", "EdActors_MyDocument::m_pri_fn_bSaveFieldsInWatch(...)", E_ERROR_GRAVITY_FATAL, "The list of Data in Wathc cannot be found"); ERROR_ASSERT( pclWatchDataList != NULL ); //Gets level file name CString csEditorLevelFileName = m_pri_fn_csGetEditorLevelFileName(); //Gets (and opens) a file according to Scripts SCR_FILE pFile = SCR_M_p_x_File_OpenWrite(M_MAKECHAR(csEditorLevelFileName)); ERROR_ASSERT( pFile != NULL ); SCR_tdst_File_Description tdstFileDesc; SCR_fn_v_File_InitFileDes(&tdstFileDesc, M_MAKECHAR(csEditorLevelFileName), pFile); //Saves Header SCR_M_SvL0_SaveComment(&tdstFileDesc, "********************************"); SCR_M_SvL0_SaveComment(&tdstFileDesc, "**** Fields in Watch Window ****"); SCR_M_SvL0_SaveComment(&tdstFileDesc, "********************************"); SCR_M_SvL0_SaveComment(&tdstFileDesc, "**** Saved by Actors Editor ****"); SCR_M_SvL0_SaveComment(&tdstFileDesc, "********************************"); SCR_M_SvL0_SaveBlankLine(&tdstFileDesc); //Saves fields in Watch BOOL bFirstEntryForActor; CPA_Actor *pclCurrentInstance; long ActorPos = m_clInstancesList.GetHeadPosition(); while ( ActorPos != 0 ) { pclCurrentInstance = (CPA_Actor *)m_clInstancesList.GetNext(ActorPos); bFirstEntryForActor = TRUE; EdActors_WatchData *pclCurrentWatchData; POSITION WatchDataPos = pclWatchDataList->GetHeadPosition(); while ( WatchDataPos != NULL ) { pclCurrentWatchData = pclWatchDataList->GetNext(WatchDataPos); if ( pclCurrentWatchData->m_fn_csGetActorName().CompareNoCase(pclCurrentInstance->GetName()) == 0 ) { //If first entry, adds a section if ( bFirstEntryForActor ) { CString csCurrentSectionName = g_c_csEdActors_ActorInWatchSectionName; csCurrentSectionName += CString(":") + pclCurrentInstance->GetName(); SCR_M_SvL0_SaveBeginSection(&tdstFileDesc, M_MAKECHAR(csCurrentSectionName), SCR_CC_C_Cfg_EOL); bFirstEntryForActor = FALSE; } //Adds an entry in the Actor list (in file) SCR_M_SvL0_SaveEntry(&tdstFileDesc, M_MAKECHAR(g_c_csEdActors_FieldInWatchEntryName), SCR_CC_C_Cfg_NoChar); SCR_fn_v_SvL0_SaveParameters_MP(&tdstFileDesc, SCR_EF_SvL0_Scanf, 2, "%s", M_MAKECHAR(pclCurrentWatchData->m_fn_csGetFieldName())); } } //If a section has been open if ( !bFirstEntryForActor ) { SCR_M_SvL0_SaveEndSection(&tdstFileDesc, SCR_CC_C_Cfg_EOL); SCR_M_SvL0_SaveBlankLine(&tdstFileDesc); } } //Closes Script file SCR_fn_v_File_CloseFileDes(&tdstFileDesc); bReturn = TRUE; }*/ return bReturn; } //*************************************************************************** BOOL EdActors_MyDocument::m_pri_fn_bLoadFieldsInWatch() { BOOL bReturn = FALSE; /* if ( g_pclInterface->m_pclWatchWindow != NULL ) { //Gets level file name CString csEditorLevelFileName = m_pri_fn_csGetEditorLevelFileName(); //If file exists CFile cfFile; if ( cfFile.Open(csEditorLevelFileName, CFile::modeRead) ) { cfFile.Close(); SCR_fnp_st_RdL0_AnalyseSection((char *)LPCTSTR(csEditorLevelFileName), SCR_CDF_uw_Anl_Normal); bReturn = TRUE; } }*/ return bReturn; } //*************************************************************************** // CallBack for Fields in Watch load SCR_tde_Anl_ReturnValue EdActors_MyDocument::m_fn_tdeCallBackLoadFieldsInWatch( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction) { //Working Model static CPA_Actor *s_pclInstance = NULL; CString csAction(_p_szName); //For error Infos ERROR_SET_SCRIPT_INFO(_p_stFile) switch ( _eAction ) { case SCR_EA_Anl_BeginSection: { CString csName(_p_szName); s_pclInstance = (CPA_Actor *)g_pclInterface->GetMainWorld()->fn_p_oFindObject(csName, C_szActorInstanceTypeName); ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Loading fields to put into Watch Window", "EdActors_MyDocument::m_fn_tdeCallBackLoadFieldsInWatch(...)", E_ERROR_GRAVITY_FATAL, "A referenced Instance does not exist"); ERROR_ASSERT( s_pclInstance != NULL ); if ( s_pclInstance != NULL ) { ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Loading fields to put into Watch Window", "EdActors_MyDocument::m_fn_tdeCallBackLoadFieldsInWatch(...)", E_ERROR_GRAVITY_FATAL, "A referenced Actor is not an Instance but a Model"); ERROR_ASSERT( s_pclInstance->m_fn_bIsAnInstance() ); } } break; case SCR_EA_Anl_EndSection: s_pclInstance = NULL; break; case SCR_EA_Anl_Entry: if ( s_pclInstance != NULL ) { //Analyses Model's type if ( csAction.CompareNoCase(g_c_csEdActors_FieldInWatchEntryName) == 0 ) { /* CTL_Editor_Data *pclData; pclData = s_pclInstance->m_fn_pclGetEditorActor()->m_clListOfAMSLists.m_fn_pclGetDataFromName(_ap_szParams[0]); if ( pclData != NULL ) { //Gets motor value pclData->m_fn_vGetMotorData(); g_pclInterface->m_pclWatchWindow->m_fn_vAddValue(pclData); OAC_fn_vSetDataInWatch(pclData, TRUE); }*/ } } break; } return SCR_ERV_Anl_NormalReturn; } //*************************************************************************** CString EdActors_MyDocument::m_pri_fn_csGetEditorLevelFileName() { CString csEditorLevelFileName; //Gets Level Name char a_256cBuffer[256]; CString csLevelExtension(C_ScriptLevelSuffixe); CString csLevelFileName = fn_zsGetActualLevelFilename(a_256cBuffer, C_ScriptAlwaysSuffixe); short wIndex = csLevelFileName.ReverseFind('.'); if ( wIndex != -1 ) csLevelFileName = csLevelFileName.Left(wIndex + 1); csEditorLevelFileName = csLevelFileName + g_c_csEdActors_EditorLevelExtension; return csEditorLevelFileName; }