//ROMTEAM Networks (Gabriela Dumitrascu 15/03/98)

/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : NtwMod.hpp
//   
// Modification classes
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from CPA_Modif
//					
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 98-03-15                        Author: CPA2 Gabriela Dumitrascu
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date:			                      Author: 
///////////////////////////////////////////////////////////////////////////////////////////////////
*/

#ifndef __NTWMOD_HPP__
#define __NTWMOD_HPP__

#include "NtwObj.hpp"

#define GRAPH_INSERT_GRAPH	0
#define GRAPH_DELETE_GRAPH	1
#define GRAPH_INSERT_NODE	2
#define GRAPH_DELETE_NODE	3
#define GRAPH_INSERT_ARC	4
#define GRAPH_DELETE_ARC	5
#define GRAPH_RENAME_GRAPH	6

class ModifGraph : public CPA_Modif
{
protected:
	Graph *m_poGraph;
	WP_tdHandleOfGraph m_hOldGraph, m_hNewGraph;

public :
	ModifGraph(Graph *poGraph, unsigned short type);
	void ModifSave();
	BOOL Do (void);
	BOOL Undo (void);
};

// Shaitan Correction {

//===========================================================================
class DeleteGraph : public CPA_Modif
{
private:
	// editor parameters
	Graph			*m_pGraph;
	// flags
	BOOL			m_bDeleted;
	BOOL			m_bFirstTime;

public:
	DeleteGraph	(Graph *pGraph);
	~DeleteGraph (void);

	BOOL Do		(void);
	BOOL Undo	(void);
};

//===========================================================================
class RenameGraph : public CPA_Modif
{
private:
	// editor parameters
	Graph			*m_pGraph;
	CString			m_csOldName;
	CString			m_csNewName;
	// flags
	BOOL			m_bFirstTime;

public:
	RenameGraph	(Graph *pGraph, CString csNewName);
	~RenameGraph (void);

	BOOL Do		(void);
	BOOL Undo	(void);
};

//===========================================================================
class InsertNode : public CPA_Modif
{
private:
	// editor parameters
	Graph			*m_pGraph;
	WayPoint		*m_pNode;
	// flags
	BOOL			m_bInserted;
	BOOL			m_bFirstTime;

public:
	InsertNode	(Graph *pGraph, WayPoint *pNode, BOOL pBlock);
	~InsertNode	(void);

	BOOL Do		(void);
	BOOL Undo	(void);
};

//===========================================================================
class DeleteNode : public CPA_Modif
{
private:
	// editor parameters
	Graph			*m_pGraph;
	WayPoint		*m_pNode;
	// connections
	CPA_List<CPA_SuperObject> m_lstConnections;
	// flags
	BOOL			m_bDeleted;
	BOOL			m_bFirstTime;

public:
	DeleteNode	(Graph *pGraph, WayPoint *pNode, BOOL pBlock);
	~DeleteNode	(void);

	BOOL Do		(void);
	BOOL Undo	(void);
};

//===========================================================================
class InsertConnection : public CPA_Modif
{
private:
	// editor parameters
	Graph			*m_pGraph;
	WayPoint		*m_pSrcWaypoint;
	WayPoint		*m_pDstWaypoint;
	CPA_SuperObject *m_pArrow;
	// engine parameters
	WP_tdhGraphNode	m_hSrcNode;
	WP_tdhGraphNode m_hDstNode;
	// flags
	BOOL			m_bInserted;
	BOOL			m_bUpdate;
	BOOL			m_bFirstTime;

public:
	InsertConnection	(Graph *pGraph, WayPoint *pSrcWaypoint, WayPoint *pDstWaypoint, BOOL bUpdate, BOOL pBlock);
	~InsertConnection	(void);

	BOOL Do		(void);
	BOOL Undo	(void);
};


//===========================================================================
class DeleteConnection : public CPA_Modif
{
private:
	// editor parameters
	Graph			*m_pGraph;
	WayPoint		*m_pSrcWaypoint;
	WayPoint		*m_pDstWaypoint;
	CPA_SuperObject *m_pArrow;
	// engine parameters
	WP_tdhGraphNode	m_hSrcNode;
	WP_tdhGraphNode m_hDstNode;
	// flags
	BOOL			m_bDeleted;
	BOOL			m_bFirstTime;

public:
	DeleteConnection	(Graph *pGraph, WayPoint *pSrcWaypoint, WayPoint *pDstWaypoint, BOOL pBlock);
	~DeleteConnection	(void);

	BOOL Do		(void);
	BOOL Undo	(void);
};


//End Shaitan Correction }

#endif

//ENDROMTEAM Networks (Gabriela Dumitrascu)
