reman3/Rayman_X/cpa/tempgrp/ITF/CPAEditB.cpp

952 lines
31 KiB
C++

/*=========================================================================
*
* CPAEditB.cpp : CPA_EditorBase : Implementation file.
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
#include "stdafx.h"
#include "Itf/customid.h"
#ifdef ACTIVE_EDITOR
#include "acp_base.h"
#include "itf/CPAMdfO.hpp"
#include "itf/CPAEditB.hpp"
#include "itf/CPAMWorl.hpp"
#include "itf/CPAProj.hpp"
/*===========================================================================
Constructor
=========================================================================*/
CPA_EditorBase::CPA_EditorBase (void)
{
m_oListOfBaseObjectList.RemoveAll();
m_oListOfInvalidObjectList.RemoveAll();
// m_oListOfModifiedBaseObjects.RemoveAll();
m_p_oMainWorld = NULL;
m_stContext.pPreviousEditor = NULL;
// editor info
m_stEditorInfo.csName = "";
m_stEditorInfo.csAuthor = "";
m_stEditorInfo.csVersion = "";
m_stEditorInfo.csFrenchHelpFile = "";
m_stEditorInfo.csEnglishHelpFile = "";
}
CPA_EditorBase::~CPA_EditorBase (void)
{
CPA_BaseObjectList *p_oList;
while (!(m_oListOfBaseObjectList.IsEmpty()))
{
p_oList = m_oListOfBaseObjectList.GetHead();
p_oList->DeleteAllObjects();
delete m_oListOfBaseObjectList.RemoveHead();
}
while (!(m_oListOfInvalidObjectList.IsEmpty()))
{
p_oList = m_oListOfInvalidObjectList.GetHead();
p_oList->DeleteAllObjects();
delete m_oListOfInvalidObjectList.RemoveHead();
}
/*
POSITION stPos = m_oListOfModifiedBaseObjects.GetHeadPosition();
while ( stPos )
{
tdstModifiedObjectsInfo *p_stList = m_oListOfModifiedBaseObjects.GetNext( stPos );
POSITION stPosROLN = p_stList -> m_oListOfModifiedObjects . GetHeadPosition();
while ( stPosROLN )
{
tdstBaseObjectListNamed *p_stROLN = p_stList -> m_oListOfModifiedObjects . GetNext( stPosROLN );
p_stROLN -> m_oListOfBaseObjects . DeleteAllElements ();
delete p_stROLN;
}
p_stList -> m_oListOfModifiedObjects . RemoveAll();
delete p_stList;
}
*/
}
void CPA_EditorBase::SetEditorInfo(CString csName, CString csAuthor,
CString csVersion, CString csFrenchHelpFile, CString csEnglishHelpFile)
{
m_stEditorInfo . csName = csName;
m_stEditorInfo . csAuthor = csAuthor;
m_stEditorInfo . csVersion = csVersion;
m_stEditorInfo . csFrenchHelpFile = csFrenchHelpFile;
m_stEditorInfo . csEnglishHelpFile = csEnglishHelpFile;
}
void CPA_EditorBase::SetMainWorld (CPA_MainWorld *p_oMainWorld)
{
m_p_oMainWorld = p_oMainWorld;
if (m_p_oMainWorld)
m_p_oMainWorld->fn_vRegisterEditor(this);
}
CPA_Interface * CPA_EditorBase::GetInterface (void)
{
return m_p_oMainWorld->GetInterface();
}
/*===========================================================================
Register objects types for BaseObjectsList
=========================================================================*/
void CPA_EditorBase::fn_vRegisterObjectsType (CString a_csTypeName[], long lTypeCount)
{
long iIndex;
for (iIndex = 0; iIndex < lTypeCount; iIndex++)
{
CPA_BaseObjectList *p_oListOfObjects;
// check if there is allready a list with that typename!!!!
ASSERT(m_p_oMainWorld->fn_p_oGetOriginalObjectList(a_csTypeName[iIndex]) == NULL);
// create base object list
p_oListOfObjects = new CPA_BaseObjectList(a_csTypeName[iIndex]);
m_oListOfBaseObjectList.AddTail(p_oListOfObjects);
// create invalid object list
p_oListOfObjects = new CPA_BaseObjectList(a_csTypeName[iIndex]);
m_oListOfInvalidObjectList.AddTail(p_oListOfObjects);
}
}
/*===========================================================================
Get the BaseObjectList corresponding to csTypeName
=========================================================================*/
CPA_BaseObjectList * CPA_EditorBase::GetBaseObjectList (CString csTypeName)
{
CPA_BaseObjectList *p_oListOfObjects;
POSITION pos;
pos = m_oListOfBaseObjectList.GetHeadPosition();
// search list
while(pos)
{
p_oListOfObjects = m_oListOfBaseObjectList.GetNext(pos);
if (p_oListOfObjects->fn_bIsOfType(csTypeName))
return p_oListOfObjects;
}
return NULL;
}
/*===========================================================================
Get the BaseObjectList corresponding to csTypeName
=========================================================================*/
CPA_BaseObjectList * CPA_EditorBase::GetInvalidObjectList (CString csTypeName)
{
CPA_BaseObjectList *p_oListOfObjects;
POSITION pos;
pos = m_oListOfInvalidObjectList.GetHeadPosition();
// search list
while(pos)
{
p_oListOfObjects = m_oListOfInvalidObjectList.GetNext(pos);
if (p_oListOfObjects->fn_bIsOfType(csTypeName))
return p_oListOfObjects;
}
return NULL;
}
/*===========================================================================
Add object to the corresponding BaseObjectList
=========================================================================*/
BOOL CPA_EditorBase::fn_bAddObject (CPA_BaseObject *p_oObject)
{
CPA_BaseObjectList *p_oListOfObjects;
// find the list
if (p_oObject->fn_bIsValid())
p_oListOfObjects = GetBaseObjectList(p_oObject->GetType());
else
p_oListOfObjects = GetInvalidObjectList(p_oObject->GetType());
// if the list for this type of object does not exist
if (!p_oListOfObjects)
{
ASSERT(0);
return FALSE;
}
// add object
return p_oListOfObjects->fn_bAddObject(p_oObject);
}
/*===========================================================================
Remove object from the corresponding BaseObjectList
=========================================================================*/
BOOL CPA_EditorBase::fn_bRemoveObject (CPA_BaseObject *p_oObject)
{
CPA_BaseObjectList *p_oListOfObjects;
// find corresponding list
if (p_oObject->fn_bIsValid())
p_oListOfObjects = GetBaseObjectList(p_oObject->GetType());
else
p_oListOfObjects = GetInvalidObjectList(p_oObject->GetType());
// type of object does not exists in this DLL
if (p_oListOfObjects == NULL)
{
ASSERT(0);
return FALSE;
}
return p_oListOfObjects->fn_bRemoveObject(p_oObject);
}
/*===========================================================================
check if object exists
=========================================================================*/
BOOL CPA_EditorBase::fn_bExist(CPA_BaseObject *p_oObject, tdeResearchCriteria eCriteria)
{
CPA_BaseObjectList *p_oListOfObjects;
BOOL bResult = FALSE;
// look in base object list
if (eCriteria != E_rc_InvalidObjects)
{
p_oListOfObjects = GetBaseObjectList(p_oObject->GetType());
if (p_oListOfObjects)
bResult = p_oListOfObjects->fn_bExist(p_oObject);
}
// look in invalid object list
if ((!bResult)&&(eCriteria != E_rc_ValidObjects))
{
p_oListOfObjects = GetInvalidObjectList(p_oObject->GetType());
if (p_oListOfObjects)
bResult = p_oListOfObjects->fn_bExist(p_oObject);
}
return bResult;
}
/*===========================================================================
check if object exists
=========================================================================*/
BOOL CPA_EditorBase::fn_bExist(CString csObjectName, CString csObjectType, CPA_BaseObject *p_oOwner, tdeResearchCriteria eCriteria)
{
CPA_BaseObjectList *p_oListOfObjects;
POSITION pos;
BOOL bResult = FALSE;
if ((csObjectName.IsEmpty()) && (csObjectType.IsEmpty()) && (p_oOwner == NO_CRITERIA))
{
ASSERT(0);
}
// if type is valid
if (!csObjectType.IsEmpty())
{
// look in base object list
if (eCriteria != E_rc_InvalidObjects)
{
p_oListOfObjects = GetBaseObjectList(csObjectType);
if (p_oListOfObjects)
bResult = fn_bExist(csObjectName,csObjectType,p_oOwner);
}
// look in invalid object list
if ((!bResult)&&(eCriteria != E_rc_ValidObjects))
{
p_oListOfObjects = GetInvalidObjectList(csObjectType);
if (p_oListOfObjects)
bResult = fn_bExist(csObjectName,csObjectType,p_oOwner);
}
return bResult;
}
else
{
// look in every base object list
if (eCriteria != E_rc_InvalidObjects)
{
pos = m_oListOfBaseObjectList.GetHeadPosition();
while (pos)
{
// get the current list
p_oListOfObjects = m_oListOfBaseObjectList.GetNext(pos);
// find the object in this list
if (p_oListOfObjects->fn_bExist(csObjectName,csObjectType,p_oOwner))
return TRUE;
}
}
// look in every invalid object list
if (eCriteria != E_rc_ValidObjects)
{
pos = m_oListOfInvalidObjectList.GetHeadPosition();
while (pos)
{
// get the current list
p_oListOfObjects = m_oListOfInvalidObjectList.GetNext(pos);
// find the object in this list
if (p_oListOfObjects->fn_bExist(csObjectName,csObjectType,p_oOwner))
return TRUE;
}
}
}
return FALSE;
}
/*===========================================================================
find object from its type and name
=========================================================================*/
CPA_BaseObject * CPA_EditorBase::GetBaseObject (CString csObjectName, CString csObjectType, CPA_BaseObject *p_oOwner, tdeResearchCriteria eCriteria)
{
CPA_BaseObjectList *p_oListOfObjects;
CPA_BaseObject *p_oObject = NULL;
POSITION pos;
if ((csObjectName.IsEmpty()) && (csObjectType.IsEmpty()) && (p_oOwner == NO_CRITERIA))
{
ASSERT(0);
}
// if type is valid
if (!csObjectType.IsEmpty())
{
// look in base object list
if (eCriteria != E_rc_InvalidObjects)
{
p_oListOfObjects = GetBaseObjectList(csObjectType);
if (p_oListOfObjects)
p_oObject = p_oListOfObjects->fn_p_oFindObject(csObjectName,csObjectType,p_oOwner);
}
// look in invalid object list
if ((!p_oObject)&&(eCriteria != E_rc_ValidObjects))
{
p_oListOfObjects = GetInvalidObjectList(csObjectType);
if (p_oListOfObjects)
p_oObject = p_oListOfObjects->fn_p_oFindObject(csObjectName,csObjectType,p_oOwner);
}
return p_oObject;
}
else
{
// look in every base object list
if (eCriteria != E_rc_InvalidObjects)
{
pos = m_oListOfBaseObjectList.GetHeadPosition();
while (pos)
{
// get the current list
p_oListOfObjects = m_oListOfBaseObjectList.GetNext(pos);
// find the object in this list
p_oObject = p_oListOfObjects->fn_p_oFindObject(csObjectName,csObjectType,p_oOwner);
if (p_oObject != NULL)
return p_oObject;
}
}
// look in every invalid object list
if (eCriteria != E_rc_ValidObjects)
{
pos = m_oListOfInvalidObjectList.GetHeadPosition();
while (pos)
{
// get the current list
p_oListOfObjects = m_oListOfInvalidObjectList.GetNext(pos);
// find the object in this list
p_oObject = p_oListOfObjects->fn_p_oFindObject(csObjectName,csObjectType,p_oOwner);
if (p_oObject != NULL)
return p_oObject;
}
}
}
return NULL;
}
/*===========================================================================
find object from its type and engine struct
=========================================================================*/
CPA_BaseObject * CPA_EditorBase::GetBaseObject (void *p_vEngineStruct, CString csObjectType, CPA_BaseObject *p_oOwner, tdeResearchCriteria eCriteria)
{
CPA_BaseObjectList *p_oListOfObjects;
CPA_BaseObject *p_oObject = NULL;
POSITION pos;
if ((p_vEngineStruct == NULL) && (csObjectType.IsEmpty()) && (p_oOwner == NO_CRITERIA))
{
ASSERT(0);
}
// if type is valid
if (!csObjectType.IsEmpty())
{
// look in base object list
if (eCriteria != E_rc_InvalidObjects)
{
p_oListOfObjects = GetBaseObjectList(csObjectType);
if (p_oListOfObjects)
p_oObject = p_oListOfObjects->fn_p_oFindObjectWithdData(p_vEngineStruct,csObjectType,p_oOwner);
}
// look in invalid object list
if ((!p_oObject)&&(eCriteria != E_rc_ValidObjects))
{
p_oListOfObjects = GetInvalidObjectList(csObjectType);
if (p_oListOfObjects)
p_oObject = p_oListOfObjects->fn_p_oFindObjectWithdData(p_vEngineStruct,csObjectType,p_oOwner);
}
return p_oObject;
}
else
{
// look in every base object list
if (eCriteria != E_rc_InvalidObjects)
{
pos = m_oListOfBaseObjectList.GetHeadPosition();
while (pos)
{
// get the current list
p_oListOfObjects = m_oListOfBaseObjectList.GetNext(pos);
// find the object in this list
p_oObject = p_oListOfObjects->fn_p_oFindObjectWithdData(p_vEngineStruct,csObjectType,p_oOwner);
if (p_oObject != NULL)
return p_oObject;
}
}
// look in every invalid object list
if (eCriteria != E_rc_ValidObjects)
{
pos = m_oListOfInvalidObjectList.GetHeadPosition();
while (pos)
{
// get the current list
p_oListOfObjects = m_oListOfInvalidObjectList.GetNext(pos);
// find the object in this list
p_oObject = p_oListOfObjects->fn_p_oFindObjectWithdData(p_vEngineStruct,csObjectType,p_oOwner);
if (p_oObject != NULL)
return p_oObject;
}
}
}
return NULL;
}
/*===========================================================================
find objects with given type and name
=========================================================================*/
long CPA_EditorBase::fn_lFindObjects (CPA_List<CPA_BaseObject> *p_oResultList, CString csObjectName, CString csObjectType, CPA_BaseObject *p_oOwner, tdeResearchCriteria eCriteria)
{
CPA_BaseObjectList *p_oListOfObjects;
POSITION pos;
long lResult = 0;
if ((csObjectName.IsEmpty()) && (csObjectType.IsEmpty()) && (p_oOwner == NO_CRITERIA))
{
ASSERT(0);
}
// if type is valid
if (!csObjectType.IsEmpty())
{
// look in base object list
if (eCriteria != E_rc_InvalidObjects)
{
p_oListOfObjects = GetBaseObjectList(csObjectType);
if (p_oListOfObjects)
lResult += p_oListOfObjects->fn_lFindObjects(p_oResultList,csObjectName,csObjectType,p_oOwner);
}
// look in invalid object list
if (eCriteria != E_rc_ValidObjects)
{
p_oListOfObjects = GetInvalidObjectList(csObjectType);
if (p_oListOfObjects)
lResult += p_oListOfObjects->fn_lFindObjects(p_oResultList,csObjectName,csObjectType,p_oOwner);
}
}
else
{
// look in every base object list
if (eCriteria != E_rc_InvalidObjects)
{
pos = m_oListOfBaseObjectList.GetHeadPosition();
while (pos)
{
// get the current list
p_oListOfObjects = m_oListOfBaseObjectList.GetNext(pos);
// find the object in this list
lResult += p_oListOfObjects->fn_lFindObjects(p_oResultList,csObjectName,csObjectType,p_oOwner);
}
}
// look in every invalid object list
if (eCriteria != E_rc_ValidObjects)
{
pos = m_oListOfInvalidObjectList.GetHeadPosition();
while (pos)
{
// get the current list
p_oListOfObjects = m_oListOfInvalidObjectList.GetNext(pos);
// find the object in this list
lResult += p_oListOfObjects->fn_lFindObjects(p_oResultList,csObjectName,csObjectType,p_oOwner);
}
}
}
return lResult;
}
/*
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// for Modified Reachable Objects
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPA_EditorBase::fn_vRegisterModificationsType(CString _csObjectTypeName, CString a_csModificationType[], long lTypeCount)
{
ASSERT( GetBaseObjectList( _csObjectTypeName ) );
tdstModifiedObjectsInfo *p_stList = fn_p_stGetMOInfo( _csObjectTypeName );
if ( !p_stList )
{
// create new
p_stList = new(tdstModifiedObjectsInfo);
p_stList -> m_oObjectType = _csObjectTypeName;
p_stList-> m_oListOfModifiedObjects . RemoveAll();
// add
m_oListOfModifiedBaseObjects . AddTail( p_stList );
}
// add modifications
for ( long i=0 ; i<lTypeCount ; i++ )
{
ASSERT( !fn_bIsRegisterModificationType( p_stList, a_csModificationType[i] ) );
tdstBaseObjectListNamed *p_stROLN = new(tdstBaseObjectListNamed);
p_stROLN -> m_ocsModificationTypeName = a_csModificationType[i];
p_stROLN -> m_oListOfBaseObjects . DeleteAllElements();
// p_stROLN -> m_oListOfBaseObjects . fn_bSetTypeName( _csObjectTypeName );
p_stList -> m_oListOfModifiedObjects . AddTail( p_stROLN );
}
}
*/
/*===========================================================================
=========================================================================*/
/*
long CPA_EditorBase::fn_lFillWithRegisterModificationsType(CPA_List<CString> *_p_oList, CString _csObjectTypeName)
{
ASSERT( GetBaseObjectList( _csObjectTypeName ) );
tdstModifiedObjectsInfo *p_stList = fn_p_stGetMOInfo( _csObjectTypeName );
if( p_stList )
{
POSITION stPos = p_stList->m_oListOfModifiedObjects.GetHeadPosition();
while ( stPos )
{
_p_oList -> AddTail( &(p_stList -> m_oListOfModifiedObjects . GetNext( stPos ) -> m_ocsModificationTypeName) );
}
return ((long)p_stList->m_oListOfModifiedObjects.GetCount());
}
return 0;
}
*/
/*===========================================================================
=========================================================================*/
/*
int CPA_EditorBase::fn_iGetModificationCount(CString _csObjectTypeName)
{
tdstModifiedObjectsInfo *p_stList = fn_p_stGetMOInfo( _csObjectTypeName );
return ( p_stList ? p_stList -> m_oListOfModifiedObjects . GetCount() : 0 );
}
*/
/*===========================================================================
=========================================================================*/
/*
CPA_BaseObjectList* CPA_EditorBase::fn_p_oGetModifiedObjectsList(CString _csObjectTypeName, CString _csModificationType)
{
tdstBaseObjectListNamed *p_stROLN = fn_p_stGetROLN (_csObjectTypeName, _csModificationType);
return ( p_stROLN ? &(p_stROLN -> m_oListOfBaseObjects) : NULL );
}
*/
/*===========================================================================
=========================================================================*/
/*
int CPA_EditorBase::fn_iGetModificationIndex(CString _csObjectTypeName, CString _csModificationType)
{
tdstModifiedObjectsInfo *p_stList = fn_p_stGetMOInfo( _csObjectTypeName );
if(p_stList)
{
int iResult = 0;
POSITION stPos = p_stList -> m_oListOfModifiedObjects . GetHeadPosition();
while ( stPos )
{
if( p_stList -> m_oListOfModifiedObjects . GetNext( stPos ) -> m_ocsModificationTypeName == _csModificationType )
return iResult;
iResult++;
}
}
return -1;
}
*/
/*===========================================================================
=========================================================================*/
/*
CString CPA_EditorBase::fn_csGetModificationByIndex(CString _csObjectTypeName, int _iIndex )
{
tdstModifiedObjectsInfo *p_stList = fn_p_stGetMOInfo( _csObjectTypeName );
if(p_stList)
{
POSITION stPos = p_stList -> m_oListOfModifiedObjects . FindIndex( _iIndex );
return ( stPos ? p_stList -> m_oListOfModifiedObjects . GetAt( stPos ) -> m_ocsModificationTypeName : "");
}
return "";
}
*/
/*===========================================================================
=========================================================================*/
/*
BOOL CPA_EditorBase::fn_bAddModifiedObject(CPA_BaseObject *_p_oObject, CString _csModificationType)
{
tdstBaseObjectListNamed *p_stROLN = fn_p_stGetROLN (_p_oObject -> GetType(), _csModificationType);
if ( p_stROLN )
{
return p_stROLN -> m_oListOfBaseObjects . fn_bAddObject(_p_oObject);
}
return FALSE;
}
*/
/*===========================================================================
=========================================================================*/
/*
BOOL CPA_EditorBase::fn_bRemoveModifiedObject(CPA_BaseObject *_p_oObject, CString _csModificationType)
{
tdstBaseObjectListNamed *p_stROLN = fn_p_stGetROLN (_p_oObject -> GetType(), _csModificationType);
if ( p_stROLN )
{
return p_stROLN -> m_oListOfBaseObjects . fn_bRemoveObject(_p_oObject);
}
return FALSE;
}
*/
/*===========================================================================
=========================================================================*/
/*
BOOL CPA_EditorBase::fn_bIsModified(CPA_BaseObject *_p_oObject, CString _csModificationType )
{
tdstModifiedObjectsInfo *p_stList = fn_p_stGetMOInfo( _p_oObject -> GetType() );
if(p_stList)
{
if ( _csModificationType != "" )
{
tdstBaseObjectListNamed *p_stROLN = fn_p_stGetROLN (p_stList, _csModificationType );
return ( p_stROLN ? p_stROLN -> m_oListOfBaseObjects . fn_bExist( _p_oObject ) : FALSE );
}
else
{
POSITION stPos = p_stList -> m_oListOfModifiedObjects . GetHeadPosition();
while ( stPos )
{
tdstBaseObjectListNamed *p_stROLN = p_stList -> m_oListOfModifiedObjects . GetNext( stPos );
if( (p_stROLN) && p_stROLN -> m_oListOfBaseObjects . fn_bExist( _p_oObject ) )
return TRUE;
}
}
}
return FALSE;
}
*/
/*===========================================================================
for dialog list
=========================================================================*/
void CPA_EditorBase::fn_vInitDefaultParameters (CPA_DialogList *pDialog)
{
pDialog->SetDefaultTestName("No Test");
pDialog->SetDefaultTypeName("");
}
/*===========================================================================
save context when editor changes
=========================================================================*/
void CPA_EditorBase::fn_vSaveContext (void)
{
int i, j;
// save current dll
if (GetMainWorld()->GetCurrentEditor() != this)
{
if (!m_stContext.pPreviousEditor)
{
m_stContext.pPreviousEditor = GetMainWorld()->GetCurrentEditor();
// save and update current editor
if (m_stContext.pPreviousEditor)
{
m_stContext.bCurrentEditor = m_stContext.pPreviousEditor->fn_bIsCurrentEditor();
m_stContext.pPreviousEditor->SetCurrent(FALSE);
}
// save dialogs
memcpy(m_stContext.m_aWinArray, g_oFrameGest.ma_p_oWinArray, sizeof(FRMBase *) * (FRM_C_MaxCol+2) * (FRM_C_MaxRow+2));
}
else
{
m_stContext.pPreviousEditor->SetCurrent(FALSE);
if (GetMainWorld()->GetCurrentEditor())
GetMainWorld()->GetCurrentEditor()->SetCurrent(FALSE);
}
// close all editor frames
for (i=1; i<=FRM_C_MaxCol; i++)
{
for (j=1; j<=FRM_C_MaxRow; j++)
{
if (((i!=2)||(j!=2))&&(g_oFrameGest.ma_p_oWinArray[i][j]))
g_oFrameGest.mfn_vDisactivateWindow(g_oFrameGest.ma_p_oWinArray[i][j]);
}
}
}
}
/*===========================================================================
restore context when editor changes
=========================================================================*/
void CPA_EditorBase::fn_vRestoreContext (void)
{
int i, j;
// restore current dll and editor
if (m_stContext.pPreviousEditor)
{
m_stContext.pPreviousEditor->SetCurrent(m_stContext.bCurrentEditor);
GetMainWorld()->fn_bRestoreEditor(m_stContext.pPreviousEditor);
// close all editor frames
for (i=1; i<=FRM_C_MaxCol; i++)
{
for (j=1; j<=FRM_C_MaxRow; j++)
{
if (((i!=2)||(j!=2))&&(g_oFrameGest.ma_p_oWinArray[i][j]))
g_oFrameGest.mfn_vDisactivateWindow(g_oFrameGest.ma_p_oWinArray[i][j]);
}
}
// restore previous dialogs
for (i=1; i<=FRM_C_MaxCol; i++)
{
for (j=1; j<=FRM_C_MaxRow; j++)
{
if (((i!=2)||(j!=2))&&(m_stContext.m_aWinArray[i][j]))
{
g_oFrameGest.mfn_vActivateWindow(m_stContext.m_aWinArray[i][j]);
m_stContext.m_aWinArray[i][j] = NULL;
}
}
}
}
// reinit context
m_stContext.pPreviousEditor = NULL;
}
/*===========================================================================
=========================================================================*/
CString CPA_EditorBase::GetReferencePath (CString csEntry)
{
CString csFileName, csReferencePath;
char szPath[SCR_CV_ui_Cfg_MaxLenName];
// search ini file for given entry
csFileName = M_GetMainApp()->m_csEditorDataPath + C_szReferenceIniFile;
GetPrivateProfileString ("ReferencePath", (char*)(LPCSTR)csEntry, "", szPath, 256, (char*)(LPCSTR)csFileName);
// build reference path
csReferencePath = szPath;
return csReferencePath;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// private
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*===========================================================================
=========================================================================*/
/*
BOOL CPA_EditorBase::fn_bIsRegisterModificationType(CString _csObjectType, CString _csModificationType)
{
tdstModifiedObjectsInfo *p_stList = fn_p_stGetMOInfo(_csObjectType);
return (p_stList ? fn_bIsRegisterModificationType(p_stList, _csModificationType) : FALSE );
}
*/
/*===========================================================================
=========================================================================*/
/*
BOOL CPA_EditorBase::fn_bIsRegisterModificationType(tdstModifiedObjectsInfo *p_stMOI, CString _csModificationType)
{
POSITION stPos = p_stMOI -> m_oListOfModifiedObjects . GetHeadPosition();
while ( stPos )
{
if( p_stMOI -> m_oListOfModifiedObjects . GetNext( stPos ) -> m_ocsModificationTypeName == _csModificationType )
return TRUE;
}
return FALSE;
}
*/
/*===========================================================================
=========================================================================*/
/*
tdstModifiedObjectsInfo *CPA_EditorBase::fn_p_stGetMOInfo(CString _csObjectType)
{
POSITION stPos = m_oListOfModifiedBaseObjects . GetHeadPosition();
while ( stPos )
{
tdstModifiedObjectsInfo *p_stList = m_oListOfModifiedBaseObjects . GetNext( stPos );
if( p_stList -> m_oObjectType == _csObjectType )
return p_stList;
}
return NULL;
}
*/
/*===========================================================================
=========================================================================*/
/*tdstBaseObjectListNamed *CPA_EditorBase::fn_p_stGetROLN(CString _csObjectType, CString _csModificationType)
{
tdstModifiedObjectsInfo *p_stList = fn_p_stGetMOInfo(_csObjectType);
return (p_stList ? fn_p_stGetROLN(p_stList, _csModificationType) : NULL );
}
*/
/*===========================================================================
=========================================================================*/
/*
tdstBaseObjectListNamed *CPA_EditorBase::fn_p_stGetROLN(tdstModifiedObjectsInfo *_p_stMOI, CString _csModificationType)
{
POSITION stPos = _p_stMOI -> m_oListOfModifiedObjects . GetHeadPosition();
while ( stPos )
{
tdstBaseObjectListNamed *p_stList = _p_stMOI -> m_oListOfModifiedObjects . GetNext( stPos );
if( p_stList -> m_ocsModificationTypeName == _csModificationType )
return p_stList;
}
return NULL;
}
*/
/*===========================================================================
=========================================================================*/
void CPA_EditorBase::fn_vRegisterModificationsType(const CString _csObjectTypeName, CString a_csModificationType[], long lTypeCount)
{
// search CPA_ModifNamesList
CPA_ModifNamesList *p_oList = fn_p_oGetModifNamesList( _csObjectTypeName );
if ( p_oList == NULL )
{
// add list
p_oList = new CPA_ModifNamesList();
p_oList -> fn_vSetObjectTypeName( _csObjectTypeName );
m_oListOfModifications . AddTail( p_oList );
}
p_oList -> fn_vRegisterModificationsType( a_csModificationType, lTypeCount );
}
/*===========================================================================
=========================================================================*/
CPA_ModifNamesList *CPA_EditorBase::fn_p_oGetModifNamesList(const CString _csObjectTypeName)
{
POSITION xPos = m_oListOfModifications . GetHeadPosition();
while ( xPos )
{
CPA_ModifNamesList *p_oList = m_oListOfModifications . GetNext( xPos );
if( p_oList -> fn_csGetObjectTypeName() == _csObjectTypeName )
return p_oList;;
}
return NULL;
}
/*===========================================================================
=========================================================================*/
long CPA_EditorBase::fn_lFillWithModifiedObject(CPA_List<CPA_ModifiableObject> *_p_oTargetList, const CString _csObjectTypeName, const CString _csModifTypeName)
{
BOOL bAddOnList = ( _p_oTargetList != NULL );
long lNbObjects = 0;
CPA_BaseObjectList *p_oList = GetBaseObjectList( _csObjectTypeName );
if( p_oList != NULL )
{
Position xPos = p_oList -> GetHeadPosition();
while ( xPos )
{
CPA_BaseObject *p_oObject = p_oList -> GetNext( xPos );
if( p_oObject -> fn_eGetBaseClass() == E_bc_ModifiableObject )
{
// Modifiable object
CPA_ModifiableObject *p_oModObj = (CPA_ModifiableObject *)p_oObject;
if( p_oModObj -> fn_bIsModified( _csModifTypeName ) )
{
lNbObjects++;
if(bAddOnList) _p_oTargetList -> AddTail( p_oModObj );
}
}
}
}
return lNbObjects;
}
/*===========================================================================
* Description: Get child for tree element (default implementation)
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
CPA_BaseObject * CPA_EditorBase::GetTreeNodeNextChild (CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pParent, CPA_BaseObject *pCurrentChild)
{
CPA_SuperObject *pSupObj, *pChild;
if ((pParent->GetType() == C_szSuperObjectTypeName)&&
((!pCurrentChild)||(pCurrentChild->GetType() == C_szSuperObjectTypeName)))
{
pSupObj = (CPA_SuperObject *) pParent;
pChild = (CPA_SuperObject *) pCurrentChild;
if (pChild)
return pSupObj->GetSuperObjectNextChild(pChild);
else
return pSupObj->GetSuperObjectFirstChild();
}
return NULL;
}
/*===========================================================================
============================================================================
============================================================================
class CPA_ModifNamesList
============================================================================
============================================================================
===========================================================================*/
CPA_ModifNamesList::CPA_ModifNamesList()
{
RemoveAll();
}
CPA_ModifNamesList::~CPA_ModifNamesList()
{
}
void CPA_ModifNamesList::fn_vRegisterModificationsType(CString a_csTypeName[], long lTypeCount)
{
for (long iIndex = 0; iIndex < lTypeCount; iIndex++)
AddTail( a_csTypeName[iIndex] );
}
#endif // ACTIVE_EDITOR