783 lines
22 KiB
C++
783 lines
22 KiB
C++
//#################################################################################
|
|
//
|
|
// BASE IMPLEMENTATION CLASS OF DLL interface Modification
|
|
//
|
|
//#################################################################################
|
|
//
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "ACP_Base.h"
|
|
#include "incITF.h"
|
|
|
|
#include "TAC.h"
|
|
#include "TFa.h"
|
|
#include "TAn.h"
|
|
#include "OAc.h"
|
|
|
|
#include "ZAModif.hpp"
|
|
#include "ACInterf.hpp"
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// MACROS
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
#define M_ForEachElement(oList,p_oElement,Pos)\
|
|
for( p_oElement = (oList) . GetHeadElement( Pos ) ;\
|
|
p_oElement ;\
|
|
p_oElement = (oList) . GetNextElement( Pos )\
|
|
)
|
|
|
|
#define M_ForEachEntry(oMap,p_oKey,p_oValue,Pos)\
|
|
Pos = (oMap) . GetStartPosition();\
|
|
if(Pos)\
|
|
for( p_oKey = NULL, p_oValue = NULL, (oMap) . GetNextAssoc( Pos, p_oKey, p_oValue ) ;\
|
|
Pos ;\
|
|
p_oKey = NULL, p_oValue = NULL, (oMap) . GetNextAssoc( Pos, p_oKey, p_oValue ) )
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZAList_New
|
|
|
|
ZAList_New::ZAList_New(TAction_Interface *_p_oParentDLL, CPA_tdoNameList *_p_oNameList, CString _csName)
|
|
:CPA_Modif(0, "New List of Activations", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oNameList = _p_oNameList;
|
|
m_p_oZAList = NULL;
|
|
m_csName = _csName;
|
|
}
|
|
|
|
ZAList_New::~ZAList_New()
|
|
{
|
|
if ( !HasBeenDone() && m_p_oZAList )
|
|
{
|
|
delete m_p_oZAList;
|
|
}
|
|
}
|
|
|
|
BOOL ZAList_New::Do()
|
|
{
|
|
if ( m_p_oZAList == NULL )
|
|
{
|
|
m_p_oZAList = new CPA_ZonesActivatingList( m_p_oParentDLL, m_p_oNameList, m_csName );
|
|
|
|
}
|
|
else
|
|
{
|
|
m_p_oZAList -> fn_bValidate();
|
|
m_p_oZAList -> fn_vNotifySave();
|
|
}
|
|
|
|
m_p_oNameList -> fn_vUpdateReference( m_p_oZAList );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAListCreated( m_p_oZAList );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZAList_New::Undo()
|
|
{
|
|
m_p_oZAList -> fn_bUnValidate();
|
|
m_p_oZAList -> fn_vNotifyUnSave();
|
|
m_p_oNameList -> fn_vUpdateReference( m_p_oZAList );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAListDeleted ( m_p_oNameList ) ;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZAList_Copy
|
|
|
|
ZAList_Copy::ZAList_Copy(TAction_Interface *_p_oParentDLL, CPA_ZonesActivatingList *_p_oSourceZAList)
|
|
:CPA_Modif(0, "Copy of List of Activations", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oSourceZAList = _p_oSourceZAList;
|
|
m_p_oTargetZAList = NULL;
|
|
}
|
|
|
|
ZAList_Copy::~ZAList_Copy()
|
|
{
|
|
if( !HasBeenDone() && m_p_oTargetZAList )
|
|
delete m_p_oTargetZAList;
|
|
}
|
|
|
|
// actions
|
|
BOOL ZAList_Copy::Do()
|
|
{
|
|
if( m_p_oTargetZAList == NULL )
|
|
{
|
|
m_p_oTargetZAList = m_p_oSourceZAList -> mfn_p_oDuplicateZAList();
|
|
}
|
|
else
|
|
{
|
|
m_p_oTargetZAList -> fn_bValidate();
|
|
m_p_oTargetZAList -> fn_vNotifySave();
|
|
}
|
|
((CPA_SaveObject*)m_p_oTargetZAList -> GetOwner()) -> fn_vUpdateReference( m_p_oTargetZAList );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAListCreated( m_p_oTargetZAList );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZAList_Copy::Undo()
|
|
{
|
|
m_p_oTargetZAList -> fn_bUnValidate();
|
|
m_p_oTargetZAList -> fn_vNotifyUnSave();
|
|
((CPA_SaveObject*)m_p_oTargetZAList -> GetOwner()) -> fn_vUpdateReference( m_p_oTargetZAList );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAListDeleted ( (CPA_tdoNameList*)m_p_oSourceZAList -> GetOwner() ) ;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZAList_Rename
|
|
|
|
ZAList_Rename::ZAList_Rename(TAction_Interface *_p_oParentDLL, CPA_ZonesActivatingList *_p_oZAList, CString _csName)
|
|
:CPA_Modif(0, "Rename List of Activations", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oZAList = _p_oZAList;
|
|
m_csName = _csName;
|
|
}
|
|
|
|
ZAList_Rename::~ZAList_Rename()
|
|
{
|
|
}
|
|
|
|
// actions
|
|
BOOL ZAList_Rename::Do()
|
|
{
|
|
CString csLastName = m_p_oZAList -> GetName();
|
|
|
|
// delete previous subsection
|
|
m_p_oZAList -> fn_bUnValidate();
|
|
((CPA_SaveObject*)m_p_oZAList -> GetOwner()) -> fn_vUpdateReference( m_p_oZAList );
|
|
// rename
|
|
m_p_oZAList -> fn_bValidate();
|
|
tdeMissingCriteria eCriteria = m_p_oZAList -> fn_eRename( m_csName );
|
|
// save new subsection
|
|
((CPA_SaveObject*)m_p_oZAList -> GetOwner()) -> fn_vUpdateReference( m_p_oZAList );
|
|
if( eCriteria != E_mc_None )
|
|
return FALSE;
|
|
|
|
m_csName = csLastName;
|
|
// notify Coherence Manager
|
|
g_oCoherenceManager . m_fn_vNotifyObjectModification( m_p_oZAList, 0 );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAListCreated( m_p_oZAList );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZAList_Rename::Undo()
|
|
{
|
|
return Do();
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZAList_Delete
|
|
|
|
ZAList_Delete::ZAList_Delete(TAction_Interface *_p_oParentDLL, CPA_ZonesActivatingList *_p_oZAList)
|
|
:CPA_Modif(0, "Delete List of Activations", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oZAList = _p_oZAList;
|
|
}
|
|
|
|
ZAList_Delete::~ZAList_Delete()
|
|
{
|
|
if( HasBeenDone() && m_p_oZAList )
|
|
{
|
|
//
|
|
POSITION xPos;
|
|
CPA_ActivationState *p_oZAST;
|
|
M_ForEachElement( m_p_oZAList -> m_oListOfZAState, p_oZAST, xPos )
|
|
{
|
|
CPA_ZonesActivating *p_oZA = p_oZAST -> mfn_p_oGetZA();
|
|
CPA_State *p_oState = p_oZAST -> mfn_p_oGetState();
|
|
if( p_oState && p_oZA )
|
|
m_p_oZAList -> mfn_vSetZAFromState( NULL, p_oState );
|
|
}
|
|
//
|
|
delete m_p_oZAList;
|
|
}
|
|
}
|
|
|
|
// actions
|
|
BOOL ZAList_Delete::Do()
|
|
{
|
|
m_p_oZAList -> fn_bUnValidate();
|
|
m_p_oZAList -> fn_vNotifyUnSave();
|
|
((CPA_SaveObject*)m_p_oZAList -> GetOwner()) -> fn_vUpdateReference( m_p_oZAList );
|
|
g_oCoherenceManager . m_fn_vDeleteObject( m_p_oZAList );
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAListDeleted ( (CPA_tdoNameList*)m_p_oZAList -> GetOwner() ) ;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZAList_Delete::Undo()
|
|
{
|
|
m_p_oZAList -> fn_bValidate();
|
|
m_p_oZAList -> fn_vNotifyRestore();
|
|
((CPA_SaveObject*)m_p_oZAList -> GetOwner()) -> fn_vUpdateReference( m_p_oZAList );
|
|
g_oCoherenceManager . m_fn_vRestoreObject( m_p_oZAList );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAListCreated ( m_p_oZAList ) ;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZAList_ExtendToFamily
|
|
|
|
ZAList_ExtendToFamily::ZAList_ExtendToFamily(TAction_Interface *_p_oParentDLL, CPA_ZonesActivatingList *_p_oZAList,
|
|
CPA_ZonesActivating *_p_oZA, CPA_List<CPA_State> *_p_oListOfDisplayStates)
|
|
:CPA_Modif(0, "Extend Activation to Family", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oZAList = _p_oZAList;
|
|
m_p_oZA = _p_oZA;
|
|
m_p_oListOfDisplayStates = _p_oListOfDisplayStates;
|
|
m_oListOfZAState . RemoveAll();
|
|
}
|
|
|
|
ZAList_ExtendToFamily::~ZAList_ExtendToFamily()
|
|
{
|
|
m_oListOfZAState . RemoveAll();
|
|
}
|
|
|
|
BOOL ZAList_ExtendToFamily::Do()
|
|
{
|
|
CPA_Family *p_oFamily = (CPA_Family*) m_p_oZAList -> GetOwner() -> GetOwner();
|
|
CPA_ActivationState *p_oStZA = NULL;
|
|
CPA_State *p_oState = NULL;
|
|
POSITION xPos;
|
|
|
|
// save current Map
|
|
M_ForEachElement( m_p_oZAList -> m_oListOfZAState, p_oStZA, xPos )
|
|
{
|
|
m_oListOfZAState . SetAt( p_oStZA -> mfn_p_oGetState(), p_oStZA -> mfn_p_oGetZA() );
|
|
}
|
|
// set map to given ZA
|
|
M_ForEachElement( p_oFamily -> m_oListOfStates, p_oState, xPos )
|
|
{
|
|
m_p_oZAList -> mfn_vSetZAFromState( m_p_oZA, p_oState );
|
|
}
|
|
//m_p_oZAList -> fn_vNotifySave();
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAToStateChanged( m_p_oListOfDisplayStates );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZAList_ExtendToFamily::Undo()
|
|
{
|
|
CPA_ActivationState *p_oStZA = NULL;
|
|
CPA_State *p_oState = NULL;
|
|
CPA_ZonesActivating *p_oZA = NULL;
|
|
POSITION xPos;
|
|
|
|
// restore previous map
|
|
M_ForEachElement( m_p_oZAList -> m_oListOfZAState, p_oStZA, xPos )
|
|
{
|
|
m_oListOfZAState . SetAt( p_oStZA -> mfn_p_oGetState(), NULL );
|
|
}
|
|
M_ForEachEntry( m_oListOfZAState, p_oState, p_oZA, xPos )
|
|
{
|
|
m_p_oZAList -> mfn_vSetZAFromState( p_oZA, p_oState);
|
|
}
|
|
//m_p_oZAList -> fn_vNotifySave();
|
|
m_oListOfZAState . RemoveAll();
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAToStateChanged( m_p_oListOfDisplayStates );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZAList_ExtendToAction
|
|
|
|
ZAList_ExtendToAction::ZAList_ExtendToAction(TAction_Interface *_p_oParentDLL, CPA_Action *_p_oAction,
|
|
CPA_ZonesActivatingList *_p_oZAList,
|
|
CPA_ZonesActivating *_p_oZA, CPA_List<CPA_State> *_p_oListOfDisplayStates)
|
|
:CPA_Modif(0, "Extend Activation to Action", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oAction = _p_oAction;
|
|
m_p_oZAList = _p_oZAList;
|
|
m_p_oZA = _p_oZA;
|
|
m_p_oListOfDisplayStates = _p_oListOfDisplayStates;
|
|
m_oListOfZAState . RemoveAll();
|
|
}
|
|
|
|
ZAList_ExtendToAction::~ZAList_ExtendToAction()
|
|
{
|
|
m_oListOfZAState . RemoveAll();
|
|
}
|
|
|
|
BOOL ZAList_ExtendToAction::Do()
|
|
{
|
|
POSITION xPos;
|
|
CPA_State *p_oState;
|
|
|
|
// save current Map
|
|
M_ForEachElement( m_p_oAction -> m_oListOfStates, p_oState, xPos )
|
|
{
|
|
m_oListOfZAState . SetAt( p_oState, m_p_oZAList -> mfn_p_oGetZAFromState( p_oState ) );
|
|
}
|
|
// set map to given ZA
|
|
M_ForEachElement( m_p_oAction -> m_oListOfStates, p_oState, xPos )
|
|
{
|
|
m_p_oZAList -> mfn_vSetZAFromState( m_p_oZA, p_oState );
|
|
}
|
|
//m_p_oZAList -> fn_vNotifySave();
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAToStateChanged( m_p_oListOfDisplayStates );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZAList_ExtendToAction::Undo()
|
|
{
|
|
CPA_State *p_oState = NULL;
|
|
CPA_ZonesActivating *p_oZA = NULL;
|
|
POSITION xPos;
|
|
|
|
// restore previous map
|
|
M_ForEachEntry( m_oListOfZAState, p_oState, p_oZA, xPos )
|
|
{
|
|
m_p_oZAList -> mfn_vSetZAFromState( p_oZA, p_oState );
|
|
}
|
|
//m_p_oZAList -> fn_vNotifySave();
|
|
m_oListOfZAState . RemoveAll();
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAToStateChanged( m_p_oListOfDisplayStates );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZAList_SetZAToState
|
|
|
|
ZAList_SetZAToState::ZAList_SetZAToState(TAction_Interface *_p_oParentDLL, CPA_ZonesActivatingList *_p_oZAList,
|
|
CPA_List<CPA_State> *_p_oListOfDisplayStates)
|
|
:CPA_Modif(0, "Change Activation to State", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oZAList = _p_oZAList;
|
|
m_p_oListOfDisplayStates = _p_oListOfDisplayStates;
|
|
m_oListOfChanged . RemoveAll();
|
|
}
|
|
|
|
ZAList_SetZAToState::~ZAList_SetZAToState()
|
|
{
|
|
while( ! m_oListOfChanged . IsEmpty() )
|
|
{
|
|
free( m_oListOfChanged . RemoveHead() );
|
|
}
|
|
m_oListOfChanged . RemoveAll();
|
|
}
|
|
|
|
void ZAList_SetZAToState::mfn_vAddZAToState( CPA_ZonesActivating *_p_oZA, CPA_State *_p_oState )
|
|
{
|
|
tdstZAStates *p_stZAST = (tdstZAStates*) malloc( sizeof(tdstZAStates) );
|
|
p_stZAST -> m_p_oState = _p_oState;
|
|
p_stZAST -> m_p_oNewZA = _p_oZA;
|
|
m_oListOfChanged . AddTail( p_stZAST );
|
|
}
|
|
|
|
BOOL ZAList_SetZAToState::Do()
|
|
{
|
|
tdstZAStates *p_stZAST;
|
|
POSITION xPos;
|
|
M_ForEachElement( m_oListOfChanged, p_stZAST, xPos )
|
|
{
|
|
CPA_ZonesActivating *p_oPreviousZA = m_p_oZAList -> mfn_p_oGetZAFromState( p_stZAST -> m_p_oState );
|
|
|
|
m_p_oZAList -> mfn_vSetZAFromState( p_stZAST -> m_p_oNewZA, p_stZAST -> m_p_oState );
|
|
|
|
p_stZAST -> m_p_oNewZA = p_oPreviousZA;
|
|
}
|
|
//m_p_oZAList -> fn_vNotifySave();
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAToStateChanged( m_p_oListOfDisplayStates );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZAList_SetZAToState::Undo()
|
|
{
|
|
return Do();
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZA_New
|
|
|
|
ZA_New::ZA_New(TAction_Interface *_p_oParentDLL, CPA_tdoNameList *_p_oNameList, CString _csName)
|
|
:CPA_Modif(0, "New Activation", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oNameList = _p_oNameList;
|
|
m_p_oZA = NULL;
|
|
m_csName = _csName;
|
|
}
|
|
|
|
ZA_New::~ZA_New()
|
|
{
|
|
if ( !HasBeenDone() && m_p_oZA )
|
|
{
|
|
delete m_p_oZA;
|
|
}
|
|
}
|
|
|
|
BOOL ZA_New::Do()
|
|
{
|
|
if ( m_p_oZA == NULL )
|
|
{
|
|
m_p_oZA = new CPA_ZonesActivating( m_p_oParentDLL, m_p_oNameList, m_csName );
|
|
}
|
|
else
|
|
{
|
|
m_p_oZA -> fn_bValidate();
|
|
m_p_oZA -> fn_vNotifySave();
|
|
}
|
|
// first ZA ????
|
|
if( m_p_oNameList -> m_fnp_oGetDefaultZA() == NULL )
|
|
m_p_oNameList -> m_fnv_SetDefaultZA( m_p_oZA );
|
|
//
|
|
m_p_oNameList -> fn_vUpdateReference( m_p_oZA );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZACreated( m_p_oZA );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZA_New::Undo()
|
|
{
|
|
m_p_oZA -> fn_bUnValidate();
|
|
// first ZA ????
|
|
if( m_p_oZA == m_p_oNameList -> m_fnp_oGetDefaultZA() )
|
|
m_p_oNameList -> m_fnv_SetDefaultZA( NULL );
|
|
//
|
|
m_p_oZA -> fn_vNotifyUnSave();
|
|
m_p_oNameList -> fn_vUpdateReference( m_p_oZA );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZADeleted ( m_p_oZA ) ;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZA_Modify
|
|
|
|
ZA_Modify::ZA_Modify(TAction_Interface *_p_oParentDLL, CPA_ZonesActivating *_p_oZA,
|
|
unsigned short _usIndex, BOOL _bNewState)
|
|
:CPA_Modif(0, "Change Activation", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oZA = _p_oZA;
|
|
m_usIndex = _usIndex;
|
|
m_bNewState = _bNewState;
|
|
}
|
|
|
|
ZA_Modify::~ZA_Modify()
|
|
{
|
|
}
|
|
|
|
BOOL ZA_Modify::Do()
|
|
{
|
|
m_p_oZA -> mfn_vSetZoneActivation( m_usIndex, m_bNewState);
|
|
m_p_oZA -> fn_vNotifySave();
|
|
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAChanged ( m_p_oZA, (int)m_usIndex ) ;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZA_Modify::Undo()
|
|
{
|
|
m_p_oZA -> mfn_vSetZoneActivation( m_usIndex, !m_bNewState);
|
|
m_p_oZA -> fn_vNotifySave();
|
|
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAChanged ( m_p_oZA, (int)m_usIndex ) ;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZA_Copy
|
|
|
|
ZA_Copy::ZA_Copy(TAction_Interface *_p_oParentDLL, CPA_ZonesActivating *_p_oSourceZA)
|
|
:CPA_Modif(0, "Copy of Activation", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oSourceZA = _p_oSourceZA;
|
|
m_p_oTargetZA = NULL;
|
|
}
|
|
|
|
ZA_Copy::~ZA_Copy()
|
|
{
|
|
if( !HasBeenDone() && m_p_oTargetZA )
|
|
delete m_p_oTargetZA;
|
|
}
|
|
|
|
// actions
|
|
BOOL ZA_Copy::Do()
|
|
{
|
|
if( m_p_oTargetZA == NULL )
|
|
{
|
|
m_p_oTargetZA = m_p_oSourceZA -> mfn_p_oDuplicateZA();
|
|
}
|
|
else
|
|
{
|
|
m_p_oTargetZA -> fn_bValidate();
|
|
m_p_oTargetZA -> fn_vNotifySave();
|
|
}
|
|
((CPA_SaveObject*)m_p_oTargetZA -> GetOwner()) -> fn_vUpdateReference( m_p_oTargetZA );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZACreated( m_p_oTargetZA );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZA_Copy::Undo()
|
|
{
|
|
m_p_oTargetZA -> fn_bUnValidate();
|
|
m_p_oTargetZA -> fn_vNotifyUnSave();
|
|
((CPA_SaveObject*)m_p_oTargetZA -> GetOwner()) -> fn_vUpdateReference( m_p_oTargetZA );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZADeleted ( m_p_oTargetZA ) ;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZA_Rename
|
|
|
|
ZA_Rename::ZA_Rename(TAction_Interface *_p_oParentDLL, CPA_ZonesActivating *_p_oZA, CString _csName)
|
|
:CPA_Modif(0, "Rename Activation", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oZA = _p_oZA;
|
|
m_csName = _csName;
|
|
}
|
|
|
|
ZA_Rename::~ZA_Rename()
|
|
{
|
|
}
|
|
|
|
// actions
|
|
BOOL ZA_Rename::Do()
|
|
{
|
|
tdstZAUsed *p_stZAUsed;
|
|
POSITION xPos;
|
|
CString csLastName = m_p_oZA -> GetName();
|
|
|
|
// delete previous subsection
|
|
m_p_oZA -> fn_bUnValidate();
|
|
((CPA_SaveObject*)m_p_oZA -> GetOwner()) -> fn_vUpdateReference( m_p_oZA );
|
|
// rename
|
|
m_p_oZA -> fn_bValidate();
|
|
tdeMissingCriteria eCriteria = m_p_oZA -> fn_eRename( m_csName );
|
|
// add new subsection
|
|
((CPA_SaveObject*)m_p_oZA -> GetOwner()) -> fn_vUpdateReference( m_p_oZA );
|
|
if( eCriteria != E_mc_None )
|
|
return FALSE;
|
|
|
|
m_csName = csLastName;
|
|
// notify all ZAList using ZA
|
|
M_ForEachElement( m_p_oZA -> m_oListOfZAListUsing, p_stZAUsed, xPos )
|
|
{
|
|
if( p_stZAUsed -> p_oZAList -> fn_bIsValid() )
|
|
p_stZAUsed -> p_oZAList -> mfn_vZARenamed( m_p_oZA );
|
|
}
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZACreated( m_p_oZA );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZA_Rename::Undo()
|
|
{
|
|
return Do();
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZA_Delete
|
|
|
|
ZA_Delete::ZA_Delete(TAction_Interface *_p_oParentDLL, CPA_ZonesActivating *_p_oZA)
|
|
:CPA_Modif(0, "Delete Activation", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oZA = _p_oZA;
|
|
m_bDefault = ( m_p_oZA == ((CPA_tdoNameList*) m_p_oZA -> GetOwner()) -> m_fnp_oGetDefaultZA() );
|
|
}
|
|
|
|
ZA_Delete::~ZA_Delete()
|
|
{
|
|
if( HasBeenDone() && m_p_oZA )
|
|
delete m_p_oZA;
|
|
}
|
|
|
|
// actions
|
|
BOOL ZA_Delete::Do()
|
|
{
|
|
tdstZAUsed *p_stZAUsed;
|
|
POSITION xPos;
|
|
CPA_tdoNameList *p_oOwnerNameList = (CPA_tdoNameList*) m_p_oZA -> GetOwner();
|
|
CPA_ZonesActivating *p_oZADefault = (CPA_ZonesActivating*) p_oOwnerNameList -> m_fnp_oGetDefaultZA();
|
|
|
|
m_p_oZA -> fn_bUnValidate();
|
|
m_p_oZA -> fn_vNotifyUnSave();
|
|
p_oOwnerNameList -> fn_vUpdateReference( m_p_oZA );
|
|
|
|
// default ZA ??????
|
|
if( m_bDefault )
|
|
{
|
|
// search new Default ZA
|
|
p_oOwnerNameList -> m_fnv_SetDefaultZA( NULL );
|
|
p_oZADefault = m_p_oZA -> mfn_p_oGetDefaultZA();
|
|
p_oOwnerNameList -> m_fnv_SetDefaultZA( p_oZADefault );
|
|
}
|
|
// delete ZA on ZAList
|
|
M_ForEachElement( m_p_oZA -> m_oListOfZAListUsing, p_stZAUsed, xPos )
|
|
{
|
|
if( p_stZAUsed -> p_oZAList -> fn_bIsValid() )
|
|
p_stZAUsed -> p_oZAList -> mfn_vSetZAFromState( p_oZADefault, p_stZAUsed -> p_oState );
|
|
}
|
|
//
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZADeleted ( m_p_oZA ) ;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL ZA_Delete::Undo()
|
|
{
|
|
tdstZAUsed *p_stZAUsed;
|
|
POSITION xPos;
|
|
|
|
m_p_oZA -> fn_bValidate();
|
|
m_p_oZA -> fn_vNotifyRestore();
|
|
((CPA_SaveObject*)m_p_oZA -> GetOwner()) -> fn_vUpdateReference( m_p_oZA );
|
|
|
|
// default ZA ????
|
|
if ( m_bDefault )
|
|
{
|
|
CPA_tdoNameList *p_oOwnerNameList = (CPA_tdoNameList*) m_p_oZA -> GetOwner();
|
|
p_oOwnerNameList -> m_fnv_SetDefaultZA( m_p_oZA );
|
|
}
|
|
// restore ZA on ZAList
|
|
M_ForEachElement( m_p_oZA -> m_oListOfZAListUsing, p_stZAUsed, xPos )
|
|
{
|
|
if( p_stZAUsed -> p_oZAList -> fn_bIsValid() )
|
|
p_stZAUsed -> p_oZAList -> mfn_vSetZAFromState( m_p_oZA, p_stZAUsed -> p_oState );
|
|
}
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZACreated ( m_p_oZA ) ;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// class ZA_Default
|
|
|
|
ZA_Default::ZA_Default(TAction_Interface *_p_oParentDLL, CPA_ZonesActivating *_p_oNewZA)
|
|
:CPA_Modif(0, "Set Default Activation", FALSE)
|
|
{
|
|
m_p_oParentDLL = _p_oParentDLL;
|
|
m_p_oNewDefaultZA = _p_oNewZA;
|
|
}
|
|
|
|
ZA_Default::~ZA_Default()
|
|
{
|
|
}
|
|
|
|
// actions
|
|
BOOL ZA_Default::Do()
|
|
{
|
|
return mfn_vMakeModif();
|
|
}
|
|
|
|
BOOL ZA_Default::Undo()
|
|
{
|
|
return mfn_vMakeModif();
|
|
}
|
|
|
|
BOOL ZA_Default::mfn_vMakeModif()
|
|
{
|
|
CPA_tdoNameList *p_oNameList = (CPA_tdoNameList*)m_p_oNewDefaultZA -> GetOwner();
|
|
CPA_ZonesActivating *p_oCurrentDefault = (CPA_ZonesActivating*)p_oNameList -> m_fnp_oGetDefaultZA();
|
|
|
|
if( m_p_oNewDefaultZA == p_oCurrentDefault )
|
|
return FALSE;
|
|
|
|
p_oNameList -> m_fnv_SetDefaultZA( m_p_oNewDefaultZA );
|
|
p_oNameList -> fn_vUpdateReference( m_p_oNewDefaultZA );
|
|
p_oNameList -> fn_vUpdateReference( p_oCurrentDefault );
|
|
|
|
// update display
|
|
if( m_p_oParentDLL -> fn_bIsCurrentEditor () )
|
|
m_p_oParentDLL -> mfn_vZAChanged( m_p_oNewDefaultZA, -1 ) ;
|
|
|
|
m_p_oNewDefaultZA = p_oCurrentDefault;
|
|
|
|
return TRUE;
|
|
} |