#ifndef TakeUndoCancel_INCLUDED
	#define TakeUndoCancel_INCLUDED

#include <bncs_script_helper.h>

#ifdef WIN32
	#ifdef DOEXPORT_SCRIPT
		#define EXPORT_SCRIPT __declspec(dllexport) 
	#else
		#define EXPORT_SCRIPT 
	#endif
#else 
	#define EXPORT_SCRIPT
#endif
 
#define MAX_MTX_DEST 200

class StC_TakeCancel : public bncs_script_helper
{
public:
	StC_TakeCancel(bncs_client_callback * parent, const char* path);
	virtual ~StC_TakeCancel();

	void buttonCallback( buttonNotify *b );
	int revertiveCallback( revertiveNotify * r );
	void databaseCallback( revertiveNotify * r );
	bncs_string parentCallback( parentNotify *p );
	void timerCallback( int );
	
private:
	bncs_string m_instance;		// Package names
	bncs_string m_sdiRouter;	// SDI router instance name
	bncs_string m_anlRouter;	// Analogue audio router instance name
	bncs_string m_aesRouter;	// AES digital audio router instance name
	bncs_string m_xptRouter;	// Crosspoint lists for package name(s)

	bncs_string bgndState;		// Name of statesheet that defines background panel colour
	bncs_string takeHighState;	// Name of statesheet that defines TAKE button flash colour 1
	bncs_string takeLowState;	// Name of statesheet that defines TAKE button flash colour 1

	int namesID;			// BNCS Driver ID passed to us by instance - Package names
	int sdiID;				// BNCS Driver ID for SDI router.
	int anlID;				// BNCS Driver ID for analogue audio router.
	int aesID;				// BNCS Driver ID for AES digital router.
	int xptID;				// BNCS Driver ID holding crosspoint list for routers

	int sourceID;			// Source ID from selection panel
	int destID;				// Destination ID from selection panel
	int takeCounter;		// Holds the count value that limits the TAKE enabled availability
	int numSources;			// Number of sources for router matrixID
	int numDestinations;	// Number of destinations for router matrixID

	bool takeEnabled;		// Indicates that the TAKE button is active - valid source and destination available
	bool m_takeDouble;		// Flag used to hold the double press property for TAKE button
	bool m_goodMtxSet;
	bool m_useVideo;		// Flag indicating if the video layer should be routed
	bool m_useAnalAudio;	// Flag indicating if the analogue audio should be routed
	bool m_useAES;			// Flag indicating if the AES digital audio layer should be routed.
	
	void checkTakeEnable(void);		// Function that checks for valid source and destination
	void checkMatrixSet(void);		// Function to test if we have a valid set of matrix data
	void getXpointData(const int dataBaseID, const int xptid, int *sdixpt, int *anlxpt, int *aesxpt);
};


#endif // TakeUndoCancel_INCLUDED