source: trunk/MagicSoft/Mars/mgui/MGMarsMain.cc@ 672

Last change on this file since 672 was 587, checked in by harald, 24 years ago
The integration of the class MGFadcDisp in the mars code. Now one is able to see at least the high gain samples with this gui. I hope that also Razmik is now able to look to the data.
  • Property svn:executable set to *
File size: 6.4 KB
Line 
1#include "MGMarsMain.h"
2
3#include <TApplication.h> // gROOT->GetApplication()->...
4
5#include <TGTab.h> // TGTab
6#include <TGMenu.h> // TGPopupMenu
7#include <TGMsgBox.h> // TGMsgBox
8#include <TGButton.h> // TGPictureButton
9#include <TGSplitter.h> // TGHorizontal3DLine
10
11#include "MGEventDispMain.h"
12#include "MGDataCheckMain.h"
13#include "MGMonteCarloMain.h"
14
15#include "MGPrototyp.h"
16
17ClassImp(MGMarsMain)
18
19enum CommandIdentifiers {
20 M_FILE_EXIT ,
21 M_FILE_ABOUT ,
22
23 M_PICTURE_MAGIC ,
24 M_PICTURE_MARS ,
25
26 M_BUTTON_EVTDISP ,
27 M_BUTTON_DATACHECK ,
28 M_BUTTON_ANALYSE ,
29 M_BUTTON_MONTECARLO
30} ;
31
32
33MGMarsMain::MGMarsMain(const TGWindow *p, UInt_t w, UInt_t h)
34 : TGMainFrame(p, w, h)
35{
36 // First create the MenuBar.
37
38 // Layout objects for menue.
39
40 fLayMenuBar = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2 ) ;
41 fLayMenuItem = new TGLayoutHints ( kLHintsTop | kLHintsLeft , 0, 4, 0, 0 ) ;
42
43 // crate the menu bar
44
45 fFileMenu = new TGPopupMenu ( fClient->GetRoot() ) ;
46 fFileMenu->AddEntry ("Exit", M_FILE_EXIT ) ;
47 fFileMenu->Associate(this) ;
48
49 // the button messages are handled by main frame (this)
50
51 fMenuBar = new TGMenuBar ( this, 1, 1, kHorizontalFrame ) ;
52 fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem ) ;
53 AddFrame(fMenuBar, fLayMenuBar ) ;
54
55 fLineSep = new TGHorizontal3DLine(this) ;
56 AddFrame(fLineSep, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
57
58 // set up the top part of the main window with the logos
59
60 fTop = new TGHorizontalFrame (this, 300, 100 ) ;
61
62 fPicMagic = new TGPictureButton(fTop,
63 gClient->GetPicture("magiclogo.xpm"), M_PICTURE_MAGIC );
64 fPicMagic->Associate(this) ;
65 fTop->AddFrame ( fPicMagic, new TGLayoutHints(kLHintsLeft, 10., 10., 20., 10.) ) ;
66
67 fPicMars = new TGPictureButton(fTop,
68 gClient->GetPicture("marslogo.xpm"), M_PICTURE_MARS );
69 fPicMars->Associate(this) ;
70 fTop->AddFrame ( fPicMars, new TGLayoutHints(kLHintsLeft, 10., 10., 10., 10.) ) ;
71
72 AddFrame(fTop, new TGLayoutHints(kLHintsTop | kLHintsExpandX ) );
73
74 // a seperator
75
76 fLineSep2 = new TGHorizontal3DLine(this) ;
77 AddFrame(fLineSep2, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
78
79 // the low part of the frame
80
81 fLow = new TGHorizontalFrame (this, 300, 100 ) ;
82
83 // create the first tab
84
85 fTab = new TGTab ( fLow, 400, 400 ) ;
86
87 TGCompositeFrame *tf = fTab->AddTab("Control") ;
88
89 fTabF1 = new TGVerticalFrame (tf, 300, 100) ;
90
91 tf->AddFrame(fTabF1, new TGLayoutHints(kLHintsTop | kLHintsExpandX) ) ;
92
93 // the buttons to go in the new window
94
95 fTabF2 = new TGVerticalFrame (tf, 300, 100) ;
96
97 fButLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX , 10, 10, 10, 10) ;
98
99 fButEvtDisp = new TGTextButton(fTabF2, "EventDisplay", M_BUTTON_EVTDISP );
100 fButEvtDisp->Associate(this) ;
101 fTabF2->AddFrame(fButEvtDisp, fButLayout ) ;
102
103 fButDataCheck = new TGTextButton(fTabF2, "Data Check", M_BUTTON_DATACHECK );
104 fButDataCheck->Associate(this) ;
105 fTabF2->AddFrame(fButDataCheck, fButLayout ) ;
106
107 fButAnalys = new TGTextButton(fTabF2, "Analysis", M_BUTTON_ANALYSE );
108 fButAnalys->Associate(this) ;
109 fTabF2->AddFrame(fButAnalys, fButLayout ) ;
110
111 fButMonteCarlo = new TGTextButton(fTabF2, "MonteCarlo", M_BUTTON_MONTECARLO );
112 fButMonteCarlo->Associate(this) ;
113 fTabF2->AddFrame(fButMonteCarlo, fButLayout ) ;
114
115
116
117
118 tf->AddFrame(fTabF2, new TGLayoutHints(kLHintsTop | kLHintsExpandX) ) ;
119
120
121
122 fLow->AddFrame ( fTab, new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5) );
123 AddFrame(fLow, new TGLayoutHints(kLHintsTop | kLHintsExpandX ) );
124
125 // Map the window, set up the layout, etc.
126
127 SetWMSizeHints(400, 650, 1000, 1000, 10, 10 ) ; // set the smallest and biggest size of the Main frame
128
129 MapSubwindows();
130
131 Layout();
132
133 SetWindowName("MARS Main Window");
134 SetIconName("MARS");
135
136 MapWindow();
137
138}
139
140// ======================================================================
141
142MGMarsMain::~MGMarsMain()
143{
144
145 delete fButLayout;
146 delete fLayMenuBar;
147 delete fLayMenuItem;
148 delete fButEvtDisp;
149 delete fButDataCheck;
150 delete fButAnalys;
151 delete fButMonteCarlo;
152 delete fPicMagic;
153 delete fPicMars;
154 delete fTabF1;
155 delete fTabF2;
156 delete fTab;
157 delete fLow;
158 delete fTop;
159 delete fLineSep2;
160 delete fLineSep;
161 delete fFileMenu;
162 delete fMenuBar;
163}
164// ======================================================================
165
166void MGMarsMain::CloseWindow()
167{
168 // Got close message for this MainFrame. Calls parent CloseWindow()
169 // (which destroys the window) and terminate the application.
170 // The close message is generated by the window manager when its close
171 // window menu item is selected.
172
173 TGMainFrame::CloseWindow();
174 gROOT->GetApplication()->Terminate(0) ;
175}
176
177Bool_t MGMarsMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
178{
179 // Process events generated by the buttons in the frame.
180 // printf (" process Message \n" ) ;
181
182 Int_t buttons = 4, retval = 0 ;
183
184
185 switch (GET_MSG(msg))
186 {
187 case kC_COMMAND:
188 switch (GET_SUBMSG(msg))
189 {
190 case kCM_BUTTON:
191
192 switch (parm1)
193 {
194
195 case M_BUTTON_EVTDISP:
196
197 new MGEventDispMain (fClient->GetRoot(), this, 400, 650 ) ;
198 break ;
199
200 case M_BUTTON_DATACHECK:
201 new MGDataCheckMain(fClient->GetRoot(), this, 400, 650 ) ;
202 break ;
203
204 case M_BUTTON_ANALYSE:
205 //new MGPrototyp(fClient->GetRoot(), this, 400, 650 ) ;
206
207 new TGMsgBox(fClient->GetRoot(), this,
208 "WARNING!",
209 "Analysis not yet implemented!",
210 kMBIconExclamation, buttons, &retval);
211 break ;
212
213 case M_BUTTON_MONTECARLO:
214 new MGMonteCarloMain(fClient->GetRoot(), this, 400, 650 ) ;
215
216 break ;
217
218 case M_PICTURE_MAGIC:
219 new TGMsgBox(fClient->GetRoot(), this,
220 "WARNING!",
221 "Please open a Netscape to the MAGIC homepage",
222 kMBIconExclamation, buttons, &retval);
223 break ;
224
225 case M_PICTURE_MARS:
226 new TGMsgBox(fClient->GetRoot(), this,
227 "WARNING!",
228 "Please open a Netscape to the MARS homepage",
229 kMBIconExclamation, buttons, &retval);
230 break ;
231
232
233 default:
234 break ;
235 }
236
237
238 case kCM_MENU:
239
240 switch (parm1) {
241 case M_FILE_EXIT:
242 CloseWindow() ;
243 break;
244 }
245
246
247 default:
248 break ;
249 }
250
251 default:
252 break ;
253 }
254
255 return kTRUE;
256
257}
Note: See TracBrowser for help on using the repository browser.