TTreeViewer.h

Go to the documentation of this file.
00001 // @(#)root/treeviewer:$Id: TTreeViewer.h 20882 2007-11-19 11:31:26Z rdm $
00002 //Author : Andrei Gheata   16/08/00
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TTreeViewer
00013 #define ROOT_TTreeViewer
00014 
00015 ////////////////////////////////////////////////////
00016 //                                                //
00017 // TTreeViewer - A GUI oriented tree viewer       //
00018 //                                                //
00019 ////////////////////////////////////////////////////
00020 
00021 #ifndef ROOT_TGFrame
00022 #include "TGFrame.h"
00023 #endif
00024 
00025 class TTreeViewer;
00026 class TTVLVContainer;
00027 class TTVLVEntry;
00028 class TTVSession;
00029 class TGSelectBox;
00030 class TTree;
00031 class TBranch;
00032 class TContextMenu;
00033 class TList;
00034 class TGPicture;
00035 class TTimer;
00036 class TGLayoutHints;
00037 class TGMenuBar;
00038 class TGPopupMenu;
00039 class TGToolBar;
00040 class TGLabel;
00041 class TGCheckButton;
00042 class TGComboBox;
00043 class TGTextButton;
00044 class TGTextEntry;
00045 class TGDoubleVSlider;
00046 class TGPictureButton;
00047 class TGStatusBar;
00048 class TGCanvas;
00049 class TGListTree;
00050 class TGListTreeItem;
00051 class TGListView;
00052 class TGHProgressBar;
00053 class TGButton;
00054 
00055 
00056 class TTreeViewer : public TGMainFrame {
00057 
00058 friend class TGClient;
00059 friend class TGButton;
00060 
00061 public:
00062    //---- item types used as user data
00063    enum EListItemType {
00064       kLTNoType            = 0,
00065       kLTPackType          = BIT(0),
00066       kLTTreeType          = BIT(1),
00067       kLTBranchType        = BIT(2),
00068       kLTLeafType          = BIT(3),
00069       kLTActionType        = BIT(4),
00070       kLTDragType          = BIT(5),
00071       kLTExpressionType    = BIT(6),
00072       kLTCutType           = BIT(7)
00073    };
00074 
00075 private:
00076    TTree                *fTree;                 // selected tree
00077    TTVSession           *fSession;              // current tree-viewer session
00078    const char           *fFilename;             // name of the file containing the tree
00079    const char           *fSourceFile;           // name of the C++ source file - default treeviewer.C
00080    TString              fLastOption;            // last graphic option
00081    TTree                *fMappedTree;           // listed tree
00082    TBranch              *fMappedBranch;         // listed branch
00083    Int_t                fDimension;             // histogram dimension
00084    Bool_t               fVarDraw;               // true if an item is double-clicked
00085    Bool_t               fScanMode;              // flag activated when Scan Box is double-clicked
00086    TContextMenu         *fContextMenu;          // context menu for tree viewer
00087    TGSelectBox          *fDialogBox;            // expression editor
00088    TList                *fTreeList;             // list of mapped trees
00089    Int_t                fTreeIndex;             // index of current tree in list
00090    const TGPicture      *fPicX, *fPicY, *fPicZ; // pictures for X, Y and Z expressions
00091    const TGPicture      *fPicDraw, *fPicStop;   // pictures for Draw/Stop buttons
00092    const TGPicture      *fPicRefr;              // pictures for Refresh buttons //ia
00093    Cursor_t             fDefaultCursor;         // default cursor
00094    Cursor_t             fWatchCursor;           // watch cursor
00095    TTimer               *fTimer;                // tree viewer timer
00096    Bool_t               fCounting;              // true if timer is counting
00097    Bool_t               fStopMapping;           // true if branch don't need remapping
00098    Bool_t               fEnableCut;             // true if cuts are enabled
00099    Int_t                fNexpressions;          // number of expression widgets
00100 // menu bar, menu bar entries and layouts
00101    TGLayoutHints        *fMenuBarLayout;
00102    TGLayoutHints        *fMenuBarItemLayout;
00103    TGLayoutHints        *fMenuBarHelpLayout;
00104    TGMenuBar            *fMenuBar;
00105    TGPopupMenu          *fFileMenu;
00106    TGPopupMenu          *fEditMenu;
00107    TGPopupMenu          *fRunMenu;
00108    TGPopupMenu          *fOptionsMenu;
00109    TGPopupMenu          *fOptionsGen;
00110    TGPopupMenu          *fOptions1D;
00111    TGPopupMenu          *fOptions2D;
00112    TGPopupMenu          *fHelpMenu;
00113 // toolbar and hints
00114    TGToolBar            *fToolBar;
00115    TGLayoutHints        *fBarLayout;
00116 // widgets on the toolbar
00117    TGLabel              *fBarLbl1;      // label of command text entry
00118    TGLabel              *fBarLbl2;      // label of option text entry
00119    TGLabel              *fBarLbl3;      // label of histogram name text entry
00120    TGCheckButton        *fBarH;         // checked for drawing current histogram with different graphic option
00121    TGCheckButton        *fBarScan;      // checked for tree scan
00122    TGCheckButton        *fBarRec;       // command recording toggle
00123    TGTextEntry          *fBarCommand;   // user command entry
00124    TGTextEntry          *fBarOption;    // histogram drawing option entry
00125    TGTextEntry          *fBarHist;      // histogram name entry
00126 // frames
00127    TGHorizontalFrame    *fHf;           // main horizontal frame
00128    TGDoubleVSlider      *fSlider;       // vertical slider to select processed tree entries;
00129    TGVerticalFrame      *fV1;           // list tree mother
00130    TGVerticalFrame      *fV2;           // list view mother
00131    TGCompositeFrame     *fTreeHdr;      // header for list tree
00132    TGCompositeFrame     *fListHdr;      // header for list view
00133    TGLabel              *fLbl1;         // label for list tree
00134    TGLabel              *fLbl2;         // label for list view
00135    TGHorizontalFrame    *fBFrame;       // button frame
00136    TGHorizontalFrame    *fHpb;          // progress bar frame
00137    TGHProgressBar       *fProgressBar;  // progress bar
00138    TGLabel              *fBLbl4;        // label for input list entry
00139    TGLabel              *fBLbl5;        // label for output list entry
00140    TGTextEntry          *fBarListIn;    // tree input event list name entry
00141    TGTextEntry          *fBarListOut;   // tree output event list name entry
00142    TGPictureButton      *fDRAW;         // DRAW button
00143    TGTextButton         *fSPIDER;       // SPIDER button
00144    TGPictureButton      *fSTOP;         // interrupt current command (not yet)
00145    TGPictureButton      *fREFR;         // REFRESH button  //ia
00146    TGStatusBar          *fStatusBar;    // status bar
00147    TGComboBox           *fCombo;        // combo box with session records
00148    TGPictureButton      *fBGFirst;
00149    TGPictureButton      *fBGPrevious;
00150    TGPictureButton      *fBGRecord;
00151    TGPictureButton      *fBGNext;
00152    TGPictureButton      *fBGLast;
00153    TGTextButton         *fReset;        // clear expression's entries
00154 // ListTree
00155    TGCanvas             *fTreeView;     // ListTree canvas container
00156    TGListTree           *fLt;           // ListTree with file and tree items
00157 // ListView
00158    TGListView           *fListView;     // ListView with branches and leaves
00159    TTVLVContainer       *fLVContainer;  // container for listview
00160 
00161    TList                *fWidgets;      // list of widgets to be deleted
00162 
00163 private:
00164 // private methods
00165    void          BuildInterface();
00166    const char   *Cut();
00167    Int_t         Dimension();
00168    const char   *EmptyBrackets(const char* name);
00169    const char   *Ex();
00170    const char   *Ey();
00171    const char   *Ez();
00172    const char   *En(Int_t n);
00173    void          MapBranch(TBranch *branch, const char *prefix="", TGListTreeItem *parent = 0, Bool_t listIt = kTRUE);
00174    void          MapOptions(Long_t parm1);
00175    void          MapTree(TTree *tree, TGListTreeItem *parent = 0, Bool_t listIt = kTRUE);
00176    void          SetFile();
00177    const char   *ScanList();
00178    void          SetParentTree(TGListTreeItem *item);
00179    void          DoError(int level, const char *location, const char *fmt, va_list va) const;
00180 
00181 public:
00182    TTreeViewer(const char* treeName = 0);
00183    TTreeViewer(const TTree *tree);
00184    virtual       ~TTreeViewer();
00185 // public methods
00186    void          AppendTree(TTree *tree);
00187    void          ActivateButtons(Bool_t first, Bool_t previous,
00188                                  Bool_t next , Bool_t last);
00189    virtual void  CloseWindow();
00190    virtual void  Delete(Option_t *) { }                          // *MENU*
00191    void          DoRefresh();
00192    void          EditExpression();
00193    void          Empty();
00194    void          EmptyAll();                                     // *MENU*
00195    void          ExecuteCommand(const char* command, Bool_t fast = kFALSE); // *MENU*
00196    void          ExecuteDraw();
00197    void          ExecuteSpider();
00198    TTVLVEntry   *ExpressionItem(Int_t index);
00199    TList        *ExpressionList();
00200    const char   *GetGrOpt();
00201    TTree        *GetTree() {return fTree;}
00202    Bool_t        HandleTimer(TTimer *timer);
00203    Bool_t        IsCutEnabled() {return fEnableCut;}
00204    Bool_t        IsScanRedirected();
00205    Int_t         MakeSelector(const char* selector = 0);         // *MENU*
00206    void          Message(const char* msg);
00207    void          NewExpression();                                // *MENU*
00208    void          PrintEntries();
00209    Long64_t      Process(const char* filename, Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0); // *MENU*
00210    Bool_t        ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00211    void          RemoveItem();
00212    void          RemoveLastRecord();                             // *MENU*
00213    void          SaveSource(const char* filename="", Option_t *option="");            // *MENU*
00214    void          SetHistogramTitle(const char *title);
00215    void          SetCutMode(Bool_t enabled = kTRUE) {fEnableCut = enabled;}
00216    void          SetCurrentRecord(Long64_t entry);
00217    void          SetGrOpt(const char *option);
00218    void          SetNexpressions(Int_t expr);
00219    void          SetRecordName(const char *name);                // *MENU*
00220    void          SetScanFileName(const char *name="");           // *MENU*
00221    void          SetScanMode(Bool_t mode=kTRUE) {fScanMode = mode;}
00222    void          SetScanRedirect(Bool_t mode);
00223    void          SetSession(TTVSession *session);
00224    void          SetUserCode(const char *code, Bool_t autoexec=kTRUE); // *MENU*
00225    void          SetTreeName(const char* treeName);              // *MENU*
00226    Bool_t        SwitchTree(Int_t index);
00227    void          UpdateCombo();
00228    void          UpdateRecord(const char *name="new name");      // *MENU*
00229 
00230    ClassDef(TTreeViewer,0)  // A GUI oriented tree viewer
00231 };
00232 
00233 #endif

Generated on Tue Jul 5 14:28:20 2011 for ROOT_528-00b_version by  doxygen 1.5.1