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 | kFileBrowser, kFileCanvas, kFileSave, kFileSaveAs, kFileSaveAsPS,
|
---|
36 | kFileSaveAsRoot, kFileSaveAsGIF, kFileSaveAsC, kFilePrint,
|
---|
37 | kFilePrinterName, 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, kLogFind, kLogSave, kLogAppend,
|
---|
47 | // kPic
|
---|
48 | kPicMagic, kPicMars,
|
---|
49 | // kPic
|
---|
50 | kSearch
|
---|
51 | } Status_t;
|
---|
52 |
|
---|
53 | private:
|
---|
54 | MGList *fList;
|
---|
55 | TGHProgressBar *fBar;
|
---|
56 | TGTab *fTab;
|
---|
57 | TGLayoutHints *fLayCanvas;
|
---|
58 |
|
---|
59 | TTimer fTimer;
|
---|
60 |
|
---|
61 | TGStatusBar *fStatusBar;
|
---|
62 |
|
---|
63 | Status_t fStatus;
|
---|
64 |
|
---|
65 | TString fPrinter;
|
---|
66 |
|
---|
67 | MLog *fLog;
|
---|
68 | Int_t fLogIdx;
|
---|
69 | TTimer fLogTimer;
|
---|
70 | TGTextView *fLogBox;
|
---|
71 |
|
---|
72 | FontStruct_t fFont;
|
---|
73 |
|
---|
74 | UInt_t fIsLocked;
|
---|
75 |
|
---|
76 | void AddMenuBar();
|
---|
77 | void AddProgressBar();
|
---|
78 | void AddMarsTab();
|
---|
79 | void AddLogTab();
|
---|
80 | void AddTabs();
|
---|
81 | void AddStatusBar();
|
---|
82 |
|
---|
83 | TCanvas *GetCanvas(TGCompositeFrame *f) const;
|
---|
84 |
|
---|
85 | Bool_t ProcessMessageCommandMenu(Long_t mp1);
|
---|
86 | Bool_t ProcessMessageCommand(Long_t submsg, Long_t mp1, Long_t mp2);
|
---|
87 | Bool_t ProcessMessageTextview(Long_t submsg, Long_t mp1, Long_t mp2);
|
---|
88 | Bool_t ProcessMessageUser(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 | Bool_t HandleConfigureNotify(Event_t *);
|
---|
92 | Bool_t HandleEvent(Event_t *event);
|
---|
93 |
|
---|
94 | Bool_t HandleTimer(TTimer *timer=NULL);
|
---|
95 | void UpdateTab(TGCompositeFrame *f);
|
---|
96 |
|
---|
97 | void DrawClonePad(TCanvas &newc, const TCanvas &oldc) const;
|
---|
98 | void CanvasSetFillColor(TPad &c, Int_t col) const;
|
---|
99 |
|
---|
100 | void AddExtension(TString &name, const TString &ext, Int_t num) const;
|
---|
101 |
|
---|
102 | void UpdatePSHeader(const TString &name) const;
|
---|
103 |
|
---|
104 | public:
|
---|
105 | MStatusDisplay(Long_t t=1000);
|
---|
106 | virtual ~MStatusDisplay();
|
---|
107 |
|
---|
108 | void SetLogStream(MLog *log, Bool_t enable=kFALSE);
|
---|
109 |
|
---|
110 | void StartUpdate(Int_t millisec=-1);
|
---|
111 | void StopUpdate();
|
---|
112 | void SetUpdateTime(Long_t t);
|
---|
113 |
|
---|
114 | TGProgressBar *GetBar() const { return (TGProgressBar*)fBar; }
|
---|
115 |
|
---|
116 | void SetStatusLine1(const char *txt);
|
---|
117 | void SetStatusLine2(const char *txt);
|
---|
118 | void SetStatusLine2(const MParContainer &cont);
|
---|
119 |
|
---|
120 | void SetPrinter(const TString &lpr) { fPrinter = lpr; }
|
---|
121 |
|
---|
122 | TCanvas &AddTab(const char *name);
|
---|
123 |
|
---|
124 | TCanvas *GetCanvas(int i) const;
|
---|
125 | TCanvas *GetCanvas(const TString &name) const;
|
---|
126 |
|
---|
127 | Int_t Read(const char *name="MStatusDisplay");
|
---|
128 | Int_t Write(const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0)
|
---|
129 | {
|
---|
130 | return Write(-1, name, option, bufsize);
|
---|
131 | }
|
---|
132 | Int_t Write(Int_t num, const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0);
|
---|
133 |
|
---|
134 | Bool_t CdCanvas(const TString &name);
|
---|
135 |
|
---|
136 | void SetNoContextMenu(Bool_t flag=kTRUE);
|
---|
137 |
|
---|
138 | Int_t SaveAsPS(TString name="") { return SaveAsPS(-1, name); }
|
---|
139 | Bool_t SaveAsGIF(TString name="") { return SaveAsGIF(-1, name); }
|
---|
140 | Bool_t SaveAsC(TString name="") { return SaveAsC(-1, name); }
|
---|
141 | Int_t SaveAsRoot(TString name="") { return SaveAsRoot(-1, name); }
|
---|
142 | Int_t PrintToLpr() { return PrintToLpr(-1); }
|
---|
143 |
|
---|
144 | Int_t SaveAsPS(Int_t num, TString name="");
|
---|
145 | Bool_t SaveAsGIF(Int_t num, TString name="");
|
---|
146 | Bool_t SaveAsC(Int_t num, TString name="");
|
---|
147 | Int_t SaveAsRoot(Int_t num, TString name="");
|
---|
148 | Int_t PrintToLpr(Int_t num);
|
---|
149 |
|
---|
150 | Status_t CheckStatus() const { return fStatus; }
|
---|
151 | void ClearStatus() { fStatus = kLoopNone; }
|
---|
152 |
|
---|
153 | void Lock() { fIsLocked++; }
|
---|
154 | void UnLock() { if (fIsLocked>0) fIsLocked--; }
|
---|
155 |
|
---|
156 | Bool_t CheckTabForCanvas(int num) const;
|
---|
157 |
|
---|
158 | ClassDef(MStatusDisplay, 0) // Window for a status display
|
---|
159 | };
|
---|
160 |
|
---|
161 | #endif
|
---|
162 |
|
---|
163 |
|
---|