| 1 | #ifndef MARS_MStatusDisplay
|
|---|
| 2 | #define MARS_MStatusDisplay
|
|---|
| 3 |
|
|---|
| 4 | #ifndef MARS_MAGIC
|
|---|
| 5 | #include "MAGIC.h"
|
|---|
| 6 | #endif
|
|---|
| 7 |
|
|---|
| 8 | #ifndef ROOT_TGFrame
|
|---|
| 9 | #include <TGFrame.h>
|
|---|
| 10 | #endif
|
|---|
| 11 |
|
|---|
| 12 | #ifndef ROOT_TTimer
|
|---|
| 13 | #include <TTimer.h>
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | class MLog;
|
|---|
| 17 | class MGList;
|
|---|
| 18 | class MParContainer;
|
|---|
| 19 |
|
|---|
| 20 | class TPad;
|
|---|
| 21 | class TTimer;
|
|---|
| 22 | class TCanvas;
|
|---|
| 23 |
|
|---|
| 24 | class TGTab;
|
|---|
| 25 | class TGTextView;
|
|---|
| 26 | class TGStatusBar;
|
|---|
| 27 | class TGProgressBar;
|
|---|
| 28 | class TGHProgressBar;
|
|---|
| 29 | class TRootEmbeddedCanvas;
|
|---|
| 30 |
|
|---|
| 31 | class MStatusDisplay : public TGMainFrame
|
|---|
| 32 | {
|
|---|
| 33 | public:
|
|---|
| 34 | typedef enum {
|
|---|
| 35 | // KFile
|
|---|
| 36 | kFileBrowser, kFileCanvas, kFileSave, kFileSaveAs, kFileSaveAsPS,
|
|---|
| 37 | kFileSaveAsRoot, kFileSaveAsGIF, kFileSaveAsC, kFilePrint,
|
|---|
| 38 | kFilePrinterName, kFileClose, kFileExit, kFileReset,
|
|---|
| 39 | // kLoop
|
|---|
| 40 | kLoopNone, kLoopStop,
|
|---|
| 41 | // kTab
|
|---|
| 42 | kTabSave, kTabSaveAs, kTabSaveAsPS, kTabSaveAsRoot, kTabSaveAsGIF,
|
|---|
| 43 | kTabSaveAsC, kTabPrint, kTabNext, kTabPrevious, kTabRemove,
|
|---|
| 44 | // kSize
|
|---|
| 45 | kSize640, kSize800, kSize960, kSize1024, kSize1280,
|
|---|
| 46 | // kLog
|
|---|
| 47 | kLogCopy, kLogClear, kLogSelect, kLogFind, kLogSave, kLogAppend,
|
|---|
| 48 | // kPic
|
|---|
| 49 | kPicMagic, kPicMars,
|
|---|
| 50 | // kPic
|
|---|
| 51 | kSearch
|
|---|
| 52 | } Status_t;
|
|---|
| 53 |
|
|---|
| 54 | private:
|
|---|
| 55 | MGList *fList;
|
|---|
| 56 | TGHProgressBar *fBar;
|
|---|
| 57 | TGTab *fTab;
|
|---|
| 58 | TGLayoutHints *fLayCanvas;
|
|---|
| 59 |
|
|---|
| 60 | TTimer fTimer;
|
|---|
| 61 |
|
|---|
| 62 | TGStatusBar *fStatusBar;
|
|---|
| 63 |
|
|---|
| 64 | Status_t fStatus;
|
|---|
| 65 |
|
|---|
| 66 | TString fPrinter;
|
|---|
| 67 |
|
|---|
| 68 | MLog *fLog;
|
|---|
| 69 | Int_t fLogIdx;
|
|---|
| 70 | TTimer fLogTimer;
|
|---|
| 71 | TGTextView *fLogBox;
|
|---|
| 72 |
|
|---|
| 73 | FontStruct_t fFont;
|
|---|
| 74 |
|
|---|
| 75 | UInt_t fIsLocked;
|
|---|
| 76 |
|
|---|
| 77 | TList *fBatch; //!
|
|---|
| 78 |
|
|---|
| 79 | void AddMenuBar();
|
|---|
| 80 | void AddProgressBar();
|
|---|
| 81 | void AddMarsTab();
|
|---|
| 82 | void AddLogTab();
|
|---|
| 83 | void AddTabs();
|
|---|
| 84 | void AddStatusBar();
|
|---|
| 85 |
|
|---|
| 86 | TCanvas *GetCanvas(TGCompositeFrame *f) const;
|
|---|
| 87 |
|
|---|
| 88 | Bool_t ProcessMessageCommandMenu(Long_t mp1);
|
|---|
| 89 | Bool_t ProcessMessageCommand(Long_t submsg, Long_t mp1, Long_t mp2);
|
|---|
| 90 | Bool_t ProcessMessageTextview(Long_t submsg, Long_t mp1, Long_t mp2);
|
|---|
| 91 | Bool_t ProcessMessageUser(Long_t submsg, Long_t mp1, Long_t mp2);
|
|---|
| 92 | Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2);
|
|---|
| 93 | void CloseWindow();
|
|---|
| 94 | Bool_t HandleConfigureNotify(Event_t *);
|
|---|
| 95 | Bool_t HandleEvent(Event_t *event);
|
|---|
| 96 |
|
|---|
| 97 | Bool_t HandleTimer(TTimer *timer=NULL);
|
|---|
| 98 | void UpdateTab(TGCompositeFrame *f);
|
|---|
| 99 |
|
|---|
| 100 | void DrawClonePad(TCanvas &newc, const TCanvas &oldc) const;
|
|---|
| 101 | void CanvasSetFillColor(TPad &c, Int_t col) const;
|
|---|
| 102 |
|
|---|
| 103 | void AddExtension(TString &name, const TString &ext, Int_t num) const;
|
|---|
| 104 |
|
|---|
| 105 | void UpdatePSHeader(const TString &name) const;
|
|---|
| 106 |
|
|---|
| 107 | void RemoveTab(int i);
|
|---|
| 108 |
|
|---|
| 109 | TRootEmbeddedCanvas *GetEmbeddedCanvas(TGCompositeFrame *cf) const;
|
|---|
| 110 |
|
|---|
| 111 | public:
|
|---|
| 112 | MStatusDisplay(Long_t t=1000);
|
|---|
| 113 | virtual ~MStatusDisplay();
|
|---|
| 114 |
|
|---|
| 115 | void SetLogStream(MLog *log, Bool_t enable=kFALSE);
|
|---|
| 116 |
|
|---|
| 117 | void StartUpdate(Int_t millisec=-1);
|
|---|
| 118 | void StopUpdate();
|
|---|
| 119 | void SetUpdateTime(Long_t t);
|
|---|
| 120 |
|
|---|
| 121 | TGProgressBar *GetBar() const { return (TGProgressBar*)fBar; }
|
|---|
| 122 |
|
|---|
| 123 | void SetStatusLine1(const char *txt);
|
|---|
| 124 | void SetStatusLine2(const char *txt);
|
|---|
| 125 | void SetStatusLine2(const MParContainer &cont);
|
|---|
| 126 |
|
|---|
| 127 | void SetPrinter(const TString &lpr) { fPrinter = lpr; }
|
|---|
| 128 |
|
|---|
| 129 | TCanvas &AddTab(const char *name);
|
|---|
| 130 | TGCompositeFrame *AddRawTab(const char *name);
|
|---|
| 131 |
|
|---|
| 132 | Bool_t HasCanvas(const TCanvas *c) const;
|
|---|
| 133 | TCanvas *GetCanvas(int i) const;
|
|---|
| 134 | TCanvas *GetCanvas(const TString &name) const;
|
|---|
| 135 |
|
|---|
| 136 | Int_t Read(const char *name="MStatusDisplay");
|
|---|
| 137 | Int_t Write(const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0)
|
|---|
| 138 | {
|
|---|
| 139 | return Write(-1, name, option, bufsize);
|
|---|
| 140 | }
|
|---|
| 141 | Int_t Write(Int_t num, const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0);
|
|---|
| 142 |
|
|---|
| 143 | Bool_t CdCanvas(const TString &name);
|
|---|
| 144 |
|
|---|
| 145 | void SetNoContextMenu(Bool_t flag=kTRUE);
|
|---|
| 146 |
|
|---|
| 147 | Int_t SaveAsPS(TString name="") { return SaveAsPS(-1, name); }
|
|---|
| 148 | Bool_t SaveAsGIF(TString name="") { return SaveAsGIF(-1, name); }
|
|---|
| 149 | Bool_t SaveAsC(TString name="") { return SaveAsC(-1, name); }
|
|---|
| 150 | Int_t SaveAsRoot(TString name="") { return SaveAsRoot(-1, name); }
|
|---|
| 151 | Int_t PrintToLpr() { return PrintToLpr(-1); }
|
|---|
| 152 |
|
|---|
| 153 | Int_t SaveAsPS(Int_t num, TString name="");
|
|---|
| 154 | Bool_t SaveAsGIF(Int_t num, TString name="");
|
|---|
| 155 | Bool_t SaveAsC(Int_t num, TString name="");
|
|---|
| 156 | Int_t SaveAsRoot(Int_t num, TString name="");
|
|---|
| 157 | Int_t PrintToLpr(Int_t num);
|
|---|
| 158 |
|
|---|
| 159 | Status_t CheckStatus() const { return fStatus; }
|
|---|
| 160 | void ClearStatus() { fStatus = kLoopNone; }
|
|---|
| 161 |
|
|---|
| 162 | void Lock() { fIsLocked++; }
|
|---|
| 163 | void UnLock() { if (fIsLocked>0) fIsLocked--; }
|
|---|
| 164 |
|
|---|
| 165 | Bool_t CheckTabForCanvas(int num) const;
|
|---|
| 166 |
|
|---|
| 167 | ClassDef(MStatusDisplay, 0) // Window for a status display
|
|---|
| 168 | };
|
|---|
| 169 |
|
|---|
| 170 | #endif
|
|---|