GUI/TFndMonitorGUI.h

00001 // @(#)fROOT/GUI:$Name:  $:$Id: TFndMonitorGUI.h,v 1.15 2007/09/05 09:54:56 Diego_Faso Exp $
00002 // Author: Diego Faso <mailto:faso@to.infn.it>, 2006/05/16
00003 
00004 #ifndef FROOT_TFndMonitorGUI
00005 #define FROOT_TFndMonitorGUI
00006 
00008 //                                                                      //
00009 //                           TFndMonitorGUI                             //
00010 //                                                                      //
00011 // Build the GUI for controlling the online monitor Producer(geb2hdt)   //
00012 // and consumer (detector monitors)                                     //
00013 // Both online and offline modes are available                          //
00014 //                                                                      //
00015 // Here everithing is thread safe                                       //
00016 //                                                                      //
00018 
00019 #ifndef ROOT_TGMenu
00020 #include "TGMenu.h"
00021 #endif
00022 #ifndef ROOT_TGButtonGroup
00023 #include "TGButtonGroup.h"
00024 #endif
00025 #ifndef ROOT_TGCanvas
00026 #include "TGCanvas.h"
00027 #endif
00028 #ifndef ROOT_TRootCanvas
00029 #include "TRootCanvas.h"
00030 #endif
00031 #ifndef ROOT_TRootGuiBuilder
00032 #include "TRootGuiBuilder.h"
00033 #endif
00034 #ifndef ROOT_TGDockableFrame
00035 #include "TGDockableFrame.h"
00036 #endif
00037 #ifndef ROOT_TGToolBar
00038 #include "TGToolBar.h"
00039 #endif
00040 #ifndef ROOT_TGButton
00041 #include "TGButton.h"
00042 #endif
00043 #ifndef ROOT_TGToolTip
00044 #include "TGToolTip.h"
00045 #endif
00046 #ifndef ROOT_TGuiBldDragManager
00047 #include "TGuiBldDragManager.h"
00048 #endif
00049 #ifndef ROOT_TGMdiMainFrame
00050 #include "TGMdiMainFrame.h"
00051 #endif
00052 #ifndef ROOT_TGLabel
00053 #include "TGLabel.h"
00054 #endif
00055 #ifndef ROOT_TG3DLine
00056 #include "TG3DLine.h"
00057 #endif
00058 #ifndef ROOT_TGNumberEntry
00059 #include "TGNumberEntry.h"
00060 #endif
00061 #ifndef ROOT_TGuiBldHintsButton
00062 #include "TGuiBldHintsButton.h"
00063 #endif
00064 #ifndef ROOT_TGuiBldHintsEditor
00065 #include "TGuiBldHintsEditor.h"
00066 #endif
00067 #ifndef ROOT_TGuiBldEditor
00068 #include "TGuiBldEditor.h"
00069 #endif
00070 #ifndef ROOT_TGShutter
00071 #include "TGShutter.h"
00072 #endif
00073 #ifndef ROOT_TGStatusBar
00074 #include "TGStatusBar.h"
00075 #endif
00076 #ifndef ROOT_TGTab
00077 #include "TGTab.h"
00078 #endif
00079 #ifndef ROOT_TGSplitter
00080 #include "TGSplitter.h"
00081 #endif
00082 #ifndef ROOT_TGMdiMenu
00083 #include "TGMdiMenu.h"
00084 #endif
00085 #ifndef ROOT_TGListBox
00086 #include "TGListBox.h"
00087 #endif
00088 #ifndef ROOT_TGListView
00089 #include "TGListView.h"
00090 #endif
00091 #ifndef ROOT_TGFSContainer
00092 #include "TGFSContainer.h"
00093 #endif
00094 #ifndef ROOT_TGFSComboBox
00095 #include "TGFSComboBox.h"
00096 #endif
00097 #ifndef ROOT_TGFileDialog
00098 #include "TGFileDialog.h"
00099 #endif
00100 #ifndef ROOT_TGScrollBar
00101 #include "TGScrollBar.h"
00102 #endif
00103 #ifndef ROOT_TGMdiDecorFrame
00104 #include "TGMdiDecorFrame.h"
00105 #endif
00106 #ifndef ROOT_TGMdiFrame
00107 #include "TGMdiFrame.h"
00108 #endif
00109 #ifndef ROOT_TRootEmbeddedCanvas
00110 #include "TRootEmbeddedCanvas.h"
00111 #endif
00112 #ifndef ROOT_TCanvas
00113 #include "TCanvas.h"
00114 #endif
00115 
00116 #include "TColor.h"
00117 
00118 #include "TFndRun.h"
00119 #include "TFndMonitorMan.h"
00120 #include "TFndEvd.h"
00121 
00122 #include "Gui.h"
00123 using namespace FROOT;
00124 using namespace Gui;
00125 
00126 class TFndMonitorGUI: public TGMainFrame, public TFndMonitorMan {
00127   // remember to use the "MoveResizeSafe" method (see the FROOT::GUI namespace)
00128 
00129  protected:
00130   TGGroupFrame *fMenuContainer;     // Container for the Producer/Consumer control menues
00131   TGGroupFrame *fConsButContainer;  // Container for the Consumer-control buttons
00132 
00133   // TGPopUp menus
00134   TGMenuBar *fMenuBar;
00135   TGPopupMenu *fPopProd;    // pop-up menu for the producer main control
00136   TGPopupMenu *fPopDetMons; // pop-up menu for the consumer monitors main control
00137   TGPopupMenu *fPopEvd;     // pop-up menu for the event display main control
00138 
00139   TGPopupMenu *fSubPop[K_N_FND_MON_DETECTORS];
00140   TGPopupMenu *fSubPopAll;  // Commands to all monitors (simultaneousely)
00141 
00142   TGGroupFrame  *fConsCntGrp[K_N_FND_MON_DETECTORS];
00143   TGTextButton  *fConsCntPopBut[K_N_FND_MON_DETECTORS];
00144   TGCheckButton *fConsCntUpdateBut[K_N_FND_MON_DETECTORS]; // Switch on/off the automatic update detector monitor (consumer)
00145 
00146   // producer/consumers start GUI
00147   TGTransientFrame *fProdMainFrame;
00148 
00149   TGGroupFrame   *fSubProdDB_Grp;
00150   TGComboBox     *fSubProdDB_Combo;
00151 
00152   TGGroupFrame   *fSubProdRDT_Grp; // offine-mode only
00153   TGTextEntry    *fSubProdRDT_Txt; // offine-mode only
00154 
00155   TGGroupFrame   *fSubProdRunType_Grp;
00156   TGComboBox     *fSubProdRunType_Combo;
00157 
00158   TGGroupFrame   *fSubProdRunNum_Grp;
00159   TGNumberEntry  *fSubProdRunNum_val;
00160 
00161   TGGroupFrame   *fSubProdEvents_Grp;
00162   TGNumberEntry  *fSubProdEvents_val;
00163 
00164   TGGroupFrame   *fSubProdExitBut_Grp;
00165   TGTextButton *fSubProd_ExitBut[2]; // meaning: [ok,cancel]
00166 
00167   TGGroupFrame *fSubProdInfo_Grp;  // online-mode only
00168   TGLabel      *fSubProd_LblGebIP; // online-mode only
00169 
00170   //
00171   Int_t fCurConsDet; // ID of the current consumer (last selection)
00172   Bool_t fConsIsOnline; // is current consumer online (referred to the last selection)
00173   TGTransientFrame *fConsMainFrame;
00174 
00175   TGGroupFrame   *fSubConsFpath_Grp; // (path to the _[detector].root file) offine-mode only
00176   TGTextEntry    *fSubConsFpath_Txt; // (path to the _[detector].root file) offine-mode only
00177 
00178   TGGroupFrame   *fSubConsRunType_Grp;
00179   TGComboBox     *fSubConsRunType_Combo;
00180 
00181   TGGroupFrame   *fSubConsRunNum_Grp;
00182   TGNumberEntry  *fSubConsRunNum_val;
00183 
00184   TGGroupFrame   *fSubConsExitBut_Grp;
00185   TGTextButton *fSubCons_ExitBut[2]; // meaning: [ok,cancel]
00186 
00187   TFndEvd *fEventDisplay;
00188   //
00189   //  TGTransientFrame *fEvdMainFrame;
00190 
00191  private:
00192   void BuildPopUpMenus();
00193   void BuildSelButContainer();
00194   virtual void MakeConnections(Int_t whichframe,Bool_t connect=kTRUE);
00195 
00196   virtual void AddDetectorSelBut(Int_t det,Bool_t is_online);
00197   virtual void DelDetectorSelBut(Int_t det);
00198   virtual void UpdateButContainer();
00199   virtual void EnableFndMonEntry(Int_t entry,Bool_t enable = kTRUE);   // see Gui::EFndCommandIdentifiers
00200   
00201   virtual void CloseSubMainFrame_from_but(TGTransientFrame *f) {
00202     if(!f) return;
00203     if(f->IsMapped()) f->UnmapWindow();
00204   }
00205   
00206   virtual void CloseSubMainFrame(TGTransientFrame *f) {
00207     if(!f) return;
00208 #ifdef _FND_ONL_USE_MAP_FILES_
00209     f->Clear();
00210     if(f->MustCleanup()) f->Cleanup();
00211     if(f->IsMapped()){
00212       f->UnmapWindow();
00213       gClient->WaitForUnmap(f);
00214     }
00215     f->CloseWindow();
00216     gClient->ProcessEventsFor(f);
00217     //    delete f;
00218     //    f = 0;
00219 #endif
00220   }
00221   
00222   // --- sub-transient frames private methods
00223   virtual void FillProdComboBoxes(Bool_t is_online);
00224   virtual void FillConsComboBoxes(Bool_t is_online);
00225 
00226  public:
00227   TFndMonitorGUI();
00228   ~TFndMonitorGUI();
00229   virtual void TestDetSelButtons(Int_t period_ms,Int_t ntimes);
00230 
00231   virtual void RemapMainWindow();
00232   // --- sub-frames management
00233   virtual void BuildProdGUI(Bool_t is_online);
00234   virtual void BuildConsGUI(Int_t det,Bool_t is_online);
00235   //  virtual void BuildEvdGUI(Bool_t is_online);
00236   
00237   virtual void CloseProdGUI_from_but() { CloseSubMainFrame_from_but(fProdMainFrame); }
00238   virtual void CloseConsGUI_from_but() { CloseSubMainFrame_from_but(fConsMainFrame); }
00239   //  virtual void CloseEvdGUI_from_but()  { CloseSubMainFrame_from_but(fEvdMainFrame); }
00240 
00241   virtual void CloseProdGUI() { CloseSubMainFrame(fProdMainFrame); fProdMainFrame = 0; }
00242   virtual void CloseConsGUI() { CloseSubMainFrame(fConsMainFrame); fConsMainFrame = 0; }
00243   //  virtual void CloseEvdGUI()  { CloseSubMainFrame(fEvdMainFrame);  fEvdMainFrame = 0; }
00244   
00245   void HandleMenu(Int_t id); // GUI actions management
00246   void CheckGevent(Event_t* event); // connected to the GUI root-management
00247 
00248   virtual void CloseWindow();
00249   virtual void BuildMainGUI();
00250 
00251   virtual void StartProducer();
00252   virtual void StartConsumer();
00253 
00254   virtual void RunEventDisplay();
00255   virtual void KillEventDisplay();
00256   
00257   ClassDef(TFndMonitorGUI,0)
00258 };
00259 
00260 
00261 #endif // FROOT_TFndMonitorGUI

Generated on Tue Oct 16 15:40:46 2007 by  doxygen 1.5.2