reman3/Rayman_X/cpa/tempgrp/OAC/Src/EdActors/EDACDgSp.cpp

804 lines
31 KiB
C++

// CPACSetp.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Defines.hpp"
#include "EDACDgSp.hpp"
#include "_AInterf.hpp"
#include "EDACVwMS.hpp"
//External Modules
#include "IncTUT.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define OAC_SETUP_sz_SECTION_GENERAL "General"
#define OAC_SETUP_sz_SECTION_ACTORS "Actors"
#define OAC_SETUP_sz_SECTION_MODELS "Models"
#define OAC_SETUP_sz_SECTION_INSTANCES "Instances"
#define OAC_SETUP_sz_SECTION_WATCH "Watch Window"
#define OAC_SETUP_sz_SECTION_HELP "Help"
#define OAC_SETUP_sz_SECTION_APPEARANCE "Appearance"
/////////////////////////////////////////////////////////////////////////////
// EdActors_EditorSetupDialog dialog
BEGIN_MESSAGE_MAP(EdActors_EditorSetupDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_EditorSetupDialog)
ON_WM_PAINT()
ON_WM_LBUTTONUP()
ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_SUB_SETUP, OnSelchangedTreeSubSetup)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
ON_MESSAGE(WM_HELP, OnMyHelp)
END_MESSAGE_MAP()
//***************************************************************************
EdActors_EditorSetupDialog::EdActors_EditorSetupDialog(CWnd* pParent /*=NULL*/)
: CDialog(EdActors_EditorSetupDialog::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(EdActors_EditorSetupDialog)
m_bMustDisplayModelFieldsInInstance = g_pclInterface->m_clDocument.m_bMustDisplayModelFieldsInInstance;
m_bMustConfirmSuppressionInWatch = g_pclInterface->m_clDocument.m_bMustConfirmWatchSuppression;
m_bMustDisplayUnallocatedMS = g_pclInterface->m_clDocument.m_bMustDisplayUnallocatedMS;
m_bMustConfirmUnallocation = g_pclInterface->m_clDocument.m_bMustConfirmUnallocation;
m_bMustConfirmAllocation = g_pclInterface->m_clDocument.m_bMustConfirmAllocation;
m_bSynchronizeDialogListWithEdition = g_pclInterface->m_clDocument.m_bMustSynchronizeDialogListWithEdition;
m_bWatchAlwaysVisible = g_pclInterface->m_clDocument.m_bWatchAlwaysVisible;
m_bProposeUnloadedModels = g_pclInterface->m_clDocument.m_bProposeUnloadedModels;
m_bRestoreGroup = g_pclInterface->m_clDocument.m_bRestoreGroup;
m_bAskForNewInstanceName = g_pclInterface->m_clDocument.m_bAskForNewInstanceName;
//}}AFX_DATA_INIT
if (g_pclInterface->m_clDocument.m_bMustDisplayHelpOnActiveView)
m_iHelpRadioValue = 0;
else
m_iHelpRadioValue = 1;
m_hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
m_pri_p_tdstCurrentTreeItem = NULL;
}
//***************************************************************************
EdActors_EditorSetupDialog::~EdActors_EditorSetupDialog()
{
//Deletes all UINTs
POSITION pos = m_clListOfListOfID.GetHeadPosition();
while ( pos != NULL )
{
OAC_tdstSetupTreeItem *p_tdstTreeItem = m_clListOfListOfID.GetNext(pos);
POSITION Pos2 = p_tdstTreeItem->ListOfID.GetHeadPosition();
while ( Pos2 != NULL )
delete p_tdstTreeItem->ListOfID.GetNext(Pos2);
p_tdstTreeItem->ListOfID.RemoveAll();
}
m_clListOfListOfID.RemoveAll();
AfxSetResourceHandle(m_hOldInstance);
}
//***************************************************************************
void EdActors_EditorSetupDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_EditorSetupDialog)
DDX_Check(pDX, IDC_CHECK_DISPLAY_MODEL_FIELDS, m_bMustDisplayModelFieldsInInstance);
DDX_Check(pDX, IDC_CHECK_WATCH_SUPPRESS_CONFIRM, m_bMustConfirmSuppressionInWatch);
DDX_Check(pDX, IDC_CHECK_DISPLAY_UNALLOCATED_MS, m_bMustDisplayUnallocatedMS);
DDX_Check(pDX, IDC_CHECK_CONFIRM_UNALLOCATION, m_bMustConfirmUnallocation);
DDX_Check(pDX, IDC_CHECK_CONFIRM_ALLOCATION, m_bMustConfirmAllocation);
DDX_Radio(pDX, IDC_RADIO_HELP_ACTIVE, m_iHelpRadioValue);
DDX_Check(pDX, IDC_CHECK_SYNCHRONIZE_DIALOG_LIST, m_bSynchronizeDialogListWithEdition);
DDX_Check(pDX, IDC_CHECK_WATCH_ALWAYS_VISIBLE, m_bWatchAlwaysVisible);
DDX_Check(pDX, IDC_CHECK_PROPOSE_UNLOADED_MODELS, m_bProposeUnloadedModels);
DDX_Check(pDX, IDC_CHECK_RESTORE_GROUP, m_bRestoreGroup);
DDX_Check(pDX, IDC_CHECK_ASK_FOR_NEW_INSTANCE_NAME, m_bAskForNewInstanceName);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_EditorSetupDialog message handlers
//***************************************************************************
BOOL EdActors_EditorSetupDialog::OnInitDialog()
{
CDialog::OnInitDialog();
//Prepares Tree
//Fills ID lists
CTreeCtrl *pclTree = (CTreeCtrl *)GetDlgItem(IDC_TREE_SUB_SETUP);
///----------------
HTREEITEM hTreeFirstItem = pclTree->InsertItem(OAC_SETUP_sz_SECTION_GENERAL);
OAC_tdstSetupTreeItem *p_tdstTreeItem = new OAC_tdstSetupTreeItem;
p_tdstTreeItem->csTreeString = OAC_SETUP_sz_SECTION_GENERAL;
UINT *p_uiID = new UINT;
*p_uiID = IDC_CHECK_SYNCHRONIZE_DIALOG_LIST;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_CHECK_PROPOSE_UNLOADED_MODELS;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_CHECK_RESTORE_GROUP;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
m_clListOfListOfID.AddTail(p_tdstTreeItem);
pclTree->SetItemData(hTreeFirstItem, (DWORD)p_tdstTreeItem);
///----------------
HTREEITEM hTreeItem = pclTree->InsertItem(OAC_SETUP_sz_SECTION_ACTORS);
p_tdstTreeItem = new OAC_tdstSetupTreeItem;
p_tdstTreeItem->csTreeString = OAC_SETUP_sz_SECTION_ACTORS;
m_clListOfListOfID.AddTail(p_tdstTreeItem);
pclTree->SetItemData(hTreeItem, (DWORD)p_tdstTreeItem);
///----------------
HTREEITEM hCurrentTreeItem = pclTree->InsertItem(OAC_SETUP_sz_SECTION_MODELS, hTreeItem);
p_tdstTreeItem = new OAC_tdstSetupTreeItem;
p_tdstTreeItem->csTreeString = OAC_SETUP_sz_SECTION_MODELS;
p_uiID = new UINT;
*p_uiID = IDC_CHECK_CONFIRM_ALLOCATION;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_CHECK_CONFIRM_UNALLOCATION;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
m_clListOfListOfID.AddTail(p_tdstTreeItem);
pclTree->SetItemData(hCurrentTreeItem, (DWORD)p_tdstTreeItem);
///----------------
hCurrentTreeItem = pclTree->InsertItem(OAC_SETUP_sz_SECTION_INSTANCES, hTreeItem);
p_tdstTreeItem = new OAC_tdstSetupTreeItem;
p_tdstTreeItem->csTreeString = OAC_SETUP_sz_SECTION_INSTANCES;
p_uiID = new UINT;
*p_uiID = IDC_CHECK_DISPLAY_MODEL_FIELDS;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_CHECK_DISPLAY_UNALLOCATED_MS;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_CHECK_ASK_FOR_NEW_INSTANCE_NAME;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
m_clListOfListOfID.AddTail(p_tdstTreeItem);
pclTree->SetItemData(hCurrentTreeItem, (DWORD)p_tdstTreeItem);
///----------------
hCurrentTreeItem = pclTree->InsertItem(OAC_SETUP_sz_SECTION_WATCH);
p_tdstTreeItem = new OAC_tdstSetupTreeItem;
p_tdstTreeItem->csTreeString = OAC_SETUP_sz_SECTION_WATCH;
p_uiID = new UINT;
*p_uiID = IDC_CHECK_WATCH_SUPPRESS_CONFIRM;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_CHECK_WATCH_ALWAYS_VISIBLE;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
m_clListOfListOfID.AddTail(p_tdstTreeItem);
pclTree->SetItemData(hCurrentTreeItem, (DWORD)p_tdstTreeItem);
///----------------
hCurrentTreeItem = pclTree->InsertItem(OAC_SETUP_sz_SECTION_HELP);
p_tdstTreeItem = new OAC_tdstSetupTreeItem;
p_tdstTreeItem->csTreeString = OAC_SETUP_sz_SECTION_HELP;
p_uiID = new UINT;
*p_uiID = IDC_RADIO_HELP_ACTIVE;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RADIO_HELP_MOUSE;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
m_clListOfListOfID.AddTail(p_tdstTreeItem);
pclTree->SetItemData(hCurrentTreeItem, (DWORD)p_tdstTreeItem);
///----------------
hCurrentTreeItem = pclTree->InsertItem(OAC_SETUP_sz_SECTION_APPEARANCE);
p_tdstTreeItem = new OAC_tdstSetupTreeItem;
p_tdstTreeItem->csTreeString = OAC_SETUP_sz_SECTION_APPEARANCE;
p_uiID = new UINT;
*p_uiID = IDC_STATIC_TEXT;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_STATIC_BG;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_STATIC_IN;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_STATIC_NF;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_STATIC_NM;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_STATIC_INST;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_STATIC_INITIAL;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_STATIC_CURRENT;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_STATIC_NFIELD;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_STATIC_WATCH_FIELDS;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_TEXT_NAME;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_BG_NAME;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_TEXT_FAMILY;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_BG_FAMILY;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_TEXT_MODEL;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_BG_MODEL;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_TEXT_FIELD_INST;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_BG_FIELD_INST;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_TEXT_FIELD_INITIAL;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_BG_FIELD_INITIAL;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_TEXT_FIELD_CURRENT;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_BG_FIELD_CURRENT;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_TEXT_FIELD_MODEL;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_BG_FIELD_MODEL;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_TEXT_FIELD_WATCH;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
p_uiID = new UINT;
*p_uiID = IDC_RECT_BG_FIELD_WATCH;
p_tdstTreeItem->ListOfID.AddTail(p_uiID); ;
m_clListOfListOfID.AddTail(p_tdstTreeItem);
pclTree->SetItemData(hCurrentTreeItem, (DWORD)p_tdstTreeItem);
//Selects first Item
pclTree-> SelectItem(hTreeFirstItem);
m_pri_fn_vDisplayControlsForType(m_clListOfListOfID.GetHead());
//Adjusts Windows display
CRect crTreeRect;
GetDlgItem(IDC_TREE_SUB_SETUP)->GetWindowRect(crTreeRect);
ScreenToClient(&crTreeRect);
CRect crOKRect;
GetDlgItem(IDOK)->GetWindowRect(crOKRect);
CRect crDialogRect;
GetWindowRect(crDialogRect);
crDialogRect.bottom = crOKRect.bottom + crTreeRect.top;
MoveWindow(crDialogRect);
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControlID(IDC_TREE_SUB_SETUP, "OAc_SetupDialog_SubSetupsTreeControl", TUT_e_TreeCtrl);
TUT_M_vRegisterControlID(IDC_CHECK_CONFIRM_ALLOCATION, "OAc_SetupDialog_ConfirmAllocationButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_CHECK_CONFIRM_UNALLOCATION, "OAc_SetupDialog_ConfirmUnallocationButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_CHECK_DISPLAY_MODEL_FIELDS, "OAc_SetupDialog_DisplayModelFieldsButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_CHECK_DISPLAY_UNALLOCATED_MS, "OAc_SetupDialog_DisplayUnallocatedMSButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_CHECK_WATCH_SUPPRESS_CONFIRM, "OAc_SetupDialog_WatchSuppressionConfirmButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_CHECK_WATCH_ALWAYS_VISIBLE, "OAc_SetupDialog_WatchAlwaysVisibleButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_CHECK_SYNCHRONIZE_DIALOG_LIST, "OAc_SetupDialog_SynchronizeDialogListButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_CHECK_PROPOSE_UNLOADED_MODELS, "OAc_SetupDialog_PreLoadModelsButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_CHECK_RESTORE_GROUP, "OAc_SetupDialog_RestoreGroupButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_CHECK_ASK_FOR_NEW_INSTANCE_NAME, "OAc_SetupDialog_AskInstanceName", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_HELP_ACTIVE, "OAc_SetupDialog_HelpOnActiveViewButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_HELP_MOUSE, "OAc_SetupDialog_HelpOnViewUnderCursorButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RECT_TEXT_NAME, "OAc_SetupDialog_ActorNameTextColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_BG_NAME, "OAc_SetupDialog_ActorNameBackgroundColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_TEXT_FAMILY, "OAc_SetupDialog_FamilyNameTextColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_BG_FAMILY, "OAc_SetupDialog_FamilyNameBackroundColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_TEXT_MODEL, "OAc_SetupDialog_ModelNameTextColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_BG_MODEL, "OAc_SetupDialog_ModelNameBackgroundColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_TEXT_FIELD_INST, "OAc_SetupDialog_InstanceFieldTextColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_BG_FIELD_INST, "OAc_SetupDialog_InstanceFiedlBackgroundColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_TEXT_FIELD_INITIAL, "OAc_SetupDialog_InitialFieldTextColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_BG_FIELD_INITIAL, "OAc_SetupDialog_InitialFiedlBackgroundColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_TEXT_FIELD_CURRENT, "OAc_SetupDialog_CurrentFieldTextColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_BG_FIELD_CURRENT, "OAc_SetupDialog_CurrentFiedlBackgroundColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_TEXT_FIELD_MODEL, "OAc_SetupDialog_ModelFieldTextColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_BG_FIELD_MODEL, "OAc_SetupDialog_ModelFieldBackgroundColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_TEXT_FIELD_WATCH, "OAc_SetupDialog_InWatchFieldTextColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_RECT_BG_FIELD_WATCH, "OAc_SetupDialog_InWatchFieldBackgroundColorStatic", TUT_e_Window);
TUT_M_vRegisterControlID(IDOK, "OAc_SetupDialog_ButtonOK", TUT_e_Button);
TUT_M_vRegisterControlID(IDCANCEL, "OAc_SetupDialog_ButtonCancel", TUT_e_Button);
//End of Registers for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void EdActors_EditorSetupDialog::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControlID(IDC_TREE_SUB_SETUP);
TUT_M_vUnregisterControlID(IDC_CHECK_CONFIRM_ALLOCATION);
TUT_M_vUnregisterControlID(IDC_CHECK_CONFIRM_UNALLOCATION);
TUT_M_vUnregisterControlID(IDC_CHECK_DISPLAY_MODEL_FIELDS);
TUT_M_vUnregisterControlID(IDC_CHECK_DISPLAY_UNALLOCATED_MS);
TUT_M_vUnregisterControlID(IDC_CHECK_WATCH_SUPPRESS_CONFIRM);
TUT_M_vUnregisterControlID(IDC_CHECK_WATCH_ALWAYS_VISIBLE);
TUT_M_vUnregisterControlID(IDC_CHECK_SYNCHRONIZE_DIALOG_LIST);
TUT_M_vUnregisterControlID(IDC_CHECK_PROPOSE_UNLOADED_MODELS);
TUT_M_vUnregisterControlID(IDC_CHECK_RESTORE_GROUP);
TUT_M_vUnregisterControlID(IDC_CHECK_ASK_FOR_NEW_INSTANCE_NAME);
TUT_M_vUnregisterControlID(IDC_RADIO_HELP_ACTIVE);
TUT_M_vUnregisterControlID(IDC_RADIO_HELP_MOUSE);
TUT_M_vUnregisterControlID(IDC_RECT_TEXT_NAME);
TUT_M_vUnregisterControlID(IDC_RECT_BG_NAME);
TUT_M_vUnregisterControlID(IDC_RECT_TEXT_FAMILY);
TUT_M_vUnregisterControlID(IDC_RECT_BG_FAMILY);
TUT_M_vUnregisterControlID(IDC_RECT_TEXT_MODEL);
TUT_M_vUnregisterControlID(IDC_RECT_BG_MODEL);
TUT_M_vUnregisterControlID(IDC_RECT_TEXT_FIELD_INST);
TUT_M_vUnregisterControlID(IDC_RECT_BG_FIELD_INST);
TUT_M_vUnregisterControlID(IDC_RECT_TEXT_FIELD_INITIAL);
TUT_M_vUnregisterControlID(IDC_RECT_BG_FIELD_INITIAL);
TUT_M_vUnregisterControlID(IDC_RECT_TEXT_FIELD_CURRENT);
TUT_M_vUnregisterControlID(IDC_RECT_BG_FIELD_CURRENT);
TUT_M_vUnregisterControlID(IDC_RECT_TEXT_FIELD_MODEL);
TUT_M_vUnregisterControlID(IDC_RECT_BG_FIELD_MODEL);
TUT_M_vUnregisterControlID(IDC_RECT_TEXT_FIELD_WATCH);
TUT_M_vUnregisterControlID(IDC_RECT_BG_FIELD_WATCH);
TUT_M_vUnregisterControlID(IDOK);
TUT_M_vUnregisterControlID(IDCANCEL);
//End of UnRegisters for TUT Module
//////////////
CDialog::OnDestroy();
}
//***************************************************************************
void EdActors_EditorSetupDialog::OnOK()
{
UpdateData(TRUE);
g_pclInterface->m_clDocument.m_bMustDisplayModelFieldsInInstance = m_bMustDisplayModelFieldsInInstance;
g_pclInterface->m_clDocument.m_bMustDisplayUnallocatedMS = m_bMustDisplayUnallocatedMS;
g_pclInterface->m_clDocument.m_bMustConfirmWatchSuppression = m_bMustConfirmSuppressionInWatch;
g_pclInterface->m_clDocument.m_bMustConfirmUnallocation = m_bMustConfirmUnallocation;
g_pclInterface->m_clDocument.m_bMustConfirmAllocation = m_bMustConfirmAllocation;
g_pclInterface->m_clDocument.m_bMustDisplayHelpOnActiveView = (m_iHelpRadioValue == 0);
g_pclInterface->m_clDocument.m_bMustSynchronizeDialogListWithEdition = m_bSynchronizeDialogListWithEdition;
g_pclInterface->m_clDocument.m_bWatchAlwaysVisible = m_bWatchAlwaysVisible;
g_pclInterface->m_clDocument.m_bProposeUnloadedModels = m_bProposeUnloadedModels;
g_pclInterface->m_clDocument.m_bRestoreGroup = m_bRestoreGroup;
g_pclInterface->m_clDocument.m_bAskForNewInstanceName = m_bAskForNewInstanceName;
//Refreshes Display in Editor
g_pclInterface->m_clDocument.m_pclMiniStrucView->InvalidateRect(NULL);
//Saves Ini file
g_pclInterface->m_clDocument.m_fn_bWriteIniFile();
CDialog::OnOK();
}
//***************************************************************************
void EdActors_EditorSetupDialog::OnLButtonUp(UINT nFlags, CPoint point)
{
CWnd *pclWnd = GetDlgItem(IDC_RECT_TEXT_NAME);
CRect crClientRect;
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_NameTextColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_BG_NAME);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_NameBackgroundColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_INST);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_FieldInstanceTextColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_INST);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_FieldInstanceBackgroundColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_INITIAL);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_FieldInitialTextColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_INITIAL);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_FieldInitialBackgroundColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_CURRENT);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_FieldCurrentTextColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_CURRENT);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_FieldCurrentBackgroundColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_MODEL);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_FieldModelTextColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_MODEL);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_FieldModelBackgroundColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FAMILY);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_FamilyTextColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_BG_FAMILY);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_FamilyBackgroundColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_WATCH);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_InWatchFieldTextColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_WATCH);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_InWatchFieldBackgroundColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_TEXT_MODEL);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_ModelTextColor) )
InvalidateRect(NULL);
pclWnd = GetDlgItem(IDC_RECT_BG_MODEL);
pclWnd->GetWindowRect(crClientRect);
ScreenToClient(crClientRect);
if ( crClientRect.PtInRect(point) )
if ( m_fn_bEditColor(g_pclInterface->m_clDocument.m_pub_colref_ModelBackgroundColor) )
InvalidateRect(NULL);
CDialog::OnLButtonUp(nFlags, point);
}
//***************************************************************************
BOOL EdActors_EditorSetupDialog::m_fn_bEditColor(COLORREF &r_Color)
{
CColorDialog dial(r_Color, CC_FULLOPEN, &g_oBaseFrame);
if ( dial.DoModal() == IDOK )
{
r_Color = dial.GetColor();
return TRUE;
}
else
return FALSE;
}
//***************************************************************************
void EdActors_EditorSetupDialog::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect crClientRect;
CWnd *pclWnd = GetDlgItem(IDC_RECT_TEXT_NAME);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc1(pclWnd);
dc1.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_NameTextColor);
pclWnd = GetDlgItem(IDC_RECT_BG_NAME);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc2(pclWnd);
dc2.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_NameBackgroundColor);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_INST);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc3(pclWnd);
dc3.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_FieldInstanceTextColor);
pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_INST);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc4(pclWnd);
dc4.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_FieldInstanceBackgroundColor);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_INITIAL);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc23(pclWnd);
dc23.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_FieldInitialTextColor);
pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_INITIAL);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc24(pclWnd);
dc24.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_FieldInitialBackgroundColor);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_CURRENT);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc33(pclWnd);
dc33.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_FieldCurrentTextColor);
pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_CURRENT);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc34(pclWnd);
dc34.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_FieldCurrentBackgroundColor);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_MODEL);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc5(pclWnd);
dc5.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_FieldModelTextColor);
pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_MODEL);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc6(pclWnd);
dc6.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_FieldModelBackgroundColor);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FAMILY);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc13(pclWnd);
dc13.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_FamilyTextColor);
pclWnd = GetDlgItem(IDC_RECT_BG_FAMILY);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc14(pclWnd);
dc14.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_FamilyBackgroundColor);
pclWnd = GetDlgItem(IDC_RECT_TEXT_FIELD_WATCH);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc7(pclWnd);
dc7.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_InWatchFieldTextColor);
pclWnd = GetDlgItem(IDC_RECT_BG_FIELD_WATCH);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc8(pclWnd);
dc8.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_InWatchFieldBackgroundColor);
pclWnd = GetDlgItem(IDC_RECT_TEXT_MODEL);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc11(pclWnd);
dc11.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_ModelTextColor);
pclWnd = GetDlgItem(IDC_RECT_BG_MODEL);
pclWnd->GetClientRect(crClientRect);
crClientRect.InflateRect(-2,-2);
CClientDC dc12(pclWnd);
dc12.FillSolidRect(crClientRect, g_pclInterface->m_clDocument.m_pub_colref_ModelBackgroundColor);
// Do not call CDialog::OnPaint() for painting messages
}
//***************************************************************************
long EdActors_EditorSetupDialog::OnMyHelp(UINT, long lParam)
{
LPHELPINFO lphi = (LPHELPINFO)lParam;
::WinHelp( m_hWnd,
LPCTSTR(g_pclInterface->m_clDocument.m_csHelpFileNameAndPath),
HELP_CONTEXTPOPUP,
lphi->dwContextId);
return TRUE;
}
//***************************************************************************
void EdActors_EditorSetupDialog::OnSelchangedTreeSubSetup(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
CTreeCtrl *pclTree = (CTreeCtrl *)GetDlgItem(IDC_TREE_SUB_SETUP);
// CString csSelectedString = pclTree->GetItemText(pNMTreeView->itemNew.hItem);
OAC_tdstSetupTreeItem *p_tdstTreeItem = (OAC_tdstSetupTreeItem *)pclTree->GetItemData(pNMTreeView->itemNew.hItem);
m_pri_fn_vDisplayControlsForType(p_tdstTreeItem);
*pResult = 0;
}
//***************************************************************************
void EdActors_EditorSetupDialog::m_pri_fn_vDisplayControlsForType(OAC_tdstSetupTreeItem *_p_tdstTreeItem)
{
if ( _p_tdstTreeItem != m_pri_p_tdstCurrentTreeItem )
{
//Hides old controls
if ( m_pri_p_tdstCurrentTreeItem != NULL )
{
//Displays controls
POSITION pos = m_pri_p_tdstCurrentTreeItem->ListOfID.GetHeadPosition();
while ( pos != NULL )
GetDlgItem(*m_pri_p_tdstCurrentTreeItem->ListOfID.GetNext(pos))->ShowWindow(SW_HIDE);
}
//Moves Controls
if ( _p_tdstTreeItem->ListOfID.GetCount() > 0 )
{
CRect crFirstControlRect;
GetDlgItem(*_p_tdstTreeItem->ListOfID.GetHead())->GetWindowRect(crFirstControlRect);
ScreenToClient(&crFirstControlRect);
CRect crImageRect;
GetDlgItem(IDC_IMAGE_TITLE)->GetWindowRect(crImageRect);
ScreenToClient(&crImageRect);
//Moves and Displays controls
CRect crCurrentRect;
UINT *p_uiCurrentID;
POSITION pos = _p_tdstTreeItem->ListOfID.GetHeadPosition();
while ( pos != NULL )
{
p_uiCurrentID = _p_tdstTreeItem->ListOfID.GetNext(pos);
GetDlgItem(*p_uiCurrentID)->GetWindowRect(crCurrentRect);
ScreenToClient(&crCurrentRect);
crCurrentRect.OffsetRect(0, crImageRect.bottom - crFirstControlRect.top + 10);
GetDlgItem(*p_uiCurrentID)->MoveWindow(crCurrentRect);
GetDlgItem(*p_uiCurrentID)->ShowWindow(SW_SHOW);
}
}
//Displays text on Bitmap
CString csTitleText;
CString csInfoText;
/* switch ( _eType )
{
case OAC_SETUP_TYPE__GENERAL:
csTitleText = "General";
csInfoText = "Set General options";
break;
case OAC_SETUP_TYPE__ACTORS:
csTitleText = "Actors";
csInfoText = "Set Actors options";
break;
case OAC_SETUP_TYPE__MODELS:
csTitleText = "Models";
csInfoText = "Set Models display";
break;
case OAC_SETUP_TYPE__INSTANCES:
csTitleText = "Instances";
csInfoText = "Set Instances display";
break;
case OAC_SETUP_TYPE__WATCH_WINDOW:
csTitleText = "Watch Window";
csInfoText = "Set Watch comportment";
break;
case OAC_SETUP_TYPE__HELP:
csTitleText = "Help";
csInfoText = "Set Help options";
break;
case OAC_SETUP_TYPE__APPEARANCE:
csTitleText = "Appearance";
csInfoText = "Set controls colors";
break;
}; */
csTitleText = _p_tdstTreeItem->csTreeString;
csInfoText = "Essai";
CRect crBitmapRect;
GetDlgItem(IDC_IMAGE_TITLE)->GetWindowRect(crBitmapRect);
ScreenToClient(crBitmapRect);
CClientDC dc(this);
dc.SetTextColor(RGB(0,0,0));
dc.SetBkMode(TRANSPARENT);
CFont *pclFont = GetFont();
LOGFONT LogFont;
pclFont->GetLogFont(&LogFont);
LogFont.lfWeight += 400;
CFont clFont;
clFont. CreateFontIndirect(&LogFont);
dc.SelectObject(&clFont);
//Offsets rect
short wFontHeight = (short)dc.GetTextExtent("A",1).cy;
crBitmapRect.OffsetRect(0, (crBitmapRect.Height() - wFontHeight) / 2);
dc.DrawText(csTitleText, &crBitmapRect, DT_LEFT);
dc.SelectObject(pclFont);
dc.DrawText(csInfoText, &crBitmapRect, DT_RIGHT);
m_pri_p_tdstCurrentTreeItem = _p_tdstTreeItem;
//Re-draws Bitmap (and erases old text)
// CWnd *pclWnd = GetDlgItem(IDC_IMAGE_TITLE);
// pclWnd->InvalidateRect(NULL);
}
}