// EdIRBVwD.cpp : implementation file
//

#include "stdafx.h"

#include "Defines.hpp"

#ifdef D_ED_IR_ACTIVE

#include "EdIRBVwX.hpp"

#include "EdIRBVw.hpp"
#include "EdIRBeEn.hpp"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_UndoDeleteAllBehaviours
/////////////////////////////////////////////////////////////////////////////

/**********************************************************************************/
CPA_EdIR_UndoDeleteAllBehaviours::CPA_EdIR_UndoDeleteAllBehaviours(CPA_EdIR_DiagView *pclDiagView,
																   CPA_EdIR_MainBehaviourList *pclMainBehaviourList,
																   BOOL bBlock)
	:CPA_Modif(3,"Delete All Behaviours",bBlock)
{
	m_pclDiagView=pclDiagView;
	m_pclMainBehaviourList=pclMainBehaviourList;

	POSITION	pos=pclMainBehaviourList->GetHeadPosition();
	while(pos!=NULL)
	{
		CPA_EdIR_MainBehaviour *pclMainBehaviour=pclMainBehaviourList->GetNext(pos);

		m_clMainBehaviourList.AddTail(pclMainBehaviour);
	}
}

/**********************************************************************************/
CPA_EdIR_UndoDeleteAllBehaviours::~CPA_EdIR_UndoDeleteAllBehaviours()
{
}

/**********************************************************************************/
BOOL CPA_EdIR_UndoDeleteAllBehaviours::Do()
{
	m_pclMainBehaviourList->m_fn_vSetModified(TRUE);

	return m_pclDiagView->m_fn_bDeleteAllBehavioursFromList();
}

/**********************************************************************************/
BOOL CPA_EdIR_UndoDeleteAllBehaviours::Undo()
{
	m_pclDiagView->m_fn_vAddAllBehavioursInList(&m_clMainBehaviourList);
	m_pclMainBehaviourList->m_fn_vSetModified(TRUE);

	return TRUE;
}

#endif //D_ED_IR_ACTIVE
