source: trunk/MagicSoft/Mars/mmain/MStatusDisplay.h@ 2230

Last change on this file since 2230 was 2215, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 4.5 KB
Line 
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
16class MLog;
17class MGList;
18class MParContainer;
19
20class TPad;
21class TTimer;
22class TCanvas;
23
24class TGTab;
25class TGTextView;
26class TGStatusBar;
27class TGProgressBar;
28class TGHProgressBar;
29class TRootEmbeddedCanvas;
30
31class MStatusDisplay : public TGMainFrame
32{
33public:
34 typedef enum {
35 // KFile
36 kFileBrowser, kFileCanvas, kFileSave, kFileSaveAs, kFileSaveAsPS,
37 kFileSaveAsRoot, kFileSaveAsGIF, kFileSaveAsC, kFilePrint,
38 kFilePrinterName, 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
54private:
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 Reset();
108 void RemoveTab(int i);
109
110 TRootEmbeddedCanvas *GetEmbeddedCanvas(TGCompositeFrame *cf) const;
111
112public:
113 MStatusDisplay(Long_t t=1000);
114 virtual ~MStatusDisplay();
115
116 void SetLogStream(MLog *log, Bool_t enable=kFALSE);
117
118 void StartUpdate(Int_t millisec=-1);
119 void StopUpdate();
120 void SetUpdateTime(Long_t t);
121
122 TGProgressBar *GetBar() const { return (TGProgressBar*)fBar; }
123
124 void SetStatusLine1(const char *txt);
125 void SetStatusLine2(const char *txt);
126 void SetStatusLine2(const MParContainer &cont);
127
128 void SetPrinter(const TString &lpr) { fPrinter = lpr; }
129
130 TCanvas &AddTab(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
171
172
Note: See TracBrowser for help on using the repository browser.