Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:38

0001 // $Id$
0002 //
0003 //    File: jv_mainframe.h
0004 // Created: Fri Oct  3 08:12:01 EDT 2014
0005 // Creator: davidl (on Darwin harriet.jlab.org 13.4.0 i386)
0006 //
0007 
0008 #ifndef _jv_mainframe_
0009 #define _jv_mainframe_
0010 
0011 #include <string>
0012 #include <iostream>
0013 using namespace std;
0014 
0015 #include <TApplication.h>
0016 #include <TGFrame.h>
0017 #include <TGClient.h>
0018 #include <TGButton.h>
0019 #include <TGLabel.h>
0020 #include <TGMenu.h>
0021 #include <TGListBox.h>
0022 #include <TGDockableFrame.h>
0023 #include <TGTab.h>
0024 #include <TGResourcePool.h>
0025 #include <TCanvas.h>
0026 #include <TText.h>
0027 #include <TRootEmbeddedCanvas.h>
0028 #include <TColor.h>
0029 #include <TTimer.h>
0030 
0031 #include "JVFactoryInfo.h"
0032 
0033 #if !defined(__CINT__) && !defined(__CLING__)
0034 #include <JANA/JObject.h>
0035 #endif // __CINT__  __CLING__
0036 
0037 
0038 
0039 // information for menu bar
0040 enum MenuCommandIdentifiers {
0041   M_FILE_OPEN,
0042   M_FILE_SAVE,
0043   M_FILE_NEW_CONFIG,
0044   M_FILE_OPEN_CONFIG,
0045   M_FILE_SAVE_CONFIG,
0046   M_FILE_SAVE_AS_CONFIG,
0047   M_FILE_EXIT,
0048 
0049   M_TOOLS_MACROS,
0050   M_TOOLS_TBROWSER,
0051   M_TOOLS_TREEINFO,
0052   M_TOOLS_SAVEHISTS,
0053   M_TOOLS_RESET,
0054 
0055   M_VIEW_NEW_TAB,
0056   M_VIEW_REMOVE_TAB,
0057   M_VIEW_LOGX,
0058   M_VIEW_LOGY,
0059   M_VIEW_SCALE_OPTS
0060 
0061 };
0062 
0063 
0064 class jv_mainframe:public TGMainFrame{
0065     public:
0066         jv_mainframe(const TGWindow *p, UInt_t w, UInt_t h, bool build_gui);
0067         virtual ~jv_mainframe();
0068 
0069         // Virtual methods and menu handler
0070         void CloseWindow(void);
0071         void HandleMenu(Int_t id);
0072         void DoQuit(void);
0073         void DoNext(void);
0074         void DoDelayedSelectObjectType(void);
0075         void DoSelectObjectType(Int_t id);
0076         void DoSelectObject(Int_t id);
0077         void DoSelectAssociatedObject(Int_t id);
0078         void DoSelectAssociatedToObject(Int_t id);
0079         void DoTimer(void);
0080         void DoDoubleClickAssociatedObject(Int_t id);
0081         void DoDoubleClickAssociatedToObject(Int_t id);
0082         void DoCallGraphClicked(Int_t event, Int_t x, Int_t y, TObject *selected);
0083         Bool_t HandleConfigureNotify(Event_t *event);
0084         
0085         string GetSelectedObjectType(void);
0086         void UpdateInfo(string source, int run, int event);
0087         void UpdateObjectTypeList(vector<JVFactoryInfo> &facinfo);
0088         void SelectNewObject(void *vobj);
0089         void Redraw(TGFrame *lb);
0090 
0091 #if !defined(__CINT__) && !defined(__CLING__)
0092         void UpdateObjectValues(JObject *obj);
0093 #endif // __CINT__  __CLING__
0094 
0095         // Helper methods for building GUI
0096         TGLabel*          AddLabel(TGCompositeFrame* frame, string text, Int_t mode=kTextLeft, ULong_t hints=kLHintsLeft | kLHintsTop);
0097         TGLabel*          AddNamedLabel(TGCompositeFrame* frame, string text, Int_t mode=kTextLeft, ULong_t hints=kLHintsLeft | kLHintsTop);
0098         TGTextButton*     AddButton(TGCompositeFrame* frame, string text, ULong_t hints=kLHintsLeft | kLHintsTop);
0099         TGCheckButton*    AddCheckButton(TGCompositeFrame* frame, string text, ULong_t hints=kLHintsLeft | kLHintsTop);
0100         TGPictureButton*  AddPictureButton(TGCompositeFrame* frame, string picture, string tooltip="", ULong_t hints=kLHintsLeft | kLHintsTop);
0101         TGFrame*          AddSpacer(TGCompositeFrame* frame, UInt_t w=10, UInt_t h=10, ULong_t hints=kLHintsCenterX | kLHintsCenterY);
0102         TGListBox*        AddListBox(TGCompositeFrame* frame, string lab="", UInt_t w=350, ULong_t hints=kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY);
0103         
0104         TGLabel   *lSource;
0105         TGLabel   *lRun;
0106         TGLabel   *lEvent;
0107         TGLabel   *lObjectType;
0108         TGLabel   *lObjectValue;
0109         TGListBox *lbObjectTypes;
0110         TGListBox *lbObjects;
0111         TGListBox *lbAssociatedObjects;
0112         TGListBox *lbAssociatedToObjects;
0113         TGListBox *lbObjectValues;
0114         
0115         TGTab *fTab;
0116         TGCanvas *gcanvas;
0117         TGVerticalFrame *fCanvas;
0118         TRootEmbeddedCanvas *canvas;
0119         
0120         vector<string> objtypes; // nametags of values in object type listbox
0121         vector<void*> vobjs;
0122 #if !defined(__CINT__) && !defined(__CLING__)
0123         vector<const JObject*> aobjs;
0124         vector<const JObject*> a2objs;
0125 #endif // __CINT__  __CLING__
0126 
0127     protected:
0128         TTimer *timer;
0129         long sleep_time; // in milliseconds
0130         Int_t delayed_object_type_id;
0131         string last_selected_nametag;
0132 
0133         void CreateGUI(void);
0134     
0135     
0136     private:
0137 
0138     ClassDef(jv_mainframe,1)
0139 };
0140 
0141 #endif // _jv_mainframe_
0142