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

Last change on this file since 2193 was 2178, 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 void AddMenuBar();
78 void AddProgressBar();
79 void AddMarsTab();
80 void AddLogTab();
81 void AddTabs();
82 void AddStatusBar();
83
84 TCanvas *GetCanvas(TGCompositeFrame *f) const;
85
86 Bool_t ProcessMessageCommandMenu(Long_t mp1);
87 Bool_t ProcessMessageCommand(Long_t submsg, Long_t mp1, Long_t mp2);
88 Bool_t ProcessMessageTextview(Long_t submsg, Long_t mp1, Long_t mp2);
89 Bool_t ProcessMessageUser(Long_t submsg, Long_t mp1, Long_t mp2);
90 Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2);
91 void CloseWindow();
92 Bool_t HandleConfigureNotify(Event_t *);
93 Bool_t HandleEvent(Event_t *event);
94
95 Bool_t HandleTimer(TTimer *timer=NULL);
96 void UpdateTab(TGCompositeFrame *f);
97
98 void DrawClonePad(TCanvas &newc, const TCanvas &oldc) const;
99 void CanvasSetFillColor(TPad &c, Int_t col) const;
100
101 void AddExtension(TString &name, const TString &ext, Int_t num) const;
102
103 void UpdatePSHeader(const TString &name) const;
104
105 void Reset();
106 void RemoveTab(int i);
107
108 TRootEmbeddedCanvas *GetEmbeddedCanvas(TGCompositeFrame *cf) const;
109
110public:
111 MStatusDisplay(Long_t t=1000);
112 virtual ~MStatusDisplay();
113
114 void SetLogStream(MLog *log, Bool_t enable=kFALSE);
115
116 void StartUpdate(Int_t millisec=-1);
117 void StopUpdate();
118 void SetUpdateTime(Long_t t);
119
120 TGProgressBar *GetBar() const { return (TGProgressBar*)fBar; }
121
122 void SetStatusLine1(const char *txt);
123 void SetStatusLine2(const char *txt);
124 void SetStatusLine2(const MParContainer &cont);
125
126 void SetPrinter(const TString &lpr) { fPrinter = lpr; }
127
128 TCanvas &AddTab(const char *name);
129
130 Bool_t HasCanvas(const TCanvas *c) const;
131 TCanvas *GetCanvas(int i) const;
132 TCanvas *GetCanvas(const TString &name) const;
133
134 Int_t Read(const char *name="MStatusDisplay");
135 Int_t Write(const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0)
136 {
137 return Write(-1, name, option, bufsize);
138 }
139 Int_t Write(Int_t num, const char *name="MStatusDisplay", Int_t option=0, Int_t bufsize=0);
140
141 Bool_t CdCanvas(const TString &name);
142
143 void SetNoContextMenu(Bool_t flag=kTRUE);
144
145 Int_t SaveAsPS(TString name="") { return SaveAsPS(-1, name); }
146 Bool_t SaveAsGIF(TString name="") { return SaveAsGIF(-1, name); }
147 Bool_t SaveAsC(TString name="") { return SaveAsC(-1, name); }
148 Int_t SaveAsRoot(TString name="") { return SaveAsRoot(-1, name); }
149 Int_t PrintToLpr() { return PrintToLpr(-1); }
150
151 Int_t SaveAsPS(Int_t num, TString name="");
152 Bool_t SaveAsGIF(Int_t num, TString name="");
153 Bool_t SaveAsC(Int_t num, TString name="");
154 Int_t SaveAsRoot(Int_t num, TString name="");
155 Int_t PrintToLpr(Int_t num);
156
157 Status_t CheckStatus() const { return fStatus; }
158 void ClearStatus() { fStatus = kLoopNone; }
159
160 void Lock() { fIsLocked++; }
161 void UnLock() { if (fIsLocked>0) fIsLocked--; }
162
163 Bool_t CheckTabForCanvas(int num) const;
164
165 ClassDef(MStatusDisplay, 0) // Window for a status display
166};
167
168#endif
169
170
Note: See TracBrowser for help on using the repository browser.