#ifndef ROOT_TSessionViewer
#define ROOT_TSessionViewer
#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TGTextEntry
#include "TGTextEntry.h"
#endif
#ifndef ROOT_TGNumberEntry
#include "TGNumberEntry.h"
#endif
#ifndef ROOT_TGTab
#include "TGTab.h"
#endif
#ifndef ROOT_TGListView
#include "TGListView.h"
#endif
#ifndef ROOT_TTime
#include "TTime.h"
#endif
#include <stdio.h>
#include <time.h>
class TList;
class TChain;
class TDSet;
class TGNumberEntry;
class TGTextEntry;
class TGTextButton;
class TGCheckButton;
class TGTextBuffer;
class TGTableLayout;
class TGIcon;
class TGLabel;
class TGHProgressBar;
class TGPopupMenu;
class TGLVContainer;
class TGListView;
class TGLVEntry;
class TGCanvas;
class TGListTree;
class TGListTreeItem;
class TGStatusBar;
class TGPicture;
class TGMenuBar;
class TGPopupMenu;
class TGToolBar;
class TGTextView;
class TGTab;
class TRootEmbeddedCanvas;
class TGListBox;
class TCanvas;
class TEnv;
struct UserGroup_t;
class TProofMgr;
class TProof;
class TSessionViewer;
class TSessionLogView;
class TQueryResult;
class TContextMenu;
class TQueryDescription : public TObject {
public:
enum ESessionQueryStatus {
kSessionQueryAborted = 0,
kSessionQuerySubmitted,
kSessionQueryRunning,
kSessionQueryStopped,
kSessionQueryCompleted,
kSessionQueryFinalized,
kSessionQueryCreated,
kSessionQueryFromProof
};
ESessionQueryStatus fStatus;
TString fReference;
TString fQueryName;
TString fSelectorString;
TString fTDSetString;
TString fOptions;
TString fEventList;
Int_t fNbFiles;
Long64_t fNoEntries;
Long64_t fFirstEntry;
TTime fStartTime;
TTime fEndTime;
TObject *fChain;
TQueryResult *fResult;
const char *GetName() const { return fQueryName; }
ClassDef(TQueryDescription, 1)
};
enum EMenuIdentification {
kMenuAddToFeedback,
kMenuShow,
kMenuRemoveFromFeedback
};
class TSessionDescription : public TObject {
public:
TString fTag;
TString fName;
TString fAddress;
Int_t fPort;
TString fConfigFile;
Int_t fLogLevel;
TString fUserName;
Bool_t fConnected;
Bool_t fAttached;
Bool_t fLocal;
Bool_t fSync;
Bool_t fAutoEnable;
TList *fQueries;
TList *fPackages;
TQueryDescription *fActQuery;
TProof *fProof;
TProofMgr *fProofMgr;
Int_t fNbHistos;
const char *GetName() const { return fName; }
ClassDef(TSessionDescription, 1)
};
class TPackageDescription : public TObject {
public:
TString fName;
TString fPathName;
Int_t fId;
Bool_t fUploaded;
Bool_t fEnabled;
const char *GetName() const { return fName; }
ClassDef(TPackageDescription, 1)
};
class TSessionServerFrame : public TGCompositeFrame {
private:
TGCompositeFrame *fFrmNewServer;
TGTextEntry *fTxtName;
TGTextEntry *fTxtAddress;
TGNumberEntry *fNumPort;
TGNumberEntry *fLogLevel;
TGTextEntry *fTxtConfig;
TGTextEntry *fTxtUsrName;
TGCheckButton *fSync;
TSessionViewer *fViewer;
TGTextButton *fBtnAdd;
TGTextButton *fBtnConnect;
public:
TSessionServerFrame(TGWindow *parent, Int_t w, Int_t h);
virtual ~TSessionServerFrame();
void Build(TSessionViewer *gui);
const char *GetName() const { return fTxtName->GetText(); }
const char *GetAddress() const { return fTxtAddress->GetText(); }
Int_t GetPortNumber() const { return fNumPort->GetIntNumber(); }
Int_t GetLogLevel() const { return fLogLevel->GetIntNumber(); }
const char *GetConfigText() const { return fTxtConfig->GetText(); }
const char *GetUserName() const { return fTxtUsrName->GetText(); }
Bool_t IsSync() const { return (Bool_t)(fSync->GetState() == kButtonDown); }
void SetAddEnabled(Bool_t on = kTRUE) {
on == kTRUE ? ShowFrame(fBtnAdd) : HideFrame(fBtnAdd); }
void SetConnectEnabled(Bool_t on = kTRUE) {
on == kTRUE ? ShowFrame(fBtnConnect) : HideFrame(fBtnConnect); }
void SetName(const char *str) { fTxtName->SetText(str); }
void SetAddress(const char *str) { fTxtAddress->SetText(str); }
void SetPortNumber(Int_t port) { fNumPort->SetIntNumber(port); }
void SetLogLevel(Int_t log) { fLogLevel->SetIntNumber(log); }
void SetConfigText(const char *str) { fTxtConfig->SetText(str); }
void SetUserName(const char *str) { fTxtUsrName->SetText(str); }
void SetSync(Bool_t sync) {
fSync->SetState(sync ? kButtonDown : kButtonUp); }
void SettingsChanged();
void OnBtnConnectClicked();
void OnBtnNewServerClicked();
void OnBtnDeleteClicked();
void OnBtnAddClicked();
void OnConfigFileClicked();
void Update(TSessionDescription* desc);
virtual Bool_t HandleExpose(Event_t *event);
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
ClassDef(TSessionServerFrame, 0)
};
class TSessionFrame : public TGCompositeFrame {
private:
TGTab *fTab;
TGCompositeFrame *fFA, *fFB, *fFC;
TGCompositeFrame *fFD, *fFE;
TGTextEntry *fCommandTxt;
TGTextBuffer *fCommandBuf;
TGTextView *fInfoTextView;
TGCheckButton *fClearCheck;
TGTextButton *fBtnShowLog;
TGTextButton *fBtnNewQuery;
TGTextButton *fBtnGetQueries;
TGListBox *fLBPackages;
TGTextButton *fBtnAdd;
TGTextButton *fBtnRemove;
TGTextButton *fBtnUp;
TGTextButton *fBtnDown;
TGTextButton *fBtnShow;
TGTextButton *fBtnShowEnabled;
TGCheckButton *fChkMulti;
TGCheckButton *fChkEnable;
TGTextButton *fBtnUpload;
TGTextButton *fBtnEnable;
TGTextButton *fBtnClear;
TGTextButton *fBtnDisable;
TGCanvas *fDSetView;
TGListTree *fDataSetTree;
TGTextButton *fBtnUploadDSet;
TGTextButton *fBtnRemoveDSet;
TGTextButton *fBtnVerifyDSet;
TGTextButton *fBtnRefresh;
TGTextEntry *fTxtParallel;
TGNumberEntry *fLogLevel;
TGTextButton *fApplyLogLevel;
TGTextButton *fApplyParallel;
TSessionViewer *fViewer;
TGLabel *fInfoLine[19];
public:
TSessionFrame(TGWindow* parent, Int_t w, Int_t h);
virtual ~TSessionFrame();
void Build(TSessionViewer *gui);
void CheckAutoEnPack(Bool_t checked = kTRUE) {
fChkEnable->SetState(checked ? kButtonDown : kButtonUp); }
Int_t GetLogLevel() const { return fLogLevel->GetIntNumber(); }
void SetLogLevel(Int_t log) { fLogLevel->SetIntNumber(log); }
TGTab *GetTab() const { return fTab; }
void OnApplyLogLevel();
void OnApplyParallel();
void OnBtnAddClicked();
void OnBtnRemoveClicked();
void OnBtnUpClicked();
void OnBtnDownClicked();
void OnBtnShowLogClicked();
void OnBtnNewQueryClicked();
void OnBtnGetQueriesClicked();
void OnBtnDisconnectClicked();
void OnCommandLine();
void OnUploadPackages();
void OnEnablePackages();
void OnDisablePackages();
void OnClearPackages();
void OnMultipleSelection(Bool_t on);
void OnStartupEnable(Bool_t on);
void ProofInfos();
void SetLocal(Bool_t local = kTRUE);
void ShutdownSession();
void UpdatePackages();
void OnBtnUploadDSet();
void OnBtnRemoveDSet();
void OnBtnVerifyDSet();
void UpdateListOfDataSets();
ClassDef(TSessionFrame, 0)
};
class TEditQueryFrame : public TGCompositeFrame {
private:
TGCompositeFrame *fFrmMore;
TGTextButton *fBtnMore;
TGTextEntry *fTxtQueryName;
TGTextEntry *fTxtChain;
TGTextEntry *fTxtSelector;
TGTextEntry *fTxtOptions;
TGNumberEntry *fNumEntries;
TGNumberEntry *fNumFirstEntry;
TGTextEntry *fTxtParFile;
TGTextEntry *fTxtEventList;
TSessionViewer *fViewer;
TQueryDescription *fQuery;
TObject *fChain;
public:
TEditQueryFrame(TGWindow* p, Int_t w, Int_t h);
virtual ~TEditQueryFrame();
void Build(TSessionViewer *gui);
void OnNewQueryMore();
void OnBrowseChain();
void OnBrowseSelector();
void OnBrowseEventList();
void OnBtnSave();
void OnElementSelected(TObject *obj);
void SettingsChanged();
void UpdateFields(TQueryDescription *desc);
ClassDef(TEditQueryFrame, 0)
};
class TSessionQueryFrame : public TGCompositeFrame {
private:
enum EQueryStatus { kRunning = 0, kDone, kStopped, kAborted };
TGTextButton *fBtnSubmit;
TGTextButton *fBtnFinalize;
TGTextButton *fBtnStop;
TGTextButton *fBtnAbort;
TGTextButton *fBtnShowLog;
TGTextButton *fBtnRetrieve;
TGTextButton *fBtnSave;
TGTextView *fInfoTextView;
Bool_t fModified;
Int_t fFiles;
Long64_t fFirst;
Long64_t fEntries;
Long64_t fPrevTotal;
Long64_t fPrevProcessed;
TGLabel *fLabInfos;
TGLabel *fLabStatus;
TGLabel *fTotal;
TGLabel *fRate;
EQueryStatus fStatus;
TGTab *fTab;
TGCompositeFrame *fFA, *fFB, *fFC;
TEditQueryFrame *fFD;
TGHProgressBar *frmProg;
TRootEmbeddedCanvas *fECanvas;
TCanvas *fStatsCanvas;
TSessionViewer *fViewer;
TQueryDescription *fDesc;
public:
TSessionQueryFrame(TGWindow* parent, Int_t w, Int_t h);
virtual ~TSessionQueryFrame();
void Build(TSessionViewer *gui);
TCanvas *GetStatsCanvas() const { return fStatsCanvas; }
TEditQueryFrame *GetQueryEditFrame() const { return fFD; }
TGTab *GetTab() const { return fTab; }
void Feedback(TList *objs);
void Modified(Bool_t mod = kTRUE);
void Progress(Long64_t total, Long64_t processed);
void Progress(Long64_t total, Long64_t processed,
Long64_t bytesread, Float_t initTime,
Float_t procTime, Float_t evtrti,
Float_t mbrti);
void ProgressLocal(Long64_t total, Long64_t processed);
void IndicateStop(Bool_t aborted);
void ResetProgressDialog(const char *selec, Int_t files, Long64_t first, Long64_t entries);
void OnBtnSubmit();
void OnBtnFinalize();
void OnBtnStop();
void OnBtnAbort();
void OnBtnShowLog();
void OnBtnRetrieve();
void UpdateInfos();
void UpdateButtons(TQueryDescription *desc);
void UpdateHistos(TList *objs);
ClassDef(TSessionQueryFrame, 0)
};
class TSessionOutputFrame : public TGCompositeFrame {
private:
TGLVEntry *fEntryTmp;
TGLVContainer *fLVContainer;
TSessionViewer *fViewer;
public:
TSessionOutputFrame(TGWindow* parent, Int_t w, Int_t h);
virtual ~TSessionOutputFrame();
void AddObject(TObject *obj);
void Build(TSessionViewer *gui);
TGLVContainer *GetLVContainer() { return fLVContainer; }
void OnElementClicked(TGLVEntry* entry, Int_t btn, Int_t x, Int_t y);
void OnElementDblClicked(TGLVEntry *entry ,Int_t btn, Int_t x, Int_t y);
void RemoveAll() { fLVContainer->RemoveAll(); }
ClassDef(TSessionOutputFrame, 0)
};
class TSessionInputFrame : public TGCompositeFrame {
private:
TSessionViewer *fViewer;
TGLVContainer *fLVContainer;
public:
TSessionInputFrame(TGWindow* parent, Int_t w, Int_t h);
virtual ~TSessionInputFrame();
void AddObject(TObject *obj);
void Build(TSessionViewer *gui);
void RemoveAll() { fLVContainer->RemoveAll(); }
TGLVContainer *GetLVContainer() { return fLVContainer; }
ClassDef(TSessionInputFrame, 0)
};
class TSessionViewer : public TGMainFrame {
private:
time_t fStart, fElapsed;
Bool_t fChangePic;
Bool_t fBusy;
TGHorizontalFrame *fHf;
TGVerticalFrame *fV1;
TGVerticalFrame *fV2;
TSessionServerFrame *fServerFrame;
TSessionFrame *fSessionFrame;
TSessionQueryFrame *fQueryFrame;
TSessionOutputFrame *fOutputFrame;
TSessionInputFrame *fInputFrame;
TSessionLogView *fLogWindow;
TSessionDescription *fActDesc;
TList *fSessions;
const TGPicture *fLocal;
const TGPicture *fProofCon;
const TGPicture *fProofDiscon;
const TGPicture *fQueryCon;
const TGPicture *fQueryDiscon;
const TGPicture *fBaseIcon;
TGFrame *fActFrame;
TGToolBar *fToolBar;
TGMenuBar *fMenuBar;
TGPopupMenu *fFileMenu;
TGPopupMenu *fSessionMenu;
TGPopupMenu *fQueryMenu;
TGPopupMenu *fOptionsMenu;
TGPopupMenu *fCascadeMenu;
TGPopupMenu *fHelpMenu;
TGPopupMenu *fPopupSrv;
TGPopupMenu *fPopupQry;
TContextMenu *fContextMenu;
TGHProgressBar *fConnectProg;
TGCanvas *fTreeView;
TGListTree *fSessionHierarchy;
TGListTreeItem *fSessionItem;
TGStatusBar *fStatusBar;
TGPicture *fRightIconPicture;
TGIcon *fRightIcon;
TTimer *fTimer;
UserGroup_t *fUserGroup;
Bool_t fAutoSave;
TString fConfigFile;
TEnv *fViewerEnv;
public:
TSessionViewer(const char *title = "ROOT Session Viewer", UInt_t w = 550, UInt_t h = 320);
TSessionViewer(const char *title, Int_t x, Int_t y, UInt_t w, UInt_t h);
virtual ~TSessionViewer();
virtual void Build();
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t);
TSessionServerFrame *GetServerFrame() const { return fServerFrame; }
TSessionFrame *GetSessionFrame() const { return fSessionFrame; }
TSessionQueryFrame *GetQueryFrame() const { return fQueryFrame; }
TSessionOutputFrame *GetOutputFrame() const { return fOutputFrame; }
TSessionInputFrame *GetInputFrame() const { return fInputFrame; }
TSessionDescription *GetActDesc() const { return fActDesc; }
TList *GetSessions() const { return fSessions; }
TGListTree *GetSessionHierarchy() const { return fSessionHierarchy; }
TGListTreeItem *GetSessionItem() const { return fSessionItem; }
const TGPicture *GetLocalPict() const { return fLocal; }
const TGPicture *GetProofConPict() const { return fProofCon; }
const TGPicture *GetProofDisconPict() const { return fProofDiscon; }
const TGPicture *GetQueryConPict() const { return fQueryCon; }
const TGPicture *GetQueryDisconPict() const { return fQueryDiscon; }
const TGPicture *GetBasePict() const { return fBaseIcon; }
TGPopupMenu *GetPopupSrv() const { return fPopupSrv; }
TGPopupMenu *GetPopupQry() const { return fPopupQry; }
TContextMenu *GetContextMenu() const { return fContextMenu; }
TGStatusBar *GetStatusBar() const { return fStatusBar; }
TGHProgressBar *GetConnectProg() const { return fConnectProg; }
TGPopupMenu *GetCascadeMenu() const { return fCascadeMenu; }
TGPopupMenu *GetOptionsMenu() const { return fOptionsMenu; }
void ChangeRightLogo(const char *name);
void CleanupSession();
void CloseWindow();
void DisableTimer();
void EditQuery();
void EnableTimer();
Bool_t HandleTimer(TTimer *);
Bool_t IsBusy() const { return fBusy; }
Bool_t IsAutoSave() const { return fAutoSave; }
void LogMessage(const char *msg, Bool_t all);
void MyHandleMenu(Int_t);
void OnCascadeMenu();
void OnListTreeClicked(TGListTreeItem *entry, Int_t btn, Int_t x, Int_t y);
void OnListTreeDoubleClicked(TGListTreeItem *entry, Int_t btn);
void QueryResultReady(char *query);
void DeleteQuery();
void ReadConfiguration(const char *filename = 0);
void ResetSession();
void UpdateListOfProofs();
void UpdateListOfSessions();
void UpdateListOfPackages();
void WriteConfiguration(const char *filename = 0);
void SetBusy(Bool_t busy = kTRUE) { fBusy = busy; }
void SetChangePic(Bool_t change) { fChangePic = change;}
void SetLogWindow(TSessionLogView *log) { fLogWindow = log; }
void ShowEnabledPackages();
void ShowPackages();
void ShowInfo(const char *txt);
void ShowLog(const char *queryref);
void ShowStatus();
void StartupMessage(char *msg, Bool_t stat, Int_t curr, Int_t total);
void StartViewer();
void Terminate();
ClassDef(TSessionViewer, 0)
};
R__EXTERN TSessionViewer *gSessionViewer;
#endif