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

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