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