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

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