#ifndef UMDnames_INCLUDED
	#define UMDnames_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
 
class UMDnames : public bncs_script_helper
{
public:
	UMDnames( bncs_client_callback * parent, const char* path );
	virtual ~UMDnames();

	void buttonCallback( buttonNotify *b );
	int revertiveCallback( revertiveNotify * r );
	void databaseCallback( revertiveNotify * r );
	bncs_string parentCallback( parentNotify *p );
	void timerCallback( int );
	
private:
#define SDI_MTX_SIZE	128		// Note that arrays must be defined larger than this if we want to use BNCS numbering 1 to 128.
#define NAMESETS	8			// Number if name sets

	int sdi_id;					// BNCS driver number for CTA SDI router.
	int tally_info_id;			// BNCS driver number for the Tally Infodriver
	int umd_names_id;			// BNCS driver number for user editable names.

	int umd_brightness;			// Current brightness of the Studio A UMD chain. Values 0 to 3 (in practice 1 to 3)
	int umd_active_names;		// Currently active name set. 0 = Use matrix names, 1 to 8 are user selections.
	int new_names;				// Number of user pre-selected name set (awaiting confirm)
	int timeout;				// Count of number of seconds that active state remains active when a new nameset is selected by not confirmed.

	int edit_set;				// Holds the index of the user name set being edited
	int edit_index;				// Holds the source index of the name being edited
	int max_namelength;			// During editing, this variable holds the maximum length of the edited name (in characters)
	int timeoutedit;			// Counter used as part of Cancel/Action timeout processing 

	bool select_active;			// Set true when user has selected a new nameset to use, but has not yet confirmed the selection.
	bool setname_edit;			// Set true when edit the dataset name, flase when edit the source name(s)
	bool edit_active;			// Set true when a source name or dataset name is being edited

	bncs_config myVals;			// Used during read of data from wn_academy.xml

	bncs_string	*current;							// Points to the name of the currently editable name set.
	bncs_string LongNames[SDI_MTX_SIZE + 1];		// Holds the long version of the matrix names
	bncs_string Mtx_Name[SDI_MTX_SIZE + 1];			// List of the short matrix names
	bncs_string UserNames_1[SDI_MTX_SIZE + 1];		// List of the User Names, set 1
	bncs_string UserNames_2[SDI_MTX_SIZE + 1];		// List of the User Names, set 2
	bncs_string UserNames_3[SDI_MTX_SIZE + 1];		// List of the User Names, set 3
	bncs_string UserNames_4[SDI_MTX_SIZE + 1];		// List of the User Names, set 4
	bncs_string UserNames_5[SDI_MTX_SIZE + 1];		// List of the User Names, set 5
	bncs_string UserNames_6[SDI_MTX_SIZE + 1];		// List of the User Names, set 6
	bncs_string UserNames_7[SDI_MTX_SIZE + 1];		// List of the User Names, set 7
	bncs_string UserNames_8[SDI_MTX_SIZE + 1];		// List of the User Names, set 8

	bncs_string	name_names[NAMESETS + 1];			// The names of UserNames_1 to UserNames_8
	bncs_string myedit;								// Used during edit operations to transfer text from buffer to buffer

	bncs_string m_myParam;
	bncs_string m_instance;
	
	// Local Methods
	void disableButtons_1(void);
	void activeNames(void);
	void cancelAction(void);
	void showEditInfo(void);
	void hideEditInfo(void);
};


#endif // UMDnames_INCLUDED