#ifndef __CPAMDF_HPP__
#define __CPAMDF_HPP__
 
#ifdef ACTIVE_EDITOR
 
#include "lst.hpp"
 
#ifdef ACTIVE_EDITOR
 
/****************************************/
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
/****************************************/
 
class CPA_EXPORT CPA_Modif : public CObject
{
private :
	CString Name;
	unsigned short Type;
	unsigned long Serial;
	BOOL m_HasBeenDone;
	static unsigned long LastSerial;
public:
	CPA_Modif(unsigned short pType, CString pName="something", BOOL pBlock = FALSE);
	~CPA_Modif(void){}
	virtual BOOL Do(void)=0;
	virtual BOOL Undo(void)=0;
	void Done(void){m_HasBeenDone=TRUE;}
	void Undone(void){m_HasBeenDone=FALSE;}
	BOOL HasBeenDone(void){return m_HasBeenDone;}
	void SetName(CString pName)	{Name=pName;}
	CString GetName(void)		{return Name;}
	void SetType(unsigned short pType)	{Type=pType;}
	unsigned short GetType(void)		{return Type;}
	unsigned long GetSerial(void)		{return Serial;}
};
 
/*-------------------------------------------------*/
 
class CPA_EXPORT CPA_EditManager : public CObject
{
private :
	POSITION NextPosition;
	POSITION PrevPosition;
	CPA_Modif *NextModif;
	CPA_Modif *PrevModif;
	long CurrentIndex;
	int m_iMaxUndo;/*New NZO 10/10/96*/
	BOOL m_bIsReDoing;
	BOOL m_bIsUnDoing;
 
public:
	CPA_List<CPA_Modif> ListOfModifs;
public :
	CPA_EditManager(int iMaxUndo=0);
	~CPA_EditManager(void);
	BOOL AskFor(CPA_Modif * pModif, BOOL _bDeleteUponFailure = TRUE);
	void Reset(void);/*New NZO 10/10/96*/
	BOOL CanRedo(void)	{return CurrentIndex<ListOfModifs.GetCount();}
	BOOL CanUndo(void)	{return CurrentIndex>0;}
	BOOL Redo(void);
	BOOL Undo(void);
 
	BOOL fn_bIsUnDoing	(void) { return m_bIsUnDoing; }
	BOOL fn_bIsReDoing	(void) { return m_bIsReDoing; }
 
	CString GetRedoName(void);
	CString GetUndoName(void);
};
 
 
#endif /* ACTIVE_EDITOR*/
 
#endif /*ACTIVE_EDITOR*/
 
#endif /* __CPAMDF_HPP__*/
