ROOT logo
#ifndef __DGFCptmPanel_h__
#define __DGFCptmPanel_h__

//_________________________________________________[C++ CLASS DEFINITION FILE]
//////////////////////////////////////////////////////////////////////////////
// Name:           DGFCptmPanel.h
// Purpose:        Class defs for the XIA DGF-4C GUI
// Class:          DGFCptmPanel
// Description:    A GUI to operate a XIA DGF-4C
// Author:         R. Lutter
// Revision:       $Id: DGFCptmPanel.h,v 1.6 2008-12-29 13:48:24 Rudolf.Lutter Exp $       
// Date:           
// URL:            
// Keywords:       
//////////////////////////////////////////////////////////////////////////////

#include "TList.h"

#include "TGWindow.h"
#include "TGFrame.h"
#include "TGButton.h"
#include "TGMenu.h"

#include "TMrbLofNamedX.h"
#include "TMrbNamedX.h"
#include "TMrbDGF.h"

#include "TGMrbTextButton.h"
#include "TGMrbRadioButton.h"
#include "TGMrbCheckButton.h"
#include "TGMrbLabelEntry.h"
#include "TGMrbLabelCombo.h"
#include "TGMrbMacroBrowser.h"


//______________________________________________________[C++ CLASS DEFINITION]
//////////////////////////////////////////////////////////////////////////////
// Name:           DGFCptmPanel
// Purpose:        Main frame to control a cptm module
// Constructors:   
// Description:    A dialog window to enter settings for a cptm module
// Keywords:       
//////////////////////////////////////////////////////////////////////////////

class DGFCptmPanel : public TGCompositeFrame {

	public:

		// cmd ids to dispatch over X events in this panel
		enum EDGFCptmCmdId 	{
									kDGFCptmSelectModule, 				//		module
									kDGFCptmGeDelayEntry, 				//		DGG(Ge):		delay
									kDGFCptmGeWidthEntry,			  	//						width
									kDGFCptmAuxDelayEntry, 				//		DGG(Aux):		delay
									kDGFCptmAuxWidthEntry,			  	//						width

									kDGFCptmTimeWdwEntry,				//		time window aux
									kDGFCptmMultValueEntry, 			//		multiplicity	value
									kDGFCptmMultDacEntry,				//						dac
									kDGFCptmAddrReadEntry,				//		address 		(read)
									kDGFCptmAddrWriteEntry,				//						(write)
									kDGFCptmMaskRegisterBtns,				//		mask register
									kDGFCptmButtonDownloadCode,			//	buttons:	download
									kDGFCptmButtonReset,				//				reset
									kDGFCptmButtonSave, 				//				save settings
									kDGFCptmButtonRestore, 				//				restore settings
									kDGFCptmButtonSynchEnable, 			//				synch enable
									kDGFCptmButtonSynchEnableReset, 	//				+ reset clock
									kDGFCptmButtonShowEvent,		 	//				show next event data
									kDGFCptmButtonShowBuffer,		 	//				show buffer data
									kDGFCptmButtonResetAddr,		 	//				reset addr ptr
									kDGFCptmButtonUpdateAddr,			//				update addr ptr
								};


		enum EDGFCptmMaskBits 	{	kDGFCptmMaskE2	=	BIT(0),
									kDGFCptmMaskT2	=	BIT(1),
									kDGFCptmMaskT1	=	BIT(2),
									kDGFCptmMaskQ4	=	BIT(3),
									kDGFCptmMaskQ3	=	BIT(4),
									kDGFCptmMaskQ2	=	BIT(5),
									kDGFCptmMaskQ1	=	BIT(6),
									kDGFCptmMaskGe	=	BIT(7)
								};

	public:
		DGFCptmPanel(TGCompositeFrame * TabFrame);
		virtual ~DGFCptmPanel() {
			fFocusList.Clear();
			fHeap.Delete();
		};

		Int_t GetLofCptmModules();
		inline Int_t GetNofCptmModules() { return(fLofCptmModules.GetEntriesFast()); };

		void InitializeValues(Int_t ModuleIndex = -1);

		void Reset(Int_t ModuleIndex = -1);
		Bool_t DownloadCode(Int_t ModuleIndex = -1);
		Bool_t SaveSettings(Int_t ModuleIndex = -1);
		Bool_t RestoreSettings(Int_t ModuleIndex = -1);
		void EnableSynch(Int_t ModuleIndex = -1, Bool_t ResetClock = kFALSE);
		void ShowNextEvent(Int_t ModuleIndex);
		void ShowBuffer(Int_t ModuleIndex, const Char_t * FileName = NULL);
		void ResetAddrPointers(Int_t ModuleIndex);

		void PerformAction(Int_t FrameId, Int_t Selection); 	// slot methods
		void EntryChanged(Int_t FrameId, Int_t Selection);
		void SelectModule(Int_t FrameId, Int_t Selection);

	protected:
		void UpdateValue(Int_t EntryId, Int_t ModuleIndex);
		void MoveFocus(Int_t EntryId);

	protected:
		TList fHeap;								//! list of objects created on heap

		Int_t fCptmIndex;							// current cptm index

		TGGroupFrame * fSelectFrame; 				// select
		TGMrbLabelCombo * fSelectModule; 			//		module

		TGHorizontalFrame * fH1Frame;				// horiz frame for DGGs & Mult
		TGGroupFrame * fGeFrame;					//		DGG(Ge)
		TGMrbLabelEntry * fGeDelayEntry;			//			delay
		TGMrbLabelEntry * fGeWidthEntry;			//			width
		TGGroupFrame * fAuxFrame;					//		DGG(Aux)
		TGMrbLabelEntry * fAuxDelayEntry;			//			delay
		TGMrbLabelEntry * fAuxWidthEntry;			//			width
		TGMrbLabelEntry * fTimeWdwEntry; 			//			time window
		TGGroupFrame * fMultFrame;					//		multiplicity
		TGMrbLabelEntry * fMultValueEntry; 			//			value
		TGMrbLabelEntry * fMultVoltsEntry; 			//			volts
		TGMrbLabelEntry * fMultDacEntry; 			//			dac

		TGHorizontalFrame * fH2Frame;				// horiz frame for mask & addr
		TGMrbCheckButtonGroup * fCptmMaskReg;		//		mask register
		TGGroupFrame * fAddrFrame;					//		addr pointers
		TGMrbLabelEntry * fAddrReadEntry; 			//			read
		TGMrbLabelEntry * fAddrWriteEntry; 			//			write

		TGMrbTextButtonGroup * fCptmButtonFrame;	// buttons

		TMrbLofNamedX fLofCptmModules;				//! list of modules
		TMrbLofNamedX fCptmActions;					//! list of actions

		TGMrbFocusList fFocusList;

	ClassDef(DGFCptmPanel, 0) 	// [DGFControl] Edit C_PTM settings
};

#endif
 DGFCptmPanel.h:1
 DGFCptmPanel.h:2
 DGFCptmPanel.h:3
 DGFCptmPanel.h:4
 DGFCptmPanel.h:5
 DGFCptmPanel.h:6
 DGFCptmPanel.h:7
 DGFCptmPanel.h:8
 DGFCptmPanel.h:9
 DGFCptmPanel.h:10
 DGFCptmPanel.h:11
 DGFCptmPanel.h:12
 DGFCptmPanel.h:13
 DGFCptmPanel.h:14
 DGFCptmPanel.h:15
 DGFCptmPanel.h:16
 DGFCptmPanel.h:17
 DGFCptmPanel.h:18
 DGFCptmPanel.h:19
 DGFCptmPanel.h:20
 DGFCptmPanel.h:21
 DGFCptmPanel.h:22
 DGFCptmPanel.h:23
 DGFCptmPanel.h:24
 DGFCptmPanel.h:25
 DGFCptmPanel.h:26
 DGFCptmPanel.h:27
 DGFCptmPanel.h:28
 DGFCptmPanel.h:29
 DGFCptmPanel.h:30
 DGFCptmPanel.h:31
 DGFCptmPanel.h:32
 DGFCptmPanel.h:33
 DGFCptmPanel.h:34
 DGFCptmPanel.h:35
 DGFCptmPanel.h:36
 DGFCptmPanel.h:37
 DGFCptmPanel.h:38
 DGFCptmPanel.h:39
 DGFCptmPanel.h:40
 DGFCptmPanel.h:41
 DGFCptmPanel.h:42
 DGFCptmPanel.h:43
 DGFCptmPanel.h:44
 DGFCptmPanel.h:45
 DGFCptmPanel.h:46
 DGFCptmPanel.h:47
 DGFCptmPanel.h:48
 DGFCptmPanel.h:49
 DGFCptmPanel.h:50
 DGFCptmPanel.h:51
 DGFCptmPanel.h:52
 DGFCptmPanel.h:53
 DGFCptmPanel.h:54
 DGFCptmPanel.h:55
 DGFCptmPanel.h:56
 DGFCptmPanel.h:57
 DGFCptmPanel.h:58
 DGFCptmPanel.h:59
 DGFCptmPanel.h:60
 DGFCptmPanel.h:61
 DGFCptmPanel.h:62
 DGFCptmPanel.h:63
 DGFCptmPanel.h:64
 DGFCptmPanel.h:65
 DGFCptmPanel.h:66
 DGFCptmPanel.h:67
 DGFCptmPanel.h:68
 DGFCptmPanel.h:69
 DGFCptmPanel.h:70
 DGFCptmPanel.h:71
 DGFCptmPanel.h:72
 DGFCptmPanel.h:73
 DGFCptmPanel.h:74
 DGFCptmPanel.h:75
 DGFCptmPanel.h:76
 DGFCptmPanel.h:77
 DGFCptmPanel.h:78
 DGFCptmPanel.h:79
 DGFCptmPanel.h:80
 DGFCptmPanel.h:81
 DGFCptmPanel.h:82
 DGFCptmPanel.h:83
 DGFCptmPanel.h:84
 DGFCptmPanel.h:85
 DGFCptmPanel.h:86
 DGFCptmPanel.h:87
 DGFCptmPanel.h:88
 DGFCptmPanel.h:89
 DGFCptmPanel.h:90
 DGFCptmPanel.h:91
 DGFCptmPanel.h:92
 DGFCptmPanel.h:93
 DGFCptmPanel.h:94
 DGFCptmPanel.h:95
 DGFCptmPanel.h:96
 DGFCptmPanel.h:97
 DGFCptmPanel.h:98
 DGFCptmPanel.h:99
 DGFCptmPanel.h:100
 DGFCptmPanel.h:101
 DGFCptmPanel.h:102
 DGFCptmPanel.h:103
 DGFCptmPanel.h:104
 DGFCptmPanel.h:105
 DGFCptmPanel.h:106
 DGFCptmPanel.h:107
 DGFCptmPanel.h:108
 DGFCptmPanel.h:109
 DGFCptmPanel.h:110
 DGFCptmPanel.h:111
 DGFCptmPanel.h:112
 DGFCptmPanel.h:113
 DGFCptmPanel.h:114
 DGFCptmPanel.h:115
 DGFCptmPanel.h:116
 DGFCptmPanel.h:117
 DGFCptmPanel.h:118
 DGFCptmPanel.h:119
 DGFCptmPanel.h:120
 DGFCptmPanel.h:121
 DGFCptmPanel.h:122
 DGFCptmPanel.h:123
 DGFCptmPanel.h:124
 DGFCptmPanel.h:125
 DGFCptmPanel.h:126
 DGFCptmPanel.h:127
 DGFCptmPanel.h:128
 DGFCptmPanel.h:129
 DGFCptmPanel.h:130
 DGFCptmPanel.h:131
 DGFCptmPanel.h:132
 DGFCptmPanel.h:133
 DGFCptmPanel.h:134
 DGFCptmPanel.h:135
 DGFCptmPanel.h:136
 DGFCptmPanel.h:137
 DGFCptmPanel.h:138
 DGFCptmPanel.h:139
 DGFCptmPanel.h:140
 DGFCptmPanel.h:141
 DGFCptmPanel.h:142
 DGFCptmPanel.h:143
 DGFCptmPanel.h:144
 DGFCptmPanel.h:145
 DGFCptmPanel.h:146
 DGFCptmPanel.h:147
 DGFCptmPanel.h:148
 DGFCptmPanel.h:149
 DGFCptmPanel.h:150
 DGFCptmPanel.h:151
 DGFCptmPanel.h:152