00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TTreeViewer
00013 #define ROOT_TTreeViewer
00014
00015
00016
00017
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
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;
00077 TTVSession *fSession;
00078 const char *fFilename;
00079 const char *fSourceFile;
00080 TString fLastOption;
00081 TTree *fMappedTree;
00082 TBranch *fMappedBranch;
00083 Int_t fDimension;
00084 Bool_t fVarDraw;
00085 Bool_t fScanMode;
00086 TContextMenu *fContextMenu;
00087 TGSelectBox *fDialogBox;
00088 TList *fTreeList;
00089 Int_t fTreeIndex;
00090 const TGPicture *fPicX, *fPicY, *fPicZ;
00091 const TGPicture *fPicDraw, *fPicStop;
00092 const TGPicture *fPicRefr;
00093 Cursor_t fDefaultCursor;
00094 Cursor_t fWatchCursor;
00095 TTimer *fTimer;
00096 Bool_t fCounting;
00097 Bool_t fStopMapping;
00098 Bool_t fEnableCut;
00099 Int_t fNexpressions;
00100
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
00114 TGToolBar *fToolBar;
00115 TGLayoutHints *fBarLayout;
00116
00117 TGLabel *fBarLbl1;
00118 TGLabel *fBarLbl2;
00119 TGLabel *fBarLbl3;
00120 TGCheckButton *fBarH;
00121 TGCheckButton *fBarScan;
00122 TGCheckButton *fBarRec;
00123 TGTextEntry *fBarCommand;
00124 TGTextEntry *fBarOption;
00125 TGTextEntry *fBarHist;
00126
00127 TGHorizontalFrame *fHf;
00128 TGDoubleVSlider *fSlider;
00129 TGVerticalFrame *fV1;
00130 TGVerticalFrame *fV2;
00131 TGCompositeFrame *fTreeHdr;
00132 TGCompositeFrame *fListHdr;
00133 TGLabel *fLbl1;
00134 TGLabel *fLbl2;
00135 TGHorizontalFrame *fBFrame;
00136 TGHorizontalFrame *fHpb;
00137 TGHProgressBar *fProgressBar;
00138 TGLabel *fBLbl4;
00139 TGLabel *fBLbl5;
00140 TGTextEntry *fBarListIn;
00141 TGTextEntry *fBarListOut;
00142 TGPictureButton *fDRAW;
00143 TGTextButton *fSPIDER;
00144 TGPictureButton *fSTOP;
00145 TGPictureButton *fREFR;
00146 TGStatusBar *fStatusBar;
00147 TGComboBox *fCombo;
00148 TGPictureButton *fBGFirst;
00149 TGPictureButton *fBGPrevious;
00150 TGPictureButton *fBGRecord;
00151 TGPictureButton *fBGNext;
00152 TGPictureButton *fBGLast;
00153 TGTextButton *fReset;
00154
00155 TGCanvas *fTreeView;
00156 TGListTree *fLt;
00157
00158 TGListView *fListView;
00159 TTVLVContainer *fLVContainer;
00160
00161 TList *fWidgets;
00162
00163 private:
00164
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
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 *) { }
00191 void DoRefresh();
00192 void EditExpression();
00193 void Empty();
00194 void EmptyAll();
00195 void ExecuteCommand(const char* command, Bool_t fast = kFALSE);
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);
00206 void Message(const char* msg);
00207 void NewExpression();
00208 void PrintEntries();
00209 Long64_t Process(const char* filename, Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0);
00210 Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00211 void RemoveItem();
00212 void RemoveLastRecord();
00213 void SaveSource(const char* filename="", Option_t *option="");
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);
00220 void SetScanFileName(const char *name="");
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);
00225 void SetTreeName(const char* treeName);
00226 Bool_t SwitchTree(Int_t index);
00227 void UpdateCombo();
00228 void UpdateRecord(const char *name="new name");
00229
00230 ClassDef(TTreeViewer,0)
00231 };
00232
00233 #endif