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

935 lines
33 KiB
C++

// Implementation for the definition of the class representing a mini-structure
// (Base class)
/////////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
/////////////////////////////////////////////////////
//////// !!!!!!!!!!!! DANGER !!!!!!!!!!! ////////////
/////////////////////////////////////////////////////
#define _ED_CAR_MUST_DEFINE_STRUCT_
#include "EdAllAct.hpp"
/////////////////////////////////////////////////////
//////// !!!!!!!!!!!! End DANGER !!!!!!!!!!! ////////
/////////////////////////////////////////////////////
#include "EDACMStr.hpp"
#include "EDACVwMS.hpp"
#include "EDACDoc.hpp"
#include "EDACFmMn.hpp"
#include "CPA_CtlS.hpp"
#include "CPA_CtlO.hpp"
#include "EDACDgQu.hpp"
#include "EDACCnst.hpp"
#include "EDACMStA.hpp"
#include "EDACMStr.hpp"
#include "EDACModl.hpp"
#include "EDACStrg.hpp"
#include "EDACBuM.hpp"
#include "_AInterf.hpp"
//External Modules
#include "ErO.h"
#include "IncTUT.h"
#include "CTL.h"
//End of External Modules
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//***************************************************************************
EdActors_MiniStructure::EdActors_MiniStructure(CString csName,
tdeMiniStructureManiability tdeManiability)
{
m_csName = csName;
m_tdeManiability = tdeManiability;
m_pclAllocButton = NULL;
m_pclOpenButton = NULL;
m_pclActorMS = NULL;
m_bIsAlreadyAllocated = FALSE;
m_crControlZone = CRect(0,0,0,0);
}
//***************************************************************************
EdActors_MiniStructure::~EdActors_MiniStructure()
{
if ( m_pclAllocButton != NULL )
delete m_pclAllocButton;
if ( m_pclOpenButton != NULL )
delete m_pclOpenButton;
}
//**************************************************************************************
CTL_Editor_Control *EdActors_MiniStructure::m_fn_pclAddIntegerControl(long lMinValue,
long lMaxValue,
char cDataLength,
BOOL bSigned,
OAC_tdeDataLevel tdeLevel,
BOOL bReadOnly,
CTL_tdeControlSpacingType tdeSpacingType,
OAC_tdeControlVisibility tdeVisibility,
BOOL bUserCanChangeAspect,
CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
BOOL _bAcceptsToTakeNameOfData /*= TRUE*/, //ANNECY BBB
DWORD _ulHelpID
)
{
CTL_Editor_Control *pclNewElement = m_clControlList.m_fn_pclAddIntegerControl(lMinValue,
lMaxValue,
cDataLength,
bSigned,
bReadOnly,
tdeSpacingType,
bUserCanChangeAspect,
_csControlName,
_bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
);
OAC_AddOwnerDataToControl(pclNewElement, tdeLevel, tdeVisibility, _ulHelpID);
return pclNewElement;
}
//**************************************************************************************
CTL_Editor_Control *EdActors_MiniStructure::m_fn_pclAddDecimalControl(long double ldMinValue,
long double ldMaxValue,
char cDataLength,
OAC_tdeDataLevel tdeLevel,
BOOL bReadOnly,
CTL_tdeControlSpacingType tdeSpacingType,
OAC_tdeControlVisibility tdeVisibility,
BOOL bUserCanChangeAspect,
CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
BOOL _bAcceptsToTakeNameOfData /*= TRUE*/, //ANNECY BBB
DWORD _ulHelpID
)
{
CTL_Editor_Control *pclNewElement = m_clControlList.m_fn_pclAddDecimalControl(ldMinValue,
ldMaxValue,
cDataLength,
bReadOnly,
tdeSpacingType,
bUserCanChangeAspect,
_csControlName,
_bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
);
OAC_AddOwnerDataToControl(pclNewElement, tdeLevel, tdeVisibility, _ulHelpID);
return pclNewElement;
}
//**************************************************************************************
CTL_Editor_Control *EdActors_MiniStructure::m_fn_pclAddBooleanControl(OAC_tdeDataLevel tdeLevel,
BOOL bReadOnly,
CTL_tdeControlSpacingType tdeSpacingType,
OAC_tdeControlVisibility tdeVisibility,
BOOL bUserCanChangeAspect,
CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
BOOL _bAcceptsToTakeNameOfData /*= TRUE*/, //ANNECY BBB
DWORD _ulHelpID
)
{
CTL_Editor_Control *pclNewElement = m_clControlList.m_fn_pclAddBooleanControl(bReadOnly,
tdeSpacingType,
bUserCanChangeAspect,
_csControlName,
_bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
);
OAC_AddOwnerDataToControl(pclNewElement, tdeLevel, tdeVisibility, _ulHelpID);
return pclNewElement;
}
//**************************************************************************************
CTL_Editor_Control *EdActors_MiniStructure::m_fn_pclAddMaskedControl( OAC_tdeDataLevel tdeLevel,
BOOL bReadOnly,
CTL_tdeControlSpacingType tdeSpacingType,
OAC_tdeControlVisibility tdeVisibility,
BOOL bUserCanChangeAspect,
CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
BOOL _bAcceptsToTakeNameOfData /*= TRUE*/, //ANNECY BBB
DWORD _ulHelpID
)
{
CTL_Editor_Control *pclNewElement = m_clControlList.m_fn_pclAddMaskedControl(bReadOnly,
tdeSpacingType,
bUserCanChangeAspect,
_csControlName,
_bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
);
OAC_AddOwnerDataToControl(pclNewElement, tdeLevel, tdeVisibility, _ulHelpID);
return pclNewElement;
}
//**************************************************************************************
CTL_Editor_Control *EdActors_MiniStructure::m_fn_pclAddEnumControl( OAC_tdeDataLevel tdeLevel,
OAC_tdeControlVisibility tdeVisibility,
BOOL bReadOnly,
CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
BOOL _bAcceptsToTakeNameOfData /*= TRUE*/, //ANNECY BBB
DWORD _ulHelpID
)
{
CTL_Editor_Control *pclNewElement = m_clControlList.m_fn_pclAddEnumControl(bReadOnly,
_csControlName,
_bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
);
OAC_AddOwnerDataToControl(pclNewElement, tdeLevel, tdeVisibility, _ulHelpID);
return pclNewElement;
}
//**************************************************************************************
CTL_Editor_Control *EdActors_MiniStructure::m_fn_pclAddTextControl( OAC_tdeDataLevel tdeLevel,
BOOL bReadOnly,
CTL_tdeControlSpacingType tdeSpacingType,
OAC_tdeControlVisibility tdeVisibility,
BOOL bUserCanChangeAspect,
CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
BOOL _bAcceptsToTakeNameOfData /*= TRUE*/, //ANNECY BBB
DWORD _ulHelpID
)
{
CTL_Editor_Control *pclNewElement = m_clControlList.m_fn_pclAddTextControl(bReadOnly,
tdeSpacingType,
bUserCanChangeAspect,
_csControlName,
_bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
);
OAC_AddOwnerDataToControl(pclNewElement, tdeLevel, tdeVisibility, _ulHelpID);
return pclNewElement;
}
//**************************************************************************************
CTL_Editor_Control *EdActors_MiniStructure::m_fn_pclAddVectorControl( long double ldMinValue,
long double ldMaxValue,
char cDataLength,
OAC_tdeDataLevel tdeLevel,
BOOL bReadOnly,
OAC_tdeControlVisibility tdeVisibility,
CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
BOOL _bAcceptsToTakeNameOfData /*= TRUE*/, //ANNECY BBB
DWORD _ulHelpID
)
{
CTL_Editor_Control *pclNewElement = m_clControlList.m_fn_pclAddVectorControl(ldMinValue,
ldMaxValue,
cDataLength,
bReadOnly,
_csControlName,
_bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
);
OAC_AddOwnerDataToControl(pclNewElement, tdeLevel, tdeVisibility, _ulHelpID);
return pclNewElement;
}
//**************************************************************************************
//**************************************************************************************
CTL_Editor_Control *EdActors_MiniStructure::m_fn_pclAddStateControl(OAC_tdeDataLevel tdeLevel,
OAC_tdeControlVisibility tdeVisibility,
BOOL bReadOnly,
CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
BOOL _bAcceptsToTakeNameOfData /*= TRUE*/, //ANNECY BBB
DWORD _ulHelpID
)
{
CPA_Editor_StateControl *pclNewElement = new CPA_Editor_StateControl(bReadOnly,
&m_clControlList,
_csControlName,
_bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
);
m_clControlList.m_fn_vAddElement(pclNewElement);
OAC_AddOwnerDataToControl(pclNewElement, tdeLevel, tdeVisibility, _ulHelpID);
return pclNewElement;
}
//**************************************************************************************
CTL_Editor_Control *EdActors_MiniStructure::m_fn_pclAddObjectListControl(OAC_tdeDataLevel tdeLevel,
BOOL bReadOnly,
OAC_tdeControlVisibility tdeVisibility,
BOOL bUserCanChangeAspect,
BOOL bNoNames,
BOOL bNoAlternateList,
CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
BOOL _bAcceptsToTakeNameOfData /*= TRUE*/, //ANNECY BBB
DWORD _ulHelpID
)
{
CPA_Editor_ObjectListControl *pclNewElement = new CPA_Editor_ObjectListControl(bReadOnly,
bUserCanChangeAspect,
bNoNames,
bNoAlternateList,
&m_clControlList,
_csControlName,
_bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
);
m_clControlList.m_fn_vAddElement(pclNewElement);
OAC_AddOwnerDataToControl(pclNewElement, tdeLevel, tdeVisibility, _ulHelpID);
return pclNewElement;
}
//**************************************************************************************
//Creates all controls
long EdActors_MiniStructure::m_fn_lCreateMSControls(CWnd *pclWnd,
CRect crRect)
{
m_pclParent = (EdActors_MiniStrucView *)pclWnd;
//Adds the MS in the view
m_crDisplayRect = crRect;
//Creates the Alloc MS Button
m_pclAllocButton = new CPA_Editor_MiniStructureButton(this, "", ECAR_MS_BUTTON_TYPE_ALLOC);
CRect crButtonRect(crRect);
crButtonRect.right = crButtonRect.left + (crButtonRect.Width() * C_ALLOC_BUTTON_PERCENT_WIDTH)/100;
if ( m_pclAllocButton->Create(m_csName,
WS_CHILD | BS_AUTOCHECKBOX | BS_PUSHLIKE,
crButtonRect,
pclWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
m_pclAllocButton->SetFont(pclWnd->GetFont());
}
//Creates the Open/Close MS Button
m_pclOpenButton = new CPA_Editor_MiniStructureButton(this, m_csName, ECAR_MS_BUTTON_TYPE_OPEN);
crButtonRect.left = crButtonRect.right;
crButtonRect.right = crRect.right;
if ( m_pclOpenButton->Create(m_csName,
WS_CHILD | BS_AUTOCHECKBOX | BS_PUSHLIKE,
crButtonRect,
pclWnd,
CTL_fn_lGetNextAvailableIDForControl()) )
{
m_pclOpenButton->SetFont(pclWnd->GetFont());
}
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
CString csTUTButtonName = CString("OAc_MSView_MSAllocButton_") + m_csName;
TUT_M_vRegisterControl(m_pclAllocButton->m_hWnd, csTUTButtonName, TUT_e_Button);
csTUTButtonName = CString("OAc_MSView_MSOpenButton_") + m_csName;
TUT_M_vRegisterControl(m_pclOpenButton->m_hWnd, csTUTButtonName, TUT_e_Button);
//End of Registers for TUT Module
//////////////
//Creates controls of the data list
////
CTL_fn_vSetDefaultCallBackFunctionWhenStaticIsClicked(OAC_fn_vFieldNameStaticHasBeenClicked_CallBack);
CTL_fn_vSetDefaultCallBackFunctionToGetStaticColor(OAC_fn_ColRefGetStaticColor_CallBack);
CTL_fn_vSetModuleInfo("OAc", CString("MS ") + m_csName); ///for TUT
////
POSITION pos = m_clControlList.GetHeadPosition();
while ( pos != NULL )
m_clControlList.GetNext(pos)->m_fn_bCreateControl(pclWnd);
////
CTL_fn_vSetDefaultCallBackFunctionWhenStaticIsClicked(NULL);
CTL_fn_vSetDefaultCallBackFunctionToGetStaticColor(NULL);
CTL_fn_vResetModuleInfo();
////
//Customizes controls
pos = m_clControlList.GetHeadPosition();
while ( pos != NULL )
OAC_fn_vCustomizeControl(m_clControlList.GetNext(pos), pclWnd);
return crButtonRect.bottom;
}
//**************************************************************************************
//Hides all controls
void EdActors_MiniStructure::m_fn_vHideAllControls()
{
//Hides the MS Button
if ( m_pclAllocButton != NULL )
m_pclAllocButton->ShowWindow(SW_HIDE);
if ( m_pclOpenButton != NULL )
m_pclOpenButton->ShowWindow(SW_HIDE);
//Hides controls of the data list
m_clControlList.m_pub_fn_vHideAllControls();
}
//**************************************************************************************
//Shows all controls
void EdActors_MiniStructure::m_fn_vShowAllControls()
{
//Shows the MS Button
if ( m_pclAllocButton != NULL )
m_pclAllocButton->ShowWindow(SW_SHOW);
if ( m_pclOpenButton != NULL )
m_pclOpenButton->ShowWindow(SW_SHOW);
m_fn_vUpdateMSButton();
}
//**************************************************************************************
long EdActors_MiniStructure::m_fn_lMove(CRect crRect)
{
CRect crButtonRect(crRect);
crButtonRect.right = crButtonRect.left + (crButtonRect.Width() * C_ALLOC_BUTTON_PERCENT_WIDTH)/100;
if ( m_pclAllocButton != NULL )
m_pclAllocButton->MoveWindow(crButtonRect);
crButtonRect.left = crButtonRect.right;
crButtonRect.right = crRect.right;
if ( m_pclOpenButton != NULL )
m_pclOpenButton->MoveWindow(crButtonRect);
//Updates MS buttons
m_fn_vUpdateMSButton();
return crRect.bottom;
}
//**************************************************************************************
void EdActors_MiniStructure::m_fn_vOnButtonAlloc()
{
BOOL bMustRefresh = TRUE;
if ( m_pclActorMS != NULL )
{
if (m_pclActorMS->m_pclParentActor->m_pclActor->m_fn_bIsAModel())
{
EdActors_EditorActorModel *pclModel = (EdActors_EditorActorModel *)m_pclActorMS->m_pclParentActor;
if ( pclModel != NULL )
{
//Allocation
if ( !(m_pclActorMS->m_fn_bIsAllocated()) )
{
//Proposes to allocate the MS
//Warning message
if ( g_pclInterface->m_clDocument.m_bMustConfirmAllocation )
{
CString csMessage = "This Mini-structure is going to be allocated\nfor this Model and all its Instances !\nDo you want to continue ?";
EdActors_QuestionDialog dial(&g_oBaseFrame, csMessage);
if ( dial.DoModal() == IDYES )
{
if ( pclModel->m_fn_bAllocateMS(m_pclActorMS) )
{
g_pclInterface->m_clDocument.m_fn_vSetPointers( g_pclInterface->m_clDocument.m_pclCurrentMiniStructureList,
pclModel->m_pclActorCurrentMSList);
m_fn_vGetMotorDatas();
m_fn_vHasBeenAllocated();
}
}
}
//No warning message
else if ( pclModel->m_fn_bAllocateMS(m_pclActorMS) )
{
g_pclInterface->m_clDocument.m_fn_vSetPointers( g_pclInterface->m_clDocument.m_pclCurrentMiniStructureList,
pclModel->m_pclActorCurrentMSList);
m_fn_vGetMotorDatas();
m_fn_vHasBeenAllocated();
}
}
//Unallocation
else
{
//Proposes to unallocate the MS
//Warning message
if ( g_pclInterface->m_clDocument.m_bMustConfirmUnallocation )
{
CString csMessage = "This Mini-structure is going to be unallocated\nfor this Model and all its Instances !\nDo you want to continue ?";
EdActors_QuestionDialog dial(&g_oBaseFrame, csMessage);
if ( dial.DoModal() == IDYES )
{
if ( pclModel->m_fn_bUnallocateMS(m_pclActorMS) )
{
g_pclInterface->m_clDocument.m_fn_vSetPointers( g_pclInterface->m_clDocument.m_pclCurrentMiniStructureList,
pclModel->m_pclActorCurrentMSList);
m_fn_vHasBeenUnallocated();
}
}
}
//No warning message
else if ( pclModel->m_fn_bUnallocateMS(m_pclActorMS) )
{
g_pclInterface->m_clDocument.m_fn_vSetPointers( g_pclInterface->m_clDocument.m_pclCurrentMiniStructureList,
pclModel->m_pclActorCurrentMSList);
m_fn_vHasBeenUnallocated();
}
}
//Notifies
m_pclActorMS->m_pclParentActor->m_pclActor->fn_vNotifySave();
}
}
else
{
EdActors_EditorActorInstance *pclInstance = (EdActors_EditorActorInstance *)m_pclActorMS->m_pclParentActor;
if (pclInstance != NULL)
{
//Allocation
if (!m_pclActorMS->m_fn_bIsAllocated())
{
if (m_pclActorMS->m_fn_bAllocate(FALSE))
{
g_pclInterface->m_clDocument.m_fn_vSetPointers(g_pclInterface->m_clDocument.m_pclCurrentMiniStructureList, pclInstance->m_pclActorCurrentMSList);
m_fn_vGetMotorDatas();
m_fn_vHasBeenAllocated();
}
}
//Unallocation
else
{
if (m_pclActorMS->m_fn_bUnallocate())
{
g_pclInterface->m_clDocument.m_fn_vSetPointers(g_pclInterface->m_clDocument.m_pclCurrentMiniStructureList, pclInstance->m_pclActorCurrentMSList);
m_fn_vHasBeenUnallocated();
}
}
//Notifies
m_pclActorMS->m_pclParentActor->m_pclActor->fn_vNotifySave();
}
}
//Updates MS buttons
m_fn_vUpdateMSButton();
//Updates all tree
if ( bMustRefresh )
m_pclParent->m_fn_vUpdateTree(this);
}
}
//**************************************************************************************
void EdActors_MiniStructure::m_fn_vOnButtonOpen()
{
if ( m_pclActorMS != NULL )
{
ERROR_ASSERT ( m_pclActorMS->m_fn_bIsAllocated() );
switch ( m_pclActorMS->m_tdeState )
{
case MS_STATE_CLOSED :
//Develops the MS
m_pclActorMS->m_tdeState = MS_STATE_DEVELOPPED;
break;
case MS_STATE_DEVELOPPED :
//Closes the MS
m_pclActorMS->m_tdeState = MS_STATE_CLOSED;
break;
};
//Updates MS buttons
m_fn_vUpdateMSButton();
//Updates all tree
m_pclParent->m_fn_vUpdateTree(this);
}
}
//**************************************************************************************
long EdActors_MiniStructure::m_fn_lOpen(CRect crRect)
{
CRect crNextLineControlRect(crRect);
CRect crSameLineControlRect(crNextLineControlRect);
//Simulates a tabulation
crNextLineControlRect.left += C_TABULATION;
CPoint cpTopLeft = crRect.TopLeft();
CPoint cpTopRight = cpTopLeft;
cpTopRight.x = crRect.right;
m_clControlList.m_pub_fn_vDisplayControlsInZone(cpTopLeft, cpTopRight);
return ( cpTopLeft.y - crRect.top );
}
//**************************************************************************************
void EdActors_MiniStructure::m_fn_vClose()
{
//Displays controls of the data list
m_clControlList.m_pub_fn_vHideAllControls();
m_crControlZone = CRect(0,0,0,0);
}
//**************************************************************************************
void EdActors_MiniStructure::m_fn_vOffsetZone(long lOffset)
{
m_crControlZone.OffsetRect(0, lOffset);
}
//**************************************************************************************
void EdActors_MiniStructure::m_fn_vGetMotorDatas()
{
//Gets motor data for all controls of the data list
//Retrieves it in the control
m_clControlList.m_pub_fn_vUpdateControlsWithEditedData(TRUE);
}
//**************************************************************************************
void EdActors_MiniStructure::m_fn_vUpdateMSButton()
{
m_pclAllocButton->m_fn_vUpdateMSButton();
m_pclOpenButton->m_fn_vUpdateMSButton();
}
//**************************************************************************************
//Called when mode is Instance
void EdActors_MiniStructure::m_fn_vUpdateControlsForInstance()
{
if ( m_pclActorMS->m_fn_bIsAllocated() )
{
CTL_Editor_Control *pclControl;
POSITION ControlPos = m_clControlList.GetHeadPosition();
while ( ControlPos != NULL )
{
pclControl = m_clControlList.GetNext(ControlPos);
if ( OAC_fn_bIsLinked(pclControl->m_fn_pclGetEditedData()) )
{
if ( (!pclControl->m_fn_bIsAlwaysReadOnly())
&& (!pclControl->m_fn_bIsReadOnly())
)
pclControl->m_fn_vMakeReadOnly();
}
else
{
if ( (!pclControl->m_fn_bIsAlwaysReadOnly())
&& (pclControl->m_fn_bIsReadOnly())
)
pclControl->m_fn_vMakeReadWrite();
}
}
}
}
//**************************************************************************************
//Called when mode is Model
void EdActors_MiniStructure::m_fn_vUpdateControlsForModel()
{
if ( m_pclActorMS->m_fn_bIsAllocated() )
{
CTL_Editor_Control *pclControl;
POSITION ControlPos = m_clControlList.GetHeadPosition();
while ( ControlPos != NULL )
{
pclControl = m_clControlList.GetNext(ControlPos);
// Shaitan FastC {
if ((pclControl->m_pub_fn_csGetControlName() == "FastC_Run") ||
(pclControl->m_pub_fn_csGetControlName() == "FastC_Run (not yet available for this model)"))
{
CAR_EDIT_TDSTACTOR *p_tdstActor = m_pclActorMS->m_pclParentActor->m_fn_ptdstGetMotorActor();
if (p_tdstActor->h_Brain->p_stMind->p_stAIModel->CFast_lFunction == 0)
{
pclControl->m_pub_fn_csSetControlName("FastC_Run (not yet available for this model)");
pclControl->m_fn_vMakeReadOnly();
}
else
{
pclControl->m_pub_fn_csSetControlName("FastC_Run");
pclControl->m_fn_vMakeReadWrite();
}
}
else
//End Shaitan FastC }
if ( (!pclControl->m_fn_bIsAlwaysReadOnly())
&& (pclControl->m_fn_bIsReadOnly())
)
pclControl->m_fn_vMakeReadWrite();
}
}
}
//**************************************************************************************
//Maniability
tdeMiniStructureManiability EdActors_MiniStructure::m_fn_tdeGetManiability()
{
return m_tdeManiability;
}
//**************************************************************************************
BOOL EdActors_MiniStructure::m_fn_bCanBeUnallocated()
{
return ( ( m_tdeManiability != MS_MANIABILITY_ALWAYS_ALLOCATED )
&& ( m_tdeManiability != MS_MANIABILITY_ALLOCATED_ONLY_ONCE ) //can not be unallocated for this type
);
}
//**************************************************************************************
BOOL EdActors_MiniStructure::m_fn_bCanBeAllocated()
{
return ( (m_tdeManiability == MS_MANIABILITY_NORMAL)
|| ( (m_tdeManiability == MS_MANIABILITY_ALLOCATED_ONLY_ONCE)
&& (!m_fn_bIsAlreadyAllocated())
)
);
}
//**************************************************************************************
void EdActors_MiniStructure::m_fn_vHasBeenAllocated()
{
m_bIsAlreadyAllocated = TRUE;
}
//**************************************************************************************
void EdActors_MiniStructure::m_fn_vHasBeenUnallocated()
{
if ( m_tdeManiability == MS_MANIABILITY_ALLOCATED_ONLY_ONCE )
m_bIsAlreadyAllocated = FALSE;
}
//**************************************************************************************
BOOL EdActors_MiniStructure::m_fn_bIsAlreadyAllocated()
{
return m_bIsAlreadyAllocated;
}
//**************************************************************************************
//**************************************************************************************
//**************************************************************************************
EdActors_MiniStructureList::EdActors_MiniStructureList()
{
}
//**************************************************************************************
EdActors_MiniStructureList::~EdActors_MiniStructureList()
{
m_fn_vEmptyList();
}
//**************************************************************************************
EdActors_MiniStructure* EdActors_MiniStructureList::m_fn_pclAddElement( CString csName,
tdeMiniStructureManiability tdeManiability)
{
EdActors_MiniStructure *pclNewElement = new EdActors_MiniStructure(csName, tdeManiability);
AddTail(pclNewElement);
return pclNewElement;
}
//**************************************************************************************
void EdActors_MiniStructureList::m_fn_vEmptyList()
{
POSITION pos = GetHeadPosition();
while( pos != NULL )
delete (GetNext(pos));
RemoveAll();
}
//**************************************************************************************
void EdActors_MiniStructureList::m_fn_vUpdateControlsForInstance()
{
POSITION pos = GetHeadPosition();
while( pos != NULL )
GetNext(pos)->m_fn_vUpdateControlsForInstance();
}
//**************************************************************************************
void EdActors_MiniStructureList::m_fn_vUpdateControlsForModel()
{
POSITION pos = GetHeadPosition();
while( pos != NULL )
GetNext(pos)->m_fn_vUpdateControlsForModel();
}
//**************************************************************************************
// Searches and Highlites the given Data
void EdActors_MiniStructureList::m_fn_vHighliteData(CTL_Editor_Data *pclData)
{
//Searches for the Data
BOOL bFound = FALSE;
CTL_Editor_Control *pclControl;
EdActors_MiniStructure *pclMS;
POSITION ControlPos;
POSITION MSpos = GetHeadPosition();
while( (MSpos != NULL) && (!bFound) )
{
pclMS = GetNext(MSpos);
ControlPos = pclMS->m_clControlList.GetHeadPosition();
while ( (ControlPos != NULL) && (!bFound) )
{
pclControl = pclMS->m_clControlList.GetNext(ControlPos);
bFound = ( pclControl->m_fn_pclGetEditedData() == pclData );
}
}
ERROR_ASSERT( bFound );
//Opens the MS
if ( !(pclMS->m_pclActorMS->m_fn_bIsOpen()) )
{
ERROR_ASSERT( pclMS->m_pclActorMS->m_fn_bIsAllocated() );
pclMS->m_pclActorMS->m_tdeState = MS_STATE_DEVELOPPED;
}
//Highlites it
// pclControl->m_fn_vHighlite();
}
//**************************************************************************************
//**************************************************************************************
//**************************************************************************************
// Definition of the class for the list of lists of mini-structures
//**************************************************************************************
EdActors_MSListsList::EdActors_MSListsList()
{
}
//**************************************************************************************
EdActors_MSListsList::~EdActors_MSListsList()
{
}
//**************************************************************************************
EdActors_MiniStructureList *EdActors_MSListsList::m_fn_pclAddElement(/*CString csGroupName*/)
{
EdActors_MiniStructureList *pclCreatedElement;
pclCreatedElement = new EdActors_MiniStructureList();
AddTail(pclCreatedElement);
return pclCreatedElement;
}
//**************************************************************************************
//Returns NULL if Index is not in a right range
EdActors_MiniStructureList *EdActors_MSListsList::m_fn_pclGetListFromIndex(unsigned char ucIndex)
{
unsigned char ucCurrentIndex = 0;
EdActors_MiniStructureList *pclMSList = NULL;
POSITION pos = GetHeadPosition();
while ( pos != NULL )
{
if ( ucCurrentIndex == ucIndex )
pclMSList = GetNext(pos);
else
GetNext(pos);
ucCurrentIndex ++;
}
return pclMSList;
}