1 | #include "MGCosy.h"
|
---|
2 |
|
---|
3 | #include <iostream.h>
|
---|
4 |
|
---|
5 | #include "msgqueue.h"
|
---|
6 | #include "coord.h"
|
---|
7 |
|
---|
8 | #include <TROOT.h>
|
---|
9 |
|
---|
10 | #include <TGTab.h> // TGTab
|
---|
11 | #include <TGMenu.h> // TGPopupMenu
|
---|
12 | #include <TGButton.h> // TGButton
|
---|
13 | #include <TSystem.h> // gSystem
|
---|
14 | #include <TGLabel.h> // TGLabel
|
---|
15 | #include <TGListBox.h> // TGListBox
|
---|
16 | #include <TG3DLine.h> // TGHorizontal3DLine (TGSplitter)
|
---|
17 | #include <TGTextEntry.h> // TGTextEntry
|
---|
18 | #include <TGFrame.h> // TGGroupFrame
|
---|
19 | #include <TApplication.h> // gApplication
|
---|
20 |
|
---|
21 | //#include "timer.h" // Timer
|
---|
22 |
|
---|
23 | #include "MCosy.h"
|
---|
24 | #include "MGList.h"
|
---|
25 | #include "MGAccuracy.h"
|
---|
26 | #include "MGCoordinates.h"
|
---|
27 | #include "MGSkyPosition.h"
|
---|
28 | #include "MGVelocity.h"
|
---|
29 |
|
---|
30 | #include "SlaStars.h"
|
---|
31 |
|
---|
32 | #undef DEBUG
|
---|
33 |
|
---|
34 | ClassImp(MGCosy);
|
---|
35 |
|
---|
36 | #define IDM_EXIT 1
|
---|
37 | #define IDM_TEXT 2
|
---|
38 | #define IDM_ASPECT 3
|
---|
39 |
|
---|
40 | enum
|
---|
41 | {
|
---|
42 | kPB_POSITION,
|
---|
43 | kPB_TRACK,
|
---|
44 | kPB_STOP,
|
---|
45 | kPB_CALCALTAZ,
|
---|
46 | kPB_TPOINT,
|
---|
47 | kPB_START,
|
---|
48 | kPB_RAp,
|
---|
49 | kPB_RAm,
|
---|
50 | kPB_DECp,
|
---|
51 | kPB_DECm,
|
---|
52 | kPB_LoadBending,
|
---|
53 | kPB_CALIBSE
|
---|
54 | };
|
---|
55 |
|
---|
56 | void MGCosy::CreateMenu()
|
---|
57 | {
|
---|
58 | fLayMenuBar = new TGLayoutHints (kLHintsNormal | kLHintsExpandX);
|
---|
59 | fLayMenuItem = new TGLayoutHints (kLHintsNormal, 0, 4, 0, 0);
|
---|
60 |
|
---|
61 | //
|
---|
62 | // crate the menu bar
|
---|
63 | //
|
---|
64 | TGPopupMenu *fFileMenu = new TGPopupMenu(gClient->GetRoot());
|
---|
65 | fFileMenu->AddEntry("Set Aspect", IDM_ASPECT);
|
---|
66 | fFileMenu->AddEntry("Exit", IDM_EXIT);
|
---|
67 | fFileMenu->Associate(this);
|
---|
68 | fList->Add(fFileMenu);
|
---|
69 |
|
---|
70 | //
|
---|
71 | // the button messages are handled by main frame (this)
|
---|
72 | //
|
---|
73 | TGMenuBar *fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
|
---|
74 | fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem);
|
---|
75 | AddFrame(fMenuBar, fLayMenuBar);
|
---|
76 | fList->Add(fMenuBar);
|
---|
77 |
|
---|
78 | //
|
---|
79 | // Seperator beyond menubar
|
---|
80 | //
|
---|
81 |
|
---|
82 | TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this);
|
---|
83 | AddFrame(fLineSep, fLayMenuBar);
|
---|
84 | fList->Add(fLineSep);
|
---|
85 | }
|
---|
86 |
|
---|
87 | void MGCosy::CreateLabel(TGCompositeFrame *f)
|
---|
88 | {
|
---|
89 | const int x = 180;
|
---|
90 | const int y = 25;
|
---|
91 |
|
---|
92 | TGLabel *l;
|
---|
93 |
|
---|
94 | l = new TGLabel(f, "UTC:");
|
---|
95 | l->Move(x-60, y);
|
---|
96 | fList->Add(l);
|
---|
97 |
|
---|
98 | l = new TGLabel(f, "Mjd:");
|
---|
99 | l->Move(x-60, y+20);
|
---|
100 | fList->Add(l);
|
---|
101 |
|
---|
102 | fUtc = new TGLabel(f, "0000/00/00 00:00:00.0");
|
---|
103 | fMjd = new TGLabel(f, "00000.000000");
|
---|
104 | fUtc->Move(x-25, y);
|
---|
105 | fMjd->Move(x-25, y+20);
|
---|
106 | fList->Add(fUtc);
|
---|
107 | fList->Add(fMjd);
|
---|
108 |
|
---|
109 | l = new TGLabel(f, "SE-Az:");
|
---|
110 | l->Move(x-60, y+60);
|
---|
111 | fList->Add(l);
|
---|
112 |
|
---|
113 | l = new TGLabel(f, "SE-Zd1:");
|
---|
114 | l->Move(x-60, y+80);
|
---|
115 | fList->Add(l);
|
---|
116 |
|
---|
117 | l = new TGLabel(f, "SE-Zd2:");
|
---|
118 | l->Move(x-60, y+100);
|
---|
119 | fList->Add(l);
|
---|
120 |
|
---|
121 | fLabel1 = new TGLabel*[3];
|
---|
122 | fLabel1[0] = new TGLabel(f, "00000"); // Max: 16384
|
---|
123 | fLabel1[1] = new TGLabel(f, "000"); // Max: 256
|
---|
124 | fLabel1[2] = new TGLabel(f, "000"); // Max: 256
|
---|
125 | fLabel1[0]->SetTextJustify(kTextRight);
|
---|
126 | fLabel1[1]->SetTextJustify(kTextRight);
|
---|
127 | fLabel1[2]->SetTextJustify(kTextRight);
|
---|
128 | fLabel1[0]->Move(x, y+60);
|
---|
129 | fLabel1[1]->Move(x+43, y+60);
|
---|
130 | fLabel1[2]->Move(x+70, y+60);
|
---|
131 | fList->Add(fLabel1[0]);
|
---|
132 | fList->Add(fLabel1[1]);
|
---|
133 | fList->Add(fLabel1[2]);
|
---|
134 | //f->AddFrame(fLabel1[0]);
|
---|
135 | //f->AddFrame(fLabel1[1]);
|
---|
136 | //f->AddFrame(fLabel1[2]);
|
---|
137 |
|
---|
138 | fLabel2 = new TGLabel*[3];
|
---|
139 | fLabel2[0] = new TGLabel(f, "00000");
|
---|
140 | fLabel2[1] = new TGLabel(f, "000");
|
---|
141 | fLabel2[2] = new TGLabel(f, "000");
|
---|
142 | fLabel2[0]->SetTextJustify(kTextRight);
|
---|
143 | fLabel2[1]->SetTextJustify(kTextRight);
|
---|
144 | fLabel2[2]->SetTextJustify(kTextRight);
|
---|
145 | fLabel2[0]->Move(x, y+80);
|
---|
146 | fLabel2[1]->Move(x+43, y+80);
|
---|
147 | fLabel2[2]->Move(x+70, y+80);
|
---|
148 | fList->Add(fLabel2[0]);
|
---|
149 | fList->Add(fLabel2[1]);
|
---|
150 | fList->Add(fLabel2[2]);
|
---|
151 | //f->AddFrame(fLabel2[0]);
|
---|
152 | //f->AddFrame(fLabel2[1]);
|
---|
153 | //f->AddFrame(fLabel2[2]);
|
---|
154 |
|
---|
155 | fLabel3 = new TGLabel*[3];
|
---|
156 | fLabel3[0] = new TGLabel(f, "00000");
|
---|
157 | fLabel3[1] = new TGLabel(f, "000");
|
---|
158 | fLabel3[2] = new TGLabel(f, "000");
|
---|
159 | fLabel3[0]->SetTextJustify(kTextRight);
|
---|
160 | fLabel3[1]->SetTextJustify(kTextRight);
|
---|
161 | fLabel3[2]->SetTextJustify(kTextRight);
|
---|
162 | fLabel3[0]->Move(x, y+100);
|
---|
163 | fLabel3[1]->Move(x+43, y+100);
|
---|
164 | fLabel3[2]->Move(x+70, y+100);
|
---|
165 | fList->Add(fLabel3[0]);
|
---|
166 | fList->Add(fLabel3[1]);
|
---|
167 | fList->Add(fLabel3[2]);
|
---|
168 | //f->AddFrame(fLabel3[0]);
|
---|
169 | //f->AddFrame(fLabel3[1]);
|
---|
170 | //f->AddFrame(fLabel3[2]);
|
---|
171 |
|
---|
172 | l = new TGLabel(f, "Offset-Zd:");
|
---|
173 | l->Move(x-60, y+140);
|
---|
174 | fList->Add(l);
|
---|
175 |
|
---|
176 | l = new TGLabel(f, "Offset-Az:");
|
---|
177 | l->Move(x-60, y+160);
|
---|
178 | fList->Add(l);
|
---|
179 |
|
---|
180 | fOffsetZd = new TGLabel(f, "0000000");
|
---|
181 | fOffsetAz = new TGLabel(f, "0000000");
|
---|
182 | fOffsetZd->SetTextJustify(kTextRight);
|
---|
183 | fOffsetAz->SetTextJustify(kTextRight);
|
---|
184 | fOffsetZd->Move(x, y+140);
|
---|
185 | fOffsetAz->Move(x, y+160);
|
---|
186 | fList->Add(fOffsetZd);
|
---|
187 | fList->Add(fOffsetAz);
|
---|
188 |
|
---|
189 |
|
---|
190 | fError = new TGLabel(f, "Error");
|
---|
191 | fMoving = new TGLabel(f, "Moving");
|
---|
192 | fTracking = new TGLabel(f, "Tracking");
|
---|
193 | fStopping = new TGLabel(f, "Stopping");
|
---|
194 | fStopped = new TGLabel(f, "Stopped");
|
---|
195 |
|
---|
196 |
|
---|
197 | ULong_t color;
|
---|
198 |
|
---|
199 | gClient->GetColorByName("Red", color);
|
---|
200 | fError->SetBackgroundColor(color);
|
---|
201 | gClient->GetColorByName("LightBlue", color);
|
---|
202 | fMoving->SetBackgroundColor(color);
|
---|
203 | gClient->GetColorByName("Blue", color);
|
---|
204 | fTracking->SetBackgroundColor(color);
|
---|
205 | gClient->GetColorByName("Orange", color);
|
---|
206 | fStopping->SetBackgroundColor(color);
|
---|
207 | gClient->GetColorByName("Green", color);
|
---|
208 | fStopped->SetBackgroundColor(color);
|
---|
209 |
|
---|
210 | fError ->Move(10, 25);
|
---|
211 | fMoving ->Move(10, 25+20);
|
---|
212 | fTracking->Move(10, 25+40);
|
---|
213 | fStopping->Move(10, 25+60);
|
---|
214 | fStopped ->Move(10, 25+80);
|
---|
215 |
|
---|
216 | fError ->Resize(60, 20);
|
---|
217 | fMoving ->Resize(60, 20);
|
---|
218 | fTracking->Resize(60, 20);
|
---|
219 | fStopping->Resize(60, 20);
|
---|
220 | fStopped ->Resize(60, 20);
|
---|
221 |
|
---|
222 | fList->Add(fError);
|
---|
223 | fList->Add(fMoving);
|
---|
224 | fList->Add(fTracking);
|
---|
225 | fList->Add(fStopping);
|
---|
226 | fList->Add(fStopped);
|
---|
227 | }
|
---|
228 |
|
---|
229 | void MGCosy::CreateTabs(TGTab *fTab)
|
---|
230 | {
|
---|
231 | TGCompositeFrame *tf1 = fTab->AddTab("Position");
|
---|
232 | TGCompositeFrame *tf2 = fTab->AddTab("Track");
|
---|
233 | TGCompositeFrame *tf4 = fTab->AddTab("Calibration");
|
---|
234 | TGCompositeFrame *tf3 = fTab->AddTab("Demo");
|
---|
235 |
|
---|
236 | fCZdAz = new MGCoordinates(tf1, kETypeZdAz);
|
---|
237 | fCZdAz->Move(27, 105);
|
---|
238 | fList->Add(fCZdAz);
|
---|
239 |
|
---|
240 | fCRaDec = new MGCoordinates(tf2, kETypeRaDec);
|
---|
241 | fCRaDec->Move(27, 105);
|
---|
242 | fList->Add(fCRaDec);
|
---|
243 |
|
---|
244 | fCCalib = new MGCoordinates(tf4, kETypeRaDec);
|
---|
245 | fCCalib->Move(27, 105);
|
---|
246 | fList->Add(fCCalib);
|
---|
247 |
|
---|
248 | const int x=15;
|
---|
249 | const int y=12;
|
---|
250 | const int h=16;
|
---|
251 |
|
---|
252 | TGLabel *l1 = new TGLabel(tf1, "Move the telescope to a position given in");
|
---|
253 | TGLabel *l2 = new TGLabel(tf1, "local coordinates. The given coordinates");
|
---|
254 | TGLabel *l3 = new TGLabel(tf1, "are pointing coordinates, which means that the");
|
---|
255 | TGLabel *l4 = new TGLabel(tf1, "coordinates are corrected for the bending of");
|
---|
256 | TGLabel *l5 = new TGLabel(tf1, "the telescope.");
|
---|
257 | l1->Move(x, y);
|
---|
258 | l2->Move(x, y+h);
|
---|
259 | l3->Move(x, y+2*h);
|
---|
260 | l4->Move(x, y+3*h);
|
---|
261 | l5->Move(x, y+4*h);
|
---|
262 | fList->Add(l1);
|
---|
263 | fList->Add(l2);
|
---|
264 | fList->Add(l3);
|
---|
265 | fList->Add(l4);
|
---|
266 | fList->Add(l5);
|
---|
267 |
|
---|
268 | l1 = new TGLabel(tf2, "Track a position given in sky coordinates.");
|
---|
269 | l2 = new TGLabel(tf2, "Right Ascension and declination must be given");
|
---|
270 | l3 = new TGLabel(tf2, "in the FK5, J2000 coordinate system.");
|
---|
271 | l1->Move(x, y);
|
---|
272 | l2->Move(x, y+h);
|
---|
273 | l3->Move(x, y+2*h);
|
---|
274 | fList->Add(l1);
|
---|
275 | fList->Add(l2);
|
---|
276 | fList->Add(l3);
|
---|
277 |
|
---|
278 | l1 = new TGLabel(tf4, "Start the calibration using the Start button.");
|
---|
279 | l2 = new TGLabel(tf4, "Write a coordinate pair to a TPoint file using");
|
---|
280 | l3 = new TGLabel(tf4, "the TPoint button. To set the Shaftencoder offset");
|
---|
281 | l4 = new TGLabel(tf4, "use the Calib SE button.");
|
---|
282 | l1->Move(x, y);
|
---|
283 | l2->Move(x, y+h);
|
---|
284 | l3->Move(x, y+2*h);
|
---|
285 | l4->Move(x, y+3*h);
|
---|
286 | fList->Add(l1);
|
---|
287 | fList->Add(l2);
|
---|
288 | fList->Add(l3);
|
---|
289 | fList->Add(l4);
|
---|
290 |
|
---|
291 | //
|
---|
292 | // light green: 3 light red: 2 blue?: 2
|
---|
293 | // dark green: 8 dark red: 50 dark blue?: 1
|
---|
294 |
|
---|
295 | //
|
---|
296 | // blue: 0-7, 9, 10,11, 14, 15, 18, 19, 22, 23, 27, 31, 33-39, 41-43
|
---|
297 | // 46, 47
|
---|
298 | // green: 8, 12,13, 16, 17, 20, 21, 24, 25, 26, 28, 29, 30, 40, 44
|
---|
299 | // 45, 48
|
---|
300 | // gray: 31, 113-
|
---|
301 | // red: 164, 192, 224, 232
|
---|
302 | //
|
---|
303 | TGTextButton *but;
|
---|
304 |
|
---|
305 | but= new TGTextButton(tf2, "Ra -", kPB_RAm);
|
---|
306 | but->Resize(50, 25);
|
---|
307 | but->Move(25, 210);
|
---|
308 | but->SetToolTipText("Right ascension -= 1'");
|
---|
309 | but->Associate(this);
|
---|
310 | fList->Add(but);
|
---|
311 | but= new TGTextButton(tf2, "RA +", kPB_RAp);
|
---|
312 | but->Resize(50, 25);
|
---|
313 | but->Move(90, 210);
|
---|
314 | but->SetToolTipText("Right ascension += 1'");
|
---|
315 | but->Associate(this);
|
---|
316 | fList->Add(but);
|
---|
317 | but= new TGTextButton(tf2, "DEC +", kPB_DECp);
|
---|
318 | but->Resize(50, 25);
|
---|
319 | but->Move(55, 185);
|
---|
320 | but->SetToolTipText("Declination += 1'");
|
---|
321 | but->Associate(this);
|
---|
322 | fList->Add(but);
|
---|
323 | but= new TGTextButton(tf2, "DEC -", kPB_DECm);
|
---|
324 | but->Resize(50, 25);
|
---|
325 | but->Move(55, 235);
|
---|
326 | but->SetToolTipText("Declination -= 1'");
|
---|
327 | but->Associate(this);
|
---|
328 | fList->Add(but);
|
---|
329 |
|
---|
330 | but= new TGTextButton(tf2, "Calc Zd/Az", kPB_CALCALTAZ);
|
---|
331 | but->Resize(80, 25);
|
---|
332 | but->Move(165, 197);
|
---|
333 | but->SetToolTipText("Calculate Zd/Az corresponding to Ra/Dec.");
|
---|
334 | but->Associate(this);
|
---|
335 | fList->Add(but);
|
---|
336 |
|
---|
337 | but = new TGTextButton(tf4, "TPoint", kPB_TPOINT);
|
---|
338 | but->Resize(80, 25);
|
---|
339 | but->Move(25, 197);
|
---|
340 | but->SetToolTipText("Trigger writing a tpoint coordinate pair.");
|
---|
341 | but->Associate(this);
|
---|
342 | fList->Add(but);
|
---|
343 |
|
---|
344 | but = new TGTextButton(tf4, "Calib SE", kPB_CALIBSE);
|
---|
345 | but->Resize(80, 25);
|
---|
346 | but->Move(160, 197);
|
---|
347 | but->SetToolTipText("Set SE to given coordinates.");
|
---|
348 | but->Associate(this);
|
---|
349 | fList->Add(but);
|
---|
350 |
|
---|
351 | but = new TGTextButton(tf4, "Load", kPB_LoadBending);
|
---|
352 | but->Resize(80, 25);
|
---|
353 | but->Move(25, 227);
|
---|
354 | but->SetToolTipText("Load bending corrections from file 'bending.txt'");
|
---|
355 | but->Associate(this);
|
---|
356 | fList->Add(but);
|
---|
357 |
|
---|
358 | ULong_t color;
|
---|
359 |
|
---|
360 | but = new TGTextButton(this, "Start", kPB_START);
|
---|
361 | gClient->GetColorByName("Green", color);
|
---|
362 | but->SetBackgroundColor(color);
|
---|
363 | but->Move(147, 295);
|
---|
364 | but->Resize(62, 25);
|
---|
365 | but->SetToolTipText("Start a telescope movement.");
|
---|
366 | fList->Add(but);
|
---|
367 |
|
---|
368 | but = new TGTextButton(this, "Stop", kPB_STOP);
|
---|
369 |
|
---|
370 | gClient->GetColorByName("Red", color);
|
---|
371 | but->SetBackgroundColor(color);
|
---|
372 | but->Move(212, 295);
|
---|
373 | but->Resize(62, 25);
|
---|
374 | but->SetToolTipText("Stop any movement of telescope.");
|
---|
375 | fList->Add(but);
|
---|
376 |
|
---|
377 | /*
|
---|
378 | const Double_t ca = 0; // Left-Right Collimation Error
|
---|
379 | const Double_t an = 0; // Azimuth Axis Misalignment (N-S)
|
---|
380 | const Double_t aw = 0; // Azimuth Axis Misalignment (E-W)
|
---|
381 | const Double_t npae = 0; // Az-El Nonperpendicularity
|
---|
382 | const Double_t nrx = 0; // Nasmyth rotator displacement, horizontan
|
---|
383 | const Double_t nry = 0; // Nasmyth rotator displacement, vertical
|
---|
384 | const Double_t crx = 0; // Alt/Az Coude Displacement (N-S)
|
---|
385 | const Double_t cry = 0; // Alt/Az Coude Displacement (E-W)
|
---|
386 | l1 = new TGLabel(tf5, "CA");
|
---|
387 | l1->SetTextJustify(kTextLeft);
|
---|
388 | l1->Move(x, y+2*h*1.5);
|
---|
389 | l1->MapWindow();
|
---|
390 | fList->Add(l1);
|
---|
391 | l1 = new TGLabel(tf5, "AN");
|
---|
392 | l1->SetTextJustify(kTextLeft);
|
---|
393 | l1->Move(x, y+3*h*1.5);
|
---|
394 | l1->MapWindow();
|
---|
395 | fList->Add(l1);
|
---|
396 | l1 = new TGLabel(tf5, "AW");
|
---|
397 | l1->SetTextJustify(kTextLeft);
|
---|
398 | l1->Move(x, y+4*h*1.5);
|
---|
399 | l1->MapWindow();
|
---|
400 | fList->Add(l1);
|
---|
401 | l1 = new TGLabel(tf5, "NPAE");
|
---|
402 | l1->SetTextJustify(kTextLeft);
|
---|
403 | l1->Move(x, y+5*h*1.5);
|
---|
404 | l1->MapWindow();
|
---|
405 | fList->Add(l1);
|
---|
406 | l1 = new TGLabel(tf5, "NRX");
|
---|
407 | l1->SetTextJustify(kTextLeft);
|
---|
408 | l1->Move(x, y+6*h*1.5);
|
---|
409 | l1->MapWindow();
|
---|
410 | fList->Add(l1);
|
---|
411 | l1 = new TGLabel(tf5, "NRY");
|
---|
412 | l1->SetTextJustify(kTextLeft);
|
---|
413 | l1->Move(x, y+7*h*1.5);
|
---|
414 | l1->MapWindow();
|
---|
415 | fList->Add(l1);
|
---|
416 | l1 = new TGLabel(tf5, "CRX");
|
---|
417 | l1->SetTextJustify(kTextLeft);
|
---|
418 | l1->Move(x, y+8*h*1.5);
|
---|
419 | l1->MapWindow();
|
---|
420 | fList->Add(l1);
|
---|
421 | l1 = new TGLabel(tf5, "CRY");
|
---|
422 | l1->SetTextJustify(kTextLeft);
|
---|
423 | l1->Move(x, y+9*h*1.5);
|
---|
424 | l1->MapWindow();
|
---|
425 | fList->Add(l1);
|
---|
426 | const Double_t ie = 0; // Index Error in Elevation
|
---|
427 | const Double_t ia = 0; // Index Error in Azimuth
|
---|
428 | const Double_t eces = 0; // Elevation Centering Error (sin)
|
---|
429 | const Double_t ecec = 0; // Elevation Centering Error (cos)
|
---|
430 | const Double_t aces = 0; // Azimuth Centering Error (sin)
|
---|
431 | const Double_t acec = 0; // Azimuth Centering Error (cos)
|
---|
432 | l1 = new TGLabel(tf5, "IE");
|
---|
433 | l1->SetTextJustify(kTextLeft);
|
---|
434 | l1->Move(x+150, y+3*h*1.5);
|
---|
435 | l1->MapWindow();
|
---|
436 | fList->Add(l1);
|
---|
437 | l1 = new TGLabel(tf5, "IA");
|
---|
438 | l1->SetTextJustify(kTextLeft);
|
---|
439 | l1->Move(x+150, y+4*h*1.5);
|
---|
440 | l1->MapWindow();
|
---|
441 | fList->Add(l1);
|
---|
442 | l1 = new TGLabel(tf5, "ECES");
|
---|
443 | l1->SetTextJustify(kTextLeft);
|
---|
444 | l1->Move(x+150, y+5*h*1.5);
|
---|
445 | l1->MapWindow();
|
---|
446 | fList->Add(l1);
|
---|
447 | l1 = new TGLabel(tf5, "ECEC");
|
---|
448 | l1->SetTextJustify(kTextLeft);
|
---|
449 | l1->Move(x+150, y+6*h*1.5);
|
---|
450 | l1->MapWindow();
|
---|
451 | fList->Add(l1);
|
---|
452 | l1 = new TGLabel(tf5, "ACES");
|
---|
453 | l1->SetTextJustify(kTextLeft);
|
---|
454 | l1->Move(x+150, y+4*h*1.5);
|
---|
455 | l1->MapWindow();
|
---|
456 | fList->Add(l1);
|
---|
457 | l1 = new TGLabel(tf5, "IA");
|
---|
458 | l1->SetTextJustify(kTextLeft);
|
---|
459 | l1->Move(x+150, y+4*h*1.5);
|
---|
460 | l1->MapWindow();
|
---|
461 | fList->Add(l1);
|
---|
462 |
|
---|
463 |
|
---|
464 | TGTextEntry *entry = new TGTextEntry(tf5, "****", kEF_BendIE);
|
---|
465 | entry->Associate(this);
|
---|
466 | entry->Move(x+50, y+2*h*1.5);
|
---|
467 | entry->MapWindow();
|
---|
468 | fList->Add(entry);
|
---|
469 |
|
---|
470 | entry = new TGTextEntry(tf5, "*****", kEF_BendIA);
|
---|
471 | entry->Associate(this);
|
---|
472 | entry->Move(x+50, y+3*h*1.5);
|
---|
473 | entry->MapWindow();
|
---|
474 | fList->Add(entry);
|
---|
475 | */
|
---|
476 | }
|
---|
477 |
|
---|
478 | MGCosy::MGCosy(MsgQueue *q, const TGWindow *p, UInt_t w, UInt_t h)
|
---|
479 | : TGMainFrame(p, w, h), fQueue(q)
|
---|
480 | {
|
---|
481 | fList = new MGList;
|
---|
482 |
|
---|
483 | #ifdef DEBUG
|
---|
484 | cout << "MGCosy: Creating Menu" << endl;
|
---|
485 | #endif
|
---|
486 | CreateMenu();
|
---|
487 |
|
---|
488 | #ifdef DEBUG
|
---|
489 | cout << "MGCosy: Creating TGCompositeFrame" << endl;
|
---|
490 | #endif
|
---|
491 | TGHorizontalFrame *f1 = new TGHorizontalFrame(this, 0, 0);
|
---|
492 | TGHorizontalFrame *f2 = new TGHorizontalFrame(this, 0, 0);
|
---|
493 | fList->Add(f1);
|
---|
494 | fList->Add(f2);
|
---|
495 |
|
---|
496 | #ifdef DEBUG
|
---|
497 | cout << "MGCosy: Creating TGTab" << endl;
|
---|
498 | #endif
|
---|
499 | fTab = new TGTab(f1, 300, 300);
|
---|
500 | fList->Add(fTab);
|
---|
501 |
|
---|
502 | #ifdef DEBUG
|
---|
503 | cout << "MGCosy: Creating MGSkyPosition" << endl;
|
---|
504 | #endif
|
---|
505 | fSkyPosition = new MGSkyPosition(f1, 300);
|
---|
506 | #ifdef DEBUG
|
---|
507 | cout << "MGCosy: Creating MGAccuracy" << endl;
|
---|
508 | #endif
|
---|
509 | fAccuracy = new MGAccuracy (f1, 300);
|
---|
510 | #ifdef DEBUG
|
---|
511 | cout << "MGCosy: Creating MGVelocity" << endl;
|
---|
512 | #endif
|
---|
513 | fVelocity = new MGVelocity (f2, "Velocity [\"/min]", 300);
|
---|
514 | // fOffset = new MGVelocity (f, "Offset se-re [']", 300);
|
---|
515 |
|
---|
516 | fList->Add(fSkyPosition);
|
---|
517 | fList->Add(fAccuracy);
|
---|
518 | fList->Add(fVelocity);
|
---|
519 | // fList->Add(fOffset);
|
---|
520 |
|
---|
521 | #ifdef DEBUG
|
---|
522 | cout << "MGCosy: Creating TGGroupFrame" << endl;
|
---|
523 | #endif
|
---|
524 | TGGroupFrame *frame = new TGGroupFrame(f2, "Status");
|
---|
525 | frame->Resize(300, 300);
|
---|
526 | fList->Add(frame);
|
---|
527 |
|
---|
528 | #ifdef DEBUG
|
---|
529 | cout << "MGCosy: Creating TGListBox" << endl;
|
---|
530 | #endif
|
---|
531 | fLog = new TGListBox(f2, -1, kSunkenFrame); //kSunkenFrame|kDoubleBorder,
|
---|
532 | fLog->Resize(300, 300);
|
---|
533 | fLog->ChangeBackground(TGFrame::GetBlackPixel());
|
---|
534 | fList->Add(fLog);
|
---|
535 |
|
---|
536 | TGLayoutHints *hints1 = new TGLayoutHints(kLHintsNormal | kLHintsExpandX|kLHintsExpandY, 6, 6, 6, 3);
|
---|
537 | TGLayoutHints *hints2 = new TGLayoutHints(kLHintsNormal | kLHintsExpandX|kLHintsExpandY, 6, 6, 3, 6);
|
---|
538 | TGLayoutHints *hints1a = new TGLayoutHints(kLHintsLeft | kLHintsTop |kLHintsExpandX|kLHintsExpandY);
|
---|
539 | TGLayoutHints *hints2a = new TGLayoutHints(kLHintsCenterY | kLHintsTop |kLHintsExpandX|kLHintsExpandY, 6, 6);
|
---|
540 | TGLayoutHints *hints3a = new TGLayoutHints(kLHintsRight | kLHintsTop |kLHintsExpandX|kLHintsExpandY);
|
---|
541 | TGLayoutHints *hints1b = new TGLayoutHints(kLHintsLeft | kLHintsBottom|kLHintsExpandX|kLHintsExpandY);
|
---|
542 | TGLayoutHints *hints2b = new TGLayoutHints(kLHintsCenterY | kLHintsBottom|kLHintsExpandX|kLHintsExpandY, 6, 6);
|
---|
543 | TGLayoutHints *hints3b = new TGLayoutHints(kLHintsRight | kLHintsBottom|kLHintsExpandX|kLHintsExpandY);
|
---|
544 |
|
---|
545 | fList->Add(hints1);
|
---|
546 | fList->Add(hints2);
|
---|
547 | fList->Add(hints1a);
|
---|
548 | fList->Add(hints2a);
|
---|
549 | fList->Add(hints3a);
|
---|
550 | fList->Add(hints1b);
|
---|
551 | fList->Add(hints2b);
|
---|
552 | fList->Add(hints3b);
|
---|
553 |
|
---|
554 | // Layout upper frame
|
---|
555 | f1->AddFrame(fTab, hints1a);
|
---|
556 | f1->AddFrame(fSkyPosition, hints2a);
|
---|
557 | f1->AddFrame(fAccuracy, hints3a);
|
---|
558 |
|
---|
559 | // Layout upper frame
|
---|
560 | f2->AddFrame(frame, hints1b);
|
---|
561 | f2->AddFrame(fVelocity, hints2b);
|
---|
562 | f2->AddFrame(fLog, hints3b);
|
---|
563 |
|
---|
564 | // Layout window
|
---|
565 | AddFrame(f1, hints1);
|
---|
566 | AddFrame(f2, hints2);
|
---|
567 |
|
---|
568 | //
|
---|
569 | // FIXME!
|
---|
570 | //
|
---|
571 | #ifdef DEBUG
|
---|
572 | cout << "MGCosy: Creating Tabs" << endl;
|
---|
573 | #endif
|
---|
574 | CreateTabs(fTab);
|
---|
575 | #ifdef DEBUG
|
---|
576 | cout << "MGCosy: Creating Label" << endl;
|
---|
577 | #endif
|
---|
578 | CreateLabel(frame);
|
---|
579 |
|
---|
580 | //
|
---|
581 | // Map the window, set up the layout, etc.
|
---|
582 | //
|
---|
583 | #ifdef DEBUG
|
---|
584 | cout << "MGCosy: Setting Size" << endl;
|
---|
585 | #endif
|
---|
586 | const Int_t w = 940;
|
---|
587 | const Int_t h = 660;
|
---|
588 | SetWMSizeHints(w, h, 1280, 900, 10, 10); // set the smallest and biggest size of the Main frame
|
---|
589 |
|
---|
590 | SetWindowName("Cosy Main Window");
|
---|
591 | SetIconName("Cosy");
|
---|
592 |
|
---|
593 | #ifdef DEBUG
|
---|
594 | cout << "MGCosy: Map Window" << endl;
|
---|
595 | #endif
|
---|
596 | MapSubwindows();
|
---|
597 | Resize(w, h); //GetDefaultSize());
|
---|
598 | MapWindow();
|
---|
599 | }
|
---|
600 |
|
---|
601 | // ======================================================================
|
---|
602 |
|
---|
603 | MGCosy::~MGCosy()
|
---|
604 | {
|
---|
605 | cout << "MGCosy::~MGCosy called." << endl;
|
---|
606 |
|
---|
607 | delete fLayMenuBar;
|
---|
608 | delete fLayMenuItem;
|
---|
609 |
|
---|
610 | cout << "Deleting MGCosy::fList" << endl;
|
---|
611 |
|
---|
612 | delete fList;
|
---|
613 |
|
---|
614 | cout << "MGCosy::~MGCosy done." << endl;
|
---|
615 | }
|
---|
616 | // ======================================================================
|
---|
617 | void MGCosy::EnableLabel(TGLabel *label, Bool_t stat)
|
---|
618 | {
|
---|
619 | stat ? label->MapWindow() : label->UnmapWindow();
|
---|
620 |
|
---|
621 | /*
|
---|
622 | TGGC *fRedTextGC(TGButton::GetDefaultGC())
|
---|
623 | // Set foreground color in graphics context for drawing of
|
---|
624 | // TGlabel and TGButtons with text in red.
|
---|
625 | ULong_t red;
|
---|
626 | gClient->GetColorByName("red", red);
|
---|
627 | fRedTextGC.SetForeground(red);
|
---|
628 | */
|
---|
629 | }
|
---|
630 |
|
---|
631 | void MGCosy::UpdateOffset(ZdAz &off)
|
---|
632 | {
|
---|
633 | static Int_t zd=~0;
|
---|
634 | static Int_t az=~0;
|
---|
635 |
|
---|
636 | char text[21];
|
---|
637 |
|
---|
638 | if (zd!=(Int_t)off.Zd())
|
---|
639 | {
|
---|
640 | zd = (Int_t)off.Zd();
|
---|
641 | sprintf(text, "%d", zd);
|
---|
642 | fOffsetZd->SetText(new TGString(text));
|
---|
643 | }
|
---|
644 | if (az!=(Int_t)off.Az())
|
---|
645 | {
|
---|
646 | az = (Int_t)off.Az();
|
---|
647 | sprintf(text, "%d", az);
|
---|
648 | fOffsetAz->SetText(new TGString(text));
|
---|
649 | }
|
---|
650 | }
|
---|
651 |
|
---|
652 | double MGCosy::UpdateTime()
|
---|
653 | {
|
---|
654 | Timer time;
|
---|
655 | time.Now();
|
---|
656 |
|
---|
657 | char text[256];
|
---|
658 |
|
---|
659 | strcpy(text, time.GetTimeStr());
|
---|
660 |
|
---|
661 | char *dot = strrchr(text, '.');
|
---|
662 |
|
---|
663 | if (dot)
|
---|
664 | dot[2] = 0;
|
---|
665 |
|
---|
666 | fUtc->SetText(new TGString(text));
|
---|
667 |
|
---|
668 | double mjd = time.CalcMjd();
|
---|
669 |
|
---|
670 | sprintf(text, "%12.6f", mjd);
|
---|
671 | fMjd->SetText(new TGString(text));
|
---|
672 |
|
---|
673 | return mjd;
|
---|
674 | }
|
---|
675 |
|
---|
676 | void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, UInt_t stat)
|
---|
677 | {
|
---|
678 | double mjd = UpdateTime();
|
---|
679 | fSkyPosition->Update(pos, mjd);
|
---|
680 | fAccuracy->Update(pos, acc);
|
---|
681 | fVelocity->Update(vel);
|
---|
682 | UpdateOffset(off);
|
---|
683 |
|
---|
684 |
|
---|
685 | #define kError 0x01
|
---|
686 | #define kMoving 0x02
|
---|
687 | #define kTracking 0x04
|
---|
688 | #define kStopping 0x08
|
---|
689 | #define kStopped 0x10
|
---|
690 |
|
---|
691 | EnableLabel(fError, stat&kError);
|
---|
692 | EnableLabel(fMoving, stat&kMoving);
|
---|
693 | EnableLabel(fTracking, stat&kTracking);
|
---|
694 | EnableLabel(fStopping, stat&kStopping);
|
---|
695 | EnableLabel(fStopped, stat&kStopped);
|
---|
696 |
|
---|
697 | stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow();
|
---|
698 | stat&kTracking ? fVelocity->MapWindow() : fVelocity->UnmapWindow();
|
---|
699 | // stat&kTracking ? fOffset->MapWindow() : fOffset->UnmapWindow();
|
---|
700 |
|
---|
701 | if (!fLog->TestBit(kHasChanged))
|
---|
702 | return;
|
---|
703 |
|
---|
704 | fLog->MapSubwindows();
|
---|
705 | fLog->Layout();
|
---|
706 | fLog->ResetBit(kHasChanged);
|
---|
707 | }
|
---|
708 | // ======================================================================
|
---|
709 |
|
---|
710 | void MGCosy::CloseWindow()
|
---|
711 | {
|
---|
712 | // Got close message for this MainFrame. Calls parent CloseWindow()
|
---|
713 | // (which destroys the window) and terminate the application.
|
---|
714 | // The close message is generated by the window manager when its close
|
---|
715 | // window menu item is selected.
|
---|
716 |
|
---|
717 | // gSystem->ExitLoop();
|
---|
718 | // gSystem->DispatchOneEvent(kTRUE);
|
---|
719 |
|
---|
720 | // TGMainFrame::CloseWindow();
|
---|
721 | cout << "Closing window - waiting until all nodes are stopped." << endl;
|
---|
722 | fQueue->PostMsg(WM_QUIT, 0, 0);
|
---|
723 | cout << "Closing window - done." << endl;
|
---|
724 | // gApplication->Terminate(0);
|
---|
725 | }
|
---|
726 |
|
---|
727 | void MGCosy::StartTrack()
|
---|
728 | {
|
---|
729 | cout << "Start tracking." << endl;
|
---|
730 |
|
---|
731 | XY xy = fCRaDec->GetCoordinates();
|
---|
732 | RaDec dest(xy.X()*15., xy.Y()); // xy.X() [h]->[ø]
|
---|
733 |
|
---|
734 | cout << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl;
|
---|
735 |
|
---|
736 | fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
|
---|
737 |
|
---|
738 | cout << "PostMsg (WM_Track) returned." << endl;
|
---|
739 | }
|
---|
740 |
|
---|
741 | void MGCosy::StartPos()
|
---|
742 | {
|
---|
743 | cout << "Start positioning." << endl;
|
---|
744 |
|
---|
745 | XY xy = fCZdAz->GetCoordinates();
|
---|
746 | ZdAz dest(xy.X(), xy.Y());
|
---|
747 |
|
---|
748 | cout << dest.Zd() << kDEG << " " << dest.Az() << kDEG << endl;
|
---|
749 |
|
---|
750 | fQueue->PostMsg(WM_POSITION, &dest, sizeof(dest));
|
---|
751 |
|
---|
752 | cout << "PostMsg (WM_Position) returned." << endl;
|
---|
753 | }
|
---|
754 |
|
---|
755 | //
|
---|
756 | // ************************** For demo purpose **********************
|
---|
757 | //
|
---|
758 | #include <TRandom.h>
|
---|
759 | class MDemo : public MThread
|
---|
760 | {
|
---|
761 | private:
|
---|
762 | MsgQueue *fQueue;
|
---|
763 | TRandom fRand;
|
---|
764 |
|
---|
765 | public:
|
---|
766 | MDemo() : MThread(false) {}
|
---|
767 |
|
---|
768 | void SetQueue(MsgQueue *q) { fQueue = q; }
|
---|
769 |
|
---|
770 | virtual void *Thread()
|
---|
771 | {
|
---|
772 | while (1)
|
---|
773 | {
|
---|
774 | Timer tm;
|
---|
775 | tm.Now();
|
---|
776 |
|
---|
777 | Float_t h = 2.+tm.H()+(10.7+tm.M())/60.;
|
---|
778 | RaDec dest(h*15, 129.7);
|
---|
779 |
|
---|
780 | cout << dest.Ra()/15 << "h " << dest.Dec() << "°" << endl;
|
---|
781 |
|
---|
782 | fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
|
---|
783 |
|
---|
784 | int i = 0;
|
---|
785 | while (!HasStopFlag() && i++<60) // 2.5min
|
---|
786 | usleep(1000000);
|
---|
787 | if (HasStopFlag())
|
---|
788 | break;
|
---|
789 |
|
---|
790 | //fQueue->PostMsg(WM_STOP, 0, 0);
|
---|
791 |
|
---|
792 | ZdAz dest1(fRand.Integer(36)+25, fRand.Integer(360));
|
---|
793 |
|
---|
794 | cout << "Demo: Zd=" << dest1.Zd() << "° Az=" << dest1.Az() << "°" << endl;
|
---|
795 |
|
---|
796 | fQueue->PostMsg(WM_POSITION, &dest1, sizeof(dest1));
|
---|
797 |
|
---|
798 | i = 0;
|
---|
799 | while (!HasStopFlag() && i++<15) // 30s
|
---|
800 | usleep(1000000);
|
---|
801 | if (HasStopFlag())
|
---|
802 | break;
|
---|
803 |
|
---|
804 | //ZdAz dest2(5, 30);
|
---|
805 | //fQueue->PostMsg(WM_POSITION, &dest2, sizeof(dest2));
|
---|
806 | /*
|
---|
807 | i = 0;
|
---|
808 | while (!HasStopFlag() && i++<30) // 30s
|
---|
809 | usleep(1000000);
|
---|
810 | */
|
---|
811 | //if (HasStopFlag())
|
---|
812 | // break;
|
---|
813 | }
|
---|
814 | cout << "Demo Thread: done." << endl;
|
---|
815 | return NULL;
|
---|
816 | }
|
---|
817 | };
|
---|
818 |
|
---|
819 | MDemo demo;
|
---|
820 |
|
---|
821 | void MGCosy::StartDemo()
|
---|
822 | {
|
---|
823 | cout << "Start Demo." << endl;
|
---|
824 |
|
---|
825 | demo.SetQueue(fQueue);
|
---|
826 | demo.Start();
|
---|
827 |
|
---|
828 | cout << "PostMsg (WM_Demo) returned." << endl;
|
---|
829 | }
|
---|
830 |
|
---|
831 | void StopDemo()
|
---|
832 | {
|
---|
833 | cout << "Stopping demo." << endl;
|
---|
834 | demo.Stop();
|
---|
835 | }
|
---|
836 |
|
---|
837 | void MGCosy::StartCalib()
|
---|
838 | {
|
---|
839 | cout << "Start Calibration." << endl;
|
---|
840 |
|
---|
841 | XY xy = fCCalib->GetCoordinates();
|
---|
842 | RaDec pos(xy.X()*360/24, xy.Y());
|
---|
843 |
|
---|
844 | fQueue->PostMsg(WM_CALIB, &pos, sizeof(pos));
|
---|
845 |
|
---|
846 | cout << "PostMsg (WM_Calib) returned." << endl;
|
---|
847 | }
|
---|
848 |
|
---|
849 | void MGCosy::StartTPoint()
|
---|
850 | {
|
---|
851 | cout << "Start writing tpoint pair." << endl;
|
---|
852 |
|
---|
853 | XY xy = fCCalib->GetCoordinates();
|
---|
854 | RaDec pos(xy.X()*360/24, xy.Y());
|
---|
855 |
|
---|
856 | //fQueue->PostMsg(WM_TPOINT, &pos, sizeof(pos));
|
---|
857 | fQueue->Proc(WM_TPOINT, &pos);
|
---|
858 |
|
---|
859 | cout << "PostMsg (WM_TPoint) returned." << endl;
|
---|
860 | }
|
---|
861 | //
|
---|
862 | // ******************************************************************
|
---|
863 | //
|
---|
864 |
|
---|
865 | Bool_t MGCosy::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2)
|
---|
866 | {
|
---|
867 | //
|
---|
868 | // This processing is serialized!
|
---|
869 | //
|
---|
870 | switch (GET_MSG(msg))
|
---|
871 | {
|
---|
872 | case kC_COMMAND:
|
---|
873 | switch (GET_SUBMSG(msg))
|
---|
874 | {
|
---|
875 | case kCM_TAB:
|
---|
876 | //cout << "Tab: " << mp1 << endl;
|
---|
877 | return kTRUE;
|
---|
878 |
|
---|
879 | case kCM_BUTTON:
|
---|
880 |
|
---|
881 | switch (mp1)
|
---|
882 | {
|
---|
883 | /*
|
---|
884 | case kPB_POSITION:
|
---|
885 | Start(0);
|
---|
886 | return kTRUE;
|
---|
887 |
|
---|
888 | case kPB_TRACK:
|
---|
889 | Start(1);
|
---|
890 | return kTRUE;
|
---|
891 | */
|
---|
892 | case kPB_START:
|
---|
893 | switch (fTab->GetCurrent())
|
---|
894 | {
|
---|
895 | case 0:
|
---|
896 | StartPos();
|
---|
897 | return kTRUE;
|
---|
898 | case 1:
|
---|
899 | StartTrack();
|
---|
900 | return kTRUE;
|
---|
901 | case 2:
|
---|
902 | fCRaDec->SetCoordinates(fCCalib->GetCoordinates());
|
---|
903 | return kTRUE;
|
---|
904 | case 3:
|
---|
905 | StartDemo();
|
---|
906 | return kTRUE;
|
---|
907 | }
|
---|
908 | return kTRUE;
|
---|
909 |
|
---|
910 | case kPB_STOP:
|
---|
911 | cout << "Sending stop movement msg." << endl;
|
---|
912 | StopDemo();
|
---|
913 | fQueue->PostMsg(WM_STOP, 0, 0);
|
---|
914 |
|
---|
915 | cout << "PostMsg (WM_Stop) returned." << endl;
|
---|
916 | return kTRUE;
|
---|
917 |
|
---|
918 | case kPB_CALCALTAZ:
|
---|
919 | {
|
---|
920 | XY xy = fCRaDec->GetCoordinates();
|
---|
921 | fQueue->Proc(WM_CALCALTAZ, &xy);
|
---|
922 | }
|
---|
923 | return kTRUE;
|
---|
924 |
|
---|
925 | case kPB_RAp:
|
---|
926 | case kPB_RAm:
|
---|
927 | case kPB_DECp:
|
---|
928 | case kPB_DECm:
|
---|
929 | {
|
---|
930 | XY xy = fCRaDec->GetCoordinates();
|
---|
931 | switch (mp1)
|
---|
932 | {
|
---|
933 | case kPB_RAp:
|
---|
934 | xy.X(xy.X()+1./60);
|
---|
935 | break;
|
---|
936 | case kPB_RAm:
|
---|
937 | xy.X(xy.X()-1./60);
|
---|
938 | break;
|
---|
939 | case kPB_DECp:
|
---|
940 | xy.Y(xy.Y()+1./60);
|
---|
941 | break;
|
---|
942 | case kPB_DECm:
|
---|
943 | xy.Y(xy.Y()-1./60);
|
---|
944 | break;
|
---|
945 | }
|
---|
946 | RaDec dest(xy.X()*15., xy.Y()); // xy.X() [h]->[ø]
|
---|
947 | fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
|
---|
948 | //fQueue->Proc(WM_NEWTRACK, &dest);
|
---|
949 | fCRaDec->SetCoordinates(xy);
|
---|
950 |
|
---|
951 | cout << "New Ra/Dec: " << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl;
|
---|
952 | }
|
---|
953 | return kTRUE;
|
---|
954 |
|
---|
955 | case kPB_TPOINT:
|
---|
956 | StartTPoint();
|
---|
957 | return kTRUE;
|
---|
958 | case kPB_CALIBSE:
|
---|
959 | StartCalib();
|
---|
960 | return kTRUE;
|
---|
961 | case kPB_LoadBending:
|
---|
962 | fQueue->Proc(WM_LOADBENDING, NULL);
|
---|
963 | return kTRUE;
|
---|
964 |
|
---|
965 | default:
|
---|
966 | return kTRUE;
|
---|
967 | }
|
---|
968 | return kTRUE;
|
---|
969 |
|
---|
970 | case kCM_MENU:
|
---|
971 |
|
---|
972 | switch (mp1)
|
---|
973 | {
|
---|
974 | case IDM_EXIT:
|
---|
975 | cout << "IDM_EXIT: Posting WM_QUIT." << endl;
|
---|
976 | fQueue->PostMsg(WM_QUIT, 0, 0);
|
---|
977 | cout << "IDM_EXIT: WM_QUIT done." << endl;
|
---|
978 | //cout << "Idm_Exit." << endl;
|
---|
979 | //CloseWindow();
|
---|
980 | return kTRUE;
|
---|
981 | case IDM_ASPECT:
|
---|
982 | Int_t w = GetWidth();
|
---|
983 | Int_t h = GetHeight();
|
---|
984 | if (w>940*h/660)
|
---|
985 | w = 940*h/660;
|
---|
986 | else
|
---|
987 | h = 660*w/940;
|
---|
988 | Resize(w, h);
|
---|
989 | return kTRUE;
|
---|
990 | }
|
---|
991 | return kTRUE;
|
---|
992 | }
|
---|
993 | }
|
---|
994 |
|
---|
995 | //
|
---|
996 | // Start a thread to process the message.
|
---|
997 | //
|
---|
998 | // fQueue->PostMsg(msg, mp1, mp2);
|
---|
999 | return kTRUE;
|
---|
1000 |
|
---|
1001 | }
|
---|