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

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