| 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 TGLabel;
|
|---|
| 26 | class TGListBox;
|
|---|
| 27 | class TGProgressBar;
|
|---|
| 28 | class TGHProgressBar;
|
|---|
| 29 |
|
|---|
| 30 | class MStatusDisplay : public TGMainFrame
|
|---|
| 31 | {
|
|---|
| 32 | public:
|
|---|
| 33 | typedef enum {
|
|---|
| 34 | kLoopNone,
|
|---|
| 35 | kLoopStop,
|
|---|
| 36 | kFileSave,
|
|---|
| 37 | kFileSaveAs,
|
|---|
| 38 | kFileSaveAsPS,
|
|---|
| 39 | kFileSaveAsRoot,
|
|---|
| 40 | kFileSaveAsGIF,
|
|---|
| 41 | kFileSaveAsC,
|
|---|
| 42 | kFilePrint,
|
|---|
| 43 | kFilePrinterName,
|
|---|
| 44 | kTabSave,
|
|---|
| 45 | kTabSaveAs,
|
|---|
| 46 | kTabSaveAsPS,
|
|---|
| 47 | kTabSaveAsRoot,
|
|---|
| 48 | kTabSaveAsGIF,
|
|---|
| 49 | kTabSaveAsC,
|
|---|
| 50 | kTabPrint,
|
|---|
| 51 | kTabNext,
|
|---|
| 52 | kTabPrevious,
|
|---|
| 53 | kFileExit,
|
|---|
| 54 | kPicMagic,
|
|---|
| 55 | kPicMars
|
|---|
| 56 | } Status_t;
|
|---|
| 57 |
|
|---|
| 58 | private:
|
|---|
| 59 | MGList *fList;
|
|---|
| 60 | TGHProgressBar *fBar;
|
|---|
| 61 | TGTab *fTab;
|
|---|
| 62 | TGLayoutHints *fLayCanvas;
|
|---|
| 63 |
|
|---|
| 64 | TTimer fTimer;
|
|---|
| 65 |
|
|---|
| 66 | TGLabel *fLine1;
|
|---|
| 67 | TGLabel *fLine2;
|
|---|
| 68 |
|
|---|
| 69 | Status_t fStatus;
|
|---|
| 70 |
|
|---|
| 71 | TString fPrinter;
|
|---|
| 72 |
|
|---|
| 73 | MLog *fLog;
|
|---|
| 74 | Int_t fLogIdx;
|
|---|
| 75 | TTimer fLogTimer;
|
|---|
| 76 | TGListBox *fLogBox;
|
|---|
| 77 |
|
|---|
| 78 | void AddMenuBar();
|
|---|
| 79 | void AddProgressBar();
|
|---|
| 80 | void AddMarsTab();
|
|---|
| 81 | void AddLogTab();
|
|---|
| 82 | void AddTabs();
|
|---|
| 83 | void AddStatusLines();
|
|---|
| 84 |
|
|---|
| 85 | TCanvas *GetCanvas(TGCompositeFrame *f) const;
|
|---|
| 86 |
|
|---|
| 87 | Bool_t ProcessMessageCommandMenu(Long_t mp1);
|
|---|
| 88 | Bool_t ProcessMessageCommand(Long_t submsg, Long_t mp1, Long_t mp2);
|
|---|
| 89 | Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2);
|
|---|
| 90 | void CloseWindow();
|
|---|
| 91 |
|
|---|
| 92 | Bool_t HandleTimer(TTimer *timer=NULL);
|
|---|
| 93 | void UpdateTab(TGCompositeFrame *f);
|
|---|
| 94 |
|
|---|
| 95 | void DrawClonePad(TCanvas &newc, const TCanvas &oldc) const;
|
|---|
| 96 | void CanvasSetFillColor(TPad &c, Int_t col) const;
|
|---|
| 97 |
|
|---|
| 98 | void AddExtension(TString &name, const TString &ext, Int_t num) const;
|
|---|
| 99 |
|
|---|
| 100 | enum {
|
|---|
| 101 | kIsLocked = BIT(14)
|
|---|
| 102 | };
|
|---|
| 103 | public:
|
|---|
| 104 | MStatusDisplay(Long_t t=1000);
|
|---|
| 105 | virtual ~MStatusDisplay();
|
|---|
| 106 |
|
|---|
| 107 | void SetLogStream(MLog *log, Bool_t enable=kFALSE);
|
|---|
| 108 |
|
|---|
| 109 | void StartUpdate(Int_t millisec=-1);
|
|---|
| 110 | void StopUpdate();
|
|---|
| 111 | void SetUpdateTime(Long_t t);
|
|---|
| 112 |
|
|---|
| 113 | TGProgressBar *GetBar() const { return (TGProgressBar*)fBar; }
|
|---|
| 114 |
|
|---|
| 115 | void SetStatusLine1(const char *txt);
|
|---|
| 116 | void SetStatusLine2(const char *txt);
|
|---|
| 117 | void SetStatusLine2(const MParContainer &cont);
|
|---|
| 118 |
|
|---|
| 119 | void SetPrinter(const TString &lpr) { fPrinter = lpr; }
|
|---|
| 120 |
|
|---|
| 121 | TCanvas &AddTab(const char *name);
|
|---|
| 122 |
|
|---|
| 123 | TCanvas *GetCanvas(int i) const;
|
|---|
| 124 | TCanvas *GetCanvas(const TString &name) const;
|
|---|
| 125 |
|
|---|
| 126 | Int_t Read(const char *name="MStatusDisplay");
|
|---|
| 127 | Int_t Write(const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0)
|
|---|
| 128 | {
|
|---|
| 129 | return Write(-1, name, option, bufsize);
|
|---|
| 130 | }
|
|---|
| 131 | Int_t Write(Int_t num, const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0);
|
|---|
| 132 |
|
|---|
| 133 | Bool_t CdCanvas(const TString &name);
|
|---|
| 134 |
|
|---|
| 135 | void SetNoContextMenu(Bool_t flag=kTRUE);
|
|---|
| 136 |
|
|---|
| 137 | Int_t SaveAsPS(TString name="") const { return SaveAsPS(-1, name); }
|
|---|
| 138 | //Bool_t SaveAsGIF(TString name="") const { return SaveAsGIF(-1, name); }
|
|---|
| 139 | //Bool_t SaveAsC(TString name="") const { return SaveAsC(-1, name); }
|
|---|
| 140 | Int_t SaveAsRoot(TString name="") { return SaveAsRoot(-1, name); }
|
|---|
| 141 | Int_t PrintToLpr() const { return PrintToLpr(-1); }
|
|---|
| 142 |
|
|---|
| 143 | Int_t SaveAsPS(Int_t num, TString name="") const;
|
|---|
| 144 | //Bool_t SaveAsGIF(Int_t num, TString name="") const;
|
|---|
| 145 | //Bool_t SaveAsC(Int_t num, TString name="") const;
|
|---|
| 146 | Int_t SaveAsRoot(Int_t num, TString name="");
|
|---|
| 147 | Int_t PrintToLpr(Int_t num) const;
|
|---|
| 148 |
|
|---|
| 149 | Status_t CheckStatus() const { return fStatus; }
|
|---|
| 150 | void ClearStatus() { fStatus = kLoopNone; }
|
|---|
| 151 |
|
|---|
| 152 | void Lock() { SetBit(kIsLocked); }
|
|---|
| 153 | void UnLock() { ResetBit(kIsLocked); }
|
|---|
| 154 |
|
|---|
| 155 | ClassDef(MStatusDisplay, 0) // Window for a status display
|
|---|
| 156 | };
|
|---|
| 157 |
|
|---|
| 158 | #endif
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|