#include "TGDockableFrame.h" #include "TGMenu.h" #include "TGMdiDecorFrame.h" #include "TG3DLine.h" #include "TGMdiFrame.h" #include "TGMdiMainFrame.h" #include "TGuiBldHintsButton.h" #include "TGMdiMenu.h" #include "TGColorDialog.h" #include "TGListBox.h" #include "TGNumberEntry.h" #include "TGScrollBar.h" #include "TGuiBldHintsEditor.h" #include "TGFrame.h" #include "TGFileDialog.h" #include "TGShutter.h" #include "TGButtonGroup.h" #include "TGCanvas.h" #include "TGFSContainer.h" #include "TGButton.h" #include "TGuiBldEditor.h" #include "TGFSComboBox.h" #include "TGLabel.h" #include "TGProgressBar.h" #include "TGMsgBox.h" #include "TRootGuiBuilder.h" #include "TGTab.h" #include "TGListView.h" #include "TGSplitter.h" #include "TGStatusBar.h" #include "TGToolTip.h" #include "TGToolBar.h" #include "TRootEmbeddedCanvas.h" #include "TCanvas.h" #include "TGuiBldDragManager.h" #include "Riostream.h" #include "TCutG.h" #include "TDatime.h" #include "TH2F.h" #include "TH1F.h" #include "TAxis.h" #include "TNtuple.h" #include "TImage.h" #include "TASImage.h" #include "TRotation.h" #include "TVector3.h" #include "TFile.h" #include "fstream" #include "iostream" #include "iomanip" #include #include #include using namespace std; class TList; const int DATANT = 20; const char *filetypesin[] = { "All files", "*", 0, 0 }; const char *filetypesout[] = { "All files", "*", 0, 0 }; const char *numlabel[] = { "Min. Cluster adu", "Max. Cluster adu", "# of Pix in clust", "Rotate by degree", "Bottom left x, y", "Top right x, y" }; const Double_t numinit[] = { 0, 3000, 3, 0.0, 0.0, 0.0, 1241.0, 1152.0 }; enum EMenuIds { M_FILE_OPEN, M_FILE_CLOSE, M_FILE_EXIT, M_FILE_QUICK_OPEN, M_WINDOW_HOR, M_WINDOW_VERT, M_WINDOW_OPAQUE, M_WINDOW_ARRANGE, M_ANAL_CLUST, M_CONVERT_TIFF, M_HELP_CONTENTS, M_HELP_ABOUT, M_SAVE_IMG, M_SAVE_TXT, M_CUT_DATA, M_CLUSINT_DIST }; class TGAppMainFrame { RQ_OBJECT("TGAppMainFrame") public: TGAppMainFrame(const TGWindow *p, int w, int h); ~TGAppMainFrame(); void HandleMenu(Int_t id); void InitMenu(); void InitMenuPlot(); void InitPlot(); void InitTGMDI(); void CloseWindow(); TList *fCleanup; TGMainFrame *fMain; TGMdiMainFrame *fMainFrame; TGMdiMenuBar *fMenuBar; TGMdiMenuBar *fMenuBar_plot; TGLayoutHints *fMenuBarItemLayout; TGLayoutHints *fMenuBarItemLayout_plot; TGPopupMenu *fMenuFile, *fMenuConv, *fMenuWindow, *fMenuHelp; TGPopupMenu *fMenuFile_plot, *fMenuAnal_plot; TGFont *ufont; // will reflect user font changes TGGC *uGC; // will reflect user GC changes ULong_t ucolor; // will reflect user color changes TGNumberEntry *fNumericEntries[13]; TGLabel *fLabel[13]; TGCheckButton * fCheckButton_rotate; TGCheckButton * fCheckButton_cut; TGCheckButton * fCheckButton_bin; // TGMdiFrame ** plot; TGMdiFrame * plot_alldata; TRootEmbeddedCanvas ** fRootEmbeddedCanvas; TRootEmbeddedCanvas * fRootEmbeddedCanvas_alldata; TGStatusBar * fSStatusBar; GCValues_t valButton; Int_t wfRootEmbeddedCanvas; // TGMainFrame *fMainFrame; TGNumberEntry * fNumberEntry3916; TGNumberEntry * fNumberEntry_flagcut; TGNumberEntry * fNumberEntry_frame; TGNumberEntry * fNumberEntry_prepix; // TGHProgressBar *fHProgressBar3920; TGCheckButton * fCheckButtonClusterize; TGCheckButton * fCheckButton3912; TGCheckButton * fCheckButton3913; TGCheckButton * fCheckButton_flag; TGCompositeFrame *fCompositeFrame3911; TGVerticalFrame *fMainFrame3910_0; TGHorizontalFrame *fMainFrame3910_01; TGVerticalFrame *fMainFrame3910_1; TGVerticalFrame *fMainFrame3910_2; TGVerticalFrame *fMainFrame3910_3; TGTextButton *fTextButton3925_0; TGTextButton *fTextButton3926; TGShutter *fShutter; TGMdiFrame * tgmdiFrame; void HandleCheckButton1(); void HandleCheckButton2(); void HandleCheckButton3(); void HandleCheckButton4(); void HandleCheckButtonRotate(); void HandleCheckButtonCut(); void HandleCheckButtonBin(); void AddShutterItem1(const char *name); void AddShutterItem2(const char *name); }; //---------------------------------------------------------------------- TGAppMainFrame::TGAppMainFrame(const TGWindow *p, int w, int h) { gStyle->SetCanvasColor(0); gStyle->SetCanvasBorderMode(0); gStyle->SetPadColor(0); gStyle->SetPadBorderMode(0); gStyle->SetFrameBorderMode(0); //intialization fNumberEntry3916 = NULL; fNumberEntry_flagcut = NULL; fNumberEntry_frame = NULL; fNumberEntry_prepix = NULL; // fHProgressBar3920 = NULL; fCheckButtonClusterize = NULL; fCheckButton3912 = NULL; fCheckButton3913 = NULL; fCheckButton_flag = NULL; fCompositeFrame3911 = NULL; fMainFrame3910_0 = NULL; fMainFrame3910_01 = NULL; fMainFrame3910_1 = NULL; fMainFrame3910_2 = NULL; fMainFrame3910_3 = NULL; fTextButton3925_0 = NULL; fTextButton3926 = NULL; fShutter = NULL; tgmdiFrame = NULL; fMain= NULL; fMainFrame= NULL; fMenuBar= NULL; fMenuBar_plot= NULL; fMenuBarItemLayout= NULL; fMenuBarItemLayout_plot= NULL; fMenuFile = NULL; fMenuConv = NULL; fMenuWindow = NULL; fMenuHelp= NULL; fMenuFile_plot = NULL; fMenuAnal_plot= NULL; ufont= NULL; uGC= NULL; fCheckButton_rotate= NULL; fCheckButton_cut= NULL; fCheckButton_bin= NULL; // plot= NULL; plot_alldata= NULL; fRootEmbeddedCanvas= NULL; fRootEmbeddedCanvas_alldata= NULL; fSStatusBar= NULL; // end initialization // Memory management isn't the best in this class, but make a half // hearted attempts not to gush too much.... fCleanup = new TList; fMain = new TGMainFrame(p, w, h, kVerticalFrame); fCleanup->Add(fMain); fMenuBar = new TGMdiMenuBar(fMain, 10, 10); fMain->AddFrame(fMenuBar, new TGLayoutHints(kLHintsTop | kLHintsExpandX)); fMainFrame = new TGMdiMainFrame(fMain, fMenuBar, 300, 300); fMain->AddFrame(fMainFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); InitPlot(); InitMenuPlot(); InitMenu(); InitTGMDI(); fMain->SetWindowName("Tiff View"); // fMain->Resize(800, 600); fMain->MapSubwindows(); fMain->MapWindow(); fMain->Move(300, 300); fMain->MoveResize(300, 300, 800, 600); fMain->Layout(); fMain->DontCallClose(); } TGAppMainFrame::~TGAppMainFrame(){ fMain->Clear(); delete fMain; fCleanup->Delete(); delete fCleanup; } void TGAppMainFrame::HandleMenu(Int_t id){ // Handle menu items. switch (id) { case M_FILE_OPEN: static TString dir("/Users/larry/data/"); TGFileInfo fi1; fi1.fIniDir = StrDup(dir); fi1.SetMultipleSelection(kTRUE); new TGFileDialog(gClient->GetDefaultRoot(), fMainFrame, kFDOpen,&fi1); int namei = 0; if(fi1.fMultipleSelection && fi1.fFileNamesList){ char * buff = NULL; TObjString *el1 = NULL; TIter next(fi1.fFileNamesList); }else if(fi1.fFilename){ char * buff = NULL; }else{ } break; case M_FILE_QUICK_OPEN: static TString dir("/Users/larry/data/"); TGFileInfo fi1; fi1.fIniDir = StrDup(dir); // fi1.SetMultipleSelection(kTRUE); fi1.fFilename = NULL; new TGFileDialog(gClient->GetDefaultRoot(), fMainFrame, kFDOpen,&fi1); if(fi1.fFilename){ Zero = 1; }else{ } break; case M_FILE_CLOSE: fMainFrame->Close(fMainFrame->GetCurrent()); break; case M_FILE_EXIT: CloseWindow(); break; case M_CONVERT_TIFF: break; case M_ANAL_CLUST: break; case M_WINDOW_HOR: fMainFrame->TileHorizontal(); break; case M_WINDOW_VERT: fMainFrame->TileVertical(); break; case M_WINDOW_ARRANGE: fMainFrame->ArrangeMinimized(); break; case M_WINDOW_OPAQUE: if (fMenuWindow->IsEntryChecked(M_WINDOW_OPAQUE)) { fMenuWindow->UnCheckEntry(M_WINDOW_OPAQUE); fMainFrame->SetResizeMode(kMdiNonOpaque); } else { fMenuWindow->CheckEntry(M_WINDOW_OPAQUE); fMainFrame->SetResizeMode(kMdiOpaque); } break; case M_HELP_ABOUT: break; case M_CLUSINT_DIST: break; case M_CUT_DATA: break; case M_SAVE_TXT: break; case M_SAVE_IMG: break; default: fMainFrame->SetCurrent(id); break; } } void TGAppMainFrame::InitMenu() { fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0); fMenuFile = new TGPopupMenu(gClient->GetRoot()); fMenuFile->AddEntry(new TGHotString("&Load Event list file(s)"), M_FILE_OPEN); fMenuFile->AddEntry(new TGHotString("&View Event list File"), M_FILE_QUICK_OPEN); fMenuFile->AddSeparator(); fMenuFile->AddEntry(new TGHotString("E&xit"), M_FILE_EXIT); // fMenuFile->AddEntry(new TGHotString("&Close Window"), M_FILE_CLOSE); fMenuConv = new TGPopupMenu(gClient->GetRoot()); fMenuConv->AddEntry(new TGHotString("Generate Event list"), M_CONVERT_TIFF); // fMenuConv->AddSeparator(); // fMenuConv->AddEntry(new TGHotString("E&xit"), M_FILE_EXIT); // fMenuConv->CheckEntry(M_CONVERT_TIFF); fMenuWindow = new TGPopupMenu(gClient->GetRoot()); fMenuWindow->AddEntry(new TGHotString("Tile &Horizontally"), M_WINDOW_HOR); fMenuWindow->AddEntry(new TGHotString("Tile &Vertically"), M_WINDOW_VERT); fMenuWindow->AddSeparator(); fMenuWindow->AddPopup(new TGHotString("&Windows"), fMainFrame->GetWinListMenu()); fMenuWindow->AddSeparator(); fMenuWindow->AddEntry(new TGHotString("&Arrange icons"), M_WINDOW_ARRANGE); fMenuWindow->AddSeparator(); fMenuWindow->AddEntry(new TGHotString("&Opaque resize"), M_WINDOW_OPAQUE); fMenuWindow->CheckEntry(M_WINDOW_OPAQUE); fMenuHelp = new TGPopupMenu(gClient->GetRoot()); fMenuHelp->AddEntry(new TGHotString("&Contents"), M_HELP_CONTENTS); fMenuHelp->AddSeparator(); fMenuHelp->AddEntry(new TGHotString("&About"), M_HELP_ABOUT); fMenuHelp->DisableEntry(M_HELP_CONTENTS); // fMenuHelp->DisableEntry(M_HELP_ABOUT); // menu message are handled by the class' HandleMenu() method fMenuFile->Connect("Activated(Int_t)", "TGAppMainFrame", this,"HandleMenu(Int_t)"); fMenuConv->Connect("Activated(Int_t)", "TGAppMainFrame", this,"HandleMenu(Int_t)"); fMenuWindow->Connect("Activated(Int_t)", "TGAppMainFrame", this,"HandleMenu(Int_t)"); fMenuHelp->Connect("Activated(Int_t)", "TGAppMainFrame", this, "HandleMenu(Int_t)"); // fMenuBar->AddPopup(new TGHotString("&Exit"), fMenuConv, fMenuBarItemLayout); fMenuBar->AddPopup(new TGHotString("&Event list"), fMenuFile, fMenuBarItemLayout); fMenuBar->AddPopup(new TGHotString("&Windows"),fMenuWindow,fMenuBarItemLayout); fMenuBar->AddPopup(new TGHotString("&Help"), fMenuHelp, fMenuBarItemLayout); //Activate default menu options - it is always there so it is not visible!!! fMenuConv->Activated(M_ANAL_CLUST); fMenuConv->Activated(M_CONVERT_TIFF); } void TGAppMainFrame::InitMenuPlot(){ fMenuBarItemLayout_plot = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0); fMenuFile_plot = new TGPopupMenu(gClient->GetRoot()); fMenuFile_plot->AddEntry(new TGHotString("&Save img as tiff"), M_SAVE_IMG); fMenuFile_plot->AddEntry(new TGHotString("&Save col.sum as txt"), M_SAVE_TXT); // fMenuFile_plot->AddSeparator(); fMenuAnal_plot = new TGPopupMenu(gClient->GetRoot()); fMenuAnal_plot->AddEntry(new TGHotString("Pulse height histogram"), M_CLUSINT_DIST); fMenuAnal_plot->AddEntry(new TGHotString("Spatial ROI"), M_CUT_DATA); fMenuFile_plot->Connect("Activated(Int_t)", "TGAppMainFrame", this, "HandleMenu(Int_t)"); fMenuAnal_plot->Connect("Activated(Int_t)", "TGAppMainFrame", this, "HandleMenu(Int_t)"); fMenuBar_plot->AddPopup(new TGHotString("&Save"), fMenuFile_plot, fMenuBarItemLayout_plot); fMenuBar_plot->AddPopup(new TGHotString("&Analize"), fMenuAnal_plot, fMenuBarItemLayout_plot); } Bool_t TGAppMainFrame::CloseWindow(){ Int_t ret = 0; new TGMsgBox(gClient->GetRoot(), fMain, "Exit?", "Really want to close the window?", kMBIconExclamation, kMBYes | kMBNo, &ret); // if (ret == kMBYes) return fMain->CloseWindow(); if (ret == kMBYes){ fMain->CloseWindow(); gApplication->Terminate(0); } return kFALSE; } void TGAppMainFrame::InitPlot(){ //plot alldata plot_alldata = new TGMdiFrame(fMainFrame, 500, 300); fMenuBar_plot = new TGMdiMenuBar(plot_alldata, 10, 5); plot_alldata->AddFrame(fMenuBar_plot, new TGLayoutHints(kLHintsTop | kLHintsExpandX)); plot_alldata->DontCallClose(); plot_alldata->SetWindowName("All data"); fRootEmbeddedCanvas_alldata = new TRootEmbeddedCanvas(0,plot_alldata,500,300,kSunkenFrame, ucolor); wfRootEmbeddedCanvas = fRootEmbeddedCanvas_alldata->GetCanvasWindowId(); c_alldata = new TCanvas("c_alldata", 10, 10, wfRootEmbeddedCanvas); c_alldata->Divide(1,2); fRootEmbeddedCanvas_alldata->AdoptCanvas(c_alldata); plot_alldata->AddFrame(fRootEmbeddedCanvas_alldata, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,2,2,2,2)); plot_alldata->SetMdiHints(kMdiDefaultHints | kMdiHelp); plot_alldata->MapSubwindows(); plot_alldata->Layout(); plot_alldata->Move(300, 100); } void TGAppMainFrame::InitTGMDI(){ tgmdiFrame = new TGMdiFrame(fMainFrame, 270, 500); //tgmdiFrame->Connect("CloseWindow()", "TGAppMainFrame", this, "CloseWindow()"); tgmdiFrame->DontCallClose(); // to avoid double deletions. fShutter = new TGShutter(tgmdiFrame, kSunkenFrame); AddShutterItem2("Generate Event list"); AddShutterItem1("Plot events"); fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY); tgmdiFrame->AddFrame(fShutter, fLayout); tgmdiFrame->MapSubwindows(); tgmdiFrame->SetWindowName("Shutter"); // tgmdiFrame->MapWindow(); tgmdiFrame->Layout(); tgmdiFrame->Move(0, 0);//500-30 } //---------------------------------------------------------------------- //Tiff convert functions //if multi - disable bg open void TGAppMainFrame::HandleCheckButton1(){ // Handle check button1 item. if(fCheckButton3912->IsDown() == kTRUE){ fCheckButton3913->SetState(kButtonUp); fTextButton3925_0->SetEnabled(kFALSE); fNumberEntry_frame->SetState(kTRUE); }elseif(fCheckButton3912->IsDown() == kFALSE){ fCheckButton3913->SetState(kButtonDown); fTextButton3925_0->SetEnabled(kTRUE); fNumberEntry_frame->SetState(kFALSE); } } //if single - enable bg open void TGAppMainFrame::HandleCheckButton2(){ // Handle check button2 item. if(fCheckButton3913->IsDown() == kTRUE){ fCheckButton3912->SetState(kButtonUp); fTextButton3925_0->SetEnabled(kTRUE); fNumberEntry_frame->SetState(kFALSE); }elseif(fCheckButton3913->IsDown() == kFALSE){ fCheckButton3912->SetState(kButtonDown); fTextButton3925_0->SetEnabled(kFALSE); fNumberEntry_frame->SetState(kTRUE); } } void TGAppMainFrame::HandleCheckButton3(){ if(fCheckButton_flag->IsDown() == kTRUE){ m_Flag = 1; // fNumberEntry_frame->SetState(kTRUE); }elseif(fCheckButton_flag->IsDown() == kFALSE){ m_Flag = 1; } } void TGAppMainFrame::HandleCheckButton4(){ if(fCheckButtonClusterize->IsDown() == kTRUE){ fNumberEntry_prepix->SetState(kTRUE); }elseif(fCheckButtonClusterize->IsDown() == kFALSE){ fNumberEntry_prepix->SetState(kFALSE); } } void TGAppMainFrame::HandleCheckButtonRotate(){ if(fCheckButton_rotate->IsDown() == kTRUE){ fNumericEntries[3]->SetState(kTRUE); }elseif(fCheckButton_rotate->IsDown() == kFALSE){ fNumericEntries[3]->SetState(kFALSE); } } void TGAppMainFrame::HandleCheckButtonCut(){ if(fCheckButton_cut->IsDown() == kTRUE){ fNumericEntries[4]->SetState(kTRUE); fNumericEntries[5]->SetState(kTRUE); fNumericEntries[6]->SetState(kTRUE); fNumericEntries[7]->SetState(kTRUE); }elseif(fCheckButton_cut->IsDown() == kFALSE){ fNumericEntries[4]->SetState(kFALSE); fNumericEntries[5]->SetState(kFALSE); fNumericEntries[6]->SetState(kFALSE); fNumericEntries[7]->SetState(kFALSE); } } void TGAppMainFrame::HandleCheckButtonBin(){ if(fCheckButton_bin->IsDown() == kTRUE){ }elseif(fCheckButton_bin->IsDown() == kFALSE){ } } void TGAppMainFrame::AddShutterItem1(const char *name){ static int id = 5001; TGLayoutHints *l = new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 5, 0); TGShutterItem *item1 = new TGShutterItem(fShutter, new TGHotString(name), id++); TGCompositeFrame *container1 = (TGCompositeFrame *) item1->GetContainer(); TGVerticalFrame * fF1 = new TGVerticalFrame(container1, 250, 350); container1->AddFrame(fF1, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,2,2,2,2)); //_____________________________________________________ //Adding binarization checkbutton TGGroupFrame * fG3 = new TGGroupFrame(fF1, new TGString("Settings"),kVerticalFrame); fF1->AddFrame(fG3, new TGLayoutHints(kLHintsExpandX|kLHintsTop, 2, 2, 2, 2)); // fLabel[5] = new TGLabel(fG3, "Binarization"); // fLabel[5]->SetTextFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1", kTRUE); //fG3->AddFrame(fLabel[5], new TGLayoutHints(kLHintsLeft, 0, 0, 0,0)); fCheckButton_bin = new TGCheckButton(fG3,"Normalize cluster ph", 4997); fG3->AddFrame(fCheckButton_bin, new TGLayoutHints(kLHintsCenterX|kLHintsTop,0,0,0,0)); fCheckButton_bin->SetState(kButtonDown); fCheckButton_bin->Connect("Clicked()", "TGAppMainFrame", this, "HandleCheckButtonBin()"); //_____________________________________________________ //Adding discrimination features for (int i = 0; i <= 2; i++) { fLabel[i] = new TGLabel(fG3, numlabel[i]); // fLabel[i]->SetTextFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1", kTRUE); fG3->AddFrame(fLabel[i], new TGLayoutHints(kLHintsTop|kLHintsCenterX, 2, 2, 2,2)); fNumericEntries[i] = new TGNumberEntry(fG3, numinit[i], 10, 3, (TGNumberFormat::EStyle) 0); fG3->AddFrame(fNumericEntries[i], new TGLayoutHints(kLHintsTop|kLHintsCenterX, 2, 2, 2, 2)); } //___________________________________________ //adding rotation feature in a horizontal frame fLabel[3] = new TGLabel(fF1, numlabel[3]); //fLabel[3]->SetTextFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1", kTRUE); fF1->AddFrame(fLabel[3], new TGLayoutHints(kLHintsTop|kLHintsCenterX, 2, 2, 2,2)); TGHorizontalFrame * fhori1 = new TGHorizontalFrame(fF1, 100, 20); fF1->AddFrame(fhori1, new TGLayoutHints(kLHintsTop|kLHintsCenterX,2,2,2,2)); fNumericEntries[3] = new TGNumberEntry(fhori1, numinit[3], 6, 3,(TGNumberFormat::kNESRealTwo),(TGNumberFormat::kNEAAnyNumber), (TGNumberFormat::kNELNoLimits)); fNumericEntries[3]->SetState(kFALSE); fhori1->AddFrame(fNumericEntries[3], new TGLayoutHints(kLHintsTop|kLHintsCenterX, 2, 2, 2, 2)); fCheckButton_rotate = new TGCheckButton(fhori1,"", 4999); fhori1->AddFrame(fCheckButton_rotate, new TGLayoutHints(kLHintsCenterX | kLHintsTop,2,2,2,2)); // fCheckButton_rotate->MoveResize(32,56,112,20); fCheckButton_rotate->SetState(kButtonUp); fCheckButton_rotate->Connect("Clicked()", "TGAppMainFrame", this, "HandleCheckButtonRotate()"); //___________________________________________ //adding current cut window points feature TGGroupFrame * fG2 = new TGGroupFrame(fF1, new TGString("Rectangular ROI"),kVerticalFrame); fF1->AddFrame(fG2, new TGLayoutHints(kLHintsCenterX|kLHintsTop, 2, 2, 2, 2)); fLabel[4] = new TGLabel(fG2, numlabel[4]); fG2->AddFrame(fLabel[4], new TGLayoutHints(kLHintsCenterX|kLHintsTop, 0, 0, 0,0)); TGHorizontalFrame * fhori2 = new TGHorizontalFrame(fG2, 40, 20); fG2->AddFrame(fhori2, new TGLayoutHints(kLHintsCenterX|kLHintsTop,0,0,0,0)); fNumericEntries[4] = new TGNumberEntry(fhori2, numinit[4], 5, 3,(TGNumberFormat::EStyle) 0); fNumericEntries[4]->SetState(kFALSE); fhori2->AddFrame(fNumericEntries[4], new TGLayoutHints(kLHintsTop|kLHintsCenterX, 2, 2, 2, 2)); fNumericEntries[5] = new TGNumberEntry(fhori2, numinit[5], 5, 3,(TGNumberFormat::EStyle) 0); fNumericEntries[5]->SetState(kFALSE); fhori2->AddFrame(fNumericEntries[5], new TGLayoutHints(kLHintsTop|kLHintsCenterX, 2, 2, 2, 2)); fCheckButton_cut = new TGCheckButton(fhori2,"", 4998); fhori2->AddFrame(fCheckButton_cut, new TGLayoutHints(kLHintsLeft,0,0,0,0)); // fCheckButton_rotate->MoveResize(32,56,112,20); fCheckButton_cut->SetState(kButtonUp); fCheckButton_cut->Connect("Clicked()", "TGAppMainFrame", this,"HandleCheckButtonCut()"); fLabel[5] = new TGLabel(fG2, numlabel[5]); // fLabel[5]->SetTextFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1", kTRUE); fG2->AddFrame(fLabel[5], new TGLayoutHints(kLHintsLeft, 0, 0, 0,0)); TGHorizontalFrame * fhori3 = new TGHorizontalFrame(fG2, 40, 20); fG2->AddFrame(fhori3, new TGLayoutHints(kLHintsTop|kLHintsCenterX,0,0,0,0)); fNumericEntries[6] = new TGNumberEntry(fhori3, numinit[6], 5, 3,(TGNumberFormat::EStyle) 0); fNumericEntries[6]->SetState(kFALSE); fhori3->AddFrame(fNumericEntries[6], new TGLayoutHints(kLHintsTop|kLHintsCenterX, 2, 2, 2, 2)); fNumericEntries[7] = new TGNumberEntry(fhori3, numinit[7], 5, 3,(TGNumberFormat::EStyle) 0); fNumericEntries[7]->SetState(kFALSE); fhori3->AddFrame(fNumericEntries[7], new TGLayoutHints(kLHintsTop|kLHintsCenterX, 2, 2, 2, 2)); //___________________________________________ TGGroupFrame * fG1 = new TGGroupFrame(fF1, new TGString("All data buttons"),kVerticalFrame); fF1->AddFrame(fG1, new TGLayoutHints(kLHintsCenterX|kLHintsTop, 2, 2, 2, 2)); // TGTextButton *setvalues = new TGTextButton(fG1,"&Set"); // setvalues->Connect("Clicked()","TGAppMainFrame",this,"SetValues()"); // fG1->AddFrame(setvalues, new TGLayoutHints(kLHintsLeft,2,2,5,5)); TGTextButton *draw = new TGTextButton(fG1,"&Update/ReDraw"); // draw->Connect("Clicked()","TGAppMainFrame",this,"DrawAlldata()"); fG1->AddFrame(draw, new TGLayoutHints(kLHintsTop|kLHintsCenterX,2,2,2,2)); TGTextButton *empty = new TGTextButton(fG1,"&Empty list"); // empty->Connect("Clicked()","TGAppMainFrame",this,"Empty()"); fG1->AddFrame(empty, new TGLayoutHints(kLHintsTop|kLHintsCenterX,2,2,2,2)); fShutter->AddItem(item1); } void TGAppMainFrame::AddShutterItem2(const char *name){ static int id = 5002; TGShutterItem *item1 = new TGShutterItem(fShutter, new TGHotString(name), id++); TGCompositeFrame *container1 = (TGCompositeFrame *) item1->GetContainer(); //_____________________________________________________ ///big first horizontal frame containing 3 vertical frames fMainFrame3910_0 = new TGVerticalFrame(container1,250,300); container1->AddFrame(fMainFrame3910_0, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,2,2,2,2)); //first vertical frame in group frame 1 fMainFrame3910_1 = new TGVerticalFrame(fMainFrame3910_0); fMainFrame3910_0->AddFrame(fMainFrame3910_1, new TGLayoutHints(kLHintsTop|kLHintsLeft,2,2,2,2)); TGGroupFrame * fGroupframe1 = new TGGroupFrame(fMainFrame3910_1, new TGString("TIFF/Clusterization options"),kVerticalFrame); fMainFrame3910_1->AddFrame(fGroupframe1, new TGLayoutHints(kLHintsCenterY, 2, 2, 2, 2)); fCheckButtonClusterize = new TGCheckButton(fGroupframe1,"Clusterize", 39999); fGroupframe1->AddFrame(fCheckButtonClusterize, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); // fCheckButtonClusterize->MoveResize(32,32,112,20); fCheckButtonClusterize->SetState(kButtonDown); fCheckButtonClusterize->Connect("Clicked()", "TGAppMainFrame", this, "HandleCheckButton4()"); fCheckButton3912 = new TGCheckButton(fGroupframe1,"Multi frame tiff", 3912); fGroupframe1->AddFrame(fCheckButton3912, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); //fCheckButton3912->MoveResize(32,56,112,20); fCheckButton3912->SetState(kButtonDown); fCheckButton3912->Connect("Clicked()", "TGAppMainFrame", this, "HandleCheckButton1()"); fCheckButton3913 = new TGCheckButton(fGroupframe1,"Single frame tiff(s)", 3913); fGroupframe1->AddFrame(fCheckButton3913, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); //fCheckButton3913->MoveResize(32,80,112,20); fCheckButton3913->Connect("Clicked()", "TGAppMainFrame", this, "HandleCheckButton2()"); //buttons in group frame 1 TGGroupFrame * fGroupframe1 = new TGGroupFrame(fMainFrame3910_1, new TGString("Process TIFF files"),kVerticalFrame); fMainFrame3910_1->AddFrame(fGroupframe1, new TGLayoutHints(kLHintsLeft|kLHintsTop, 2, 2, 2, 2)); fTextButton3925_0 = new TGTextButton(fGroupframe1,"Set bckg tiff file"); fGroupframe1->AddFrame(fTextButton3925_0, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,2,2,2,2)); // fTextButton3925_0->SetTextJustify(36); // fTextButton3925_0->Connect("Clicked()", "TGAppMainFrame", this, "OpenBgFile()"); fTextButton3925_0->SetEnabled(kFALSE); TGTextButton *fTextButton3925 = new TGTextButton(fGroupframe1,"Open tiff file(s)"); fGroupframe1->AddFrame(fTextButton3925, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,2,2,2,2)); // fTextButton3925->SetTextJustify(36); //fTextButton3925->Resize(98,24); // fTextButton3925->Connect("Clicked()", "TGAppMainFrame", this, "OpenFile()"); ///Second vertical frame in group frame 1 fMainFrame3910_2 = new TGVerticalFrame(fMainFrame3910_0); fMainFrame3910_0->AddFrame(fMainFrame3910_2, new TGLayoutHints(kLHintsTop|kLHintsLeft,2,2,2,2)); TGGroupFrame * fGroupframe2 = new TGGroupFrame(fMainFrame3910_2, new TGString("Prediscr./Frame options"),kVerticalFrame); fMainFrame3910_2->AddFrame(fGroupframe2, new TGLayoutHints(kLHintsCenterY, 2, 2, 2, 2)); //Prediscrimination level TGLabel *fLabel3915 = new TGLabel(fGroupframe2,"Pulse height pre-discr. level"); fLabel3915->SetTextJustify(30); fGroupframe2->AddFrame(fLabel3915, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fNumberEntry3916 = new TGNumberEntry(fGroupframe2, (Double_t) 1,6,-1,(TGNumberFormat::kNESInteger),(TGNumberFormat::kNEAAnyNumber) ,(TGNumberFormat::kNELNoLimits)); fNumberEntry3916->SetNumber(0); fGroupframe2->AddFrame(fNumberEntry3916, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); //number entry for pre_max number of signal pixels in tiff file, so //the algorithm will put back these into their original pixels, not taking center of mass TGLabel *fLabel_pix = new TGLabel(fGroupframe2,"Cluster size pre-discr. level"); fLabel_pix->SetTextJustify(30); fGroupframe2->AddFrame(fLabel_pix, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fNumberEntry_prepix = new TGNumberEntry(fGroupframe2, (Double_t) 1,6,-1,(TGNumberFormat::kNESInteger), (TGNumberFormat::kNEAAnyNumber),(TGNumberFormat::kNELLimitMin), 1); fNumberEntry_prepix->SetNumber(0.0); fGroupframe2->AddFrame(fNumberEntry_prepix, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); //number entry for frame number of multiframe tiff file, from which frame //one wants the noise to be extracted TGLabel *fLabel_frame = new TGLabel(fGroupframe2,"Frame # (All: -1)"); fLabel_frame->SetTextJustify(30); fGroupframe2->AddFrame(fLabel_frame, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fNumberEntry_frame = new TGNumberEntry(fGroupframe2, (Double_t) 1,6,-1,(TGNumberFormat::kNESInteger), (TGNumberFormat::kNEAAnyNumber),(TGNumberFormat::kNELLimitMin), -1); fNumberEntry_frame ->SetNumber(0); fGroupframe2->AddFrame(fNumberEntry_frame, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); ///Third vertical frame in groupframe 2 fMainFrame3910_3 = new TGVerticalFrame(fMainFrame3910_0); fMainFrame3910_0->AddFrame(fMainFrame3910_3, new TGLayoutHints(kLHintsTop|kLHintsLeft,2,2,2,2)); TGGroupFrame * fGroupframe3 = new TGGroupFrame(fMainFrame3910_3, new TGString("View img. pulse height distr."),kVerticalFrame); fMainFrame3910_3->AddFrame(fGroupframe3, new TGLayoutHints(kLHintsCenterY, 2, 2, 2, 2)); //checkbutton for lower cut on the nois fCheckButton_flag = new TGCheckButton(fGroupframe3,"Apply noise correction", 3914); fGroupframe3->AddFrame(fCheckButton_flag, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); //fCheckButton_flag->MoveResize(32,104,112,20); fCheckButton_flag->Connect("Clicked()", "TGAppMainFrame", this, "HandleCheckButton3()"); fCheckButton_flag->SetState(kTRUE); //number entry for lower cut on the noise TGHorizontalFrame * fNoiseframe = new TGHorizontalFrame(fGroupframe3); fGroupframe3->AddFrame(fNoiseframe, new TGLayoutHints(kLHintsTop|kLHintsLeft,2,2,2,2)); //fNumberEntry_flagcut = new TGNumberEntry(fNoiseframe, (Double_t) 1,6,-1,(TGNumberFormat::kNESInteger),(TGNumberFormat::kNEAAnyNumber) ,(TGNumberFormat::kNELNoLimits)); //fNumberEntry_flagcut->SetNumber(m_FlagCut); //fNoiseframe->AddFrame(fNumberEntry_flagcut, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton3926 = new TGTextButton(fNoiseframe,"Draw noise"); fNoiseframe->AddFrame(fTextButton3926, new TGLayoutHints(kLHintsLeft | kLHintsTop,8,2,2,2)); fTextButton3926->SetTextJustify(30); //fTextButton3926->Resize(98,24); // fTextButton3926->Connect("Clicked()", "TGAppMainFrame", this, "DrawNoise()"); fTextButton3926->SetEnabled(kTRUE); /////////////////////////////////// TGFont *ufont; // will reflect user font changes // ufont = gClient->GetFont("-*-Times New Roman-normal-r-*-*-20-*-*-*-*-*-*-*"); ufont = gClient->GetFont("fixed"); TGGC *uGC; // will reflect user GC changes // graphics context changes GCValues_t vall3922; vall3922.fMask = kGCForeground | kGCBackground | kGCFillStyle | kGCFont | kGCGraphicsExposures; gClient->GetColorByName("#ffffff",vall3922.fForeground); gClient->GetColorByName("#c0c0c0",vall3922.fBackground); vall3922.fFillStyle = kFillSolid; vall3922.fFont = ufont->GetFontHandle(); vall3922.fGraphicsExposures = kFALSE; uGC = gClient->GetGC(&vall3922, kTRUE); // fNumberEntry_flagcut->SetState(kFALSE); fTextButton3926->SetEnabled(kTRUE); fShutter->AddItem(item1); } //---------------------------------------------------------------------- void TestGui() { new TGAppMainFrame(gClient->GetRoot(), 800, 600); // TDatime * progtime = new TDatime(); //while(1){ // cout << progtime->AsSQLString() << endl; //} }