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,60 @@
#include "StdAfx.h"
#include "EDAC2Mot.hpp"
#include "EDACStrg.hpp"
#include "EdtList.hpp"
#include "TAc.h"
//-------------------------------------- Called by Motor --------------------------------------
//***********************************************************************
//========================================================================
// Used in Motor, to save Zone Lists
//========================================================================
//***********************************************************************
// ALX
BOOL EDACTORS_fn_b_GetZoneListSectionName(/*ZDX_tdxHandleToZdxList*/void *hHandleToMotorList,
BOOL bListOfZone,
CString &r_csReturnedName)
{
if (bListOfZone) // List of zones
{
CPA_SaveObject * pEdtList = (CPA_SaveObject *) M_GetMainApp () -> m_p_oMainWorld ->
fn_p_oFindObjectWithEngine (hHandleToMotorList , C_szEdtListTypeName);
if (! pEdtList) return FALSE;
r_csReturnedName = pEdtList -> GetReferencedSectionName ();
return TRUE;
}
else // List of activations
{
CPA_SaveObject * pZaList = (CPA_SaveObject *) M_GetMainApp () -> m_p_oMainWorld ->
fn_p_oFindObjectWithEngine (hHandleToMotorList , C_szZAListTypeName);
if (! pZaList) return FALSE;
r_csReturnedName = pZaList -> GetReferencedSectionName ();
return TRUE;
}
}
// End ALX
//***********************************************************************
//========================================================================
// Used in Motor, to save Way Lists
//========================================================================
//***********************************************************************
BOOL EDACTORS_fn_b_GetWayListSectionName(struct WAYLST_tdstFatherListOfWay_ *hHandleToMotorList,
CString &r_csReturnedName)
{
CPA_SaveObject * pEdtList = (CPA_SaveObject *) M_GetMainApp () -> m_p_oMainWorld ->
fn_p_oFindObjectWithEngine (hHandleToMotorList , C_szEdtListTypeName);
if (! pEdtList) return FALSE;
r_csReturnedName = pEdtList -> GetReferencedSectionName ();
return TRUE;
}

View File

@@ -0,0 +1,435 @@
// Implementation for the class of Editor Actors
//////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACActr.hpp"
#include "EDACInst.hpp"
#include "EDACModl.hpp"
#include "EDACDgQu.hpp"
#include "EDACStrg.hpp"
#include "_Ainterf.hpp"
#include "Defines.hpp"
//-----------------IR-------------------------
#include "EDACQuer.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
//****************************************************************
EdActors_EditorActor::EdActors_EditorActor(tdeCarActorType tdeType)
{
//For Objetc Tables
m_pclEnumDescriptorForObjectsTables = new CTL_Editor_EnumDescriptor(g_c_csObjectTablesEnumDescriptorName, 4/*long*/);
m_tdeType = tdeType;
m_ptdstActor = NULL;
m_pclActor = NULL;
m_fn_vConstructListOfMS();
//Sets the parent actor for all the MS
EdActors_ActorMiniStructureList *pclCurrentAMSList;
POSITION AMSPos = m_clListOfAMSLists.GetHeadPosition();
POSITION pos;
while ( AMSPos != NULL )
{
pclCurrentAMSList = m_clListOfAMSLists.GetNext(AMSPos);
pos = pclCurrentAMSList->GetHeadPosition();
while ( pos != NULL )
pclCurrentAMSList->GetNext(pos)->m_pclParentActor = this;
}
m_ucCurrentMSListIndex = 0;
//Calls "m_fn_vGetMotorData()" for each data in the Data List
//-----------------IR-------------------------
m_pclListOfDesignerVariableType = new CTL_Editor_DataList();
m_pclListOfDesignerVariables=EDAC_fn_pclGetNewDesignerVariableList();
//--------------------------------------------
}
//****************************************************************
EdActors_EditorActor::~EdActors_EditorActor()
{
//-----------------IR-------------------------
delete m_pclListOfDesignerVariableType;
EDAC_fn_vDeleteDesignerVariableList(m_pclListOfDesignerVariables);
//--------------------------------------------
if ( m_pclEnumDescriptorForObjectsTables != NULL )
delete m_pclEnumDescriptorForObjectsTables;
}
//****************************************************************
CString EdActors_EditorActor::m_fn_csGetActorName()
{
ERROR_ASSERT( m_pclActor != NULL );
return m_pclActor->GetName();
}
//****************************************************************
CAR_EDIT_TDSTACTOR *EdActors_EditorActor::m_fn_ptdstGetMotorActor()
{
return m_ptdstActor;
}
//****************************************************************
void EdActors_EditorActor::m_fn_vSetMotorActor(CAR_EDIT_TDSTACTOR *ptdstActor)
{
m_ptdstActor = ptdstActor;
}
//**********************************************************************************************
void EdActors_EditorActor::m_fn_vCreateActorMSDataList()
{
EdActors_ActorMiniStructure *pclActorMS;
EdActors_ActorMiniStructureList *pclCurrentAMSList;
POSITION AMSPos = m_clListOfAMSLists.GetHeadPosition();
POSITION pos;
while ( AMSPos != NULL )
{
pclCurrentAMSList = m_clListOfAMSLists.GetNext(AMSPos);
pos = pclCurrentAMSList->GetHeadPosition();
while ( pos != NULL )
{
pclActorMS = pclCurrentAMSList->GetNext(pos);
if ( m_fn_ptdstGetMotorActor() != NULL )
{
ERROR_ASSERT( pclActorMS->m_td_pfn_vFillFunction != NULL );
pclActorMS->m_td_pfn_vFillFunction(this, pclActorMS);
}
}
}
}
//****************************************************************
void EdActors_EditorActor::m_fn_vSetCurrentMSList(EdActors_ActorMiniStructureList *pclActorNewCurrentMSList)
{
m_pclActorCurrentMSList = pclActorNewCurrentMSList;
}
//****************************************************************
// return value :
// -1 if not found
// or the list Index in whicih Data is found
char EdActors_EditorActor::m_fn_cDoesActorOwnData(CTL_Editor_Data *pclDataToSearch)
{
EdActors_ActorMiniStructure *pclUnusedAMS;
return m_fn_cDoesActorOwnData(pclDataToSearch, pclUnusedAMS);
}
//****************************************************************
// return value :
// -1 if not found
// or the list Index in which Data is found (0,1,...)
char EdActors_EditorActor::m_fn_cDoesActorOwnData(CTL_Editor_Data *pclDataToSearch,
EdActors_ActorMiniStructure *&pclAMS)
{
char cIndexToReturn = -1;
BOOL bStop = FALSE;
EdActors_ActorMiniStructureList *pclCurrentAMSList;
POSITION AMSPos = m_clListOfAMSLists.GetHeadPosition();
while ( (AMSPos != NULL) && (!bStop) )
{
pclCurrentAMSList = m_clListOfAMSLists.GetNext(AMSPos);
if ( m_fn_bLookForAData(pclCurrentAMSList, pclDataToSearch, pclAMS) )
bStop = TRUE;
cIndexToReturn ++;
}
return cIndexToReturn;
}
//****************************************************************
BOOL EdActors_EditorActor::m_fn_bLookForAData(EdActors_ActorMiniStructureList *pclActorMSList,
CTL_Editor_Data *pclDataToSearch,
EdActors_ActorMiniStructure *&pclAMS)
{
BOOL bFound = FALSE;
EdActors_ActorMiniStructure *pclCurrentAMS;
POSITION MSpos = pclActorMSList->GetHeadPosition();
POSITION DataPos;
while ( (MSpos != NULL) && !bFound )
{
pclCurrentAMS = pclActorMSList->GetNext(MSpos);
DataPos = pclCurrentAMS->m_pclDataList->GetHeadPosition();
while ( (DataPos != NULL ) && (!bFound) )
bFound = ( pclCurrentAMS->m_pclDataList->GetNext(DataPos) == pclDataToSearch);
if ( bFound )
pclAMS = pclCurrentAMS;
}
return bFound;
}
//****************************************************************
unsigned char EdActors_EditorActor::m_fn_ucGetCurrentMSListIndex()
{
return m_ucCurrentMSListIndex;
}
//****************************************************************
void EdActors_EditorActor::m_fn_vSetCurrentMSListIndex(unsigned char cNewIndex)
{
ERROR_ASSERT( (cNewIndex >= 0) && (cNewIndex < m_clListOfAMSLists.GetCount()) );
m_ucCurrentMSListIndex = cNewIndex;
m_fn_vSetCurrentMSList(m_clListOfAMSLists.m_fn_pclGetListFromIndex(cNewIndex));
}
//****************************************************************
void EdActors_EditorActor::m_fn_vDeleteAllMS()
{
EdActors_ActorMiniStructure *pclActorMS;
EdActors_ActorMiniStructureList *pclCurrentAMSList;
POSITION AMSPos = m_clListOfAMSLists.GetHeadPosition();
POSITION pos;
while ( AMSPos != NULL )
{
pclCurrentAMSList = m_clListOfAMSLists.GetNext(AMSPos);
pos = pclCurrentAMSList->GetHeadPosition();
while ( pos != NULL )
{
pclActorMS = pclCurrentAMSList->GetNext(pos);
if ( pclActorMS->m_fn_bIsAllocated() )
pclActorMS->m_fn_bUnallocate();
}
}
}
//****************************************************************
//Allocates MS if the correponding MS in the Model is allocated
void EdActors_EditorActor::m_fn_vAllocateMSAsInModel(EdActors_EditorActorModel *pclSourceModel)
{
ERROR_ASSERT( pclSourceModel != NULL );
EdActors_ActorMiniStructureList *pclInstanceAMSList;
EdActors_ActorMiniStructureList *pclModelAMSList;
POSITION InstAMSPos = m_clListOfAMSLists.GetHeadPosition();
POSITION ModelAMSPos = pclSourceModel->m_clListOfAMSLists.GetHeadPosition();
EdActors_ActorMiniStructure *pclInstanceAMS;
EdActors_ActorMiniStructure *pclModelAMS;
POSITION InstPos;
POSITION ModelPos;
while ( InstAMSPos != NULL )
{
ERROR_ASSERT( ModelAMSPos != NULL );
pclInstanceAMSList = m_clListOfAMSLists.GetNext(InstAMSPos);
pclModelAMSList = pclSourceModel->m_clListOfAMSLists.GetNext(ModelAMSPos);
InstPos = pclInstanceAMSList->GetHeadPosition();
ModelPos = pclModelAMSList->GetHeadPosition();
while ( InstPos != NULL )
{
pclInstanceAMS = pclInstanceAMSList->GetNext(InstPos);
pclModelAMS = pclModelAMSList->GetNext(ModelPos);
if ( pclModelAMS->m_fn_bIsAllocated() )
{
ERROR_ASSERT ( pclInstanceAMS->m_td_pfn_vAllocationFunction != NULL );
pclInstanceAMS->m_fn_bAllocate();
}
}
}
}
//****************************************************************
void EdActors_EditorActor::m_fn_vUpdateDatas(EdActors_EditorActor *pclSourceActor,
BOOL _bMustUpdateUnlinkedData /*= TRUE*/,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_ASSERT( pclSourceActor != NULL );
EdActors_ActorMiniStructureList *pclDestAMSList;
EdActors_ActorMiniStructureList *pclSourceAMSList;
POSITION DestAMSPos = m_clListOfAMSLists.GetHeadPosition();
POSITION SourceAMSPos = pclSourceActor->m_clListOfAMSLists.GetHeadPosition();
while ( DestAMSPos != NULL )
{
ERROR_ASSERT( SourceAMSPos != NULL );
pclDestAMSList = m_clListOfAMSLists.GetNext(DestAMSPos);
pclSourceAMSList = pclSourceActor->m_clListOfAMSLists.GetNext(SourceAMSPos);
ERROR_ASSERT( pclDestAMSList->GetCount() == pclSourceAMSList->GetCount());
m_fn_vUpdateDataInList(pclDestAMSList, pclSourceAMSList, _bMustUpdateUnlinkedData, eReason, _lUserDefinedReason);
}
}
//****************************************************************
void EdActors_EditorActor::m_fn_vUpdateDataInList(EdActors_ActorMiniStructureList *pclDestMSList,
EdActors_ActorMiniStructureList *pclSourceMSList,
BOOL _bMustUpdateUnlinkedData /*= TRUE*/,
CTL_tdeUpdateReason eReason,
long _lUserDefinedReason /*= 0*/)
{
EdActors_ActorMiniStructure *pclInstanceCurrentMS;
EdActors_ActorMiniStructure *pclModelCurrentMS;
CTL_Editor_DataList *pclInstanceDataList;
CTL_Editor_DataList *pclModelDataList;
POSITION ModelMSPos = pclSourceMSList->GetHeadPosition();
POSITION InstanceMSPos = pclDestMSList->GetHeadPosition();
while ( ModelMSPos != NULL )
{
pclModelCurrentMS = pclSourceMSList->GetNext(ModelMSPos);
pclInstanceCurrentMS = pclDestMSList->GetNext(InstanceMSPos);
if ( pclModelCurrentMS->m_fn_bIsAllocated() )
{
ERROR_ASSERT( pclInstanceCurrentMS->m_fn_bIsAllocated() );
pclInstanceDataList = pclInstanceCurrentMS->m_pclDataList;
pclModelDataList = pclModelCurrentMS->m_pclDataList;
ERROR_ASSERT ( pclInstanceDataList->GetCount() == pclModelDataList->GetCount() );
CTL_Editor_Data *pclDataToBeUpdated;
CTL_Editor_Data *pclSourceData;
POSITION InstDataPos = pclInstanceDataList->GetHeadPosition();
POSITION ModelDataPos = pclModelDataList->GetHeadPosition();
while ( InstDataPos != NULL )
{
pclDataToBeUpdated = pclInstanceDataList->GetNext(InstDataPos);
pclSourceData = pclModelDataList->GetNext(ModelDataPos);
if ( ( _bMustUpdateUnlinkedData )
|| ( OAC_fn_bIsLinked(pclDataToBeUpdated) )
)
pclDataToBeUpdated->m_fn_vUpdateData(pclSourceData, eReason, _lUserDefinedReason);
}
}
}
}
//****************************************************************
tdeCarActorType EdActors_EditorActor::m_fn_tdeGetActorType()
{
return m_tdeType;
}
//****************************************************************
BOOL EdActors_EditorActor::m_fn_bIsAnInstance()
{
return (m_tdeType == EDCAR_ACTOR_TYPE_INSTANCE);
}
//****************************************************************
CTL_Editor_EnumDescriptor *EdActors_EditorActor::m_pub_fn_pclGetEnumDescriptorForObjectsTables()
{
return m_pclEnumDescriptorForObjectsTables;
}
//****************************************************************
void EdActors_EditorActor::m_fn_vSaveActor(SCR_tdst_File_Description *p_stFile)
{
}
//****************************************************************
CTL_Editor_Data *EdActors_EditorActor::m_fn_p_oFindDataByName(CString csName)
{
BOOL bDataFound = FALSE;
CTL_Editor_Data *pclFoundData = NULL;
EdActors_ActorMiniStructure *pclActorMS;
EdActors_ActorMiniStructureList *pclCurrentAMSList;
POSITION AMSPos = m_clListOfAMSLists.GetHeadPosition();
POSITION MSPos;
POSITION DataPos;
while ( (AMSPos != NULL) && (!bDataFound) )
{
pclCurrentAMSList = m_clListOfAMSLists.GetNext(AMSPos);
MSPos = pclCurrentAMSList->GetHeadPosition();
while ( (MSPos != NULL) && (!bDataFound) )
{
pclActorMS = pclCurrentAMSList->GetNext(MSPos);
DataPos = pclActorMS->m_pclDataList->GetHeadPosition();
while ( (DataPos != NULL) && (!bDataFound) )
{
pclFoundData = pclActorMS->m_pclDataList->GetNext(DataPos);
bDataFound = ( pclFoundData->m_pub_fn_csGetDataName().CompareNoCase(csName) == 0 );
}
}
}
if ( bDataFound )
return pclFoundData;
else
return NULL;
}
//****************************************************************
CPA_tdoNameList *EdActors_EditorActor::m_fn_p_oGetNameList(CString csName)
{
CPA_Editor_ObjectListData *p_oData = (CPA_Editor_ObjectListData *) m_fn_p_oFindDataByName(csName);
return p_oData ? p_oData->m_p_oNameList : NULL;
}
//****************************************************************
EdtList *EdActors_EditorActor::m_fn_p_oGetObjectList(CString csName)
{
CPA_Editor_ObjectListData *p_oData = (CPA_Editor_ObjectListData *) m_fn_p_oFindDataByName(csName);
return p_oData ? p_oData->m_p_oObjectList : NULL;
}
//****************************************************************
CPA_ZonesActivatingList *EdActors_EditorActor::m_fn_p_oGetZAList(CString csName)
{
CPA_Editor_ObjectListData *p_oData = (CPA_Editor_ObjectListData *) m_fn_p_oFindDataByName(csName);
return p_oData ? p_oData->m_p_oZAList : NULL;
}
//****************************************************************
void EdActors_EditorActor::m_fn_vSetObjectList(CString csName, EdtList *p_oList)
{
CPA_Editor_ObjectListData *p_oData = (CPA_Editor_ObjectListData *) m_fn_p_oFindDataByName(csName);
if ( p_oData )
p_oData->m_p_oObjectList = p_oList;
}

View File

@@ -0,0 +1,199 @@
// CPACMSBu.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACBuM.hpp"
#include "EDACMStr.hpp"
#include "EDACMStA.hpp"
#include "EDACActr.hpp"
#include "EDACInst.hpp"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
//External Modules
#include "ErO.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPA_Editor_MiniStructureButton
BEGIN_MESSAGE_MAP(CPA_Editor_MiniStructureButton, CButton)
//{{AFX_MSG_MAP(CPA_Editor_MiniStructureButton)
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
CPA_Editor_MiniStructureButton::CPA_Editor_MiniStructureButton( EdActors_MiniStructure *pclMS,
CString csText,
tdeCarMSButtonType tdeType)
{
m_pclMS = pclMS;
m_csBaseText = csText;
m_tdeType = tdeType;
}
//***************************************************************************
CPA_Editor_MiniStructureButton::~CPA_Editor_MiniStructureButton()
{
}
/////////////////////////////////////////////////////////////////////////////
// CPA_Editor_MiniStructureButton message handlers
//***************************************************************************
void CPA_Editor_MiniStructureButton::OnClicked()
{
switch ( m_tdeType )
{
case ECAR_MS_BUTTON_TYPE_ALLOC :
m_pclMS->m_fn_vOnButtonAlloc();
break;
case ECAR_MS_BUTTON_TYPE_OPEN :
m_pclMS->m_fn_vOnButtonOpen();
break;
}
m_fn_vUpdateMSButton();
}
//***************************************************************************
void CPA_Editor_MiniStructureButton::m_fn_vUpdateMSButton()
{
switch ( m_tdeType )
{
case ECAR_MS_BUTTON_TYPE_ALLOC :
if ( m_pclMS->m_pclActorMS != NULL )
{
//Update buttons for Models
//--------------------------------------------
if ( !(m_pclMS->m_pclActorMS->m_pclParentActor->m_fn_bIsAnInstance()) )
{
EnableWindow(TRUE);
if ( m_pclMS->m_pclActorMS->m_fn_bIsAllocated() )
{
SetCheck(1);
if ( m_pclMS->m_fn_bCanBeUnallocated() )
{
SetWindowText("Unalloc");
}
else
{
EnableWindow(FALSE);
if ( m_pclMS->m_fn_tdeGetManiability() == MS_MANIABILITY_ALWAYS_ALLOCATED )
SetWindowText("Always");
}
}
else
{
SetCheck(0);
if ( m_pclMS->m_fn_bCanBeAllocated() )
{
SetWindowText("Alloc");
}
else
{
EnableWindow(FALSE);
SetWindowText("Once");
}
}
}
//Update buttons for Instances
//--------------------------------------------
else
{
// Check if model & instance have the same state
EdActors_EditorActorInstance *pInstance = (EdActors_EditorActorInstance *) m_pclMS->m_pclActorMS->m_pclParentActor;
EdActors_EditorActor *pModel = pInstance->m_fn_pclGetModel()->m_fn_pclGetEditorActor();
EdActors_ActorMiniStructure *pclModelMS = pModel->m_clListOfAMSLists.m_fn_pclGetAMSFromName(m_pclMS->m_pclActorMS->m_fn_csGetScriptName());
if (m_pclMS->m_pclActorMS->m_fn_bIsAllocated())
{
SetCheck(1);
if (m_pclMS->m_fn_bCanBeUnallocated())
{
if (m_pclMS->m_pclActorMS->m_fn_bIsAllocated() != pclModelMS->m_fn_bIsAllocated())
SetWindowText("Unalloc");
else
SetWindowText("All.d");
}
else
{
if ( m_pclMS->m_fn_tdeGetManiability() == MS_MANIABILITY_ALLOCATED_ONLY_ONCE )
SetWindowText("Once");
else if ( m_pclMS->m_fn_tdeGetManiability() == MS_MANIABILITY_ALWAYS_ALLOCATED )
SetWindowText("Always");
}
}
else
{
SetCheck(0);
if (m_pclMS->m_pclActorMS->m_fn_bIsAllocated() != pclModelMS->m_fn_bIsAllocated())
SetWindowText("Alloc");
else
SetWindowText("Unall.d");
ERROR_ASSERT( m_pclMS->m_fn_bCanBeUnallocated() );
}
if (m_pclMS->m_pclActorMS->m_fn_bIsAllocated() != pclModelMS->m_fn_bIsAllocated())
EnableWindow(TRUE);
else
EnableWindow(FALSE);
}
}
else
{
SetWindowText("");
SetCheck(0);
EnableWindow(FALSE);
}
break;
case ECAR_MS_BUTTON_TYPE_OPEN :
if ( m_pclMS->m_pclActorMS != NULL )
{
if ( m_pclMS->m_pclActorMS->m_fn_bIsAllocated() )
{
EnableWindow(TRUE);
if ( m_pclMS->m_pclActorMS->m_fn_bIsOpen() )
SetCheck(1);
else
SetCheck(0);
}
else
{
SetCheck(0);
EnableWindow(FALSE);
}
}
else
{
SetCheck(0);
EnableWindow(FALSE);
}
break;
}
}

View File

@@ -0,0 +1,255 @@
///////////////////////////////////////////////////////////////////////
// The CallBack Functions called by controls when a Data has changed //
///////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
//ANNECY CHRISTOPHE MODIFICATIONS
#define D_ZdxStuff_StructureDefine
//ANNECY END CHRISTOPHE MODIFICATIONS
#include "EDACClBk.hpp"
#include "EDACActr.hpp"
#include "_AInterf.hpp"
#include "EDACStrg.hpp"
#include "CPA_DatS.hpp"
//External Modules
#include "CTL.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
//***********************************************************************
void OAC_fn_vCurrentObjectTableHasChanged(class CTL_Editor_Data *_pclChangedData,
enum CTL_eUpdateReason _eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Into CallBack because current Object Table has been changed",
"EDACT_fn_vCurrentObjectTableHasChanged(...)",
E_ERROR_GRAVITY_FATAL,
"Data is not of the right type");
ERROR_ASSERT( _pclChangedData->m_pub_fn_tdeGetDataType() == CTL_DATA_TYPE__ENUM );
//Sets Actor's pointer on the current Object Table
CString csOTName = ((CTL_Editor_EnumData *)_pclChangedData)->m_pclCurrentValue->m_pub_fn_csGetElementName();
CPA_BaseObject *pclOwnerFamily = (CPA_BaseObject *)OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_pclGetFamily();
EditorObjectTable *pclOT = (EditorObjectTable *)g_pclInterface->GetMainWorld()->fn_p_oFindObject(csOTName, C_szObjectTableTypeName, pclOwnerFamily);
OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_vSetCurrentObjectTable(pclOT);
}
//***********************************************************************
void OAC_fn_vInitialObjectTableHasChanged(class CTL_Editor_Data *_pclChangedData,
enum CTL_eUpdateReason _eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Into CallBack because initial Object Table has been changed",
"EDACT_fn_vInitialObjectTableHasChanged(...)",
E_ERROR_GRAVITY_FATAL,
"Data is not of the right type");
ERROR_ASSERT( _pclChangedData->m_pub_fn_tdeGetDataType() == CTL_DATA_TYPE__ENUM );
//Sets Actor's pointer on the current Object Table
CString csOTName = ((CTL_Editor_EnumData *)_pclChangedData)->m_pclCurrentValue->m_pub_fn_csGetElementName();
CPA_BaseObject *pclOwnerFamily = (CPA_BaseObject *)OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_pclGetFamily();
CPA_BaseObject *pObject = g_pclInterface->GetMainWorld()->fn_p_oFindObject(csOTName, C_szObjectTableTypeName, pclOwnerFamily);
EditorObjectTable *pclOT = (EditorObjectTable *) pObject;
if (pObject && pObject->GetData() == NULL)
{
pObject->GetEditor()->fn_bLoadBaseObject(pObject);
((CTL_Editor_EnumData *)_pclChangedData)->m_pclCurrentValue->m_pub_fn_vSetValue((long) pObject->GetData());
_pclChangedData->m_fn_vUpdateMotorData(_eReason, _lUserDefinedReason);
}
OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_vSetInitialObjectTable(pclOT);
}
//***********************************************************************
void OAC_fn_vCurrentActionHasChanged(class CTL_Editor_Data *_pclChangedData,
enum CTL_eUpdateReason _eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Into CallBack because current Action has been changed",
"EDACT_fn_vCurrentActionHasChanged(...)",
E_ERROR_GRAVITY_FATAL,
"Data is not of the right type");
ERROR_ASSERT( _pclChangedData->m_pub_fn_lGetUSerDefinedDataType() == OAC_DATA_TYPE__STATE );
//Sets Actor's pointer on the current Action
if ( ((CPA_Editor_StateData *)_pclChangedData)->m_pclCurrentValueForActions != NULL )
{
CString csName = ((CPA_Editor_StateData *)_pclChangedData)->m_pclCurrentValueForActions->m_pub_fn_csGetElementName();
CPA_BaseObject *pclOwnerFamily = (CPA_BaseObject *)OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_pclGetFamily();
CPA_Action *pclAction = (CPA_Action *)g_pclInterface->GetMainWorld()->fn_p_oFindObject(csName, C_szActionTypeName, pclOwnerFamily);
OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_vSetCurrentAction(pclAction);
}
//Sets Actor's pointer on the current State
if ( ((CPA_Editor_StateData *)_pclChangedData)->m_pclCurrentValueForStates != NULL )
{
CString csName = ((CPA_Editor_StateData *)_pclChangedData)->m_pclCurrentValueForStates->m_pub_fn_csGetElementName();
CPA_BaseObject *pclOwnerFamily = (CPA_BaseObject *)OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_pclGetFamily();
CPA_State *pclState = (CPA_State *)g_pclInterface->GetMainWorld()->fn_p_oFindObject(csName, C_szStateTypeName, pclOwnerFamily);
OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_vSetCurrentState(pclState);
}
}
//***********************************************************************
void OAC_fn_vInitialActionHasChanged(class CTL_Editor_Data *_pclChangedData,
enum CTL_eUpdateReason _eReason,
long _lUserDefinedReason /*= 0*/)
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Into CallBack because initial Action has been changed",
"EDACT_fn_vInitialActionHasChanged(...)",
E_ERROR_GRAVITY_FATAL,
"Data is not of the right type");
ERROR_ASSERT( _pclChangedData->m_pub_fn_lGetUSerDefinedDataType() == OAC_DATA_TYPE__STATE );
//Sets Actor's pointer on the current Action
if ( ((CPA_Editor_StateData *)_pclChangedData)->m_pclCurrentValueForActions != NULL )
{
CString csName = ((CPA_Editor_StateData *)_pclChangedData)->m_pclCurrentValueForActions->m_pub_fn_csGetElementName();
CPA_BaseObject *pclOwnerFamily = (CPA_BaseObject *)OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_pclGetFamily();
CPA_Action *pclAction = (CPA_Action *)g_pclInterface->GetMainWorld()->fn_p_oFindObject(csName, C_szActionTypeName, pclOwnerFamily);
OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_vSetInitialAction(pclAction);
}
//Sets Actor's pointer on the current State
if ( ((CPA_Editor_StateData *)_pclChangedData)->m_pclCurrentValueForStates != NULL )
{
CString csName = ((CPA_Editor_StateData *)_pclChangedData)->m_pclCurrentValueForStates->m_pub_fn_csGetElementName();
CPA_BaseObject *pclOwnerFamily = (CPA_BaseObject *)OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_pclGetFamily();
CPA_State *pclState = (CPA_State *)g_pclInterface->GetMainWorld()->fn_p_oFindObject(csName, C_szStateTypeName, pclOwnerFamily);
OAC_fn_pclGetParentActorOfData(_pclChangedData)->m_pclActor->m_pub_fn_vSetInitialState(pclState);
}
}
//***********************************************************************
void OAC_fn_vCallBackDynamicsObjectTypeHasChanged(class CTL_Editor_Data *_pclChangedData,
enum CTL_eUpdateReason _eReason,
long _lUserDefinedReason /*= 0*/)
{
struct tdstDynam_ *p_stDynam = (struct tdstDynam_ *)OAC_fn_pclGetParentAMSOfData(_pclChangedData)->m_fn_pvGetBaseAddress();
fn_v_DynamUpdateDNMObjectTypeFromMS(p_stDynam);
}
//ANNECY CT 13/01/98 {
// Local Light flag have been changed
//***********************************************************************
void EDACTORS_fn_vCallBackInitialLocalLightHasChanged(CTL_Editor_Data *pclChangedData, enum CTL_eUpdateReason _eReason, long _lUserDefinedReason = 0)
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Into CallBack because Local Light has been changed",
"EDACTORS_fn_vCallBackLocalLightHasChanged(...)",
E_ERROR_GRAVITY_FATAL,
"Data is not of the right type");
ERROR_ASSERT( pclChangedData->m_pub_fn_tdeGetDataType() == CTL_DATA_TYPE__BOOLEAN );
if (_eReason == CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER) {
unsigned char bLocalLight =
((CTL_Editor_BooleanData *)pclChangedData)->m_bCurrentState;
HIE_tdxHandleToSuperObject hCharacter =
(HIE_tdxHandleToSuperObject)OAC_fn_pclGetParentActorOfData(pclChangedData)->m_pclActor->m_pub_fn_pclGetSuperObject()->GetSuperObjectStruct();
HIE_tdxHandleToSuperObject hSector;
MS_tdxHandleToMSLight hMSLight = M_GetMSHandle(hCharacter,MSLight);
// get charcter's sector
hSector = GAM_fn_hGetCurrentSector(hCharacter);
if (bLocalLight) {
CTL_Editor_Data *pclOtherData;
// remove from dyn light list
SECT_fn_vIsolateDNMLightsListNode(fn_hMSLightGetLightNodeInSector(hMSLight));
// update super object struct
HIE_fn_vSetSuperObjectExcluLight(hCharacter,*fn_p_ucMSLightGetOnlyLocalInit(hMSLight));
// update Ministructure, set other flag writable
pclOtherData = OAC_fn_pclGetParentActorOfData(pclChangedData)->m_fn_p_oFindDataByName("OnlyLocalLight_Init");
((CTL_Editor_BooleanControl *)pclOtherData->m_pub_fn_pclGetParentControl())->m_fn_vMakeReadWrite();
}
else {
CTL_Editor_Data *pclOtherData;
// update super object struct
HIE_fn_vSetSuperObjectExcluLight(hCharacter,FALSE);
// update Ministructure in motor
*fn_p_ucMSLightGetOnlyLocalInit(hMSLight) = FALSE;
// update Ministructure in editor and set other flag FALSE & read only
pclOtherData = OAC_fn_pclGetParentActorOfData(pclChangedData)->m_fn_p_oFindDataByName("OnlyLocalLight_Init");
((CTL_Editor_BooleanData *)pclOtherData)->m_bCurrentState=FALSE;
pclOtherData->m_pub_fn_pclGetParentControl()->m_fn_vUpdate();
((CTL_Editor_BooleanControl *)pclOtherData->m_pub_fn_pclGetParentControl())->m_fn_vMakeReadOnly();
// add in dyn light list
if (hSector) {
SECT_fn_vIsolateDNMLightsListNode(fn_hMSLightGetLightNodeInSector(hMSLight));
SECT_fn_vAddTailDNMLightsListNode(hSector,fn_hMSLightGetLightNodeInSector(hMSLight));
}
}
// redraw the display window
g_pclInterface->GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
}
}
// Only Local Light flag have been changed
//***********************************************************************
void EDACTORS_fn_vCallBackInitialOnlyLocalLightHasChanged(CTL_Editor_Data *pclChangedData, enum CTL_eUpdateReason _eReason, long _lUserDefinedReason = 0)
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Into CallBack because Only Local Light has been changed",
"EDACTORS_fn_vCallBackLocalOnlyLightHasChanged(...)",
E_ERROR_GRAVITY_FATAL,
"Data is not of the right type");
ERROR_ASSERT( pclChangedData->m_pub_fn_tdeGetDataType() == CTL_DATA_TYPE__BOOLEAN );
if (_eReason == CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER) {
unsigned char bOnlyLocalLight =
((CTL_Editor_BooleanData *)pclChangedData)->m_bCurrentState;
HIE_tdxHandleToSuperObject hCharacter =
(HIE_tdxHandleToSuperObject)OAC_fn_pclGetParentActorOfData(pclChangedData)->m_pclActor->m_pub_fn_pclGetSuperObject()->GetSuperObjectStruct();
HIE_tdxHandleToSuperObject hSector;
MS_tdxHandleToMSLight hMSLight = M_GetMSHandle(hCharacter,MSLight);
// get charcter's sector
hSector = GAM_fn_hGetCurrentSector(hCharacter);
// update effective only if light is local
if (*fn_p_ucMSLightGetLocalLightInit(hMSLight)) {
HIE_fn_vSetSuperObjectExcluLight(hCharacter,bOnlyLocalLight);
// redraw the display window
g_pclInterface->GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
}
}
}
//ENDANNECY CT }

View File

@@ -0,0 +1,65 @@
// Implementation file for the definition of a characteristic base type
////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDatW.hpp"
#include "EDACActr.hpp"
#include "EDACCust.hpp"
//External Modules
#include "CTL.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Constructor / Destructor
//************************************************************************
EdActors_WatchData::EdActors_WatchData(CTL_Editor_Data *pclData)
{
m_csActorName = OAC_fn_pclGetParentActorOfData(pclData)->m_fn_csGetActorName();
m_csCharacName = pclData->m_csScriptName;
m_pclData = pclData;
}
//************************************************************************
EdActors_WatchData::~EdActors_WatchData()
{
}
//Member functions
//************************************************************************
CString EdActors_WatchData::m_fn_csGetActorName()
{
return m_csActorName;
}
//************************************************************************
CString EdActors_WatchData::m_fn_csGetFieldName()
{
return m_csCharacName;
}
//************************************************************************
CString EdActors_WatchData::m_fn_csGetDataValue()
{
CString csReturnedString;
CStringList *pclStringList = m_pclData->m_fn_pcslFormatDataValueString();
POSITION pos = pclStringList->GetHeadPosition();
while ( pos != NULL )
{
csReturnedString += pclStringList->GetNext(pos);
if ( pos != NULL )
csReturnedString += CString(" ; ");
}
return csReturnedString;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,241 @@
// EDACDgIL.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDgAC.hpp"
#include "_AInterf.hpp"
#include "EDACModl.hpp"
//External Modules
#include "IncTUT.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
#define OAC_ACTOR_CHOICE_TIMER_ID 75
#define OAC_ACTOR_CHOICE_TIMER_DELAY 10
#define OAC_ACTOR_CHOICE_SCALING_STEP 8 //Percentage of size
/////////////////////////////////////////////////////////////////////////////
// EdActors_Dialog_ActorChoice dialog
BEGIN_MESSAGE_MAP(EdActors_Dialog_ActorChoice, CDialog)
//{{AFX_MSG_MAP(EdActors_Dialog_ActorChoice)
ON_LBN_DBLCLK(IDC_LIST_INSTANCES_OF_MODEL, OnDblclkListInstancesOfModel)
ON_WM_TIMER()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
EdActors_Dialog_ActorChoice::EdActors_Dialog_ActorChoice(CPA_Actor *pclModel,
CPoint cpPoint,
CWnd* pParent /*=NULL*/)
: CDialog(EdActors_Dialog_ActorChoice::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(EdActors_Dialog_ActorChoice)
m_iSelectedItem = 0;
//}}AFX_DATA_INIT
m_hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
m_pclSelectedActor = NULL;
m_pclModel = pclModel;
m_pri_pclFamily = NULL;
m_cpRefPoint = cpPoint;
}
//***************************************************************************
EdActors_Dialog_ActorChoice::EdActors_Dialog_ActorChoice(CPA_Family *_pclFamily,
CPoint cpPoint,
CWnd* pParent /*=NULL*/)
: CDialog(EdActors_Dialog_ActorChoice::IDD, &g_oBaseFrame)
{
m_iSelectedItem = 0;
m_hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
m_pclSelectedActor = NULL;
m_pclModel = NULL;
m_pri_pclFamily = _pclFamily;
m_cpRefPoint = cpPoint;
}
//**************************************************************************
EdActors_Dialog_ActorChoice::~EdActors_Dialog_ActorChoice()
{
AfxSetResourceHandle(m_hOldInstance);
}
//***************************************************************************
void EdActors_Dialog_ActorChoice::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_Dialog_ActorChoice)
DDX_LBIndex(pDX, IDC_LIST_INSTANCES_OF_MODEL, m_iSelectedItem);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_Dialog_ActorChoice message handlers
//***************************************************************************
BOOL EdActors_Dialog_ActorChoice::OnInitDialog()
{
CDialog::OnInitDialog();
//Fills listbox
CListBox *pclListBox = (CListBox *)GetDlgItem(IDC_LIST_INSTANCES_OF_MODEL);
if ( m_pclModel != NULL )
{
short wIndex;
EdActors_EditorActorModel *m_pclEditorModel = (EdActors_EditorActorModel *)m_pclModel->m_fn_pclGetEditorActor();
EdActors_EditorActor *pclCurrentInstance;
POSITION pos = m_pclEditorModel->m_clInstancesList.GetHeadPosition();
while ( pos != NULL )
{
pclCurrentInstance = m_pclEditorModel->m_clInstancesList.GetNext(pos);
wIndex = pclListBox->AddString(pclCurrentInstance->m_fn_csGetActorName());
pclListBox->SetItemDataPtr(wIndex, (void *)pclCurrentInstance);
}
}
else if ( m_pri_pclFamily != NULL )
{
//Gets the list of Models which are childs of the Family
CPA_List<CPA_BaseObject> clListOfModels;
g_pclInterface->GetMainWorld()->fn_lFindObjects(&clListOfModels,
"",
C_szActorModelTypeName,
(CPA_BaseObject *)m_pri_pclFamily);
short wIndex;
CPA_Actor *pclCurrentModel;
POSITION pos = clListOfModels.GetHeadPosition();
while ( pos != NULL )
{
pclCurrentModel = (CPA_Actor *)clListOfModels.GetNext(pos);
//Proposes only loaded Models
if ( pclCurrentModel->fn_bIsAvailable() )
{
wIndex = pclListBox->AddString(pclCurrentModel->GetName());
pclListBox->SetItemDataPtr(wIndex, (void *)pclCurrentModel->m_fn_pclGetEditorActor());
}
}
}
//Places Window
CRect crWindowRect;
GetWindowRect(crWindowRect);
crWindowRect.OffsetRect(m_cpRefPoint.x - crWindowRect.left, m_cpRefPoint.y - crWindowRect.top);
MoveWindow(crWindowRect);
m_cCurrentPercentage = 0;
m_wCurrentWidth = 0;
m_wCurrentHeight = 0;
GetWindowRect(crWindowRect);
m_wFinalWidth = (short)crWindowRect.Width();
m_wFinalHeight = (short)crWindowRect.Height();
m_wInitialTop = (short)crWindowRect.top;
m_wInitialLeft = (short)crWindowRect.left;
MoveWindow(CRect(0,0,0,0));
SetTimer(OAC_ACTOR_CHOICE_TIMER_ID, OAC_ACTOR_CHOICE_TIMER_DELAY, NULL);
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControlID(IDC_LIST_INSTANCES_OF_MODEL, "OAc_AdtorChoiceDialog_ListBox", TUT_e_ListBox);
TUT_M_vRegisterControlID(IDOK, "OAc_AdtorChoiceDialog_OKButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDCANCEL, "OAc_AdtorChoiceDialog_CancelButton", TUT_e_Button);
//End of Registers for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void EdActors_Dialog_ActorChoice::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControlID(IDC_LIST_INSTANCES_OF_MODEL);
TUT_M_vUnregisterControlID(IDOK);
TUT_M_vUnregisterControlID(IDCANCEL);
//End of UnRegisters for TUT Module
//////////////
CDialog::OnDestroy();
}
//***************************************************************************
void EdActors_Dialog_ActorChoice::OnOK()
{
UpdateData(TRUE);
if ( m_iSelectedItem != LB_ERR )
{
CListBox *pclListBox = (CListBox *)GetDlgItem(IDC_LIST_INSTANCES_OF_MODEL);
m_pclSelectedActor = (EdActors_EditorActor *)pclListBox->GetItemDataPtr(m_iSelectedItem);
}
CDialog::OnOK();
}
//***************************************************************************
void EdActors_Dialog_ActorChoice::OnDblclkListInstancesOfModel()
{
OnOK();
}
//***************************************************************************
void EdActors_Dialog_ActorChoice::OnTimer(UINT nIDEvent)
{
if ( nIDEvent == OAC_ACTOR_CHOICE_TIMER_ID )
{
m_wCurrentWidth = (m_wFinalWidth * m_cCurrentPercentage) / 100 + 5;
m_wCurrentHeight = (m_wFinalHeight * m_cCurrentPercentage) / 100 + 5;
m_cCurrentPercentage += OAC_ACTOR_CHOICE_SCALING_STEP;
CRect crDestRect;
crDestRect.top = m_wInitialTop;
crDestRect.bottom = m_wInitialTop + m_wCurrentHeight;
crDestRect.left = m_wInitialLeft;
crDestRect.right = m_wInitialLeft + m_wCurrentWidth;
MoveWindow(crDestRect);
ShowWindow(SW_SHOW);
if ( m_cCurrentPercentage >= 100 )
KillTimer(OAC_ACTOR_CHOICE_TIMER_ID);
}
CDialog::OnTimer(nIDEvent);
}

View File

@@ -0,0 +1,160 @@
// EDACDgCp.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "_AInterf.hpp"
#include "IncGAM.h"
#include "EDACDgCp.hpp"
#include "EDACDgIf.hpp"
//External Modules
#include "IncTUT.h"
//End of External Modules
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_CopyDialog dialog
BEGIN_MESSAGE_MAP(EdActors_CopyDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_CopyDialog)
ON_EN_CHANGE(IDC_EDIT_COPIES_NUMBER, OnChangeEditCopiesNumber)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
EdActors_CopyDialog::EdActors_CopyDialog(CPA_Actor *_pclSourceActor, CWnd* _pParent /*= NULL*/)
: CDialog(EdActors_CopyDialog::IDD, _pParent)
{
m_pclSourceActor = _pclSourceActor;
m_hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
//{{AFX_DATA_INIT(EdActors_CopyDialog)
m_lCopiesNumber = 1;
m_bAutoName = TRUE;
//}}AFX_DATA_INIT
//Computes copy name
m_csNewName = _pclSourceActor->GetName() + "_Copy";
}
//***************************************************************************
//Destructor
EdActors_CopyDialog::~EdActors_CopyDialog()
{
AfxSetResourceHandle(m_hOldInstance);
}
//***************************************************************************
void EdActors_CopyDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_CopyDialog)
DDX_Text(pDX, IDC_EDIT_COPIES_NUMBER, m_lCopiesNumber);
DDX_Text(pDX, IDC_EDIT_FOR_NAME, m_csNewName);
DDX_Check(pDX, IDC_CHECK_NAME_AUTO, m_bAutoName);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_CopyDialog message handlers
//***************************************************************************
BOOL EdActors_CopyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
//Changes Bitmap
if ( m_pclSourceActor->m_fn_bIsAModel() )
{
m_cbBitmap.LoadBitmap(IDB_BITMAP_MODEL);
((CStatic *)GetDlgItem(IDC_IMAGE_MODE))->SetBitmap(HBITMAP(m_cbBitmap));
}
((CSpinButtonCtrl *)GetDlgItem(IDC_SPIN))->SetRange(1, 50);
OnChangeEditCopiesNumber();
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControlID(IDC_EDIT_FOR_NAME, "OAc_CopyDialog_NameEdit", TUT_e_TextEdit);
TUT_M_vRegisterControlID(IDC_EDIT_COPIES_NUMBER, "OAc_CopyDialog_CopiesNumberEdit", TUT_e_TextEdit);
TUT_M_vRegisterControlID(IDC_SPIN, "OAc_CopyDialog_Spin", TUT_e_Spin);
TUT_M_vRegisterControlID(IDC_CHECK_NAME_AUTO, "OAc_CopyDialog_AutoNameButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDOK, "OAc_CopyDialog_OKButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDCANCEL, "OAc_CopyDialog_CancelButton", TUT_e_Button);
//End of Registers for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void EdActors_CopyDialog::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControlID(IDC_EDIT_FOR_NAME);
TUT_M_vUnregisterControlID(IDC_EDIT_COPIES_NUMBER);
TUT_M_vUnregisterControlID(IDC_SPIN);
TUT_M_vUnregisterControlID(IDC_CHECK_NAME_AUTO);
TUT_M_vUnregisterControlID(IDOK);
TUT_M_vUnregisterControlID(IDCANCEL);
//End of UnRegisters for TUT Module
//////////////
CDialog::OnDestroy();
}
//***************************************************************************
void EdActors_CopyDialog::OnChangeEditCopiesNumber()
{
// UpdateData(TRUE);
// GetDlgItem(IDC_CHECK_NAME_AUTO)->EnableWindow( m_lCopiesNumber > 1 );
}
//***************************************************************************
void EdActors_CopyDialog::OnOK()
{
UpdateData(TRUE);
if ( m_lCopiesNumber < 1 )
m_lCopiesNumber = 1;
if ( m_csNewName.IsEmpty() )
{
CString csMessage = "You must chose a name, or press 'Cancel' !";
EdActors_InformationDialog dial(&g_oBaseFrame, csMessage);
dial.DoModal();
}
else
CDialog::OnOK();
}

View File

@@ -0,0 +1,184 @@
// EDACDgIA.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDgIA.hpp"
#include "_AInterf.hpp"
#include "EDACMStA.hpp"
#include "EDACActr.hpp"
//External Modules
#include "IncTUT.h"
//End of External Modules
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_Dialog_InconsistentAllocations dialog
BEGIN_MESSAGE_MAP(EdActors_Dialog_InconsistentAllocations, CDialog)
//{{AFX_MSG_MAP(EdActors_Dialog_InconsistentAllocations)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
EdActors_Dialog_InconsistentAllocations::EdActors_Dialog_InconsistentAllocations( CPA_Actor *_pclModel,
CPA_Actor *_pclInstance,
BOOL _bAllocatedInModel,
EdActors_ActorMiniStructure *_pclModelAMS,
EdActors_ActorMiniStructure *_pclInstanceAMS,
CWnd* pParent /*=NULL*/)
: CDialog(EdActors_Dialog_InconsistentAllocations::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(EdActors_Dialog_InconsistentAllocations)
m_iRadioValue = 2;
//}}AFX_DATA_INIT
m_pri_bAllocatedInModel = _bAllocatedInModel;
m_pri_pclInstanceAMS = _pclInstanceAMS;
m_pri_pclModelAMS = _pclModelAMS;
if ( _bAllocatedInModel )
{
m_csText = "The MS '" + _pclInstanceAMS->m_fn_csGetScriptName() + "' is allocated in Model '";
m_csText += _pclModel->GetName() + "'\n";
m_csText += "but not in Instance '" + _pclInstance->GetName() + "'";
}
else
{
m_csText = "The MS '" + _pclInstanceAMS->m_fn_csGetScriptName() + "' is allocated in Instance '";
m_csText += _pclInstance->GetName() + "'\n";
m_csText += "but not in Model '" + _pclModel->GetName() + "'";
}
}
//***************************************************************************
void EdActors_Dialog_InconsistentAllocations::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_Dialog_InconsistentAllocations)
DDX_Radio(pDX, IDC_RADIO_ALLOCATE, m_iRadioValue);
DDX_Text(pDX, IDC_STATIC_TEXT, m_csText);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_Dialog_InconsistentAllocations message handlers
//***************************************************************************
BOOL EdActors_Dialog_InconsistentAllocations::OnInitDialog()
{
CDialog::OnInitDialog();
//Inits Text for Radio
if ( m_pri_bAllocatedInModel )
{
GetDlgItem(IDC_RADIO_ALLOCATE)->SetWindowText("Allocate in Instance");
GetDlgItem(IDC_RADIO_UNALLOCATE)->SetWindowText("Unallocate in Model (and all its Instances)");
}
else
{
GetDlgItem(IDC_RADIO_ALLOCATE)->SetWindowText("Allocate in Model (and all its Instances)");
GetDlgItem(IDC_RADIO_UNALLOCATE)->SetWindowText("Unallocate in Instance");
}
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControlID(IDC_RADIO_ALLOCATE, "OAc_InconsistentAllocationsDialog_AllocateButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_UNALLOCATE, "OAc_InconsistentAllocationsDialog_UnallocateButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_DO_NOTHING, "OAc_InconsistentAllocationsDialog_DoNothingButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDOK, "OAc_InconsistentAllocationsDialog_OKButton", TUT_e_Button);
//End of Registers for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void EdActors_Dialog_InconsistentAllocations::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControlID(IDC_RADIO_ALLOCATE);
TUT_M_vUnregisterControlID(IDC_RADIO_UNALLOCATE);
TUT_M_vUnregisterControlID(IDC_RADIO_DO_NOTHING);
TUT_M_vUnregisterControlID(IDOK);
//End of UnRegisters for TUT Module
//////////////
CDialog::OnDestroy();
}
//***************************************************************************
void EdActors_Dialog_InconsistentAllocations::OnOK()
{
UpdateData(TRUE);
switch ( m_iRadioValue )
{
/////////////
//Allocates where it's not allocated
case 0:
if ( !m_pri_pclInstanceAMS->m_fn_bIsAllocated() )
{
m_pri_pclInstanceAMS->m_fn_bAllocate(FALSE);
m_pri_pclInstanceAMS->m_pclParentActor->m_pclActor->fn_vNotifySave();
}
else
{
m_pri_pclModelAMS->m_fn_bAllocate(FALSE);
m_pri_pclInstanceAMS->m_pclParentActor->m_pclActor->fn_vNotifySave();
}
break;
/////////////
//Unallocates where it's allocated
case 1:
if ( m_pri_pclInstanceAMS->m_fn_bIsAllocated() )
{
m_pri_pclInstanceAMS->m_fn_bUnallocate();
m_pri_pclInstanceAMS->m_pclParentActor->m_pclActor->fn_vNotifySave();
}
else
{
m_pri_pclModelAMS->m_fn_bUnallocate();
m_pri_pclInstanceAMS->m_pclParentActor->m_pclActor->fn_vNotifySave();
}
break;
/////////////
//Does nothing and continues
case 2:
break;
};
CDialog::OnOK();
}

View File

@@ -0,0 +1,99 @@
// EDACDgIC.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDgIC.hpp"
//External Modules
#include "IncTUT.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BEGIN_MESSAGE_MAP(EdActors_InstanceCreationDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_InstanceCreationDialog)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
EdActors_InstanceCreationDialog::EdActors_InstanceCreationDialog(CString _csModelName,
CString _csDefaultName,
CWnd* pParent /*=NULL*/)
: CDialog(EdActors_InstanceCreationDialog::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(EdActors_InstanceCreationDialog)
m_pri_csNewInstanceName = _csDefaultName;
//}}AFX_DATA_INIT
m_pri_csModelName = _csModelName;
}
//***************************************************************************
void EdActors_InstanceCreationDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_InstanceCreationDialog)
DDX_Text(pDX, IDC_EDIT_NAME, m_pri_csNewInstanceName);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_InstanceCreationDialog message handlers
//***************************************************************************
BOOL EdActors_InstanceCreationDialog::OnInitDialog()
{
CDialog::OnInitDialog();
GetDlgItem(IDC_STATIC_TEXT)->SetWindowText(CString("You are going to instanciate the Model '") + m_pri_csModelName + "' ...");
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_hWnd, "OAc_ActorCreationNameDialog_Window", TUT_e_Window);
TUT_M_vRegisterControlID(IDC_EDIT_NAME, "OAc_ActorCreationNameDialog_NameEdit", TUT_e_TextEdit);
TUT_M_vRegisterControlID(IDOK, "OAc_ActorCreationNameDialog_OKButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDCANCEL, "OAc_ActorCreationNameDialog_CancelButton", TUT_e_Button);
//End of Register for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void EdActors_InstanceCreationDialog::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl(m_hWnd);
TUT_M_vUnregisterControlID(IDC_EDIT_NAME);
TUT_M_vUnregisterControlID(IDOK);
TUT_M_vUnregisterControlID(IDCANCEL);
//End of UnRegister for TUT Module
//////////////
CDialog::OnDestroy();
}
//***************************************************************************
CString EdActors_InstanceCreationDialog::m_fn_csGetNewInstanceName()
{
return m_pri_csNewInstanceName;
}

View File

@@ -0,0 +1,108 @@
// CPACDgIf.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "EDACDgIf.hpp"
#include "_Ainterf.hpp"
//External Modules
#include "IncTUT.h"
//End of External Modules
#define C_INFO_DIALOG_TIMER 70 //An Id for the timer
#define C_TEMPO_TIMER 100 //(ms)
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_InformationDialog dialog
BEGIN_MESSAGE_MAP(EdActors_InformationDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_InformationDialog)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//**************************************************************************
EdActors_InformationDialog::EdActors_InformationDialog(CWnd* pParent, CString csMessage)
: CDialog(EdActors_InformationDialog::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(EdActors_InformationDialog)
m_csMessage = csMessage;
//}}AFX_DATA_INIT
m_hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
}
//**************************************************************************
EdActors_InformationDialog::~EdActors_InformationDialog()
{
AfxSetResourceHandle(m_hOldInstance);
}
//***************************************************************************
void EdActors_InformationDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_InformationDialog)
DDX_Text(pDX, IDC_STATIC_TEXT, m_csMessage);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_InformationDialog message handlers
//***************************************************************************
BOOL EdActors_InformationDialog::OnInitDialog()
{
CDialog::OnInitDialog();
//Init. timer
SetTimer(C_INFO_DIALOG_TIMER, C_TEMPO_TIMER, NULL);
//Loads Bitmaps
m_a_cbBitmaps[0].LoadBitmap(IDB_BITMAP_INFO1);
m_a_cbBitmaps[1].LoadBitmap(IDB_BITMAP_INFO2);
m_a_cbBitmaps[2].LoadBitmap(IDB_BITMAP_INFO3);
m_a_cbBitmaps[3].LoadBitmap(IDB_BITMAP_INFO4);
m_a_cbBitmaps[4].LoadBitmap(IDB_BITMAP_INFO5);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void EdActors_InformationDialog::OnOK()
{
KillTimer(C_INFO_DIALOG_TIMER);
EndDialog(IDOK);
}
//***************************************************************************
void EdActors_InformationDialog::OnTimer(UINT nIDEvent)
{
static BOOL s_bFirstPass = TRUE;
static char s_cCurrentBitmapIndex = -1; //To begin with first bitmap
static char s_cIndexIncrement = 1;
s_cCurrentBitmapIndex += s_cIndexIncrement;
if ( ! s_bFirstPass )
{
if ( s_cCurrentBitmapIndex % (C_NUMBER_OF_BITMAPS-1) == 0 )
s_cIndexIncrement = -s_cIndexIncrement;
}
else
s_bFirstPass = FALSE;
((CStatic *)GetDlgItem(IDC_STATIC_IMAGE))->SetBitmap(HBITMAP(m_a_cbBitmaps[s_cCurrentBitmapIndex]));
CDialog::OnTimer(nIDEvent);
}

View File

@@ -0,0 +1,835 @@
// CPACMNDg.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "TAc.h"
#include "TFa.h"
#include "IncMEC.h"
#define D_State_Define
#include "IncGAM.h"
#undef D_State_Define
#include "GLI.h"
#include "EDACDgMC.hpp"
#include "EDACDgIf.hpp"
#include "EDACDgMg.hpp"
#include "EDACModl.hpp"
#include "EDACStrg.hpp"
#include "EDACGlob.hpp"
#include "_Ainterf.hpp"
//External Modules
#include "ErO.h"
#include "IncTUT.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
#define EdActors_C_COLOR_FOR_LOADED_FAMILIES (RGB(255,0,0))
#define EdActors_C_INVERSE_COLOR_FOR_LOADED_FAMILIES (RGB(255,150,150))
#define EdActors_C_COLOR_FOR_SELECTED_LOADED_FAMILIES (RGB(150,100,100))
#define EdActors_C_COLOR_FOR_UNLOADED_FAMILIES (RGB(96,96,96))
#define EdActors_C_INVERSE_COLOR_FOR_UNLOADED_FAMILIES (RGB(255,255,255))
#define EdActors_C_COLOR_FOR_SELECTED_UNLOADED_FAMILIES (RGB(96,96,255))
#define EdActors_C_szGenDoorsDescriptor "[GenDoor] "
#define EdActors_C_szNormalDescriptor "[Normal] "
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_ModelCreationDialog dialog
BEGIN_MESSAGE_MAP(EdActors_ModelCreationDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_ModelCreationDialog)
ON_LBN_DBLCLK(IDC_LIST_FAMILIES, OnDblclkListFamilies)
ON_LBN_SELCHANGE(IDC_LIST_FAMILIES, OnSelchangeListFamilies)
ON_LBN_SELCHANGE(IDC_LIST_BITMAPS, OnSelchangeListBitmaps)
ON_BN_CLICKED(IDC_RADIO_ALL_FAMILIES, OnRadioAllFamilies)
ON_BN_CLICKED(IDC_RADIO_LOADED_FAMILIES, OnRadioLoadedFamilies)
ON_BN_CLICKED(IDC_RADIO_UNLOADED_FAMILIES, OnRadioUnloadedFamilies)
ON_WM_DRAWITEM()
ON_BN_CLICKED(IDC_CHECK_GEN_DOOR, OnCheckGenDoor)
ON_EN_CHANGE(IDC_EDIT_CONTAINING, OnChangeEditContaining)
ON_EN_CHANGE(IDC_EDIT_START_WITH, OnChangeEditStartWith)
ON_BN_CLICKED(IDC_CHECK_ASPECT, OnCheckAspect)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//**************************************************************************
EdActors_ModelCreationDialog::EdActors_ModelCreationDialog(CWnd* pParent)
: CDialog(EdActors_ModelCreationDialog::IDD,
&g_oBaseFrame)
{
hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
//{{AFX_DATA_INIT(EdActors_ModelCreationDialog)
m_bQuickView = TRUE;
m_iFilterChoice = 0;
m_bIsAGenDoor = FALSE;
m_csStartWith = _T("");
m_csContaining = _T("");
//}}AFX_DATA_INIT
//Gets the current Family List
m_pclFamilyList = g_pclInterface->GetMainWorld()->fn_p_oGetOriginalObjectList(C_szFamilyTypeName);
m_hBitmap = NULL;
m_hNoBitmap = NULL;
m_pclCreatedModel = NULL;
m_pclSelectedFamily = NULL;
}
//**************************************************************************
EdActors_ModelCreationDialog::~EdActors_ModelCreationDialog()
{
//Deletes all bitmap descriptions
POSITION pos = m_clListOfBitmapsForActors.GetHeadPosition();
while ( pos != NULL )
delete (m_clListOfBitmapsForActors.GetNext(pos));
pos = m_clListOfBitmapsForGenDoors.GetHeadPosition();
while ( pos != NULL )
delete (m_clListOfBitmapsForGenDoors.GetNext(pos));
pos = m_clListOfFamilies.GetHeadPosition();
while ( pos != NULL )
delete (m_clListOfFamilies.GetNext(pos));
AfxSetResourceHandle(hOldInstance);
}
//**************************************************************************
void EdActors_ModelCreationDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_ModelCreationDialog)
DDX_Text(pDX, IDC_EDIT_FOR_NAME, m_csNewModelName);
DDX_Check(pDX, IDC_CHECK_ASPECT, m_bQuickView);
DDX_Radio(pDX, IDC_RADIO_ALL_FAMILIES, m_iFilterChoice);
DDX_Check(pDX, IDC_CHECK_GEN_DOOR, m_bIsAGenDoor);
DDX_Text(pDX, IDC_EDIT_START_WITH, m_csStartWith);
DDX_Text(pDX, IDC_EDIT_CONTAINING, m_csContaining);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_ModelCreationDialog message handlers
//**************************************************************************
BOOL EdActors_ModelCreationDialog::OnInitDialog()
{
CDialog::OnInitDialog();
//Computes BackGround Color
m_colrefBackGroundColor = ::GetSysColor(COLOR_MENU);
//Builds the internal list of Families
CPA_Family *pclCurrentFamily;
struct m_stFamilyDescription *p_stDescriptor;
Position pos = m_pclFamilyList->GetHeadPosition();
while ( pos != 0 )
{
pclCurrentFamily = (CPA_Family *)m_pclFamilyList->GetNext(pos);
//Adds a descriptor
p_stDescriptor = new struct m_stFamilyDescription;
p_stDescriptor->pclFamily = pclCurrentFamily;
p_stDescriptor->bIsAGenDoorFamily = m_pri_fn_bIsAGenDoorFamily(pclCurrentFamily);
m_clListOfFamilies.AddTail(p_stDescriptor);
}
//Fills the list box with Families
m_fn_vDisplayFilteredFamilies();
//Fills the second ListBox with Bitmaps Names
CString csBitmapsNames = g_pclInterface->m_clDocument.m_csModelsBitmapsCompletePath
+ "*.bmp";
CString csFileName;
HANDLE hFileHandle;
WIN32_FIND_DATA FindData;
hFileHandle = FindFirstFile(LPCTSTR(csBitmapsNames), &FindData);
BOOL bMustGoOn = ( hFileHandle != INVALID_HANDLE_VALUE );
struct m_stBitmapDescription *p_stBMDesc;
while ( bMustGoOn )
{
csFileName = FindData.cFileName;
//Adds to internal list
p_stBMDesc = new struct m_stBitmapDescription;
p_stBMDesc->csFileName = csFileName;
p_stBMDesc->hBitmap = NULL;
p_stBMDesc->bLoaded = FALSE;
m_clListOfBitmapsForActors.AddTail(p_stBMDesc);
bMustGoOn = FindNextFile(hFileHandle, &FindData);
}
FindClose(hFileHandle);
//Gets the Bitmaps for GenDoors
csBitmapsNames = g_pclInterface->m_clDocument.m_csModelsBitmapsCompletePathForGenDoors
+ "*.bmp";
BOOL bModFound;
CString csModFileName;
CFile cfModFile;
hFileHandle = FindFirstFile(LPCTSTR(csBitmapsNames), &FindData);
bMustGoOn = ( hFileHandle != INVALID_HANDLE_VALUE );
while ( bMustGoOn )
{
csFileName = FindData.cFileName;
//Searches for the corresponding ".MOD"
csModFileName = csFileName.Left(csFileName.GetLength() - 3) + "mod";
csModFileName = g_pclInterface->m_clDocument.m_csModelsBitmapsCompletePathForGenDoors + csModFileName;
bModFound = cfModFile.Open(csModFileName, CFile::modeRead);
if ( bModFound )
{
cfModFile.Close();
//Adds to internal list
p_stBMDesc = new struct m_stBitmapDescription;
p_stBMDesc->csFileName = csFileName;
p_stBMDesc->hBitmap = NULL;
p_stBMDesc->bLoaded = FALSE;
m_clListOfBitmapsForGenDoors.AddTail(p_stBMDesc);
}
bMustGoOn = FindNextFile(hFileHandle, &FindData);
}
FindClose(hFileHandle);
//Initial setting is "Actors mode"
CButton *pclGenDoorButton = (CButton *)GetDlgItem(IDC_CHECK_GEN_DOOR);
pclGenDoorButton->SetCheck(TRUE); //Init
m_fn_vFillListBoxWithBitmapNames(&m_clListOfBitmapsForActors);
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControlID(IDC_LIST_FAMILIES, "OAc_ModelCreationDialog_FamiliesListBox", TUT_e_ListBox);
TUT_M_vRegisterControlID(IDC_LIST_BITMAPS, "OAc_ModelCreationDialog_BitmpasListBox", TUT_e_ListBox);
TUT_M_vRegisterControlID(IDC_EDIT_FOR_NAME, "OAc_ModelCreationDialog_ModelNameEdit", TUT_e_TextEdit);
TUT_M_vRegisterControlID(IDC_RADIO_ALL_FAMILIES, "OAc_ModelCreationDialog_AllFamiliesButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_LOADED_FAMILIES, "OAc_ModelCreationDialog_LoadedFamiliesButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_UNLOADED_FAMILIES, "OAc_ModelCreationDialog_UnloadedFamiliesButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDC_EDIT_START_WITH, "OAc_ModelCreationDialog_StartWithEdit", TUT_e_TextEdit);
TUT_M_vRegisterControlID(IDC_EDIT_CONTAINING, "OAc_ModelCreationDialog_ContainingEdit", TUT_e_TextEdit);
TUT_M_vRegisterControlID(IDC_CHECK_ASPECT, "OAc_ModelCreationDialog_QuickViewButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDOK, "OAc_ModelCreationDialog_OKButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDCANCEL, "OAc_ModelCreationDialog_CancelButton", TUT_e_Button);
//End of Registers for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControlID(IDC_LIST_FAMILIES);
TUT_M_vUnregisterControlID(IDC_LIST_BITMAPS);
TUT_M_vUnregisterControlID(IDC_EDIT_FOR_NAME);
TUT_M_vUnregisterControlID(IDC_RADIO_ALL_FAMILIES);
TUT_M_vUnregisterControlID(IDC_RADIO_LOADED_FAMILIES);
TUT_M_vUnregisterControlID(IDC_RADIO_UNLOADED_FAMILIES);
TUT_M_vUnregisterControlID(IDC_EDIT_START_WITH);
TUT_M_vUnregisterControlID(IDC_EDIT_CONTAINING);
TUT_M_vUnregisterControlID(IDC_CHECK_ASPECT);
TUT_M_vUnregisterControlID(IDOK);
TUT_M_vUnregisterControlID(IDCANCEL);
//End of UnRegisters for TUT Module
//////////////
CDialog::OnDestroy();
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnOK()
{
AfxGetApp()->DoWaitCursor(1);
UpdateData(TRUE);
BOOL bMustContinue = TRUE;
//Checks if Family has an animation
if ( m_pclSelectedFamily == NULL )
{
CString csMessage = "You must choose a family for the Model\nor 'Cancel' !!";
EdActors_InformationDialog dial(&g_oBaseFrame, csMessage);
dial.DoModal();
bMustContinue = FALSE;
}
//Checks Name
if ( bMustContinue )
{
if ( m_csNewModelName.IsEmpty() )
{
if ( MessageBox("You did not give any name to your new Model !\nIf you chose 'OK', a default name will be given.",
"Model Creation - WARNING !",
MB_OKCANCEL | MB_ICONEXCLAMATION) == IDCANCEL )
bMustContinue = FALSE;
}
else
fn_vCheckAndChangeName(m_csNewModelName);
}
if ( bMustContinue )
{
//Loads Family if necessary
if ( !m_pclSelectedFamily->fn_bIsAvailable() )
{
CPA_DLLBase *p_clFamilyDll = g_pclInterface->GetMainWorld()->GetDLLWithTypeName(C_szDLLFamilyName);
ERROR_ASSERT( p_clFamilyDll != NULL );
//Displays message window
CString csMessageString = "Loading Family '" + m_pclSelectedFamily->GetName() + "'... Please wait !";
EdActors_Dialog_Message MessageDial(csMessageString);
MessageDial.m_pub_fn_bCreate();
ERROR_VERIFY( p_clFamilyDll->fn_bLoadBaseObject(m_pclSelectedFamily) );
}
//Creates all needed objects
///////////////////////////////
//Creates Editor's Actor
CPA_Actor *pclNewEditorActor = new CPA_Actor( NULL,
NULL,
g_c_csActorModelType,
NULL,
m_pclSelectedFamily,
NULL,
m_csNewModelName);
pclNewEditorActor->m_fn_vMakeGenDoor(m_bIsAGenDoor);
////////////////////////////////////////////////////////
//Creates a SuperObject to place in the hierarchy
m_pclCreatedModel = g_pclInterface->GetInterface()->GetNewSuperObject(E_ss_NoSave,
C_Protected,
"",
"");
pclNewEditorActor->m_fn_vMakeGenDoor(m_bIsAGenDoor);
pclNewEditorActor->m_pub_fn_vSetSuperObject(m_pclCreatedModel);
pclNewEditorActor->m_fn_vSetModelDefaultValues();
m_pclCreatedModel->SetModelName(pclNewEditorActor->GetName());
m_pclCreatedModel->SetObject(pclNewEditorActor);
//PROVISOIRE...
m_pclCreatedModel->GetStruct()->hLocalMatrix = (GEO_tdxHandleToMatrix)malloc(sizeof(POS_tdstCompletePosition));
POS_fn_vSetIdentityMatrix(m_pclCreatedModel->GetStruct()->hLocalMatrix);
EndDialog(IDOK);
}
AfxGetApp()->DoWaitCursor(-1);
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnSelchangeListFamilies()
{
CListBox *pclLB = (CListBox *)GetDlgItem(IDC_LIST_FAMILIES);
short wIndex = pclLB->GetCurSel();
if ( wIndex != LB_ERR )
{
m_pclSelectedFamily = ((struct m_stFamilyDescription *)(pclLB->GetItemDataPtr(wIndex)))->pclFamily;
if ( ((struct m_stFamilyDescription *)(pclLB->GetItemDataPtr(wIndex)))->bIsAGenDoorFamily )
{
m_bIsAGenDoor = TRUE;
m_fn_vFillListBoxWithBitmapNames(&m_clListOfBitmapsForGenDoors);
}
else
{
m_bIsAGenDoor = FALSE;
m_fn_vFillListBoxWithBitmapNames(&m_clListOfBitmapsForActors);
}
}
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnDblclkListFamilies()
{
// OnOK();
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnRadioAllFamilies()
{
UpdateData(TRUE);
m_fn_vDisplayFilteredFamilies();
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnRadioLoadedFamilies()
{
UpdateData(TRUE);
m_fn_vDisplayFilteredFamilies();
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnRadioUnloadedFamilies()
{
UpdateData(TRUE);
m_fn_vDisplayFilteredFamilies();
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnChangeEditContaining()
{
UpdateData(TRUE);
m_fn_vDisplayFilteredFamilies();
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnChangeEditStartWith()
{
UpdateData(TRUE);
m_fn_vDisplayFilteredFamilies();
}
//**************************************************************************
//Fills the list box with Families
void EdActors_ModelCreationDialog::m_fn_vDisplayFilteredFamilies()
{
//Fills the list box with Families
CListBox *pclLB = (CListBox *)GetDlgItem(IDC_LIST_FAMILIES);
pclLB->ResetContent();
BOOL bMustDisplayCurrentFamily;
short wIndex;
struct m_stFamilyDescription *p_stCurrentFamilyDescriptor;
CPA_Family *pclCurrentFamily;
POSITION pos = m_clListOfFamilies.GetHeadPosition();
while ( pos != 0 )
{
p_stCurrentFamilyDescriptor = m_clListOfFamilies.GetNext(pos);
pclCurrentFamily = p_stCurrentFamilyDescriptor->pclFamily;
switch ( m_iFilterChoice )
{
//All families
case 0:
bMustDisplayCurrentFamily = TRUE;
break;
//Loaded families
case 1:
bMustDisplayCurrentFamily = ( pclCurrentFamily->fn_bIsAvailable() );
break;
//Unloaded families
case 2:
bMustDisplayCurrentFamily = ( !(pclCurrentFamily->fn_bIsAvailable()) );
break;
default:
bMustDisplayCurrentFamily = FALSE;
break;
}
if ( bMustDisplayCurrentFamily )
{
CString csFamilyName = pclCurrentFamily->GetName();
csFamilyName.MakeLower();
//Looks for strings
if ( !m_csStartWith.IsEmpty() )
{
m_csStartWith.MakeLower();
bMustDisplayCurrentFamily = ( csFamilyName.Left(m_csStartWith.GetLength()).CompareNoCase(m_csStartWith) == 0 );
}
if ( bMustDisplayCurrentFamily )
if ( !m_csContaining.IsEmpty() )
{
m_csContaining.MakeLower();
bMustDisplayCurrentFamily = ( csFamilyName.Find(m_csContaining) != -1 );
}
if ( bMustDisplayCurrentFamily )
{
wIndex = pclLB->AddString(pclCurrentFamily->GetName());
pclLB->SetItemDataPtr(wIndex, (void *)p_stCurrentFamilyDescriptor);
}
}
}
m_pclSelectedFamily = NULL;
}
//**************************************************************************
CPA_SuperObject *EdActors_ModelCreationDialog::m_fn_pclGetNewModel()
{
return m_pclCreatedModel;
}
//**************************************************************************
CString EdActors_ModelCreationDialog::m_fn_csGetBitmapName()
{
return m_csBitmapName;
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnCheckAspect()
{
UpdateData(TRUE);
if ( !m_bQuickView )
{
if ( m_hNoBitmap == NULL )
if ( m_clBitmapNoImage.LoadBitmap(IDB_BITMAP_NO_IMAGE) )
m_hNoBitmap = HBITMAP(m_clBitmapNoImage);
CStatic *pclStatic = (CStatic *)GetDlgItem(IDC_PICTURES);
pclStatic->SetBitmap(m_hNoBitmap);
}
else
OnSelchangeListBitmaps();
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnSelchangeListBitmaps()
{
CListBox *pclLB = (CListBox *)GetDlgItem(IDC_LIST_BITMAPS);
short wIndex = pclLB->GetCurSel();
if ( wIndex != LB_ERR )
{
pclLB->GetText(wIndex, m_csBitmapName);
CWnd *pclWnd = GetDlgItem(IDC_PICTURES);
CRect crPictureRect;
pclWnd->GetWindowRect(crPictureRect);
struct m_stBitmapDescription *p_stBMDesc;
p_stBMDesc = (struct m_stBitmapDescription *)pclLB->GetItemDataPtr(wIndex);
if ( (m_bQuickView) && (!p_stBMDesc->bLoaded) )
{
CString csBitmapNameAndPath;
if ( m_bIsAGenDoor )
csBitmapNameAndPath = g_pclInterface->m_clDocument.m_csModelsBitmapsCompletePathForGenDoors
+ m_csBitmapName;
else
csBitmapNameAndPath = g_pclInterface->m_clDocument.m_csModelsBitmapsCompletePath
+ m_csBitmapName;
//Gets size
m_fn_bGetBitmapSize(csBitmapNameAndPath, &p_stBMDesc->csSize);
int xSize, ySize;
double dfRatio;
if ( p_stBMDesc->csSize.cx > p_stBMDesc->csSize.cy )
{
xSize = crPictureRect.Width();
dfRatio = (double)crPictureRect.Width() / (double)p_stBMDesc->csSize.cx;
ySize = (int)(p_stBMDesc->csSize.cy * dfRatio);
}
else
{
ySize = crPictureRect.Height();
dfRatio = (double)crPictureRect.Height() / (double)p_stBMDesc->csSize.cy;
xSize = (int)(p_stBMDesc->csSize.cx * dfRatio);
}
//Loads Bitmap
p_stBMDesc->hBitmap = (HBITMAP)LoadImage( NULL,
csBitmapNameAndPath,
IMAGE_BITMAP,
xSize,
ySize,
LR_LOADFROMFILE | LR_CREATEDIBSECTION
);
p_stBMDesc->bLoaded = TRUE;
}
m_hBitmap = p_stBMDesc->hBitmap;
m_csBitmapSize = p_stBMDesc->csSize;
if ( m_bQuickView )
{
//Sets size Text
CWnd *pclStaticWnd = GetDlgItem(IDC_PICTURE_SIZE);
CString csSizeText;
csSizeText.Format("%i x %i", m_csBitmapSize.cx, m_csBitmapSize.cy);
pclStaticWnd->SetWindowText(csSizeText);
//Displays it
CStatic *pclStatic = (CStatic *)GetDlgItem(IDC_PICTURES);
pclStatic->SetBitmap(m_hBitmap);
}
}
}
//**************************************************************************
BOOL EdActors_ModelCreationDialog::m_fn_bGetBitmapSize(CString csFileName, CSize *sz)
{
FILE *hFile;
BITMAPFILEHEADER bf;
BITMAPINFOHEADER bi;
if ( (hFile = fopen( csFileName, "rb")) == NULL)
return FALSE;
if (sizeof(bf) == fread( &bf, 1, sizeof(bf), hFile ))
{
if (bf.bfType == 0x4d42 /*BM*/)
{
if ( sizeof(bi) == fread( &bi, 1, sizeof(bi), hFile) )
{
sz->cx = bi.biWidth;
sz->cy = bi.biHeight;
fclose(hFile);
return TRUE;
}
}
}
fclose(hFile);
return FALSE;
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if ( nIDCtl == IDC_LIST_FAMILIES )
{
ERROR_ASSERT( lpDrawItemStruct->CtlType == ODT_LISTBOX );
CDC *pclDC;
pclDC = pclDC->FromHandle(lpDrawItemStruct->hDC);
CRect crRect(lpDrawItemStruct->rcItem);
CFont *pclFont = GetFont();
pclDC->SelectObject(pclFont);
struct m_stFamilyDescription *p_stDescriptor = (struct m_stFamilyDescription *)lpDrawItemStruct->itemData;
CPA_Family *pclFamily = p_stDescriptor->pclFamily;
COLORREF colRef;
COLORREF colRefForBackground;
if ( (lpDrawItemStruct->itemState & ODS_SELECTED) != 0 )
{
colRef = pclFamily->fn_bIsAvailable() ? EdActors_C_INVERSE_COLOR_FOR_LOADED_FAMILIES
: EdActors_C_INVERSE_COLOR_FOR_UNLOADED_FAMILIES;
colRefForBackground = pclFamily->fn_bIsAvailable() ? EdActors_C_COLOR_FOR_SELECTED_LOADED_FAMILIES
: EdActors_C_COLOR_FOR_SELECTED_UNLOADED_FAMILIES;
}
else
{
colRef = pclFamily->fn_bIsAvailable() ? EdActors_C_COLOR_FOR_LOADED_FAMILIES
: EdActors_C_COLOR_FOR_UNLOADED_FAMILIES;
colRefForBackground = m_colrefBackGroundColor;
}
pclDC->SetTextColor(colRef);
pclDC->SetBkMode(TRANSPARENT);
pclDC->FillSolidRect(&(lpDrawItemStruct->rcItem), colRefForBackground);
CString csCurrentText = p_stDescriptor->bIsAGenDoorFamily ? EdActors_C_szGenDoorsDescriptor : EdActors_C_szNormalDescriptor;
csCurrentText += pclFamily->GetName();
pclDC->TextOut(crRect.left + 1, crRect.top + 1, csCurrentText);
}
}
//**************************************************************************
void EdActors_ModelCreationDialog::OnCheckGenDoor()
{
UpdateData(TRUE);
if ( m_bIsAGenDoor )
m_fn_vFillListBoxWithBitmapNames(&m_clListOfBitmapsForGenDoors);
else
m_fn_vFillListBoxWithBitmapNames(&m_clListOfBitmapsForActors);
}
//**************************************************************************
void EdActors_ModelCreationDialog::m_fn_vFillListBoxWithBitmapNames(CPA_List<struct m_stBitmapDescription> *_pclListOfBitmaps)
{
BOOL bMustSwap = FALSE;
//Gets current list type
CButton *pclGenDoorButton = (CButton *)GetDlgItem(IDC_CHECK_GEN_DOOR);
if ( pclGenDoorButton->GetCheck() )
{
//Must swap modes
if ( !m_bIsAGenDoor )
bMustSwap = TRUE;
}
else
{
//Must swap modes
if ( m_bIsAGenDoor )
bMustSwap = TRUE;
}
if ( bMustSwap )
{
pclGenDoorButton->SetCheck( !pclGenDoorButton->GetCheck() );
CListBox *pclLB = (CListBox *)GetDlgItem(IDC_LIST_BITMAPS);
pclLB->ResetContent();
short wIndex;
struct m_stBitmapDescription *pstCurrentBDesc;
POSITION pos = _pclListOfBitmaps->GetHeadPosition();
while (pos != NULL )
{
pstCurrentBDesc = _pclListOfBitmaps->GetNext(pos);
wIndex = pclLB->AddString(pstCurrentBDesc->csFileName);
pclLB->SetItemDataPtr(wIndex, (void *)pstCurrentBDesc);
}
//Selects first bitmap
if ( pclLB->GetCount() > 0 )
{
pclLB->SetCurSel(0);
OnSelchangeListBitmaps();
}
}
}
//**************************************************************************
BOOL EdActors_ModelCreationDialog::m_pri_fn_bIsAGenDoorFamily(CPA_Family *_pclFamily)
{
BOOL bReturn = FALSE;
//Gets the Family Subfolder
CString csFolderName = _pclFamily->GetCompleteSectionName();
short wIndex = csFolderName.ReverseFind('\\');
if ( wIndex != -1 )
csFolderName = csFolderName.Left(++wIndex);
//Looks in Family subfolder for the CHL or TBL file
HANDLE hFileHandle;
WIN32_FIND_DATA FindData;
// check if CHL exists
CString csFileName = csFolderName + "*.chl";
hFileHandle = FindFirstFile(LPCTSTR(csFileName), &FindData);
bReturn = (hFileHandle == INVALID_HANDLE_VALUE);
FindClose(hFileHandle);
if (!bReturn)
return FALSE;
// checks if TBL exist
csFileName = csFolderName + "*.tbl";
hFileHandle = FindFirstFile(LPCTSTR(csFileName), &FindData);
bReturn = ( hFileHandle == INVALID_HANDLE_VALUE );
FindClose(hFileHandle);
if (!bReturn)
return FALSE;
// Look in Specific directories
char szVersion[255];
FILE *hIni;
// get info from ini file
hIni = fopen("version.ini", "rt");
if(hIni == NULL)
hIni = fopen("x:\\cpa\\exe\\main\\version.ini", "rt");
if(hIni)
{
fgets(szVersion, 49, hIni);
while(!isalnum(szVersion[strlen(szVersion) - 1]))
szVersion[strlen(szVersion) - 1] = '\0';
fclose(hIni);
}
// if no specific version, no more search
else
return bReturn;
char szVersion1[255];
char szVersion2[255];
char *szCut;
int iNumVersion, iNbVersions = 1;
strcpy(szVersion1, szVersion);
szCut = strchr(szVersion1, ',');
if (szCut)
{
strcpy(szVersion2, szCut+1 );
strcpy(szCut, "\0");
iNbVersions = 2;
}
for (iNumVersion = 0; iNumVersion < iNbVersions; iNumVersion++)
{
// build specific path
wIndex = csFolderName.Find('\\');
if (wIndex != -1)
csFolderName = (iNumVersion ? szVersion2 : szVersion1) + csFolderName.Mid(wIndex);
// check if CHL exists
csFileName = csFolderName + "*.chl";
hFileHandle = FindFirstFile(LPCTSTR(csFileName), &FindData);
bReturn = (hFileHandle == INVALID_HANDLE_VALUE);
FindClose(hFileHandle);
if (!bReturn)
return FALSE;
// checks if TBL exist
csFileName = csFolderName + "*.tbl";
hFileHandle = FindFirstFile(LPCTSTR(csFileName), &FindData);
bReturn = (hFileHandle == INVALID_HANDLE_VALUE);
FindClose(hFileHandle);
if (!bReturn)
return FALSE;
}
return bReturn;
}

View File

@@ -0,0 +1,287 @@
// CPACDgMI.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "ACP_Base.h"
#include "ITF.h"
/*
#include "TAc.h"
#include "TFa.h"
#include "IncMEC.h"
#define D_State_Define
#include "IncGAM.h"
#undef D_State_Define
#include "GLI.h"
*/
#include "EDACDgMi.hpp"
/*
#include "EDACDgIf.hpp"
#include "EDACDgMg.hpp"
#include "EDACModl.hpp"
#include "EDACStrg.hpp"
#include "EDACGlob.hpp"
*/
#include "_Ainterf.hpp"
#include "EdAcDoc.hpp"
//External Modules
#include "ErO.h"
#include "IncTUT.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
/*
#define EdActors_C_COLOR_FOR_LOADED_FAMILIES (RGB(255,0,0))
#define EdActors_C_INVERSE_COLOR_FOR_LOADED_FAMILIES (RGB(255,150,150))
#define EdActors_C_COLOR_FOR_SELECTED_LOADED_FAMILIES (RGB(150,100,100))
#define EdActors_C_COLOR_FOR_UNLOADED_FAMILIES (RGB(96,96,96))
#define EdActors_C_INVERSE_COLOR_FOR_UNLOADED_FAMILIES (RGB(255,255,255))
#define EdActors_C_COLOR_FOR_SELECTED_UNLOADED_FAMILIES (RGB(96,96,255))
#define EdActors_C_szGenDoorsDescriptor "[GenDoor] "
#define EdActors_C_szNormalDescriptor "[Normal] "
*/
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_ModelIconDialog dialog
BEGIN_MESSAGE_MAP(EdActors_ModelIconDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_ModelIconDialog)
ON_LBN_SELCHANGE(IDC_BITMAP_LIST, OnSelchangeListBitmaps)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//**************************************************************************
EdActors_ModelIconDialog::EdActors_ModelIconDialog(CWnd* pParent, CPA_SuperObject *pModel)
: CDialog(EdActors_ModelIconDialog::IDD, &g_oBaseFrame)
{
hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
//{{AFX_DATA_INIT(EdActors_ModelIconDialog)
//}}AFX_DATA_INIT
m_pModel = pModel;
m_csBitmapName = "";
}
//**************************************************************************
EdActors_ModelIconDialog::~EdActors_ModelIconDialog()
{
// deletes all bitmap descriptions
POSITION pos = m_clListOfBitmapsForActors.GetHeadPosition();
while ( pos != NULL )
delete (m_clListOfBitmapsForActors.GetNext(pos));
AfxSetResourceHandle(hOldInstance);
}
//**************************************************************************
void EdActors_ModelIconDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_ModelIconDialog)
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_ModelIconDialog message handlers
//**************************************************************************
BOOL EdActors_ModelIconDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// get the list of all bitmaps
struct m_stBitmapDescription *p_stBMDesc;
WIN32_FIND_DATA FindData;
CString csBitmapsNames;
CString csFileName;
HANDLE hFileHandle;
// get parameters
CPA_Actor *pclEdtModel = (CPA_Actor *)m_pModel->GetObject();
if (pclEdtModel->m_fn_bIsAGenDoor())
csBitmapsNames = g_pclInterface->m_clDocument.m_csModelsBitmapsCompletePathForGenDoors + "*.bmp";
else
csBitmapsNames = g_pclInterface->m_clDocument.m_csModelsBitmapsCompletePath + "*.bmp";
hFileHandle = FindFirstFile(LPCTSTR(csBitmapsNames), &FindData);
if (hFileHandle != INVALID_HANDLE_VALUE)
{
do
{
csFileName = FindData.cFileName;
//Adds to internal list
p_stBMDesc = new struct m_stBitmapDescription;
p_stBMDesc->csFileName = csFileName;
p_stBMDesc->hBitmap = NULL;
p_stBMDesc->bLoaded = FALSE;
m_clListOfBitmapsForActors.AddTail(p_stBMDesc);
}
while (FindNextFile(hFileHandle, &FindData));
}
FindClose(hFileHandle);
m_fn_vFillListBoxWithBitmapNames(&m_clListOfBitmapsForActors);
return TRUE;
}
//**************************************************************************
void EdActors_ModelIconDialog::OnDestroy()
{
CDialog::OnDestroy();
}
//**************************************************************************
void EdActors_ModelIconDialog::OnOK()
{
// get selection
CListBox *pclLB = (CListBox *)GetDlgItem(IDC_BITMAP_LIST);
if (pclLB->GetCurSel() != -1)
{
char szBitmap[256];
pclLB->GetText(pclLB->GetCurSel(), szBitmap);
m_csBitmapName = szBitmap;
}
CDialog::OnOK();
}
//**************************************************************************
CString EdActors_ModelIconDialog::m_fn_csGetBitmapName()
{
return m_csBitmapName;
}
//**************************************************************************
void EdActors_ModelIconDialog::m_fn_vFillListBoxWithBitmapNames(CPA_List<struct m_stBitmapDescription> *_pclListOfBitmaps)
{
struct m_stBitmapDescription *pstCurrentBDesc;
CListBox *pclLB;
POSITION pos;
short wIndex;
// reset list box
pclLB = (CListBox *)GetDlgItem(IDC_BITMAP_LIST);
pclLB->ResetContent();
// fill list with bitmaps
pos = _pclListOfBitmaps->GetHeadPosition();
while (pos)
{
pstCurrentBDesc = _pclListOfBitmaps->GetNext(pos);
wIndex = pclLB->AddString(pstCurrentBDesc->csFileName);
pclLB->SetItemDataPtr(wIndex, (void *)pstCurrentBDesc);
}
//Selects first bitmap
if (pclLB->GetCount() > 0)
{
pclLB->SetCurSel(0);
OnSelchangeListBitmaps();
}
}
//**************************************************************************
void EdActors_ModelIconDialog::OnSelchangeListBitmaps()
{
CListBox *pclLB = (CListBox *)GetDlgItem(IDC_BITMAP_LIST);
short wIndex = pclLB->GetCurSel();
if ( wIndex != LB_ERR )
{
pclLB->GetText(wIndex, m_csBitmapName);
CWnd *pclWnd = GetDlgItem(IDC_SHOW_BITMAP);
CRect crPictureRect;
pclWnd->GetWindowRect(crPictureRect);
struct m_stBitmapDescription *p_stBMDesc;
p_stBMDesc = (struct m_stBitmapDescription *)pclLB->GetItemDataPtr(wIndex);
if (!p_stBMDesc->bLoaded)
{
CString csBitmapNameAndPath;
CPA_Actor *pclEdtModel = (CPA_Actor *)m_pModel->GetObject();
if (pclEdtModel->m_fn_bIsAGenDoor())
csBitmapNameAndPath = g_pclInterface->m_clDocument.m_csModelsBitmapsCompletePathForGenDoors + m_csBitmapName;
else
csBitmapNameAndPath = g_pclInterface->m_clDocument.m_csModelsBitmapsCompletePath + m_csBitmapName;
//Gets size
m_fn_bGetBitmapSize(csBitmapNameAndPath, &p_stBMDesc->csSize);
int xSize, ySize;
double dfRatio;
if ( p_stBMDesc->csSize.cx > p_stBMDesc->csSize.cy )
{
xSize = crPictureRect.Width();
dfRatio = (double)crPictureRect.Width() / (double)p_stBMDesc->csSize.cx;
ySize = (int)(p_stBMDesc->csSize.cy * dfRatio);
}
else
{
ySize = crPictureRect.Height();
dfRatio = (double)crPictureRect.Height() / (double)p_stBMDesc->csSize.cy;
xSize = (int)(p_stBMDesc->csSize.cx * dfRatio);
}
//Loads Bitmap
p_stBMDesc->hBitmap = (HBITMAP)LoadImage(NULL, csBitmapNameAndPath, IMAGE_BITMAP, xSize, ySize, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
p_stBMDesc->bLoaded = TRUE;
}
// Displays bitmap
CStatic *pclStatic = (CStatic *)GetDlgItem(IDC_SHOW_BITMAP);
pclStatic->SetBitmap(p_stBMDesc->hBitmap);
}
}
//**************************************************************************
BOOL EdActors_ModelIconDialog::m_fn_bGetBitmapSize(CString csFileName, CSize *sz)
{
FILE *hFile;
BITMAPFILEHEADER bf;
BITMAPINFOHEADER bi;
if ( (hFile = fopen( csFileName, "rb")) == NULL)
return FALSE;
if (sizeof(bf) == fread( &bf, 1, sizeof(bf), hFile ))
{
if (bf.bfType == 0x4d42 /*BM*/)
{
if ( sizeof(bi) == fread( &bi, 1, sizeof(bi), hFile) )
{
sz->cx = bi.biWidth;
sz->cy = bi.biHeight;
fclose(hFile);
return TRUE;
}
}
}
fclose(hFile);
return FALSE;
}

View File

@@ -0,0 +1,276 @@
// EDACDgML.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDgML.hpp"
#include "_AInterf.hpp"
#include "EDACStrg.hpp"
#include "EDACGlob.hpp"
//External modules
#include "TFa.h"
#include "Dpt.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
#define EDAC_C_TreeIconSize 16
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_Dialog_LoadModels dialog
BEGIN_MESSAGE_MAP(EdActors_Dialog_LoadModels, CDialog)
//{{AFX_MSG_MAP(EdActors_Dialog_LoadModels)
ON_BN_CLICKED(IDC_RADIO_LOAD_ALL_MODELS, OnRadioLoadAllModels)
ON_BN_CLICKED(IDC_RADIO_LOAD_SELECT_MODELS, OnRadioLoadSelectModels)
ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_MODELS, OnSelchangedTreeModels)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
EdActors_Dialog_LoadModels::EdActors_Dialog_LoadModels(CWnd* pParent /*=NULL*/)
: CDialog(EdActors_Dialog_LoadModels::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(EdActors_Dialog_LoadModels)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
//***************************************************************************
void EdActors_Dialog_LoadModels::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_Dialog_LoadModels)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_Dialog_LoadModels message handlers
//***************************************************************************
BOOL EdActors_Dialog_LoadModels::OnInitDialog()
{
CDialog::OnInitDialog();
AfxGetApp()->DoWaitCursor(1);
//Prepares Icons for tree
m_pri_clImageListForTree.Create(EDAC_C_TreeIconSize, EDAC_C_TreeIconSize, ILC_MASK, 0, 3);
m_pri_iIndexInImageListForFamilies = m_pri_clImageListForTree.Add( LoadIcon(g_pclInterface->GetDLLIdentity()->hModule, MAKEINTRESOURCE(IDI_CAR_TREE_FAMILIES)) );
m_pri_iIndexInImageListForModels = m_pri_clImageListForTree.Add( LoadIcon(g_pclInterface->GetDLLIdentity()->hModule, MAKEINTRESOURCE(IDI_CAR_TREE_MODELS)) );
m_pri_iIndexInImageListForUnloadedFamilies = m_pri_clImageListForTree.Add( LoadIcon(g_pclInterface->GetDLLIdentity()->hModule, MAKEINTRESOURCE(IDI_CAR_TREE_FAMILIES_UNSELECTED)) );
m_pri_iIndexInImageListForUnloadedModels = m_pri_clImageListForTree.Add( LoadIcon(g_pclInterface->GetDLLIdentity()->hModule, MAKEINTRESOURCE(IDI_CAR_TREE_MODELS_UNSELECTED)) );
CTreeCtrl *pclTreeCtrl = (CTreeCtrl *)GetDlgItem(IDC_TREE_MODELS);
pclTreeCtrl->SetImageList(&m_pri_clImageListForTree, TVSIL_NORMAL);
//Fills Tree
m_pri_fn_vScanDirectoryForUnloadedModels(fn_szGetFamiliesDataPath());
((CButton *)GetDlgItem(IDC_RADIO_LOAD_SELECT_MODELS))->SetCheck(TRUE);
((CButton *)GetDlgItem(IDC_RADIO_LOAD_ALL_MODELS))->SetCheck(TRUE);
OnRadioLoadAllModels();
AfxGetApp()->DoWaitCursor(-1);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void EdActors_Dialog_LoadModels::OnRadioLoadAllModels()
{
GetDlgItem(IDC_TREE_MODELS)->EnableWindow(FALSE);
}
//***************************************************************************
void EdActors_Dialog_LoadModels::OnRadioLoadSelectModels()
{
GetDlgItem(IDC_TREE_MODELS)->EnableWindow(TRUE);
}
//***************************************************************************
void EdActors_Dialog_LoadModels::OnOK()
{
CDialog::OnOK();
}
//***************************************************************************
void EdActors_Dialog_LoadModels::OnSelchangedTreeModels(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
CTreeCtrl *pclTreeCtrl = (CTreeCtrl *)GetDlgItem(IDC_TREE_MODELS);
if ( pclTreeCtrl->GetParentItem(pNMTreeView->itemNew.hItem) == NULL )
{
//It's a Family
pclTreeCtrl->SetItemImage(pNMTreeView->itemNew.hItem, m_pri_iIndexInImageListForFamilies, m_pri_iIndexInImageListForFamilies);
}
else
{
//It's a Model
pclTreeCtrl->SetItemImage(pNMTreeView->itemNew.hItem, m_pri_iIndexInImageListForModels, m_pri_iIndexInImageListForModels);
}
*pResult = 0;
}
//***************************************************************************
// Copyright Xavier Billault !!
void EdActors_Dialog_LoadModels::m_pri_fn_vScanDirectoryForUnloadedModels(CString csDirectory)
{
HANDLE h;
WIN32_FIND_DATA hData;
CString csName;
CString csModelName;
CString csFamilyName;
short wIndex;
CTreeCtrl *pclTreeCtrl = (CTreeCtrl *)GetDlgItem(IDC_TREE_MODELS);
ERROR_ASSERT( pclTreeCtrl != NULL );
h = FindFirstFile(csDirectory + "\\*", &hData);
if( h != INVALID_HANDLE_VALUE )
{
do
{
if( ( CString(hData.cFileName) != "." )
&& ( CString(hData.cFileName) != ".." )
)
{
if( hData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
m_pri_fn_vScanDirectoryForUnloadedModels(csDirectory + "\\" + hData.cFileName);
else
{
CFile cfSrcFile;
CString csSrcFile = csDirectory + "\\" + hData.cFileName;
//Looks if extension is a Model's one
if ( g_csModelExtension.CompareNoCase(csSrcFile.Right(g_csModelExtension.GetLength())) == 0 )
{
//Extracts Model' Name
wIndex = csSrcFile.ReverseFind('\\');
if ( wIndex != -1 )
{
csName = csSrcFile.Left(wIndex);
wIndex = csName.ReverseFind('\\');
csModelName = csName.Right(csName.GetLength() - wIndex - 1);
}
else
csModelName = "< Unknown >";
//Extracts Model' Family Name
wIndex = csSrcFile.ReverseFind('\\');
if ( wIndex != -1 )
{
csName = csSrcFile.Left(wIndex);
wIndex = csName.ReverseFind('\\');
if ( wIndex != -1 )
{
csName = csName.Left(wIndex);
wIndex = csName.ReverseFind('\\');
csFamilyName = csName.Right(csName.GetLength() - wIndex - 1);
}
else
csFamilyName = "< Unknown >";
}
else
csFamilyName = "< Unknown >";
//Looks if this Model is loaded
BOOL bModelFound = FALSE;
CPA_Actor *pclActor;
Position ModelPos = g_pclInterface->m_clDocument.m_clModelsList.GetHeadPosition();
while ( (ModelPos != 0) && (!bModelFound) )
{
pclActor = (CPA_Actor *)g_pclInterface->m_clDocument.m_clModelsList.GetNext(ModelPos);
//Compares Models names AND Families names
if ( pclActor->m_pub_fn_pclGetFamily() != NULL )
bModelFound = ( ( pclActor->GetName().CompareNoCase(csModelName) == 0 )
&& ( pclActor->m_pub_fn_pclGetFamily()->GetName().CompareNoCase(csFamilyName) == 0 )
);
}
if ( !bModelFound )
{
//Looks in the Tree if Family node exists
BOOL bFamilyFoundInTree = FALSE;
HTREEITEM hCurrentItemForFamily = pclTreeCtrl->GetNextItem(NULL, TVGN_ROOT);
while ( (hCurrentItemForFamily != NULL) && (!bFamilyFoundInTree) )
{
bFamilyFoundInTree = ( csFamilyName.Compare(pclTreeCtrl->GetItemText(hCurrentItemForFamily)) == 0 );
if ( !bFamilyFoundInTree )
hCurrentItemForFamily = pclTreeCtrl->GetNextItem(hCurrentItemForFamily, TVGN_NEXT);
}
if ( !bFamilyFoundInTree )
{
hCurrentItemForFamily = pclTreeCtrl->InsertItem(csFamilyName, TVI_ROOT, TVI_SORT);
pclTreeCtrl->SetItemImage(hCurrentItemForFamily, m_pri_iIndexInImageListForUnloadedFamilies, m_pri_iIndexInImageListForUnloadedFamilies);
}
//Adds in Tree
HTREEITEM hAddedItemForModel = pclTreeCtrl->InsertItem(csModelName, hCurrentItemForFamily, TVI_SORT);
pclTreeCtrl->SetItemImage(hAddedItemForModel, m_pri_iIndexInImageListForUnloadedModels, m_pri_iIndexInImageListForUnloadedModels);
/* //Displays a message (in status bar)
CString csMessage = "Actors Editor prepares the Model '" + csModelName + "' for load";
EDACTORS_fn_vGiveProgressInfo(csMessage, -1);
BOOL bIsLoadingWorld = g_pclInterface->GetInterface()->fn_bIsLoadingWorld();
g_pclInterface->GetInterface()->SetLoadingWorld(TRUE);
//Gets the Editor Family
CPA_Family *pclBaseFamily = (CPA_Family *)g_pclInterface->GetMainWorld()->fn_p_oFindObject(csFamilyName, C_szFamilyTypeName);
//Constructs the new CPA_Actor
CPA_Actor *pclNewModel = new CPA_Actor( NULL,
NULL,
g_c_csActorModelType,
NULL,
pclBaseFamily, //Family
NULL,
csModelName,
FALSE
);
pclNewModel->SetAvailable(FALSE);
pclNewModel->m_fn_vSetFamilyName(csFamilyName);
g_pclInterface->m_clDocument.m_clModelsList.fn_bAddObject(pclNewModel);
g_pclInterface->GetInterface()->SetLoadingWorld(bIsLoadingWorld);
*/ }
}
}
}
} while ( FindNextFile(h,&hData) );
FindClose(h);
}
}

View File

@@ -0,0 +1,97 @@
// CPACMNDg.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDgMN.hpp"
#include "EDACGlob.hpp"
#include "_AInterf.hpp"
//External Modules
#include "IncTUT.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_ActorNameChangeDialog dialog
BEGIN_MESSAGE_MAP(EdActors_ActorNameChangeDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_ActorNameChangeDialog)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//****************************************************************************
EdActors_ActorNameChangeDialog::EdActors_ActorNameChangeDialog( CString csProposedName,
CWnd* pParent /*=NULL*/)
: CDialog(EdActors_ActorNameChangeDialog::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(EdActors_ActorNameChangeDialog)
m_csNewName = csProposedName;
//}}AFX_DATA_INIT
}
//****************************************************************************
void EdActors_ActorNameChangeDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_ActorNameChangeDialog)
DDX_Text(pDX, IDC_EDIT_FOR_NAME, m_csNewName);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_ActorNameChangeDialog message handlers
//****************************************************************************
BOOL EdActors_ActorNameChangeDialog::OnInitDialog()
{
CDialog::OnInitDialog();
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControlID(IDC_EDIT_FOR_NAME, "OAc_ActorNameChangeDialog_NameEdit", TUT_e_TextEdit);
TUT_M_vRegisterControlID(IDOK, "OAc_UndoRedoDialog_OKButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDCANCEL, "OAc_UndoRedoDialog_CancelButton", TUT_e_Button);
//End of Registers for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//****************************************************************************
void EdActors_ActorNameChangeDialog::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControlID(IDC_EDIT_FOR_NAME);
TUT_M_vUnregisterControlID(IDOK);
TUT_M_vUnregisterControlID(IDCANCEL);
//End of UnRegisters for TUT Module
//////////////
CDialog::OnDestroy();
}
//****************************************************************************
void EdActors_ActorNameChangeDialog::OnOK()
{
UpdateData(TRUE);
//Checks validity for the new Name
fn_vCheckAndChangeName(m_csNewName);
EndDialog(IDOK);
}

View File

@@ -0,0 +1,144 @@
// EDACDgMg.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDgMg.hpp"
#include "_AInterf.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define C_EDAC_MESSAGE_TIMER_ID 70
#define C_EDAC_MESSAGE_TIMER_DELAY 200
/////////////////////////////////////////////////////////////////////////////
// EdActors_Dialog_Message dialog
BEGIN_MESSAGE_MAP(EdActors_Dialog_Message, CDialog)
//{{AFX_MSG_MAP(EdActors_Dialog_Message)
ON_WM_TIMER()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
EdActors_Dialog_Message::EdActors_Dialog_Message(CString _csMessage,
CWnd* pParent /*=NULL*/)
: CDialog(EdActors_Dialog_Message::IDD, &g_oBaseFrame)
{
hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
//{{AFX_DATA_INIT(EdActors_Dialog_Message)
//}}AFX_DATA_INIT
m_csMessage = _csMessage;
}
//***************************************************************************
EdActors_Dialog_Message::~EdActors_Dialog_Message()
{
AfxSetResourceHandle(hOldInstance);
}
//***************************************************************************
void EdActors_Dialog_Message::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_Dialog_Message)
DDX_Text(pDX, IDC_STATIC_TEXT_OF_MESSAGE, m_csMessage);
//}}AFX_DATA_MAP
}
//***************************************************************************
BOOL EdActors_Dialog_Message::OnInitDialog()
{
CDialog::OnInitDialog();
//Computes Message size
CStatic *pclStatic = (CStatic *)GetDlgItem(IDC_STATIC_TEXT_OF_MESSAGE);
CClientDC dc(pclStatic);
CSize csMessageSize = dc.GetTextExtent(m_csMessage);
//Computes the max number of 'Spaces' to be inserted
CSize csSpaceSize = dc.GetTextExtent(" ", 1);
CRect crStaticRect;
pclStatic->GetClientRect(crStaticRect);
m_pri_uwMaxNumberOfSpaces = (unsigned short)(( crStaticRect.Width() - csMessageSize.cx ) / csSpaceSize.cx);
m_pri_uwCurrentNumberOfSpaces = 0;
m_pri_cDelta = 1;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_Dialog_Message message handlers
//***************************************************************************
BOOL EdActors_Dialog_Message::m_pub_fn_bCreate()
{
BOOL bCreationOK = Create(EdActors_Dialog_Message::IDD, NULL);
// if ( bCreationOK )
// SetTimer(C_EDAC_MESSAGE_TIMER_ID, C_EDAC_MESSAGE_TIMER_DELAY, NULL);
return bCreationOK;
}
//***************************************************************************
void EdActors_Dialog_Message::m_pub_fn_vDestroy()
{
// KillTimer(C_EDAC_MESSAGE_TIMER_ID);
}
//***************************************************************************
void EdActors_Dialog_Message::OnTimer(UINT nIDEvent)
{
if ( nIDEvent == C_EDAC_MESSAGE_TIMER_ID )
{
if ( m_pri_cDelta == 1 )
{
if ( m_pri_uwCurrentNumberOfSpaces < m_pri_uwMaxNumberOfSpaces )
{
m_csMessage = " " + m_csMessage;
m_pri_uwCurrentNumberOfSpaces += 1;
}
else
m_pri_cDelta = -1;
}
else
{
if ( m_pri_uwCurrentNumberOfSpaces > 0 )
{
m_csMessage = m_csMessage.Right(m_csMessage.GetLength() - 1);
m_pri_uwCurrentNumberOfSpaces -= 1;
}
else
m_pri_cDelta = 1;
}
}
//Displays Text
CStatic *pclStatic = (CStatic *)GetDlgItem(IDC_STATIC_TEXT_OF_MESSAGE);
pclStatic->SetWindowText(m_csMessage);
CDialog::OnTimer(nIDEvent);
}
//***************************************************************************
void EdActors_Dialog_Message::OnDestroy()
{
CDialog::OnDestroy();
m_pub_fn_vDestroy();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,316 @@
// cpacdgol.cpp : implementation file
//
#include "stdafx.h"
#include "EDAcIRes.h"
#include "EDACdgol.hpp"
#include "cpa_nll.hpp"
#include "EDACstrg.hpp"
#include "EDACinst.hpp"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_EditObjectListsDialog dialog
EdActors_EditObjectListsDialog::EdActors_EditObjectListsDialog(tdstCarEditObjectListsDialogArgs *p_stArgs, CWnd* pParent /*=NULL*/)
: CDialog(EdActors_EditObjectListsDialog::IDD, &g_oBaseFrame)
{
m_p_stArgs = p_stArgs;
//{{AFX_DATA_INIT(EdActors_EditObjectListsDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
//bbb 25/03/97 {
// create font
PLOGFONT plf = (PLOGFONT) LocalAlloc(LPTR, sizeof(LOGFONT));
lstrcpy(plf->lfFaceName, "Times New Roman");
plf->lfWeight = FW_BOLD ;
plf->lfHeight = 36;
plf->lfEscapement = 0;
m_oBoldFont.CreateFontIndirect(plf);
//bbb 25/03/97 }
}
//bbb 25/03/97 {
EdActors_EditObjectListsDialog::~EdActors_EditObjectListsDialog()
{
m_oBoldFont.DeleteObject();
}
//bbb 25/03/97 }
void EdActors_EditObjectListsDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_EditObjectListsDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(EdActors_EditObjectListsDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_EditObjectListsDialog)
ON_BN_CLICKED(IDC_BUTTON_OLC_DEFAULT, OnOlcSetDefaultButtonClicked)
ON_BN_CLICKED(IDC_BUTTON_OLC_RENAME, OnOlcRenameButtonClicked)
ON_CBN_SELCHANGE(IDC_COMBO_OLC_OBJLISTS, OnOlcObjListsComboSelChange)
ON_EN_CHANGE(IDC_EDIT_OLC_NAME, OnOlcEditNameChange)
ON_WM_DRAWITEM()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// EdActors_EditObjectListsDialog message handlers
void EdActors_EditObjectListsDialog::OnOlcSetDefaultButtonClicked()
{
// set the default value
m_p_stArgs->stOut.p_oDefaultSelectedObjectList = m_p_stArgs->stOut.p_oLastSelectedObjectList;
//tell the list that the actor's model uses this list as default
m_p_stArgs->stOut.p_oDefaultSelectedObjectList->fn_bMakeActorUseThisList(
(EdActors_EditorActorInstance *) m_p_stArgs->stIn.p_oEditorActor
->m_fn_pclGetModel()->m_fn_pclGetEditorActor()
);
// and disable the button since the values are equal
m_p_oListSetDefaultButton->EnableWindow(FALSE);
}
void EdActors_EditObjectListsDialog::OnOlcRenameButtonClicked()
{
//normally the "change name" button is pressed only when relevant.
CString oNewListName;
//which entry is seleted ?
short wIndex = m_p_oListNameCombo->GetCurSel();
// get the data pointer (pointer on the EdtList reachable object)
EdtList *p_oDataPtr = (EdtList *) m_p_oListNameCombo->GetItemDataPtr(wIndex);
//read the new name in the edit
m_p_oListNameEdit->GetWindowText(oNewListName);
//tell the object that its name changed.
if ( p_oDataPtr->fn_eRename(M_MAKECHAR(oNewListName)) == E_mc_None )
{ // if the object was successfully renamed
// change the text in the item of the combo too
m_p_oListNameCombo->DeleteString(wIndex);
m_p_oListNameCombo->InsertString(wIndex, M_MAKECHAR(oNewListName));
m_p_oListNameCombo->SetItemDataPtr(wIndex, (void *) p_oDataPtr);
m_p_oListNameCombo->SetCurSel(wIndex);
//since the combo and edit display the same text, "rename" is disabled
m_p_oListRenameButton->EnableWindow(FALSE);
//but the "set default" button may be enabled if the entry is not already the default one
m_p_oListSetDefaultButton->EnableWindow(
m_p_stArgs->stOut.p_oLastSelectedObjectList != m_p_stArgs->stOut.p_oDefaultSelectedObjectList
);
}
}
void EdActors_EditObjectListsDialog::OnOlcObjListsComboSelChange()
{
// TODO: Add your control notification handler code here
short wIndex = m_p_oListNameCombo->GetCurSel();
if ( wIndex == CB_ERR )
{
//no list is selected for the actor
m_p_stArgs->stOut.p_oLastSelectedObjectList = NULL;
//disable all controls in the dialog
m_p_oListNameEdit->EnableWindow(FALSE);
m_p_oListNameEdit->SetWindowText("");
m_p_oListRenameButton->EnableWindow(FALSE);
m_p_oListSetDefaultButton->EnableWindow(FALSE);
}
else
{
//this list is selected for the actor
m_p_stArgs->stOut.p_oLastSelectedObjectList = (class EdtList *) m_p_oListNameCombo->GetItemDataPtr(wIndex);
//put the name in the edit
CString oSelectedName;
m_p_oListNameCombo->GetLBText(wIndex, oSelectedName);
m_p_oListNameEdit->SetWindowText(oSelectedName);
// since the names are equal, the "rename" button is disabled
m_p_oListRenameButton->EnableWindow(FALSE);
// the "default" button is enabled only if selected list is not already marked as default
m_p_oListSetDefaultButton->EnableWindow(
m_p_stArgs->stOut.p_oLastSelectedObjectList != m_p_stArgs->stOut.p_oDefaultSelectedObjectList
);
}
}
void EdActors_EditObjectListsDialog::OnOlcEditNameChange()
{
CString oNewNameString;
m_p_oListNameEdit->GetWindowText(oNewNameString);
//disable the "rename" and "set default" button if the text is empty
if ( oNewNameString.IsEmpty() )
{
m_p_oListRenameButton->EnableWindow(FALSE);
m_p_oListSetDefaultButton->EnableWindow(FALSE);
}
else // there is text in the edit
{
short wNbLists = m_p_oListNameCombo->GetCount();
if ( wNbLists > 0 ) //if the combo is not empty
{
CString oComboString;
for ( short wIndex = 0; wIndex < wNbLists; wIndex ++ )
{
// if we find a name in the combo that is the string in the edit,
// the "rename" button is disabled, but the "set default" may be enabled
// if the name is of a list that is not set as default
m_p_oListNameCombo->GetLBText(wIndex, oComboString);
if ( oComboString == oNewNameString )
{
m_p_oListRenameButton->EnableWindow(FALSE);
m_p_oListSetDefaultButton->EnableWindow(
m_p_stArgs->stOut.p_oLastSelectedObjectList != m_p_stArgs->stOut.p_oDefaultSelectedObjectList
);
return;
}
}
//here, there are items in the combo, that are different from the edit
//the names in the combo and the edit must match to enable "set default"
m_p_oListSetDefaultButton->EnableWindow(FALSE);
short wSelectedIndex = m_p_oListNameCombo->GetCurSel();
if ( wSelectedIndex != CB_ERR ) //if an item is selected in the combo
m_p_oListRenameButton->EnableWindow(TRUE);
else //no item is selected in the combo
m_p_oListRenameButton->EnableWindow(FALSE);
}
else //the combo is empty, but the edit is not: buttons are disabled
{
m_p_oListRenameButton->EnableWindow(FALSE);
m_p_oListSetDefaultButton->EnableWindow(FALSE);
}
}
}
BOOL EdActors_EditObjectListsDialog::OnInitDialog()
{
short wIndex, wOk, wInstanceIndex = 0;
short wNbObjectLists = 0; //bbb 25/03/97
CDialog::OnInitDialog();
m_p_stArgs->stOut.p_oLastSelectedObjectList = NULL;
m_p_stArgs->stOut.p_oDefaultSelectedObjectList = m_p_stArgs->stIn.p_oDefaultSelectedObjectList;
m_p_oListNameEdit = (CEdit *) GetDlgItem(IDC_EDIT_OLC_NAME);
m_p_oListNameCombo = (CComboBox *) GetDlgItem(IDC_COMBO_OLC_OBJLISTS);
m_p_oListRenameButton = (CButton *) GetDlgItem(IDC_BUTTON_OLC_RENAME);
m_p_oListSetDefaultButton = (CButton *) GetDlgItem(IDC_BUTTON_OLC_DEFAULT);
//bbb 25/03/97 {
m_p_oStaticTitle = (CStatic *) GetDlgItem(IDC_STATIC_OLC_LISTNAMES);
m_p_oButtonMessage = (CButton *) GetDlgItem(IDC_BUTTON_OLC_NOOBJECTLIST);
//bbb 25/03/97 }
//bbb 04/03/97 tout le pat<61>
//ask the name list for the list of lists of objects it handles
CPA_tdoNameList *p_oNameList =
((CPA_Editor_ObjectListData *) m_p_stArgs->stIn.p_oEditorActor
->m_fn_p_oFindDataByName(m_p_stArgs->stIn.p_c_szObjectListType))->m_p_oNameList;
CPA_List<EdtList> *p_oListOfObjectLists = NULL;
if ( p_oNameList ) //bbb 25/03/97 tout dedans
{
p_oListOfObjectLists = p_oNameList->m_pEdtListHandler->fn_oGetListOfEdtLists();
wNbObjectLists = p_oListOfObjectLists->GetCount();
}
wOk = 0;
m_p_oListNameCombo->ResetContent();
if ( p_oListOfObjectLists && wNbObjectLists ) //bbb 25/03/97 test
{
//short wNbObjectLists = p_oListOfObjectLists->GetCount(); //bbb 25/03/97
for ( 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...
{
wOk = 1;
//add its name in the combo
short wPos = m_p_oListNameCombo->AddString(p_oObjectList->GetName());
//set the pointer
m_p_oListNameCombo->SetItemDataPtr(wPos, p_oObjectList);
if ( p_oObjectList == m_p_stArgs->stIn.p_oCurrentObjectList )
wInstanceIndex = wIndex;
}
}
} //bbb 05/03/97 fin du test
//bbb 25/03/97 {
else //there is no object list
{
//hide all object-list related controls
m_p_oListNameCombo->ShowWindow(FALSE);
m_p_oListNameEdit->ShowWindow(FALSE);
m_p_oListRenameButton->ShowWindow(FALSE);
m_p_oListSetDefaultButton->ShowWindow(FALSE);
m_p_oStaticTitle->ShowWindow(FALSE);
m_p_oButtonMessage->ShowWindow(TRUE);
}
//bbb 25/03/97 }
// clear the pointer to avoid later mistakes
p_oListOfObjectLists = NULL;
if ( wOk )
{
//these controls have to be enabled/disabled
m_p_oListNameCombo->EnableWindow(TRUE);
m_p_oListNameEdit->EnableWindow(TRUE);
//we will put the object list name in the edit, hence "rename" is disabled
m_p_oListRenameButton->EnableWindow(FALSE);
//just to be sure, because it will be set properly by OnOlcObjListsComboSelChange()
m_p_oListSetDefaultButton->EnableWindow(FALSE);
//make the combo list the entry used is the instance
m_p_oListNameCombo->SetCurSel(wInstanceIndex);
OnOlcObjListsComboSelChange();
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//bbb 25/03/97 {
void EdActors_EditObjectListsDialog::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if ( nIDCtl == IDC_BUTTON_OLC_NOOBJECTLIST )
{
CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
//fill the rectangle with a solid color
pDC->FillSolidRect( &lpDrawItemStruct->rcItem, pDC->GetBkColor() );
//set the text color and font
COLORREF xTextColor = GetSysColor(COLOR_ACTIVECAPTION);
CFont *xFntPrev = pDC->SelectObject( &m_oBoldFont );
pDC->SetTextColor(xTextColor);
//draw the text
CString csButtonText = "There is no list\nto select";
pDC->DrawText(csButtonText, &lpDrawItemStruct->rcItem, DT_CENTER | DT_VCENTER );
//restore the previous font
pDC->SelectObject( xFntPrev );
}
else
CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
}
//bbb 25/03/97 }

View File

@@ -0,0 +1,84 @@
// CPACDgPI.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDgPI.hpp"
#include "_AInterf.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define C_MIN_POS 0
#define C_MAX_POS 100
/////////////////////////////////////////////////////////////////////////////
// EdActors_ProgressInfoDialog dialog
BEGIN_MESSAGE_MAP(EdActors_ProgressInfoDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_ProgressInfoDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//******************************************************************************
EdActors_ProgressInfoDialog::EdActors_ProgressInfoDialog(CString csMessage,
CWnd* pParent /*=NULL*/)
: CDialog(EdActors_ProgressInfoDialog::IDD, &g_oBaseFrame)
{
hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
//{{AFX_DATA_INIT(EdActors_ProgressInfoDialog)
m_csMessage = csMessage;
//}}AFX_DATA_INIT
//Creates Window
Create(EdActors_ProgressInfoDialog::IDD, AfxGetMainWnd());
}
//******************************************************************************
EdActors_ProgressInfoDialog::~EdActors_ProgressInfoDialog()
{
AfxSetResourceHandle(hOldInstance);
}
//******************************************************************************
void EdActors_ProgressInfoDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_ProgressInfoDialog)
DDX_Text(pDX, IDC_STATIC_MESSAGE, m_csMessage);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_ProgressInfoDialog message handlers
//******************************************************************************
BOOL EdActors_ProgressInfoDialog::OnInitDialog()
{
CDialog::OnInitDialog();
CProgressCtrl *pclProgressCtrl = (CProgressCtrl *)GetDlgItem(IDC_PROGRESS);
pclProgressCtrl->SetRange(C_MIN_POS, C_MAX_POS);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//******************************************************************************
void EdActors_ProgressInfoDialog::m_fn_vSetProgress(unsigned char ucProgessValue)
{
CProgressCtrl *pclProgressCtrl = (CProgressCtrl *)GetDlgItem(IDC_PROGRESS);
if ( ucProgessValue < C_MIN_POS )
ucProgessValue = C_MIN_POS;
else if ( ucProgessValue > C_MAX_POS )
ucProgessValue = C_MAX_POS;
pclProgressCtrl->SetPos(ucProgessValue);
}

View File

@@ -0,0 +1,180 @@
// cpacqudg.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDgQu.hpp"
#include "_Ainterf.hpp"
//External Modules
#include "IncTUT.h"
//End of External Modules
#define C_QUESTION_DIALOG_TIMER 69 //An Id for the timer
#define C_TEMPO_TIMER 60 //(ms)
#define C_NUMBER_OF_FRAMES 15
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_QuestionDialog dialog
BEGIN_MESSAGE_MAP(EdActors_QuestionDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_QuestionDialog)
ON_BN_CLICKED(IDNO, OnNo)
ON_BN_CLICKED(IDYES, OnYes)
ON_WM_TIMER()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//**************************************************************************
EdActors_QuestionDialog::EdActors_QuestionDialog(CWnd* pParent, CString csMessage)
: CDialog(EdActors_QuestionDialog::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(EdActors_QuestionDialog)
m_csMessage = csMessage;
//}}AFX_DATA_INIT
m_hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
}
//**************************************************************************
EdActors_QuestionDialog::~EdActors_QuestionDialog()
{
AfxSetResourceHandle(m_hOldInstance);
}
//***************************************************************************
void EdActors_QuestionDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_QuestionDialog)
DDX_Text(pDX, IDC_STATIC_QUESTION, m_csMessage);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_QuestionDialog message handlers
//***************************************************************************
BOOL EdActors_QuestionDialog::OnInitDialog()
{
CDialog::OnInitDialog();
//Init. timer
SetTimer(C_QUESTION_DIALOG_TIMER, C_TEMPO_TIMER, NULL);
//Loads Bitmaps
m_cbBitmap.LoadBitmap(IDB_BITMAP_QUESTION);
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControlID(IDYES, "OAc_QuestionDialog_YesButton", TUT_e_Button);
TUT_M_vRegisterControlID(IDNO, "OAc_QuestionDialog_NoButton", TUT_e_Button);
//End of Registers for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void EdActors_QuestionDialog::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControlID(IDYES);
TUT_M_vUnregisterControlID(IDNO);
//End of UnRegisters for TUT Module
//////////////
CDialog::OnDestroy();
}
//***************************************************************************
void EdActors_QuestionDialog::OnNo()
{
KillTimer(C_QUESTION_DIALOG_TIMER);
EndDialog(IDNO);
}
//***************************************************************************
void EdActors_QuestionDialog::OnYes()
{
KillTimer(C_QUESTION_DIALOG_TIMER);
EndDialog(IDYES);
}
//***************************************************************************
void EdActors_QuestionDialog::OnTimer(UINT nIDEvent)
{
/* static BOOL s_bFirstPass = TRUE;
static char s_cCurrentBitmapIndex = -1; //To begin with first bitmap
static char s_cIndexIncrement = 1;
s_cCurrentBitmapIndex += s_cIndexIncrement;
if ( ! s_bFirstPass )
{
if ( s_cCurrentBitmapIndex % (C_NUMBER_OF_FRAMES-1) == 0 )
s_cIndexIncrement = -s_cIndexIncrement;
}
else
s_bFirstPass = FALSE;
((CStatic *)GetDlgItem(IDC_STATIC_IMAGE))->SetBitmap(HBITMAP(m_a_cbBitmaps[s_cCurrentBitmapIndex]));
*/
static BOOL s_bFirstPass = TRUE;
static CRect crRect;
static char s_cCurrentIndex = -1;
static char s_cIndexIncrement = 1;
s_cCurrentIndex += s_cIndexIncrement;
if ( s_bFirstPass )
{
crRect.top = 0;
crRect.bottom = 56;
crRect.left = 0;
crRect.right = 56;
s_bFirstPass = FALSE;
}
else
{
if ( s_cCurrentIndex % (C_NUMBER_OF_FRAMES-1) == 0 )
s_cIndexIncrement = -s_cIndexIncrement;
}
//Computes Rect
crRect.left = (56 * s_cCurrentIndex)/ C_NUMBER_OF_FRAMES;
crRect.right = 56 - (56 * s_cCurrentIndex)/ C_NUMBER_OF_FRAMES;
CClientDC dc(GetDlgItem(IDC_EDIT_BIDON));
CDC memDC;
memDC.CreateCompatibleDC(&dc);
memDC.SelectObject(m_cbBitmap);
dc.StretchBlt( crRect.left,
crRect.top,
crRect.Width(),
crRect.Height(), &memDC, 0, 0, 56, 56, SRCCOPY);
CDialog::OnTimer(nIDEvent);
}

View File

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

View File

@@ -0,0 +1,341 @@
// CPACDgUL.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACDgUL.hpp"
#include "EDACActr.hpp"
#include "EDACVwAc.hpp"
#include "_AInterf.hpp"
//External Modules
#include "ErO.h"
#include "IncTUT.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_UndoRedoListDialog dialog
BEGIN_MESSAGE_MAP(EdActors_UndoRedoListDialog, CDialog)
//{{AFX_MSG_MAP(EdActors_UndoRedoListDialog)
ON_LBN_SELCHANGE(IDC_LIST_UNDO, OnSelchangeListUndo)
ON_WM_LBUTTONUP()
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
EdActors_UndoRedoListDialog::EdActors_UndoRedoListDialog( CPoint clUpAndLeftPoint,
m_eUndoRedoListType eType,
CWnd* pParent /*=NULL*/)
: CDialog(EdActors_UndoRedoListDialog::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(EdActors_UndoRedoListDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stActorEditorIdentity.hModule);
m_clUpAndLeftPoint = clUpAndLeftPoint;
m_eType = eType;
//Gets current Actor
m_pclEditorActor = g_pclInterface->m_clDocument.m_pclSelectedActor;
}
//***************************************************************************
EdActors_UndoRedoListDialog::~EdActors_UndoRedoListDialog()
{
AfxSetResourceHandle(m_hOldInstance);
}
//***************************************************************************
void EdActors_UndoRedoListDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(EdActors_UndoRedoListDialog)
DDX_Control(pDX, IDC_LIST_UNDO, m_clListBox);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_UndoRedoListDialog message handlers
//***************************************************************************
BOOL EdActors_UndoRedoListDialog::OnInitDialog()
{
CDialog::OnInitDialog();
//Moves the Window
CRect crWindowRect;
GetWindowRect(crWindowRect);
crWindowRect.OffsetRect(m_clUpAndLeftPoint.x - crWindowRect.left,
m_clUpAndLeftPoint.y - crWindowRect.top);
MoveWindow(crWindowRect);
ShowWindow(SW_SHOW);
SetCapture();
//Fills the List
CPA_List<CPA_Modif> *pclListOfModifs = &(m_pclEditorActor->m_clUndoManager.ListOfModifs);
CPA_Modif *pclModif;
if ( m_eType == EDCAR_UNDOREDO_LIST_TYPE_UNDO )
{
POSITION pos = pclListOfModifs->GetTailPosition();
while ( pos != NULL )
{
pclModif = pclListOfModifs->GetPrev(pos);
if ( pclModif->HasBeenDone() )
m_clListBox.AddString(pclModif->GetName());
}
}
else
{
POSITION pos = pclListOfModifs->GetHeadPosition();
while ( pos != NULL )
{
pclModif = pclListOfModifs->GetNext(pos);
if ( !pclModif->HasBeenDone() )
m_clListBox.AddString(pclModif->GetName());
}
}
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControlID(IDC_LIST_UNDO, "OAc_UndoRedoDialog_ListBox", TUT_e_ListBox);
TUT_M_vRegisterControlID(IDC_STATIC_STATUS, "OAc_UndoRedoDialog_CancelStatic", TUT_e_Window);
//End of Registers for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void EdActors_UndoRedoListDialog::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControlID(IDC_LIST_UNDO);
TUT_M_vUnregisterControlID(IDC_STATIC_STATUS);
//End of UnRegisters for TUT Module
//////////////
CDialog::OnDestroy();
}
//***************************************************************************
void EdActors_UndoRedoListDialog::OnSelchangeListUndo()
{
//Gets the Selected Undo action
unsigned short uwIndex = m_clListBox.GetCurSel();
if ( (m_clListBox.m_bMustUndo) && (uwIndex != LB_ERR) )
{
//Makes (uwIndex + 1) undo in the reversed list
CPA_List<CPA_Modif> *pclListOfModifs = &(m_pclEditorActor->m_clUndoManager.ListOfModifs);
unsigned short c_uwI;
CPA_Modif *pclModif;
if ( m_eType == EDCAR_UNDOREDO_LIST_TYPE_UNDO )
{
POSITION pos = pclListOfModifs->GetTailPosition();
for (c_uwI = 0; c_uwI < (uwIndex+1); )
{
ERROR_ASSERT( pos != NULL );
pclModif = pclListOfModifs->GetPrev(pos);
if ( pclModif->HasBeenDone() )
{
ERROR_VERIFY( m_pclEditorActor->m_clUndoManager.Undo() );
c_uwI ++;
}
}
}
else
{
POSITION pos = pclListOfModifs->GetHeadPosition();
for (c_uwI = 0; c_uwI < (uwIndex+1); )
{
ERROR_ASSERT( pos != NULL );
pclModif = pclListOfModifs->GetNext(pos);
if ( !pclModif->HasBeenDone() )
{
ERROR_VERIFY( m_pclEditorActor->m_clUndoManager.Redo() );
c_uwI ++;
}
}
}
}
//Updates buttons
g_pclInterface->m_clDocument.m_pclActorsView->m_fn_vUpdateUndoRedoButtons();
//Ends Dialog
ReleaseCapture();
EndDialog(IDOK);
}
//***************************************************************************
void EdActors_UndoRedoListDialog::OnLButtonUp(UINT nFlags, CPoint point)
{
CPoint cpPoint(point);
ClientToScreen(&cpPoint);
CRect crWindowRect;
GetWindowRect(crWindowRect);
//If user clicks elsewhere, closes Dialog
if ( !crWindowRect.PtInRect(cpPoint) )
{
ReleaseCapture();
EndDialog(IDCANCEL);
}
//else looks if user clicked in the ListBox
else
m_clListBox.OnLButtonUp(nFlags, point);
CDialog::OnLButtonUp(nFlags, point);
}
//***************************************************************************
void EdActors_UndoRedoListDialog::OnLButtonDown(UINT nFlags, CPoint point)
{
m_clListBox.OnLButtonDown(nFlags, point);
CDialog::OnLButtonDown(nFlags, point);
}
//***************************************************************************
void EdActors_UndoRedoListDialog::OnMouseMove(UINT nFlags, CPoint point)
{
m_clListBox.OnMouseMove(nFlags, point);
CDialog::OnMouseMove(nFlags, point);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// EdActors_UndoListBox
BEGIN_MESSAGE_MAP(EdActors_UndoListBox, CListBox)
//{{AFX_MSG_MAP(EdActors_UndoListBox)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//****************************************************************************
EdActors_UndoListBox::EdActors_UndoListBox()
: CListBox()
{
m_bMustUndo = FALSE;
}
//****************************************************************************
EdActors_UndoListBox::~EdActors_UndoListBox()
{
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_UndoListBox message handlers
//****************************************************************************
void EdActors_UndoListBox::OnMouseMove(UINT nFlags, CPoint point)
{
if ( nFlags & MK_LBUTTON )
{
BOOL bInside;
short wIndex = ItemFromPoint(point, bInside);
CString csTextToDisplay;
//Re-computes bOutside
GetClientRect(m_crWindowRect);
bInside = m_crWindowRect.PtInRect(point);
if ( bInside )
{
//Selects first items
SelItemRange(TRUE, 0, wIndex+1);
//Unselects others
SelItemRange(FALSE, wIndex+1, GetCount()-1);
CString csTextPart = "undo";
if ( ((EdActors_UndoRedoListDialog *)GetParent())->m_eType == EdActors_UndoRedoListDialog::EDCAR_UNDOREDO_LIST_TYPE_REDO )
csTextPart = "redo";
csTextToDisplay.Format("Will %s %i %s", csTextPart,
wIndex+1,
(wIndex > 0) ? "actions" : "action");
m_bMustUndo = TRUE;
}
else
{
//Unselects all
SelItemRange(FALSE, 0, GetCount()-1);
csTextToDisplay = "Cancel";
m_bMustUndo = FALSE;
}
//Updates static text
GetParent()->GetDlgItem(IDC_STATIC_STATUS)->SetWindowText(csTextToDisplay);
}
CListBox::OnMouseMove(nFlags, point);
}
//****************************************************************************
void EdActors_UndoListBox::OnLButtonDown(UINT nFlags, CPoint point)
{
CListBox::OnLButtonDown(nFlags, point);
BOOL bInside;
short wIndex = ItemFromPoint(point, bInside);
CString csTextToDisplay;
//Selects first items
SelItemRange(TRUE, 0, wIndex+1);
//Unselects others
SelItemRange(FALSE, wIndex+1, GetCount()-1);
CString csTextPart = "undo";
if ( ((EdActors_UndoRedoListDialog *)GetParent())->m_eType == EdActors_UndoRedoListDialog::EDCAR_UNDOREDO_LIST_TYPE_REDO )
csTextPart = "redo";
csTextToDisplay.Format("Will %s %i %s", csTextPart,
wIndex+1,
(wIndex > 0) ? "actions" : "action");
m_bMustUndo = TRUE;
//Updates static text
GetParent()->GetDlgItem(IDC_STATIC_STATUS)->SetWindowText(csTextToDisplay);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,179 @@
// MainFrm.cpp : implementation of the CMainFrame class
////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "_AInterf.hpp"
#include "EDACFmMn.hpp"
#include "EDACVwAc.hpp"
#include "EDACVwMS.hpp"
#include "EDACCnst.hpp"
//-----------------IR-------------------------
#include "EdIRDVVw.hpp"
#include "EDACQuer.hpp"
//--------------------------------------------
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CSplitFrame)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_HELPINFO()
// ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
//*******************************************************************************
CMainFrame::CMainFrame()
{
}
//*******************************************************************************
CMainFrame::~CMainFrame()
{
//Closes Help if necessary
::WinHelp( m_hWnd,
LPCTSTR(g_pclInterface->m_clDocument.m_csHelpFileNameAndPath),
HELP_QUIT,
0);
}
//*******************************************************************************
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!(CreateSplitter(C_cVerticalSplitter, C_NUMBER_OF_PANES)))
return FALSE;
HINSTANCE hOldInstance = AfxGetResourceHandle();
//Creates Dialog List View
CPA_DialogList *pclDialogList = new CPA_DialogList;
g_pclInterface->m_clDocument.m_pclDialogList = pclDialogList;
pclDialogList->fn_vInitDialog(g_pclInterface, this);
SetPaneView(C_ROW_INDEX_LISTS,
pclDialogList,
"Selection",
g_pclInterface->m_clDocument.m_ulListViewHeight);
AfxSetResourceHandle( g_stActorEditorIdentity.hModule );
//Creates other views
if ( !CreateView( C_ROW_INDEX_MINI_STRUC,
RUNTIME_CLASS(EdActors_MiniStrucView),
"Mini Structures",
g_pclInterface->m_clDocument.m_ulMSViewHeight) )
return FALSE;
if ( !CreateView( C_ROW_INDEX_CONTROL,
RUNTIME_CLASS(EdActors_ActorsView),
"Editor's Control",
g_pclInterface->m_clDocument.m_ulControlViewHeight) )
return FALSE;
//-----------------IR-------------------------
if ( !CreateView( C_ROW_INDEX_DES_VAR,
EDAC_fn_pclDesignerVariableView_GetRuntimeClass(),
"Designer Variables",
C_wCaptionHeight) )
return FALSE;
//--------------------------------------------
//Manually calls OnInitialUpdate for all views !!!!!
EdActors_MiniStrucView *pclMSView = (EdActors_MiniStrucView *)m_fn_p_oGetPane(C_ROW_INDEX_MINI_STRUC);
pclMSView->OnInitialUpdate();
EdActors_ActorsView *pclActorsView = (EdActors_ActorsView *)m_fn_p_oGetPane(C_ROW_INDEX_CONTROL);
pclActorsView->OnInitialUpdate();
//-----------------IR-------------------------
CPA_EdIR_DesignerVariablesView *pclDesVarView = (CPA_EdIR_DesignerVariablesView *)m_fn_p_oGetPane(C_ROW_INDEX_DES_VAR);
pclDesVarView->OnInitialUpdate();
//SetPaneSize(C_ROW_INDEX_DES_VAR,C_wCaptionHeight);
short wScreenHeight;
HDC hdc = ::GetWindowDC(NULL);
wScreenHeight = (short)GetDeviceCaps(hdc, VERTRES);
::ReleaseDC(NULL, hdc);
EDAC_fn_vDesignerVariableView_SetOldHeight(pclDesVarView,wScreenHeight/C_NUMBER_OF_PANES);
//--------------------------------------------
AfxSetResourceHandle( hOldInstance );
return TRUE;
}
//*******************************************************************************
BOOL CMainFrame::OnHelpInfo(HELPINFO* pHelpInfo)
{
::WinHelp(m_hWnd,
LPCTSTR(g_pclInterface->m_clDocument.m_csHelpFileNameAndPath),
HELP_FINDER,
0);
return FALSE;
//return FRMBase::OnHelpInfo(pHelpInfo);
}
//*******************************************************************************
void CMainFrame::OnPaint()
{
// static s_bFirstPass = TRUE;
CPaintDC dc(this); // device context for painting
/* if ( s_bFirstPass )
{
EdActors_ActorsView *pclActorsView = (EdActors_ActorsView *)m_fn_p_oGetPane(C_ROW_INDEX_CONTROL);
pclActorsView->OnInitialUpdate();
EdActors_MiniStrucView *pclMSView = (EdActors_MiniStrucView *)m_fn_p_oGetPane(C_ROW_INDEX_MINI_STRUC);
pclMSView->OnInitialUpdate();
EdActors_NamesView *pclNamesView = (EdActors_NamesView *)m_fn_p_oGetPane(C_ROW_INDEX_INFO);
pclNamesView->OnInitialUpdate();
//-----------------IR-------------------------
CPA_EdIR_DesignerVariablesView *pclDesVarView = (CPA_EdIR_DesignerVariablesView *)m_fn_p_oGetPane(C_ROW_INDEX_DES_VAR);
pclDesVarView->OnInitialUpdate();
//--------------------------------------------
s_bFirstPass = FALSE;
}*/
// Do not call CSplitFrame::OnPaint() for painting messages
}
//*******************************************************************************
//*******************************************************************************
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
FRMBase::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
FRMBase::Dump(dc);
}
#endif //_DEBUG

View File

@@ -0,0 +1,258 @@
// Global functions
///////////////////////////
#include "stdafx.h"
#include "EDACGlob.hpp"
#include "ACP_Base.h"
#include "TAC.h"
#include "TFa.h"
#include "DPT.h"
#include "EdtList.hpp"
#include "CPA_dato.hpp"
#include "CPA_nll.hpp"
#include "_AInterf.hpp"
#include "x:\cpa\main\inc\_EditID.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BOOL FirstLoad = FALSE;
//**************************************************************************
void fn_vCheckAndChangeName(CString &r_csName)
{
if ( !r_csName.IsEmpty() )
{
long c_lI;
for (c_lI = 0; c_lI < r_csName.GetLength(); c_lI++ )
{
if ( (r_csName.Mid(c_lI, 1) == " ")
|| (r_csName.Mid(c_lI, 1) == "-")
)
r_csName.SetAt(c_lI, '_');
}
}
}
#define C_CHAR_UNPASSED '.'
#define C_CHAR_PASSED '|'
#define C_BAR_LENGTH 50
//**************************************************************************
// Only displays message in the status bar if 'cPercentage = -1'
void EDACTORS_fn_vGiveProgressInfo(CString csMessage, char cPercentage /*= -1*/)
{
CString csTrueMessage = csMessage;
if ( cPercentage > 0 )
{
CString csBar;
short c_wI;
for (c_wI = 0; c_wI < C_BAR_LENGTH; c_wI ++)
{
csBar += (c_wI < ((cPercentage * C_BAR_LENGTH)/100)) ? C_CHAR_PASSED : C_CHAR_UNPASSED;
}
csTrueMessage.Format("%s %s", csMessage, csBar);
}
if(FirstLoad == FALSE)
M_GetMainWnd()->UpdateStatus((char *)LPCTSTR(csTrueMessage), C_STATUSPANE_INFOS, C_STATUS_NORMAL);
else
g_oBaseFrame.mfnv_UpdateTitle((char *)LPCTSTR(csTrueMessage));
}
//**************************************************************************
BOOL EDACTORS_fn_bIsFileInCommon(CString _csFileName)
{
_csFileName.MakeLower();
return ( _csFileName.Find("_common") != -1 );
}
//***********************************************************************
// m_wGetIndexOfName
// finds the the index of a name in a name list, and the model using the name list
// wParam can have the following values :
// C_uiActor_GetANameList
// C_uiActor_CreateANewObjectList
// C_uiActor_DeleteAnObjectList
// C_uiActor_GetAnObjectList
// C_uiActor_SetAnObjectList
// C_uiActor_SetAnObjectInObjectList
//***********************************************************************
void fn_vSplitName(CString csName,CString &csFamily,CString &csNameList,CString &csObject)
{
CString csTemp;
int iPos;
// extract object
iPos = csName.ReverseFind('@');
if (iPos != -1)
{
csObject = csName.Right(csName.GetLength()-iPos-1);
csTemp = csName.Left(iPos);
}
else
{
csObject = csName;
csTemp = "";
}
// extract name list
iPos = csTemp.ReverseFind('@');
if (iPos != -1)
{
csNameList = csTemp.Right(csTemp.GetLength()-iPos-1);
csFamily = csName.Left(iPos);
}
else
{
csNameList = csTemp;
csFamily = "";
}
}
//**************************************************************************
short m_wGetIndexOfName(CString _csNameOfObject, CPA_Actor *&r_pModel,CString &rcsObjectType)
{
//CPA_BaseObjectList *p_oObjectList = GetMainWorld()->fn_p_oGetOriginalObjectList(C_szObjectNameType);
CString csFamilyName, csNameListName, csObjectName;
//split the name to get separately the reachable names of the name, list, and family
//p_oObjectList->fn_vSplitName(_csNameOfObject, &csNameListName, &csObjectType, &csObjectName);
//p_oObjectList->fn_vSplitName(csNameListName, &csFamilyName, &csObjectType, &csNameListName);
fn_vSplitName(_csNameOfObject,csFamilyName,csNameListName,csObjectName);
rcsObjectType="";
r_pModel = NULL;
long lNbFamilies, lNbNameLists, lNbNames;
class CPA_List<class CPA_BaseObject> oObList;
CPA_BaseObject *p_oFamily, *p_oNameList, *p_oName;
//if the family is specified, find it
p_oFamily = NO_CRITERIA;
if ( !csFamilyName.IsEmpty() )
{
lNbFamilies = g_pclInterface->GetMainWorld()->fn_lFindObjects(&oObList, csFamilyName, C_szFamilyTypeName, NO_CRITERIA);
if ( lNbFamilies <= 0 )
{
oObList.RemoveAll();
return C_wNoFamilyFound;
}
if ( lNbFamilies > 1 )
{
oObList.RemoveAll();
return C_wMultipleFamiliesFound;
}
p_oFamily = oObList.GetHead()/*->GetObject()*/;
}
//if the name list is specified, find it
oObList.RemoveAll();
p_oNameList = NO_CRITERIA;
if ( !csNameListName.IsEmpty() )
{
char *a_szTypes[] =
{
C_szZDeNameListType,
C_szZDmNameListType,
C_szZDdNameListType,
C_szZDrNameListType,
C_szWayNameListType,
};
short wNbTypes = sizeof(a_szTypes) / sizeof(char *);
lNbNameLists = 0;
for ( short wIndex = 0; wIndex < wNbTypes; wIndex ++ )
{
//find a name list owned by the specified family, if relevant
long lNb = g_pclInterface->GetMainWorld()->fn_lFindObjects(&oObList, csNameListName, a_szTypes[wIndex], p_oFamily);
lNbNameLists =+ lNb;
if ( lNb == 1 )
p_oNameList = oObList.GetHead()/*->GetObject()*/;
}
if ( lNbNameLists <= 0 )
{
oObList.RemoveAll();
return C_wNoNameListFound;
}
if ( lNbNameLists > 1 )
{
oObList.RemoveAll();
return C_wMultipleNameListsFound;
}
}
//try to find the object name
oObList.RemoveAll();
if ( !csObjectName.IsEmpty() )
{
//find a name that is used by the specified name list, or without criteria
lNbNames = g_pclInterface->GetMainWorld()->fn_lFindObjects(&oObList, csObjectName, C_szObjectNameType, p_oNameList);
if ( lNbNames <= 0 )
{
oObList.RemoveAll();
return C_wNoNameFound;
}
if ( lNbNames > 1 )
{
oObList.RemoveAll();
return C_wMultipleNamesFound;
}
p_oName = oObList.GetHead()/*->GetObject()*/;
}
else
return C_wNoNameFound;
oObList.RemoveAll();
//here only one name was found with the specified information
//lets find out the model using the name list referencing the name
//Gets type
rcsObjectType=p_oName->GetOwner()->GetType();
//Gets model
//CString csNameList=p_oName->GetOwner()->GetName();
int iNbReferencingFathers;
CList< CPA_BaseObject *, CPA_BaseObject *> oFatherList;
p_oNameList=p_oName->GetOwner();
iNbReferencingFathers = g_oCoherenceManager.m_fn_iGetFatherList(p_oNameList, &oFatherList);
if ( iNbReferencingFathers == 1 )
r_pModel = ((CPA_Actor *) oFatherList.GetHead());
oFatherList.RemoveAll();
return ((CPA_tdoNameList *) p_oNameList)->m_wGetIndexOfName(csObjectName);
/* int iNbReferencingFathers;
CList< CPA_SaveObject *, CPA_SaveObject *> oFatherList;
if ( p_oNameList == NO_CRITERIA ) //if no name list was specified
{
//find the name lists that use it
int iNbReferencingFathers = g_oCoherenceManager.m_fn_iGetFatherList(p_oName, &oFatherList);
if ( iNbReferencingFathers <= 0 )
{
oFatherList.RemoveAll();
return C_wNoNameListFound;
}
if ( iNbReferencingFathers > 1 )
{
oFatherList.RemoveAll();
return C_wMultipleNameListsFound;
}
//the only valid result is 1!
p_oNameList = oFatherList.GetHead();
}
//find which models use this name list
oFatherList.RemoveAll();
iNbReferencingFathers = g_oCoherenceManager.m_fn_iGetFatherList(p_oNameList, &oFatherList);
if ( iNbReferencingFathers == 1 )
r_pModel = (EdActors_EditorActorModel *) ((CPA_Actor *) oFatherList.GetHead())->m_fn_pclGetEditorActor();
oFatherList.RemoveAll();
return ((CPA_tdoNameList *) p_oNameList)->m_wGetIndexOfName(csObjectName);*/
}

View File

@@ -0,0 +1,86 @@
// EDACGrBt.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACGrBt.hpp"
#include "_AInterf.hpp"
//External Modules
#include "CTL.h"
#include "IncTUT.h"
//End of External Modules
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define C_ED_ACTORS_GROUP_BUTTON_HEIGHT 23
/////////////////////////////////////////////////////////////////////////////
// EdActors_MSGroupButton
BEGIN_MESSAGE_MAP(EdActors_MSGroupButton, CButton)
//{{AFX_MSG_MAP(EdActors_MSGroupButton)
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//****************************************************************************
EdActors_MSGroupButton::EdActors_MSGroupButton( unsigned char ucListIndex,
CString csText,
short wXPos,
short wYPos,
short wWidth,
CWnd *pclParentWnd)
{
m_ucListIndex = ucListIndex;
CRect crGroupButtonRect;
crGroupButtonRect.left = wXPos;
crGroupButtonRect.right = wXPos + wWidth;
crGroupButtonRect.top = wYPos;
crGroupButtonRect.bottom = wYPos + C_ED_ACTORS_GROUP_BUTTON_HEIGHT;
//Creates Button
Create( csText,
WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON | BS_PUSHLIKE,
crGroupButtonRect,
pclParentWnd,
CTL_fn_lGetNextAvailableIDForControl());
SetFont(pclParentWnd->GetFont());
//Registers in TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_hWnd, "OAc - Group Button - " + csText, TUT_e_Button);
//End of Registers in TUT Module
}
//****************************************************************************
EdActors_MSGroupButton::~EdActors_MSGroupButton()
{
//Un-Registers in TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl(m_hWnd);
//End of Un-Registers in TUT Module
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_MSGroupButton message handlers
//****************************************************************************
unsigned char EdActors_MSGroupButton::m_fn_ucGetListIndex()
{
return m_ucListIndex;
}
//****************************************************************************
void EdActors_MSGroupButton::OnClicked()
{
g_pclInterface->m_clDocument.m_fn_vSetCurrentList(m_ucListIndex);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,327 @@
// Implementation for the class of Editor Actors Instances
///////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACInst.hpp"
#include "EDACActr.hpp"
#include "EDACModl.hpp"
#include "EDACStrg.hpp"
#include "EDACDgIA.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
//****************************************************************
// PROVISOIRE....
//This constructor should not exist in final version....
EdActors_EditorActorInstance::EdActors_EditorActorInstance( CAR_EDIT_TDSTACTOR *ptdstActor)
: EdActors_EditorActor(EDCAR_ACTOR_TYPE_INSTANCE)
{
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!! BE CAREFUL !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//!! There is no Model for this Instance at that time !!
//!! The Model must be set elsewhere, or Editor won't work correctly !!
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
m_pclModel = NULL;
m_pclActorModel = NULL;
m_fn_vSetMotorActor(ptdstActor);
//Creates datas
m_fn_vCreateActorMSDataList();
//Calls special functions
m_fn_vCallSpecialFunctions();
m_pri_tdstWatchField.eType = OAC_WATCH_FIELD_TYPE__NONE;
m_pri_tdstWatchField.p_vData = (void *)this;
m_pri_tdstWatchField.pclWatchData = NULL;
}
//****************************************************************
EdActors_EditorActorInstance::EdActors_EditorActorInstance( CPA_Actor *pclBaseModel,
CPA_Actor *pclActor,
CAR_EDIT_TDSTACTOR *p_tdstMotorActor,
CPA_SuperObject *p_oSuperObject
)
: EdActors_EditorActor(EDCAR_ACTOR_TYPE_INSTANCE)
{
//Sets the pointer to the motor actor now.
m_pclActor = pclActor;
//and back-sets the motor actor's pointer on the editor actor
m_pclActor->m_fn_vSetEditorActor(this);
//Sets base model pointer
m_pclActorModel = pclBaseModel;
if ( pclBaseModel != NULL )
{
ERROR_ASSERT( pclBaseModel->m_fn_bIsAModel() );
m_pclModel = (EdActors_EditorActorModel *)m_pclActorModel->m_fn_pclGetEditorActor();
}
else
m_pclModel = NULL;
//Sets Family
if ( m_pclModel != NULL )
{
//Updates Model's list of Instances
m_pclModel->m_clInstancesList.AddTail(this);
m_pclActor->m_pub_fn_vSetFamily(m_pclModel->m_pclActor->m_pub_fn_pclGetFamily());
}
else
{
m_pclActor->m_pub_fn_vSetFamily(NULL);
}
if ( m_pclModel != NULL )
{
//Creates a new motor actor
CAR_EDIT_TDSTACTOR *p_tdstNewMotorActor;
if ( p_tdstMotorActor == NULL )
p_tdstNewMotorActor = (CAR_EDIT_TDSTACTOR *)malloc(sizeof(CAR_EDIT_TDSTACTOR));
else
p_tdstNewMotorActor = p_tdstMotorActor;
m_fn_vSetMotorActor(p_tdstNewMotorActor);
if ( p_tdstMotorActor == NULL )
m_fn_vSetMSPointersToNULL();
//Allocates MS if the corresponding MS in the Model is allocated
if ( p_tdstMotorActor == NULL )
m_fn_vAllocateMSAsInModel(m_pclModel);
m_pclActor->fn_vUpdateData(p_tdstNewMotorActor);
m_pclActor->SetEngineStruct(p_tdstNewMotorActor);
}
//Creates datas
m_fn_vCreateActorMSDataList();
// if the superobject is given, give it the object
if ( p_oSuperObject != NULL )
p_oSuperObject->SetObject(m_pclActor);
//Updates datas with model's ones (including 'model link' state)
if ( (m_pclModel != NULL) && (p_tdstMotorActor == NULL) )
m_fn_vUpdateDatas(m_pclModel, TRUE, CTL_UPDATE_REASON__USE_USER_DEFINED_REASON, OAC_E_ur_InstanciatedFromModel);
//Calls special functions
if ( (m_pclModel != NULL) && (p_tdstMotorActor == NULL) )
m_fn_vCallSpecialFunctions();
//else it's done in m_fn_vSetModel(...)
m_pri_tdstWatchField.eType = OAC_WATCH_FIELD_TYPE__NONE;
m_pri_tdstWatchField.p_vData = (void *)this;
m_pri_tdstWatchField.pclWatchData = NULL;
}
//****************************************************************
EdActors_EditorActorInstance::~EdActors_EditorActorInstance()
{
//Removes from Model's list of Instances
m_pclModel->m_fn_vRemoveFromInstancesList(this);
m_fn_vDeleteAllMS();
//PROVISOIRE !?! ( will be deleted by motor ? )
// free(m_fn_ptdstGetMotorActor());
}
//****************************************************************
// Looks in the list of datas if they have been modified
void EdActors_EditorActorInstance::m_fn_vLookForModifiedDatas()
{
EdActors_ActorMiniStructure *pclInstanceCurrentMS;
CTL_Editor_DataList *pclInstanceDataList;
POSITION InstanceMSPos = m_pclActorCurrentMSList->GetHeadPosition();
while ( InstanceMSPos != NULL )
{
pclInstanceCurrentMS = m_pclActorCurrentMSList->GetNext(InstanceMSPos);
//Looks only for the developped MS
if ( pclInstanceCurrentMS->m_fn_bIsAllocated() )
{
pclInstanceDataList = pclInstanceCurrentMS->m_pclDataList;
POSITION DataPos = pclInstanceDataList->GetHeadPosition();
while ( DataPos != NULL )
pclInstanceDataList->GetNext(DataPos)->m_fn_vLookIfDataHasBeenModified();
}
}
}
//****************************************************************
CPA_Actor *EdActors_EditorActorInstance::m_fn_pclGetModel()
{
return m_pclActorModel;
}
//****************************************************************
BOOL EdActors_EditorActorInstance::m_pub_fn_bCheckAllMSWithModel()
{
BOOL bCheckIsOK = TRUE;
EdActors_EditorActorModel *pclEdModel = m_pclModel;
ERROR_ASSERT( pclEdModel != NULL );
//Checks the number of MS in Model and in Actor
long lNumberOfAMSGroupsInInstance = m_clListOfAMSLists.GetCount();
long lNumberOfAMSGroupsInModel = pclEdModel->m_clListOfAMSLists.GetCount();
CString csHeaderMessage = "Checking MS in the (loaded) Actor '" + m_fn_csGetActorName();
csHeaderMessage += "', according to its Model ('" + pclEdModel->m_fn_csGetActorName() + "')";
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,csHeaderMessage,
"EdActors_EditorActorInstance::m_pub_fn_bCheckAllMSWithModel()",
E_ERROR_GRAVITY_FATAL,
"Number of groups of MS are not the same in Instance and Model");
ERROR_ASSERT( lNumberOfAMSGroupsInInstance == lNumberOfAMSGroupsInModel );
EdActors_ActorMiniStructureList *pclInstanceAMSList;
EdActors_ActorMiniStructureList *pclModelAMSList;
long lNumberOfAMSInInstance;
long lNumberOfAMSInModel;
POSITION ActorPos = m_clListOfAMSLists.GetHeadPosition();
POSITION ModelPos = pclEdModel->m_clListOfAMSLists.GetHeadPosition();
while ( ActorPos != NULL )
{
ERROR_ASSERT( ModelPos != NULL );
pclInstanceAMSList = m_clListOfAMSLists.GetNext(ActorPos);
pclModelAMSList = pclEdModel->m_clListOfAMSLists.GetNext(ModelPos);
lNumberOfAMSInInstance = pclInstanceAMSList->GetCount();
lNumberOfAMSInModel = pclModelAMSList->GetCount();
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
csHeaderMessage,
"EdActors_EditorActorInstance::m_pub_fn_bCheckAllMSWithModel()",
E_ERROR_GRAVITY_FATAL,
"Number of MS are not the same in Instance and Model");
ERROR_ASSERT( lNumberOfAMSInInstance == lNumberOfAMSInModel );
EdActors_ActorMiniStructure *pclInstanceAMS;
EdActors_ActorMiniStructure *pclModelAMS;
POSITION InstanceAMSPos = pclInstanceAMSList->GetHeadPosition();
POSITION ModelAMSPos = pclModelAMSList->GetHeadPosition();
while ( InstanceAMSPos != NULL )
{
ERROR_ASSERT( ModelAMSPos != NULL );
pclInstanceAMS = pclInstanceAMSList->GetNext(InstanceAMSPos);
pclModelAMS = pclModelAMSList->GetNext(ModelAMSPos);
if ( pclInstanceAMS->m_fn_bIsAllocated() != pclModelAMS->m_fn_bIsAllocated() )
{
// Shaitan FastC {
if (pclModelAMS->m_fn_csGetScriptName() == "Brain")
{
pclModelAMS->m_fn_bAllocate(FALSE);
m_pclActor->m_fn_pclGetModel()->fn_vNotifySave();
}
else
{
//End Shaitan FastC }
EdActors_Dialog_InconsistentAllocations Dial( m_pclActor->m_fn_pclGetModel(),
m_pclActor,
pclModelAMS->m_fn_bIsAllocated(),
pclModelAMS,
pclInstanceAMS,
&g_oBaseFrame);
//The Dialog does all...
Dial.DoModal();
// Shaitan FastC {
}
//End Shaitan FastC }
}
}
}
return bCheckIsOK;
}
//****************************************************************
// Sets the Model for an Instance who does not have any
// i.e. which has been loaded from a file
void EdActors_EditorActorInstance::m_fn_vSetModel(CPA_Actor *pclNewModel)
{
ERROR_ASSERT( pclNewModel != NULL );
m_pclActorModel = pclNewModel;
m_pclModel = (EdActors_EditorActorModel *)m_pclActorModel->m_fn_pclGetEditorActor();
//Sets the Model as Owner
m_pclActor->fn_bSetOwner(pclNewModel);
//Is a GenDoor if Model is one
m_pclActor->m_fn_vMakeGenDoor(pclNewModel->m_fn_bIsAGenDoor());
//Allocates MS if the corresponding MS in the Model is allocated
// m_fn_vAllocateMSAsInModel(m_pclModel);
//Creates datas
m_fn_vCreateActorMSDataList();
//Updates datas with model's ones (including 'model link' state)
// m_fn_vUpdateDatas(m_pclModel);
//PROVISOIRE...
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
// !!!!! Data Consistency will have to be tested !!!!! //
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
//Calls special fucntions
m_fn_vCallSpecialFunctions();
//Updates model's list of instances
m_pclModel->m_clInstancesList.AddTail(this);
}
//****************************************************************
void EdActors_EditorActorInstance::m_fn_vCallSpecialFunctions()
{
POSITION pos = m_clListOfAMSLists.GetHeadPosition();
POSITION AMSpos;
EdActors_ActorMiniStructureList *pclAMSList;
while ( pos != NULL )
{
pclAMSList = m_clListOfAMSLists.GetNext(pos);
AMSpos = pclAMSList->GetHeadPosition();
while ( AMSpos != NULL )
pclAMSList->GetNext(AMSpos)->m_fn_bCallSpecialFunction();
}
}
//****************************************************************
void EdActors_EditorActorInstance::m_pub_fn_vSetLink(CTL_Editor_Data *_pclSourceData,
BOOL _bMustLink)
{
OAC_fn_tdeSetLink(_pclSourceData, eNot(OAC_fn_tdeGetLink(_pclSourceData)));
}
//***************************************************************************
OAC_tdstWatchField *EdActors_EditorActorInstance::m_pub_fn_p_tdstGetWatchField()
{
return (&m_pri_tdstWatchField);
}

View File

@@ -0,0 +1,465 @@
#include "StdAfx.h"
//External Modules
#include "ACP_Base.h"
#include "ITF.h"
#include "TAC.h"
#include "TFA.h"
#include "IncMEC.h"
#define D_State_Define
#include "IncGAM.h"
#undef D_State_Define
#include "GLI.h"
//End of External Modules
#include "EDACStrg.hpp"
#include "EDACInst.hpp"
#include "EDACModl.hpp"
#include "EDACDgIf.hpp"
#include "EDACDgPI.hpp"
#include "EDACGlob.hpp"
#include "Defines.hpp"
#include "x:\cpa\Main\inc\_editid.h"
//-----------------IR-------------------------
#include "EdIRStrg.hpp"
#include "EdIRFrm.hpp"
#include "EdIRBeEn.hpp"
#include "EDACQuer.hpp"
//--------------------------------------------
//External Modules
#include "ErO.h"
//#include "CTL.h"
//End of External Modules
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
//-----------------IR-------------------------
#include "EdIRIRD.hpp"
//--------------------------------------------
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
//*************************************************************************
// Model Loading Function (Direct)
//*************************************************************************
CPA_Actor *EdActors_MyDocument::m_fn_pclLoadModel(CString csModelName /*=""*/,
CPA_Actor *pclModel /*= NULL*/)
{
CPA_Actor *pclLoadedModel = NULL;
CString csTrueFileName;
BOOL bMustGoOn = TRUE;
if ( csModelName.IsEmpty() )
{
/* CString csFilters("Actor Model File(*.eam)|*.eam|All Files|*.*|");
CFileDialog dial( TRUE,
"*.ema",
"*.ema",
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
csFilters);
char a_cOldDir[MAX_PATH];
GetCurrentDirectory(MAX_PATH, (char *)(&a_cOldDir));
CString csOldDir(a_cOldDir);
SetCurrentDirectory(m_csModelsSavePath);
if ( dial.DoModal() == IDOK )
csTrueFileName = dial.GetFileName();
else
bMustGoOn = FALSE;
SetCurrentDirectory(csOldDir);
*/
}
else
csTrueFileName = csModelName + g_csModelExtension;
if ( bMustGoOn )
{
//Loads the Model
CString csCompleteSectionName = csTrueFileName;
csCompleteSectionName += '^';
csCompleteSectionName += g_c_csActorScriptModelSectionName + ':';
csModelName = g_c_csModelNamePrefix + csModelName;
CString csModelTrueName = csModelName.Right(csModelName.GetLength() - csModelName.ReverseFind('\\') - 1);
csCompleteSectionName += csModelTrueName;
//Gives the Model to the CallBack
SCR_M_RdL0_SetContextLong(1, 0, pclModel);
AfxGetApp()->DoWaitCursor(1);
BOOL bIsLoadingWorld = g_pclInterface->GetInterface()->fn_bIsLoadingWorld();
g_pclInterface->GetInterface()->SetLoadingWorld(TRUE);
SCR_tdst_Cxt_Values *p_stValues;
p_stValues = SCR_fnp_st_RdL0_AnalyseSection((char *)LPCTSTR(csCompleteSectionName),
SCR_CDF_uw_Anl_Normal);
ERROR_RESET_SCRIPT_INFO
//Displays the last loaded Actor
pclLoadedModel = (CPA_Actor *)p_stValues->a_ulValues[0];
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Loading a Model",
"EdActors_MyDocument::m_fn_pclLoadModel(...)",
E_ERROR_GRAVITY_FATAL,
"Model could not be loaded");
ERROR_ASSERT( pclLoadedModel != NULL );
pclLoadedModel->SetExistingSection(TRUE);
g_pclInterface->GetInterface()->SetLoadingWorld(bIsLoadingWorld);
AfxGetApp()->DoWaitCursor(-1);
}
g_pclInterface->m_clDocument.m_pLoadedModel = NULL;
return pclLoadedModel;
}
////////////////////////////////
// Models : Loading functions //
////////////////////////////////
//*************************************************************************
// Model Loading Function (CallBack)
//*************************************************************************
SCR_tde_Anl_ReturnValue EdActors_MyDocument::m_fn_tdeCallBackLoadModel( SCR_tdst_File_Description *_p_stFile,
char *_p_szName,
char *_ap_szParams[],
SCR_tde_Anl_Action _eAction)
{
//Working Model
static CPA_Actor *s_pclModel = NULL;
//Info Window
static unsigned char s_ucProgressValue = 0;
static CString s_csMessage;
static BOOL s_bModelAlreadyExists = FALSE;
CString csAction(_p_szName);
//For error Infos
ERROR_SET_SCRIPT_INFO(_p_stFile)
switch ( _eAction )
{
case SCR_EA_Anl_BeginSection:
{
CString csName(_p_szName);
s_csMessage = "Actors Editor loading Model : " + csName;
//Gets the 'context' Model
unsigned long ulPassedValue;
SCR_M_RdL0_GetContextLong(0, 0, unsigned long, ulPassedValue);
if ( ulPassedValue == 0 )
{
//Creates the Model
CPA_SuperObject *pclSO = g_pclInterface->m_clDocument.m_fn_pclCreateModelForLoad(csName);
s_pclModel = (CPA_Actor *)pclSO->GetObject();
s_bModelAlreadyExists = FALSE;
}
else
{
//Creates the Model
s_pclModel = (CPA_Actor *)ulPassedValue;
CPA_SuperObject *pclSO = g_pclInterface->m_clDocument.m_fn_pclCreateModelForLoad(csName, s_pclModel);
s_pclModel = (CPA_Actor *)pclSO->GetObject();
ERROR_ASSERT( (unsigned long)s_pclModel == ulPassedValue );
s_bModelAlreadyExists = TRUE;
}
ERROR_ASSERT( s_pclModel != NULL );
ERROR_ASSERT( s_pclModel->m_fn_bIsAModel() );
}
break;
case SCR_EA_Anl_EndSection:
//Adds in the Models list
g_pclInterface->m_clDocument.m_fn_vAddLoadedModelInList(s_pclModel->m_fn_pclGetEditorModel(), !s_bModelAlreadyExists);
//Re-builds section name
s_pclModel->GetCompleteSectionName();
SCR_M_RdL0_SetSectionLong(0, 0, (long)s_pclModel);
s_pclModel = NULL;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, 100);
s_ucProgressValue = 0;
s_csMessage = "";
s_bModelAlreadyExists = FALSE;
break;
case SCR_EA_Anl_BeginSubSection:
SCR_M_RdL0_SetContextLong(1, 0, (long)s_pclModel);
break;
case SCR_EA_Anl_Entry:
ERROR_ASSERT ( s_pclModel != NULL );
//Analyses Model's type
if ( csAction.CompareNoCase(g_c_csModelType) == 0 )
{
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
s_pclModel->m_fn_vMakeGenDoor(g_c_csModelTypeGenDoor.CompareNoCase(_ap_szParams[0]) == 0);
//Sets progress
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
}
//Analyses Model's Bitmap name
else if ( csAction.CompareNoCase(g_c_csBitmapName) == 0 )
{
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
CString csBitmapName(_ap_szParams[0]);
s_pclModel->m_fn_pclGetEditorModel()->m_fn_vSetBitmapName(csBitmapName);
//Sets progress
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
}
//Analyses Model's Family
else if ( csAction.CompareNoCase(g_c_csActorFamily) == 0 )
{
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
CPA_Family *pclFamily = (CPA_Family *)g_pclInterface->GetMainWorld()->fn_p_oFindObject( _ap_szParams[0],
C_szFamilyTypeName);
//If Family is not loaded, calls Family DLL to load it
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,"Loading a Model",
"EdActors_MyDocument::m_fn_tdeCallBackLoadModel(...)",
E_ERROR_GRAVITY_FATAL,
"Family for the Model has not been found");
ERROR_ASSERT( pclFamily != NULL );
if ( !(pclFamily->fn_bIsAvailable()) )
{
CString csFamilyMessage = "Actors Editor asking for Family '" + pclFamily->GetName() + "' load... Please wait !";
EDACTORS_fn_vGiveProgressInfo(csFamilyMessage, -1);
CPA_DLLBase *p_clFamilyDll = g_pclInterface->GetMainWorld()->GetDLLWithTypeName(C_szDLLFamilyName);
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,"Loading a Model",
"EdActors_MyDocument::m_fn_tdeCallBackLoadModel(...)",
E_ERROR_GRAVITY_FATAL,
"Family DLL cannot be found");
ERROR_ASSERT( p_clFamilyDll != NULL );
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,"Loading a Model",
"EdActors_MyDocument::m_fn_tdeCallBackLoadModel(...)",
E_ERROR_GRAVITY_FATAL,
"Family can't be loaded");
ERROR_VERIFY( p_clFamilyDll->fn_bLoadBaseObject(pclFamily) );
}
s_pclModel->m_pub_fn_vSetFamily(pclFamily);
s_pclModel->m_pub_fn_vConstructEnumDescriptorForObjectsTables();
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
}
//-----------------IR-------------------------
//Analyses Brain
else
if(csAction.CompareNoCase(g_c_csBrainName)==0)
{
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
CString csName(_ap_szParams[0]);
EDAC_fn_vLoadBrain(s_pclModel,csName);
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
}
//BEGIN ROMTEAM Cristi Petrescu 98-06-
//Analyses show private variable status
else
if(csAction.CompareNoCase(g_c_csShowPrivateVariable)==0)
{
CPA_EdIR_Brain *pclBrain = ((EdActors_EditorActorModel *)s_pclModel->m_fn_pclGetEditorActor())->m_pclBrain;
pclBrain -> m_bShowPrivateVariable = atoi(_ap_szParams[0]);
}
//END ROMTEAM Cristi Petrescu 98-06-
//--------------------------------------------
break;
}
return SCR_ERV_Anl_NormalReturn;
}
//////////////////////////////////////
// MS : Loading functions //
//////////////////////////////////////
//*************************************************************************
// Level Loading Function (CallBack)
//*************************************************************************
SCR_tde_Anl_ReturnValue EdActors_ActorMiniStructure::m_fn_tdeCallBackLoad(SCR_tdst_File_Description *_p_stFile,
char *_p_szName,
char *_ap_szParams[],
SCR_tde_Anl_Action _eAction)
{
//Gets the working Model
long lValue;
SCR_M_RdL0_GetContextLong(0, 0, long, lValue);
CPA_Actor *pclActor = (CPA_Actor *)lValue;
ERROR_ASSERT( pclActor->m_fn_bIsAModel() );
EdActors_EditorActor *pclEdActor = pclActor->m_fn_pclGetEditorActor();
static EdActors_ActorMiniStructure *s_pclAMS = NULL;
//For error Infos
ERROR_SET_SCRIPT_INFO(_p_stFile);
CString csAction(_p_szName);
switch ( _eAction )
{
case SCR_EA_Anl_Entry:
{
/* ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Loading a Mini Structure",
"EdActors_ActorMiniStructure::m_fn_tdeCallBackLoad(...)",
E_ERROR_GRAVITY_WARNING,
"A field has been found in a Model's MS which is not allocated");
ERROR_ASSERT( s_pclAMS != NULL );*/
if ( s_pclAMS != NULL )
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Loading a Mini Structure",
"EdActors_ActorMiniStructure::m_fn_tdeCallBackLoad(...)",
E_ERROR_GRAVITY_FATAL,
"A field has been found in a Model's MS which is not allocated : this should not occur !!");
ERROR_ASSERT( s_pclAMS->m_fn_bIsAllocated() );
//Searches for the Data
BOOL bFound = FALSE;
CTL_Editor_Data *pclData;
POSITION pos = s_pclAMS->m_pclDataList->GetHeadPosition();
while ( (pos != NULL) && (!bFound) )
{
pclData = s_pclAMS->m_pclDataList->GetNext(pos);
bFound = ( pclData->m_pub_fn_csGetDataName().CompareNoCase(csAction) == 0 );
}
if ( bFound )
{
CString csValue(_ap_szParams[0]);
//Analyses link state
if ( csValue.CompareNoCase(g_c_csLinkedField) == 0 )
OAC_fn_tdeSetLink(pclData, OAC_LINK_MODE__LINKED);
else if ( csValue.CompareNoCase(g_c_csNotLinkedField) == 0 )
OAC_fn_tdeSetLink(pclData, OAC_LINK_MODE__NOT_LINKED);
else if ( csValue.CompareNoCase(g_c_csAlwaysLinkedField) == 0 )
OAC_fn_tdeSetLink(pclData, OAC_LINK_MODE__ALWAYS_LINKED);
else if ( csValue.CompareNoCase(g_c_csNeverLinkedField) == 0 )
OAC_fn_tdeSetLink(pclData, OAC_LINK_MODE__NEVER_LINKED);
else
ERROR_ASSERT(FALSE);
//Analyses Value string
CStringList cslStringList;
// To clean all ema files
if (csValue.CompareNoCase("Activable") != 0)
{
long c_lI;
for ( c_lI = 1; _ap_szParams[c_lI] != NULL; c_lI ++ )
cslStringList.AddTail(_ap_szParams[c_lI]);
}
else
cslStringList.AddTail("TRUE");
pclData->m_fn_vSetValueWithString(&cslStringList);
}
}
}
break;
case SCR_EA_Anl_EndSection:
s_pclAMS = NULL;
break;
case SCR_EA_Anl_BeginSection:
{
CString csAllocated = CString(_ap_szParams[1]);
if ( csAllocated.CompareNoCase(g_c_csAllocatedMS) == 0 )
{
//Selects the right list of AMS
EdActors_ActorMiniStructureList *pclAMSList;
CString csGroupName = CString(_ap_szParams[0]);
BOOL bAMSListFound = FALSE;
POSITION ASMListPos = pclEdActor->m_clListOfAMSLists.GetHeadPosition();
while ( (ASMListPos != NULL) && (!bAMSListFound) )
{
pclAMSList = pclEdActor->m_clListOfAMSLists.GetNext(ASMListPos);
bAMSListFound = ( csGroupName.CompareNoCase(pclAMSList->m_fn_csGetGroupScriptName()) == 0 );
}
ERROR_ASSERT( bAMSListFound );
BOOL bAMSFound = FALSE;
CString csMSName = csAction;
EdActors_ActorMiniStructure *pclAMS;
POSITION pos = pclAMSList->GetHeadPosition();
while ( (pos != NULL) && (!bAMSFound) )
{
pclAMS = pclAMSList->GetNext(pos);
bAMSFound = ( pclAMS->m_csScriptName.CompareNoCase(csMSName) == 0 );
}
/* ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Loading a Mini Structure",
"EdActors_ActorMiniStructure::m_fn_tdeCallBackLoad(...)",
E_ERROR_GRAVITY_FATAL,
"A section is referencing a MS which does not exist in Editor");
ERROR_ASSERT( bAMSFound );*/
//Allocates the MS
if ( bAMSFound )
{
pclAMS->m_fn_bAllocate();
s_pclAMS = pclAMS;
}
}
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,645 @@
// Implementation for the definition of the class representing a mini-structure
// (Base class) (actors datas)
/////////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "_AInterf.hpp"
#include "EDACMStA.hpp"
#include "EDACModl.hpp"
#include "EDACVwMS.hpp"
#include "EDACVwAc.hpp"
#include "EDACStrg.hpp"
#include "ErO.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//***************************************************************************
EdActors_ActorMiniStructure::EdActors_ActorMiniStructure(CString csScriptName)
{
m_csScriptName = csScriptName;
m_tdeState = MS_STATE_UNALLOCATED;
m_bDataCreated = FALSE;
m_bDataInitialized = FALSE;
m_pclParentActor = NULL;
m_pclParentMS = NULL;
m_td_pfn_vFillFunction = NULL;
m_td_pfn_vAllocationFunction = NULL;
m_td_pfn_vUnallocationFunction = NULL;
m_td_pfn_vInstanciationSpecialFunction = NULL;
m_td_pfn_vBeforeAllocationSpecialFunction = NULL;
m_td_pfn_vAfterAllocationSpecialFunction = NULL;
m_pvBaseAddress = NULL;
m_pvKeptAddress = NULL;
m_bIsReallyAllocated = FALSE;
m_pclDataList = new CTL_Editor_DataList;
m_pri_tdstWatchField.eType = OAC_WATCH_FIELD_TYPE__NONE;
m_pri_tdstWatchField.p_vData = (void *)this;
m_pri_tdstWatchField.pclWatchData = NULL;
}
//***************************************************************************
EdActors_ActorMiniStructure::~EdActors_ActorMiniStructure()
{
delete m_pclDataList;
}
//***************************************************************************
BOOL EdActors_ActorMiniStructure::m_fn_bAllocate(BOOL bCanBeUndone /*= FALSE*/)
{
BOOL bReturn = FALSE;
if ( !m_fn_bIsAllocated() )
{
if ( bCanBeUndone )
{
//Allocation for an Instance can never be Undone
// ERROR_ASSERT( m_pclParentActor->m_pclActor->m_fn_bIsAModel() );
EdActors_ActorMSAllocateModif *pclModif = new EdActors_ActorMSAllocateModif(this);
bReturn = m_pclParentActor->m_clUndoManager.AskFor(pclModif);
//Updates Undo / Redo Buttons
g_pclInterface->m_clDocument.m_pclActorsView->m_fn_vUpdateUndoRedoButtons();
}
else
{
if ( !m_bIsReallyAllocated )
bReturn = m_fn_bRealAllocate();
else
{
m_fn_vUnrealAllocate();
bReturn = TRUE;
}
}
m_bIsReallyAllocated = bReturn;
}
return bReturn;
}
//***************************************************************************
BOOL EdActors_ActorMiniStructure::m_fn_bUnallocate(BOOL bCanBeUndone /*= FALSE*/)
{
BOOL bReturn;
if ( M_GetMainApp()->m_bLeavingApplication == FALSE )
{
//For an Instance
if ( m_pclParentActor->m_fn_bIsAnInstance() )
{
//Removes fields from Watch Window if necessary
POSITION pos = m_pclDataList->GetHeadPosition();
CTL_Editor_Data *pclData;
while ( pos != NULL )
{
pclData = m_pclDataList->GetNext(pos);
if ( OAC_fn_bDataIsInWatch(pclData) )
OAC_RemoveFieldFromWatchWindow(pclData);
}
//Removes concerned modif from Undo Manager
CPA_Modif *pclModif;
pos = m_pclParentActor->m_clUndoManager.ListOfModifs.GetHeadPosition();
while ( pos != NULL )
{
pclModif = m_pclParentActor->m_clUndoManager.ListOfModifs.GetNext(pos);
//PROVISOIRE...
//Removes all undo from instances lists
delete pclModif;
}
m_pclParentActor->m_clUndoManager.ListOfModifs.RemoveAll();
//(Unreal) unallocates MS
m_fn_vUnrealUnallocate();
}
//For a Model
else
{
EdActors_ActorMSUnallocateModif *pclModif = new EdActors_ActorMSUnallocateModif(this);
bReturn = m_pclParentActor->m_clUndoManager.AskFor(pclModif);
}
}
return bReturn;
}
//***************************************************************************
BOOL EdActors_ActorMiniStructure::m_fn_bRealAllocate()
{
ERROR_ASSERT( m_td_pfn_vFillFunction != NULL );
ERROR_ASSERT( m_td_pfn_vAllocationFunction != NULL );
//Calls "before" special fucntion
if ( m_td_pfn_vBeforeAllocationSpecialFunction != NULL )
m_td_pfn_vBeforeAllocationSpecialFunction(this);
//First constructs the Data List (no effect if already done once)
m_td_pfn_vFillFunction(m_pclParentActor, this);
//Calls the motor's allocation function
ERROR_ASSERT( m_pclParentActor->m_fn_ptdstGetMotorActor() != NULL );
m_td_pfn_vAllocationFunction(m_pclParentActor->m_fn_ptdstGetMotorActor());
//Fills the MS with new datas pointers
m_td_pfn_vFillFunction(m_pclParentActor, this);
//Sets the new state for the MS
m_tdeState = MS_STATE_DEVELOPPED;
//Calls "after" special fucntion
if ( m_td_pfn_vAfterAllocationSpecialFunction != NULL )
m_td_pfn_vAfterAllocationSpecialFunction(this);
return TRUE;
}
//For Undo / Redo
//***************************************************************************
void EdActors_ActorMiniStructure::m_fn_vUnrealAllocate()
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Trying to allocate a MS, which has been unallocated",
"EdActors_ActorMiniStructure::m_fn_vUnrealAllocate()",
E_ERROR_GRAVITY_INSTABLE,
"This probably means that a MS was allocated in an Instance, but not in its Model (when they were loaded)");
ERROR_ASSERT( m_pvKeptAddress != NULL );
if ( m_pvKeptAddress != NULL )
{
//m_fn_vSetBaseAddress(m_pvKeptAddress);
memcpy(m_pvBaseAddress, &m_pvKeptAddress, sizeof(void *));
//Sets the new state for the MS
m_tdeState = MS_STATE_DEVELOPPED;
//Updates display
g_pclInterface->m_clDocument.m_pclMiniStrucView->m_fn_vUpdateTree();
}
}
//***************************************************************************
void EdActors_ActorMiniStructure::m_fn_vUnrealUnallocate()
{
//Pointer on real MS is kept here...
m_pvKeptAddress = m_fn_pvGetBaseAddress();
//...but Pointer in Motor structure is set to NULL
//m_fn_vSetBaseAddress(NULL);
long lNULL = 0L;
memcpy(m_pvBaseAddress, &lNULL, sizeof(long));
//Sets the new state for the MS
m_tdeState = MS_STATE_UNALLOCATED;
//Updates display
g_pclInterface->m_clDocument.m_pclMiniStrucView->m_fn_vUpdateTree();
}
//***************************************************************************
BOOL EdActors_ActorMiniStructure::m_fn_bCallSpecialFunction()
{
if ( m_td_pfn_vInstanciationSpecialFunction != NULL )
{
if ( m_fn_bIsAllocated() )
m_td_pfn_vInstanciationSpecialFunction(this);
return TRUE;
}
else
return FALSE;
}
//***************************************************************************
BOOL EdActors_ActorMiniStructure::m_fn_bIsAllocated()
{
return ( m_tdeState != MS_STATE_UNALLOCATED );
}
//***************************************************************************
BOOL EdActors_ActorMiniStructure::m_fn_bCanBeUnallocated()
{
if ( m_pclParentMS != NULL )
return ( m_pclParentMS->m_fn_bCanBeUnallocated() );
else
return TRUE;
}
//***************************************************************************
BOOL EdActors_ActorMiniStructure::m_fn_bIsOpen()
{
return ( m_tdeState == MS_STATE_DEVELOPPED );
}
//***************************************************************************
CString EdActors_ActorMiniStructure::m_fn_csGetScriptName()
{
return m_csScriptName;
}
//***************************************************************************
void EdActors_ActorMiniStructure::m_fn_vSetScriptName(CString csNewName)
{
m_csScriptName = csNewName;
}
//***************************************************************************
void *EdActors_ActorMiniStructure::m_fn_pvGetBaseAddress()
{
long *p_lPointerToAddressOfMS = (long *)m_pvBaseAddress;
return (void *)(*p_lPointerToAddressOfMS);
}
//***************************************************************************
void EdActors_ActorMiniStructure::m_fn_vSetBaseAddress(void *pvNewAddress)
{
m_pvBaseAddress = pvNewAddress;
}
//***************************************************************************
//To init all data in the AMS
void EdActors_ActorMiniStructure::m_pub_fn_vInitializeAllData()
{
if ( !m_bDataInitialized )
{
POSITION pos = m_pclDataList->GetHeadPosition();
while ( pos != NULL )
m_pclDataList->GetNext(pos)->m_fn_vInitData();
m_bDataInitialized = TRUE;
}
}
//***************************************************************************
//To get all motor Data
void EdActors_ActorMiniStructure::m_pub_fn_vGetAllMotorData()
{
POSITION pos = m_pclDataList->GetHeadPosition();
while ( pos != NULL )
m_pclDataList->GetNext(pos)->m_fn_vGetMotorData();
}
//***************************************************************************
OAC_tdstWatchField *EdActors_ActorMiniStructure::m_pub_fn_p_tdstGetWatchField()
{
return (&m_pri_tdstWatchField);
}
//**************************************************************************************
//**************************************************************************************
//**************************************************************************************
//Modif class
//************************************************************************
//Constructor
EdActors_ActorMSAllocateModif::EdActors_ActorMSAllocateModif(EdActors_ActorMiniStructure *pclAMS)
: CPA_Modif(0, "MS allocated")
{
m_pclAMS = pclAMS;
CString csName = CString("MS '") + m_pclAMS->m_fn_csGetScriptName() + "' allocated";
SetName(csName);
}
//************************************************************************
//Destructor
EdActors_ActorMSAllocateModif::~EdActors_ActorMSAllocateModif()
{
}
//************************************************************************
BOOL EdActors_ActorMSAllocateModif::Do()
{
EdActors_EditorActorModel *pclEdModel = NULL;
//Only for Models !
if (m_pclAMS->m_pclParentActor->m_pclActor->m_fn_bIsAModel())
pclEdModel = (EdActors_EditorActorModel *)m_pclAMS->m_pclParentActor;
if ( !m_pclAMS->m_bIsReallyAllocated )
{
m_pclAMS->m_fn_bRealAllocate();
//(Real) Allocation for Instances MS
if (pclEdModel)
pclEdModel->m_fn_vAllocateMSInInstances(m_pclAMS);
}
else
//This is a Redo
{
m_pclAMS->m_fn_vUnrealAllocate();
//Unreal allocation for Instances
if (pclEdModel)
pclEdModel->m_fn_vAllocateMSInInstances(m_pclAMS);
}
return TRUE;
}
//************************************************************************
BOOL EdActors_ActorMSAllocateModif::Undo()
{
EdActors_EditorActorModel *pclEdModel = NULL;
//Only for Models !
if (m_pclAMS->m_pclParentActor->m_pclActor->m_fn_bIsAModel())
pclEdModel = (EdActors_EditorActorModel *)m_pclAMS->m_pclParentActor;
ERROR_ASSERT( m_pclAMS->m_bIsReallyAllocated );
m_pclAMS->m_fn_vUnrealUnallocate();
//Unreal unallocation for Instances
if (pclEdModel)
pclEdModel->m_fn_vUnallocateMSInInstances(m_pclAMS);
return TRUE;
}
//**************************************************************************************
//**************************************************************************************
//**************************************************************************************
//Modif class
//************************************************************************
//Constructor
EdActors_ActorMSUnallocateModif::EdActors_ActorMSUnallocateModif(EdActors_ActorMiniStructure *pclAMS)
: CPA_Modif(0)
{
m_pclAMS = pclAMS;
CString csName = CString("MS '") + m_pclAMS->m_fn_csGetScriptName() + "' unallocated";
SetName(csName);
}
//************************************************************************
//Destructor
EdActors_ActorMSUnallocateModif::~EdActors_ActorMSUnallocateModif()
{
}
//************************************************************************
BOOL EdActors_ActorMSUnallocateModif::Do()
{
//Only for Models !
ERROR_ASSERT( !m_pclAMS->m_pclParentActor->m_fn_bIsAnInstance() );
EdActors_EditorActorModel *pclEdModel = (EdActors_EditorActorModel *)m_pclAMS->m_pclParentActor;
ERROR_ASSERT( m_pclAMS->m_bIsReallyAllocated );
m_pclAMS->m_fn_vUnrealUnallocate();
//Unreal allocation for Instances
pclEdModel->m_fn_vUnallocateMSInInstances(m_pclAMS);
return TRUE;
}
//************************************************************************
BOOL EdActors_ActorMSUnallocateModif::Undo()
{
//Only for Models !
ERROR_ASSERT( !m_pclAMS->m_pclParentActor->m_fn_bIsAnInstance() );
EdActors_EditorActorModel *pclEdModel = (EdActors_EditorActorModel *)m_pclAMS->m_pclParentActor;
ERROR_ASSERT( m_pclAMS->m_bIsReallyAllocated );
m_pclAMS->m_fn_vUnrealAllocate();
//Unreal unallocation for Instances
pclEdModel->m_fn_vAllocateMSInInstances(m_pclAMS);
return TRUE;
}
//**************************************************************************************
//**************************************************************************************
//**************************************************************************************
EdActors_ActorMiniStructureList::EdActors_ActorMiniStructureList(CString csScriptName)
{
m_csGroupScriptName = csScriptName;
}
//**************************************************************************************
EdActors_ActorMiniStructureList::~EdActors_ActorMiniStructureList()
{
m_fn_vEmptyList();
}
//**************************************************************************************
EdActors_ActorMiniStructure* EdActors_ActorMiniStructureList::m_fn_pclAddElement(CString csScriptName)
{
EdActors_ActorMiniStructure *pclNewElement = new EdActors_ActorMiniStructure(csScriptName);
AddTail(pclNewElement);
return pclNewElement;
}
//**************************************************************************************
void EdActors_ActorMiniStructureList::m_fn_vEmptyList()
{
POSITION pos = GetHeadPosition();
while( pos != NULL )
delete (GetNext(pos));
RemoveAll();
}
//**************************************************************************************
CString EdActors_ActorMiniStructureList::m_fn_csGetGroupScriptName()
{
return m_csGroupScriptName;
}
//**************************************************************************************
EdActors_ActorMiniStructure *EdActors_ActorMiniStructureList::m_fn_pclGetAMSFromName(CString csNameOfAMSToSearch)
{
EdActors_ActorMiniStructure *pclFoundAMS = NULL;
EdActors_ActorMiniStructure *pclCurrentAMS;
POSITION pos = GetHeadPosition();
while( (pos != NULL) && (pclFoundAMS == NULL) )
{
pclCurrentAMS = GetNext(pos);
if ( pclCurrentAMS->m_fn_csGetScriptName().Compare(csNameOfAMSToSearch) == 0 )
pclFoundAMS = pclCurrentAMS;
}
return pclFoundAMS;
}
//**************************************************************************************
void EdActors_ActorMiniStructureList::m_pub_fn_vGetAllMotorData()
{
POSITION pos = GetHeadPosition();
while( pos != NULL )
GetNext(pos)->m_pub_fn_vGetAllMotorData();
}
//**************************************************************************************
//**************************************************************************************
//**************************************************************************************
// Definition of the class for the list of mini-structures lists (!!!)
//**************************************************************************************
EdActors_AMSListList::EdActors_AMSListList()
{
}
//**************************************************************************************
EdActors_AMSListList::~EdActors_AMSListList()
{
}
//**************************************************************************************
EdActors_ActorMiniStructureList *EdActors_AMSListList::m_fn_pclAddList(CString csScriptName)
{
EdActors_ActorMiniStructureList *pclCreatedList;
pclCreatedList = new EdActors_ActorMiniStructureList(csScriptName);
AddTail(pclCreatedList);
return pclCreatedList;
}
//**************************************************************************************
//Returns NULL if Index is not in a right range
EdActors_ActorMiniStructureList *EdActors_AMSListList::m_fn_pclGetListFromIndex(unsigned char ucIndex)
{
unsigned char ucCurrentIndex = 0;
EdActors_ActorMiniStructureList *pclAMSList = NULL;
POSITION pos = GetHeadPosition();
while ( (pos != NULL) && (ucCurrentIndex != (ucIndex+1)) )
{
if ( ucCurrentIndex == ucIndex )
pclAMSList = GetNext(pos);
else
GetNext(pos);
ucCurrentIndex ++;
}
return pclAMSList;
}
//**************************************************************************************
//Returns (-1) if Index is AMS List is not found
char EdActors_AMSListList::m_fn_cGetIndexFromList(EdActors_ActorMiniStructureList *pclAMSList)
{
char cIndex = 0;
BOOL bFound = FALSE;
POSITION pos = GetHeadPosition();
while ( (pos != NULL) && (!bFound) )
{
bFound = (pclAMSList == GetNext(pos));
if ( !bFound )
cIndex ++;
}
if ( bFound )
return cIndex;
else
return (-1);
}
//**************************************************************************************
//Returns (-1) if Index is AMS is not found
char EdActors_AMSListList::m_fn_cGetIndexFromAMS(EdActors_ActorMiniStructure *pclAMS)
{
char cIndex = 0;
BOOL bFound = FALSE;
EdActors_ActorMiniStructureList *pclAMSList;
POSITION pos = GetHeadPosition();
POSITION AMSPos;
while ( (pos != NULL) && (!bFound) )
{
pclAMSList = GetNext(pos);
AMSPos = pclAMSList->GetHeadPosition();
while ( (AMSPos != NULL) && (!bFound) )
bFound = (pclAMS == pclAMSList->GetNext(AMSPos));
if ( !bFound )
cIndex ++;
}
if ( bFound )
return cIndex;
else
return (-1);
}
//**************************************************************************************
EdActors_ActorMiniStructure *EdActors_AMSListList::m_fn_pclGetAMSFromName(CString csNameOfAMSToSearch)
{
EdActors_ActorMiniStructure *pclFoundAMS = NULL;
EdActors_ActorMiniStructureList *pclAMSList;
POSITION pos = GetHeadPosition();
while ( (pos != NULL) && (pclFoundAMS == NULL) )
{
pclAMSList = GetNext(pos);
pclFoundAMS = pclAMSList->m_fn_pclGetAMSFromName(csNameOfAMSToSearch);
}
return pclFoundAMS;
}
//**************************************************************************************
// Returns the first data found in the list, with the given name
CTL_Editor_Data *EdActors_AMSListList::m_fn_pclGetDataFromName(CString _csName)
{
CTL_Editor_Data *pclFoundData = NULL;
EdActors_ActorMiniStructureList *pclCurrentAMSList;
EdActors_ActorMiniStructure *pclCurrentAMS;
POSITION AMSListPos = GetHeadPosition();
while ( (AMSListPos != NULL) && (pclFoundData == NULL) )
{
pclCurrentAMSList = GetNext(AMSListPos);
POSITION AMSPos = pclCurrentAMSList->GetHeadPosition();
while ( (AMSPos != NULL) && (pclFoundData == NULL) )
{
pclCurrentAMS = pclCurrentAMSList->GetNext(AMSPos);
pclFoundData = pclCurrentAMS->m_pclDataList->m_fn_pclGetDataFromName(_csName);
}
}
return pclFoundData;
}

View File

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

View File

@@ -0,0 +1,962 @@
// Implementation for the class of Editor Actors Models
///////////////////////////////////////////////////////
#include "StdAfx.h"
// Shaitan FastC {
/////////////////////////////////////////////////////
//////// !!!!!!!!!!!! DANGER !!!!!!!!!!! ////////////
/////////////////////////////////////////////////////
#define _ED_CAR_MUST_DEFINE_STRUCT_
#include "EdAllAct.hpp"
/////////////////////////////////////////////////////
//////// !!!!!!!!!!!! End DANGER !!!!!!!!!!! ////////
/////////////////////////////////////////////////////
//End Shaitan FastC }
//ANNECY CHRISTOPHE MODIFICATIONS
#define D_ZdxStuff_StructureDefine
//ANNECY END CHRISTOPHE MODIFICATIONS
#include "EDACModl.hpp"
#include "EDACDef.hpp"
#include "_Ainterf.hpp"
#include "Defines.hpp"
#include "EDACDgIf.hpp"
#include "EDACStrg.hpp"
//External Modules
#include "ErO.h"
#include "TFa.h"
//End of External Modules
//-----------------IR-------------------------
#include "EdIRBeEn.hpp"
#include "EDACQuer.hpp"
//--------------------------------------------
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
//-----------------IR-------------------------
#include "EdIRIRD.hpp"
// Shaitan FastC {
#include "EdIRStrg.hpp"
//End Shaitan FastC }
//--------------------------------------------
#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
// Shaitan FastC {
#define M_SAVEENTRY1PARM(a,b) SCR_M_SvL0_SaveEntry(p_tdstFile, \
M_MAKECHAR(a), \
SCR_CC_C_Cfg_NoChar); \
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, \
SCR_EF_SvL0_Normal, \
1, \
M_MAKECHAR(b));
//End Shaitan FastC }
//****************************************************************
EdActors_EditorActorModel::EdActors_EditorActorModel(CPA_Family *pclFamily,
CPA_Actor *pclActor)
:EdActors_EditorActor(EDCAR_ACTOR_TYPE_MODEL)
{
//Creates a new 'motor actor' for the model
//This is an editor data !
CAR_EDIT_TDSTACTOR *p_tdstMotorActor = (CAR_EDIT_TDSTACTOR *)malloc(sizeof(CAR_EDIT_TDSTACTOR));
m_fn_vSetMotorActor(p_tdstMotorActor);
m_fn_vSetMSPointersToNULL();
//Creates datas
m_fn_vCreateActorMSDataList();
if ( pclFamily->fn_bIsAvailable() )
{
m_fn_vMinimalAllocation();
//Sets Initial and Current States
CPA_Action *pclInitialAction = pclFamily->mfn_p_oGetInitialAction();
CString csMsg = "Family '";
csMsg += pclFamily->GetName();
csMsg += "' has no initial Action. Check if your family directory is empty !";
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Creation of an Editor Model",
"EdActors_EditorActorModel::EdActors_EditorActorModel(...)",
E_ERROR_GRAVITY_FATAL,
csMsg);
ERROR_CHECK( pclInitialAction != NULL );
tdxHandleToState hInitialState = (tdxHandleToState)pclInitialAction->mfn_p_oGetDefaultState()->GetData();
fn_v3dDataSetInitialState(p_tdstMotorActor->h_3dData, hInitialState);
fn_v3dDataSetCurrentState(p_tdstMotorActor->h_3dData, hInitialState);
}
m_pclActor = pclActor;
//-----------------IR-------------------------
m_pclBrain=EDAC_fn_pclGetNewBrain(pclActor);
//--------------------------------------------
}
//****************************************************************
//"Empty" Constructor (for loading)
EdActors_EditorActorModel::EdActors_EditorActorModel(CPA_Actor *pclActor)
:EdActors_EditorActor(EDCAR_ACTOR_TYPE_MODEL)
{
//Creates a new 'motor actor' for the model
//This is an editor data !
CAR_EDIT_TDSTACTOR *p_tdstMotorActor = (CAR_EDIT_TDSTACTOR *)malloc(sizeof(CAR_EDIT_TDSTACTOR));
m_fn_vSetMotorActor(p_tdstMotorActor);
m_fn_vSetMSPointersToNULL();
//Creates datas
m_fn_vCreateActorMSDataList();
///////////////////////////////////////////
// Do not call m_fn_vMinimalAllocation() //
///////////////////////////////////////////
m_pclActor = pclActor;
//-----------------IR-------------------------
m_pclBrain=EDAC_fn_pclGetNewBrain(pclActor);
//--------------------------------------------
}
//****************************************************************
//Copy constructor
EdActors_EditorActorModel::EdActors_EditorActorModel(EdActors_EditorActorModel *_pclSourceModel,
CPA_Actor *_pclActor)
: EdActors_EditorActor(EDCAR_ACTOR_TYPE_MODEL)
{
m_pclActor = _pclActor;
_pclActor->m_fn_vSetEditorActor(this);
m_csBitmapName = _pclSourceModel->m_csBitmapName;
//Creates a new 'motor actor'
CAR_EDIT_TDSTACTOR *p_tdstMotorActor = (CAR_EDIT_TDSTACTOR *)malloc(sizeof(CAR_EDIT_TDSTACTOR));
m_fn_vSetMotorActor(p_tdstMotorActor);
m_fn_vSetMSPointersToNULL();
//Allocates MS if the corresponding MS in the Model is allocated
m_fn_vAllocateMSAsInModel(_pclSourceModel);
//Creates datas
m_fn_vCreateActorMSDataList();
//Updates datas with model's ones (including 'model link' state)
m_fn_vUpdateDatas(_pclSourceModel, TRUE, CTL_UPDATE_REASON__USE_USER_DEFINED_REASON, OAC_E_ur_InstanciatedFromModel);
//-----------------IR-------------------------
m_pclBrain=EDAC_fn_pclGetNewCopyOfBrain(_pclActor,_pclSourceModel->m_pclBrain);
//--------------------------------------------
}
//****************************************************************
EdActors_EditorActorModel::~EdActors_EditorActorModel()
{
//Deletes all MS and their Datas
m_fn_vDeleteAllMS();
//Deletes motor (structure) actor (this is merely an editor Data !!)
free(m_fn_ptdstGetMotorActor());
//-----------------IR-------------------------
EDAC_fn_vDeleteBrain(m_pclBrain);
//--------------------------------------------
}
//****************************************************************
//Updates all instances of this model because "pclSourceData" has changed
void EdActors_EditorActorModel::m_fn_vUpdateAllInstances( CTL_Editor_Data *_pclSourceData,
CTL_tdeUpdateReason _eReason,
long _lUserDefinedReason /*= 0*/)
{
// ERROR_ASSERT( _pclSourceData->m_pub_fn_bIsLinked() );
unsigned char ucModelListIndex = m_fn_ucGetCurrentMSListIndex();
EdActors_EditorActorInstance *pclCurrentInstance;
POSITION InstancesPos = m_clInstancesList.GetHeadPosition();
while ( InstancesPos != NULL )
{
pclCurrentInstance = m_clInstancesList.GetNext(InstancesPos);
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Updating All Instances of a Model, because a Data has changed",
"EdActors_EditorActorModel::m_fn_vUpdateAllInstances(...)",
E_ERROR_GRAVITY_WARNING,
"The Model and one of its Instances do no have the same number of AMS");
ERROR_ASSERT( pclCurrentInstance->m_clListOfAMSLists.m_fn_pclGetListFromIndex(ucModelListIndex)->GetCount()
== m_clListOfAMSLists.m_fn_pclGetListFromIndex(ucModelListIndex)->GetCount()
);
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Updating All Instances of a Model, because a Data has changed",
"EdActors_EditorActorModel::m_fn_vUpdateAllInstances(...)",
E_ERROR_GRAVITY_WARNING,
"The Data to be updated has not been found in the lists");
ERROR_VERIFY( !m_fn_bUpdateList(pclCurrentInstance->m_clListOfAMSLists.m_fn_pclGetListFromIndex(ucModelListIndex),
m_clListOfAMSLists.m_fn_pclGetListFromIndex(ucModelListIndex),
_pclSourceData,
_eReason,
_lUserDefinedReason)
);
}
}
//****************************************************************
//Updates all instances of this model because "pclSourceData" has changed
// returns TRUE if Data has not been found, i.e. search must continue in another list
BOOL EdActors_EditorActorModel::m_fn_bUpdateList(EdActors_ActorMiniStructureList *_pclDestList,
EdActors_ActorMiniStructureList *_pclSourceList,
CTL_Editor_Data *_pclSourceData,
CTL_tdeUpdateReason _eReason,
//CPA2 Stegaru Cristian 98/06/24
long _lUserDefinedReason /*= 0*/,
BOOL bUsePropagate/* = FALSE*/)
//End CPA2 Stegaru Cristian 98/06/24
{
//Gets the MS in which "pclSourceData" is
long lMSIndex = 0;
long lDataIndex;
BOOL bFound = FALSE;
POSITION DataPos;
POSITION MSPos = _pclSourceList->GetHeadPosition();
while ( (MSPos != NULL) && (!bFound) )
{
//Gets the Data list
CTL_Editor_DataList *pclDataList = (_pclSourceList->GetNext(MSPos))->m_pclDataList;
lDataIndex = 0;
DataPos = pclDataList->GetHeadPosition();
while ( ( DataPos != NULL ) && ( !bFound ) )
{
bFound = (pclDataList->GetNext(DataPos) == _pclSourceData);
if ( !bFound )
lDataIndex ++;
}
if ( !bFound )
lMSIndex ++;
}
//Sets the data for the current instance
if ( bFound )
{
//Gets the data
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Updating a Data of an Instance because the corresponding Data has changed in its Model",
"EdActors_EditorActorModel::m_fn_bUpdateList(...)",
E_ERROR_GRAVITY_WARNING,
"The Data can't be found");
ERROR_ASSERT( lMSIndex < _pclDestList->GetCount() );
MSPos = _pclDestList->FindIndex(lMSIndex);
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Updating a Data of an Instance because the corresponding Data has changed in its Model",
"EdActors_EditorActorModel::m_fn_bUpdateList(...)",
E_ERROR_GRAVITY_WARNING,
"The Data can't be found");
ERROR_ASSERT( MSPos != NULL );
EdActors_ActorMiniStructure *pclMS = _pclDestList->GetAt(MSPos);
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Updating a Data of an Instance because the corresponding Data has changed in its Model",
"EdActors_EditorActorModel::m_fn_bUpdateList(...)",
E_ERROR_GRAVITY_WARNING,
"The Data can't be found");
ERROR_ASSERT(lDataIndex < pclMS->m_pclDataList->GetCount());
DataPos = pclMS->m_pclDataList->FindIndex(lDataIndex);
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Updating a Data of an Instance because the corresponding Data has changed in its Model",
"EdActors_EditorActorModel::m_fn_bUpdateList(...)",
E_ERROR_GRAVITY_WARNING,
"The Data can't be found");
ERROR_ASSERT( DataPos != NULL );
CTL_Editor_Data *pclInstanceData = pclMS->m_pclDataList->GetAt(DataPos);
//CPA2 Stegaru Cristian 98/06/24
if (bUsePropagate)
{
if (pclMS->m_fn_bIsAllocated())
{
if (OAC_fn_bLinkAllowPropagation (pclInstanceData))
pclInstanceData->m_fn_vUpdateData(_pclSourceData, _eReason, _lUserDefinedReason);
}
else
{
MessageBox(NULL, "The mini-structure is not allocated in the instance, \nthe modification cannot be propagated",
"Propagation of a modification - WARNING !", MB_OK);
}
}
else if ( OAC_fn_bIsLinked(pclInstanceData) )
//Updates it...
pclInstanceData->m_fn_vUpdateData(_pclSourceData, _eReason, _lUserDefinedReason);
//End CPA2 Stegaru Cristian 98/06/24
}
return ( !bFound && (_pclSourceData->m_pub_fn_csGetDataName() != "FastC_Index") && (_pclSourceData->m_pub_fn_csGetDataName() != "FastC_Run"));
}
//****************************************************************
//Allocates MS and all corresponding MS in existing Instances
BOOL EdActors_EditorActorModel::m_fn_bAllocateMS( EdActors_ActorMiniStructure *pclAMS)
{
ERROR_ASSERT ( !(pclAMS->m_fn_bIsAllocated()) );
return pclAMS->m_fn_bAllocate(TRUE);
}
//****************************************************************
//Unallocates MS and all corresponding MS in existing Instances
BOOL EdActors_EditorActorModel::m_fn_bUnallocateMS(EdActors_ActorMiniStructure *pclAMS)
{
ERROR_ASSERT ( pclAMS->m_fn_bIsAllocated() );
return pclAMS->m_fn_bUnallocate();
}
//****************************************************************
void EdActors_EditorActorModel::m_fn_vAllocateMSInInstances(EdActors_ActorMiniStructure *pclAMS)
{
//Searches for the right list of MS
EdActors_ActorMiniStructureList *m_pclActorMSList = NULL;
char cGroupIndex = m_clListOfAMSLists.m_fn_cGetIndexFromAMS(pclAMS);
ERROR_ASSERT( cGroupIndex != -1 );
m_pclActorMSList = m_clListOfAMSLists.m_fn_pclGetListFromIndex(cGroupIndex);
//Searches for MS Index
BOOL bFound = FALSE;
long lModelMSIndex = 0;
POSITION ModelMSPos = m_pclActorMSList->GetHeadPosition();
while ( (ModelMSPos != NULL) && (!bFound) )
{
bFound = ( m_pclActorMSList->GetNext(ModelMSPos) == pclAMS );
if ( !bFound )
lModelMSIndex ++;
}
ERROR_ASSERT(bFound);
//Allocates in Instances
long lInstanceMSIndex;
POSITION InstanceMSPos;
EdActors_ActorMiniStructure *pclInstAMS;
EdActors_EditorActorInstance *pclInstance;
POSITION InstancesPos = m_clInstancesList.GetHeadPosition();
while ( InstancesPos != NULL )
{
pclInstance = m_clInstancesList.GetNext(InstancesPos);
pclInstance->m_fn_vSetCurrentMSListIndex(m_fn_ucGetCurrentMSListIndex());
lInstanceMSIndex = 0;
InstanceMSPos = pclInstance->m_pclActorCurrentMSList->GetHeadPosition();
while ( lInstanceMSIndex <= lModelMSIndex )
{
ERROR_ASSERT(InstanceMSPos != NULL);
pclInstAMS = pclInstance->m_pclActorCurrentMSList->GetNext(InstanceMSPos);
lInstanceMSIndex ++;
}
if ( !pclInstAMS->m_fn_bIsAllocated() )
{
if ( !pclInstAMS->m_bIsReallyAllocated )
pclInstAMS->m_fn_bAllocate();
else
pclInstAMS->m_fn_vUnrealAllocate();
//Notifies
pclInstance->m_pclActor->fn_vNotifySave();
}
}
}
//****************************************************************
void EdActors_EditorActorModel::m_fn_vUnallocateMSInInstances(EdActors_ActorMiniStructure *pclAMS)
{
//Searches for the right list of MS
EdActors_ActorMiniStructureList *m_pclActorMSList = NULL;
char cGroupIndex = m_clListOfAMSLists.m_fn_cGetIndexFromAMS(pclAMS);
ERROR_ASSERT( cGroupIndex != -1 );
m_pclActorMSList = m_clListOfAMSLists.m_fn_pclGetListFromIndex(cGroupIndex);
//Searches for MS Index
BOOL bFound = FALSE;
long lModelMSIndex = 0;
POSITION ModelMSPos = m_pclActorMSList->GetHeadPosition();
while ( (ModelMSPos != NULL) && (!bFound) )
{
bFound = ( m_pclActorMSList->GetNext(ModelMSPos) == pclAMS );
if ( !bFound )
lModelMSIndex ++;
}
ERROR_ASSERT(bFound);
//Allocates in Instances
long lInstanceMSIndex;
POSITION InstanceMSPos;
EdActors_ActorMiniStructure *pclInstAMS;
EdActors_EditorActorInstance *pclInstance;
POSITION InstancesPos = m_clInstancesList.GetHeadPosition();
while ( InstancesPos != NULL )
{
pclInstance = m_clInstancesList.GetNext(InstancesPos);
pclInstance->m_fn_vSetCurrentMSListIndex(m_fn_ucGetCurrentMSListIndex());
lInstanceMSIndex = 0;
InstanceMSPos = pclInstance->m_pclActorCurrentMSList->GetHeadPosition();
while ( lInstanceMSIndex <= lModelMSIndex )
{
ERROR_ASSERT(InstanceMSPos != NULL);
pclInstAMS = pclInstance->m_pclActorCurrentMSList->GetNext(InstanceMSPos);
lInstanceMSIndex ++;
}
if ( (pclInstAMS->m_fn_bIsAllocated()) && (pclInstAMS->m_fn_bCanBeUnallocated()) )
{
pclInstAMS->m_fn_bUnallocate();
//Notifies
pclInstance->m_pclActor->fn_vNotifySave();
}
}
}
//****************************************************************
//Links the Data to Instances
void EdActors_EditorActorModel::m_pri_fn_vLinkData(CTL_Editor_Data *pclData)
{
//Searches for the Data
BOOL bFound = FALSE;
long lModelMSIndex = 0;
long lDataIndex;
EdActors_ActorMiniStructure *pclAMS;
POSITION DataPos;
POSITION ModelMSPos = m_pclActorCurrentMSList->GetHeadPosition();
while ( (ModelMSPos != NULL) && (!bFound) )
{
pclAMS = m_pclActorCurrentMSList->GetNext(ModelMSPos);
lDataIndex = 0;
DataPos = pclAMS->m_pclDataList->GetHeadPosition();
while ( (DataPos != NULL) && (!bFound) )
{
bFound = ( pclAMS->m_pclDataList->GetNext(DataPos) == pclData);
if ( !bFound )
lDataIndex ++;
}
if ( !bFound )
lModelMSIndex ++;
}
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Linking data in Instances according to Model",
"EdActors_EditorActorModel::m_fn_vLinkData(...)",
E_ERROR_GRAVITY_INSTABLE,
"The given Data can't be found in Model's data list");
ERROR_ASSERT(bFound);
if ( bFound )
{
//Updates link state of Model data
// pclData->m_fn_bSetLink(eNot(pclData->m_fn_eGetLink()));
//Links in all existing Instances
long lInstanceMSIndex;
POSITION InstanceMSPos;
long lInstanceDataIndex;
POSITION InstanceDataPos;
EdActors_ActorMiniStructure *pclInstAMS;
EdActors_EditorActorInstance *pclInstance;
CTL_Editor_Data *pclCurrentData;
POSITION InstancesPos = m_clInstancesList.GetHeadPosition();
while ( InstancesPos != NULL )
{
pclInstance = m_clInstancesList.GetNext(InstancesPos);
char cOldListIndex = pclInstance->m_fn_ucGetCurrentMSListIndex();
pclInstance->m_fn_vSetCurrentMSListIndex(m_fn_ucGetCurrentMSListIndex());
lInstanceMSIndex = 0;
InstanceMSPos = pclInstance->m_pclActorCurrentMSList->GetHeadPosition();
while ( lInstanceMSIndex <= lModelMSIndex )
{
ERROR_ASSERT(InstanceMSPos != NULL);
pclInstAMS = pclInstance->m_pclActorCurrentMSList->GetNext(InstanceMSPos);
lInstanceMSIndex ++;
}
InstanceDataPos = pclInstAMS->m_pclDataList->GetHeadPosition();
lInstanceDataIndex = 0;
while ( lInstanceDataIndex <= lDataIndex )
{
ERROR_ASSERT(InstanceDataPos != NULL);
pclCurrentData = pclInstAMS->m_pclDataList->GetNext(InstanceDataPos);
lInstanceDataIndex ++;
}
//Sets link in Instance Data
// pclCurrentData->m_fn_bSetLink(pclData->m_fn_eGetLink());
//Immediatly updates Instance Data value with Model's one
pclCurrentData->m_fn_vUpdateData(pclData);
//Restores old List for Instance
pclInstance->m_fn_vSetCurrentMSListIndex(cOldListIndex);
}
}
}
//****************************************************************
CString EdActors_EditorActorModel::m_fn_csGetBitmapName()
{
return m_csBitmapName;
}
//****************************************************************
void EdActors_EditorActorModel::m_fn_vSetBitmapName(CString csNewBitmapName)
{
m_csBitmapName = csNewBitmapName;
}
//****************************************************************
short EdActors_EditorActorModel::m_fn_wGetRelatedInstancesCount()
{
return m_clInstancesList.GetCount();
}
//****************************************************************
//This function allocates the MS which must always be Allocated
void EdActors_EditorActorModel::m_fn_vMinimalAllocation()
{
EdActors_ActorMiniStructureList *pclCurrentAMSList;
EdActors_MiniStructureList *pclCurrentMSList;
POSITION AMSpos = m_clListOfAMSLists.GetHeadPosition();
POSITION MSpos = g_pclInterface->m_clDocument.m_clListOfMSLists.GetHeadPosition();
EdActors_ActorMiniStructure *pclAMS;
EdActors_MiniStructure *pclMS;
POSITION AMSSubPos;
POSITION MSSubPos;
unsigned long c_lI = 0;
while ( AMSpos != NULL )
{
ERROR_ASSERT( MSpos != NULL );
pclCurrentAMSList = m_clListOfAMSLists.GetNext(AMSpos);
pclCurrentMSList = g_pclInterface->m_clDocument.m_clListOfMSLists.GetNext(MSpos);
AMSSubPos = pclCurrentAMSList->GetHeadPosition();
MSSubPos = pclCurrentMSList->GetHeadPosition();
while ( AMSSubPos != NULL )
{
ERROR_ASSERT( MSSubPos != NULL );
pclAMS = pclCurrentAMSList->GetNext(AMSSubPos);
pclMS = pclCurrentMSList->GetNext(MSSubPos);
if ( !(pclMS->m_fn_bCanBeUnallocated()) )
pclAMS->m_fn_bAllocate();
}
c_lI ++;
}
}
//*************************************************************************
void EdActors_EditorActorModel::m_fn_vRemoveFromInstancesList(EdActors_EditorActorInstance *pclInstanceToRemove)
{
EdActors_EditorActorInstance *pclCurrentInstance;
BOOL bFound = FALSE;
POSITION pos = m_clInstancesList.GetHeadPosition();
POSITION KeepPos;
while ( (pos != NULL) && (!bFound) )
{
KeepPos = pos;
pclCurrentInstance = m_clInstancesList.GetNext(pos);
bFound = ( pclCurrentInstance == pclInstanceToRemove );
}
ERROR_ASSERT( bFound );
m_clInstancesList.RemoveAt(KeepPos);
}
//*************************************************************************
void EdActors_EditorActorModel::m_fn_vAddToInstancesList(EdActors_EditorActorInstance *pclInstanceToAdd)
{
m_clInstancesList.AddTail(pclInstanceToAdd);
}
//*************************************************************************
//Returns TRUE only if Data exists and belongs to an allocated MS
BOOL EdActors_EditorActorModel::m_fn_bDataBelongsToAnAllocatedMS(CString csDataName)
{
BOOL bReturn = FALSE;
CTL_Editor_Data *pclBaseData = m_fn_p_oFindDataByName(csDataName);
if ( pclBaseData != NULL )
bReturn = OAC_fn_pclGetParentAMSOfData(pclBaseData)->m_fn_bIsAllocated();
//else
//Data has not been found, so returns FALSE
return bReturn;
}
//*************************************************************************
//Updates all linked Data in given Instance, according to Model
void EdActors_EditorActorModel::m_pub_fn_vUpdateLinkedDataInInstance(CPA_Actor *_pclInstanceToUpdate)
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Updating Instance linked data according to Model",
"EdActors_EditorActorModel::m_pub_fn_vUpdateLinkedDataInInstance(...)",
E_ERROR_GRAVITY_INSTABLE,
"The given Actor is not an Instance");
ERROR_ASSERT( _pclInstanceToUpdate->m_fn_bIsAnInstance() );
_pclInstanceToUpdate->m_fn_pclGetEditorActor()->m_fn_vUpdateDatas(this, FALSE, CTL_UPDATE_REASON__USE_USER_DEFINED_REASON, OAC_E_ur_InstanciatedFromModel);
}
#if defined ( D_DoNotInstanciateIncompleteModels )
//****************************************************************
//checks that all datae handling object lists have a valid name list specified
BOOL EdActors_EditorActorModel::m_bAllListsAreSpecified()
{
short wMSIndex;
for
(//scan all lists of ministructures
wMSIndex = 0;
wMSIndex < sizeof(m_a_poMSLists) / sizeof(void *);
wMSIndex ++
)
{
EdActors_ActorMiniStructureList *p_oMSList = m_a_poMSLists[wMSIndex];
POSITION xMSPos = p_oMSList->GetHeadPosition();
while ( xMSPos ) //for each ministructure in the list
{
EdActors_ActorMiniStructure *p_oMS = p_oMSList->GetNext(xMSPos);
CTL_Editor_DataList *p_oDataList = &p_oMS->m_clDataList;
POSITION xDataPos = p_oDataList->GetHeadPosition();
while (xDataPos) //check each data ofthe current list
{
CTL_Editor_Data *p_oData = p_oDataList->GetNext(xDataPos);
if ( p_oData->m_tdeDataType == EDITOR_DATA_TYPE_OBJECTLIST )
{ //we care only about object lists
CPA_Editor_ObjectListData &r_oObjectListData = (CPA_Editor_ObjectListData &) *p_oData;
// if no name list exists in this data, we tell it...
if ( !r_oObjectListData.m_p_oNameList )
return FALSE;
}
}
}
}
return TRUE;
}
#endif /* D_DoNotInstanciateIncompleteModels */
//****************************************************************
void EdActors_EditorActorModel::m_pub_fn_vSetLink(CTL_Editor_Data *_pclSourceData,
BOOL _bMustLink)
{
m_pri_fn_vLinkData(_pclSourceData);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vUpdateInstances
// Date : 98/06/22
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void EdActors_EditorActorModel::mfn_vUpdateInstances (CTL_Editor_Data *_pclSourceData, int nReason/* = REASON_ALL_INSTANCES*/, CStringList *pInstanceNames/* = NULL*/)
{
unsigned char ucModelListIndex = m_fn_ucGetCurrentMSListIndex();
EdActors_EditorActorInstance *pclCurrentInstance;
POSITION InstancesPos = m_clInstancesList.GetHeadPosition();
while (InstancesPos != NULL)
{
pclCurrentInstance = m_clInstancesList.GetNext(InstancesPos);
ASSERT (pclCurrentInstance);
if (REASON_INSTANCES_IN_THE_LIST == nReason)
{
ASSERT (pInstanceNames);
CString csInstanceName = pclCurrentInstance->m_pclActor->GetName ();
BOOL bInstanceIsInTheList = FALSE;
POSITION pos = pInstanceNames->GetHeadPosition ();
while (pos)
{
const CString csName = pInstanceNames->GetNext (pos);
if (csName == csInstanceName)
{
bInstanceIsInTheList = TRUE;
break;
}
}
if (!bInstanceIsInTheList)
continue;
}
//treat all instances for REASON_ALL_INSTANCES == nReason
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Updating Instances of a Model, because the user propagate a value",
"EdActors_EditorActorModel::mfn_vUpdateInstances(...)",
E_ERROR_GRAVITY_WARNING,
"The Model and one of its Instances do no have the same number of AMS");
ERROR_ASSERT( pclCurrentInstance->m_clListOfAMSLists.m_fn_pclGetListFromIndex(ucModelListIndex)->GetCount()
== m_clListOfAMSLists.m_fn_pclGetListFromIndex(ucModelListIndex)->GetCount());
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Updating Instances of a Model, because the user propagate a value",
"EdActors_EditorActorModel::mfn_vUpdateInstances(...)",
E_ERROR_GRAVITY_WARNING,
"The Data to be updated has not been found in the lists");
ERROR_VERIFY( !m_fn_bUpdateList(pclCurrentInstance->m_clListOfAMSLists.m_fn_pclGetListFromIndex(ucModelListIndex),
m_clListOfAMSLists.m_fn_pclGetListFromIndex(ucModelListIndex),
_pclSourceData,
CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0, TRUE));
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vGetStandardInstances
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void EdActors_EditorActorModel::mfn_vGetStandardInstances (CTL_Editor_Data *pSourceData, CTL_Editor_Data *pModifiedData, CStringList &rlstStandardInstances)
{
if (!pSourceData || !pModifiedData)
return;
EdActors_EditorActorInstance *pclCurrentInstance;
POSITION InstancesPos = m_clInstancesList.GetHeadPosition();
while (InstancesPos != NULL)
{
pclCurrentInstance = m_clInstancesList.GetNext(InstancesPos);
ASSERT (pclCurrentInstance);
if (mfn_bIsAStandardInstance (pclCurrentInstance, pSourceData, pModifiedData))
rlstStandardInstances.AddTail (pclCurrentInstance->m_pclActor->GetName ());
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bIsAStandardInstance
// Date : 98/06/24
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EdActors_EditorActorModel::mfn_bIsAStandardInstance (EdActors_EditorActorInstance *pclInstance, CTL_Editor_Data *pSourceData, CTL_Editor_Data *pModifiedData)
{
ASSERT (pclInstance);
ASSERT (pModifiedData);
unsigned char ucModelListIndex = m_fn_ucGetCurrentMSListIndex();
EdActors_ActorMiniStructureList *pInstanceMSList = pclInstance->m_clListOfAMSLists.m_fn_pclGetListFromIndex(ucModelListIndex);
EdActors_ActorMiniStructureList *pModelMSList = m_clListOfAMSLists.m_fn_pclGetListFromIndex(ucModelListIndex);
if (!pInstanceMSList || !pModelMSList)
return FALSE;
//Gets the MS in which "pclSourceData" is
long lMSIndex = 0;
long lDataIndex;
BOOL bFound = FALSE;
POSITION DataPos;
POSITION MSPos = pModelMSList->GetHeadPosition();
while ( (MSPos != NULL) && (!bFound) )
{
//Gets the Data list
CTL_Editor_DataList *pclDataList = (pModelMSList->GetNext(MSPos))->m_pclDataList;
lDataIndex = 0;
DataPos = pclDataList->GetHeadPosition();
while ( ( DataPos != NULL ) && ( !bFound ) )
{
bFound = (pclDataList->GetNext(DataPos) == pSourceData);
if ( !bFound )
lDataIndex ++;
}
if ( !bFound )
lMSIndex ++;
}
//Sets the data for the current instance
if ( bFound )
{
//Gets the data
ASSERT (lMSIndex < pInstanceMSList->GetCount());
MSPos = pInstanceMSList->FindIndex (lMSIndex);
ASSERT (MSPos != NULL);
EdActors_ActorMiniStructure *pclMS = pInstanceMSList->GetAt (MSPos);
ASSERT (lDataIndex < pclMS->m_pclDataList->GetCount());
DataPos = pclMS->m_pclDataList->FindIndex(lDataIndex);
ASSERT( DataPos != NULL );
CTL_Editor_Data *pclInstanceData = pclMS->m_pclDataList->GetAt(DataPos);
ASSERT (pclInstanceData);
if (OAC_fn_bLinkAllowPropagation (pclInstanceData) && pclInstanceData->mfn_bEqualsModifiedDataOldValue (pModifiedData))
return TRUE;
}
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vGetAllInstances
// Date : 98/06/25
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void EdActors_EditorActorModel::mfn_vGetAllInstances (CStringList &rlstAllInstances)
{
EdActors_EditorActorInstance *pclCurrentInstance;
POSITION InstancesPos = m_clInstancesList.GetHeadPosition();
while (InstancesPos != NULL)
{
pclCurrentInstance = m_clInstancesList.GetNext(InstancesPos);
ASSERT (pclCurrentInstance);
rlstAllInstances.AddTail (pclCurrentInstance->m_pclActor->GetName ());
}
}
// Shaitan FastC {
//****************************************************************
void EdActors_EditorActorModel::m_pub_fn_vNotifyBrain (void)
{
// at loading time, do not notify !
if (m_pclActor->GetEditor()->GetInterface()->fn_bIsLoadingWorld())
return;
CString csFamilyName = m_pclActor->m_pub_fn_pclGetFamily()->GetName();
CString csModelName = m_pclActor->GetName();
CString csPathName = fn_szGetFamiliesDataPath();
csPathName += "\\" + csFamilyName + "\\"+ csModelName + "\\" + csModelName + ".ai";
SCR_fn_v_SvL1_RegisterNotify((char *) (LPCSTR) csPathName,
EdActors_EditorActorModel::m_fn_vSaveEngineAI,
this,
SCR_EA_Ntfy_RebuildSection);
}
/**********************************************************************************/
void EdActors_EditorActorModel::m_fn_vSaveEngineAI(SCR_tdst_File_Description *p_tdstFile,
char *p_szSectionName,
void *p_vData,
SCR_tde_Ntfy_Action eAction)
{
EdActors_EditorActorModel *pModel = (EdActors_EditorActorModel *)p_vData;
CPA_EdIR_Brain *pclBrain=pModel->m_pclBrain;
CPA_Actor *pclActor=pModel->m_pclActor;
CString csFamilyName=pclActor->m_pub_fn_pclGetFamily()->GetName();
CString csModelName=pclActor->GetName();
long CFast_bIsC ;
SCR_M_SvL0_SaveScriptFileHeader(p_tdstFile);
//Saves version number
SCR_M_SvL0_SaveComment(p_tdstFile,C_VERSION);
SCR_M_SvL0_SaveBlankLine(p_tdstFile);
//Computes date
SYSTEMTIME stSystemTime;
::GetLocalTime(&stSystemTime);
CTime cTime(stSystemTime);
CString csDate=cTime.Format("%A,%B,%d,%Y,%Hh%Mm");
CString csLine="Save date:"+csDate;
SCR_M_SvL0_SaveComment(p_tdstFile,M_MAKECHAR(csLine));
SCR_M_SvL0_SaveBlankLine(p_tdstFile);
SCR_M_SvL0_SaveBeginSection(p_tdstFile,
M_MAKECHAR(g_c_csAISectionName+":"),
SCR_CC_C_Cfg_EOL);
M_SAVEENTRY1PARM(g_c_csAIDecSectionName,
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIDecFileExtension);
M_SAVEENTRY1PARM(g_c_csAIRulSectionName,
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRulFileExtension);
M_SAVEENTRY1PARM(g_c_csAIRfxSectionName,
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRfxFileExtension);
if (!pclBrain->m_clListOfSubrs.IsEmpty ())
{
M_SAVEENTRY1PARM(g_c_csAISubrSectionName,
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAISubrFileExtension);
}
CFast_bIsC = pModel->m_fn_ptdstGetMotorActor()->h_Brain->p_stMind->p_stAIModel->CFast_bIsC ;
if ( CFast_bIsC ) {
M_SAVEENTRY1PARM(g_c_csAICrrSectionName,
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAICrrFileExtension);
M_SAVEENTRY1PARM( g_c_csAINodeSectionName,
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAINodeFileExtension );
}
CString csFast_IsC;
CString csFast_FunctionIndex;
csFast_IsC.Format("%ld", CFast_bIsC);
M_SAVEENTRY1PARM(g_c_csAIFastIsC_SectionName, csFast_IsC);
csFast_FunctionIndex.Format("%ld", pModel->m_fn_ptdstGetMotorActor()->h_Brain->p_stMind->p_stAIModel->CFast_lFunction);
M_SAVEENTRY1PARM(g_c_csAIFastFId_SectionName, csFast_FunctionIndex);
SCRIPT_vSaveEndSection(p_tdstFile);
}
//End Shaitan FastC }

View File

@@ -0,0 +1,288 @@
#include "StdAfx.h"
#include "ACP_Base.h"
#include "TAC.h"
#include "TFa.h"
#include "ITF.h"
#include "IncMEC.h"
#define D_State_Define
#include "IncGAM.h"
#undef D_State_Define
#include "GLI.h"
#include "GAM\MainChar.h"
#include "EDACDoc.hpp"
#include "EDACStrg.hpp"
#include "_AInterf.hpp"
#include "EDACGlob.hpp"
#include "EDACMISv.hpp"
#include "ErO.h"
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#define C_SAVE_CURRENT_POS 2
#define C_SAVE_INITIAL_POS 0
#define C_SAVE_POS C_SAVE_INITIAL_POS
//#define C_SAVE_POS C_SAVE_CURRENT_POS
/////////////////////////////////////
// Motor Levels : Saving functions //
/////////////////////////////////////
//*************************************************************************
// Motor Level Saving Function
//*************************************************************************
void EdActors_MyDocument::m_fn_vSaveMotorLevel(SCR_tdst_File_Description *p_tdstFile,
CString csSectionName,
SCR_tde_Ntfy_Action _eAction)
{
//Jumps to the end of the File, if Section does not exist
if ( _eAction == SCR_EA_Ntfy_AddSection )
SCR_fn_v_SvL1_ToEndSection(p_tdstFile);
//Gets info on the file
BOOL bLevelFile;
CString csLevelName;
CString csFileName = p_tdstFile->a_szFileName;
// short wIndex = csFileName.ReverseFind('\\');
CString csExtension(C_ScriptLevelSuffixe);
CString csRealExtension = csFileName.Right(csExtension.GetLength());
if ( csRealExtension.CompareNoCase(csExtension) == 0 )
bLevelFile = TRUE;
else
bLevelFile = FALSE;
CString csCurrentLine;
//Extracts Actors name from Section
//(this is the name of the Actor which caused this Notification to be raised)
CString csActorName = csSectionName;
short wIndex = csActorName.ReverseFind(':');
ERROR_ASSERT( wIndex != -1 );
csActorName = csActorName.Right(csActorName.GetLength() - wIndex - 1);
BOOL bMustSaveThisOne;
BOOL bActorFound = FALSE;
CPA_Actor *pclCurrentActor;
HIE_tdxHandleToSuperObject h_MotorActorSO;
CPA_BaseObjectList *pclConcernedList = ( bLevelFile ) ? &(g_pclInterface->m_clDocument.m_clInstancesList)
: &(g_pclInterface->m_clDocument.m_clAlwaysList);
Position pos = pclConcernedList->GetHeadPosition();
while ( ( pos != 0 ) && ( !bActorFound ) )
{
//Gets the Actor
pclCurrentActor = (CPA_Actor *)pclConcernedList->GetNext(pos);
h_MotorActorSO = pclCurrentActor->m_pub_fn_hGetMotorSuperObject();
bMustSaveThisOne = ( HIE_fn_ulGetSuperObjectType(h_MotorActorSO) == HIE_C_ulActor )
&& ( ( (bLevelFile) && (!pclCurrentActor->m_fn_bIsAnAlways()) )
|| ( (!bLevelFile) && (pclCurrentActor->m_fn_bIsAnAlways()) )
);
if ( bMustSaveThisOne )
{
bActorFound = ( csActorName.Compare(pclCurrentActor->GetName()) == 0 );
if ( bActorFound )
{
CString csAction = bLevelFile ? C_SectionLevelCharacters : C_SectionLevelAlways;
csCurrentLine.Format("%s:%s", csAction,
pclCurrentActor->GetName());
if /*( MC_fn_ucIsCharacterInMainCharacterList(h_MotorActorSO) ) */
((*fn_p_ulStdGameGetCustomBitsInit(M_GetMSHandle(h_MotorActorSO,StandardGame)))&GAM_C_CustBitRayman)
{
SCR_M_SvL0_SaveBeginSection(p_tdstFile, M_MAKECHAR(csCurrentLine), SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, SCR_EF_SvL0_Normal, 2, C_LevelPrincipalCharacter, C_LevelCharacterLauchingSounds);
}
else if ( h_MotorActorSO == g_stEngineStructure.h_StdCamCaracter )
{
SCR_M_SvL0_SaveBeginSection(p_tdstFile, M_MAKECHAR(csCurrentLine), SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, SCR_EF_SvL0_Normal, 1, C_LevelStandardCamera);
}
else
{
SCR_M_SvL0_SaveBeginSection(p_tdstFile, M_MAKECHAR(csCurrentLine), SCR_CC_C_Cfg_EOL);
}
//*** Link character ***
SCR_M_SvL0_SaveEntry(p_tdstFile, C_LevelLinkCharacters, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, SCR_EF_SvL0_Normal, 1,
M_MAKECHAR(pclCurrentActor->GetReferencedSectionName()));
if ( bLevelFile )
{
// ANNECY MT - 19/11/98 {
//*** In All SubMaps ??? ***
if ( pclCurrentActor -> m_pub_fn_bIsInAllSubMaps() )
{
SCR_M_SvL0_SaveEntry(p_tdstFile, C_LevelCharacterIsInAllSubmap, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, SCR_EF_SvL0_Normal, 1, "");
}
// END ANNECY MT }
//*** character's positions *** (CURRENT Positions)
SCR_M_SvL0_SaveEntry(p_tdstFile,C_LevelCharacterMatrixTranslation,SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, SCR_EF_SvL0_Scanf,4,
"%f,%f,%f",
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 0,0,0),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 0,0,1),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 0,0,2)
);
SCR_M_SvL0_SaveEntry(p_tdstFile,C_LevelCharacterMatrixRotation,SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, SCR_EF_SvL0_Scanf,10,
"%f,%f,%f,%f,%f,%f,%f,%f,%f",
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 1,0,0),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 1,0,1),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 1,0,2),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 1,1,0),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 1,1,1),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 1,1,2),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 1,2,0),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 1,2,1),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 1,2,2)
);
SCR_M_SvL0_SaveEntry(p_tdstFile,C_LevelCharacterMatrixScale,SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, SCR_EF_SvL0_Scanf,10,
"%f,%f,%f,%f,%f,%f,%f,%f,%f",
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 2,0,0),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 2,0,1),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 2,0,2),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 2,1,0),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 2,1,1),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 2,1,2),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 2,2,0),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 2,2,1),
fn_v3dDataGetMatrixElement(M_GetMSHandle(h_MotorActorSO,3dData),C_SAVE_POS, 2,2,2)
);
}
//*** Always Active ***
if ( (!pclCurrentActor->m_fn_bIsAnAlways()) /*&& (!pclCurrentActor->m_fn_bIsTheWorldActor())*/ )
if ( fn_bGetIfCharacterIsInAlwaysActiveCharacterList(h_MotorActorSO) )
{
SCR_M_SvL0_SaveEntry(p_tdstFile, C_LevelCharacterIsAlwaysActive, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, SCR_EF_SvL0_Normal, 1, "");
}
//ANNECY Shaitan SPOFlags 19/02/98
//*** SPO Flags ***
unsigned long ulFlags = HIE_fn_SO_ulGetFlags(pclCurrentActor->m_pub_fn_pclGetSuperObject()->GetStruct());
SCR_M_SvL0_SaveEntry(p_tdstFile,C_LevelCharacterFlags,SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, SCR_EF_SvL0_Scanf,1, "%d", ulFlags);
//ENDANNECY Shaitan SPOFlags
//ANNECY Shaitan Transparency (26/03/98) {
//*** Transparency ***
float fTransparency = HIE_fn_fGetSuperObjectTransparenceLevel(pclCurrentActor->m_pub_fn_pclGetSuperObject()->GetStruct());
SCR_M_SvL0_SaveEntry(p_tdstFile,C_LevelCharacterTransparency,SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, SCR_EF_SvL0_Scanf,1, "%f", fTransparency);
//ENDANNECY Shaitan Transparency }
SCR_M_SvL0_SaveEndSection(p_tdstFile, SCR_CC_C_Cfg_EOL);
}
}
}
EDACTORS_fn_vGiveProgressInfo("Motor Level saved by Actors Editor ...", -1);
}
////////////////////////////////////////
// Motor Instances : Saving functions //
////////////////////////////////////////
//*************************************************************************
// Motor Instances Saving Function
//*************************************************************************
void EdActors_MyDocument::m_fn_vSaveMotorInstance(SCR_tdst_File_Description *p_tdstFile,
CPA_Actor *p_clActor)
{
//Saves Scripts header
SCR_M_SvL0_SaveScriptFileHeader(p_tdstFile);
//Actors Editor header
CString csNextAndPreviousLine = "+++++++++++++++++++++++++++++++++++++++++++";
CString csCurrentLine = "+ Actors Editor +";
SCR_M_SvL0_SaveComment(p_tdstFile, M_MAKECHAR(csNextAndPreviousLine));
SCR_M_SvL0_SaveComment(p_tdstFile, M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveComment(p_tdstFile, M_MAKECHAR(csNextAndPreviousLine));
csCurrentLine = "+ Version " + g_pclInterface->m_fn_csGetEditorVersion() + " +";
SCR_M_SvL0_SaveComment(p_tdstFile, M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveBlankLine(p_tdstFile);
//Computes date
SYSTEMTIME stSystemTime;
::GetLocalTime(&stSystemTime);
CTime cTime(stSystemTime);
CString csDate = cTime.Format( "%A, %B %d, %Y, %Hh%Mm ");
csCurrentLine = " Save date : " + csDate;
SCR_M_SvL0_SaveComment(p_tdstFile, M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveComment(p_tdstFile, M_MAKECHAR(csNextAndPreviousLine));
SCR_M_SvL0_SaveBlankLine(p_tdstFile);
csCurrentLine.Format("########### Actor %s ###########", p_clActor->GetName());
csNextAndPreviousLine = "######################";
while ( csNextAndPreviousLine.GetLength() < csCurrentLine.GetLength() )
csNextAndPreviousLine += '#';
SCR_M_SvL0_SaveComment(p_tdstFile, M_MAKECHAR(csNextAndPreviousLine));
SCR_M_SvL0_SaveComment(p_tdstFile, M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveComment(p_tdstFile, M_MAKECHAR(csNextAndPreviousLine));
SCR_M_SvL0_SaveBlankLine(p_tdstFile);
//Begins section
csCurrentLine = CString(C_SectionOneCharacters) + ':' + p_clActor->GetName();
SCR_M_SvL0_SaveBeginSection(p_tdstFile,
M_MAKECHAR(csCurrentLine),
SCR_CC_C_Cfg_EOL);
//Saves all MS
m_fn_vSaveAllMSOfMotorInstance(p_tdstFile, p_clActor);
//End section
SCR_M_SvL0_SaveEndSection(p_tdstFile, SCR_CC_C_Cfg_EOL);
}
//*************************************************************************
void EdActors_MyDocument::m_fn_vSaveAllMSOfMotorInstance( SCR_tdst_File_Description *p_tdstFile,
CPA_Actor *p_clActor)
{
struct tdstEngineObject_ *p_tdstObject = (struct tdstEngineObject_ *)p_clActor->GetData();
//Saves all MS
///////////////////////////////////////
// BE CAREFUL : Order is important ! //
///////////////////////////////////////
ED_ACTORS_fn_v3dDataSaveMiniStructure(p_tdstFile, p_tdstObject);
ED_ACTORS_fn_vStdGameSaveMiniStructure(p_tdstFile, p_tdstObject);
ED_ACTORS_fn_vBrainSaveMiniStructure(p_clActor,p_tdstFile, p_tdstObject);
ED_ACTORS_fn_vDynamSaveMiniStructure(p_tdstFile, p_tdstObject);
ED_ACTORS_fn_vCineinfoSaveMiniStructure(p_tdstFile, p_tdstObject);
ED_ACTORS_fn_vCollSetSaveMiniStructure(p_tdstFile, p_tdstObject);
ED_ACTORS_fn_vSectInfoSaveMiniStructure(p_tdstFile, p_tdstObject);
//ANNECY BBB 20/10/97 {
ED_ACTORS_fn_vAnimEffectSaveMiniStructure(p_tdstFile, p_tdstObject);
//ENDANNECY BBB 20/10/97 }
ED_ACTORS_fn_vMicroSaveMiniStructure(p_tdstFile, p_tdstObject);
ED_ACTORS_fn_vMSWaySaveMiniStructure(p_tdstFile, p_tdstObject);
ED_ACTORS_fn_vLightSaveMiniStructure(p_tdstFile, p_tdstObject);
ED_ACTORS_fn_vPrtSourceSaveMiniStructure(p_tdstFile, p_tdstObject);
ED_ACTORS_fn_vSoundSaveMiniStructure(p_tdstFile, p_tdstObject);
// CHINA QZY (MT) 26/02/98 {
ED_ACTORS_fn_vMagnetSaveMiniStructure(p_tdstFile, p_tdstObject);
// CHINA QZY }
}

View File

@@ -0,0 +1,318 @@
// Implementation file for the definition of a characteristic base type
////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EDACQuer.hpp"
#include "_AInterf.hpp"
#include "Defines.hpp"
#include "x:\cpa\main\inc\_EditID.h"
#include "acp_base.h"
#include "incITF.h"
//-----------------IR-------------------------
#include "ai_intf.hpp"
//--------------------------------------------
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
///////////////////////////
// Designer Variable List
///////////////////////////
//************************************************************************
CPA_EdIR_DesignerVariableList *EDAC_fn_pclGetNewDesignerVariableList()
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
return (CPA_EdIR_DesignerVariableList *)pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_GetNewDesignerVariableList,0);
}
else
{
return NULL;
}
}
//************************************************************************
void EDAC_fn_vDeleteDesignerVariableList(CPA_EdIR_DesignerVariableList *pclListOfDesignerVariables)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_DeleteDesignerVariableList,(long)pclListOfDesignerVariables);
}
}
///////////////////////////
// Designer Variable View
///////////////////////////
//************************************************************************
void EDAC_fn_vDesignerVariableView_UpdateDisplayWithValues(CPA_EdIR_DesignerVariablesView *pclDesignerVariableView,
CTL_Editor_DataList *pclDataList)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
tdstActorsIACom stCom;
stCom.pvThis=pclDesignerVariableView;
stCom.pvData=pclDataList;
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_DesignerVariableView_UpdateDisplayWithValues,(long)(&stCom));
}
}
//************************************************************************
void EDAC_fn_vDesignerVariableView_UpdateDisplay(CPA_EdIR_DesignerVariablesView *pclDesignerVariableView)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_DesignerVariableView_UpdateDisplay,(long)pclDesignerVariableView);
}
}
//************************************************************************
void EDAC_fn_vDesignerVariableView_UpdateState(CPA_EdIR_DesignerVariablesView *pclDesignerVariableView, BOOL bHide)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
if (bHide)
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_DesignerVariableView_HideVariables,(long)pclDesignerVariableView);
else
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_DesignerVariableView_ShowVariables,(long)pclDesignerVariableView);
}
}
//************************************************************************
void EDAC_fn_vDesignerVariableView_UpdateControls(CPA_EdIR_DesignerVariablesView *pclDesignerVariableView,
CTL_Editor_ControlList *pclControlList)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
tdstActorsIACom stCom;
stCom.pvThis=pclDesignerVariableView;
stCom.pvData=pclControlList;
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_DesignerVariableView_UpdateControls,(long)(&stCom));
}
}
//************************************************************************
long EDAC_fn_lDesignerVariableView_GetOldHeight(CPA_EdIR_DesignerVariablesView *pclDesignerVariableView)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
return pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_DesignerVariableView_GetOldHeight,(long)pclDesignerVariableView);
}
else
{
return -1;
}
}
//************************************************************************
void EDAC_fn_vDesignerVariableView_SetOldHeight(CPA_EdIR_DesignerVariablesView *pclDesignerVariableView,
long lHeight)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
tdstActorsIACom stCom;
stCom.pvThis=pclDesignerVariableView;
stCom.lData=lHeight;
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_DesignerVariableView_SetOldHeight,(long)(&stCom));
}
}
//************************************************************************
CRuntimeClass *EDAC_fn_pclDesignerVariableView_GetRuntimeClass()
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
return (CRuntimeClass *)pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_DesignerVariableView_GetRuntimeClass,0);
}
else
{
return NULL;
}
}
///////////////////////////
// Brain
///////////////////////////
//************************************************************************
CPA_EdIR_Brain *EDAC_fn_pclGetNewBrain(CPA_Actor *pclModel)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
return (CPA_EdIR_Brain *)pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_GetNewIA,(long)pclModel);
}
else
{
return NULL;
}
}
//************************************************************************
CPA_EdIR_Brain *EDAC_fn_pclGetNewCopyOfBrain(CPA_Actor *pclModel,CPA_EdIR_Brain *pclBrain)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
tdstActorsIACom stCom;
stCom.pvThis=pclBrain;
stCom.pvData=pclModel;
return (CPA_EdIR_Brain *)pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_GetNewCopyOfIA,(long)(&stCom));
}
else
{
return NULL;
}
}
//************************************************************************
void EDAC_fn_vDeleteBrain(CPA_EdIR_Brain *pclBrain)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_DeleteIA,(long)pclBrain);
}
}
//************************************************************************
void EDAC_fn_vShowBrain(CPA_EdIR_Brain *pclBrain)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_ShowIA,(long)pclBrain);
}
}
//************************************************************************
void EDAC_fn_vLoadBrain(CPA_Actor *pclModel,CString csName)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
tdstActorsIACom stCom;
stCom.pvThis=pclModel;
stCom.pvData=&csName;
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_LoadIA,(long)(&stCom));
}
}
//************************************************************************
// Shaitan => optimisation lists in the level
void EDAC_fn_vProcessBrain(CPA_Actor *pclModel,CPA_Actor *pclInstance, BOOL bUpdateReferences)
// End Shaitan => optimisation lists in the level
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
tdstActorsIACom stCom;
stCom.pvThis=pclModel;
stCom.pvData=pclInstance;
// Shaitan => optimisation lists in the level
pclIADLL->OnQueryAction(g_pclInterface, (bUpdateReferences) ? C_uiAI_UpdateAndProcessIA : C_uiAI_ProcessIA,(long)(&stCom));
// End Shaitan => optimisation lists in the level
}
}
//************************************************************************
void EDAC_fn_vSaveInitValuesInBrainMS(CPA_Actor *pclInstance,struct SCR_tdst_File_Description_ *pstFile)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
tdstActorsIACom stCom;
stCom.pvThis=pclInstance;
stCom.pvData=pstFile;
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_SaveInitValuesInBrainMS,(long)(&stCom));
}
}
//************************************************************************
BOOL EDAC_fn_bMustSaveAIEntryInModel(CPA_EdIR_Brain *pclBrain)
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
return (BOOL)pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_MustSaveAIEntryInModel,(long)pclBrain);
}
else
{
return FALSE;
}
}
///////////////////////////
// AI Editor
///////////////////////////
//************************************************************************
void EDAC_fn_vShowAIEditor()
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_ShowEditor,0);
}
}
//************************************************************************
void EDAC_fn_vHideAIEditor()
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_HideEditor,0);
}
}
//************************************************************************
void EDAC_fn_vOnLostFocusAIEditor()
{
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
if(pclIADLL!=NULL)
{
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_HasLostFocus,0);
}
}

View File

@@ -0,0 +1,484 @@
// To Save Models
//
// YB
/////////////////////////////////////
#include "StdAfx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "TAC.h"
#include "TFa.h"
#include "IncMEC.h"
#define D_State_Define
#include "IncGAM.h"
#undef D_State_Define
#include "GLI.h"
#include "EDACInst.hpp"
#include "EDACModl.hpp"
#include "EDACDgIf.hpp"
#include "EDACStrg.hpp"
#include "Defines.hpp"
//-----------------IR-------------------------
#include "EdIRStrg.hpp"
#include "EdIRBeEn.hpp"
#include "EdIRBeHa.hpp"
#include "EDACQuer.hpp"
//--------------------------------------------
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
//-----------------IR-------------------------
#include "EdIRIRD.hpp"
//--------------------------------------------
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
BOOL OAC_fn_bSaveData(SCRIPT_tdstSaveFile *p_tdstScriptFile,
CTL_Editor_Data *_pclData);
////////////////////////////////
// Models : Saving functions //
////////////////////////////////
//*************************************************************************
// Model Saving Function
//*************************************************************************
void EdActors_EditorActorModel::m_fn_vSaveActor(SCR_tdst_File_Description *p_stFile)
{
CString csCurrentLine;
CString csNextAndPreviousLine;
//Scripts header
SCR_M_SvL0_SaveScriptFileHeader(p_stFile);
//Actors Editor header
csNextAndPreviousLine = "+++++++++++++++++++++++++++++++++++++++++++";
csCurrentLine = "+ Actors Editor +";
SCR_M_SvL0_SaveComment(p_stFile, M_MAKECHAR(csNextAndPreviousLine));
SCR_M_SvL0_SaveComment(p_stFile, M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveComment(p_stFile, M_MAKECHAR(csNextAndPreviousLine));
csCurrentLine = "+ Version " + g_pclInterface->m_fn_csGetEditorVersion() + " +";
SCR_M_SvL0_SaveComment(p_stFile, M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveBlankLine(p_stFile);
//Computes date
SYSTEMTIME stSystemTime;
::GetLocalTime(&stSystemTime);
CTime cTime(stSystemTime);
CString csDate = cTime.Format( "%A, %B %d, %Y, %Hh%Mm ");
csCurrentLine = " Save date : " + csDate;
SCR_M_SvL0_SaveComment(p_stFile, M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveComment(p_stFile, M_MAKECHAR(csNextAndPreviousLine));
SCR_M_SvL0_SaveBlankLine(p_stFile);
csCurrentLine.Format("########### Model %s ###########", m_fn_csGetActorName());
csNextAndPreviousLine = "######################";
while ( csNextAndPreviousLine.GetLength() < csCurrentLine.GetLength() )
csNextAndPreviousLine += '#';
SCR_M_SvL0_SaveComment(p_stFile, M_MAKECHAR(csNextAndPreviousLine));
SCR_M_SvL0_SaveComment(p_stFile, M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveComment(p_stFile, M_MAKECHAR(csNextAndPreviousLine));
SCR_M_SvL0_SaveBlankLine(p_stFile);
csCurrentLine.Format("%s:%s", g_c_csActorScriptModelSectionName,
m_fn_csGetActorName());
SCR_M_SvL0_SaveBeginSection(p_stFile,
M_MAKECHAR(csCurrentLine),
SCR_CC_C_Cfg_EOL);
SCR_M_SvL0_SaveBlankLine(p_stFile);
//---------------------------------------------------------------------
//Saves Model type
SCR_M_SvL0_SaveEntry( p_stFile,
M_MAKECHAR(g_c_csModelType),
SCR_CC_C_Cfg_NoChar);
if ( m_pclActor->m_fn_bIsAGenDoor() )
csCurrentLine = g_c_csModelTypeGenDoor;
else
csCurrentLine = g_c_csModelTypeActor;
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile,
SCR_EF_SvL0_Scanf,
2,
"%s",
M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveBlankLine(p_stFile);
//---------------------------------------------------------------------
//Saves Bitmap Name
if ( m_fn_csGetBitmapName().IsEmpty() )
csCurrentLine = "<< Unknown Bitmap name >>";
else
csCurrentLine = M_MAKECHAR(m_fn_csGetBitmapName());
SCR_M_SvL0_SaveEntry( p_stFile,
M_MAKECHAR(g_c_csBitmapName),
SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile,
SCR_EF_SvL0_Scanf,
2,
"%s",
M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveBlankLine(p_stFile);
//---------------------------------------------------------------------
//Saves base Family
if ( m_pclActor->m_pub_fn_pclGetFamily() != NULL )
csCurrentLine = m_pclActor->m_pub_fn_pclGetFamily()->GetName();
else
csCurrentLine = "<< Unknown Family name >>";
SCR_M_SvL0_SaveEntry( p_stFile,
M_MAKECHAR(g_c_csActorFamily),
SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile,
SCR_EF_SvL0_Scanf,
2,
"%s",
M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveBlankLine(p_stFile);
//---------------------------------------------------------------------
//Saves AI Model Name
//-----------------IR-------------------------
if(EDAC_fn_bMustSaveAIEntryInModel(m_pclBrain))
{
CString csBrainSectionEntry;
csBrainSectionEntry= m_pclActor->m_pub_fn_pclGetFamily()->GetName()+"\\";
csBrainSectionEntry+=m_fn_csGetActorName()+"\\";
csBrainSectionEntry+=m_fn_csGetActorName();
SCR_M_SvL0_SaveEntry( p_stFile,
M_MAKECHAR(g_c_csBrainName),
SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile,
SCR_EF_SvL0_Scanf,
2,
"%s",
M_MAKECHAR(csBrainSectionEntry));
SCR_M_SvL0_SaveBlankLine(p_stFile);
}
//BEGIN ROMTEAM Cristi Petrescu 98-06-
//---------------------------------------------------------------------
//Saves AI Private variable status
SCR_M_SvL0_SaveEntry( p_stFile,
M_MAKECHAR(g_c_csShowPrivateVariable),
SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile,
SCR_EF_SvL0_Scanf,
2,
"%d",
(int) m_pclBrain -> m_bShowPrivateVariable);
SCR_M_SvL0_SaveBlankLine(p_stFile);
//END ROMTEAM Cristi Petrescu 98-06-
//--------------------------------------------
//---------------------------------------------------------------------
//Saves all MS
csCurrentLine = "___________________ Group Separator ___________________";
BOOL bReturn = TRUE;
EdActors_ActorMiniStructureList *pclCurrentGroup;
POSITION pos = m_clListOfAMSLists.GetHeadPosition();
while ( (pos != NULL) && (bReturn) )
{
SCR_M_SvL0_SaveComment(p_stFile, M_MAKECHAR(csCurrentLine));
SCR_M_SvL0_SaveBlankLine(p_stFile);
pclCurrentGroup = m_clListOfAMSLists.GetNext(pos);
bReturn = m_fn_bSaveMSList(p_stFile, pclCurrentGroup);
}
if ( !bReturn )
{
CString csMessage = "There was a problem to save Editor Actor Model\ncalled ' ";
csMessage += m_fn_csGetActorName() + " ',\nin the MS save process, in the group :\n";
csMessage += pclCurrentGroup->m_fn_csGetGroupScriptName();
EdActors_InformationDialog dial(&g_oBaseFrame, csMessage);
dial.DoModal();
}
//Closes file's main section
SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
}
////////////////////////////////
// Actors : Saving functions //
////////////////////////////////
//*************************************************************************
BOOL EdActors_EditorActor::m_fn_bSaveMSList(SCRIPT_tdstSaveFile *p_tdstScriptFile,
EdActors_ActorMiniStructureList *mclMSList)
{
BOOL bReturn = TRUE;
POSITION pos = mclMSList->GetHeadPosition();
while ( (pos != NULL) && (bReturn) )
{
bReturn = mclMSList->GetNext(pos)->m_fn_bSaveMS(p_tdstScriptFile, mclMSList->m_fn_csGetGroupScriptName());
SCR_M_SvL0_SaveBlankLine(p_tdstScriptFile);
}
return bReturn;
}
//////////////////////////
// MS : Saving function //
//////////////////////////
//*************************************************************************
BOOL EdActors_ActorMiniStructure::m_fn_bSaveMS(SCRIPT_tdstSaveFile *p_tdstScriptFile,
CString csGroupScriptName)
{
BOOL bReturn = TRUE;
char *a_szParams_3;
if ( m_fn_bIsAllocated() )
a_szParams_3 = (char *)LPCTSTR(g_c_csAllocatedMS);
else
a_szParams_3 = (char *)LPCTSTR(g_c_csNotAllocatedMS);
CString csSection;
csSection.Format("%s:%s(%s,%s)", g_c_csMSSection,
m_fn_csGetScriptName(),
csGroupScriptName,
a_szParams_3);
SCR_M_SvL0_SaveBeginSection(p_tdstScriptFile,
M_MAKECHAR(csSection),
SCR_CC_C_Cfg_EOL);
if ( m_fn_bIsAllocated() )
{
POSITION pos = m_pclDataList->GetHeadPosition();
while ( pos != NULL )
OAC_fn_bSaveData(p_tdstScriptFile, m_pclDataList->GetNext(pos));
}
//Closes MS Section
SCRIPT_vSaveEndSection(p_tdstScriptFile);
return bReturn;
}
//////////////////////////////////////////
// Datas : Saving & Loading functions //
//////////////////////////////////////////
//************************************************************************
BOOL OAC_fn_bSaveData(SCRIPT_tdstSaveFile *p_tdstScriptFile,
CTL_Editor_Data *_pclData)
{
BOOL bReturn = TRUE;
//Saves Data
////////////////////////////
char *a_szParams[64]; //Limit to 64 parameters !!!
////////////////////////////
switch ( OAC_fn_tdeGetLink(_pclData) )
{
case OAC_LINK_MODE__LINKED:
a_szParams[0] = (char *)LPCTSTR(g_c_csLinkedField);
break;
case OAC_LINK_MODE__NOT_LINKED:
a_szParams[0] = (char *)LPCTSTR(g_c_csNotLinkedField);
break;
case OAC_LINK_MODE__ALWAYS_LINKED:
a_szParams[0] = (char *)LPCTSTR(g_c_csAlwaysLinkedField);
break;
case OAC_LINK_MODE__NEVER_LINKED:
a_szParams[0] = (char *)LPCTSTR(g_c_csNeverLinkedField);
break;
default:
bReturn = FALSE;
break;
}
CStringList *pcslParams = _pclData->m_fn_pcslFormatDataValueString();
long c_lI = 1; //Param #0 is reserved !!
POSITION pos = pcslParams->GetHeadPosition();
while ( pos != NULL )
{
a_szParams[c_lI] = (char *)LPCTSTR(pcslParams->GetNext(pos));
c_lI ++;
}
SCR_M_SvL0_SaveEntry( p_tdstScriptFile,
M_MAKECHAR(_pclData->m_pub_fn_csGetDataName()),
SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_AP(p_tdstScriptFile,
SCR_EF_SvL0_Normal,
c_lI,
a_szParams);
return bReturn;
}
// Shaitan => state list in the level
//////////////////////
// Save State List //
//////////////////////
//************************************************************************
void EdActors_MyDocument::s_m_fn_vCallBackSaveStateList (SCR_tdst_File_Description *_p_stFile,
char *_p_szSectionName,
void *_p_vData,
SCR_tde_Ntfy_Action _eAction)
{
CPA_Family *pFamily = (CPA_Family *) _p_vData;
CPA_Action *pAction;
CPA_State *pState;
POSITION pos, pos1;
char szSectionName[SCR_CV_ui_Cfg_MaxLenName];
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
// save begin section
SCR_fn_v_RdL0_ComputeSectionName(szSectionName, NULL, C_SectionCreateListOfState, "");
SCR_M_SvL0_SaveBeginSection(_p_stFile, szSectionName, SCR_CC_C_Cfg_EOL);
// for each used action of the family
pos = pFamily->m_oListOfUsedActions.GetHeadPosition();
while (pos)
{
pAction = pFamily->m_oListOfUsedActions.GetNext(pos);
// for each state of the action
pos1 = pAction->m_oListOfStates.GetHeadPosition();
while (pos1)
{
pState = pAction->m_oListOfStates.GetNext(pos1);
// save entry
SCR_M_SvL0_SaveEntry(_p_stFile, C_Entry_State, SCR_CC_C_Cfg_NoChar);
// compute section name for state
sprintf(szFileName, "%s\\%s.sta", pFamily->GetName(), pFamily->GetName());
SCR_fn_v_RdL0_ComputeSectionName(szSectionName, szFileName, C_SectionCreateNewState, (char *) (LPCSTR) pState->GetName());
// save parameter
SCR_fn_v_SvL0_SaveParameters_MP(_p_stFile, SCR_EF_SvL0_Scanf, 1, "%s", szSectionName);
}
}
SCR_M_SvL0_SaveEndSection(_p_stFile, SCR_CC_C_Cfg_EOL);
}
// End Shaitan => state list in the level
// Shaitan => module list in the level
//////////////////////
// Save PO List //
//////////////////////
//************************************************************************
void EdActors_MyDocument::s_m_fn_vCallBackSavePOList (SCR_tdst_File_Description *_p_stFile,
char *_p_szSectionName,
void *_p_vData,
SCR_tde_Ntfy_Action _eAction)
{
CPA_Family *pFamily = (CPA_Family *) _p_vData;
CPA_BaseObject *pPO;
POSITION pos;
char szSectionName[SCR_CV_ui_Cfg_MaxLenName];
// save begin section
SCR_fn_v_RdL0_ComputeSectionName(szSectionName, NULL, C_SectionCreateListOfPOs, "");
SCR_M_SvL0_SaveBeginSection(_p_stFile, szSectionName, SCR_CC_C_Cfg_EOL);
// for each used action of the family
pos = pFamily->m_oListOfUsedPOs.GetHeadPosition();
while (pos)
{
pPO = pFamily->m_oListOfUsedPOs.GetNext(pos);
// save entry
SCR_M_SvL0_SaveEntry(_p_stFile, C_Entry_LoadPO, SCR_CC_C_Cfg_NoChar);
// save parameter
SCR_fn_v_SvL0_SaveParameters_MP(_p_stFile, SCR_EF_SvL0_Scanf, 1, "%s", (char *) (LPCSTR) ((CPA_SaveObject *)pPO)->GetReferencedSectionName());
}
SCR_M_SvL0_SaveEndSection(_p_stFile, SCR_CC_C_Cfg_EOL);
}
// End Shaitan => module list in the level
//////////////////////
// Save of FIX file //
//////////////////////
//************************************************************************
void EdActors_MyDocument::s_m_fn_vCallBackSaveFixFile(SCR_tdst_File_Description *_p_stFile,
char *_p_szSectionName,
void *_p_vData,
SCR_tde_Ntfy_Action _eAction)
{
const CString c_csPreLoadSection_EntryName = "PreloadSection";
const CString c_csSecondPassForCharacter_EntryName = "SecondPassForCharacter";
//Begins main Section
SCR_M_SvL0_SaveBeginSection(_p_stFile,
"PreloadSectionInFix:Characters",
SCR_CC_C_Cfg_EOL);
//Recurses for all Instances
g_pclInterface->m_clDocument.m_pri_fn_vSaveAllActorsInFixFile(_p_stFile, &g_pclInterface->m_clDocument.m_clInstancesList, c_csPreLoadSection_EntryName);
//Recurses for all Always
g_pclInterface->m_clDocument.m_pri_fn_vSaveAllActorsInFixFile(_p_stFile, &g_pclInterface->m_clDocument.m_clAlwaysList, c_csPreLoadSection_EntryName);
SCR_M_SvL0_SaveBlankLine(_p_stFile);
//Recurses for all Instances
g_pclInterface->m_clDocument.m_pri_fn_vSaveAllActorsInFixFile(_p_stFile, &g_pclInterface->m_clDocument.m_clInstancesList, c_csSecondPassForCharacter_EntryName);
//Recurses for all Always
g_pclInterface->m_clDocument.m_pri_fn_vSaveAllActorsInFixFile(_p_stFile, &g_pclInterface->m_clDocument.m_clAlwaysList, c_csSecondPassForCharacter_EntryName);
//Closes main Section
SCRIPT_vSaveEndSection(_p_stFile);
}
//************************************************************************
void EdActors_MyDocument::m_pri_fn_vSaveAllActorsInFixFile(SCR_tdst_File_Description *_p_stFile,
CPA_BaseObjectList *_pclList,
CString _csEntryName)
{
//Recurses for all Actors...
//... for 'PreloadSection' entries
CPA_Actor *pclCurrentActor;
Position pos = _pclList->GetHeadPosition();
while ( pos != 0 )
{
pclCurrentActor = (CPA_Actor *)_pclList->GetNext(pos);
if ( (pclCurrentActor->m_fn_bIsAnInstance()) && (pclCurrentActor->m_pub_fn_bIsInFix()) )
{
SCR_M_SvL0_SaveEntry( _p_stFile,
M_MAKECHAR(_csEntryName),
SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(_p_stFile,
SCR_EF_SvL0_Scanf,
2,
"%s",
M_MAKECHAR(pclCurrentActor->GetReferencedSectionName()));
}
}
}

View File

@@ -0,0 +1,131 @@
// The Special functions called on Instanciation,
// when a particular MS is allocated
///////////////////////////////////////////////////////
#include "StdAfx.h"
/////////////////////////////////////////////////////
//////// !!!!!!!!!!!! DANGER !!!!!!!!!!! ////////////
/////////////////////////////////////////////////////
#define _ED_CAR_MUST_DEFINE_STRUCT_
#include "EdAllAct.hpp"
/////////////////////////////////////////////////////
//////// !!!!!!!!!!!! End DANGER !!!!!!!!!!! ////////
/////////////////////////////////////////////////////
#include "EDACSpec.hpp"
#include "EDACMStA.hpp"
#include "EDACActr.hpp"
#include "_AInterf.hpp"
#include "EDACStrg.hpp"
//External Modules
#include "ErO.h"
#include "CTL.h"
//End of External Modules
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
//***********************************************************************
void EDACT_fn_vCineinfoAfterAllocation(EdActors_ActorMiniStructure *pclAMS)
{
struct tdstCineinfo_ *hCineInfo = (struct tdstCineinfo_ *)pclAMS->m_fn_pvGetBaseAddress();
ERROR_ASSERT( hCineInfo != NULL );
CPA_Actor *pclActor = pclAMS->m_pclParentActor->m_pclActor;
if ( pclActor->m_fn_bIsAnInstance() )
{
//Always points on Ed at allocation
//ANNECY YLG 23/01/98{
// CPA_Actor *pclActorEd = (CPA_Actor *)g_pclInterface->GetMainWorld()->fn_p_oFindObject("Ed", C_szActorInstanceTypeName);
// HIE_tdxHandleToSuperObject hMotorSO = pclActorEd->m_pub_fn_hGetMotorSuperObject();
HIE_tdxHandleToSuperObject hMotorSO = MC_fn_hGetCharacterInMainCharacterNode( MC_fn_hGetFirstMainCharNode());
//ENDANNECY YLG }
//ANNECY CB
CAM_fn_vCineInfoSetSuperObjectTargeted(hCineInfo->hInit, hMotorSO);
//ENDANNECY CB
}
}
//***********************************************************************
void EDACT_fn_vLightAfterAllocation(EdActors_ActorMiniStructure *pclAMS)
{
struct tdstMSLight_ *ptdstLight = (struct tdstMSLight_ *)pclAMS->m_fn_pvGetBaseAddress();
//PROVISOIRE...
if ( ptdstLight->p_stLight == NULL )
GLI_xCreateLight(&(ptdstLight->p_stLight), 1);
}
//***********************************************************************
void EDACT_fn_vStdGameAfterAllocation(EdActors_ActorMiniStructure *pclAMS)
{
MS_tdxHandleToStandardGame hStdGame = (MS_tdxHandleToStandardGame)pclAMS->m_fn_pvGetBaseAddress();
ERROR_ASSERT( hStdGame != NULL );
CPA_Actor *pclActor = pclAMS->m_pclParentActor->m_pclActor;
if ( pclActor != NULL )
if ( pclActor->m_fn_bIsAnInstance() )
{
HIE_tdxHandleToSuperObject h_SuperObject = pclActor->m_pub_fn_hGetMotorSuperObject();
h_SuperObject->hLinkedObject.p_Void = (void *)pclActor->m_fn_pclGetEditorActor()->m_fn_ptdstGetMotorActor();
fn_vStandardGameSetSuperObject(hStdGame, h_SuperObject);
}
}
//***********************************************************************
void EDACT_fn_v3dDataAfterAllocation(EdActors_ActorMiniStructure *pclAMS)
{
MS_tdxHandleTo3dData h3dData = (MS_tdxHandleTo3dData)pclAMS->m_fn_pvGetBaseAddress();
ERROR_ASSERT( h3dData != NULL );
}
// Shaitan FastC {
//***********************************************************************
void EDACT_fn_vBrainAfterAllocation(EdActors_ActorMiniStructure *pclAMS)
{
MS_tdxHandleToBrain hBrain = (MS_tdxHandleToBrain)pclAMS->m_fn_pvGetBaseAddress();
ERROR_ASSERT( hBrain != NULL );
}
//End Shaitan FastC }
//***********************************************************************
void EDACT_fn_vDynamicsAfterAllocation(EdActors_ActorMiniStructure *pclAMS)
{
MS_tdxHandleToDynam hDynam = (MS_tdxHandleToDynam)pclAMS->m_fn_pvGetBaseAddress();
ERROR_ASSERT( hDynam != NULL );
CPA_Actor *pclActor = pclAMS->m_pclParentActor->m_pclActor;
ERROR_ASSERT( pclActor != NULL );
if ( pclActor->m_fn_bIsAnInstance() )
{
if ( (pclActor->m_pub_fn_pclGetSuperObject() != NULL)
&& (pclActor->m_pub_fn_pclGetSuperObject()->GetData() != NULL)
&& (!pclActor->m_fn_bIsAnAlways())
)
{
struct tdstEngineObject_ *p_stObject = pclAMS->m_pclParentActor->m_fn_ptdstGetMotorActor();
fn_vDynamInit(p_stObject, OTI_MapLoaded);
}
//else this is done elsewhere !
}
}

View File

@@ -0,0 +1,94 @@
// CPACTTip.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "EDACTTip.hpp"
#include "EDACCnst.hpp"
CBrush g_cbToolTipBackgroudBrush(RGB(32, 32,224));
COLORREF g_colrefTextColor = RGB(192, 192, 192);
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_SpecialToolTip
BEGIN_MESSAGE_MAP(EdActors_SpecialToolTip, CWnd)
//{{AFX_MSG_MAP(EdActors_SpecialToolTip)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//***************************************************************************
EdActors_SpecialToolTip::EdActors_SpecialToolTip(CString csText,
CFont *pclFont)
{
m_csToolTipText = csText;
m_pclFont = pclFont;
}
//***************************************************************************
EdActors_SpecialToolTip::~EdActors_SpecialToolTip()
{
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_SpecialToolTip message handlers
//***************************************************************************
BOOL EdActors_SpecialToolTip::m_fn_bCreate(CWnd *pclParentWnd)
{
return CWnd::Create(NULL,
"",
WS_BORDER,
CRect(0,0,0,0),
/*GetDesktopWindow()*/pclParentWnd,
0,
NULL);
}
//***************************************************************************
void EdActors_SpecialToolTip::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect crClientRect;
GetClientRect(crClientRect);
dc.FillRect(crClientRect, &g_cbToolTipBackgroudBrush);
dc.SelectObject(m_pclFont);
dc.SetTextColor(g_colrefTextColor);
dc.SetBkMode(TRANSPARENT);
dc.TextOut(0, 0, m_csToolTipText);
// Do not call CWnd::OnPaint() for painting messages
}
//***************************************************************************
void EdActors_SpecialToolTip::m_fn_vMove(CPoint point)
{
CRect crNewRect;
CClientDC dc(this);
dc.SelectObject(m_pclFont);
CSize csTextSize = dc.GetTextExtent(m_csToolTipText);
crNewRect = CRect( point.x,
point.y,
point.x + csTextSize.cx + C_TTIPS_SPACING,
point.y + csTextSize.cy + C_TTIPS_SPACING);
//Looks if whole tooltip would be visible
CRect crPCRect;
GetParent()->GetClientRect(crPCRect);
if ( crNewRect.right > crPCRect.right )
crNewRect.OffsetRect(crPCRect.right-crNewRect.right, 0);
ShowWindow(SW_SHOW);
MoveWindow(crNewRect);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,498 @@
// cpacvwms.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "_AInterf.hpp"
#include "EDACVwMS.hpp"
#include "EDACFmMn.hpp"
#include "EDACDoc.hpp"
#include "EDACCnst.hpp"
#include "EDACActr.hpp"
#include "EDACWatc.hpp"
#include "help_def.h"
CBrush g_clWhiteBrush(RGB(255,255,255));
CBrush g_clRedBrush(RGB(255,0,0));
CBrush g_clGreenBrush(RGB(0,255,0));
CBrush g_clBackgroundBrush;
CTL_ToolTipTextDatabase g_oToolTipTextDatabase;
#define C_TIMER_COUNTER_MAX 19
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// EdActors_MiniStrucView
IMPLEMENT_DYNCREATE(EdActors_MiniStrucView, CFormView)
BEGIN_MESSAGE_MAP(EdActors_MiniStrucView, CTL_Editor_BaseFormView)
//{{AFX_MSG_MAP(EdActors_MiniStrucView)
ON_WM_TIMER()
ON_WM_HELPINFO()
ON_WM_SIZE()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
ON_NOTIFY_EX( TTN_NEEDTEXT, 0, OnToolTipNotify )
END_MESSAGE_MAP()
//***************************************************************************
EdActors_MiniStrucView::EdActors_MiniStrucView()
: CTL_Editor_BaseFormView(EdActors_MiniStrucView::IDD, TRUE)
{
//{{AFX_DATA_INIT(EdActors_MiniStrucView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pclControlTimerSender = NULL;
m_ucTimerCounter = 0;
m_bMustDragData = FALSE;
m_pri_pclDataToDrop = NULL;
m_pri_hDragCursor = AfxGetApp()->LoadCursor(IDC_CURSOR_DRAG);
m_pri_hDisabledDragCursor = AfxGetApp()->LoadCursor(IDC_CURSOR_DRAG_DISABLED);
}
//***************************************************************************
EdActors_MiniStrucView::~EdActors_MiniStrucView()
{
if ( m_pclToolTip != NULL )
delete m_pclToolTip;
}
//Member Functions
////////////////////////////
//*************************************************************************
//D<>finition des textes pour les Tool Tips
BOOL EdActors_MiniStrucView::OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
UINT nID =pNMHDR->idFrom;
nID = ::GetDlgCtrlID((HWND)nID);
BOOL bReturn = FALSE;
strcpy( pTTT->szText,
g_oToolTipTextDatabase[nID][m_fn_pclGetDocument()->m_pub_fn_bCurrentModeIsModel()]
);
return (TRUE);
}
//***************************************************************************
/*void EdActors_MiniStrucView::OnDraw(CDC* pDC)
{
static s_bFirstPass = TRUE;
if ( s_bFirstPass )
{
g_clBackgroundBrush.CreateSolidBrush(pDC->GetPixel(2,2));
s_bFirstPass = FALSE;
}
/* CRect crClientRect;
GetClientRect(crClientRect);
pDC->FillRect(crClientRect, &g_clWhiteBrush);
*/
//}
//***************************************************************************
void EdActors_MiniStrucView::OnInitialUpdate()
{
HINSTANCE hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle( g_stActorEditorIdentity.hModule );
//------------------------------------------------------------
CTL_Editor_BaseFormView::OnInitialUpdate();
m_fn_pclGetDocument()->m_pclMiniStrucView = this;
//Creates tool tips
EnableToolTips(TRUE);
m_pclToolTip = new CToolTipCtrl;
m_pclToolTip->Create(this, WS_VISIBLE | TTS_ALWAYSTIP);
//Sets the edition rectangle
GetClientRect(m_crEditionRect);
m_crEditionRect.InflateRect(-C_MAIN_VIEW_SPACING, -C_MAIN_VIEW_SPACING);
m_fn_vCreateAllMS();
//------------------------------------------------------------
AfxSetResourceHandle( hOldInstance );
}
//*********************************************************************************
// Creates the MS controls (and their data controls)
void EdActors_MiniStrucView::m_fn_vCreateAllMS()
{
POSITION pos = m_fn_pclGetDocument()->m_clListOfMSLists.GetHeadPosition();
while ( pos != NULL )
m_fn_vCreateMS(m_fn_pclGetDocument()->m_clListOfMSLists.GetNext(pos));
}
//*********************************************************************************
// Creates the MS controls (and their data controls)
void EdActors_MiniStrucView::m_fn_vCreateMS(EdActors_MiniStructureList *pclList)
{
//Creates the list of MS (non visible action)
CRect crCurrentRect(m_crEditionRect);
crCurrentRect.bottom = crCurrentRect.top + C_MS_LINE_HEIGHT;
EdActors_MiniStructure *pclCurrentMiniStructure;
POSITION MiniStrucPos = pclList->GetHeadPosition();
while ( MiniStrucPos != NULL )
{
pclCurrentMiniStructure = pclList->GetNext(MiniStrucPos);
pclCurrentMiniStructure->m_fn_lCreateMSControls(this, crCurrentRect);
crCurrentRect.OffsetRect(0, C_MS_SPACING + C_MS_LINE_HEIGHT);
}
}
//*********************************************************************************
// Updates editor values with motor values and displays the Actor's charac.
void EdActors_MiniStrucView::m_fn_vDisplayActor(EdActors_EditorActor *pclNewSelectedActor)
{
if ( pclNewSelectedActor != NULL )
{
POSITION AMSpos = pclNewSelectedActor->m_clListOfAMSLists.GetHeadPosition();
POSITION MSpos = m_fn_pclGetDocument()->m_clListOfMSLists.GetHeadPosition();
//Gets all motor datas
while ( MSpos != NULL )
m_fn_vUpdateMSListDatas(m_fn_pclGetDocument()->m_clListOfMSLists.GetNext(MSpos),
pclNewSelectedActor->m_clListOfAMSLists.GetNext(AMSpos));
ASSERT( AMSpos == NULL );
}
else
//only disables buttons
{
EdActors_MiniStructureList *pclEditorMSList = m_fn_pclGetDocument()->m_pclCurrentMiniStructureList;
if ( pclEditorMSList )
{
EdActors_MiniStructure *pclEditorMS;
POSITION EditorMiniStrucPos = pclEditorMSList->GetHeadPosition();
while ( EditorMiniStrucPos != NULL )
{
pclEditorMS = pclEditorMSList->GetNext(EditorMiniStrucPos);
//Sets the pointer onthe Actor MS in the Editor MS
pclEditorMS->m_pclActorMS = NULL;
//Updates button aspect
pclEditorMS->m_fn_vUpdateMSButton();
}
}
}
}
//*********************************************************************************
void EdActors_MiniStrucView::m_fn_vUpdateMSListDatas(EdActors_MiniStructureList *pclEditorMSList,
EdActors_ActorMiniStructureList *pclActorMSList)
{
//Gets all motor datas
EdActors_MiniStructure *pclEditorMS;
EdActors_ActorMiniStructure *pclActorMS;
POSITION EditorMiniStrucPos = pclEditorMSList->GetHeadPosition();
POSITION ActorMiniStrucPos = pclActorMSList->GetHeadPosition();
while ( EditorMiniStrucPos != NULL )
{
pclEditorMS = pclEditorMSList->GetNext(EditorMiniStrucPos);
pclActorMS = pclActorMSList->GetNext(ActorMiniStrucPos);
//Updates button aspect
pclEditorMS->m_fn_vUpdateMSButton();
if ( pclEditorMS->m_pclActorMS->m_fn_bIsAllocated() )
pclEditorMS->m_fn_vGetMotorDatas();
}
}
//*********************************************************************************
void EdActors_MiniStrucView::m_fn_vUpdateTree(EdActors_MiniStructure *pclMS)
{
EdActors_MiniStructureList *pclList = m_fn_pclGetDocument()->m_pclCurrentMiniStructureList;
//ANNECY CB
BOOL hashide = FALSE;
//END
if ( pclList != NULL )
{
//ANNECY CB
if(IsWindowVisible())
{
hashide = TRUE;
ShowWindow(FALSE);
}
//END
EdActors_MiniStructure *pclCurrentMiniStructure;
long lOffsetControls;
CRect crCurrentRect = m_crEditionRect;
crCurrentRect.bottom = crCurrentRect.top + C_MS_LINE_HEIGHT;
//Substracts vertical scroll position
long lOffset = -(GetScrollPosition().y);
crCurrentRect.OffsetRect(0, lOffset);
if ( m_fn_pclGetDocument()->m_pclSelectedActor != NULL )
{
CClientDC dc(this);
long lUpperLimit;
POSITION MiniStrucPos = pclList->GetHeadPosition();
while ( MiniStrucPos != NULL )
{
pclCurrentMiniStructure = pclList->GetNext(MiniStrucPos);
pclCurrentMiniStructure->m_fn_lMove(crCurrentRect);
crCurrentRect.OffsetRect(0, C_MS_LINE_HEIGHT + C_MS_SPACING);
if ( pclCurrentMiniStructure == pclMS )
lUpperLimit = crCurrentRect.top;
if ( pclCurrentMiniStructure->m_pclActorMS->m_fn_bIsOpen() )
{
lOffsetControls = pclCurrentMiniStructure->m_fn_lOpen(crCurrentRect);
crCurrentRect.OffsetRect(0, lOffsetControls + C_MS_SPACING);
}
else
{
if ( m_fn_pclGetDocument()->m_pclSelectedActor->m_fn_bIsAnInstance() )
{
if ( !(pclCurrentMiniStructure->m_pclActorMS->m_fn_bIsAllocated()) )
{
if ( m_fn_pclGetDocument()->m_bMustDisplayUnallocatedMS )
pclCurrentMiniStructure->m_fn_vClose();
else
pclCurrentMiniStructure->m_fn_vHideAllControls();
}
else
pclCurrentMiniStructure->m_fn_vClose();
}
else
pclCurrentMiniStructure->m_fn_vClose();
}
}
//Adjusts zone rectangle for MS according to new vertical scroll position
lOffset = (GetScrollPosition().y) - lOffset;
MiniStrucPos = pclList->GetHeadPosition();
while ( MiniStrucPos != NULL )
(pclList->GetNext(MiniStrucPos))->m_fn_vOffsetZone(lOffset);
//Repaints what is needed
if ( pclMS != NULL )
{
CRect crUpdateRegion;
crUpdateRegion = crCurrentRect;
crUpdateRegion.top = lUpperLimit;
InvalidateRect(crUpdateRegion);
}
else
InvalidateRect(NULL);
}
else
//if no selected actor
{
POSITION MiniStrucPos = pclList->GetHeadPosition();
while ( MiniStrucPos != NULL )
{
pclCurrentMiniStructure = pclList->GetNext(MiniStrucPos);
pclCurrentMiniStructure->m_fn_lMove(crCurrentRect);
crCurrentRect.OffsetRect(0, C_MS_LINE_HEIGHT + C_MS_SPACING);
pclCurrentMiniStructure->m_fn_vClose();
}
lOffsetControls = 0;
}
//Looks if scroll is possible
unsigned short uwNewViewHeigth = (unsigned short)(crCurrentRect.top + GetScrollPosition().y);
m_fn_vSetViewHeight(uwNewViewHeigth);
if(hashide)
ShowWindow(TRUE);
}//end of test 'pclList != NULL'
}
//*******************************************************************************
//Called (during motor for example) to update current data in editor
void EdActors_MiniStrucView::m_fn_vUpdateAllDatas()
{
EdActors_MiniStructureList *pclList = m_fn_pclGetDocument()->m_pclCurrentMiniStructureList;
if (pclList)
{
EdActors_MiniStructure *pclCurrentMiniStructure;
POSITION MiniStrucPos = pclList->GetHeadPosition();
while ( MiniStrucPos != NULL )
{
pclCurrentMiniStructure = pclList->GetNext(MiniStrucPos);
if ( pclCurrentMiniStructure->m_pclActorMS->m_tdeState == MS_STATE_DEVELOPPED )
pclCurrentMiniStructure->m_clControlList.m_pub_fn_vUpdateControlsWithEditedData(FALSE);
}
}
}
//*******************************************************************************
EdActors_MyDocument* EdActors_MiniStrucView::m_fn_pclGetDocument()
{
return &(g_pclInterface->m_clDocument);
}
//*******************************************************************************
void EdActors_MiniStrucView::OnTimer(UINT nIDEvent)
{
if ( m_ucTimerCounter < C_TIMER_COUNTER_MAX )
{
if ( m_ucTimerCounter % 2)
m_fn_vHighliteControl();
else
m_fn_vUnhighliteControl();
m_ucTimerCounter ++;
}
else
{
KillTimer(nIDEvent);
m_pclControlTimerSender = NULL;
m_ucTimerCounter = 0;
CClientDC dc(this);
dc.FrameRect(m_pclControlTimerSender->m_fn_crGetZoneRect(), &g_clBackgroundBrush);
}
CFormView::OnTimer(nIDEvent);
}
//*******************************************************************************
void EdActors_MiniStrucView::m_fn_vUnhighliteControl()
{
CClientDC dc(this);
dc.FrameRect(m_pclControlTimerSender->m_fn_crGetZoneRect(), &g_clRedBrush);
}
//*******************************************************************************
void EdActors_MiniStrucView::m_fn_vHighliteControl()
{
CClientDC dc(this);
dc.FrameRect(m_pclControlTimerSender->m_fn_crGetZoneRect(), &g_clGreenBrush);
}
//***************************************************************************
BOOL EdActors_MiniStrucView::OnHelpInfo(HELPINFO* pHelpInfo)
{
DWORD lHelpId = IDH_MS_VIEW;
UINT uiCommand = HELP_CONTEXT;
//If necessary, searches for the window under mouse
if ( !(g_pclInterface->m_clDocument.m_bMustDisplayHelpOnActiveView) )
{
CWnd *pclWindow = WindowFromPoint(pHelpInfo->MousePos);
if ( pclWindow == (CWnd *)g_pclInterface->m_clDocument.m_pclActorsView )
lHelpId = IDH_ACTORS_VIEW;
else if ( pclWindow == (CWnd *)g_pclInterface->m_clDocument.m_pclMiniStrucView )
lHelpId = IDH_MS_VIEW;
else
{
lHelpId = 0;
uiCommand = HELP_FINDER;
}
}
::WinHelp(m_hWnd,
LPCTSTR(g_pclInterface->m_clDocument.m_csHelpFileNameAndPath),
uiCommand,
lHelpId);
return FALSE;
}
//***************************************************************************
void EdActors_MiniStrucView::OnSize(UINT nType, int cx, int cy)
{
CTL_Editor_BaseFormView::OnSize(nType, cx, cy);
GetClientRect(m_crEditionRect);
m_crEditionRect.InflateRect(-C_MAIN_VIEW_SPACING, -C_MAIN_VIEW_SPACING);
m_fn_vUpdateTree();
}
//***************************************************************************
void EdActors_MiniStrucView::OnMouseMove(UINT nFlags, CPoint point)
{
if ( m_bMustDragData )
{
CPoint cpMyPoint = point;
ClientToScreen(&cpMyPoint);
BOOL bCanDropHere = ( (WindowFromPoint(cpMyPoint)->m_hWnd == WAW_fn_pclGetWatchWindowDialog()->m_hWnd)
|| (WindowFromPoint(cpMyPoint)->m_hWnd == WAW_fn_pclGetWatchWindowTree()->m_hWnd)
);
SetCursor(bCanDropHere ? m_pri_hDragCursor : m_pri_hDisabledDragCursor);
}
CTL_Editor_BaseFormView::OnMouseMove(nFlags, point);
}
//***************************************************************************
void EdActors_MiniStrucView::OnLButtonUp(UINT nFlags, CPoint point)
{
if ( m_bMustDragData )
{
CPoint cpMyPoint = point;
ClientToScreen(&cpMyPoint);
if ( (WindowFromPoint(cpMyPoint)->m_hWnd == WAW_fn_pclGetWatchWindowDialog()->m_hWnd)
|| (WindowFromPoint(cpMyPoint)->m_hWnd == WAW_fn_pclGetWatchWindowTree()->m_hWnd)
)
OAC_AddFieldInWatchWindow(m_pri_pclDataToDrop);
m_bMustDragData = FALSE;
m_pri_pclDataToDrop = NULL;
ReleaseCapture();
}
CTL_Editor_BaseFormView::OnLButtonUp(nFlags, point);
}
/////////////////////////////////////////////////////////////////////////////
// EdActors_MiniStrucView diagnostics
//***************************************************************************
//***************************************************************************
//***************************************************************************
#ifdef _DEBUG
void EdActors_MiniStrucView::AssertValid() const
{
CTL_Editor_BaseFormView::AssertValid();
}
void EdActors_MiniStrucView::Dump(CDumpContext& dc) const
{
CTL_Editor_BaseFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// EdActors_MiniStrucView message handlers

View File

@@ -0,0 +1,269 @@
// To handle Watch Window messages
//
// Written by YB on 19 / 01 / 1998
///////////////////////////////////////
#include "StdAfx.h"
#include "EDACWatc.hpp"
#include "EDACCust.hpp"
#include "EDACMStA.hpp"
#include "EDACInst.hpp"
#include "_AInterf.hpp"
#include "EDACVwAc.hpp"
//External Modules
#include "CTL.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
//*******************************************************************
void OAC_CallBackForWatchWindow(WAW_tdeMessage _tdeMessage,
void *_p_vData)
{
switch ( _tdeMessage )
{
case WAW_eDeletedData:
OAC_fn_vDeleteDataFromWatch((WAW_Data *)_p_vData);
break;
case WAW_eDeletedNode:
OAC_fn_vDeleteNodeFromWatch((WAW_Data *)_p_vData);
break;
case WAW_eUpdateData:
{
WAW_DataList clListOfMyData("OAC_Module_for_WAW");
clListOfMyData.m_pub_fn_vGetAll();
clListOfMyData.m_pub_fn_vSelectData();
clListOfMyData.m_pub_fn_vSelectVisible();
WAW_Data *pclCurrentData;
CTL_Editor_Data *pclData;
POSITION pos = clListOfMyData.GetHeadPosition();
while ( pos != NULL )
{
pclCurrentData = clListOfMyData.GetNext(pos);
OAC_tdstWatchField *p_tdstWatchField = (OAC_tdstWatchField *)pclCurrentData->m_pub_fn_pvGetUserData();
pclData = (CTL_Editor_Data *)p_tdstWatchField->p_vData;
pclData->m_fn_vGetMotorData();
WAW_fn_bUpdateData(pclCurrentData, OAC_fn_csComputeTotalValueString(pclData));
}
}
break;
case WAW_eHideWindow:
((CButton *)g_pclInterface->m_clDocument.m_pclActorsView->GetDlgItem(IDC_CHECK_WATCH))->SetCheck(FALSE);
g_pclInterface->m_clDocument.m_pub_bWatchWindowIsVisible = FALSE;
break;
case WAW_eShowWindow:
((CButton *)g_pclInterface->m_clDocument.m_pclActorsView->GetDlgItem(IDC_CHECK_WATCH))->SetCheck(TRUE);
g_pclInterface->m_clDocument.m_pub_bWatchWindowIsVisible = TRUE;
break;
}
}
//*******************************************************************
void OAC_AddFieldInWatchWindow(CTL_Editor_Data *_pclData)
{
//Gets Parent Actor
WAW_Data *pclParentActorWatchData;
EdActors_EditorActor *pclParentActor = OAC_fn_pclGetParentActorOfData(_pclData);
ERROR_ASSERT( pclParentActor != NULL );
ERROR_ASSERT( pclParentActor->m_fn_bIsAnInstance() );
EdActors_EditorActorInstance *pclParentInstance = (EdActors_EditorActorInstance *)pclParentActor;
if ( pclParentInstance->m_pub_fn_p_tdstGetWatchField()->eType == OAC_WATCH_FIELD_TYPE__NONE )
{
//Adds in Watch
pclParentActorWatchData = WAW_fn_pclAddNode("OAC_Module_for_WAW",
NULL,
pclParentInstance->m_pclActor->GetName());
WAW_fn_bSetDataIcon(pclParentActorWatchData, g_pclInterface->m_clDocument.m_pub_hWatchIcon_Actor);
pclParentInstance->m_pub_fn_p_tdstGetWatchField()->eType == OAC_WATCH_FIELD_TYPE__ACTOR;
pclParentInstance->m_pub_fn_p_tdstGetWatchField()->pclWatchData == pclParentActorWatchData;
pclParentActorWatchData->m_pub_fn_vSetUserData( (void *)pclParentInstance->m_pub_fn_p_tdstGetWatchField() );
}
else
pclParentActorWatchData = pclParentInstance->m_pub_fn_p_tdstGetWatchField()->pclWatchData;
//Gets Parent AMS
WAW_Data *pclParentMSWatchData;
EdActors_ActorMiniStructure *pclParentAMS = OAC_fn_pclGetParentAMSOfData(_pclData);
ERROR_ASSERT( pclParentAMS != NULL );
if ( pclParentAMS->m_pub_fn_p_tdstGetWatchField()->eType == OAC_WATCH_FIELD_TYPE__NONE )
{
//Adds in Watch
pclParentMSWatchData = WAW_fn_pclAddNode("OAC_Module_for_WAW",
pclParentActorWatchData,
pclParentAMS->m_fn_csGetScriptName());
WAW_fn_bSetDataIcon(pclParentMSWatchData, g_pclInterface->m_clDocument.m_pub_hWatchIcon_MS);
pclParentAMS->m_pub_fn_p_tdstGetWatchField()->eType == OAC_WATCH_FIELD_TYPE__MS;
pclParentAMS->m_pub_fn_p_tdstGetWatchField()->pclWatchData == pclParentMSWatchData;
pclParentMSWatchData->m_pub_fn_vSetUserData( (void *)pclParentAMS->m_pub_fn_p_tdstGetWatchField() );
}
else
pclParentMSWatchData = pclParentAMS->m_pub_fn_p_tdstGetWatchField()->pclWatchData;
//Adds data
WAW_Data *pclAddedWatchData = WAW_fn_pclAddData("OAC_Module_for_WAW",
pclParentMSWatchData,
_pclData->m_pub_fn_csGetDataName(),
OAC_fn_csComputeTotalValueString(_pclData),
NULL);
WAW_fn_bSetDataIcon(pclAddedWatchData, g_pclInterface->m_clDocument.m_pub_hWatchIcon_Field);
OAC_tdstWatchField *p_tdstWatchField = new OAC_tdstWatchField;
p_tdstWatchField->eType = OAC_WATCH_FIELD_TYPE__DATA;
p_tdstWatchField->p_vData = (void *)_pclData;
p_tdstWatchField->pclWatchData = pclAddedWatchData;
pclAddedWatchData->m_pub_fn_vSetUserData((void *)p_tdstWatchField);
OAC_fn_vSetDataInWatch(_pclData, pclAddedWatchData);
// CPA2 ASilvescu 98-05-07
CTL_Editor_Control *parent = _pclData->m_pub_fn_pclGetParentControl();
if(parent) parent->m_pub_fn_pclGetNameStatic()->InvalidateRect(NULL);
// Save watch data
CString saveFileName = M_GetMainApp()->m_csEditorDataPath;
saveFileName += "watch.dat";
WritePrivateProfileString(pclParentInstance->m_pclActor->GetName(), _pclData->m_pub_fn_csGetDataName(), pclParentAMS->m_fn_csGetScriptName(), saveFileName);
// End CPA2 ASilvescu 98-05-07
}
//*******************************************************************
void OAC_RemoveFieldFromWatchWindow(CTL_Editor_Data *_pclData)
{
ERROR_ASSERT( _pclData != NULL );
WAW_Data *pclWAWData = OAC_fn_pclGetAssociatedWatchData(_pclData);
// OAC_tdstWatchField *p_tdstWatchField = (OAC_tdstWatchField *)pclWAWData->m_pub_fn_pvGetUserData();
// delete p_tdstWatchField;
WAW_fn_bDeleteData(pclWAWData);
// OAC_fn_vSetDataInWatch(_pclData, NULL);
// _pclData->m_pub_fn_pclGetParentControl()->m_pub_fn_pclGetNameStatic()->InvalidateRect(NULL);
// CPA2 ASilvescu 98-05-07
// Delete watch data
CString saveFileName = M_GetMainApp()->m_csEditorDataPath;
saveFileName += "watch.dat";
EdActors_EditorActor *pclActor = OAC_fn_pclGetParentActorOfData(_pclData);
if(pclActor)
WritePrivateProfileString(pclActor->m_pclActor->GetName(), _pclData->m_pub_fn_csGetDataName(), NULL, saveFileName);
// End CPA2 ASilvescu 98-05-07
}
//*******************************************************************
CString OAC_fn_csComputeTotalValueString(CTL_Editor_Data *_pclData)
{
CString csValue;
CStringList *pcslList = _pclData->m_fn_pcslFormatDataValueString();
POSITION pos = pcslList->GetHeadPosition();
while ( pos != NULL )
{
csValue += pcslList->GetNext(pos);
if ( pos != NULL )
csValue += " ; ";
}
return csValue;
}
//*******************************************************************
void OAC_fn_vDeleteDataFromWatch(WAW_Data *_pclWatchData)
{
ERROR_ASSERT( _pclWatchData != NULL );
OAC_tdstWatchField *p_tdstWatchField = (OAC_tdstWatchField *)_pclWatchData->m_pub_fn_pvGetUserData();
CTL_Editor_Data *pclData = (CTL_Editor_Data *)p_tdstWatchField->p_vData;
delete p_tdstWatchField;
OAC_fn_vSetDataInWatch(pclData, NULL);
// pclData->m_pub_fn_pclGetParentControl()->m_pub_fn_pclGetNameStatic()->InvalidateRect(NULL);
// CPA2 ASilvescu 98-05-07
// Delete watch data
CTL_Editor_Control *parent = pclData->m_pub_fn_pclGetParentControl();
if(parent) parent->m_pub_fn_pclGetNameStatic()->InvalidateRect(NULL);
CString saveFileName = M_GetMainApp()->m_csEditorDataPath;
saveFileName += "watch.dat";
EdActors_EditorActor *pclActor = OAC_fn_pclGetParentActorOfData(pclData);
if(pclActor)
WritePrivateProfileString(pclActor->m_pclActor->GetName(), pclData->m_pub_fn_csGetDataName(), NULL, saveFileName);
// End CPA2 ASilvescu 98-05-07
}
//*******************************************************************
void OAC_fn_vDeleteNodeFromWatch(WAW_Data *_pclWatchData)
{
ERROR_ASSERT( _pclWatchData != NULL );
OAC_tdstWatchField *p_tdstWatchField = (OAC_tdstWatchField *)_pclWatchData->m_pub_fn_pvGetUserData();
switch ( p_tdstWatchField->eType )
{
case OAC_WATCH_FIELD_TYPE__ACTOR:
{
EdActors_EditorActorInstance *pclParentInstance = (EdActors_EditorActorInstance *)p_tdstWatchField->p_vData;
pclParentInstance->m_pub_fn_p_tdstGetWatchField()->eType = OAC_WATCH_FIELD_TYPE__NONE;
pclParentInstance->m_pub_fn_p_tdstGetWatchField()->pclWatchData = NULL;
}
break;
case OAC_WATCH_FIELD_TYPE__MS:
{
EdActors_ActorMiniStructure *pclParentAMS = (EdActors_ActorMiniStructure *)p_tdstWatchField->p_vData;
pclParentAMS->m_pub_fn_p_tdstGetWatchField()->eType = OAC_WATCH_FIELD_TYPE__NONE;
pclParentAMS->m_pub_fn_p_tdstGetWatchField()->pclWatchData = NULL;
}
break;
}
}
//*******************************************************************
void OAC_fn_vUpdateDataInWatchWindow(CTL_Editor_Data *_pclData)
{
WAW_fn_bUpdateData(OAC_fn_pclGetAssociatedWatchData(_pclData), OAC_fn_csComputeTotalValueString(_pclData));
}
//*******************************************************************
void OAC_fn_vUpdateAllDataInWatchWindow()
{
WAW_DataList clListOfMyData("OAC_Module_for_WAW");
clListOfMyData.m_pub_fn_vSelectData();
clListOfMyData.m_pub_fn_vSelectVisible();
WAW_Data *pclCurrentData;
CTL_Editor_Data *pclData;
POSITION pos = clListOfMyData.GetHeadPosition();
while ( pos != NULL )
{
pclCurrentData = clListOfMyData.GetNext(pos);
OAC_tdstWatchField *p_tdstWatchField = (OAC_tdstWatchField *)pclCurrentData->m_pub_fn_pvGetUserData();
pclData = (CTL_Editor_Data *)p_tdstWatchField->p_vData;
pclData->m_fn_vGetMotorData();
WAW_fn_bUpdateData(pclCurrentData, OAC_fn_csComputeTotalValueString(pclData));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,220 @@
// dlgcleanalwfile.cpp : implementation file
//
#include "stdafx.h"
#include "..\inc\edactors\EdAcIRes.h"
#include "..\inc\edactors\dlgcleanalwfile.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgCleanAlwFile dialog
const CString CDlgCleanAlwFile::m_aColumnHeaders [][COLUMNS] = {
{"List of loaded and not referenced always", "List of always to be removed from the alw file"},
{"List of referenced and not loaded always", "List of always to be loaded in the alw file"}
};
const CString CDlgCleanAlwFile::m_aDlgTitle [] = {
"Clean the ALW file",
"Update the ALW file"
};
const CString CDlgCleanAlwFile::m_aOKText [] = {
"Remove",
"Update"
};
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CDlgCleanAlwFile
// Date : 98/07/01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CDlgCleanAlwFile::CDlgCleanAlwFile(CStringList &rlstOfAlways, int nCurrentTask/* = TASK_CLEAN_ALW_FILE*/, CWnd* pParent /*=NULL*/)
: CDialog(CDlgCleanAlwFile::IDD, pParent), m_rlstOfAlways (rlstOfAlways)
{
//{{AFX_DATA_INIT(CDlgCleanAlwFile)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_nCurrentTask = nCurrentTask;
}
void CDlgCleanAlwFile::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgCleanAlwFile)
DDX_Control(pDX, IDC_LOADED_ALWAYS, m_lstAlways);
DDX_Control(pDX, IDC_ALWAYS_TO_BE_REMOVED, m_lstAlwaysToBeRemoved);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgCleanAlwFile, CDialog)
//{{AFX_MSG_MAP(CDlgCleanAlwFile)
ON_BN_CLICKED(IDC_LEFT, OnLeft)
ON_BN_CLICKED(IDC_RIGHT, OnRight)
ON_BN_CLICKED(IDC_RIGHT_ALL, OnRightAll)
ON_LBN_DBLCLK(IDC_LOADED_ALWAYS, OnDblclkLoadedAlways)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgCleanAlwFile message handlers
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnLeft
// Date : 98/07/01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCleanAlwFile::OnLeft()
{
int iSelectedInx = m_lstAlwaysToBeRemoved.GetCurSel ();
if (LB_ERR != iSelectedInx)
{
CString csAlwaysName;
m_lstAlwaysToBeRemoved.GetText (iSelectedInx, csAlwaysName);
m_lstAlwaysToBeRemoved.DeleteString (iSelectedInx);
m_lstAlways.AddString (csAlwaysName);
}
const int iItemsInList = m_lstAlwaysToBeRemoved.GetCount ();
if (iItemsInList > iSelectedInx)
m_lstAlwaysToBeRemoved.SetCurSel (iSelectedInx);
else if (iItemsInList > 0)
m_lstAlwaysToBeRemoved.SetCurSel (iItemsInList - 1);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnRight
// Date : 98/07/01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCleanAlwFile::OnRight()
{
int iSelectedInx = m_lstAlways.GetCurSel ();
if (LB_ERR != iSelectedInx)
{
CString csAlwaysName;
m_lstAlways.GetText (iSelectedInx, csAlwaysName);
m_lstAlways.DeleteString (iSelectedInx);
m_lstAlwaysToBeRemoved.AddString (csAlwaysName);
}
const int iItemsInList = m_lstAlways.GetCount ();
if (iItemsInList > iSelectedInx)
m_lstAlways.SetCurSel (iSelectedInx);
else if (iItemsInList > 0)
m_lstAlways.SetCurSel (iItemsInList - 1);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnRightAll
// Date : 98/07/01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCleanAlwFile::OnRightAll()
{
CString csAlwaysName;
for (int i = 0; i < m_lstAlways.GetCount (); i++)
{
m_lstAlways.GetText (i, csAlwaysName);
m_lstAlwaysToBeRemoved.AddString (csAlwaysName);
}
m_lstAlways.ResetContent ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnOK
// Date : 98/07/01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCleanAlwFile::OnOK()
{
UpdateData (TRUE);
m_rlstOfAlways.RemoveAll ();
CString csAlwaysName;
for (int i = 0; i < m_lstAlwaysToBeRemoved.GetCount (); i++)
{
m_lstAlwaysToBeRemoved.GetText (i, csAlwaysName);
m_rlstOfAlways.AddTail (csAlwaysName);
}
CDialog::EndDialog(IDOK);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnInitDialog
// Date : 98/07/01
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CDlgCleanAlwFile::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText (m_aDlgTitle [m_nCurrentTask]);
GetDlgItem (IDC_STATIC_LEFT)->SetWindowText (m_aColumnHeaders [m_nCurrentTask][LEFT]);
GetDlgItem (IDC_STATIC_RIGHT)->SetWindowText (m_aColumnHeaders [m_nCurrentTask][RIGHT]);
GetDlgItem (IDOK)->SetWindowText (m_aOKText [m_nCurrentTask]);
POSITION pos = m_rlstOfAlways.GetHeadPosition ();
while (pos)
{
CString csAlwaysName = m_rlstOfAlways.GetNext (pos);
m_lstAlways.AddString (csAlwaysName);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnDblclkLoadedAlways
// Date : 98/07/16
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgCleanAlwFile::OnDblclkLoadedAlways()
{
OnRight();
}

View File

@@ -0,0 +1,71 @@
////////////////////////////////////////////////////////////////////////////////////////
// File : dlgladai.cpp
// Author : Cristi Petrescu
// Date : 98.03
// Description : implementaton for simple dialog class to display two labeled buttonds in the
// center of the main view
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "_AInterf.hpp"
#include "Defines.hpp"
#include "EdAcIRes.h"
#include "dlgldai.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// DlgLoadAI dialog
DlgLoadAI::DlgLoadAI(CWnd* pParent /*=NULL*/)
: CDialog(DlgLoadAI::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(DlgLoadAI)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void DlgLoadAI::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DlgLoadAI)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DlgLoadAI, CDialog)
//{{AFX_MSG_MAP(DlgLoadAI)
ON_BN_CLICKED(IDC_OAC_LOAD_AI, OnOacLoadAi)
ON_BN_CLICKED(IDC_OAC_SHOW_MODELS, OnOacShowModels)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DlgLoadAI message handlers
void DlgLoadAI::OnOacLoadAi()
{
EndDialog (IDYES);
}
void DlgLoadAI::OnOacShowModels()
{
EndDialog (IDOK);
}
BOOL DlgLoadAI::OnInitDialog()
{
CDialog::OnInitDialog();
CenterWindow (M_GetMainWnd ());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

View File

@@ -0,0 +1,279 @@
// dlgselectinstances.cpp : implementation file
//
#include "stdafx.h"
//#include "X:\CPA\tempgrp\oac\Inc\EdActors\edactors.h"
#include "..\inc\edactors\EdAcIRes.h"
#include "..\inc\edactors\dlgselectinstances.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgSelectInstances dialog
IMPLEMENT_DYNAMIC (CSimpleCheckListBox, CCheckListBox)
CSimpleCheckListBox::CSimpleCheckListBox () : CCheckListBox ()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : DrawItem
// Date : 98/06/25
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CSimpleCheckListBox::DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if (0 > lpDrawItemStruct->itemID)
return;
CDC *pDC = CDC::FromHandle (lpDrawItemStruct->hDC);
char szText [TEXT_LENGTH];
SendMessage (LB_GETTEXT, lpDrawItemStruct->itemID, (LPARAM)(LPCSTR)szText);
CString csText = szText;
COLORREF rgbTextOld = 0, rgbTextStandard = RGB (0, 0, 255), rgbTextRegular = RGB (82, 16, 0);
switch (lpDrawItemStruct->itemData)
{
case STANDARD_INSTANCE:
rgbTextOld = pDC->SetTextColor (rgbTextStandard);
break;
case REGULAR_INSTANCE:
rgbTextOld = pDC->SetTextColor (rgbTextRegular);
break;
default:
ASSERT (FALSE);
}
pDC->DrawText (csText, &lpDrawItemStruct->rcItem, DT_LEFT);
pDC->SetTextColor (rgbTextOld);
}
CDlgSelectInstances::CDlgSelectInstances(CStringList &rlstAllInstances, CStringList &rlstStandardInstances, CWnd* pParent /*=NULL*/)
: CDialog(CDlgSelectInstances::IDD, pParent), m_rlstAllInstances (rlstAllInstances), m_rlstStandardInstances (rlstStandardInstances)
{
//{{AFX_DATA_INIT(CDlgSelectInstances)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_bAllInstances = FALSE;
}
void CDlgSelectInstances::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgSelectInstances)
DDX_Control(pDX, IDC_LIST_INSTANCES, m_lstInstances);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgSelectInstances, CDialog)
//{{AFX_MSG_MAP(CDlgSelectInstances)
ON_BN_CLICKED(IDC_CHECK_ALL, OnCheckAll)
ON_BN_CLICKED(IDC_CHECK_STANDARD, OnCheckStandard)
ON_LBN_SELCHANGE(IDC_LIST_INSTANCES, OnSelchangeListInstances)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgSelectInstances message handlers
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnCheckAll
// Date : 98/06/25
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSelectInstances::OnCheckAll()
{
BOOL bCheckStandardChecked = 1 == ((CButton *)GetDlgItem (IDC_CHECK_STANDARD))->GetCheck ();
CButton *pCheck = (CButton *)GetDlgItem (IDC_CHECK_ALL);
int nCheckAll = pCheck->GetCheck ();
int nCnt = m_lstInstances.GetCount ();
for (int i = 0; i < nCnt; i++)
{
if (0 == nCheckAll && bCheckStandardChecked)
{
if (STANDARD_INSTANCE == m_lstInstances.GetItemData (i))
m_lstInstances.SetCheck (i, 1);
else
m_lstInstances.SetCheck (i, 0);
}
else
m_lstInstances.SetCheck (i, nCheckAll);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnCheckStandard
// Date : 98/06/25
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSelectInstances::OnCheckStandard()
{
BOOL bCheckAllChecked = 1 == ((CButton *)GetDlgItem (IDC_CHECK_ALL))->GetCheck ();
CButton *pCheck = (CButton *)GetDlgItem (IDC_CHECK_STANDARD);
int nStandardCheck = pCheck->GetCheck ();
if (bCheckAllChecked && 0 == nStandardCheck)
{
pCheck->SetCheck (1);
return;
}
int nCnt = m_lstInstances.GetCount ();
for (int i = 0; i < nCnt; i++)
{
if (STANDARD_INSTANCE == m_lstInstances.GetItemData (i))
m_lstInstances.SetCheck (i, nStandardCheck);
else
m_lstInstances.SetCheck (i, 0);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnOK
// Date : 98/06/25
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSelectInstances::OnOK()
{
BOOL bCheckAllChecked = 1 == ((CButton *)GetDlgItem (IDC_CHECK_ALL))->GetCheck ();
if (!bCheckAllChecked)
{
m_rlstAllInstances.RemoveAll ();
int nCnt = m_lstInstances.GetCount ();
for (int iInx = 0; iInx < nCnt; iInx++)
{
BOOL bInstanceSelected = 1 == m_lstInstances.GetCheck (iInx);
if (bInstanceSelected)
{
CString csInstanceName;
m_lstInstances.GetText (iInx, csInstanceName);
m_rlstAllInstances.AddTail (csInstanceName);
}
}
}
else
m_bAllInstances = TRUE;
//if allCheckChecked then all the instances remain in the list
CDialog::OnOK();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnInitDialog
// Date : 98/06/25
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CDlgSelectInstances::OnInitDialog()
{
CDialog::OnInitDialog();
POSITION pos = m_rlstAllInstances.GetHeadPosition ();
while (pos)
{
CString csInstanceName = m_rlstAllInstances.GetNext (pos);
DWORD dwType = REGULAR_INSTANCE;
if (mfn_bIsAStandardInstance (csInstanceName))
dwType = STANDARD_INSTANCE;
int iInx = m_lstInstances.AddString (csInstanceName);
ASSERT (0 <= iInx);
m_lstInstances.SetItemData (iInx, dwType);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnSelchangeListInstances
// Date : 98/06/25
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CDlgSelectInstances::OnSelchangeListInstances()
{
CSimpleCheckListBox *pList = (CSimpleCheckListBox *)GetDlgItem (IDC_LIST_INSTANCES);
int nSel = pList->GetCurSel ();
if (LB_ERR == nSel)
return;
if (0 == pList->GetCheck (nSel)) //uncheck
{
((CButton *)GetDlgItem (IDC_CHECK_ALL))->SetCheck (0);
((CButton *)GetDlgItem (IDC_CHECK_STANDARD))->SetCheck (0);
}
else
((CButton *)GetDlgItem (IDC_CHECK_STANDARD))->SetCheck (0);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bIsAStandardInstance
// Date : 98/06/25
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CDlgSelectInstances::mfn_bIsAStandardInstance (CString csInstanceName)
{
BOOL bIsStandardInstance = FALSE;
POSITION pos = m_rlstStandardInstances.GetHeadPosition ();
while (pos && !bIsStandardInstance)
{
const CString csName = m_rlstStandardInstances.GetNext (pos);
if (csName == csInstanceName)
bIsStandardInstance = TRUE;
}
return bIsStandardInstance;
}

View File

@@ -0,0 +1,443 @@
#include "StdAfx.h"
//External Modules
#include "ACP_Base.h"
#include "ITF.h"
#include "TAC.h"
#include "TFA.h"
#include "IncMEC.h"
#define D_State_Define
#include "IncGAM.h"
#undef D_State_Define
#include "GLI.h"
//End of External Modules
#include "EDACStrg.hpp"
#include "EDACInst.hpp"
#include "EDACModl.hpp"
#include "EDACDgIf.hpp"
#include "EDACDgPI.hpp"
#include "EDACGlob.hpp"
#include "Defines.hpp"
#include "x:\cpa\Main\inc\_editid.h"
//-----------------IR-------------------------
#include "EdIRStrg.hpp"
#include "EdIRFrm.hpp"
#include "EdIRBeEn.hpp"
#include "EDACQuer.hpp"
//--------------------------------------------
//External Modules
#include "ErO.h"
//#include "CTL.h"
//End of External Modules
#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
//-----------------IR-------------------------
#include "EdIRIRD.hpp"
//--------------------------------------------
#include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT
#ifdef CPA_USES_LDT
#include "ldt.h"
#define lTagType 'epyT'
#define lTagBitmap 'mtiB'
#define lTagFamily 'imaF'
#define lTagEditorBrain 'tidE'
#define lTagShowPrivate 'wohS'
/*****************************************************************
Function name : EdActors_MyDocument::fn_iCreateEditorActorModel
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 15-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int EdActors_MyDocument::fn_iCreateEditorActorModel( LDT_tdst_Link *pLink )
{
//Working Model
CPA_Actor *s_pclModel = NULL;
//For error Infos
//ERROR_SET_SCRIPT_INFO(_p_stFile)
//Gets the 'context' Model
unsigned long ulPassedValue = LDT_GetTempLong(0);
LDT_SetLinkValue( pLink, ulPassedValue);
char* szName = LDT_szGetSectionName();
CString csName(pLink->szName);
if ( ulPassedValue == 0 )
{
//Creates the Model
CPA_SuperObject *pclSO = g_pclInterface->m_clDocument.m_fn_pclCreateModelForLoad(csName);
s_pclModel = (CPA_Actor *)pclSO->GetObject();
}
else
{
//Creates the Model
s_pclModel = (CPA_Actor *)ulPassedValue;
CPA_SuperObject *pclSO = g_pclInterface->m_clDocument.m_fn_pclCreateModelForLoad(csName, s_pclModel);
s_pclModel = (CPA_Actor *)pclSO->GetObject();
ERROR_ASSERT( (unsigned long)s_pclModel == ulPassedValue );
}
ERROR_ASSERT( s_pclModel != NULL );
ERROR_ASSERT( s_pclModel->m_fn_bIsAModel() );
pLink->pObject = (void*)s_pclModel;
return 0;
}
/*****************************************************************
Function name : EdActors_MyDocument::fn_iLoadEditorActorModel
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 15-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int EdActors_MyDocument::fn_iLoadEditorActorModel( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
//Working Model
CPA_Actor *s_pclModel = (CPA_Actor *)pLink->pObject;
ERROR_ASSERT ( s_pclModel != NULL );
//Info Window
CString s_csMessage;
BOOL s_bModelAlreadyExists = FALSE;
unsigned char s_ucProgressValue = 0;
char * szName = LDT_szGetSectionName();
CString csName(szName);
s_csMessage = "Actors Editor loading Model : " + csName;
unsigned long ulPassedValue = LDT_GetLinkValue( pLink);
if ( ulPassedValue == 0 )
{
s_bModelAlreadyExists = FALSE;
}
else
{
s_bModelAlreadyExists = TRUE;
}
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagType : /* */
{
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
s_pclModel->m_fn_vMakeGenDoor( g_c_csModelTypeGenDoor.CompareNoCase(LDT_szGetParam(1)) == 0);
//Sets progress
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
}
break;
case lTagBitmap : /* */
{
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
CString csBitmapName(LDT_szGetParam(1));
s_pclModel->m_fn_pclGetEditorModel()->m_fn_vSetBitmapName(csBitmapName);
//Sets progress
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
}
break;
case lTagFamily : /* */
{
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
CPA_Family *pclFamily = (CPA_Family *)g_pclInterface->GetMainWorld()->fn_p_oFindObject( LDT_szGetParam(1),
C_szFamilyTypeName);
//If Family is not loaded, calls Family DLL to load it
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,"Loading a Model",
"EdActors_MyDocument::m_fn_tdeCallBackLoadModel(...)",
E_ERROR_GRAVITY_FATAL,
"Family for the Model has not been found");
ERROR_ASSERT( pclFamily != NULL );
if ( !(pclFamily->fn_bIsAvailable()) )
{
CString csFamilyMessage = "Actors Editor asking for Family '" + pclFamily->GetName() + "' load... Please wait !";
EDACTORS_fn_vGiveProgressInfo(csFamilyMessage, -1);
CPA_DLLBase *p_clFamilyDll = g_pclInterface->GetMainWorld()->GetDLLWithTypeName(C_szDLLFamilyName);
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,"Loading a Model",
"EdActors_MyDocument::m_fn_tdeCallBackLoadModel(...)",
E_ERROR_GRAVITY_FATAL,
"Family DLL cannot be found");
ERROR_ASSERT( p_clFamilyDll != NULL );
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,"Loading a Model",
"EdActors_MyDocument::m_fn_tdeCallBackLoadModel(...)",
E_ERROR_GRAVITY_FATAL,
"Family can't be loaded");
ERROR_VERIFY( p_clFamilyDll->fn_bLoadBaseObject(pclFamily) );
}
s_pclModel->m_pub_fn_vSetFamily(pclFamily);
s_pclModel->m_pub_fn_vConstructEnumDescriptorForObjectsTables();
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
}
break;
case lTagEditorBrain : /* */
{
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
CString csName(LDT_szGetParam(1));
// NOTE: LoadBrain calls dActors_ActorMiniStructure::m_fn_tdeCallBackLoad (the CB for 'CreateEditorIntelligence' section from .eru files)
EDAC_fn_vLoadBrain(s_pclModel,csName);
s_ucProgressValue += 10;
EDACTORS_fn_vGiveProgressInfo(s_csMessage, s_ucProgressValue);
}
break;
case lTagShowPrivate : /* */
{
CPA_EdIR_Brain *pclBrain = ((EdActors_EditorActorModel *)s_pclModel->m_fn_pclGetEditorActor())->m_pclBrain;
pclBrain -> m_bShowPrivateVariable = atoi(LDT_szGetParam(1));
}
break;
}
}
break;
case ParseResult_BeginSection : /* subsection MiniStructure*/
{
LDT_LoadSection( NULL );
}
break;
}
}
//Adds in the Models list
g_pclInterface->m_clDocument.m_fn_vAddLoadedModelInList(s_pclModel->m_fn_pclGetEditorModel(), !s_bModelAlreadyExists);
//Re-builds section name
s_pclModel->GetCompleteSectionName(); //???
// -> OS : THIS CODE SHOULD BE CHANGED 17-Sep-98
// SCR_M_RdL0_SetSectionLong(0, 0, (long)s_pclModel);
// <- OS : THIS CODE SHOULD BE CHANGED 17-Sep-98
EDACTORS_fn_vGiveProgressInfo(s_csMessage, 100);
return 0;
}
/*****************************************************************
Function name : EdActors_ActorMiniStructure::fn_iCreateActorMiniStructure
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 15-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int EdActors_ActorMiniStructure::fn_iCreateActorMiniStructure( LDT_tdst_Link *pLink )
{
CPA_Actor *pclActor = (CPA_Actor *)pLink->pParent->pObject;
char* szName= LDT_szGetSectionName();
CString csAction(szName);
ERROR_ASSERT( pclActor->m_fn_bIsAModel() );
EdActors_EditorActor *pclEdActor = pclActor->m_fn_pclGetEditorActor();
EdActors_ActorMiniStructure *s_pclAMS = NULL;
//For error Infos
//ERROR_SET_SCRIPT_INFO(_p_stFile);
CString csAllocated = CString(LDT_szGetParam(2));
if ( csAllocated.CompareNoCase(g_c_csAllocatedMS) == 0 )
{
//Selects the right list of AMS
EdActors_ActorMiniStructureList *pclAMSList;
CString csGroupName = CString(LDT_szGetParam(1));
BOOL bAMSListFound = FALSE;
POSITION ASMListPos = pclEdActor->m_clListOfAMSLists.GetHeadPosition();
while ( (ASMListPos != NULL) && (!bAMSListFound) )
{
pclAMSList = pclEdActor->m_clListOfAMSLists.GetNext(ASMListPos);
bAMSListFound = ( csGroupName.CompareNoCase(pclAMSList->m_fn_csGetGroupScriptName()) == 0 );
}
ERROR_ASSERT( bAMSListFound );
BOOL bAMSFound = FALSE;
CString csMSName = csAction;
EdActors_ActorMiniStructure *pclAMS;
POSITION pos = pclAMSList->GetHeadPosition();
while ( (pos != NULL) && (!bAMSFound) )
{
pclAMS = pclAMSList->GetNext(pos);
bAMSFound = ( pclAMS->m_csScriptName.CompareNoCase(csMSName) == 0 );
}
//Allocates the MS
if ( bAMSFound )
{
pclAMS->m_fn_bAllocate();
s_pclAMS = pclAMS;
}
}
pLink->pObject = (void*)s_pclAMS;
return 0;
}
/*****************************************************************
Function name : EdActors_ActorMiniStructure::fn_iLoadActorMiniStructure
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 15-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int EdActors_ActorMiniStructure::fn_iLoadActorMiniStructure( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
CPA_Actor *pclActor = (CPA_Actor *)pLink->pParent->pObject;
ERROR_ASSERT( pclActor->m_fn_bIsAModel() );
EdActors_EditorActor *pclEdActor = pclActor->m_fn_pclGetEditorActor();
EdActors_ActorMiniStructure *s_pclAMS = (EdActors_ActorMiniStructure *)pLink->pObject;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char* szEntry = LDT_szGetEntryName();
CString csAction(szEntry);
if ( s_pclAMS != NULL )
{
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
"Loading a Mini Structure",
"EdActors_ActorMiniStructure::m_fn_tdeCallBackLoad(...)",
E_ERROR_GRAVITY_FATAL,
"A field has been found in a Model's MS which is not allocated : this should not occur !!");
ERROR_ASSERT( s_pclAMS->m_fn_bIsAllocated() );
//Searches for the Data
BOOL bFound = FALSE;
CTL_Editor_Data *pclData;
POSITION pos = s_pclAMS->m_pclDataList->GetHeadPosition();
while ( (pos != NULL) && (!bFound) )
{
pclData = s_pclAMS->m_pclDataList->GetNext(pos);
bFound = ( pclData->m_pub_fn_csGetDataName().CompareNoCase(csAction) == 0 );
}
if ( bFound )
{
CString csValue(LDT_szGetParam(1));
//Analyses link state
if ( csValue.CompareNoCase(g_c_csLinkedField) == 0 )
OAC_fn_tdeSetLink(pclData, OAC_LINK_MODE__LINKED);
else if ( csValue.CompareNoCase(g_c_csNotLinkedField) == 0 )
OAC_fn_tdeSetLink(pclData, OAC_LINK_MODE__NOT_LINKED);
else if ( csValue.CompareNoCase(g_c_csAlwaysLinkedField) == 0 )
OAC_fn_tdeSetLink(pclData, OAC_LINK_MODE__ALWAYS_LINKED);
else if ( csValue.CompareNoCase(g_c_csNeverLinkedField) == 0 )
OAC_fn_tdeSetLink(pclData, OAC_LINK_MODE__NEVER_LINKED);
else
ERROR_ASSERT(FALSE);
//Analyses Value string
CStringList cslStringList;
long c_lI;
// To clean all ema files
if (csValue.CompareNoCase("Activable") != 0)
{
long lNbP = LDT_iGetNbParams();
for ( c_lI = 2; c_lI <= (lNbP-1); c_lI ++ )
{
cslStringList.AddTail(LDT_szGetParam(c_lI));
}
}
else
cslStringList.AddTail("TRUE");
pclData->m_fn_vSetValueWithString(&cslStringList);
}
}
}
}
}
return 0;
}
#endif //CPA_USES_LDT