Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,743 @@
// Implementation file for the definition of an object list
/////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "TAC.h"
#include "EDACCnst.hpp"
#include "CPA_CtlO.hpp"
#include "_AInterf.hpp"
#include "CPA_DatO.hpp"
#include "CPA_NLL.hpp"
#include "EDACDgNL.hpp"
#include "EDACStrg.hpp"
#include "EDACModl.hpp"
//External Modules
#include "ErO.h"
//End of External Modules
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Constructor / Destructor
//**************************************************************************************
CPA_Editor_ObjectListControl::CPA_Editor_ObjectListControl(BOOL bReadOnly,
BOOL bUserCanChangeAspect,
BOOL bNoNames,
BOOL bNoAlternateList,
CTL_Editor_ControlList *_pclParentList,
CString _csControlName,
BOOL _bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
)
: CTL_Editor_Control(CTL_DATA_TYPE__USE_USER_DEFINED_TYPE,
bReadOnly,
CTL_SPACING_TYPE__MULTI_LINE,
bUserCanChangeAspect,
_pclParentList,
_csControlName,
_bAcceptsToTakeNameOfData,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
)
{
m_p_oPushButtonToEdit = NULL;
m_p_oPushButtonToRename = NULL;
m_p_oNamesCombo = NULL;
m_p_oAlternateNamesCombo = NULL;
m_bNoNames = bNoNames;
m_bNoAlternateList = bNoAlternateList;
}
//**************************************************************************************
CPA_Editor_ObjectListControl::~CPA_Editor_ObjectListControl()
{
}
//Member functions
//**************************************************************************************
//Function called to create associated control
BOOL CPA_Editor_ObjectListControl::m_fn_bCreateControl(CWnd *pclParentWnd)
{
BOOL bReturnValue = TRUE;
m_pclParentWnd = pclParentWnd;
m_pro_fn_bCreateBaseControls( C_OLIST_NAME_PERCENT_WIDTH,
27,
C_EDIT_HEIGHT);
CTL_Editor_BaseControl *pclBC;
if ( !m_fn_bIsAlwaysReadOnly() )
{
//Creates the combo box containing the names of the current name list
m_p_oNamesCombo = new CTL_Editor_ComboBox(CTL_COMBO_BOX_TYPE_USE_USER_DEFINED_TYPE,
WS_TABSTOP,
this,
m_pclParentWnd,
OAC_COMBO_BOX_TYPE__OBJECTS_LIST_COMBO_BOX,
OAC_COMBO_BOX_RETURN_CODE_VALUE__OBJECTS_LIST_NAMES);
m_p_oNamesCombo->m_pub_fn_vSetSelChanged_CallBack(s_m_fn_vComboBoxSelChanged);
m_p_oNamesCombo->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - ObjectList Name");
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail( m_p_oNamesCombo,
m_p_oNamesCombo,
this,
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
C_OLIST_BOX_PERCENT_WIDTH,
C_OLIST_BOX_MIN_WIDTH,
C_OLIST_COMBO_BOX_HEIGHT,
FALSE,
FALSE);
pclBC->m_pub_fn_vSetMustBeEnabledCallBack(s_m_fn_bComboMustBeEnabled);
}
m_p_oPushButtonToEdit = new CTL_Editor_Button("Edit",
CTL_BUTTON_TYPE__USE_USER_DEFINED_TYPE,
0,
this,
m_pclParentWnd,
OAC_BUTTON_TYPE__OBJECTS_LIST_BUTTON,
OAC_BUTTON_RETURN_CODE_VALUE__OBJECTS_LIST_EDIT
);
m_p_oPushButtonToEdit->m_pub_fn_vSetButtonHasBeenClicked_CallBack(s_m_fn_vAButtonHasBeenClicked);
m_p_oPushButtonToEdit->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - ObjectList Edit");
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_p_oPushButtonToEdit,
m_p_oPushButtonToEdit,
this,
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
C_OLIST_BUTTON_PERCENT_WIDTH,
C_OLIST_BUTTON_MIN_WIDTH,
C_OLIST_BUTTON_HEIGHT);
pclBC->m_pub_fn_vSetMustBeEnabledCallBack(s_m_fn_bButtonMustBeEnabled);
if ( !m_bNoAlternateList && !m_fn_bIsAlwaysReadOnly() )
{
//Creates the combo box containing the names of the current name list
m_p_oAlternateNamesCombo = new CTL_Editor_ComboBox(CTL_COMBO_BOX_TYPE_USE_USER_DEFINED_TYPE,
WS_TABSTOP,
this,
m_pclParentWnd,
OAC_COMBO_BOX_TYPE__OBJECTS_LIST_COMBO_BOX,
OAC_COMBO_BOX_RETURN_CODE_VALUE__OBJECTS_LIST_ALTERNATE_NAMES);
m_p_oAlternateNamesCombo->m_pub_fn_vSetSelChanged_CallBack(s_m_fn_vComboBoxSelChanged);
m_p_oAlternateNamesCombo->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - ObjectList AlternateNames");
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail( m_p_oAlternateNamesCombo,
m_p_oAlternateNamesCombo,
this,
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
C_OLIST_BOX_PERCENT_WIDTH + C_OLIST_NAME_PERCENT_WIDTH,
C_OLIST_BOX_MIN_WIDTH,
C_OLIST_COMBO_BOX_HEIGHT,
FALSE,
TRUE); //force this item to go to next line
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bAlternateComboMustBeDisplayed);
m_p_oPushButtonToRename = new CTL_Editor_Button("Rename",
CTL_BUTTON_TYPE__USE_USER_DEFINED_TYPE,
0,
this,
m_pclParentWnd,
OAC_BUTTON_TYPE__OBJECTS_LIST_BUTTON,
OAC_BUTTON_RETURN_CODE_VALUE__OBJECTS_LIST_RENAME);
m_p_oPushButtonToRename->m_pub_fn_vSetButtonHasBeenClicked_CallBack(s_m_fn_vAButtonHasBeenClicked);
m_p_oPushButtonToRename->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - ObjectList Rename");
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_p_oPushButtonToRename,
m_p_oPushButtonToRename,
this,
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
C_OLIST_BUTTON_PERCENT_WIDTH,
C_OLIST_BUTTON_MIN_WIDTH,
C_OLIST_BUTTON_HEIGHT);
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bRenameButtonCanBeDisplayed);
pclBC->m_pub_fn_vSetMustBeEnabledCallBack(s_m_fn_bButtonMustBeEnabled);
}
m_bControlCreated = bReturnValue;
return bReturnValue;
}
//************************************************************************************
//Function called to display the associated control(s) of the char.
void CPA_Editor_ObjectListControl::m_fn_vDisplay()
{
m_pro_fn_vDisplayBaseControls();
}
//************************************************************************
//Function called to update editor data of the CPA_XXData when a ComboBox receives OnSelChange()
//the action is the identifier of the combo box
void CPA_Editor_ObjectListControl::m_fn_vUpdateCurrentValue(short wAction /* = 0 */)
{
OAC_tdeUpdateReason eReason = OAC_E_ur_ComboSelChanged;
short wSelectedIndex = CB_ERR;
// if ( m_pclComboBox != NULL )
// {
// short wIndex = m_pclComboBox->GetCurSel();
// if ( wIndex != CB_ERR )
// ((CPA_Editor_ObjectListData *)m_pclData)->m_pclCurrentValue = (CTL_Editor_EnumElement *)(m_pclComboBox->GetItemDataPtr(wIndex));
// }
CPA_Editor_ObjectListData *pclData = (CPA_Editor_ObjectListData *)m_pclData;
switch ( wAction )
{
case OAC_COMBO_BOX_RETURN_CODE_VALUE__OBJECTS_LIST_NAMES: //the primary list
wSelectedIndex = m_p_oNamesCombo->GetCurSel();
if ( OAC_fn_bIsEditingAnInstance(this) )
{
//tell the actor not to use its current list. this will clear m_p_oObjectList as well
if ( pclData->m_p_oObjectList )
pclData->m_p_oObjectList->fn_bMakeActorNotUseThisList(OAC_fn_pclGetParentActorOfData(pclData));
//if a new list was selected
if ( wSelectedIndex != CB_ERR )
{
//set the pointer to the list
EdtList *p_oNewObjectList = (EdtList *) m_p_oNamesCombo->GetItemDataPtr(wSelectedIndex);
pclData->m_p_oObjectList = p_oNewObjectList;
eReason = OAC_E_ur_InstanceChangedObjectList;
//and tell the handler that the actor uses this list
if ( p_oNewObjectList )
p_oNewObjectList->fn_bMakeActorUseThisList(OAC_fn_pclGetParentActorOfData(pclData));
}
}
else /* is editing a model -> change current name list for the model */
{
CPA_tdoNameList *p_oNewNameList = (CPA_tdoNameList *) m_p_oNamesCombo->GetItemDataPtr(wSelectedIndex);
eReason = OAC_E_ur_ModelChangedNameList;
if ( p_oNewNameList != ((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList )
{
//tell the coherence manager to remember the model no longer uses its old name list.
g_oCoherenceManager.m_fn_vRemoveALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(pclData)->m_pclActor,
pclData->m_p_oNameList
);
//tell the coherence manager to remember the model now uses the new name list.
if ( p_oNewNameList )
g_oCoherenceManager.m_fn_vAddALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(pclData)->m_pclActor,
p_oNewNameList
);
// store the pointer in the editor data
pclData->m_p_oNameList = p_oNewNameList;
}
//if the model has instances and the selected list is valid, no more change is allowed
if
(
p_oNewNameList
&& ((EdActors_EditorActorModel *) OAC_fn_pclGetParentActorOfData(pclData))->m_fn_wGetRelatedInstancesCount() > 0
)
m_p_oNamesCombo->EnableWindow(FALSE);
}
break;
case OAC_COMBO_BOX_RETURN_CODE_VALUE__OBJECTS_LIST_ALTERNATE_NAMES: //the alternate list
eReason = OAC_E_ur_InstanceChangedAlternateList;
ERROR_ASSERT(!m_bNoAlternateList && m_p_oAlternateNamesCombo );
wSelectedIndex = m_p_oAlternateNamesCombo->GetCurSel();
if ( wSelectedIndex != CB_ERR )
{
CPA_ZonesActivatingList *p_oNewZAList = (CPA_ZonesActivatingList *) m_p_oAlternateNamesCombo->GetItemDataPtr(wSelectedIndex);
((CPA_Editor_ObjectListData *) m_pclData)->m_vSetZAList(p_oNewZAList);
//m_pclData->m_pclParentActor->m_pclActor->fn_vNotifySave(); //done in m_vSetZAList
//get the model of the instance
EdActors_EditorActor *p_oEditorModel = OAC_fn_pclGetParentActorOfData(pclData)->m_pclActor->m_fn_pclGetModel()->m_fn_pclGetEditorActor();
ERROR_ASSERT(p_oEditorModel);
//find the associated data for the model
CPA_Editor_ObjectListData *p_oModelData = (CPA_Editor_ObjectListData *) p_oEditorModel->m_fn_p_oFindDataByName(m_pclData->m_pub_fn_csGetDataName());
//if the model has no default activation list
if ( !p_oModelData->m_p_oZAList && p_oNewZAList )
{
//give it this one
p_oModelData->m_vSetZAList(p_oNewZAList);
//and save the model to remember that
//p_oEditorModel->m_pclActor->fn_vNotifySave(); //done in m_vSetZAList
//TODO: capture cohmnge messages to the interface to handle invalidation of links...
}
}
else
pclData->m_vSetZAList(NULL);
break;
}
// normally this call is unnecessary because the control is already up-to-date, but we never know...
//update the contents of the combo according to the new name list
m_fn_vUpdate();
m_fn_vUpdateParent(CTL_UPDATE_REASON__USE_USER_DEFINED_REASON, eReason);
}
//************************************************************************
//Function called to update editor data of the CPA_XXData when a CheckBox receives Onclicked()
void CPA_Editor_ObjectListControl::m_fn_vSetValue(short wAction)
{
tdstEdtListMess stMessage;
OAC_tdeUpdateReason eReason = OAC_E_ur_ButtonClicked;
CPA_Editor_ObjectListData *pclData = (CPA_Editor_ObjectListData *)m_pclData;
switch ( wAction )
{
case OAC_BUTTON_RETURN_CODE_VALUE__OBJECTS_LIST_EDIT: //the "edit" button was pressed
if ( OAC_fn_bIsEditingAnInstance(this) )
{
if ( ((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList )
{
stMessage.csListType = ((CPA_Editor_ObjectListData *) m_pclData)->m_pub_fn_csGetDataName();
stMessage.pActor = (CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(pclData)->m_pclActor->m_pub_fn_pclGetSuperObject();
stMessage.ulIndexInList = -1;
stMessage.pObject = NULL;
stMessage.pList = ((CPA_Editor_ObjectListData *) m_pclData)->m_p_oObjectList;
CPA_DLLBase *p_oDll = g_pclInterface->GetMainWorld()->GetDLLWithTypeName(M_MAKECHAR(stMessage.csListType));
if ( p_oDll )
p_oDll->OnQueryAction(g_pclInterface, C_uiQueryEditAnObjectList, (long) &stMessage);
}
else
{
//tell the user that there is no name list in the model...
MessageBox(
m_p_oPushButtonToEdit->m_hWnd, //parent window of the dialog
"There is no name list defined\nfor this instance's model",
"Actor's Editor Warning",
MB_OK
);
}
}
else /* we are editing a model */
{
CString csRototo;
short wInstancesCount = ((EdActors_EditorActorModel *) OAC_fn_pclGetParentActorOfData(pclData))->m_fn_wGetRelatedInstancesCount();
EdActors_EditNameListsDialog *p_oDialog;
tdstCarEditNameListsDialogArgs stArgs;
// ALX
csRototo = g_c_csGenericNameListType + ((CPA_Editor_ObjectListData *) m_pclData)->m_pub_fn_csGetDataName();
// End ALX
stArgs.stIn.p_c_szNameListType = LPCTSTR(csRototo);
stArgs.stIn.p_oEditorActor = OAC_fn_pclGetParentActorOfData(pclData);
stArgs.stIn.p_oCurrentNameList = ((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList;
stArgs.stIn.p_c_szScriptName = LPCTSTR(((CPA_Editor_ObjectListData *) m_pclData)->m_pub_fn_csGetDataName());
//the model can select a different name list only if he has no instance or he specified no name list
//before starting to create instances
//in which condition the model can change its name list to select another ?
stArgs.stIn.bModelCanSelectANameList = (wInstancesCount <= 0) //it has no instance
|| !stArgs.stIn.p_oCurrentNameList //if it has instances, it must not a a name list yet
|| (stArgs.stIn.p_oCurrentNameList->m_pEdtListHandler->fn_oGetListOfEdtLists()->GetCount() <= 0); //if it has a name list, no object list must be defined for it
stArgs.stIn.bNoNames = m_bNoNames;
HINSTANCE hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
p_oDialog = new EdActors_EditNameListsDialog(&stArgs);
p_oDialog->DoModal();
delete p_oDialog;
AfxSetResourceHandle(hOldInstance);
// the model can change its current name list only if no instance exist...
if
(
stArgs.stIn.bModelCanSelectANameList
&& stArgs.stIn.p_oCurrentNameList != stArgs.stOut.p_oNameListSelectedForModel
)
{
//tell the instances that the model selected a name list
eReason = OAC_E_ur_ModelChangedNameList;
//tell the coherence manager to remember the model no longer uses its old name list.
#if defined ( D_UseCoherenceManager )
g_oCoherenceManager.m_fn_vRemoveALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(pclData)->m_pclActor,
((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList
);
//tell the coherence manager to remember the model now uses the new name list.
if ( stArgs.stOut.p_oNameListSelectedForModel )
g_oCoherenceManager.m_fn_vAddALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(pclData)->m_pclActor,
stArgs.stOut.p_oNameListSelectedForModel
);
#endif /* D_UseCoherenceManager */
//since the model changed a name list, its current object and activation lists must be forgotten
((CPA_Editor_ObjectListData *) m_pclData)->m_vSetObjectList(NULL);
((CPA_Editor_ObjectListData *) m_pclData)->m_vSetZAList(NULL);
// store the pointer on the new name list in the editor data
((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList = stArgs.stOut.p_oNameListSelectedForModel;
if
(
stArgs.stOut.p_oNameListSelectedForModel
&& ((EdActors_EditorActorModel *) OAC_fn_pclGetParentActorOfData(pclData))->m_fn_wGetRelatedInstancesCount() > 0
)
m_p_oNamesCombo->EnableWindow(FALSE);
}
else
eReason = OAC_E_ur_ModelEditedNameList;
}
break;
case OAC_BUTTON_RETURN_CODE_VALUE__OBJECTS_LIST_RENAME: //the rename button was pressed (in instance mode)
{
eReason = OAC_E_ur_InstanceRenamedObjectList;
//get the current edited object list
short wSelIndex = m_p_oNamesCombo->GetCurSel();
if ( wSelIndex != CB_ERR )
{
EdtList *p_oEdtList = (EdtList *) m_p_oNamesCombo->GetItemDataPtr(wSelIndex);
CDialog *p_oDialog = new CDialog();
p_oDialog->Create(IDD_CAR_DIALOG_OBJECTLIST_RENAME, m_p_oPushButtonToRename);
//get strings to init the controls in the dialog
CString csCurrentName = p_oEdtList->GetName();
CString csStaticCaption;
p_oDialog->GetDlgItem(IDC_STATIC_OLR_RENAMELIST)->GetWindowText(csStaticCaption);
short wNameInsertPos = csStaticCaption.Find('<EFBFBD>');
csStaticCaption = csStaticCaption.Left(wNameInsertPos) + csCurrentName + csStaticCaption.Mid(wNameInsertPos + 1);
p_oDialog->GetDlgItem(IDC_EDIT_OLR_NAME)->SetWindowText(csCurrentName);
p_oDialog->GetDlgItem(IDC_STATIC_OLR_RENAMELIST)->SetWindowText(csStaticCaption);
//create the dialog to get the new name
p_oDialog->ShowWindow(TRUE);
BOOL bChangeAccepted = (p_oDialog->RunModalLoop() == IDOK);
if ( bChangeAccepted ) //if name is accepted, get it
p_oDialog->GetDlgItem(IDC_EDIT_OLR_NAME)->GetWindowText(csCurrentName);
delete p_oDialog;
if ( bChangeAccepted )
{
p_oEdtList->fn_bUnValidate();
((CPA_SaveObject *) p_oEdtList->GetOwner())->fn_vUpdateReference(p_oEdtList);
p_oEdtList->fn_bValidate();
//the rename will cause a rename notification that will notify all dependent actors as well
p_oEdtList->fn_eRename(csCurrentName);
((CPA_SaveObject *) p_oEdtList->GetOwner())->fn_vUpdateReference(p_oEdtList);
//now update the string in the combo too
m_p_oNamesCombo->DeleteString(wSelIndex);
VERIFY(m_p_oNamesCombo->InsertString(wSelIndex, p_oEdtList->GetName()) == wSelIndex);
m_p_oNamesCombo->SetItemDataPtr(wSelIndex, p_oEdtList);
m_p_oNamesCombo->SetCurSel(wSelIndex);
}
}
}
break;
default: // debug...
ERROR_ASSERT(FALSE);
break;
}
//update the contents of the combo according to the new name list
m_fn_vUpdate(CTL_UPDATE_REASON__USE_USER_DEFINED_REASON, eReason);
//Updates parent's controls if necessary (Watch Window, ...)
m_fn_vUpdateParent(CTL_UPDATE_REASON__USE_USER_DEFINED_REASON, eReason);
}
//************************************************************************
//fills the controls with editor data
void CPA_Editor_ObjectListControl::m_fn_vUpdate(CTL_tdeUpdateReason _eReason /*= CTL_UPDATE_REASON__NO_REASON_GIVEN*/,
long _lUserDefinedReason /*= 0*/)
{
/* if ( (m_pclCheckBoxForLink != NULL) && (m_pclData != NULL) )
{
m_pclCheckBoxForLink->SetCheck(m_pclData->m_pub_fn_bIsLinked());
m_pclCheckBoxForLink->EnableWindow( (m_pclData->m_fn_eGetLink() != E_dlm_AlwaysLinked)
&& (m_pclData->m_fn_eGetLink() != E_dlm_NeverLinked)
);
}*/
CPA_Editor_ObjectListData *pclData = (CPA_Editor_ObjectListData *)m_pclData;
if ( m_pclData->m_pub_fn_bGetDataHasChanged() )
{
CPA_tdoNameList *p_oNameList;
CString csReachableType = g_c_csGenericNameListType + ((CPA_Editor_ObjectListData *) m_pclData)->m_pub_fn_csGetDataName();
//make the buttons display their text
if ( m_p_oPushButtonToEdit )
m_p_oPushButtonToEdit->SetCheck(FALSE);
m_p_oNamesCombo->ResetContent();
m_p_oNamesCombo->SetItemDataPtr(m_p_oNamesCombo->AddString("No List"), NULL);
if ( !m_bNoAlternateList && m_p_oAlternateNamesCombo )
{
m_p_oAlternateNamesCombo->ResetContent();
m_p_oAlternateNamesCombo->SetItemDataPtr(m_p_oAlternateNamesCombo->AddString("No ZA List"), NULL);
}
if ( OAC_fn_bIsEditingAnInstance(this) )
{
//fill the m_p_oNamesCombo with the names of the data's m_p_oNameList
p_oNameList = ((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList;
if ( !p_oNameList )
{
((CPA_Editor_ObjectListData *) m_pclData)->m_vSetObjectList(NULL);
((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList = NULL;
((CPA_Editor_ObjectListData *) m_pclData)->m_vSetZAList(NULL);
}
else
{
short wInstanceIndex = CB_ERR;
short wNbObjectLists = 0;
CPA_List<EdtList> *p_oListOfObjectLists = p_oNameList->m_pEdtListHandler->fn_oGetListOfEdtLists();;
wNbObjectLists = p_oListOfObjectLists->GetCount();
if ( p_oListOfObjectLists && wNbObjectLists )
for ( short wIndex = 0; wIndex < wNbObjectLists; wIndex ++ )
{
//get the list of objects
EdtList *p_oObjectList = (EdtList *) p_oListOfObjectLists->FindElementFromIndex(wIndex);
/*if ( p_oObjectList->fn_bIsOfType(C_szEdtListTypeName) ) //TODO-B 21/02/97: a virer + tard...
{*/
//add its name in the combo
short wPos = m_p_oNamesCombo->AddString(p_oObjectList->GetName());
//set the pointer
m_p_oNamesCombo->SetItemDataPtr(wPos, p_oObjectList);
if ( p_oObjectList == ((CPA_Editor_ObjectListData *) m_pclData)->m_p_oObjectList )
wInstanceIndex = wPos;
//}
}
if ( wInstanceIndex != CB_ERR )
m_p_oNamesCombo->SetCurSel(wInstanceIndex);
//fill the other combo with the list of zone activating lists for the name list
wInstanceIndex = CB_ERR;
if ( !m_bNoAlternateList && m_p_oAlternateNamesCombo )
{
CPA_List<CPA_BaseObject> oActivationListList;
g_pclInterface->GetMainWorld()->fn_lFindObjects(
&oActivationListList,
"" /* obj name */,
C_szZAListTypeName, /* type */
p_oNameList /* owner */
);
short wNbActivationLists = oActivationListList.GetCount();
POSITION Pos = oActivationListList.GetHeadPosition ();
while (Pos)
{
//get the activation list
CPA_ZonesActivatingList *p_oActivationList = (CPA_ZonesActivatingList *) oActivationListList.GetNext(Pos);
short wPos = m_p_oAlternateNamesCombo->AddString(p_oActivationList->GetName());
m_p_oAlternateNamesCombo->SetItemDataPtr(wPos, p_oActivationList);
if ( p_oActivationList == ((CPA_Editor_ObjectListData *) m_pclData)->m_p_oZAList )
wInstanceIndex = wPos;
}
}
if ( wInstanceIndex != CB_ERR )
m_p_oAlternateNamesCombo->SetCurSel(wInstanceIndex);
}
}
else // we display the data for a model
{
//fill the m_p_oNamesCombo with the names of available name lists
//Gets the current Family's List of name lists
CPA_List<CPA_BaseObject> oNameListList;
g_pclInterface->GetMainWorld()->fn_lFindObjects(
&oNameListList,
"",
csReachableType,
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(pclData)->m_pclActor->m_pub_fn_pclGetFamily() /* owner */
);
short wNbNameLists = (short) oNameListList.GetCount();
short wOk = 0, wModelIndex = -1;
if ( wNbNameLists == 0 ) // no name list remain
{
#if defined ( D_UseCoherenceManager )
//remove the coherence link
if ( ((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList )
g_oCoherenceManager.m_fn_vRemoveALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(pclData)->m_pclActor,
((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList
);
#endif /* D_UseCoherenceManager */
//make the model reference no list
((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList = NULL;
}
else
{
//for each list of names we got
POSITION Pos= oNameListList.GetHeadPosition();
short wIndex = 1;
while (Pos)
{
//get the list of names
p_oNameList = (CPA_tdoNameList *) oNameListList.GetNext(Pos);
/*if ( p_oNameList->fn_bIsOfType(M_MAKECHAR(csReachableType)) ) //TODO-B 01/03/97: a virer + tard...
{*/
wOk = 1;
//add its name in the combo
short wPos = m_p_oNamesCombo->AddString(p_oNameList->GetName());
//set the pointer
m_p_oNamesCombo->SetItemDataPtr(wPos, p_oNameList);
if
(
((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList
&& p_oNameList == ((CPA_Editor_ObjectListData *) m_pclData)->m_p_oNameList
)
wModelIndex = wIndex;
/*}*/
wIndex++;
}
}
// make the combo select the name of the current name list
if ( wOk )
m_p_oNamesCombo->SetCurSel(wModelIndex);
}
}
}
//************************************************************************
//Function called to update parent window in case of values changes.
void CPA_Editor_ObjectListControl::m_fn_vUpdateParent(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
//Updates parent if necessary(Watch a.s.o.)
CTL_Editor_Control::m_fn_vUpdateParent(eReason, _lUserDefinedReason);
//Updates motor's data
m_pclData->m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to make control Read Only
void CPA_Editor_ObjectListControl::m_fn_vMakeReadOnly()
{
if ( !m_fn_bIsReadOnly() )
{
m_bIsReadOnly = TRUE;
}
}
//************************************************************************
//Function called to make control Read-Write
void CPA_Editor_ObjectListControl::m_fn_vMakeReadWrite()
{
if ( (m_fn_bIsReadOnly()) && (!m_fn_bIsAlwaysReadOnly()) )
{
m_bIsReadOnly = FALSE;
}
}
//************************************************************************
// CALLBACKS
//************************************************************************
void CPA_Editor_ObjectListControl::s_m_fn_vAButtonHasBeenClicked(class CTL_Editor_Button *_pclSenderButton,
class CTL_Editor_Control *_pclParentControl,
enum CTL_eButtonType _tdeType,
long _lUserDefinedType,
long _lUserDefinedCode)
{
ERROR_ASSERT( _tdeType == CTL_BUTTON_TYPE__USE_USER_DEFINED_TYPE );
ERROR_ASSERT( _lUserDefinedType == OAC_BUTTON_TYPE__OBJECTS_LIST_BUTTON );
ERROR_ASSERT( _pclParentControl != NULL );
((CPA_Editor_ObjectListControl *)_pclParentControl)->m_fn_vSetValue((short)_lUserDefinedCode);
}
//************************************************************************
void CPA_Editor_ObjectListControl::s_m_fn_vComboBoxSelChanged(class CTL_Editor_ComboBox *_pclSenderComboBox,
class CTL_Editor_Control *_pclParentControl,
enum CTL_eComboBoxType _tdeType,
long _lUserDefinedType,
long _lUserDefinedCode)
{
ERROR_ASSERT( _tdeType == CTL_COMBO_BOX_TYPE_USE_USER_DEFINED_TYPE );
ERROR_ASSERT( _lUserDefinedType == OAC_COMBO_BOX_TYPE__OBJECTS_LIST_COMBO_BOX );
ERROR_ASSERT( _pclParentControl != NULL );
((CPA_Editor_ObjectListControl *)_pclParentControl)->m_fn_vUpdateCurrentValue((short)_lUserDefinedCode);
}
//************************************************************************
BOOL CPA_Editor_ObjectListControl::s_m_fn_bRenameButtonCanBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
{
CPA_Editor_ObjectListControl *pclControl = (CPA_Editor_ObjectListControl *)_pclSenderBaseControl->m_pub_fn_pclGetParentControl();
return OAC_fn_bIsEditingAnInstance(pclControl);
}
//************************************************************************
BOOL CPA_Editor_ObjectListControl::s_m_fn_bButtonMustBeEnabled(class CTL_Editor_BaseControl *_pclSenderBaseControl)
{
return !_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsAlwaysReadOnly();
}
//************************************************************************
BOOL CPA_Editor_ObjectListControl::s_m_fn_bComboMustBeEnabled(class CTL_Editor_BaseControl *_pclSenderBaseControl)
{
CPA_Editor_ObjectListControl *pclControl = (CPA_Editor_ObjectListControl *)_pclSenderBaseControl->m_pub_fn_pclGetParentControl();
CPA_Editor_ObjectListData *pclData = (CPA_Editor_ObjectListData *)pclControl->m_pclData;
BOOL bMustBeEnabled = FALSE;
//The edited Actor is an Instance
if ( OAC_fn_bIsEditingAnInstance(pclControl) )
{
//if the list contains a specific item, the instance cannot select another list
if ( pclData->m_p_oNameList->m_bHasAVirgeField() )
bMustBeEnabled = FALSE;
else
bMustBeEnabled = TRUE;
}
//The edited Actor is a Model
else
{
if ( //it has at least one associated instance
( ((EdActors_EditorActorModel *) OAC_fn_pclGetParentActorOfData(pclData))->m_fn_wGetRelatedInstancesCount() > 0 )
//and it already has a selected name list
&& ( pclData->m_p_oNameList != NULL )
)
//the combo just gives the name of the current name list
bMustBeEnabled = FALSE;
else
bMustBeEnabled = TRUE;
}
return bMustBeEnabled;
}
//************************************************************************
BOOL CPA_Editor_ObjectListControl::s_m_fn_bAlternateComboMustBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
{
CPA_Editor_ObjectListControl *pclControl = (CPA_Editor_ObjectListControl *)_pclSenderBaseControl->m_pub_fn_pclGetParentControl();
BOOL bMustBeDisplayed = FALSE;
if ( !pclControl->m_bNoAlternateList )
{
if ( OAC_fn_bIsEditingAnInstance(pclControl) )
bMustBeDisplayed = TRUE;
else
bMustBeDisplayed = FALSE;
}
return bMustBeDisplayed;
}

View File

@@ -0,0 +1,381 @@
// Implementation file for the definition of an Action / States characteristic
///////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
//ANNECY CHRISTOPHE MODIFICATIONS
#define D_ZdxStuff_StructureDefine
//ANNECY END CHRISTOPHE MODIFICATIONS
#include "CPA_CtlS.hpp"
#include "CPA_DatS.hpp"
#include "EDACCnst.hpp"
//External Modules
#include "ErO.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//**************************************************************************
//Constructor / Destructor
CPA_Editor_StateControl::CPA_Editor_StateControl(BOOL _bReadOnly,
CTL_Editor_ControlList *_pclParentList,
CString _csControlName,
BOOL _bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
unsigned char ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
)
: CTL_Editor_Control(CTL_DATA_TYPE__USE_USER_DEFINED_TYPE,
_bReadOnly,
CTL_SPACING_TYPE__MULTI_LINE,
FALSE,
_pclParentList,
_csControlName,
_bAcceptsToTakeNameOfData, //ANNECY BBB
//Stefan Dumitrean 20-07-98 ( OAC buttons )
ucInitialCurrentPair
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
)
{
m_pclEnumDescriptorForActions = NULL;
m_pclEnumDescriptorForStates = NULL;
m_pclComboBoxForActions = NULL;
m_pclStaticForActions = NULL;
m_pclStaticForStatesName = NULL;
m_pclStaticForStates = NULL;
m_pclCheckBoxForRandom = NULL;
}
//**************************************************************************
CPA_Editor_StateControl::~CPA_Editor_StateControl()
{
delete m_pclComboBoxForActions;
delete m_pclStaticForActions;
delete m_pclStaticForStatesName;
delete m_pclStaticForStates;
delete m_pclCheckBoxForRandom;
}
//Member functions
//**************************************************************************
//Function called to create associated control
BOOL CPA_Editor_StateControl::m_fn_bCreateControl(CWnd *pclParentWnd)
{
BOOL bReturnValue = TRUE;
m_pclParentWnd = pclParentWnd;
m_pro_fn_bCreateBaseControls( C_STATE_NAME_PERCENT_WIDTH,
C_STATE_NAME_MIN_WIDTH,
C_EDIT_HEIGHT);
//Creates the static control (Read only)
m_pclStaticForActions = new CTL_Editor_Static("", CTL_STATIC_TYPE__FIELD_VALUE, 0, NULL, m_pclParentWnd);
m_pclStaticForActions->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Action Value");
CTL_Editor_BaseControl *pclBC;
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclStaticForActions,
m_pclStaticForActions,
this,
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
C_STATE_COMBO_BOX_PERCENT_WIDTH,
C_STATE_COMBO_BOX_MIN_WIDTH,
C_EDIT_HEIGHT,
!m_fn_bIsAlwaysReadOnly());
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bStaticCanBeDisplayed);
if ( !m_fn_bIsAlwaysReadOnly() )
{
//Creates the combo box
m_pclComboBoxForActions = new CTL_Editor_ComboBox(CTL_COMBO_BOX_TYPE__STANDARD,
WS_TABSTOP,
this,
m_pclParentWnd);
m_pclComboBoxForActions->m_pub_fn_vSetSelChanged_CallBack(s_m_fn_vComboBoxSelChanged);
m_pclComboBoxForActions->m_pub_fn_vSetDropDown_CallBack(s_m_fn_vComboBoxDroppedDown);
m_pclComboBoxForActions->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Action");
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclComboBoxForActions,
m_pclComboBoxForActions,
this,
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
C_STATE_COMBO_BOX_PERCENT_WIDTH,
C_STATE_COMBO_BOX_MIN_WIDTH,
C_STATE_COMBO_BOX_HEIGHT);
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bComboBoxCanBeDisplayed);
}
//Creates a static control for the State declaration
m_pclStaticForStatesName = new CTL_Editor_Static("State", CTL_STATIC_TYPE__NEUTRAL_FIELD, 0, NULL, m_pclParentWnd);
m_pclStaticForStatesName->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - State Header");
m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclStaticForStatesName,
m_pclStaticForStatesName,
this,
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
C_STATE_STATIC_NAME_PERCENT_WIDTH,
0, //no min. size for static name
C_EDIT_HEIGHT,
FALSE,
TRUE);
//Creates a static control for the State
m_pclStaticForStates = new CTL_Editor_Static("", CTL_STATIC_TYPE__FIELD_VALUE, 0 , NULL, m_pclParentWnd);
m_pclStaticForStates->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - State Value");
m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclStaticForStates,
m_pclStaticForStates,
this,
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
C_STATE_STATIC_PERCENT_WIDTH,
C_STATE_STATIC_MIN_WIDTH,
C_EDIT_HEIGHT);
//Creates a Check Box for Random initial States
m_pclCheckBoxForRandom = new CTL_Editor_CheckBox(CTL_CHECK_BOX_TYPE__NORMAL,
WS_TABSTOP,
this,
m_pclParentWnd,
0, 0,
"Normal", "Random");
m_pclCheckBoxForRandom->m_pub_fn_vSetHasBeenClicked_CallBack(s_m_fn_vCheckBoxHasBeenClicked);
m_pclCheckBoxForRandom->m_pub_fn_vRegisterWindowsControl(m_pub_fn_csGetControlName() + " - Random State");
pclBC = m_pclListOfBaseControls->m_pub_fn_pclAddControlAtTail(m_pclCheckBoxForRandom,
m_pclCheckBoxForRandom,
this,
CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL,
C_STATE_BUTTON_PERCENT_WIDTH,
C_STATE_BUTTON_MIN_WIDTH,
C_STATE_BUTTON_HEIGHT);
pclBC->m_pub_fn_vSetCanBeDisplayedCallBack(s_m_fn_bButtonCanBeDisplayed);
m_bControlCreated = bReturnValue;
return bReturnValue;
}
//**************************************************************************
//Function called to display the associated control of the char.
void CPA_Editor_StateControl::m_fn_vDisplay()
{
m_pro_fn_vDisplayBaseControls();
}
//************************************************************************
void CPA_Editor_StateControl::m_fn_vUpdateCurrentValue()
{
//Gets the new current value
if ( m_pclComboBoxForActions != NULL )
{
short wIndex = m_pclComboBoxForActions->GetCurSel();
if ( wIndex != CB_ERR )
{
CTL_Editor_EnumElement * pSelect = (CTL_Editor_EnumElement *) m_pclComboBoxForActions->GetItemDataPtr(wIndex);
if ((pSelect->m_pub_fn_lGetValue() != 0) || (m_pclComboBoxForActions->GetCount() == 1))
((CPA_Editor_StateData *)m_pclData)->m_pclCurrentValueForActions = pSelect;
}
//Updates State edited value
//Sets state to Action's default state
((CPA_Editor_StateData *)m_pclData)->m_fn_bSetCurrentValueForStateAccordingToAction();
}
m_fn_vUpdateParent(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
}
//************************************************************************
void CPA_Editor_StateControl::m_fn_vUpdate(CTL_tdeUpdateReason _eReason /*= E_ur_NoReasonGiven*/,
long _lUserDefinedReason /*= 0*/)
{
//Re-constructs the list of entries in ComboBox
m_pclEnumDescriptorForActions = ((CPA_Editor_StateData *)m_pclData)->m_fn_pclGetEnumDescriptorForActions();
m_pclEnumDescriptorForStates = ((CPA_Editor_StateData *)m_pclData)->m_fn_pclGetEnumDescriptorForStates();
if ( !m_fn_bIsAlwaysReadOnly() )
{
//Empties the ComboBox
m_pclComboBoxForActions->ResetContent();
//Fills the combo box
short wIndex;
POSITION pos = m_pclEnumDescriptorForActions->GetHeadPosition();
CTL_Editor_EnumElement *pclElement;
while ( pos != NULL )
{
pclElement = m_pclEnumDescriptorForActions->GetNext(pos);
wIndex = m_pclComboBoxForActions->AddString(pclElement->m_pub_fn_csGetElementName());
m_pclComboBoxForActions->SetItemDataPtr(wIndex, (void *)(pclElement));
}
}
//Read/Write
//Updates the combo box (Action)
CTL_Editor_EnumElement *pclSearchedElement = ((CPA_Editor_StateData *)m_pclData)->m_pclCurrentValueForActions;
CTL_Editor_EnumElement *pclCurrentComboValue;
BOOL bFound = FALSE;
if ( m_pclComboBoxForActions != NULL )
{
short wIndex = m_pclComboBoxForActions->GetCurSel();
for ( wIndex = 0; (wIndex < m_pclComboBoxForActions->GetCount()) && (!bFound); wIndex ++ )
{
pclCurrentComboValue = (CTL_Editor_EnumElement *)(m_pclComboBoxForActions->GetItemDataPtr(wIndex));
bFound = ( pclSearchedElement == pclCurrentComboValue );
}
if ( bFound )
m_pclComboBoxForActions->SetCurSel(--wIndex);
}
//Read Only
if ( ( m_pclStaticForActions != NULL )
&& ( ((CPA_Editor_StateData *)m_pclData)->m_pclCurrentValueForActions != NULL )
)
m_pclStaticForActions->m_fn_vSetTextToDisplay(((CPA_Editor_StateData *)m_pclData)->m_pclCurrentValueForActions->m_pub_fn_csGetElementName(), TRUE);
//Sets text to Display in State static
if ( ( m_pclStaticForStates != NULL )
&& ( ((CPA_Editor_StateData *)m_pclData)->m_pclCurrentValueForStates != NULL )
)
m_pclStaticForStates->m_fn_vSetTextToDisplay(((CPA_Editor_StateData *)m_pclData)->m_pclCurrentValueForStates->m_pub_fn_csGetElementName(), TRUE);
//Button (Random initial State)
m_pclCheckBoxForRandom->SetCheck(FALSE/*TEMPORAIRE*/);
//CallBack
m_pclData->m_fn_vDataHasBeenChanged(_eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to update parent window in case of values changes.
void CPA_Editor_StateControl::m_fn_vUpdateParent(CTL_tdeUpdateReason _eReason,
long _lUserDefinedReason /*= 0*/)
{
//Updates motor's data
m_pclData->m_fn_vUpdateMotorData(_eReason, _lUserDefinedReason);
m_fn_vUpdate(_eReason, _lUserDefinedReason);
//Updates parent if necessary (Watch a.s.o.)
CTL_Editor_Control::m_fn_vUpdateParent(_eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to make control Read Only
void CPA_Editor_StateControl::m_fn_vMakeReadOnly()
{
if ( !m_fn_bIsReadOnly() )
{
m_bIsReadOnly = TRUE;
m_fn_vHide();
}
}
//************************************************************************
//Function called to make control Read-Write
void CPA_Editor_StateControl::m_fn_vMakeReadWrite()
{
if ( !m_fn_bIsAlwaysReadOnly() )
{
if ( m_fn_bIsReadOnly() )
{
m_bIsReadOnly = FALSE;
m_fn_vHide();
}
}
}
//************************************************************************
BOOL CPA_Editor_StateControl::s_m_fn_bStaticCanBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
{
return _pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly();
}
//************************************************************************
BOOL CPA_Editor_StateControl::s_m_fn_bComboBoxCanBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
{
return (!_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_bIsReadOnly());
}
//************************************************************************
BOOL CPA_Editor_StateControl::s_m_fn_bButtonCanBeDisplayed(class CTL_Editor_BaseControl *_pclSenderBaseControl)
{
CPA_Editor_StateData *pclData = (CPA_Editor_StateData *)_pclSenderBaseControl->m_pub_fn_pclGetParentControl()->m_fn_pclGetEditedData();
ERROR_ASSERT( pclData != NULL );
return ( pclData->m_pub_fn_bIsTheInitialState() );
}
//************************************************************************
void CPA_Editor_StateControl::s_m_fn_vCheckBoxHasBeenClicked(class CTL_Editor_CheckBox *_pclSenderCheckBox,
class CTL_Editor_Control *_pclParentControl,
enum CTL_eCarCheckBoxType _tdeType,
long _lUserDefinedType,
long _lUserDefinedCode)
{
ERROR_ASSERT( _pclParentControl != NULL );
CPA_Editor_StateData *pclData = (CPA_Editor_StateData *)_pclParentControl->m_fn_pclGetEditedData();
ERROR_ASSERT( pclData != NULL );
//Reads buttons state
BOOL bCheck = _pclSenderCheckBox->GetCheck();
//Updates motor field
//Calls Motor function
}
//************************************************************************
//When selection has been changed in Actions Combo box
void CPA_Editor_StateControl:: s_m_fn_vComboBoxSelChanged(class CTL_Editor_ComboBox *_pclSenderComboBox,
class CTL_Editor_Control *_pclParentControl,
enum CTL_eComboBoxType _tdeType,
long _lUserDefinedType,
long _lUserDefinedCode)
{
ERROR_ASSERT( _pclParentControl != NULL );
//Re-builds the Enum Descriptor
CPA_Editor_StateData *pclData = (CPA_Editor_StateData *)_pclParentControl->m_fn_pclGetEditedData();
ERROR_ASSERT( pclData != NULL );
if ( pclData->m_pub_fn_bIsTheInitialState() )
{
}
else
{
}
((CPA_Editor_StateControl *)_pclParentControl)->m_fn_vUpdateCurrentValue();
}
//************************************************************************
//When selection has been changed in Actions Combo box
void CPA_Editor_StateControl:: s_m_fn_vComboBoxDroppedDown(class CTL_Editor_ComboBox *_pclSenderComboBox,
class CTL_Editor_Control *_pclParentControl,
enum CTL_eComboBoxType _tdeType,
long _lUserDefinedType,
long _lUserDefinedCode)
{
/* ERROR_ASSERT( _pclParentControl != NULL );
//Re-builds the Enum Descriptor
CPA_Editor_StateData *pclData = (CPA_Editor_StateData *)_pclParentControl->m_fn_pclGetEditedData();
ERROR_ASSERT( pclData != NULL );
pclData->m_fn_vConstructEnumDescriptors();
*/
}

View File

@@ -0,0 +1,702 @@
// Implementation file for the definition of a characteristic type
/////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "ACP_Base.h"
/////////////////////////////////////////////////////
//////// !!!!!!!!!!!! DANGER !!!!!!!!!!! ////////////
/////////////////////////////////////////////////////
#define _ED_CAR_MUST_DEFINE_STRUCT_
#include "EdAllAct.hpp"
/////////////////////////////////////////////////////
//////// !!!!!!!!!!!! End DANGER !!!!!!!!!!! ////////
/////////////////////////////////////////////////////
#include "_AInterf.hpp"
#include "CPA_DatO.hpp"
#include "EDACactr.hpp"
#include "edtlist.hpp"
#include "EDACStrg.hpp"
//External Modules
#include "ITF.h"
#include "TAC.h"
#include "ErO.h"
//End of External Modules
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Constructors / Destructor
//**************************************************************************************
CPA_Editor_ObjectListData::CPA_Editor_ObjectListData(CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
: CTL_Editor_Data(CTL_DATA_TYPE__USE_USER_DEFINED_TYPE,
csScriptName,
_pclParentList,
pclCurrentBaseData,
OAC_DATA_TYPE__OBJECT_LIST)
{
m_p_oObjectList = NULL;
m_p_oNameList = NULL;
m_p_oZAList = NULL;
}
//**************************************************************************************
CPA_Editor_ObjectListData::~CPA_Editor_ObjectListData()
{
}
//**************************************************************************************
void CPA_Editor_ObjectListData::m_vSetZAList(CPA_ZonesActivatingList *_p_oZAList)
{
if ( m_p_oZAList != _p_oZAList )
{
//tell the coherence manager to remember the actor no longer uses its old activation list.
if ( m_p_oZAList )
g_oCoherenceManager.m_fn_vRemoveALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(this)->m_pclActor,
m_p_oZAList
);
//tell the coherence manager to remember the instance now uses the new activation list.
if ( _p_oZAList )
g_oCoherenceManager.m_fn_vAddALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(this)->m_pclActor,
_p_oZAList
);
//now we can set the new value
m_p_oZAList = _p_oZAList;
if ( !g_pclInterface->GetInterface()->fn_bIsLoadingWorld() )
OAC_fn_pclGetParentActorOfData(this)->m_pclActor->fn_vNotifySave();
}
}
//**************************************************************************************
void CPA_Editor_ObjectListData::m_vSetObjectList(EdtList *_p_oObjectList)
{
if ( m_p_oObjectList != _p_oObjectList )
{
if ( m_p_oObjectList )
m_p_oObjectList->fn_bMakeActorNotUseThisList(OAC_fn_pclGetParentActorOfData(this) , FALSE); // No NotifySave
if ( _p_oObjectList )
_p_oObjectList->fn_bMakeActorUseThisList(OAC_fn_pclGetParentActorOfData(this) , FALSE); // No NotifySave
//now we can set the new value
m_p_oObjectList = _p_oObjectList; //should be useless...
}
}
//**************************************************************************************
//Function called to Init the data
void CPA_Editor_ObjectListData::m_vUpdateEngineZAList()
{
MS_tdxHandleToCollSet hCollSet = (MS_tdxHandleToCollSet) OAC_fn_pclGetParentAMSOfData(this)->m_fn_pvGetBaseAddress();
ZDX_tdxHandleToCsaList hActivationList;
// get engine activation list
if ( m_p_oZAList )
hActivationList = (ZDX_tdxHandleToCsaList) m_p_oZAList->GetData();
else
hActivationList = NULL;
//set activation list
if ( m_pub_fn_csGetDataName() == C_szZdeName )
CS_M_SetActivationList(Zde, hCollSet, hActivationList);
else if ( m_pub_fn_csGetDataName() == C_szZddName )
CS_M_SetActivationList(Zdd, hCollSet, hActivationList);
else if ( m_pub_fn_csGetDataName() == C_szZdmName )
CS_M_SetActivationList(Zdm, hCollSet, hActivationList);
else if ( m_pub_fn_csGetDataName() == C_szZdrName )
CS_M_SetActivationList(Zdr, hCollSet, hActivationList);
}
//**************************************************************************************
//Function called to Init the data
void CPA_Editor_ObjectListData::m_vUpdateEngineObjectList()
{
MS_tdxHandleToCollSet hCollSet = (MS_tdxHandleToCollSet) OAC_fn_pclGetParentAMSOfData(this)->m_fn_pvGetBaseAddress();
ZDX_tdxHandleToZdxList hZdxList;
// get engine object list
if ( m_p_oObjectList )
hZdxList = (ZDX_tdxHandleToZdxList) m_p_oObjectList->fn_hGetMotorList();
else
hZdxList = NULL;
// set object list
if ( m_pub_fn_csGetDataName() == C_szZdeName )
CS_M_SetZdxList(Zde, hCollSet, hZdxList);
else if ( m_pub_fn_csGetDataName() == C_szZddName )
CS_M_SetZdxList(Zdd, hCollSet, hZdxList);
else if ( m_pub_fn_csGetDataName() == C_szZdmName )
CS_M_SetZdxList(Zdm, hCollSet, hZdxList);
else if ( m_pub_fn_csGetDataName() == C_szZdrName )
CS_M_SetZdxList(Zdr, hCollSet, hZdxList);
}
//**************************************************************************************
//Function called to Init the data
void CPA_Editor_ObjectListData::m_fn_vInitData()
{
if ( OAC_fn_bBelongsToAnInstance(this) )
{
// The instance must have the same list of names (Zdd/Zde/Zdm/Way) as the model
EdActors_EditorActor *p_oEditorModel = OAC_fn_pclGetParentActorOfData(this)->m_pclActor->m_fn_pclGetModel()->m_fn_pclGetEditorActor();
m_p_oNameList = ((CPA_Editor_ObjectListData *) p_oEditorModel->m_fn_p_oFindDataByName(m_pub_fn_csGetDataName()))->m_p_oNameList;
//make it also update en editor list pointers according to the engine handles
m_fn_vGetMotorData();
}
}
//**************************************************************************************
//Function called to read associated motor's data
void CPA_Editor_ObjectListData::m_fn_vGetMotorData()
{
//get the handle to the engine list
ZDX_tdxHandleToZdxList hZdxList = * (ZDX_tdxHandleToZdxList *) m_pro_pvMotorData;
//the IA can change the activation lists and zone lists of an object -> read them and store them
//in the editor data
//find the reachable object for the engine list
if ( hZdxList )
{
CPA_BaseObject *p_oZDxEdtList = g_pclInterface->GetMainWorld()->fn_p_oFindObjectWithEngine(
hZdxList,
C_szEdtListTypeName
);
//make the actor reference the found object list
m_vSetObjectList((EdtList *)p_oZDxEdtList);
}
//do it too for m_p_oZAList
ZDX_tdxHandleToCsaList hActivationList;
if ( m_pub_fn_csGetDataName() == C_szZdeName )
hActivationList = ((MS_tdxHandleToCollSet) OAC_fn_pclGetParentAMSOfData(this)->m_fn_pvGetBaseAddress())->hZdeActivationList;
else if ( m_pub_fn_csGetDataName() == C_szZddName )
hActivationList = ((MS_tdxHandleToCollSet) OAC_fn_pclGetParentAMSOfData(this)->m_fn_pvGetBaseAddress())->hZddActivationList;
else if ( m_pub_fn_csGetDataName() == C_szZdmName )
hActivationList = ((MS_tdxHandleToCollSet) OAC_fn_pclGetParentAMSOfData(this)->m_fn_pvGetBaseAddress())->hZdmActivationList;
else if ( m_pub_fn_csGetDataName() == C_szZdrName )
hActivationList = ((MS_tdxHandleToCollSet) OAC_fn_pclGetParentAMSOfData(this)->m_fn_pvGetBaseAddress())->hZdrActivationList;
else if ( m_pub_fn_csGetDataName() == C_szWayName )
hActivationList = NULL;
else
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Setting editor list pointers from engine handles",
"CPA_Editor_ObjectListData::m_fn_vGetMotorData()",
E_ERROR_GRAVITY_FATAL,
"No editor activation list was found for the engine activation list handle"
);
ERROR_ASSERT(FALSE);
}
//find the reachable object for the engine list
if ( hActivationList )
{
CPA_ZonesActivatingList *p_oNewZAList = (CPA_ZonesActivatingList *) g_pclInterface->GetMainWorld()->fn_p_oFindObjectWithEngine(
hActivationList,
C_szZAListTypeName
);
m_vSetZAList(p_oNewZAList);
}
}
//**************************************************************************************
//Function called to update associated motor's data from editor data
void CPA_Editor_ObjectListData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
MS_tdxHandleToCollSet hCollSet = (MS_tdxHandleToCollSet) OAC_fn_pclGetParentAMSOfData(this)->m_fn_pvGetBaseAddress();
MS_tdxHandleToMSWay hWay = (MS_tdxHandleToMSWay) OAC_fn_pclGetParentAMSOfData(this)->m_fn_pvGetBaseAddress();
ZDX_tdxHandleToZdxList hZdxList;
ZDX_tdxHandleToCsaList hActivationList;
if ( m_p_oObjectList )
{
hZdxList = (ZDX_tdxHandleToZdxList) m_p_oObjectList->fn_hGetMotorList();
}
else
hZdxList = NULL;
if ( m_p_oZAList )
hActivationList = (ZDX_tdxHandleToCsaList) m_p_oZAList->GetData();
else
hActivationList = NULL;
//set the object and activation list
if ( m_pub_fn_csGetDataName() == C_szZdeName )
{
CS_M_SetZdxList(Zde, hCollSet, hZdxList);
CS_M_SetActivationList(Zde, hCollSet, hActivationList);
}
else if ( m_pub_fn_csGetDataName() == C_szZddName )
{
CS_M_SetZdxList(Zdd, hCollSet, hZdxList);
CS_M_SetActivationList(Zdd, hCollSet, hActivationList);
}
else if ( m_pub_fn_csGetDataName() == C_szZdmName )
{
CS_M_SetZdxList(Zdm, hCollSet, hZdxList);
CS_M_SetActivationList(Zdm, hCollSet, hActivationList);
}
else if ( m_pub_fn_csGetDataName() == C_szZdrName )
{
CS_M_SetZdxList(Zdr, hCollSet, hZdxList);
CS_M_SetActivationList(Zdr, hCollSet, hActivationList);
}
//Special changes
m_fn_vDataHasBeenChanged(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to update data with another one
void CPA_Editor_ObjectListData::m_fn_vUpdateData(CTL_Editor_Data *pclSourceData,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Copying data from a model into an instance",
"CPA_Editor_ObjectListData::m_fn_vUpdateData(...)",
E_ERROR_GRAVITY_FATAL,
"The data types are not equal"
);
ERROR_ASSERT( pclSourceData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType() );
BOOL bChanged = FALSE;
switch (eReason)
{
case E_ur_InstanciatedFromModel:
case E_ur_ModelChangedNameList:
// do something only if the model has a valid name list
if ( ((CPA_Editor_ObjectListData *) pclSourceData)->m_p_oNameList )
{
//set the instance with the values of the model
m_p_oNameList = ((CPA_Editor_ObjectListData *) pclSourceData)->m_p_oNameList;
// if the model has no default object list yet, create one.
//if ( !((CPA_Editor_ObjectListData *) pclSourceData)->m_p_oObjectList )
//{
tdstEdtListMess stMessage;
stMessage.csListType = LPCTSTR(pclSourceData->m_pub_fn_csGetDataName());
stMessage.pActor = (CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(this)->m_pclActor;
//create an object list for the model
((CPA_Editor_ObjectListData *) pclSourceData)->m_p_oNameList
->m_pEdtListHandler->fn_poCreateEdtList(&stMessage);
//m_p_oObjectList = ((CPA_Editor_ObjectListData *) pclSourceData)->m_p_oObjectList;
bChanged = TRUE;
/*m_fn_bSetLink(pclSourceData->m_fn_eGetLink());
m_fn_vUpdateMotorData();*/
}
if ( ((CPA_Editor_ObjectListData *) pclSourceData)->m_p_oZAList )
{
if ( ((CPA_tdoNameList *) ((CPA_Editor_ObjectListData *) pclSourceData)->m_p_oZAList->GetOwner()) != m_p_oNameList )
((CPA_Editor_ObjectListData *) pclSourceData)->m_vSetZAList(NULL);
else
m_vSetZAList(((CPA_Editor_ObjectListData *) pclSourceData)->m_p_oZAList);
bChanged = TRUE;
}
if ( bChanged )
{
// m_fn_bSetLink(pclSourceData->m_fn_eGetLink());
m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
}
break;
case E_ur_ModelEditedNameList:
//if the model just modified the contents of some name lists, we dont care.
break;
default:
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Copying data from a model into an instance",
"CPA_Editor_ObjectListData::m_fn_vUpdateData(...)",
E_ERROR_GRAVITY_FATAL,
"No good valid reason was given for data update (i.e. model changed some data)"
);
ERROR_ASSERT(FALSE);
break;
}
}
//************************************************************************
//Function called to get a string representing the value of the data
CStringList *CPA_Editor_ObjectListData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
m_csStringList.AddTail(m_p_oNameList ? m_p_oNameList->GetName() : "");
BOOL bSaveOL, bSaveZAL;
//save the ZA list only for zones, and if we have one...
bSaveZAL = ((m_p_oZAList && (m_pub_fn_csGetDataName() != C_szWayName)) ? TRUE : FALSE);
if ( OAC_fn_bBelongsToAnInstance(this) ) //if an instance
{
//save the object list if we have one
bSaveOL = (m_p_oObjectList ? TRUE : FALSE);
}
else //is a model
{
//a model does not save its ways object list, and zone object lists
//are saved only if they have no virge field
bSaveOL = (m_p_oObjectList && (m_pub_fn_csGetDataName() != C_szWayName) && m_p_oNameList->m_bHasACommonField());
}
m_csStringList.AddTail(bSaveOL ? m_p_oObjectList->GetName() : "");
m_csStringList.AddTail(bSaveZAL ? m_p_oZAList->GetName() : "");
return &m_csStringList;
}
//************************************************************************
//Function called to set the value of the data acoording to a string representing it
void CPA_Editor_ObjectListData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Filling data with script information",
"CPA_Editor_ObjectListData::m_fn_vSetValueWithString(...)",
E_ERROR_GRAVITY_FATAL,
"The number of fields to fill and provided data do not correspond"
);
ERROR_ASSERT(pcslValueStringList->GetCount() == 3);
POSITION xPos = pcslValueStringList->GetHeadPosition();
CString csNameList(pcslValueStringList->GetNext(xPos));
CString csObjectList(pcslValueStringList->GetNext(xPos));
CString csZAList(pcslValueStringList->GetNext(xPos));
// Get the main world
CPA_MainWorld * pMainWorld = OAC_fn_pclGetParentActorOfData(this)->m_pclActor->GetMainWorld ();
// Search the name list
if ( m_p_oNameList )
g_oCoherenceManager.m_fn_vRemoveALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(this)->m_pclActor,
m_p_oNameList
);
m_p_oNameList = NULL;
if ( !csNameList.IsEmpty() )
{
CPA_BaseObject *p_oFamily = (CPA_BaseObject *) OAC_fn_pclGetParentActorOfData(this)->m_pclActor->m_pub_fn_pclGetFamily();
m_p_oNameList = (CPA_tdoNameList *) pMainWorld -> fn_p_oFindObject (csNameList, C_szZDdNameListType, p_oFamily);
if ( !m_p_oNameList )
m_p_oNameList = (CPA_tdoNameList *) pMainWorld -> fn_p_oFindObject (csNameList, C_szZDeNameListType, p_oFamily);
if ( !m_p_oNameList )
m_p_oNameList = (CPA_tdoNameList *) pMainWorld -> fn_p_oFindObject (csNameList, C_szZDmNameListType, p_oFamily);
if ( !m_p_oNameList )
m_p_oNameList = (CPA_tdoNameList *) pMainWorld -> fn_p_oFindObject (csNameList, C_szZDrNameListType, p_oFamily);
// add by jt
if ( !m_p_oNameList )
m_p_oNameList = (CPA_tdoNameList *) pMainWorld -> fn_p_oFindObject (csNameList, C_szWayNameListType, p_oFamily);
// end jt
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Filling data with script information",
"CPA_Editor_ObjectListData::m_fn_vSetValueWithString(...)",
E_ERROR_GRAVITY_FATAL,
"No editor name list was found with the specified name"
);
ERROR_ASSERT(m_p_oNameList);
}
//tell the coherence manager to remember the model now uses the new name list.
if ( m_p_oNameList )
g_oCoherenceManager.m_fn_vAddALink(
OAC_fn_pclGetParentActorOfData(this)->m_pclActor,
m_p_oNameList
);
// We set the pointer of the model to the name list
if ( !csObjectList.IsEmpty() )
{
EdtList *p_oObjectList = (EdtList *) pMainWorld -> fn_p_oFindObject (csObjectList, C_szEdtListTypeName, m_p_oNameList ? m_p_oNameList : NO_CRITERIA );
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Filling data with script information",
"CPA_Editor_ObjectListData::m_fn_vSetValueWithString(...)",
E_ERROR_GRAVITY_FATAL,
"No editor object list was found with the specified name"
);
ERROR_ASSERT(p_oObjectList);
m_vSetObjectList(p_oObjectList);
}
else
m_vSetObjectList(NULL);
if ( !csZAList.IsEmpty() )
{
m_vSetZAList((CPA_ZonesActivatingList *) pMainWorld -> fn_p_oFindObject (csZAList, C_szZAListTypeName));
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Filling data with script information",
"CPA_Editor_ObjectListData::m_fn_vSetValueWithString(...)",
E_ERROR_GRAVITY_FATAL,
"No editor activation list was found with the specified name"
);
ERROR_ASSERT(m_p_oZAList);
}
else
m_vSetZAList(NULL);
}
//************************************************************************
//Function called to look if data has been modified (by motor for example)
void CPA_Editor_ObjectListData::m_fn_vLookIfDataHasBeenModified()
{
BOOL bIsEditingAnInstance = OAC_fn_bBelongsToAnInstance(this);
m_fn_vGetMotorData();
m_pro_bDataHasChanged = bIsEditingAnInstance
? ((m_p_oObjectList != m_p_oOldObjectList) || (m_p_oZAList != m_p_oOldZAList ))
: (m_p_oNameList != m_p_oOldNameList);
if ( m_pro_bDataHasChanged )
{
if ( bIsEditingAnInstance )
{
m_p_oOldObjectList = m_p_oObjectList;
m_p_oOldZAList = m_p_oZAList;
}
else
m_p_oOldNameList = m_p_oNameList;
}
}
//************************************************************************
//Function called when data has been really modified (i.e. value is different from previous one)
void CPA_Editor_ObjectListData::m_fn_vDataHasBeenReallyModified()
{
}
//Undo
//************************************************************************
//Function called to save the current Value (for Undo)
void CPA_Editor_ObjectListData::m_fn_vKeepCurrentValue()
{
m_p_oNameListKeptForUndo = m_p_oNameList;
m_p_oObjectListKeptForUndo = m_p_oObjectList;
m_p_oZAListKeptForUndo = m_p_oZAList;
}
//************************************************************************
//Function called to validate Undo for the current change
void CPA_Editor_ObjectListData::m_fn_vRegisterUndoAction()
{
void *pKeptList, *pCurList;
void *pKeptAlternateList, *pCurAlternateList;
if ( OAC_fn_bBelongsToAnInstance(this) )
{
pKeptList = m_p_oObjectListKeptForUndo;
pCurList = m_p_oObjectList;
pKeptAlternateList = m_p_oZAListKeptForUndo;
pCurAlternateList = m_p_oZAList;
}
else
{
pKeptList = m_p_oNameListKeptForUndo;
pCurList = m_p_oNameList;
pKeptAlternateList = NULL;
pCurAlternateList = NULL;
}
CPA_ObjectListDataModif *pclModif = new CPA_ObjectListDataModif(this,
pKeptList,
pCurList,
pKeptAlternateList,
pCurAlternateList);
OAC_fn_pclGetParentActorOfData(this)->m_clUndoManager.AskFor(pclModif);
}
//##################################################################"
//************************************************************************
//Constructor
CPA_ObjectListDataModif::CPA_ObjectListDataModif
(
CPA_Editor_ObjectListData *p_oData,
void *pOldList,
void *pNewList,
void *_pOldAlternateList,
void *_pNewAlternateList
)
: CPA_Modif(0)
{
m_p_oData = p_oData;
m_pListAfterDo = pNewList;
m_pListBeforeDo = pOldList;
m_pAlternateListAfterDo = _pNewAlternateList;
m_pAlternateListBeforeDo = _pOldAlternateList;
CString csName;
csName.Format("%s : modified", p_oData->m_pub_fn_csGetDataName());
SetName(csName);
}
//************************************************************************
//Destructor
CPA_ObjectListDataModif::~CPA_ObjectListDataModif()
{
}
//************************************************************************
BOOL CPA_ObjectListDataModif::Do()
{
if ( OAC_fn_bBelongsToAnInstance(m_p_oData) )
{
m_p_oData->m_vSetObjectList((EdtList *) m_pListAfterDo);
m_p_oData->m_vSetZAList((CPA_ZonesActivatingList *) m_pAlternateListAfterDo);
}
else
{
//remove the link with the old name list
if ( m_p_oData->m_p_oNameList )
g_oCoherenceManager.m_fn_vRemoveALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(m_p_oData)->m_pclActor,
m_p_oData->m_p_oNameList
);
//set the name name list
m_p_oData->m_p_oNameList = (CPA_tdoNameList *) m_pListAfterDo;
//and set the link with the new name list
if ( m_p_oData->m_p_oNameList )
g_oCoherenceManager.m_fn_vAddALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(m_p_oData)->m_pclActor,
m_p_oData->m_p_oNameList
);
m_p_oData->m_vSetZAList((CPA_ZonesActivatingList *) m_pAlternateListAfterDo);
}
m_p_oData->m_fn_vUpdateMotorData();
m_p_oData->m_pub_fn_vSetDataHasChanged(TRUE);
m_p_oData->m_pub_fn_pclGetParentControl()->m_fn_vUpdate();
OAC_fn_pclGetParentActorOfData(m_p_oData)->m_pclActor->fn_vNotifySave();
return TRUE;
}
//************************************************************************
BOOL CPA_ObjectListDataModif::Undo()
{
if ( OAC_fn_bBelongsToAnInstance(m_p_oData) )
{
m_p_oData->m_vSetObjectList((EdtList *) m_pListBeforeDo);
m_p_oData->m_vSetZAList((CPA_ZonesActivatingList *) m_pAlternateListBeforeDo);
}
else
{
//remove the link with the old name list
if ( m_p_oData->m_p_oNameList )
g_oCoherenceManager.m_fn_vRemoveALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(m_p_oData)->m_pclActor,
m_p_oData->m_p_oNameList
);
m_p_oData->m_p_oNameList = (CPA_tdoNameList *) m_pListBeforeDo;
//and set the link with the new name list
if ( m_p_oData->m_p_oNameList )
g_oCoherenceManager.m_fn_vAddALink(
(CPA_SaveObject *) OAC_fn_pclGetParentActorOfData(m_p_oData)->m_pclActor,
m_p_oData->m_p_oNameList
);
m_p_oData->m_vSetZAList((CPA_ZonesActivatingList *) m_pAlternateListAfterDo);
}
m_p_oData->m_fn_vUpdateMotorData();
m_p_oData->m_pub_fn_vSetDataHasChanged(TRUE);
m_p_oData->m_pub_fn_pclGetParentControl()->m_fn_vUpdate();
return TRUE;
}
// ROMTEAM corrections (Nicu 06-02-98) {
//Function called to read associated motor's data
void OAC_FloatData::m_fn_vGetMotorData()
{
BOOL bMustReadData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeRead != NULL )
bMustReadData &= m_pro_td_p_fn_bDataMustBeRead(this);
if ( bMustReadData )
{
m_ldCurrentValue = *(long*)m_pro_pvMotorData / 65536.0;
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenRead != NULL )
m_pro_td_p_fn_vDataModifWhenRead(this);
}
}
//Function called to update associated motor's data
void OAC_FloatData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason, long _lUserDefinedReason)
{
BOOL bMustWriteData = TRUE;
if ( m_pro_td_p_fn_bDataMustBeWritten != NULL )
bMustWriteData &= m_pro_td_p_fn_bDataMustBeWritten(this);
if ( bMustWriteData )
{
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenWrite != NULL )
m_pro_td_p_fn_vDataModifWhenWrite(this);
*(long*)m_pro_pvMotorData = (long)(m_ldCurrentValue * 65536.0 + 0.5);
//Calls Modification function if needed
if ( m_pro_td_p_fn_vDataModifWhenRead != NULL )
m_pro_td_p_fn_vDataModifWhenRead(this);
//Special changes
m_fn_vDataHasBeenChanged(eReason, _lUserDefinedReason);
}
}
//Function called to get a string representing the value of the data
CStringList *OAC_FloatData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
CString csStringToReturn;
csStringToReturn.Format("%ld", (long)(m_ldCurrentValue * 65536.0 + 0.5));
m_csStringList.AddTail(csStringToReturn);
return &m_csStringList;
}
//Function called to set the value of the data acoording to a string representing it
void OAC_FloatData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
ERROR_ASSERT(pcslValueStringList->GetCount() == 1);
CString csValueString = pcslValueStringList->GetHead();
m_ldCurrentValue = atol(LPCTSTR(csValueString)) / 65536.0;
m_fn_vUpdateMotorData();
}
// END ROMTEAM corrections (Nicu) }

View File

@@ -0,0 +1,398 @@
// Implementation file for the definition of a State characteristic
///////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "_AInterf.hpp"
#include "CPA_DatS.hpp"
#include "EDACActr.hpp"
#include "EDACCust.hpp"
//External Modules
#include "ErO.h"
#include "TFa.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
//**************************************************************************
//Constructor / Destructor
CPA_Editor_StateData::CPA_Editor_StateData(CString csScriptName,
CTL_Editor_DataList *_pclParentList,
CTL_Editor_Data *pclCurrentBaseData /*= NULL*/)
: CTL_Editor_Data(CTL_DATA_TYPE__USE_USER_DEFINED_TYPE,
csScriptName,
_pclParentList,
pclCurrentBaseData,
OAC_DATA_TYPE__STATE)
{
m_pri_bIsTheInitialState = ( pclCurrentBaseData != NULL );
m_pclCurrentValueForStates = NULL;
m_pclOldValueForStates = NULL;
m_pclCurrentValueForActions = NULL;
m_pclOldValueForActions = NULL;
m_pclKeepedValueForUndoForStates = NULL;
m_pclKeepedValueForUndoForActions = NULL;
m_pclAction = NULL;
short wIndex = csScriptName.Find('|');
CString csFirstScritpName;
CString csSecondScritpName;
if ( wIndex != -1 )
{
csFirstScritpName = csScriptName.Left(csScriptName.GetLength() - wIndex);
csSecondScritpName = csScriptName.Right(wIndex - 1);
m_pro_csDataName = csFirstScritpName;
}
//Constructs the List of States (according to Family)
m_pclEnumDescriptorForStates = new CTL_Editor_EnumDescriptor(csFirstScritpName, 4/*long*/);
m_pclEnumDescriptorForActions = new CTL_Editor_EnumDescriptor(csSecondScritpName, 4/*long*/);
}
//**************************************************************************
CPA_Editor_StateData::~CPA_Editor_StateData()
{
delete m_pclEnumDescriptorForStates;
delete m_pclEnumDescriptorForActions;
}
//Member functions
//**************************************************************************************
//Function called to Init the data
void CPA_Editor_StateData::m_fn_vInitData()
{
}
//**************************************************************************
//Function called to read associated motor's data
void CPA_Editor_StateData::m_fn_vGetMotorData()
{
long lEnumValue;
ERROR_ASSERT( m_pclEnumDescriptorForStates->m_fn_ucGetEnumSize() == 4 );
CTL_fn_vGetMemory(m_pub_fn_pvGetMotorData(), &lEnumValue, 4);
//Gets corresponding State
tdxHandleToState hState = (tdxHandleToState)lEnumValue;
CPA_State *pclState = NULL;
CPA_Action *pclAction = NULL;
if ( hState != NULL )
{
pclState = (CPA_State *)g_pclInterface->GetMainWorld()->fn_p_oFindObjectWithEngine(hState, C_szStateTypeName);
pclAction = (pclState != NULL) ? pclState->mfn_p_oGetAction() : NULL;
CPA_Actor *pclActor = OAC_fn_pclGetParentActorOfData(this)->m_pclActor;
if ( m_pri_bIsTheInitialState )
{
pclActor->m_pub_fn_vSetInitialAction(pclAction);
pclActor->m_pub_fn_vSetInitialState(pclState);
}
else
{
pclActor->m_pub_fn_vSetCurrentAction(pclAction);
pclActor->m_pub_fn_vSetCurrentState(pclState);
}
}
//ANNECY VL PRT 09/04/98{
if ( M_bEditorsActive() )
//ENDANNECY VL}
m_fn_vConstructEnumDescriptors();
//Updates current value (pointer) for Actions
m_pclCurrentValueForActions = m_pclEnumDescriptorForActions->m_fn_pclGetElementFromEnumIndex((long)pclAction);
//Updates current value (pointer) for States
m_pclCurrentValueForStates = m_pclEnumDescriptorForStates->m_fn_pclGetElementFromEnumIndex(lEnumValue);
}
//**************************************************************************
//Function called to update associated motor's data
void CPA_Editor_StateData::m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT( m_pro_pvMotorData != NULL );
//Data must be coded on a long (to represent a pointer)
ERROR_ASSERT( m_pclEnumDescriptorForStates->m_fn_ucGetEnumSize() == 4 );
m_pclAction = (CPA_Action *)m_pclCurrentValueForActions->m_pub_fn_lGetValue();
tdxHandleToState hDefaultState = NULL;
if ( (m_pclAction != NULL) && (m_pclAction->mfn_p_oGetDefaultState() != NULL) )
hDefaultState = (tdxHandleToState)m_pclAction->mfn_p_oGetDefaultState()->GetData();
CTL_fn_vSetMemory(m_pro_pvMotorData, &hDefaultState, 4);
CPA_Actor *pclActor = OAC_fn_pclGetParentActorOfData(this)->m_pclActor;
if ( (OAC_tdeUpdateReason)_lUserDefinedReason != OAC_E_ur_InstanciatedFromModel )
{
CPA_State *pclState = (CPA_State *)g_pclInterface->GetMainWorld()->fn_p_oFindObjectWithEngine(hDefaultState, C_szStateTypeName);
//Sets pointers in parent Actor
if ( m_pri_bIsTheInitialState )
{
pclActor->m_pub_fn_vSetInitialAction(m_pclAction);
pclActor->m_pub_fn_vSetInitialState(pclState, TRUE);
}
else
{
pclActor->m_pub_fn_vSetCurrentAction(m_pclAction);
pclActor->m_pub_fn_vSetCurrentState(pclState);
}
}
if ( m_pro_td_p_fn_vDataHasChangedCallBack != NULL )
m_pro_td_p_fn_vDataHasChangedCallBack(this, eReason, _lUserDefinedReason);
//Special changes
m_fn_vDataHasBeenChanged(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to update data with another one
void CPA_Editor_StateData::m_fn_vUpdateData(CTL_Editor_Data *pclSourceData,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT( pclSourceData->m_pub_fn_tdeGetDataType() == m_pub_fn_tdeGetDataType() );
//Asserts Families are the Same
//TO BE DONE....
m_pclCurrentValueForStates = ((CPA_Editor_StateData *)pclSourceData)->m_pclCurrentValueForStates;
m_pclCurrentValueForActions = ((CPA_Editor_StateData *)pclSourceData)->m_pclCurrentValueForActions;
m_fn_vUpdateMotorData(eReason, _lUserDefinedReason);
}
//************************************************************************
//Function called to get a string representing the value of the data
CStringList *CPA_Editor_StateData::m_fn_pcslFormatDataValueString()
{
m_csStringList.RemoveAll();
ERROR_ASSERT( m_pclCurrentValueForActions != NULL );
if ( m_pclCurrentValueForActions != NULL )
{
CString csStringToReturn;
csStringToReturn.Format("%s", LPCTSTR(m_pclCurrentValueForActions->m_pub_fn_csGetElementName()));
m_csStringList.AddTail(csStringToReturn);
}
return &m_csStringList;
}
//************************************************************************
//Function called to set the value of the data according to a string representing it
void CPA_Editor_StateData::m_fn_vSetValueWithString(CStringList *pcslValueStringList)
{
ERROR_ASSERT(pcslValueStringList->GetCount() == 1);
CString csValueString = pcslValueStringList->GetHead();
m_fn_vConstructEnumDescriptors();
BOOL bFound = FALSE;
CTL_Editor_EnumElement *pclElement;
POSITION pos = m_pclEnumDescriptorForActions->GetHeadPosition();
while ( (pos != NULL) && (!bFound) )
{
pclElement = m_pclEnumDescriptorForActions->GetNext(pos);
bFound = ( pclElement->m_pub_fn_csGetElementName().CompareNoCase(csValueString) == 0 );
}
if ( bFound )
m_pclCurrentValueForActions = pclElement;
else
{
//Default Value
if ( m_pclEnumDescriptorForActions->GetCount() > 0 )
m_pclCurrentValueForActions = m_pclEnumDescriptorForActions->GetHead();
else
m_pclCurrentValueForActions = NULL;
}
m_fn_vUpdateMotorData();
}
//************************************************************************
//Function called to look if data has been modified (by motor for example)
void CPA_Editor_StateData::m_fn_vLookIfDataHasBeenModified()
{
m_fn_vGetMotorData();
m_pro_bDataHasChanged = ( m_pclCurrentValueForStates != m_pclOldValueForStates )
|| ( m_pclCurrentValueForActions != m_pclOldValueForActions );
if ( m_pro_bDataHasChanged )
{
m_pclOldValueForStates = m_pclCurrentValueForStates;
m_pclOldValueForActions = m_pclCurrentValueForActions;
}
}
//************************************************************************
//Function called when data has been really modified (i.e. value is different from previous one)
void CPA_Editor_StateData::m_fn_vDataHasBeenReallyModified()
{
}
//Undo
//************************************************************************
//Function called to save the current Value (for Undo)
void CPA_Editor_StateData::m_fn_vKeepCurrentValue()
{
m_pclKeepedValueForUndoForStates = m_pclCurrentValueForStates;
m_pclKeepedValueForUndoForActions = m_pclCurrentValueForActions;
}
//************************************************************************
//Function called to validate Undo for the current change
void CPA_Editor_StateData::m_fn_vRegisterUndoAction()
{
/* if ( m_pclKeepedValueForUndo->m_lEnumValue != m_pclCurrentValue->m_lEnumValue )
{
EdActors_ActorStateDataModif *pclModif = new EdActors_ActorStateDataModif(this,
m_pclKeepedValueForUndo,
m_pclCurrentValue);
m_pclParentActor->m_clUndoManager.AskFor(pclModif);
}
*/
}
//************************************************************************
//************************************************************************
//Specific functions
//************************************************************************
CTL_Editor_EnumDescriptor *CPA_Editor_StateData::m_fn_pclGetEnumDescriptorForActions()
{
return m_pclEnumDescriptorForActions;
}
//************************************************************************
CTL_Editor_EnumDescriptor *CPA_Editor_StateData::m_fn_pclGetEnumDescriptorForStates()
{
return m_pclEnumDescriptorForStates;
}
//************************************************************************
void CPA_Editor_StateData::m_fn_vConstructEnumDescriptors()
{
//Fills the List of States (according to Family)
CPA_Family *pclFamily = OAC_fn_pclGetParentActorOfData(this)->m_pclActor->m_pub_fn_pclGetFamily();
ERROR_ASSERT( pclFamily != NULL );
m_pclEnumDescriptorForStates->m_fn_vEmptyList();
////////////////////////////////////////
//For initial State
if ( m_pri_bIsTheInitialState )
{
POSITION pos = pclFamily->m_oListOfActions.GetHeadPosition();
CPA_Action *pclCurrentAction;
while ( pos != NULL )
{
pclCurrentAction = pclFamily->m_oListOfActions.GetNext(pos);
if ( ( pclCurrentAction != NULL ) && ( pclCurrentAction->mfn_p_oGetDefaultState() != NULL ))
m_pclEnumDescriptorForStates->m_fn_pclAddElement(pclCurrentAction->mfn_p_oGetDefaultState()->GetName(),
(long)(pclCurrentAction->mfn_p_oGetDefaultState()->GetData())
);
}
}
//For current State
else
{
POSITION pos = pclFamily->m_oListOfStates.GetHeadPosition();
CPA_State *pclCurrentState;
while ( pos != NULL )
{
pclCurrentState = pclFamily->m_oListOfStates.GetNext(pos);
if ( pclCurrentState != NULL )
m_pclEnumDescriptorForStates->m_fn_pclAddElement(pclCurrentState->GetName(),
(long)(pclCurrentState->GetData())
);
}
}
//Always adds a reference to NULL pointer
m_pclEnumDescriptorForStates->m_fn_pclAddElement("No State !", 0L);
////////////////////////////////////////
//For Initial and Current Action
m_pclEnumDescriptorForActions->m_fn_vEmptyList();
POSITION pos = pclFamily->m_oListOfActions.GetHeadPosition();
CPA_Action *pclCurrentAction;
while ( pos != NULL )
{
pclCurrentAction = pclFamily->m_oListOfActions.GetNext(pos);
if ( pclCurrentAction != NULL )
m_pclEnumDescriptorForActions->m_fn_pclAddElement( pclCurrentAction->GetName(),
(long)(pclCurrentAction)
);
}
//Always adds a reference to NULL pointer
m_pclEnumDescriptorForActions->m_fn_pclAddElement("No Action !", 0L);
}
//************************************************************************
//Called when Action Data has been changed, to update State Data
BOOL CPA_Editor_StateData::m_fn_bSetCurrentValueForStateAccordingToAction()
{
BOOL bReturn = FALSE;
if ( m_pclCurrentValueForActions != NULL )
{
//Gets new Action
CPA_Action *pclAction = (CPA_Action *)m_pclCurrentValueForActions->m_pub_fn_lGetValue();
if ( pclAction != NULL )
{
//Gets Action default state
CPA_State *pclActionDefaultState = pclAction->mfn_p_oGetDefaultState();
//Sets new current value for State
if ( pclActionDefaultState != NULL )
m_pclCurrentValueForStates = m_pclEnumDescriptorForStates->m_fn_pclGetElementFromEnumIndex((long)pclActionDefaultState->GetData());
else
m_pclCurrentValueForStates = m_pclEnumDescriptorForStates->m_fn_pclGetElementFromEnumIndex(0L);
}
else
m_pclCurrentValueForStates = m_pclEnumDescriptorForStates->m_fn_pclGetElementFromEnumIndex(0L);
bReturn = TRUE;
}
else
m_pclCurrentValueForStates = m_pclEnumDescriptorForStates->m_fn_pclGetElementFromEnumIndex(0L);
return bReturn;
}
//************************************************************************
BOOL CPA_Editor_StateData::m_pub_fn_bIsTheInitialState()
{
return m_pri_bIsTheInitialState;
}

View File

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

View File

@@ -0,0 +1,833 @@
// Used for Data and Controls customization
//
// YB
//
/////////////////////////////////////////////////////
#include "StdAfx.h"
//ANNECY CHRISTOPHE MODIFICATIONS
#define D_ZdxStuff_StructureDefine
//ANNECY END CHRISTOPHE MODIFICATIONS
#include "EDACCust.hpp"
#include "_AInterf.hpp"
#include "EDACMStA.hpp"
#include "EDACActr.hpp"
#include "EDACModl.hpp"
#include "CPA_DatO.hpp"
#include "CPA_DatS.hpp"
#include "EDACWatc.hpp"
#include "EDACVwMS.hpp"
//CPA2 Stegaru Cristian 98/06/25
#include "..\inc\edactors\dlgselectinstances.h"
//End CPA2 Stegaru Cristian 98/06/25
//External Modules
#include "ErO.h"
#include "IncTUT.h"
#include "WAW.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
//************************************************************************************
//*****************************########################*******************************
//*****************************# Owner Data Functions #*******************************
//*****************************########################*******************************
//************************************************************************************
//************************************************************************************
//************************************ Data ******************************************
//************************************************************************************
#define OAC_C_szOwnerDataName_Data_ParentActor "Data_Parent_Actor"
#define OAC_C_szOwnerDataName_Data_ParentAMS "Data_Parent_AMS"
#define OAC_C_szOwnerDataName_Data_LinkType "Data_Link_Type"
#define OAC_C_szOwnerDataName_Data_InWatch "Data_In_Watch"
//************************************************************************************
void OAC_AddOwnerDataToData(CTL_Editor_Data *_pclData,
EdActors_EditorActor *_pclParentActor,
EdActors_ActorMiniStructure *_pclParentAMS)
{
_pclData->m_pub_fn_pclAddOwnerData((void *)_pclParentActor, OAC_C_szOwnerDataName_Data_ParentActor);
_pclData->m_pub_fn_pclAddOwnerData((void *)_pclParentAMS, OAC_C_szOwnerDataName_Data_ParentAMS);
_pclData->m_pub_fn_pclAddOwnerData((long)OAC_LINK_MODE__NOT_LINKED, OAC_C_szOwnerDataName_Data_LinkType);
_pclData->m_pub_fn_pclAddOwnerData((void *)NULL, OAC_C_szOwnerDataName_Data_InWatch);
}
//************************************************************************************
EdActors_EditorActor *OAC_fn_pclGetParentActorOfData(CTL_Editor_Data *_pclData)
{
CTL_OwnerData *pclOD = _pclData->m_pub_fn_pclGetOwnerDataWithName(OAC_C_szOwnerDataName_Data_ParentActor);
if ( pclOD != NULL )
return (EdActors_EditorActor *)pclOD->m_pub_fn_pvGetDataPtr();
else
return NULL;
}
//************************************************************************************
EdActors_ActorMiniStructure *OAC_fn_pclGetParentAMSOfData(CTL_Editor_Data *_pclData)
{
CTL_OwnerData *pclOD = _pclData->m_pub_fn_pclGetOwnerDataWithName(OAC_C_szOwnerDataName_Data_ParentAMS);
if ( pclOD != NULL )
return (EdActors_ActorMiniStructure *)pclOD->m_pub_fn_pvGetDataPtr();
else
return NULL;
}
//************************************************************************************
OAC_eDataLinkMode OAC_fn_tdeGetLink(CTL_Editor_Data *_pclData)
{
//Sets new link
CTL_OwnerData *pclOD = _pclData->m_pub_fn_pclGetOwnerDataWithName(OAC_C_szOwnerDataName_Data_LinkType);
if ( pclOD != NULL )
return ((OAC_eDataLinkMode)pclOD->m_pub_fn_lGetData());
else
return OAC_LINK_MODE__NOT_LINKED; //Default value
}
//************************************************************************************
//Returns the previous Link status
OAC_eDataLinkMode OAC_fn_tdeSetLink(CTL_Editor_Data *_pclData,
OAC_eDataLinkMode _tdeNewLink)
{
OAC_eDataLinkMode tdePreviousLink = OAC_fn_tdeGetLink(_pclData);
//Sets new link
CTL_OwnerData *pclOD = _pclData->m_pub_fn_pclGetOwnerDataWithName(OAC_C_szOwnerDataName_Data_LinkType);
if ( pclOD != NULL )
pclOD->m_pub_fn_vSetData((long)_tdeNewLink);
return tdePreviousLink;
}
//************************************************************************************
BOOL OAC_fn_bIsLinked(CTL_Editor_Data *_pclData)
{
BOOL bIsLinked = ( ( OAC_fn_tdeGetLink(_pclData) == OAC_LINK_MODE__LINKED )
|| ( OAC_fn_tdeGetLink(_pclData) == OAC_LINK_MODE__ALWAYS_LINKED )
);
return bIsLinked;
}
//************************************************************************************
OAC_tdeDataLinkMode eNot(OAC_tdeDataLinkMode _eMode)
{
switch ( _eMode )
{
//Can be changed
case OAC_LINK_MODE__NOT_LINKED:
return OAC_LINK_MODE__LINKED;
case OAC_LINK_MODE__LINKED:
return OAC_LINK_MODE__NOT_LINKED;
//Cannot be changed !!
case OAC_LINK_MODE__ALWAYS_LINKED:
case OAC_LINK_MODE__NEVER_LINKED:
return _eMode;
//Default returned value
default:
return OAC_LINK_MODE__LINKED;
};
}
//************************************************************************************
BOOL OAC_fn_bDataIsInWatch(CTL_Editor_Data *_pclData)
{
CTL_OwnerData *pclOD = _pclData->m_pub_fn_pclGetOwnerDataWithName(OAC_C_szOwnerDataName_Data_InWatch);
if ( pclOD != NULL )
return (pclOD->m_pub_fn_pvGetDataPtr() != NULL );
else
return FALSE;
}
//************************************************************************************
WAW_Data *OAC_fn_pclGetAssociatedWatchData(CTL_Editor_Data *_pclData)
{
CTL_OwnerData *pclOD = _pclData->m_pub_fn_pclGetOwnerDataWithName(OAC_C_szOwnerDataName_Data_InWatch);
if ( pclOD != NULL )
return ( (WAW_Data *)pclOD->m_pub_fn_pvGetDataPtr() );
else
return NULL;
}
//************************************************************************************
void OAC_fn_vSetDataInWatch(CTL_Editor_Data *_pclData,
WAW_Data *_p_clDataInWatch)
{
CTL_OwnerData *pclOD = _pclData->m_pub_fn_pclGetOwnerDataWithName(OAC_C_szOwnerDataName_Data_InWatch);
if ( pclOD != NULL )
pclOD->m_pub_fn_vSetDataPtr((void *)_p_clDataInWatch);
}
//************************************************************************************
//********************************** Controls ****************************************
//************************************************************************************
#define OAC_C_szOwnerDataName_Control_Level "Control_Level"
#define OAC_C_szOwnerDataName_Control_Visibility "Control_Visibility"
#define OAC_C_szOwnerDataName_Control_LinkCheckBox "Control_LinkCheckBox"
#define OAC_C_szOwnerDataName_Control_HelpID "Control_Help_ID"
//************************************************************************************
void OAC_AddOwnerDataToControl(CTL_Editor_Control *_pclControl,
OAC_tdeDataLevel _eLevel,
OAC_tdeControlVisibility _eVisibility,
DWORD dwHelpID)
{
_pclControl->m_pub_fn_pclAddOwnerData(_eLevel, OAC_C_szOwnerDataName_Control_Level);
_pclControl->m_pub_fn_pclAddOwnerData(_eVisibility, OAC_C_szOwnerDataName_Control_Visibility);
_pclControl->m_pub_fn_pclAddOwnerData(dwHelpID, OAC_C_szOwnerDataName_Control_HelpID);
_pclControl->m_pub_fn_vSetControlCanBeDisplayedCallBack(OAC_fn_bControlCanBeDisplayed);
}
//************************************************************************************
OAC_tdeControlVisibility OAC_tdeGetVisibilityOfControl(CTL_Editor_Control *_pclControl)
{
CTL_OwnerData *pclOD = _pclControl->m_pub_fn_pclGetOwnerDataWithName(OAC_C_szOwnerDataName_Control_Visibility);
if ( pclOD != NULL )
return (OAC_tdeControlVisibility)pclOD->m_pub_fn_lGetData();
else
return EDCAR_DATA_VISI_DUAL;
}
//************************************************************************************
DWORD OAC_fn_tdeGetHelpIDOfControl(CTL_Editor_Control *_pclControl)
{
CTL_OwnerData *pclOD = _pclControl->m_pub_fn_pclGetOwnerDataWithName(OAC_C_szOwnerDataName_Control_HelpID);
if ( pclOD != NULL )
return (DWORD)pclOD->m_pub_fn_lGetData();
else
return IDH_FIELD_UNKNOWN;
}
//************************************************************************************
OAC_eDataLevel OAC_fn_tdeGetLevelOfControl(CTL_Editor_Control *_pclControl)
{
CTL_OwnerData *pclOD = _pclControl->m_pub_fn_pclGetOwnerDataWithName(OAC_C_szOwnerDataName_Control_Level);
if ( pclOD != NULL )
return (OAC_eDataLevel)pclOD->m_pub_fn_lGetData();
else
return OAC_DATA_LEVEL_1;
}
//************************************************************************************
void OAC_fn_vCustomizeControl(CTL_Editor_Control *_pclControl,
CWnd *_pclParentWnd)
{
//Adds a Check Box at Head of control
ERROR_ASSERT( _pclControl->m_pub_fn_pclGetListOfBaseControls() != NULL );
//Creates the Check Box
CTL_Editor_CheckBox *pclCheckBox = new CTL_Editor_CheckBox(CTL_CHECK_BOX_TYPE__USE_USER_DEFINED_TYPE,
0, //Additionnal Style
_pclControl,
_pclParentWnd,
OAC_CHECK_BOX_TYPE__LINK,
0); //Returned code
//Sets CallBack
pclCheckBox->m_pub_fn_vSetHasBeenClicked_CallBack(OAC_fn_vCheckBoxHasBeenClicked_CallBack);
//Adds an owner Data
_pclControl->m_pub_fn_pclAddOwnerData((void *)pclCheckBox, OAC_C_szOwnerDataName_Control_LinkCheckBox);
CTL_Editor_BaseControl *pclAddedBaseControl;
pclAddedBaseControl = _pclControl->m_pub_fn_pclGetListOfBaseControls()->m_pub_fn_pclAddControlAtHead(pclCheckBox,
pclCheckBox,
_pclControl,
CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED,
0,
15,
15,
FALSE,
FALSE);
pclAddedBaseControl->m_pub_fn_vSetCanBeDisplayedCallBack(OAC_fn_bLinkCheckBoxCanBeDisplayed_CallBack);
pclAddedBaseControl->m_pub_fn_vSetMustBeEnabledCallBack(OAC_fn_bLinkCheckBoxMustBeEnabled_CallBack);
}
//************************************************************************************
BOOL OAC_fn_bControlCanBeDisplayed(class CTL_Editor_Control *_pclSenderControl)
{
BOOL bMustBeDisplayed;
BOOL bMustNotDisplayBecauseLinkedFieldOfAnInstance;
BOOL bMustNotDisplayBecauseInstanceOnlyField;
BOOL bMustNotDisplayBecauseModelOnlyField;
BOOL bMustDisplayBecauseRightLevel;
// Shaitan FastC {
if (_pclSenderControl->m_pub_fn_csGetControlName() == "FastC_Index")
return FALSE;
//End Shaitan FastC }
//Gets Data
CTL_Editor_Data *pclData = _pclSenderControl->m_fn_pclGetEditedData();
//Gets Parent Actor
EdActors_EditorActor *pclEdActor = OAC_fn_pclGetParentActorOfData(pclData);
//Gets visibility
OAC_tdeControlVisibility eVisibility = OAC_tdeGetVisibilityOfControl(_pclSenderControl);
//Gets Level
OAC_eDataLevel eLevel = OAC_fn_tdeGetLevelOfControl(_pclSenderControl);
//Analyses if control must be displayed
bMustNotDisplayBecauseLinkedFieldOfAnInstance = (
pclEdActor->m_fn_bIsAnInstance()
&& ( ( OAC_fn_bIsLinked(pclData) )
&& (!g_pclInterface->m_clDocument.m_bMustDisplayModelFieldsInInstance)
)
);
bMustNotDisplayBecauseInstanceOnlyField = (
( !pclEdActor->m_fn_bIsAnInstance() )
&& ( eVisibility == EDCAR_DATA_VISI_ONLY_INSTANCES )
);
bMustNotDisplayBecauseModelOnlyField = (
( pclEdActor->m_fn_bIsAnInstance() )
&& ( eVisibility == EDCAR_DATA_VISI_ONLY_MODELS )
);
//Stefan Dumitrean 14-07-98 ( OAC buttons )
/*
bMustDisplayBecauseRightLevel = ( (
(!g_pclInterface->m_clDocument.m_bExclusiveLevel)
&& (eLevel <= g_pclInterface->m_clDocument.m_tdeCurrentDataLevel)
)
|| (
(g_pclInterface->m_clDocument.m_bExclusiveLevel)
&& (eLevel == g_pclInterface->m_clDocument.m_tdeCurrentDataLevel)
)
);
*/
CString csControlName = _pclSenderControl->m_pub_fn_csGetControlName();
/*
switch( eLevel )
{
case OAC_DATA_LEVEL_1:
case OAC_DATA_LEVEL_2:
bMustDisplayBecauseRightLevel =
g_pclInterface->m_clDocument.m_aCurrentOACButtonsPressed[0];
break;
case OAC_DATA_LEVEL_3:
bMustDisplayBecauseRightLevel =
g_pclInterface->m_clDocument.m_aCurrentOACButtonsPressed[1];
}
if( bMustDisplayBecauseRightLevel )
*/ switch( _pclSenderControl->m_ucInitialCurrentPair )
{
case 1: //is initial
bMustDisplayBecauseRightLevel = g_pclInterface->m_clDocument.m_bDisplayInitialValue;
break;
case 2: //is current
bMustDisplayBecauseRightLevel = g_pclInterface->m_clDocument.m_bDisplayCurrentValue;
}
//End Stefan Dumitrean 14-07-98 ( OAC buttons )
bMustBeDisplayed = ( !bMustNotDisplayBecauseLinkedFieldOfAnInstance
&& !bMustNotDisplayBecauseInstanceOnlyField
&& !bMustNotDisplayBecauseModelOnlyField
&& bMustDisplayBecauseRightLevel
);
return bMustBeDisplayed;
}
//************************************************************************************
//*******************************######################*******************************
//*******************************# CallBack Functions #*******************************
//*******************************######################*******************************
//************************************************************************************
//************************************************************************************
//************************************** Data ****************************************
//************************************************************************************
//************************************************************************************
void OAC_fn_vDataHasBeenChanged(class CTL_Editor_Data *_pclChangedData,
enum CTL_eUpdateReason _eReason,
long _lUserDefinedReason /*= 0*/)
{
if ( _eReason == CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER )
{
EdActors_EditorActor *pclParentActor = OAC_fn_pclGetParentActorOfData(_pclChangedData);
if ( pclParentActor != NULL )
pclParentActor->m_pclActor->fn_vNotifySave();
//CPA2 Stegaru Cristian 98/06/24
MS_Field modifField;
EdActors_EditorActor *pclEdActor = g_pclInterface->m_clDocument.m_pclSelectedActor;
if (pclEdActor && pclEdActor->m_pclActor && pclEdActor->m_pclActor->m_fn_bIsAModel())
{
modifField.m_csModelName = pclEdActor->m_pclActor->GetName ();
CTL_Editor_Control *pParentControl = _pclChangedData->m_pub_fn_pclGetParentControl();
if (pParentControl)
{
CTL_Editor_Data *pclData = pParentControl->m_fn_pclGetEditedData();
modifField.m_pModifiedData = pclData;
}
}
g_pclInterface->m_clDocument.mfn_vSetLastModifiedField (modifField);
//End CPA2 Stegaru Cristian 98/06/24
}
BOOL bWatchHasBeenUpdated = FALSE;
// If a Model has changed
EdActors_MyDocument *pclDoc = &(g_pclInterface->m_clDocument);
if ( OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_fn_bIsAModel() )
{
// For Fast_C
if (_pclChangedData->m_pub_fn_csGetDataName() == "FastC_Run")
((EdActors_EditorActorModel *) OAC_fn_pclGetParentActorOfData(_pclChangedData))->m_pub_fn_vNotifyBrain();
// If data is an initial value, update the current one
if (_pclChangedData->m_fn_bHasACurrentData())
_pclChangedData->m_fn_pclGetAssociatedCurrentData()->m_fn_vUpdateData(_pclChangedData, _eReason, OAC_E_ur_ModelDataChanged);
// If data is linked, update instances
if ( OAC_fn_bIsLinked(_pclChangedData) && (pclDoc->m_pclSelectedActor == OAC_fn_pclGetParentActorOfData(_pclChangedData)))
{
//Updates Instances if a Model has changed
((EdActors_EditorActorModel *)pclDoc->m_pclSelectedActor)->m_fn_vUpdateAllInstances(_pclChangedData, _eReason, OAC_E_ur_ModelDataChanged);
//Updates Watch Window
OAC_fn_vUpdateAllDataInWatchWindow();
bWatchHasBeenUpdated = TRUE;
}
}
//Updates Watch Window if necessary
if ( (OAC_fn_bDataIsInWatch(_pclChangedData)) && (!bWatchHasBeenUpdated) )
OAC_fn_vUpdateDataInWatchWindow(_pclChangedData);
}
//************************************************************************************
BOOL OAC_fn_bVectorDataMustBeRead(CTL_Editor_Data *_pclData)
{
BOOL bDataMustBeRead = TRUE;
EdActors_EditorActor *pclParentActor = OAC_fn_pclGetParentActorOfData(_pclData);
bDataMustBeRead = ( ( _pclData->m_fn_pvGetMotorDataPtr() != NULL ) //This is NULL for a Model
&& ((pclParentActor->m_pclActor == NULL) ? TRUE : !pclParentActor->m_pclActor->m_fn_bIsAnAlways())
);
return bDataMustBeRead;
}
//************************************************************************************
BOOL OAC_fn_bVectorDataMustBeWritten(CTL_Editor_Data *_pclData)
{
BOOL bDataMustBeWritten = TRUE;
EdActors_EditorActor *pclParentActor = OAC_fn_pclGetParentActorOfData(_pclData);
bDataMustBeWritten = ( ( _pclData->m_fn_pvGetMotorDataPtr() != NULL ) //This is NULL for a Model
&& ((pclParentActor->m_pclActor == NULL) ? TRUE : !pclParentActor->m_pclActor->m_fn_bIsAnAlways())
);
return bDataMustBeWritten;
}
//************************************************************************************
//************************************ Controls **************************************
//************************************************************************************
//************************************************************************************
//******************************** Windows Controls **********************************
//************************************************************************************
//************************************************************************************
void OAC_fn_vFieldNameStaticHasBeenClicked_CallBack(class CTL_Editor_Static *_pclSenderStatic,
enum CTL_eClickType _tdeClickType)
{
switch ( _tdeClickType )
{
//CPA2 Stegaru Cristian 98/06/22
case CTL_CLICK_TYPE__SHIFT_RIGHT_CLICK:
//show popup
{
EdActors_EditorActor *pclEdActor = g_pclInterface->m_clDocument.m_pclSelectedActor;
if (pclEdActor && pclEdActor->m_pclActor && pclEdActor->m_pclActor->m_fn_bIsAModel())
{
const CString csModelName = pclEdActor->m_pclActor->GetName ();
//get data
CTL_Editor_Control *pParentControl = _pclSenderStatic->m_pub_fn_pclGetParentControl();
CTL_Editor_Data *pclData = pParentControl->m_fn_pclGetEditedData();
const CString csDataName = pclData->m_pub_fn_csGetDataName();
MS_Field stLastModifiedField = g_pclInterface->m_clDocument.mfn_stGetLastModifiedField ();
CStringList lstAllInstances, lstStandardInstances;
EdActors_EditorActorModel *pEdModel = (EdActors_EditorActorModel *)pclEdActor;
if (pEdModel)
{
pEdModel->mfn_vGetAllInstances (lstAllInstances);
if (!stLastModifiedField.m_csModelName.IsEmpty ()
&& csModelName == stLastModifiedField.m_csModelName
&& stLastModifiedField.m_pModifiedData
&& csDataName == stLastModifiedField.m_pModifiedData->m_pub_fn_csGetDataName())
pEdModel->mfn_vGetStandardInstances (pclData, stLastModifiedField.m_pModifiedData, lstStandardInstances);
CDlgSelectInstances dlg (lstAllInstances, lstStandardInstances);
if (IDOK == dlg.DoModal ())
{
if (dlg.mfn_bProcessAllInstances ())
pEdModel->mfn_vUpdateInstances (pclData);
else
pEdModel->mfn_vUpdateInstances (pclData, REASON_INSTANCES_IN_THE_LIST, &lstAllInstances);
}
}
}
}
break;
//End CPA2 Stegaru Cristian 98/06/22
case CTL_CLICK_TYPE__RIGHT_CLICK:
{
EdActors_EditorActor *pclEdActor = g_pclInterface->m_clDocument.m_pclSelectedActor;
if ( pclEdActor->m_fn_bIsAnInstance() )
{
//Adds/Removes Field in/from Watch
if ( _pclSenderStatic->m_pub_fn_pclGetParentControl() != NULL )
{
CTL_Editor_Data *pclData = _pclSenderStatic->m_pub_fn_pclGetParentControl()->m_fn_pclGetEditedData();
EdActors_EditorActor *pclParentActor = OAC_fn_pclGetParentActorOfData(pclData);
if ( (pclParentActor->m_fn_bIsAnInstance())
&& (!pclParentActor->m_pclActor->m_fn_bIsAnAlways())
)
{
BOOL bDataIsInWatch = OAC_fn_bDataIsInWatch(pclData);
if ( bDataIsInWatch )
//Removes from Watch
OAC_RemoveFieldFromWatchWindow(pclData);
else
//Adds in Watch
OAC_AddFieldInWatchWindow(pclData);
_pclSenderStatic->m_pub_fn_vSetBackGroundColor(bDataIsInWatch ? g_pclInterface->m_clDocument.m_pub_colref_FieldInstanceBackgroundColor
: g_pclInterface->m_clDocument.m_pub_colref_InWatchFieldBackgroundColor,
TRUE);
_pclSenderStatic->m_pub_fn_vSetTextColor(bDataIsInWatch ? g_pclInterface->m_clDocument.m_pub_colref_FieldInstanceTextColor
: g_pclInterface->m_clDocument.m_pub_colref_InWatchFieldTextColor,
TRUE);
}
}
}
}
break;
case CTL_CLICK_TYPE__LEFT_DOUBLE_CLICK:
break;
case CTL_CLICK_TYPE__LEFT_BUTTON_DOWN:
if ( _pclSenderStatic->m_pub_fn_pclGetParentControl() != NULL )
{
CTL_Editor_Data *pclData = _pclSenderStatic->m_pub_fn_pclGetParentControl()->m_fn_pclGetEditedData();
EdActors_EditorActor *pclParentActor = OAC_fn_pclGetParentActorOfData(pclData);
if ( pclParentActor->m_fn_bIsAnInstance() )
{
//Begins Drag
g_pclInterface->m_clDocument.m_pclMiniStrucView->m_bMustDragData = TRUE;
g_pclInterface->m_clDocument.m_pclMiniStrucView->SetCapture();
g_pclInterface->m_clDocument.m_pclMiniStrucView->m_pri_pclDataToDrop = pclData;
}
}
break;
};
}
//************************************************************************************
void OAC_fn_vInstanceNameStaticHasBeenClicked_CallBack(class CTL_Editor_Static *_pclSenderStatic,
enum CTL_eClickType _tdeClickType)
{
switch ( _tdeClickType )
{
case CTL_CLICK_TYPE__RIGHT_CLICK:
{
//Displays Popup Menu
////
//Loads menu
CMenu clMenu;
clMenu.LoadMenu(IDR_MENU_CONTEXT);
//Gets submenu
CMenu *pclSubMenu;
EdActors_EditorActor *pclEdActor = g_pclInterface->m_clDocument.m_pclSelectedActor;
ERROR_ASSERT( pclEdActor->m_fn_bIsAnInstance() );
pclSubMenu = clMenu.GetSubMenu(2);
//Selects what's needed
UINT nCheck = pclEdActor->m_pclActor->m_fn_bIsAnAlways() ? MF_CHECKED : MF_UNCHECKED;
pclSubMenu->CheckMenuItem(ID_ALWAYS, MF_BYCOMMAND | nCheck);
nCheck = pclEdActor->m_pclActor->m_fn_bIsAGenDoor() ? MF_CHECKED : MF_UNCHECKED;
pclSubMenu->CheckMenuItem(ID_GENDOOR, MF_BYCOMMAND | nCheck);
nCheck = pclEdActor->m_pclActor->m_pub_fn_bIsCommon() ? MF_CHECKED : MF_UNCHECKED;
pclSubMenu->CheckMenuItem(ID_COMMON, MF_BYCOMMAND | nCheck);
nCheck = pclEdActor->m_pclActor->m_pub_fn_bIsInFix() ? MF_CHECKED : MF_UNCHECKED;
pclSubMenu->CheckMenuItem(ID_INTO_FIX, MF_BYCOMMAND | nCheck);
nCheck = pclEdActor->m_pclActor->m_pub_fn_bIsAlwaysActive() ? MF_CHECKED : MF_UNCHECKED;
pclSubMenu->CheckMenuItem(ID_ALWAYS_ACTIVE, MF_BYCOMMAND | nCheck);
if ( (pclEdActor->m_pclActor->m_fn_bIsAnAlways()) /*|| (pclEdActor->m_pclActor->m_fn_bIsTheWorldActor())*/ )
nCheck = MF_GRAYED;
else
nCheck = MF_ENABLED;
pclSubMenu->EnableMenuItem(ID_ALWAYS_ACTIVE, MF_BYCOMMAND | nCheck);
// ANNECY MT - 19/11/98 {
nCheck = pclEdActor->m_pclActor->m_pub_fn_bIsInAllSubMaps() ? MF_CHECKED : MF_UNCHECKED;
pclSubMenu->CheckMenuItem(ID_IN_ALL_SUBMAPS, MF_BYCOMMAND | nCheck);
if ( (pclEdActor->m_pclActor->m_fn_bIsAnAlways()) /*|| (pclEdActor->m_pclActor->m_fn_bIsTheWorldActor())*/ )
nCheck = MF_GRAYED;
else
nCheck = MF_ENABLED;
pclSubMenu->EnableMenuItem(ID_IN_ALL_SUBMAPS, MF_BYCOMMAND | nCheck);
// END ANNECY MT }
CPoint crPoint;
GetCursorPos(&crPoint);
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterMenu(_pclSenderStatic->GetParent()->m_hWnd, pclSubMenu->m_hMenu, crPoint.x, crPoint.y);
//End of Registers for TUT Module
//////////////
pclSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_LEFTBUTTON, crPoint.x, crPoint.y, _pclSenderStatic->GetParent());
pclSubMenu->DestroyMenu();
clMenu.DestroyMenu();
}
break;
case CTL_CLICK_TYPE__LEFT_DOUBLE_CLICK:
//Edits Model of this Instance
break;
};
}
//************************************************************************************
void OAC_fn_vModelNameStaticHasBeenClicked_CallBack(class CTL_Editor_Static *_pclSenderStatic,
enum CTL_eClickType _tdeClickType)
{
switch ( _tdeClickType )
{
/* case CTL_CLICK_TYPE__RIGHT_CLICK:
{
//Displays Popup Menu
////
//Loads menu
CMenu clMenu;
clMenu.LoadMenu(IDR_MENU_CONTEXT);
//Gets submenu
CMenu *pclSubMenu;
EdActors_EditorActor *pclEdActor = g_pclInterface->m_clDocument.m_pclSelectedActor;
pclSubMenu = clMenu.GetSubMenu(0);
CPoint crPoint;
GetCursorPos(&crPoint);
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterMenu(_pclSenderStatic->GetParent()->m_hWnd, pclSubMenu->m_hMenu, crPoint.x, crPoint.y);
//End of Registers for TUT Module
//////////////
pclSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_LEFTBUTTON, crPoint.x, crPoint.y, _pclSenderStatic->GetParent());
pclSubMenu->DestroyMenu();
clMenu.DestroyMenu();
}
break; */
case CTL_CLICK_TYPE__LEFT_DOUBLE_CLICK:
//Edits Model of the Edited Instance
//
break;
};
}
//************************************************************************************
void OAC_fn_ColRefGetStaticColor_CallBack(class CTL_Editor_Static *_pclSenderStatic,
COLORREF &r_ColRefBackGround,
COLORREF &r_ColRefText)
{
CTL_Editor_Control *pclParentControl = _pclSenderStatic->m_pub_fn_pclGetParentControl();
if ( pclParentControl != NULL )
{
CTL_Editor_Data *pclEditedData = pclParentControl->m_fn_pclGetEditedData();
if ( pclEditedData != NULL )
{
EdActors_EditorActor *pclParentActor = OAC_fn_pclGetParentActorOfData(pclEditedData);
if ( pclParentActor->m_fn_bIsAnInstance() )
{
if ( OAC_fn_bDataIsInWatch(pclEditedData) )
{
r_ColRefBackGround = g_pclInterface->m_clDocument.m_pub_colref_InWatchFieldBackgroundColor;
r_ColRefText = g_pclInterface->m_clDocument.m_pub_colref_InWatchFieldTextColor;
}
else
{
switch (pclParentControl->m_ucInitialCurrentPair)
{
case 2:
r_ColRefBackGround = g_pclInterface->m_clDocument.m_pub_colref_FieldCurrentBackgroundColor;
r_ColRefText = g_pclInterface->m_clDocument.m_pub_colref_FieldCurrentTextColor;
break;
case 1:
r_ColRefBackGround = g_pclInterface->m_clDocument.m_pub_colref_FieldInitialBackgroundColor;
r_ColRefText = g_pclInterface->m_clDocument.m_pub_colref_FieldInitialTextColor;
break;
case 0:
default:
r_ColRefBackGround = g_pclInterface->m_clDocument.m_pub_colref_FieldInstanceBackgroundColor;
r_ColRefText = g_pclInterface->m_clDocument.m_pub_colref_FieldInstanceTextColor;
break;
}
}
}
else
{
r_ColRefBackGround = g_pclInterface->m_clDocument.m_pub_colref_FieldModelBackgroundColor;
r_ColRefText = g_pclInterface->m_clDocument.m_pub_colref_FieldModelTextColor;
}
}
}
else
{
if ( _pclSenderStatic->m_pub_fn_tdeGetType() == CTL_STATIC_TYPE__NEUTRAL_FIELD )
{
r_ColRefBackGround = RGB(190,190,190);
r_ColRefText = RGB(0,0,0);
}
}
}
//************************************************************************************
void OAC_fn_vCheckBoxHasBeenClicked_CallBack(class CTL_Editor_CheckBox *_pclSenderCheckBox,
class CTL_Editor_Control *_pclParentControl,
enum CTL_eCarCheckBoxType _tdeType,
long _lUserDefinedType,
long _lUserDefinedCode)
{
}
//************************************************************************************
BOOL OAC_fn_bLinkCheckBoxCanBeDisplayed_CallBack(class CTL_Editor_BaseControl *_pclSenderBaseControl)
{
return g_pclInterface->m_clDocument.m_pub_bMustShowLinks;
}
//************************************************************************************
BOOL OAC_fn_bLinkCheckBoxMustBeEnabled_CallBack(class CTL_Editor_BaseControl *_pclSenderBaseControl)
{
//Gets Link mode of Data
CTL_Editor_Control *pclControl = _pclSenderBaseControl->m_pub_fn_pclGetParentControl();
ERROR_ASSERT( pclControl != NULL );
CTL_Editor_Data *pclData = pclControl->m_fn_pclGetEditedData();
ERROR_ASSERT( pclData != NULL );
OAC_eDataLinkMode eLinkMode = OAC_fn_tdeGetLink(pclData);
return ( ( eLinkMode != OAC_LINK_MODE__ALWAYS_LINKED ) && ( eLinkMode != OAC_LINK_MODE__NEVER_LINKED ) );
}
//************************************************************************************
//********************************####################********************************
//********************************# Global Functions #********************************
//********************************####################********************************
//************************************************************************************
//************************************************************************************
CTL_Editor_Data *OAC_fn_pclAddStateData(CTL_Editor_DataList *_pclDataList,
CString _csDataName,
CTL_Editor_Data *_pclCurrentAssociatedData /*= NULL*/)
{
CPA_Editor_StateData *pclData = new CPA_Editor_StateData(_csDataName, _pclDataList, _pclCurrentAssociatedData);
_pclDataList->m_pub_fn_vAddData(pclData);
return pclData;
}
//************************************************************************************
CTL_Editor_Data *OAC_fn_pclAddObjectListData(CTL_Editor_DataList *_pclDataList,
CString _csDataName,
CTL_Editor_Data *_pclCurrentAssociatedData /*= NULL*/)
{
CPA_Editor_ObjectListData *pclData = new CPA_Editor_ObjectListData(_csDataName, _pclDataList, _pclCurrentAssociatedData);
_pclDataList->m_pub_fn_vAddData(pclData);
return pclData;
}
//************************************************************************************
BOOL OAC_fn_bBelongsToAnInstance(CTL_Editor_Data *_pclData)
{
BOOL bBelongsToAnInstance = FALSE;
EdActors_EditorActor *pclEditorActor = OAC_fn_pclGetParentActorOfData(_pclData);
if ( pclEditorActor != NULL )
bBelongsToAnInstance = pclEditorActor->m_fn_bIsAnInstance();
return bBelongsToAnInstance;
}
//************************************************************************************
BOOL OAC_fn_bIsEditingAnInstance(CTL_Editor_Control *_pclControl)
{
return OAC_fn_bBelongsToAnInstance(_pclControl->m_fn_pclGetEditedData());
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OAC_fn_bLinkAllowPropagation
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL OAC_fn_bLinkAllowPropagation (CTL_Editor_Data *pclData)
{
return OAC_LINK_MODE__NOT_LINKED == OAC_fn_tdeGetLink(pclData);
}

View File

@@ -0,0 +1,378 @@
#include "stdafx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "TAC.h"
#include "IncMEC.h"
#define D_State_Define
#include "IncGAM.h"
#undef D_State_Define
#include "GLI.h"
#include "DPT.h"
#include "TFA.h" // Family dll include
#include "CPA_Nll.hpp"
#include "_Ainterf.hpp"
#include "EDACstrg.hpp"
#include "ACP_Base.h"
#include "ITF.h"
#include "IncMEC.h"
#define D_State_Define
#include "IncGAM.h"
#undef D_State_Define
#include "GLI.h"
#include "EDACstrg.hpp"
#include "EDACactr.hpp"
#include "edtList.hpp"
#include "CPA_dato.hpp"
#include "CPA_nll.hpp"
#include "x:\Cpa\Main\Inc\_EditID.h"
#include "_AInterf.hpp"
#include "DPT.h"
#include "OZO.h" // Zones dll
#include "owp.h" // Waypoint dll
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#define C_ucTypeWay 18
#ifdef CPA_USES_LDT
#include "ldt.h"
#define sTagObjectsList 'bO'
#define sTagZA 'AZ'
#define sTagDefaultZA 'eD'
#define lTagAddName 'NddA'
HREF g_hRefAddENL;
LDT_tdst_Link *g_pLink;
/*****************************************************************
Function name : CPA_tdoNameList::fn_iCreateCreateNamesList
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 15-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int CPA_tdoNameList::fn_iCreateCreateNamesList( LDT_tdst_Link *pLink ) // create for 'CreateNamesList' section
{
CPA_Family *p_oOwnerFamily = (CPA_Family *)LDT_GetTempLong(0);
CPA_tdoNameList *p_tdoNameList;
BOOL bSaveOnLevel;
ASSERT( p_oOwnerFamily );
bSaveOnLevel = p_oOwnerFamily -> GetEditor() -> GetMainWorld() -> GetInterface() -> fn_bIsLoadingWorld();
p_oOwnerFamily -> GetEditor() -> GetMainWorld() -> GetInterface() -> SetLoadingWorld( TRUE );
p_tdoNameList = new CPA_tdoNameList(LDT_szGetParam(1), p_oOwnerFamily, TRUE, LDT_szGetSectionName());
// set
pLink->pObject = (void*)p_tdoNameList;
LDT_SetLinkValue(pLink, (unsigned long)bSaveOnLevel);
return 0;
}
/*****************************************************************
Function name : CPA_tdoNameList::fn_iLoadCreateNamesList
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 15-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int CPA_tdoNameList::fn_iLoadCreateNamesList( LDT_tdst_Link *pLink ) // load for 'CreateNamesList' section
{
LDT_tdeParseResult result=ParseResult_BeginSection;
CPA_tdoNameList *p_tdoNameList = (CPA_tdoNameList *)pLink->pObject;
BOOL bSaveOnLevel = (BOOL)LDT_GetLinkValue(pLink);
// load subsections
do{
result=LDT_GetNextEntry();
if( result== ParseResult_BeginSection )
LDT_LoadSection( NULL );
}while ( result!=ParseResult_EndSection );
// if no default ZA, select first (if exists)
if( p_tdoNameList -> m_p_oDefaultZA == NULL )
{
CPA_List<CPA_BaseObject> oList;
long lNbFound = p_tdoNameList -> GetMainWorld() -> fn_lFindObjects( &oList, "", C_szZATypeName, p_tdoNameList );
if( lNbFound> 0 )
p_tdoNameList -> m_p_oDefaultZA = oList . GetHead();
}
// load level section
if( p_tdoNameList -> m_p_oLevelSection -> fn_bSectionExists() )
{
LDT_SetTempLong(2, (unsigned long)p_tdoNameList);
LDT_LoadSection( M_MAKECHAR( p_tdoNameList -> m_p_oLevelSection -> GetCompleteSectionName() ) );
}
//
p_tdoNameList -> GetEditor() -> GetMainWorld() -> GetInterface() -> SetLoadingWorld( bSaveOnLevel );
return 0;
}
/*****************************************************************
Function name : CPA_tdoNameList::fn_iCreateAddToNamesList
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 15-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int CPA_tdoNameList::fn_iCreateAddToNamesList( LDT_tdst_Link *pLink ) // create for 'AddToNamesList' section
{
CPA_tdoNameList *p_tdoNameList = (CPA_tdoNameList *)LDT_GetTempLong(2);
ASSERT( p_tdoNameList );
pLink->pObject = (void*)p_tdoNameList;
return 0;
}
/*****************************************************************
Function name : CPA_tdoNameList::LoadNamesList
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 15-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int CPA_tdoNameList::LoadNamesList( LDT_tdst_Link *pLink ) // load for 'NamesList' section
{
LDT_tdeParseResult result=ParseResult_BeginSection;
CPA_tdoNameList *p_tdoNameList = (CPA_tdoNameList *)pLink->pParent->pObject;
ASSERT( p_tdoNameList );
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
if ((*(long*)szEntry) == lTagAddName)
{
tdeShareMode eMode = (tdeShareMode) atoi( LDT_szGetParam(2) );
tdoObjectName *p_oObjName = new tdoObjectName( p_tdoNameList, LDT_szGetParam(1), eMode );
p_tdoNameList -> AddTail( p_oObjName );
}
}
}
}
return 0;
}
/*****************************************************************
Function name : CPA_tdoNameList::fn_iLoadAddENL
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 15-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int CPA_tdoNameList::fn_iLoadAddENL( LDT_tdst_Link *pLink ) // load for 'AddENL' subsection
{
LDT_tdeParseResult result=ParseResult_BeginSection;
CPA_tdoNameList *p_tdoNameList = (CPA_tdoNameList *)pLink->pParent->pObject;
ASSERT( p_tdoNameList );
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(short*)szEntry)
{
case sTagObjectsList : /* */
{
if (p_tdoNameList -> GetType () != C_szWayNameListType)
{
g_pLink = pLink; // for calling postprocess from EdtListHandler::fn_poCreateEdtList
p_tdoNameList -> m_fnp_oCreateNewZoneList( LDT_szGetParam(1) );
}
}
break;
case sTagDefaultZA : /* */
{
p_tdoNameList -> m_p_oDefaultZA = p_tdoNameList -> m_fnp_oCreateNewZA( LDT_szGetParam(1) );
}
break;
case sTagZA : /* */
{
if (strlen(szEntry)<3) //ZA
{
p_tdoNameList -> m_fnp_oCreateNewZA( LDT_szGetParam(1) );
}
else // ZAList
{
p_tdoNameList -> m_fnp_oCreateNewZAList( LDT_szGetParam(1) );
}
}
break;
}
}
}
}
return 0;
}
/*****************************************************************
Function name : CPA_tdoNameList::fn_vAddENLPostProcessLDT
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 15-Oct-98
Modified :
Return type : void
Argument : HREF hRef
*****************************************************************/
void CPA_tdoNameList::fn_vAddENLPostProcessLDT( HREF hRef )
{
LDT_tdst_Link *pLink;
LDT_tdst_Link *pGetFrom;
int iType;
short xCount;
long *pVal;
while( LDT_GetRefFromTable( hRef, &pLink, &pGetFrom, &iType, &xCount, &pVal )==0 )
{
CPA_tdoNameList *p_NameList = (CPA_tdoNameList *)(*pVal);
void *p_vEngineList = (void*)(*(pVal+1));
EdtList *p_NewEdtList = (EdtList *)(*(pVal+2));
CString *p_csEdtListType = (CString *)(*(pVal+3));
CString csEdtListType = *p_csEdtListType;
if (p_NameList -> GetType () != g_c_csWayNameListType)
{
ZDX_tdxHandleToZdxList hZdxList = (ZDX_tdxHandleToZdxList) p_vEngineList; // The engine zone list
int iNumberOfZDx = p_NameList -> GetCount (); // The number of zones
CPA_DLLBase * pZdxDll = M_GetMainApp () -> fn_p_oGetMainWorld () -> GetObjectDLLWithName (C_szDLLZDxName);
ASSERT (pZdxDll);
// More names that ZDx objects : we must grow up the ZDx list
if (fn_uwGetNumberOfGeoObjInList (hZdxList) < iNumberOfZDx)
{
while (fn_uwGetNumberOfGeoObjInList (hZdxList) < p_NewEdtList -> GetCount ())
p_NewEdtList -> RemoveTail (); // Remove one zdx from the editor list
while (fn_uwGetNumberOfGeoObjInList (hZdxList) < iNumberOfZDx)
{
p_NewEdtList -> AddObjectInZoneMotorList (fn_uwGetNumberOfGeoObjInList (hZdxList)); // Add one zdx into the engine list
p_NewEdtList -> AddTail ((CPA_SaveObject *) NULL); // Add one zdx into the editor list
hZdxList = (ZDX_tdxHandleToZdxList) p_NewEdtList -> fn_hGetMotorList ();
}
p_NewEdtList -> fn_vNotifySave ();
}
POSITION PosEdtList = p_NewEdtList -> GetHeadPosition ();
POSITION PosNameList = p_NameList -> GetHeadPosition ();
for (int i = 0 ; i < iNumberOfZDx ; i++) // For each engine zone :
{
// We get the name in the list of names
tdoObjectName * pObjectName = p_NameList -> GetNext (PosNameList);
// We get the engine zone
ACP_tdxHandleOfObject hGeometricObject = ZDX_fn_hGetGeometricZdxInListAtIndex (i , hZdxList);
CPA_SaveObject * pZdxObject;
if (hGeometricObject)
{
// We search the section name of the zone and it MUST exist
char * szZoneSectionName = GLI_p_cSearchValueInLinkTableOfGeometric ((unsigned long) hGeometricObject);
ASSERT (szZoneSectionName);
// We compute the zone name
char * szFamilyName = p_NameList -> GetOwner () -> fn_p_szGetName ();
char szZoneName [SCR_CV_ui_Cfg_MaxLenName];
SCR_fn_v_RdL0_SplitSectionName (szZoneSectionName , NULL , NULL , szZoneName);
// We ask the Zone dll to give us a ZDx object associated to the engine zone
tdstCreateZoneMess stCreateZoneMess;
stCreateZoneMess . csTypeName = csEdtListType;
stCreateZoneMess . hEngineZone = hGeometricObject;
stCreateZoneMess . pOwner = p_NameList -> GetOwner (); // Owner = the family
stCreateZoneMess . csName = szZoneName;
stCreateZoneMess . szDataPath = fn_szGetLevelsDataPath ();
char szSectionName [SCR_CV_ui_Cfg_MaxLenName];
if (pObjectName -> m_eGetShareMode () == E_sm_Virge)
{
fn_zsGetActualLevelFilename (szSectionName , ""); // szSectionName = "GameData\Level\Cave\Cave"
char * p_cSlash = strrchr (szSectionName , '\\');
char * p_cPoint = strrchr (szSectionName , '.');
*p_cPoint = 0;
sprintf (szSectionName , "%s\\Families\\%s\\%s%s" , p_cSlash+1 , szFamilyName , szFamilyName , (LPCTSTR) g_csZoneListExtension);
// szSectionName = "Cave\Families\Ed\Ed.zdx"
}
else
{
sprintf (szSectionName , "_Common\\Families\\%s\\%s%s" , szFamilyName , szFamilyName ,
(LPCTSTR) g_csZoneListExtension); // "_Common\Families\Ed\Ed.zdx"
}
stCreateZoneMess . csReferenceSectionName = szSectionName;
pZdxObject = (CPA_SaveObject *) pZdxDll -> OnQueryAction (g_pclInterface , C_uiQueryCreateZDxObject , (LPARAM) & stCreateZoneMess);
}
else pZdxObject = NULL;
// And we put the editor zone into the object list
p_NewEdtList -> SetAt (PosEdtList , pZdxObject);
p_NewEdtList -> GetNext (PosEdtList);
}
}
delete p_csEdtListType;
LDT_FreeRefValues( pVal );
}
}
#endif //CPA_USES_LDT