// EDACVwAc.cpp : implementation file ///////////////////////////////////////////////////////////////////////////// #include "StdAfx.h" //External Modules #include "ACP_Base.h" #include "TAC.h" #include "TFa.h" //End of External Modules #include "_AInterf.hpp" #include "EDACVwAc.hpp" #include "EDACDoc.hpp" #include "EDACFmMn.hpp" #include "EDACDgSp.hpp" #include "EDACDgMN.hpp" #include "EDACDgCp.hpp" #include "EDACDgIf.hpp" #include "EDACCnst.hpp" #include "EDACVwMS.hpp" #include "EDACModl.hpp" #include "EDACInst.hpp" #include "EDACDgUL.hpp" #include "EDACDgAC.hpp" #include "EDACStrg.hpp" //External Modules #include "ErO.h" #include "CTL.h" #include "IncTUT.h" #include "WAW.h" //End of External Modules //-----------------IR------------------------- #include "EdIRDVVw.hpp" #include "EdIRFrm.hpp" #include "EdIRBeEn.hpp" #include "EDACQuer.hpp" // Shaitan => state list in the level #include "ai_intf.hpp" // End Shaitan => state list in the level //-------------------------------------------- //CPA2 Stegaru Cristian 98/07/01 #include "..\inc\edactors\dlgcleanalwfile.h" //End CPA2 Stegaru Cristian 98/07/01 #undef CPA_WANTS_IMPORT #undef CPA_EXPORT #define CPA_WANTS_EXPORT //-----------------IR------------------------- #include "EdIRIRD.hpp" //-------------------------------------------- #include "_Actors.hpp" #undef CPA_WANTS_EXPORT #define CPA_WANTS_IMPORT #define C_ED_ACTORS_GROUP_BUTTON_SPACING 3 #define C_szActorModified " << M >>" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // EdActors_ActorsView IMPLEMENT_DYNCREATE(EdActors_ActorsView, CFormView) BEGIN_MESSAGE_MAP(EdActors_ActorsView, CFormView) //{{AFX_MSG_MAP(EdActors_ActorsView) // ON_BN_CLICKED(IDC_RADIO_LEVEL_1, OnButtonLevel1) // ON_BN_CLICKED(IDC_RADIO_LEVEL_2, OnButtonLevel2) // ON_BN_CLICKED(IDC_RADIO_LEVEL_3, OnButtonLevel3) ON_BN_CLICKED(IDC_CHECK_WATCH, OnButtonWatch) ON_BN_CLICKED(IDC_CHECK_IA, OnCheckModels) ON_BN_CLICKED(IDC_CHECK_VAR, OnCheckVariables) ON_BN_CLICKED(IDC_CHECK_CURRENT, OnCheckCurrent) ON_BN_CLICKED(IDC_CHECK_INIT, OnCheckInitial) ON_WM_HELPINFO() ON_BN_CLICKED(IDC_BUTTON_REDO, OnButtonRedo) ON_BN_CLICKED(IDC_BUTTON_UNDO, OnButtonUndo) ON_BN_CLICKED(IDC_BUTTON_UNDO_ARROW, OnButtonUndoArrow) ON_BN_CLICKED(IDC_BUTTON_REDO_ARROW, OnButtonRedoArrow) ON_BN_CLICKED(IDC_BUTTON_SHOW_MODELS, OnButtonShowModels) ON_BN_CLICKED(IDC_BUTTON_EDIT_MODEL, OnButtonEditModel) ON_BN_CLICKED(IDC_BUTTON_SHOW_INSTANCES, OnButtonShowInstances) ON_BN_CLICKED(IDC_BUTTON_ACTIONS, OnButtonActions) ON_BN_CLICKED(IDC_BUTTON_COPY_MODEL, OnButtonCopy) // Shaitan => state list in the level ON_BN_CLICKED(IDC_BUTTON_GENERATE_STATELIST, OnButtonStateList) // End Shaitan => state list in the level ON_BN_CLICKED(IDC_BUTTON_HELP, OnButtonHelp) ON_WM_LBUTTONUP() ON_WM_MOUSEMOVE() ON_BN_CLICKED(IDC_CHECK_SHOW_LINKS, OnCheckShowLinks) ON_COMMAND(ID_ALWAYS, m_fn_vOnMenuAlways) ON_COMMAND(ID_COMMON, m_fn_vOnMenuCommon) ON_COMMAND(ID_INTO_FIX, m_fn_vOnMenuIntoFix) ON_COMMAND(ID_RENAME_MODEL, m_fn_vRenameModel) ON_COMMAND(ID_REMOVE_MODEL, m_fn_vRemoveModel) ON_COMMAND(ID_RENAME_INSTANCE, m_fn_vRenameInstance) ON_COMMAND(ID_SET_INSTANCE_POSITION_AS_INITIAL, m_fn_vSetInstancePositionAsInitial) ON_COMMAND(ID_ALWAYS_ACTIVE, OnAlwaysActive) ON_WM_DESTROY() ON_BN_CLICKED(IDC_CHECK_ALWAYS_ACTIVE, OnCheckAlwaysActive) ON_BN_CLICKED(IDC_CLEAN_ALW_FILE, OnCleanAlwFile) // ANNECY MT - 19/11/98 { ON_COMMAND(ID_IN_ALL_SUBMAPS, OnInAllSubMaps) ON_BN_CLICKED(IDC_CHECK_IN_ALL_SUBMAPS, OnCheckInAllSubMaps) // END ANNECY MT } //}}AFX_MSG_MAP // ON_NOTIFY( TTN_NEEDTEXT, 0, OnToolTipNotify ) ON_NOTIFY_EX( TTN_NEEDTEXT, 0, OnToolTipNotify ) END_MESSAGE_MAP() //************************************************************************* EdActors_ActorsView::EdActors_ActorsView() : CFormView(EdActors_ActorsView::IDD) { //{{AFX_DATA_INIT(EdActors_ActorsView) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_pclToolTip = NULL; m_pclActorNameStatic = NULL; m_pclModelNameStatic = NULL; m_pclFamilyNameStatic = NULL; } //************************************************************************* EdActors_ActorsView::~EdActors_ActorsView() { //Deletes Tool Tip Control if ( m_pclToolTip ) delete m_pclToolTip; //Deletes Statics if ( m_pclActorNameStatic ) delete m_pclActorNameStatic; if ( m_pclModelNameStatic ) delete m_pclModelNameStatic; if ( m_pclFamilyNameStatic ) delete m_pclFamilyNameStatic; //Deletes Group buttons POSITION pos = m_clListOfGroupButtons.GetHeadPosition(); while ( pos != NULL ) delete ( m_clListOfGroupButtons.GetNext(pos) ); } ///////////////////////////////////////////////////////////////////////////// // EdActors_ActorsView message handlers //************************************************************************* void EdActors_ActorsView::OnInitialUpdate() { HINSTANCE hOldInstance = AfxGetResourceHandle(); AfxSetResourceHandle( g_stActorEditorIdentity.hModule ); //------------------------------------------------------------ CFormView::OnInitialUpdate(); //Sets scroll sizes CRect crButtonRect; GetDlgItem(IDC_CHECK_WATCH)->GetWindowRect(crButtonRect); ScreenToClient(crButtonRect); m_wMinYScrollSize = crButtonRect.bottom + 2; m_wXScrollSize = 0; SetScrollSizes(MM_TEXT, CSize(m_wXScrollSize, m_wMinYScrollSize)); m_fn_pclGetDocument()->m_pclActorsView = this; //Sets Icons in buttons HICON hIcon; //Stefan Dumitrean 14-07-98 ( OAC buttons ) // hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_LEVEL_1); // ((CButton *)GetDlgItem(IDC_RADIO_LEVEL_1))->SetIcon(hIcon); // hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_LEVEL_2); // ((CButton *)GetDlgItem(IDC_RADIO_LEVEL_2))->SetIcon(hIcon); // hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_LEVEL_3); // ((CButton *)GetDlgItem(IDC_RADIO_LEVEL_3))->SetIcon(hIcon); //End Stefan Dumitrean 14-07-98 ( OAC buttons ) hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_WATCH); ((CButton *)GetDlgItem(IDC_CHECK_WATCH))->SetIcon(hIcon); //Stefan Dumitrean 14-07-98 ( OAC buttons ) // hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_EXCLUSIVE_LEVEL); // ((CButton *)GetDlgItem(IDC_CHECK_LEVEL_EXCLUSIVE))->SetIcon(hIcon); //End Stefan Dumitrean 14-07-98 ( OAC buttons ) hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_MODELS_WINDOW); ((CButton *)GetDlgItem(IDC_CHECK_IA))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_VARIABLES_WINDOW); ((CButton *)GetDlgItem(IDC_CHECK_VAR))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_UNDO); ((CButton *)GetDlgItem(IDC_BUTTON_UNDO))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_UNDO_ARROW_DOWN); ((CButton *)GetDlgItem(IDC_BUTTON_UNDO_ARROW))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_REDO); ((CButton *)GetDlgItem(IDC_BUTTON_REDO))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_UNDO_ARROW_DOWN); ((CButton *)GetDlgItem(IDC_BUTTON_REDO_ARROW))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_EDIT_MODEL); ((CButton *)GetDlgItem(IDC_BUTTON_EDIT_MODEL))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_ACTIONS); ((CButton *)GetDlgItem(IDC_BUTTON_ACTIONS))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_COPY_MODEL); ((CButton *)GetDlgItem(IDC_BUTTON_COPY_MODEL))->SetIcon(hIcon); // Shaitan => state list in the level hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_GENERATE_STATELIST); ((CButton *)GetDlgItem(IDC_BUTTON_GENERATE_STATELIST))->SetIcon(hIcon); // End Shaitan => state list in the level hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_HELP); ((CButton *)GetDlgItem(IDC_BUTTON_HELP))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_LINKS); ((CButton *)GetDlgItem(IDC_CHECK_SHOW_LINKS))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_ALWAYS_ACTIVE); ((CButton *)GetDlgItem(IDC_CHECK_ALWAYS_ACTIVE))->SetIcon(hIcon); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_CLEAN_ALW_FILE); ((CButton *)GetDlgItem(IDC_CLEAN_ALW_FILE))->SetIcon(hIcon); // ANNECY MT - 19/11/98 { hIcon = AfxGetApp()->LoadIcon(IDI_CAR_IN_ALL_SUBMAPS); ((CButton *)GetDlgItem(IDC_CHECK_IN_ALL_SUBMAPS))->SetIcon(hIcon); // END ANNECY MT } //Creates tool tips EnableToolTips(TRUE); m_pclToolTip = new CToolTipCtrl; m_pclToolTip->Create(this, WS_VISIBLE | TTS_ALWAYSTIP); //Re-adjusts elements /////////////////////////// CRect crModelButtonRect; GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->GetWindowRect(crModelButtonRect); ScreenToClient(crModelButtonRect); CRect crFirstRect; GetDlgItem(IDC_STATIC_LINE)->GetWindowRect(crFirstRect); ScreenToClient(crFirstRect); //Adjusts the static for the name of the Family CRect crStaticName; CRect crFamilyStaticRect; GetDlgItem(IDC_STATIC_FAMILY)->GetWindowRect(crFamilyStaticRect); ScreenToClient(crFamilyStaticRect); crStaticName.top = crFamilyStaticRect.top; crStaticName.bottom = crFamilyStaticRect.bottom; crStaticName.left = crFamilyStaticRect.right + C_MAIN_VIEW_SPACING; crStaticName.right = crModelButtonRect.left - C_MAIN_VIEW_SPACING; m_pclFamilyNameStatic = new CTL_Editor_Static("", CTL_STATIC_TYPE__USE_USER_DEFINED, SS_CENTER, NULL, this, OAC_STATIC_TYPE__FAMILY_NAME); m_pclFamilyNameStatic->MoveWindow(crStaticName); m_pclFamilyNameStatic->ShowWindow(SW_SHOW); m_pclFamilyNameStatic->m_pub_fn_vSetBackGroundColor(g_pclInterface->m_clDocument.m_pub_colref_FamilyBackgroundColor); m_pclFamilyNameStatic->m_pub_fn_vSetTextColor(g_pclInterface->m_clDocument.m_pub_colref_FamilyTextColor); //Adjusts the static for the name of the Model CRect crModelStaticRect; GetDlgItem(IDC_STATIC_MODEL)->GetWindowRect(crModelStaticRect); ScreenToClient(crModelStaticRect); crStaticName.top = crModelStaticRect.top; crStaticName.bottom = crModelStaticRect.bottom; crStaticName.left = crModelStaticRect.right + C_MAIN_VIEW_SPACING; m_pclModelNameStatic = new CTL_Editor_Static("", CTL_STATIC_TYPE__USE_USER_DEFINED, SS_CENTER, NULL, this, OAC_STATIC_TYPE__MODEL_NAME); m_pclModelNameStatic->MoveWindow(crStaticName); m_pclModelNameStatic->m_pub_fn_vSetStaticHasBeenClicked_CallBack(OAC_fn_vModelNameStaticHasBeenClicked_CallBack); m_pclModelNameStatic->ShowWindow(SW_SHOW); m_pclModelNameStatic->m_pub_fn_vSetBackGroundColor(g_pclInterface->m_clDocument.m_pub_colref_ModelBackgroundColor); m_pclModelNameStatic->m_pub_fn_vSetTextColor(g_pclInterface->m_clDocument.m_pub_colref_ModelTextColor); //Adjusts the static for the name of the Instance CRect crInstanceStaticRect; GetDlgItem(IDC_STATIC_INSTANCE)->GetWindowRect(crInstanceStaticRect); ScreenToClient(crInstanceStaticRect); crStaticName.top = crInstanceStaticRect.top; crStaticName.bottom = crInstanceStaticRect.bottom; crStaticName.left = crInstanceStaticRect.right + C_MAIN_VIEW_SPACING; m_pclActorNameStatic = new CTL_Editor_Static("", CTL_STATIC_TYPE__USE_USER_DEFINED, SS_CENTER, NULL, this, OAC_STATIC_TYPE__INSTANCE_NAME); m_pclActorNameStatic->MoveWindow(crStaticName); m_pclActorNameStatic->m_pub_fn_vSetStaticHasBeenClicked_CallBack(OAC_fn_vInstanceNameStaticHasBeenClicked_CallBack); m_pclActorNameStatic->m_pub_fn_vSetBackGroundColor(g_pclInterface->m_clDocument.m_pub_colref_NameBackgroundColor); m_pclActorNameStatic->m_pub_fn_vSetTextColor(g_pclInterface->m_clDocument.m_pub_colref_NameTextColor); //Sets the current data level //ANNECY Shaitan Correction (16/04/98) { //Stefan Dumitrean 14-07-98 ( OAC buttons ) // m_fn_pclGetDocument()->m_bExclusiveLevel = FALSE; //will be inverted... // OnCheckLevelExclusive(); // ((CButton *)GetDlgItem(IDC_CHECK_LEVEL_EXCLUSIVE))->SetCheck(m_fn_pclGetDocument()->m_bExclusiveLevel); //End Stefan Dumitrean 14-07-98 ( OAC buttons ) //ENDANNECY Shaitan Correction } /* switch ( g_pclInterface->m_clDocument.m_ucCurrentDataLevel ) { case 1: OnButtonLevel1(); ((CButton *)GetDlgItem(IDC_RADIO_LEVEL_1))->SetCheck(1); break; case 2: OnButtonLevel2(); ((CButton *)GetDlgItem(IDC_RADIO_LEVEL_2))->SetCheck(1); break; case 3: OnButtonLevel3(); ((CButton *)GetDlgItem(IDC_RADIO_LEVEL_3))->SetCheck(1); break; default: OnButtonLevel1(); ((CButton *)GetDlgItem(IDC_RADIO_LEVEL_1))->SetCheck(1); break; } */ //Creates buttons for Groups of MS CRect crLastRect; GetDlgItem(IDC_STATIC_LINE_MS)->GetWindowRect(crLastRect); ScreenToClient(crLastRect); EdActors_MiniStructureList *pclMSGroup; unsigned char ucIndex = 0; unsigned char ucNumberOfGroups = m_fn_pclGetDocument()->m_clListOfMSLists.GetCount(); short wButtonWidth = (crLastRect.Width() - (ucNumberOfGroups-1)* C_ED_ACTORS_GROUP_BUTTON_SPACING ) / ucNumberOfGroups; short wXPos = (short)crLastRect.left; CString csGroupButtonText; POSITION pos = m_fn_pclGetDocument()->m_clListOfMSLists.GetHeadPosition(); while( pos != NULL ) { pclMSGroup = m_fn_pclGetDocument()->m_clListOfMSLists.GetNext(pos); csGroupButtonText.Format("%s%i", g_c_csGroupName, ucIndex + 1); //Creates button EdActors_MSGroupButton *pclNewButton = new EdActors_MSGroupButton(ucIndex, csGroupButtonText, wXPos, crLastRect.bottom + C_ED_ACTORS_GROUP_BUTTON_SPACING, wButtonWidth, this); m_clListOfGroupButtons.AddTail(pclNewButton); ucIndex ++; wXPos += (wButtonWidth + C_ED_ACTORS_GROUP_BUTTON_SPACING); //First 'Enable' Init m_pri_bControlsAreEnabled = TRUE; m_pub_fn_vEnableAllControls(FALSE); } ((CButton *)GetDlgItem(IDC_CHECK_IA))->SetCheck(g_pclInterface->m_clDocument.m_bIAActivated); ((CButton *)GetDlgItem(IDC_CHECK_VAR))->SetCheck(g_pclInterface->m_clDocument.m_bVariablesActivated); ((CButton *)GetDlgItem(IDC_CHECK_CURRENT))->SetCheck(g_pclInterface->m_clDocument.m_bDisplayCurrentValue); ((CButton *)GetDlgItem(IDC_CHECK_INIT))->SetCheck(g_pclInterface->m_clDocument.m_bDisplayInitialValue); //-----------------IR------------------------- ((CButton *)GetDlgItem(IDC_CHECK_IA))->EnableWindow(FALSE); //??? //-------------------------------------------- //Watch window initial state ((CButton *)GetDlgItem(IDC_CHECK_WATCH))->SetCheck(g_pclInterface->m_clDocument.m_bWatchActivated); ((CButton *)GetDlgItem(IDC_CHECK_SHOW_LINKS))->SetCheck(g_pclInterface->m_clDocument.m_pub_bMustShowLinks); ////////////// ////////////// //Registers for TUT Module TUT_M_vGetTutDll(); TUT_M_vRegisterControlID(IDC_BUTTON_ACTIONS, "OAc_ControlView_ButtonActions", TUT_e_Button); TUT_M_vRegisterControlID(IDC_CHECK_WATCH, "OAc_ControlView_CheckWatch", TUT_e_Button); TUT_M_vRegisterControlID(IDC_CHECK_IA, "OAc_ControlView_CheckIA", TUT_e_Button); TUT_M_vRegisterControlID(IDC_CHECK_VAR, "OAc_ControlView_CheckVar", TUT_e_Button); TUT_M_vRegisterControlID(IDC_CHECK_CURRENT, "OAc_ControlView_CheckCurrent", TUT_e_Button); TUT_M_vRegisterControlID(IDC_CHECK_INIT, "OAc_ControlView_CheckInit", TUT_e_Button); TUT_M_vRegisterControlID(IDC_BUTTON_HELP, "OAc_ControlView_ButtonHelp", TUT_e_Button); TUT_M_vRegisterControlID(IDC_CHECK_SHOW_LINKS, "OAc_ControlView_CheckShowLinks", TUT_e_Button); /* TUT_M_vRegisterControlID(IDC_RADIO_LEVEL_1, "OAc_ControlView_RadioLevel1", TUT_e_Button); TUT_M_vRegisterControlID(IDC_RADIO_LEVEL_2, "OAc_ControlView_RadioLevel2", TUT_e_Button); TUT_M_vRegisterControlID(IDC_RADIO_LEVEL_3, "OAc_ControlView_RadioLevel3", TUT_e_Button); */ //Stefan Dumitrean 14-07-98 ( OAC buttons ) // TUT_M_vRegisterControlID(IDC_CHECK_LEVEL_EXCLUSIVE, "OAc_ControlView_CheckLevelExclusive", TUT_e_Button); //End Stefan Dumitrean 14-07-98 ( OAC buttons ) TUT_M_vRegisterControlID(IDC_BUTTON_SHOW_MODELS, "OAc_ControlView_ButtonShowModels", TUT_e_Button); TUT_M_vRegisterControlID(IDC_BUTTON_SHOW_INSTANCES, "OAc_ControlView_ButtonShowInstances", TUT_e_Button); TUT_M_vRegisterControlID(IDC_BUTTON_EDIT_MODEL, "OAc_ControlView_ButtonEditModel", TUT_e_Button); TUT_M_vRegisterControlID(IDC_BUTTON_COPY_MODEL, "OAc_ControlView_ButtonCopyModel", TUT_e_Button); // Shaitan => state list in the level TUT_M_vRegisterControlID(IDC_BUTTON_GENERATE_STATELIST, "OAc_ControlView_ButtonGenerateStateList", TUT_e_Button); // End Shaitan => state list in the level TUT_M_vRegisterControlID(IDC_BUTTON_UNDO, "OAc_ControlView_ButtonUndo", TUT_e_Button); TUT_M_vRegisterControlID(IDC_BUTTON_UNDO_ARROW, "OAc_ControlView_ButtonUndoList", TUT_e_Button); TUT_M_vRegisterControlID(IDC_BUTTON_REDO, "OAc_ControlView_ButtonRedo", TUT_e_Button); TUT_M_vRegisterControlID(IDC_BUTTON_REDO_ARROW, "OAc_ControlView_ButtonRedoList", TUT_e_Button); TUT_M_vRegisterControlID(IDC_CHECK_ALWAYS_ACTIVE, "OAc_ControlView_ButtonAlwaysActive", TUT_e_Button); TUT_M_vRegisterControlID(IDC_CLEAN_ALW_FILE, "OAc_ControlView_ButtonCleanAlwFile", TUT_e_Button); // ANNECY MT - 19/11/98 { TUT_M_vRegisterControlID(IDC_CHECK_IN_ALL_SUBMAPS, "OAc_ControlView_ButtonInAllSubMaps", TUT_e_Button); // END ANNECY MT } TUT_M_vRegisterControl(m_pclActorNameStatic->m_hWnd, "OAc_ControlView_StaticInstanceName", TUT_e_Window); TUT_M_vRegisterControl(m_pclModelNameStatic->m_hWnd, "OAc_ControlView_StaticModelName", TUT_e_Window); TUT_M_vRegisterControl(m_pclFamilyNameStatic->m_hWnd, "OAc_ControlView_StaticFamilyName", TUT_e_Window); //End of Registers for TUT Module ////////////// //------------------------------------------------------------ AfxSetResourceHandle( hOldInstance ); } //********************************************************************************* void EdActors_ActorsView::OnDestroy() { ////////////// ////////////// //UnRegisters for TUT Module TUT_M_vGetTutDll(); TUT_M_vUnregisterControlID(IDC_BUTTON_ACTIONS); TUT_M_vUnregisterControlID(IDC_CHECK_WATCH); TUT_M_vUnregisterControlID(IDC_CHECK_IA); TUT_M_vUnregisterControlID(IDC_CHECK_VAR); TUT_M_vUnregisterControlID(IDC_CHECK_CURRENT); TUT_M_vUnregisterControlID(IDC_CHECK_INIT); TUT_M_vUnregisterControlID(IDC_BUTTON_HELP); TUT_M_vUnregisterControlID(IDC_CHECK_SHOW_LINKS); /* TUT_M_vUnregisterControlID(IDC_RADIO_LEVEL_1); TUT_M_vUnregisterControlID(IDC_RADIO_LEVEL_2); TUT_M_vUnregisterControlID(IDC_RADIO_LEVEL_3); TUT_M_vUnregisterControlID(IDC_CHECK_LEVEL_EXCLUSIVE); */ TUT_M_vUnregisterControlID(IDC_BUTTON_SHOW_MODELS); TUT_M_vUnregisterControlID(IDC_BUTTON_SHOW_INSTANCES); TUT_M_vUnregisterControlID(IDC_BUTTON_EDIT_MODEL); TUT_M_vUnregisterControlID(IDC_BUTTON_COPY_MODEL); // Shaitan => state list in the level TUT_M_vUnregisterControlID(IDC_BUTTON_GENERATE_STATELIST); // End Shaitan => state list in the level TUT_M_vUnregisterControlID(IDC_BUTTON_UNDO); TUT_M_vUnregisterControlID(IDC_BUTTON_UNDO_ARROW); TUT_M_vUnregisterControlID(IDC_BUTTON_REDO); TUT_M_vUnregisterControlID(IDC_BUTTON_REDO_ARROW); TUT_M_vUnregisterControlID(IDC_CHECK_ALWAYS_ACTIVE); TUT_M_vUnregisterControlID(IDC_CLEAN_ALW_FILE); // ANNECY MT - 19/11/98 { TUT_M_vUnregisterControlID(IDC_CHECK_IN_ALL_SUBMAPS); // END ANNECY MT } TUT_M_vUnregisterControl(m_pclActorNameStatic->m_hWnd); TUT_M_vUnregisterControl(m_pclModelNameStatic->m_hWnd); TUT_M_vUnregisterControl(m_pclFamilyNameStatic->m_hWnd); //End of UnRegisters for TUT Module ////////////// CFormView::OnDestroy(); } //********************************************************************************* // Updates editor values with motor values and displays the Actor's charac. void EdActors_ActorsView::m_fn_vDisplayActor(EdActors_EditorActor *pclNewSelectedActor) { //Sets the names in edit box if ( pclNewSelectedActor != NULL ) { m_pub_fn_vEnableAllControls(TRUE); //Family name if ( pclNewSelectedActor->m_pclActor->m_pub_fn_pclGetFamily() != NULL ) m_pclFamilyNameStatic->m_fn_vSetTextToDisplay(pclNewSelectedActor->m_pclActor->m_pub_fn_pclGetFamily()->GetName()); else m_pclFamilyNameStatic->m_fn_vSetTextToDisplay("< Unknown >"); if ( pclNewSelectedActor ->m_fn_bIsAnInstance() ) { //Model name (for Instance) if ( ((EdActors_EditorActorInstance *)pclNewSelectedActor)->m_fn_pclGetModel() != NULL ) m_pub_fn_vUpdateActorNameForModif(((EdActors_EditorActorInstance *)pclNewSelectedActor)->m_fn_pclGetModel()); else m_pclModelNameStatic->m_fn_vSetTextToDisplay("< Unknown >"); //Actor's name m_pclActorNameStatic->ShowWindow(SW_SHOW); GetDlgItem(IDC_BUTTON_EDIT_MODEL)->ShowWindow(SW_SHOW); GetDlgItem(IDC_STATIC_INSTANCE)->ShowWindow(SW_SHOW); m_pub_fn_vUpdateActorNameForModif(pclNewSelectedActor->m_pclActor); //Number of Instances in Model long lNumber = pclNewSelectedActor->m_pclActor->m_fn_pclGetModel()->m_fn_pclGetEditorModel()->m_clInstancesList.GetCount(); CString csNumber; csNumber.Format("%ld", lNumber); GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->SetWindowText(csNumber); if ( lNumber < 1 ) GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->EnableWindow(FALSE); else GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->EnableWindow(TRUE); } else { //Model name (for Model) m_pub_fn_vUpdateActorNameForModif(pclNewSelectedActor->m_pclActor); //Actor's name m_pclActorNameStatic->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON_EDIT_MODEL)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC_INSTANCE)->ShowWindow(SW_HIDE); //Number of Instances in Model long lNumber = pclNewSelectedActor->m_pclActor->m_fn_pclGetEditorModel()->m_clInstancesList.GetCount(); CString csNumber; csNumber.Format("%ld", lNumber); GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->SetWindowText(csNumber); if ( lNumber < 1 ) GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->EnableWindow(FALSE); else GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->EnableWindow(TRUE); } //Number of Models in Family //Gets the list of Models which are childs of the Family CPA_List clListOfModels; g_pclInterface->GetMainWorld()->fn_lFindObjects(&clListOfModels, "", C_szActorModelTypeName, pclNewSelectedActor->m_pclActor->m_pub_fn_pclGetFamily()); long lNumber = clListOfModels.GetCount(); CString csNumber; csNumber.Format("%ld", lNumber); GetDlgItem(IDC_BUTTON_SHOW_MODELS)->SetWindowText(csNumber); if ( lNumber < 1 ) GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->EnableWindow(FALSE); else GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->EnableWindow(TRUE); } else { m_pclActorNameStatic->m_fn_vSetTextToDisplay("Empty list ..."); m_pclFamilyNameStatic->m_fn_vSetTextToDisplay(""); m_pclModelNameStatic->m_fn_vSetTextToDisplay(""); m_pub_fn_vEnableAllControls(FALSE); } m_fn_vRefreshNavigationButtons(); m_pclActorNameStatic->InvalidateRect(NULL); m_pclModelNameStatic->InvalidateRect(NULL); m_pclFamilyNameStatic->InvalidateRect(NULL); m_fn_vUpdateUndoRedoButtons(); m_fn_pclGetDocument()->m_pclMiniStrucView->m_fn_vDisplayActor(pclNewSelectedActor); } //Stefan Dumitrean 14-07-98 ( OAC buttons ) //************************************************************************* /* void EdActors_ActorsView::OnButtonLevel1() { // if ( !m_fn_pclGetDocument()->m_aCurrentOACButtonsPressed[0]) // { m_fn_pclGetDocument()->m_aCurrentOACButtonsPressed[0] = !m_fn_pclGetDocument()->m_aCurrentOACButtonsPressed[0]; m_fn_pclGetDocument()->m_pclMiniStrucView->m_fn_vUpdateTree(); //-----------------IR------------------------- if(m_fn_pclGetDocument()->m_pclDesignerVariablesView) EDAC_fn_vDesignerVariableView_UpdateDisplay(m_fn_pclGetDocument()->m_pclDesignerVariablesView); //-------------------------------------------- // } } */ //************************************************************************* /* void EdActors_ActorsView::OnButtonLevel2() { // if ( !m_fn_pclGetDocument()->m_aCurrentOACButtonsPressed[1]) // { m_fn_pclGetDocument()->m_aCurrentOACButtonsPressed[1] = !m_fn_pclGetDocument()->m_aCurrentOACButtonsPressed[1]; m_fn_pclGetDocument()->m_pclMiniStrucView->m_fn_vUpdateTree(); //-----------------IR------------------------- if(m_fn_pclGetDocument()->m_pclDesignerVariablesView) EDAC_fn_vDesignerVariableView_UpdateDisplay(m_fn_pclGetDocument()->m_pclDesignerVariablesView); //-------------------------------------------- // } } */ //************************************************************************* /* void EdActors_ActorsView::OnButtonLevel3() { // if ( !m_fn_pclGetDocument()->m_aCurrentOACButtonsPressed[2]) // { m_fn_pclGetDocument()->m_aCurrentOACButtonsPressed[2] = !m_fn_pclGetDocument()->m_aCurrentOACButtonsPressed[2]; if ( m_fn_pclGetDocument()->m_aCurrentOACButtonsPressed[2] ) GetDlgItem( IDC_RADIO_LEVEL_3 )->SetWindowText("Curr"); else GetDlgItem( IDC_RADIO_LEVEL_3 )->SetWindowText("Init"); m_fn_pclGetDocument()->m_pclMiniStrucView->m_fn_vUpdateTree(); //-----------------IR------------------------- if(m_fn_pclGetDocument()->m_pclDesignerVariablesView) EDAC_fn_vDesignerVariableView_UpdateDisplay(m_fn_pclGetDocument()->m_pclDesignerVariablesView); //-------------------------------------------- // } } */ /* //************************************************************************* void EdActors_ActorsView::OnCheckLevelExclusive() { m_fn_pclGetDocument()->m_bExclusiveLevel = !(m_fn_pclGetDocument()->m_bExclusiveLevel); m_fn_pclGetDocument()->m_pclMiniStrucView->m_fn_vUpdateTree(); //-----------------IR------------------------- if(m_fn_pclGetDocument()->m_pclDesignerVariablesView) EDAC_fn_vDesignerVariableView_UpdateDisplay(m_fn_pclGetDocument()->m_pclDesignerVariablesView); //-------------------------------------------- } */ //End Stefan Dumitrean 14-07-98 ( OAC buttons ) //************************************************************************* void EdActors_ActorsView::OnButtonWatch() { if ( g_pclInterface->m_clDocument.m_pub_bWatchWindowIsVisible ) { WAW_fn_vHideWatchWindow(); g_pclInterface->m_clDocument.m_pub_bWatchWindowIsVisible = FALSE; } else { WAW_fn_vDisplayWatchWindow(); g_pclInterface->m_clDocument.m_pub_bWatchWindowIsVisible = TRUE; // CPA2 ASilvescu 98-05-08 g_pclInterface->m_fn_LoadWatchData(); // End CPA2 ASilvescu 98-05-08 } } //************************************************************************* void EdActors_ActorsView::m_fn_vRefreshNavigationButtons() { GetDlgItem(IDC_BUTTON_EDIT_MODEL)->EnableWindow( (m_fn_pclGetDocument()->m_pclSelectedActor != NULL ) && (m_fn_pclGetDocument()->m_pclSelectedActor->m_fn_bIsAnInstance()) ); } //************************************************************************* EdActors_MyDocument *EdActors_ActorsView::m_fn_pclGetDocument() { return &(g_pclInterface->m_clDocument); } //************************************************************************* //Definition for Tool Tips texts BOOL EdActors_ActorsView::OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult ) { TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR; UINT nID =pNMHDR->idFrom; nID = ::GetDlgCtrlID((HWND)nID); BOOL bReturn = FALSE; switch ( nID ) { case IDC_CHECK_WATCH: strcpy(pTTT->szText,"Display / Hide Watch"); break; case IDC_CHECK_IA: strcpy(pTTT->szText,"Display / Hide IA window"); break; case IDC_CHECK_VAR: strcpy(pTTT->szText,"Display / Hide Variables"); break; case IDC_CHECK_CURRENT: strcpy(pTTT->szText,"Display / Hide Current Values"); break; case IDC_CHECK_INIT: strcpy(pTTT->szText,"Display / Hide Initial Values"); break; /* case IDC_RADIO_LEVEL_1: //Stefan Dumitrean 14-07-98 ( OAC buttons ) // strcpy(pTTT->szText,"Level 1 Data"); strcpy(pTTT->szText,"Display/Hide Behaviour Data"); //End Stefan Dumitrean 14-07-98 ( OAC buttons ) break; case IDC_RADIO_LEVEL_2: //Stefan Dumitrean 14-07-98 ( OAC buttons ) // if ( m_fn_pclGetDocument()->m_bExclusiveLevel ) // strcpy(pTTT->szText,"Level 2 Data"); // else // strcpy(pTTT->szText,"Level 1 and 2 Data"); strcpy(pTTT->szText,"Display/Hide Variables Data"); //End Stefan Dumitrean 14-07-98 ( OAC buttons ) break; case IDC_RADIO_LEVEL_3: //Stefan Dumitrean 14-07-98 ( OAC buttons ) // if ( m_fn_pclGetDocument()->m_bExclusiveLevel ) // strcpy(pTTT->szText,"Level 3 Data"); // else // strcpy(pTTT->szText,"Level 1, 2 and 3 Data"); strcpy(pTTT->szText,"Current/Initial Values Data"); //End Stefan Dumitrean 14-07-98 ( OAC buttons ) break; */ //Stefan Dumitrean 14-07-98 ( OAC buttons ) // case IDC_CHECK_LEVEL_EXCLUSIVE: // strcpy(pTTT->szText,"Only the selected Level / All lower levels"); // break; //End Stefan Dumitrean 14-07-98 ( OAC buttons ) case IDC_BUTTON_UNDO: strcpy(pTTT->szText,"Undo"); break; case IDC_BUTTON_UNDO_ARROW: strcpy(pTTT->szText,"Multiple Undo"); break; case IDC_BUTTON_REDO: strcpy(pTTT->szText,"Redo"); break; case IDC_BUTTON_REDO_ARROW: strcpy(pTTT->szText,"Multiple Redo"); break; case IDC_BUTTON_SHOW_MODELS: strcpy(pTTT->szText,"Shows all Models of the Family"); break; case IDC_BUTTON_EDIT_MODEL: strcpy(pTTT->szText,"Edits the Model of this Instance"); break; case IDC_BUTTON_SHOW_INSTANCES: strcpy(pTTT->szText,"Shows all Instances of the Model"); break; case IDC_BUTTON_ACTIONS: strcpy(pTTT->szText,"Edits Family's Actions"); break; case IDC_CHECK_SHOW_LINKS: strcpy(pTTT->szText,"Shows or hides links controls for each Data"); break; case IDC_BUTTON_COPY_MODEL: if ( g_pclInterface->m_clDocument.m_pub_fn_bCurrentModeIsInstance() ) strcpy(pTTT->szText,"Copy Instance"); else if ( g_pclInterface->m_clDocument.m_pub_fn_bCurrentModeIsModel() ) strcpy(pTTT->szText,"Copy Model"); else if ( g_pclInterface->m_clDocument.m_pub_fn_bCurrentModeIsAlwaysModel() ) strcpy(pTTT->szText,"Copy Always Model"); break; // Shaitan => state list in the level case IDC_BUTTON_GENERATE_STATELIST: // Shaitan => module list in the level strcpy(pTTT->szText,"Generate or update the list of states and POs used by the family in this level"); // End Shaitan => module list in the level break; // End Shaitan => state list in the level case IDC_BUTTON_HELP: strcpy(pTTT->szText,"Help on fields"); break; case IDC_CHECK_ALWAYS_ACTIVE: strcpy (pTTT->szText,"Actor always active"); break; case IDC_CLEAN_ALW_FILE: strcpy (pTTT->szText,"Clean the ALW file"); break; case IDC_CHECK_IN_ALL_SUBMAPS: strcpy (pTTT->szText,"Actor in all SubMaps"); break; default: strcpy(pTTT->szText,""); break; }; return (TRUE); } //************************************************************************* void EdActors_ActorsView::OnButtonSetup() { BOOL bOldValue = m_fn_pclGetDocument()->m_bMustDisplayUnallocatedMS; EdActors_EditorSetupDialog dial(&g_oBaseFrame); if ( dial.DoModal() ==IDOK ) { //Refreshes Editor's actors' view InvalidateRect(NULL); //Prepares and Refreshes editor's MS view if ( (m_fn_pclGetDocument()->m_bMustDisplayUnallocatedMS != bOldValue) && (m_fn_pclGetDocument()->m_bMustDisplayUnallocatedMS) ) { POSITION pos = m_fn_pclGetDocument()->m_pclCurrentMiniStructureList->GetHeadPosition(); while ( pos != NULL ) m_fn_pclGetDocument()->m_pclCurrentMiniStructureList->GetNext(pos)->m_fn_vShowAllControls(); } m_fn_pclGetDocument()->m_pclMiniStrucView->m_fn_vUpdateTree(); //-----------------IR------------------------- //Refreshes editor's IR view m_fn_pclGetDocument()->m_pclDesignerVariablesView->InvalidateRect(NULL); //-------------------------------------------- } } //************************************************************************* void EdActors_ActorsView::OnCheckModels() { g_oFrameGest.mfn_vSetRefresh(FALSE); //-----------------IR------------------------- //Swaps between Models' window and IR Editor if ( ((CButton *)GetDlgItem(IDC_CHECK_IA))->GetCheck() ) { //SHA-TEMP GetDlgItem(IDC_CHECK_VAR)->EnableWindow(TRUE); EDAC_fn_vShowAIEditor(); if(m_fn_pclGetDocument()->m_pclDesignerVariablesView) EDAC_fn_vDesignerVariableView_UpdateState(m_fn_pclGetDocument()->m_pclDesignerVariablesView, !((CButton *) GetDlgItem(IDC_CHECK_VAR))->GetCheck()); if (m_fn_pclGetDocument()->m_bAIFirstTime) g_oFrameGest.ma_p_oWinArray[2][3]->mfn_vHeightWindow(m_fn_pclGetDocument()->m_ulAIViewHeight); m_fn_pclGetDocument()->m_bAIFirstTime = FALSE; g_pclInterface->m_clDocument.m_fn_vDisplayActorIA(); // int nOldHeight=EDAC_fn_lDesignerVariableView_GetOldHeight(m_fn_pclGetDocument()->m_pclDesignerVariablesView); // g_pclInterface->m_pclCaracMainFrame->SetPaneSize(C_ROW_INDEX_DES_VAR,nOldHeight); } else { //SHA-TEMP GetDlgItem(IDC_CHECK_VAR)->EnableWindow(FALSE); EDAC_fn_vHideAIEditor(); g_oFrameGest.mfn_vActivateWindow(g_pclInterface->GetInterface()->GetModelFrame()); if (m_fn_pclGetDocument()->m_bModelFirstTime) g_pclInterface->GetInterface()->GetModelFrame()->mfn_vHeightWindow(m_fn_pclGetDocument()->m_ulModelViewHeight); m_fn_pclGetDocument()->m_bModelFirstTime = FALSE; // int nOldHeight=g_pclInterface->m_pclCaracMainFrame->GetPaneSize(C_ROW_INDEX_DES_VAR); // EDAC_fn_vDesignerVariableView_SetOldHeight(m_fn_pclGetDocument()->m_pclDesignerVariablesView,nOldHeight); // g_pclInterface->m_pclCaracMainFrame->SetPaneSize(C_ROW_INDEX_DES_VAR,C_wCaptionHeight); } //-------------------------------------------- g_oFrameGest.mfn_vSetRefresh(TRUE); } //******************************************************************************* void EdActors_ActorsView::OnCheckVariables() { //-----------------IR------------------------- if(m_fn_pclGetDocument()->m_pclDesignerVariablesView) EDAC_fn_vDesignerVariableView_UpdateState(m_fn_pclGetDocument()->m_pclDesignerVariablesView, !((CButton *) GetDlgItem(IDC_CHECK_VAR))->GetCheck()); //-------------------------------------------- } //******************************************************************************* void EdActors_ActorsView::OnCheckCurrent() { CButton *pCurrent = (CButton *) GetDlgItem(IDC_CHECK_CURRENT); CButton *pInitial = (CButton *) GetDlgItem(IDC_CHECK_INIT); if (pCurrent->GetCheck()) m_fn_pclGetDocument()->m_bDisplayCurrentValue = TRUE; else { m_fn_pclGetDocument()->m_bDisplayCurrentValue = FALSE; if (!m_fn_pclGetDocument()->m_bDisplayInitialValue) { m_fn_pclGetDocument()->m_bDisplayInitialValue = TRUE; pInitial->SetCheck(TRUE); } } m_fn_pclGetDocument()->m_pclMiniStrucView->m_fn_vUpdateTree(); //-----------------IR------------------------- if(m_fn_pclGetDocument()->m_pclDesignerVariablesView) EDAC_fn_vDesignerVariableView_UpdateDisplay(m_fn_pclGetDocument()->m_pclDesignerVariablesView); //-------------------------------------------- } //******************************************************************************* void EdActors_ActorsView::OnCheckInitial() { CButton *pCurrent = (CButton *) GetDlgItem(IDC_CHECK_CURRENT); CButton *pInitial = (CButton *) GetDlgItem(IDC_CHECK_INIT); if (pInitial->GetCheck()) m_fn_pclGetDocument()->m_bDisplayInitialValue = TRUE; else { m_fn_pclGetDocument()->m_bDisplayInitialValue = FALSE; if (!m_fn_pclGetDocument()->m_bDisplayCurrentValue) { m_fn_pclGetDocument()->m_bDisplayCurrentValue = TRUE; pCurrent->SetCheck(TRUE); } } m_fn_pclGetDocument()->m_pclMiniStrucView->m_fn_vUpdateTree(); //-----------------IR------------------------- if(m_fn_pclGetDocument()->m_pclDesignerVariablesView) EDAC_fn_vDesignerVariableView_UpdateDisplay(m_fn_pclGetDocument()->m_pclDesignerVariablesView); //-------------------------------------------- } //******************************************************************************* void EdActors_ActorsView::m_fn_vUpdatePagesButtons(char cPage) { ASSERT( (cPage >= 0) && (cPage < m_fn_pclGetDocument()->m_clListOfMSLists.GetCount()) ); EdActors_MSGroupButton *pclCurrentButton; POSITION pos = m_clListOfGroupButtons.GetHeadPosition(); while ( pos != NULL ) { pclCurrentButton = m_clListOfGroupButtons.GetNext(pos); if ( cPage == pclCurrentButton->m_fn_ucGetListIndex() ) { pclCurrentButton->SetCheck(TRUE); } else pclCurrentButton->SetCheck(FALSE); } } //******************************************************************************* void EdActors_ActorsView::m_fn_vUpdateActorName() { if (m_fn_pclGetDocument()->m_pclSelectedActor) m_pub_fn_vUpdateActorNameForModif(m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor); } //************************************************************************* BOOL EdActors_ActorsView::OnHelpInfo(HELPINFO* pHelpInfo) { DWORD lHelpId = IDH_ACTORS_VIEW; UINT uiCommand = HELP_CONTEXT; //If necessary, searches for the window under mouse if ( !(g_pclInterface->m_clDocument.m_bMustDisplayHelpOnActiveView) ) { CWnd *pclWindow = WindowFromPoint(pHelpInfo->MousePos); if ( pclWindow == (CWnd *)g_pclInterface->m_clDocument.m_pclActorsView ) lHelpId = IDH_ACTORS_VIEW; else if ( pclWindow == (CWnd *)g_pclInterface->m_clDocument.m_pclMiniStrucView ) lHelpId = IDH_MS_VIEW; else { lHelpId = 0; uiCommand = HELP_FINDER; } } ::WinHelp(m_hWnd, LPCTSTR(g_pclInterface->m_clDocument.m_csHelpFileNameAndPath), uiCommand, lHelpId); return FALSE; } ////////////////////////////// // Responses to Popup Menus // ////////////////////////////// //******************************************************************************* //Renames a Model /////////////////////////////////////////////////////////// // NOT TO BE CALLED !! This doesnot work properly !! // /////////////////////////////////////////////////////////// void EdActors_ActorsView::m_fn_vRenameModel() { EdActors_EditorActor *pclEdActor = m_fn_pclGetDocument()->m_pclSelectedActor; ASSERT( !pclEdActor->m_fn_bIsAnInstance() ); CString csOldName = pclEdActor->m_fn_csGetActorName(); EdActors_ActorNameChangeDialog dial(csOldName, &g_oBaseFrame); if (dial.DoModal() == IDOK ) { //Sets actor's name if ( pclEdActor->m_pclActor->fn_eRename(dial.m_csNewName) == E_mc_None ) { pclEdActor->m_pclActor->m_pub_fn_pclGetSuperObject()->SetModelName(dial.m_csNewName); //Refreshes all (in Editor) m_fn_pclGetDocument()->m_fn_vUpdateName(); //Refreshes all (out of Editor) //Removes old Model... EDT_ModelsByType *pclModelList = g_pclInterface->GetInterface()->GetModelsWithTypeName(g_c_csActorModelType); EDT_Model *pclModel = pclModelList->GetModelWithName(csOldName); EDT_Model *pclNewModel = new EDT_Model( pclModel->m_pObjectDLL, pclModel->m_csTypeName, dial.m_csNewName, pclModel->m_csBitmapName, g_pclInterface->GetInterface()); g_pclInterface->GetInterface()->fn_bRemoveAModel(csOldName, g_c_csActorModelType); //...then adds the new one g_pclInterface->GetInterface()->fn_bAddANewModel(pclNewModel, g_c_csActorModelType, g_pclInterface); //TO BE DONE... //Updates Instances and Level //.... } } } //******************************************************************************* //Removes a Model void EdActors_ActorsView::m_fn_vRemoveModel() { } //******************************************************************************* //Renames an Instance void EdActors_ActorsView::m_fn_vRenameInstance() { EdActors_EditorActor *pclEdActor = m_fn_pclGetDocument()->m_pclSelectedActor; ASSERT( pclEdActor->m_fn_bIsAnInstance() ); CString csOldName = pclEdActor->m_fn_csGetActorName(); //ANNECY Shaitan Correction 18/03/98 { HINSTANCE hOldInstance = AfxGetResourceHandle(); AfxSetResourceHandle( g_stActorEditorIdentity.hModule ); //ENDANNECY Shaitan Correction } EdActors_ActorNameChangeDialog dial(csOldName, &g_oBaseFrame); if (dial.DoModal() == IDOK ) { //Sets actor's name pclEdActor->m_pclActor->m_fn_bRename(dial.m_csNewName); } //ANNECY Shaitan Correction 18/03/98 { AfxSetResourceHandle( hOldInstance ); //ENDANNECY Shaitan Correction } } //******************************************************************************* void EdActors_ActorsView::m_fn_vSetInstancePositionAsInitial() { EdActors_EditorActor *pclEdActor = m_fn_pclGetDocument()->m_pclSelectedActor; ASSERT( pclEdActor->m_fn_bIsAnInstance() ); CPA_Actor *pclActor = pclEdActor->m_pclActor; g_pclInterface->m_clDocument.m_fn_vSetCurrentActorPositionAsInitial(pclActor); } //******************************************************************************* void EdActors_ActorsView::m_fn_vOnMenuAlways() { CPA_Actor *pclSelectedActor = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor; ERROR_ASSERT( pclSelectedActor->m_fn_bIsAnInstance() ); ERROR_ASSERT( !pclSelectedActor->m_fn_bIsAPrincipalActor() ); ERROR_ASSERT( !pclSelectedActor->m_fn_bIsTheCurrentMotorCamera() ); //ERROR_ASSERT( !pclSelectedActor->m_fn_bIsTheWorldActor() ); //If always mode and actor -> not always, change it if (pclSelectedActor->m_fn_bIsAnAlways() && m_fn_pclGetDocument()->m_pub_fn_bCurrentModeIsAlwaysModel()) m_fn_pclGetDocument()->m_fn_vSetMode(ED_ACTORS_eDisplayMode_Instance); pclSelectedActor->GetEditor()->M_GetEditManager()->AskFor(new CPA_MakeAlways(m_fn_pclGetDocument(), pclSelectedActor, !pclSelectedActor->m_fn_bIsAnAlways())); // pclSelectedActor->m_fn_vMakeAlways(!pclSelectedActor->m_fn_bIsAnAlways()); } //******************************************************************************* void EdActors_ActorsView::m_fn_vOnMenuCommon() { CPA_Actor *pclSelectedActor = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor; ERROR_ASSERT( pclSelectedActor->m_fn_bIsAnInstance() ); pclSelectedActor->m_pub_fn_vSetCommon(!pclSelectedActor->m_pub_fn_bIsCommon()); } //******************************************************************************* void EdActors_ActorsView::m_fn_vOnMenuIntoFix() { CPA_Actor *pclSelectedActor = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor; ERROR_ASSERT( pclSelectedActor->m_fn_bIsAnInstance() ); pclSelectedActor->m_pub_fn_vSetInFix(!pclSelectedActor->m_pub_fn_bIsInFix()); } //******************************************************************************* void EdActors_ActorsView::OnAlwaysActive() { CPA_Actor *pclSelectedActor = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor; ERROR_ASSERT( pclSelectedActor->m_fn_bIsAnInstance() ); pclSelectedActor->m_pub_fn_vSetAlwaysActive(!pclSelectedActor->m_pub_fn_bIsAlwaysActive()); ((CButton *)GetDlgItem(IDC_CHECK_ALWAYS_ACTIVE))->SetCheck (pclSelectedActor->m_pub_fn_bIsAlwaysActive() ? 1 : 0); } // ANNECY MT - 19/11/98 { //******************************************************************************* void EdActors_ActorsView::OnInAllSubMaps() { CPA_Actor *pclSelectedActor = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor; ERROR_ASSERT( pclSelectedActor->m_fn_bIsAnInstance() ); pclSelectedActor->m_pub_fn_vSetInAllSubMaps(!pclSelectedActor->m_pub_fn_bIsInAllSubMaps()); ((CButton *)GetDlgItem(IDC_CHECK_IN_ALL_SUBMAPS))->SetCheck (pclSelectedActor->m_pub_fn_bIsInAllSubMaps() ? 1 : 0); } // END ANNECY MT } //************************************************************************* //************************************************************************* // Undo / Redo //************************************************************************* void EdActors_ActorsView::OnButtonRedo() { EdActors_EditorActor *pclCurrentActor = m_fn_pclGetDocument()->m_pclSelectedActor; if ( pclCurrentActor->m_clUndoManager.CanRedo() ) { if ( !pclCurrentActor->m_clUndoManager.Redo() ) { CString csMessage = "Actors Editor can not Redo !"; EdActors_InformationDialog InfoDial(&g_oBaseFrame, csMessage); InfoDial.DoModal(); } } m_fn_vUpdateUndoRedoButtons(); } //************************************************************************* void EdActors_ActorsView::OnButtonUndo() { } //************************************************************************* void EdActors_ActorsView::m_fn_vUpdateUndoRedoButtons() { EdActors_EditorActor *pclCurrentActor = m_fn_pclGetDocument()->m_pclSelectedActor; if ( pclCurrentActor != NULL ) { if ( !pclCurrentActor->m_clUndoManager.CanUndo() ) { GetDlgItem(IDC_BUTTON_UNDO)->EnableWindow(FALSE); GetDlgItem(IDC_BUTTON_UNDO_ARROW)->EnableWindow(FALSE); } else { GetDlgItem(IDC_BUTTON_UNDO_ARROW)->EnableWindow(TRUE); GetDlgItem(IDC_BUTTON_UNDO)->EnableWindow(TRUE); } if ( !pclCurrentActor->m_clUndoManager.CanRedo() ) { GetDlgItem(IDC_BUTTON_REDO_ARROW)->EnableWindow(FALSE); GetDlgItem(IDC_BUTTON_REDO)->EnableWindow(FALSE); } else { GetDlgItem(IDC_BUTTON_REDO_ARROW)->EnableWindow(TRUE); GetDlgItem(IDC_BUTTON_REDO)->EnableWindow(TRUE); } } else { GetDlgItem(IDC_BUTTON_UNDO)->EnableWindow(FALSE); GetDlgItem(IDC_BUTTON_UNDO_ARROW)->EnableWindow(FALSE); GetDlgItem(IDC_BUTTON_REDO)->EnableWindow(FALSE); } } //************************************************************************* void EdActors_ActorsView::OnButtonUndoArrow() { HICON hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_UNDO_ARROW_UP); ((CButton *)GetDlgItem(IDC_BUTTON_UNDO_ARROW))->SetIcon(hIcon); CRect crUndoButtonRect; GetDlgItem(IDC_BUTTON_UNDO)->GetWindowRect(crUndoButtonRect); CPoint clPoint; clPoint.x = crUndoButtonRect.left; clPoint.y = crUndoButtonRect.bottom; EdActors_UndoRedoListDialog dial(clPoint, EdActors_UndoRedoListDialog::EDCAR_UNDOREDO_LIST_TYPE_UNDO, &g_oBaseFrame); dial.DoModal(); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_UNDO_ARROW_DOWN); ((CButton *)GetDlgItem(IDC_BUTTON_UNDO_ARROW))->SetIcon(hIcon); } //************************************************************************* void EdActors_ActorsView::OnButtonRedoArrow() { HICON hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_UNDO_ARROW_UP); ((CButton *)GetDlgItem(IDC_BUTTON_REDO_ARROW))->SetIcon(hIcon); CRect crUndoButtonRect; GetDlgItem(IDC_BUTTON_REDO)->GetWindowRect(crUndoButtonRect); CPoint clPoint; clPoint.x = crUndoButtonRect.left; clPoint.y = crUndoButtonRect.bottom; EdActors_UndoRedoListDialog dial(clPoint, EdActors_UndoRedoListDialog::EDCAR_UNDOREDO_LIST_TYPE_REDO, &g_oBaseFrame); dial.DoModal(); hIcon = AfxGetApp()->LoadIcon(IDI_CAR_BUTTON_UNDO_ARROW_DOWN); ((CButton *)GetDlgItem(IDC_BUTTON_REDO_ARROW))->SetIcon(hIcon); } //************************************************************************* void EdActors_ActorsView::OnButtonShowModels() { //Shows all Models of the current Family if ( m_fn_pclGetDocument()->m_pclSelectedActor != NULL ) { //Opens a box with all Models of the Family CPA_Family *pclFamily = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor->m_pub_fn_pclGetFamily(); CRect crButtonRect; GetDlgItem(IDC_BUTTON_SHOW_MODELS)->GetWindowRect(crButtonRect); EdActors_Dialog_ActorChoice dial(pclFamily, CPoint(crButtonRect.left, crButtonRect.bottom + 1)); if ( (dial.DoModal() == IDOK) && (dial.m_pclSelectedActor != NULL) ) m_fn_pclGetDocument()->m_fn_vDisplayActor(dial.m_pclSelectedActor, ED_ACTORS_eModeOfActorSelection_InActorsView); } } //************************************************************************* void EdActors_ActorsView::OnButtonEditModel() { if ( m_fn_pclGetDocument()->m_pclSelectedActor != NULL ) { //Edits the Model of the Instance ERROR_ASSERT( m_fn_pclGetDocument()->m_pclSelectedActor->m_fn_bIsAnInstance() ); EdActors_EditorActor *pclNewSelectedActor = m_fn_pclGetDocument()->m_pclSelectedActor-> m_pclActor->m_fn_pclGetModel()->m_fn_pclGetEditorActor(); m_fn_pclGetDocument()->m_fn_vDisplayActor(pclNewSelectedActor, ED_ACTORS_eModeOfActorSelection_InActorsView); } } //************************************************************************* void EdActors_ActorsView::OnButtonShowInstances() { if ( m_fn_pclGetDocument()->m_pclSelectedActor != NULL ) { //Opens a box with all instances of the Model CPA_Actor *pclModel; if ( m_fn_pclGetDocument()->m_pclSelectedActor->m_fn_bIsAnInstance() ) pclModel = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor->m_fn_pclGetModel(); else pclModel = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor; CRect crButtonRect; GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->GetWindowRect(crButtonRect); EdActors_Dialog_ActorChoice dial(pclModel, CPoint(crButtonRect.left, crButtonRect.bottom + 1)); if ( (dial.DoModal() == IDOK) && (dial.m_pclSelectedActor != NULL) ) m_fn_pclGetDocument()->m_fn_vDisplayActor(dial.m_pclSelectedActor, ED_ACTORS_eModeOfActorSelection_InActorsView); } } //************************************************************************* void EdActors_ActorsView::OnButtonActions() { //Calls Action DLL CPA_ToolDLLBase *pclActionDLL = g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLActionName); if(m_fn_pclGetDocument()->m_pclSelectedActor!=NULL) { CPA_Actor *pclCurrentActor = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor; ERROR_ASSERT( pclActionDLL != NULL ); ERROR_ASSERT( pclCurrentActor != NULL ); ERROR_ASSERT( pclCurrentActor->m_pub_fn_pclGetFamily() != NULL ); if ( pclActionDLL != NULL ) { CPA_List pclBaseObjectList; pclBaseObjectList.AddTail(pclCurrentActor->m_pub_fn_pclGetFamily()); g_pclInterface->GetMainWorld()->fn_bActivateEditor(pclActionDLL, &pclBaseObjectList); } } } //************************************************************************* void EdActors_ActorsView::OnCheckShowLinks() { g_pclInterface->m_clDocument.m_pub_bMustShowLinks = ((CButton *)GetDlgItem(IDC_CHECK_SHOW_LINKS))->GetCheck(); g_pclInterface->m_clDocument.m_pclMiniStrucView->m_fn_vUpdateTree(); //-----------------IR------------------------- if(m_fn_pclGetDocument()->m_pclDesignerVariablesView) EDAC_fn_vDesignerVariableView_UpdateDisplay(m_fn_pclGetDocument()->m_pclDesignerVariablesView); //-------------------------------------------- } //************************************************************************* void EdActors_ActorsView::m_pub_fn_vUpdateActorNameForModif(CPA_Actor *_pclSendingActor) { if ( m_fn_pclGetDocument()->m_pclSelectedActor != NULL ) { if ( _pclSendingActor == m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor ) { CString csActorName = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor->GetName(); if ( m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor->m_pub_fn_bHasBeenModified() ) csActorName += CString(C_szActorModified); if ( m_fn_pclGetDocument()->m_pclSelectedActor->m_fn_bIsAnInstance() ) { m_pclActorNameStatic->m_fn_vSetTextToDisplay(csActorName, TRUE); } else m_pclModelNameStatic->m_fn_vSetTextToDisplay(csActorName, TRUE); } else if ( m_fn_pclGetDocument()->m_pclSelectedActor->m_fn_bIsAnInstance() ) { //Updates Model's name CPA_Actor *pclModel = ((EdActors_EditorActorInstance *)m_fn_pclGetDocument()->m_pclSelectedActor)->m_fn_pclGetModel(); CString csActorName = pclModel->GetName(); if ( pclModel->m_pub_fn_bHasBeenModified() ) csActorName += CString(C_szActorModified); m_pclModelNameStatic->m_fn_vSetTextToDisplay(csActorName, TRUE); } } } //************************************************************************* void EdActors_ActorsView::OnButtonCopy() { //Gets current model CPA_Actor *pclSourceActor = NULL; if ( ( g_pclInterface->m_clDocument.m_pub_fn_bCurrentModeIsModel() ) && ( g_pclInterface->m_clDocument.m_pclCurrentModel != NULL ) ) pclSourceActor = g_pclInterface->m_clDocument.m_pclCurrentModel->m_pclActor; else if ( ( g_pclInterface->m_clDocument.m_pub_fn_bCurrentModeIsInstance() ) && ( g_pclInterface->m_clDocument.m_pclCurrentInstance != NULL ) ) pclSourceActor = g_pclInterface->m_clDocument.m_pclCurrentInstance->m_pclActor; if( pclSourceActor != NULL ) { g_pclInterface->m_clDocument.m_fn_vCreateCopiesOfActor(pclSourceActor); } } // Shaitan => state list in the level //************************************************************************* void EdActors_ActorsView::OnButtonStateList() { if (g_pclInterface->m_bCanGenerateOptimizedLevel) { CPA_Family *pFamily; // get current family pFamily = (CPA_Family *) g_pclInterface->m_clDocument.m_pclCurrentFamily; // update actions references g_pclInterface->m_clDocument.m_fn_vUpdateReferencesForAllActions(); // update and notify the state list of the family g_pclInterface->m_clDocument.m_fn_vUpdateListOfUsedActionsForFamily(pFamily); // Shaitan => module list in the level // update the object table list of the family g_pclInterface->m_clDocument.m_fn_vUpdateListOfUsedObjectTablesForFamily(pFamily); // update and notify the PO list of the family g_pclInterface->m_clDocument.m_fn_vUpdateListOfUsedPOsForFamily(pFamily); // End Shaitan => module list in the level } } // End Shaitan => state list in the level //************************************************************************* void EdActors_ActorsView::m_pub_fn_vEnableAllControls(BOOL _bEnable) { if ( _bEnable != m_pri_bControlsAreEnabled ) { //Resources controls /* GetDlgItem(IDC_RADIO_LEVEL_1)->EnableWindow(_bEnable); GetDlgItem(IDC_RADIO_LEVEL_2)->EnableWindow(_bEnable); GetDlgItem(IDC_RADIO_LEVEL_3)->EnableWindow(_bEnable); */ GetDlgItem(IDC_CHECK_WATCH)->EnableWindow(_bEnable); //Stefan Dumitrean 14-07-98 ( OAC buttons ) // GetDlgItem(IDC_CHECK_LEVEL_EXCLUSIVE)->EnableWindow(_bEnable); //End Stefan Dumitrean 14-07-98 ( OAC buttons ) GetDlgItem(IDC_CHECK_IA)->EnableWindow(_bEnable); //SHA-TEMP // GetDlgItem(IDC_CHECK_VAR)->EnableWindow(_bEnable); GetDlgItem(IDC_CHECK_VAR)->EnableWindow(_bEnable && ((CButton *)GetDlgItem(IDC_CHECK_IA))->GetCheck()); GetDlgItem(IDC_CHECK_CURRENT)->EnableWindow(_bEnable); GetDlgItem(IDC_CHECK_INIT)->EnableWindow(_bEnable); GetDlgItem(IDC_BUTTON_UNDO)->EnableWindow(_bEnable); GetDlgItem(IDC_BUTTON_UNDO_ARROW)->EnableWindow(_bEnable); GetDlgItem(IDC_BUTTON_REDO)->EnableWindow(_bEnable); GetDlgItem(IDC_BUTTON_REDO_ARROW)->EnableWindow(_bEnable); GetDlgItem(IDC_BUTTON_EDIT_MODEL)->EnableWindow(_bEnable); GetDlgItem(IDC_BUTTON_SHOW_INSTANCES)->EnableWindow(_bEnable); GetDlgItem(IDC_BUTTON_SHOW_MODELS)->EnableWindow(_bEnable); GetDlgItem(IDC_BUTTON_ACTIONS)->EnableWindow(_bEnable); GetDlgItem(IDC_BUTTON_COPY_MODEL)->EnableWindow(_bEnable); // Shaitan => state list in the level GetDlgItem(IDC_BUTTON_GENERATE_STATELIST)->EnableWindow(_bEnable && g_pclInterface->m_bCanGenerateOptimizedLevel); // End Shaitan => state list in the level GetDlgItem(IDC_BUTTON_HELP)->EnableWindow(_bEnable); GetDlgItem(IDC_CHECK_ALWAYS_ACTIVE)->EnableWindow(_bEnable && mfn_bIsAlwaysActiveEnabled ()); GetDlgItem(IDC_CHECK_IN_ALL_SUBMAPS)->EnableWindow(_bEnable && mfn_bIsInAllSubMapsEnabled ()); //Other controls POSITION pos = m_clListOfGroupButtons.GetHeadPosition(); while ( pos != NULL ) m_clListOfGroupButtons.GetNext(pos)->EnableWindow(_bEnable); m_pri_bControlsAreEnabled = _bEnable; } //CPA2 Stegaru Cristian 98/06/30 GetDlgItem(IDC_CLEAN_ALW_FILE)->EnableWindow (TRUE); //End CPA2 Stegaru Cristian 98/06/30 } //************************************************************************* void EdActors_ActorsView::OnButtonHelp() { g_pclInterface->m_clDocument.m_pub_bMustDisplayHelpOnFields = !g_pclInterface->m_clDocument.m_pub_bMustDisplayHelpOnFields; if ( g_pclInterface->m_clDocument.m_pub_bMustDisplayHelpOnFields ) { SetCapture(); g_pclInterface->m_clDocument.m_hPreviousCursorForHelpOnFields = SetCursor(g_pclInterface->m_clDocument.m_hHelpCursor); } else { SetCursor(g_pclInterface->m_clDocument.m_hPreviousCursorForHelpOnFields); g_pclInterface->m_clDocument.m_hPreviousCursorForHelpOnFields = NULL; ReleaseCapture(); } } //************************************************************************* void EdActors_ActorsView::OnMouseMove(UINT nFlags, CPoint point) { if ( g_pclInterface->m_clDocument.m_pub_bMustDisplayHelpOnFields ) { //Converts the point CPoint cpTruePoint = point; ClientToScreen(&cpTruePoint); //Gets the window under the cursor CWnd *pclWindow = WindowFromPoint(cpTruePoint); //Tests if window under cursor is a Static of Characteristics Editor BOOL bHelpEnabled = FALSE; if ( pclWindow->IsKindOf(RUNTIME_CLASS(CTL_Editor_Static)) ) bHelpEnabled = ( ((CTL_Editor_Static *)pclWindow)->m_pub_fn_tdeGetType() == CTL_STATIC_TYPE__FIELD_NAME ); SetCursor(bHelpEnabled ? g_pclInterface->m_clDocument.m_hHelpCursor : g_pclInterface->m_clDocument.m_hHelpDisabledCursor); } CFormView::OnMouseMove(nFlags, point); } //************************************************************************* void EdActors_ActorsView::OnLButtonUp(UINT nFlags, CPoint point) { if ( g_pclInterface->m_clDocument.m_pub_bMustDisplayHelpOnFields ) { //Converts the point CPoint cpTruePoint = point; ClientToScreen(&cpTruePoint); //Gets the window under the cursor CWnd *pclWindow = WindowFromPoint(cpTruePoint); //Tests if window under cursor is a Static of Characteristics Editor if ( pclWindow->IsKindOf(RUNTIME_CLASS(CTL_Editor_Static)) ) { CTL_Editor_Static *pclMyStatic = (CTL_Editor_Static *)pclWindow; if ( pclMyStatic->m_pub_fn_tdeGetType() == CTL_STATIC_TYPE__FIELD_NAME ) { //Displays Help ::WinHelp(m_hWnd, LPCTSTR(g_pclInterface->m_clDocument.m_csHelpFileNameAndPath), HELP_CONTEXTPOPUP, OAC_fn_tdeGetLevelOfControl( pclMyStatic->m_pub_fn_pclGetParentControl() ) ); } } SetCursor(g_pclInterface->m_clDocument.m_hPreviousCursorForHelpOnFields); g_pclInterface->m_clDocument.m_hPreviousCursorForHelpOnFields = NULL; g_pclInterface->m_clDocument.m_pub_bMustDisplayHelpOnFields = FALSE; ReleaseCapture(); } CFormView::OnLButtonUp(nFlags, point); } //************************************************************************* //************************************************************************* ///////////////////////////////////////////////////////////////////////////// // EdActors_ActorsView diagnostics #ifdef _DEBUG void EdActors_ActorsView::AssertValid() const { CFormView::AssertValid(); } void EdActors_ActorsView::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } #endif //_DEBUG ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : OnCheckAlwaysActive // Date : 98-05 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA2 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void EdActors_ActorsView::OnCheckAlwaysActive() { CPA_Actor *pclSelectedActor = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor; ERROR_ASSERT( pclSelectedActor->m_fn_bIsAnInstance() ); pclSelectedActor->m_pub_fn_vSetAlwaysActive(!pclSelectedActor->m_pub_fn_bIsAlwaysActive()); } // ANNECY MT - 19/11/98 { ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : OnCheckInAllSubMaps // Date : 98-05 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Marc Trabucato ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void EdActors_ActorsView::OnCheckInAllSubMaps() { CPA_Actor *pclSelectedActor = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor; ERROR_ASSERT( pclSelectedActor->m_fn_bIsAnInstance() ); pclSelectedActor->m_pub_fn_vSetInAllSubMaps(!pclSelectedActor->m_pub_fn_bIsInAllSubMaps()); } // END ANNECY MT } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : mfn_bIsAlwaysActiveEnabled // Date : 98-05 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA2 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// BOOL EdActors_ActorsView::mfn_bIsAlwaysActiveEnabled (void) { BOOL bEnabled = FALSE; CPA_Actor *pclSelectedActor = NULL; if (m_fn_pclGetDocument()->m_pclSelectedActor && (pclSelectedActor = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor)) { if (pclSelectedActor->m_fn_bIsAnInstance()) bEnabled = !pclSelectedActor->m_fn_bIsAnAlways() /*&& !pclSelectedActor->m_fn_bIsTheWorldActor()*/; } return bEnabled; } // ANNECY MT - 19/11/98 { ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : mfn_bIsInAllSubMapsEnabled // Date : 98-05 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Marc Trabucato ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// BOOL EdActors_ActorsView::mfn_bIsInAllSubMapsEnabled (void) { BOOL bEnabled = FALSE; CPA_Actor *pclSelectedActor = NULL; if (m_fn_pclGetDocument()->m_pclSelectedActor && (pclSelectedActor = m_fn_pclGetDocument()->m_pclSelectedActor->m_pclActor)) { if (pclSelectedActor->m_fn_bIsAnInstance()) bEnabled = !pclSelectedActor->m_fn_bIsAnAlways() /*&& !pclSelectedActor->m_fn_bIsTheWorldActor()*/; } return bEnabled; } // END ANNECY MT } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : OnCleanAlwFile // Date : 98/06/30 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void EdActors_ActorsView::OnCleanAlwFile() { CWaitCursor wait; CStringList lstOfRefAlways; //treat regular models Position pos = g_pclInterface->m_clDocument.m_clModelsList.GetHeadPosition (); while (pos) { CPA_Actor *pModel = (CPA_Actor *)g_pclInterface->m_clDocument.m_clModelsList.GetNext (pos); if (!pModel || !pModel->m_fn_bIsAModel ()) continue; g_pclInterface->m_clDocument.mfn_vFillRefAlwaysForModel (pModel, lstOfRefAlways); } //treat always models pos = g_pclInterface->m_clDocument.m_clAlwaysList.GetHeadPosition (); while (pos) { CPA_Actor *pModel = (CPA_Actor *)g_pclInterface->m_clDocument.m_clAlwaysList.GetNext (pos); if (!pModel || !pModel->m_fn_bIsAModel ()) continue; g_pclInterface->m_clDocument.mfn_vFillRefAlwaysForModel (pModel, lstOfRefAlways); } //prepare the list of always loaded and not referenced CStringList lstOfLoadedAlwaysNotReferenced; Position posA = g_pclInterface->m_clDocument.m_clAlwaysList.GetHeadPosition (); while (posA) { CPA_BaseObject *pAlways = g_pclInterface->m_clDocument.m_clAlwaysList.GetNext (posA); ASSERT (pAlways); CString csAlways = pAlways->GetName(); csAlways.MakeLower(); BOOL bAlwaysIsReferenced = (lstOfRefAlways.Find(csAlways) != NULL); if (!bAlwaysIsReferenced) lstOfLoadedAlwaysNotReferenced.AddTail(pAlways->GetName()); } CDlgCleanAlwFile dlg (lstOfLoadedAlwaysNotReferenced, TASK_CLEAN_ALW_FILE); if (IDOK == dlg.DoModal ()) { //clean the alw file CStringList &rlstOfAlwaysToBeRemoved = lstOfLoadedAlwaysNotReferenced; //the dialog fills the list with the always to be removed //change the name in order not to propagate confusion g_pclInterface->M_GetEditManager ()->AskFor (new ModifCleanAlwFile (g_pclInterface, rlstOfAlwaysToBeRemoved)); } } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : ModifCleanAlwFile // Date : 98/07/15 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// ModifCleanAlwFile::ModifCleanAlwFile (CPA_Actor_Editor_Interface *pInterface, CStringList &rlstAlwObjects, BOOL pBlock/* = FALSE*/) : CPA_Modif (CLEAN_ALW_FILE, "CleanAlwFile", pBlock) { m_pInterface = pInterface; m_lstAlwObjects.AddHead (&rlstAlwObjects); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : Do // Date : 98/07/15 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// BOOL ModifCleanAlwFile::Do () { ASSERT (m_pInterface); int iReinitDialog = 0; Position posAlw = m_pInterface->m_clDocument.m_clAlwaysList.GetHeadPosition (); while (posAlw) { CPA_Actor *pAlways = (CPA_Actor *)m_pInterface->m_clDocument.m_clAlwaysList.GetNext (posAlw); ASSERT (pAlways); BOOL bRemoveIt = NULL != m_lstAlwObjects.Find (pAlways->GetName ()); //remove the always that are choosed to be removed if (bRemoveIt) iReinitDialog = m_pInterface->mfn_bUnloadAlwaysFromLevel (pAlways) ? posAlw = m_pInterface->m_clDocument.m_clAlwaysList.GetHeadPosition (), //there is a bug in the list implementatin, so I have to reinitialize the list pos after I delete an element iReinitDialog + 1 : iReinitDialog; } if (0 < iReinitDialog) { ASSERT (m_pInterface->m_clDocument.m_pclDialogList); m_pInterface->m_clDocument.m_pclDialogList->fn_vReinitDialog (); } return TRUE; } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : Undo // Date : 98/07/15 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// BOOL ModifCleanAlwFile::Undo () { int iReinitDialog = 0; POSITION pos = m_lstAlwObjects.GetHeadPosition (); while (pos) { CString csAlwName = m_lstAlwObjects.GetNext (pos); if (csAlwName.IsEmpty ()) continue; CPA_UnloadedAlways *pUAlways = NULL; BOOL bFound = FALSE; Position posUA = m_pInterface->m_clDocument.m_clUnloadedAlwaysList.GetHeadPosition (); while (posUA) { pUAlways = (CPA_UnloadedAlways *)m_pInterface->m_clDocument.m_clUnloadedAlwaysList.GetNext (posUA); if (csAlwName == pUAlways->mfn_csGetUAlwaysName ()) { bFound = TRUE; break; } } if (!bFound) return FALSE; ASSERT (pUAlways); m_pInterface->m_clDocument.m_clUnloadedAlwaysList.fn_bRemoveObject (pUAlways); m_pInterface->mfn_vLoadAlways (pUAlways); pUAlways->mfn_vSetLoaded (TRUE); iReinitDialog++; } if (0 < iReinitDialog) m_pInterface->m_clDocument.m_pclDialogList->fn_vReinitDialog (); return TRUE; }