source: trunk/MagicSoft/Mars/mbase/MStatusDisplay.h@ 2551

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