#include "daqMainFrame.hh" //============================================================================================= // //============================================================================================= TCanvas* daqMainFrame::add_tab(/*TGString*/ char* name) { // container of "Tab1" TCanvas* c1; //TGCompositeFrame *fComp; fComp = fTab->AddTab(name); fComp->SetLayoutManager(new TGVerticalLayout(fComp)); //fTab->Resize(fTab->GetDefaultSize()); // embedded canvas TRootEmbeddedCanvas *fRootEmbCan = new TRootEmbeddedCanvas(0,fComp,1289,870); Int_t wfRootEmbCan = fRootEmbCan->GetCanvasWindowId(); //char cname[100]; //sprintf(cname,"canvas_%d",id); c1 = new TCanvas(name, 10, 10, wfRootEmbCan); fRootEmbCan->AdoptCanvas(c1); fComp->AddFrame(fRootEmbCan, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTab->MoveResize(200,2,1298,897); //-- size_1 //fRootEmbCan->MoveResize(0,0,1089,870); //c1->Divide(4,5); MapSubwindows(); return c1; } //============================================================================================= // //============================================================================================= Bool_t daqMainFrame::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) { // Process events generated by the buttons in the frame. printf("SF:: %d ==> %d ==>%d %ld pressed\n", (int)GET_MSG(msg),(int)GET_SUBMSG(msg),(int)msg,parm1); ULong_t yellow,reg,green,gray; switch (GET_MSG(msg)) { case kC_COMMAND: switch (GET_SUBMSG(msg)) { /*___________________________________*/ case kCM_TAB: printf("Tab pressed %d\n",(int)parm1); CurrentTAB=parm1; break; /*___________________________________*/ case kCM_COMBOBOX : printf("combox id %ld %ld pressed\n", parm1,parm2); break; case kCM_BUTTON: printf("text button id %ld pressed\n", parm1); switch(parm1) { case b_EXIT: printf("EXIT button pressed\n"); v_EXIT=1; break; case b_SAVE: printf("SAVE button pressed\n"); v_SAVE=1; break; case b_PAUSE: printf("PAUSE button pressed: before=%d ",v_PAUSE); v_PAUSE=!v_PAUSE; if ( v_PAUSE ) { fPause->ChangeText("Continue"); gClient->GetColorByName("yellow", yellow); fPause->ChangeBackground(yellow); } else { fPause->ChangeText("Pause"); gClient->GetColorByName("gray", gray); fPause->ChangeBackground(gray); } printf("after=%d \n",v_PAUSE); break; default: break; } //---------- end buttons --- default: break; } } return kTRUE; } //============================================================================================= // //============================================================================================= //daqMainFrame::daqMainFrame(const TGWindow *p, UInt_t w, UInt_t h) { //daqMainFrame::daqMainFrame(const TGWindow *p, UInt_t w, UInt_t h): TGMainFrame(p, w, h) { daqMainFrame::daqMainFrame(const TGWindow *p, UInt_t w, UInt_t h): TGMainFrame(p, w, h, kMainFrame | kVerticalFrame) { v_UPDATE=0; v_SEND=0; v_PAUSE=0;v_EXIT=0; v_SAVE=0;; // use hierarchical cleaning SetCleanup(kDeepCleanup); // main frame //this = new TGMainFrame(gClient->GetRoot(),10,10,kMainFrame | kVerticalFrame); //TGMainFrame *fMain = new TGMainFrame(NULL,900,700,kMainFrame | kVerticalFrame); //-------- example for not inherited class : // MyMainFrame::MyMainFrame(const TGWindow *p,UInt_t w,UInt_t h) { // Create a main frame //fMain = new TGMainFrame(p,w,h); SetName("DAQ Monitor"); SetLayoutBroken(kTRUE); CurrentTAB=0; // tab widget fTab = new TGTab(this,1290,895); /* // container of "Tab1" //TGCompositeFrame *fComp1; fComp1 = fTab->AddTab("Tab1"); fComp1->SetLayoutManager(new TGVerticalLayout(fComp1)); // embedded canvas TRootEmbeddedCanvas *fRootEmbeddedCanvas718 = new TRootEmbeddedCanvas(0,fComp1,1089,870); Int_t wfRootEmbeddedCanvas718 = fRootEmbeddedCanvas718->GetCanvasWindowId(); cdt[0][0] = new TCanvas("cdt00", 10, 10, wfRootEmbeddedCanvas718); fRootEmbeddedCanvas718->AdoptCanvas(cdt[0][0]); fComp1->AddFrame(fRootEmbeddedCanvas718, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); cdt[0][0]->Divide(4,5); Nhist[0][0]=4*5; */ fTab->SetTab(0); fTab->Resize(fTab->GetDefaultSize()); AddFrame(fTab, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTab->MoveResize(200,2,1098,897); TGCheckButton *fTextButton624 = new TGCheckButton(this,"Asynchronous"); fTextButton624->SetTextJustify(36); fTextButton624->SetMargins(0,0,0,0); fTextButton624->SetWrapLength(-1); AddFrame(fTextButton624, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton624->MoveResize(40,64,111,17); TGCheckButton *fTextButton629 = new TGCheckButton(this,"Opt.2"); fTextButton629->SetTextJustify(36); fTextButton629->SetMargins(0,0,0,0); fTextButton629->SetWrapLength(-1); AddFrame(fTextButton629, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton629->MoveResize(40,88,111,17); TGCheckButton *fTextButton634 = new TGCheckButton(this,"Opt.3"); fTextButton634->SetTextJustify(36); fTextButton634->SetMargins(0,0,0,0); fTextButton634->SetWrapLength(-1); AddFrame(fTextButton634, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton634->MoveResize(40,112,111,17); ULong_t ucolor; // will reflect user color changes gClient->GetColorByName("#ffffff",ucolor); // combo box TGComboBox *fSubsystem = new TGComboBox(this,-1,kHorizontalFrame | kSunkenFrame | kDoubleBorder | kOwnBackground); fSubsystem->SetName("Subsystem"); fSubsystem->AddEntry("Entry 1 ",0); fSubsystem->AddEntry("Entry 2 ",1); fSubsystem->AddEntry("Entry 3 ",2); fSubsystem->AddEntry("Entry 4 ",3); fSubsystem->AddEntry("Entry 5 ",4); fSubsystem->AddEntry("Entry 6 ",5); fSubsystem->AddEntry("Entry 7 ",6); fSubsystem->Resize(102,20); fSubsystem->Select(-1); AddFrame(fSubsystem, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fSubsystem->MoveResize(40,280,102,20); // list box TGListBox *fDataSource = new TGListBox(this); fDataSource->SetName("DataSource"); fDataSource->AddEntry("FCAL",0); fDataSource->AddEntry("BCAL",1); fDataSource->AddEntry("FDC",2); fDataSource->AddEntry("CDC",3); fDataSource->AddEntry("TOF",4); fDataSource->AddEntry("TRIGGER",5); fDataSource->AddEntry("PS",6); fDataSource->Resize(102,88); AddFrame(fDataSource, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fDataSource->MoveResize(40,384,102,88); //--- TGLabel *fOption = new TGLabel(this,"Update Options"); fOption->SetTextJustify(36); fOption->SetMargins(0,0,0,0); fOption->SetWrapLength(-1); AddFrame(fOption, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fOption->MoveResize(35,35,100,16); TGLabel *fLabel725 = new TGLabel(this,"Subsystem"); fLabel725->SetTextJustify(36); fLabel725->SetMargins(0,0,0,0); fLabel725->SetWrapLength(-1); AddFrame(fLabel725, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fLabel725->MoveResize(25,240,100,16); TGLabel *fLabel730 = new TGLabel(this,"Configuration"); fLabel730->SetTextJustify(36); fLabel730->SetMargins(0,0,0,0); fLabel730->SetWrapLength(-1); AddFrame(fLabel730, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fLabel730->MoveResize(25,350,100,16); TGHorizontal3DLine *fHorizontal3DLine743 = new TGHorizontal3DLine(this,182,8); fHorizontal3DLine743->SetName("fHorizontal3DLine743"); AddFrame(fHorizontal3DLine743, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fHorizontal3DLine743->MoveResize(8,320,182,8); TGHorizontal3DLine *fHorizontal3DLine748 = new TGHorizontal3DLine(this,184,8); fHorizontal3DLine748->SetName("fHorizontal3DLine748"); AddFrame(fHorizontal3DLine748, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fHorizontal3DLine748->MoveResize(8,200,184,8); fPause = new TGTextButton(this,"&Pause",b_PAUSE); fPause->SetTextJustify(36); fPause->SetMargins(0,0,0,0); fPause->SetWrapLength(-1); //fPause->Resize(94,22); AddFrame(fPause, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fPause->MoveResize(40,160,94,22); TGTextButton *fTextButton753 = new TGTextButton(this,"&Send",b_SEND); fTextButton753->SetTextJustify(36); fTextButton753->SetMargins(0,0,0,0); fTextButton753->SetWrapLength(-1); fTextButton753->Resize(94,22); AddFrame(fTextButton753, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton753->MoveResize(40,520,94,22); TGLayoutHints *fLayout; fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,5,5,0,0); Pixel_t col; TGFont *ufont,*ufont1; //gClient->GetColorByName("#72c9f6",col); gClient->GetColorByName("#DDDDAA",col); ufont = gClient->GetFont("-*-andy mt-bold-r-*-*-18-*-*-*-*-*-*-*"); ufont1 = gClient->GetFont("-*-andy mt-bold-r-*-*-*-*-*-*-*-*-*-*"); Lrunnum = new TGLabel(this,"Run:"); Lrunnum->ChangeBackground(col); Lrunnum->SetTextFont(ufont,kFALSE); AddFrame(Lrunnum, fLayout); Lrunnum->MoveResize(40,620,93,25); Levtnum = new TGLabel(this,"Evt:"); Levtnum ->ChangeBackground(col); Levtnum ->SetTextFont(ufont,kFALSE); AddFrame(Levtnum, fLayout); Levtnum->MoveResize(40,645,93,25); TGTextButton *fButtonSave = new TGTextButton(this,"&Save",b_SAVE); fButtonSave->SetTextJustify(36); fButtonSave->SetMargins(0,0,0,0); fButtonSave->SetWrapLength(-1); fButtonSave->Resize(94,22); AddFrame(fButtonSave, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fButtonSave->MoveResize(40,750,94,22); TGTextButton *fTextButton754 = new TGTextButton(this,"&Exit",b_EXIT); fTextButton754->SetTextJustify(36); fTextButton754->SetMargins(0,0,0,0); fTextButton754->SetWrapLength(-1); fTextButton754->Resize(94,22); AddFrame(fTextButton754, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton754->MoveResize(40,850,94,22); //Layout(); SetWindowName("GlueX DAQ Monitor"); SetIconName("GlueX DQM"); SetMWMHints(kMWMDecorAll, kMWMFuncAll, kMWMInputModeless); MapSubwindows(); Resize(GetDefaultSize()); SetWMPosition(100, 100); MapWindow(); Move(100, 100); Resize(1500,900); //-- size_2 } //============================================================================================= // //============================================================================================= int daqMainFrame::ViewMyFrame(int ID) { fTab->SetTab(0); fTab->Resize(fTab->GetDefaultSize()); AddFrame(fTab, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); //fTabMain->MoveResize(0,0,W,H-5); Resize(GetDefaultSize()); MapSubwindows(); Layout(); SetWindowName("GlueX DQM"); SetIconName("GlueX DQM"); printf("Done3\n"); MapWindow(); printf("Done4\n"); return 0; } //============================================================================================= // //============================================================================================= void daqMainFrame::CloseWindow() { printf(" Got close message for this MainFrame. Terminates the application. \n"); v_EXIT=1; // gApplication->Terminate(); }