source: trunk/MagicSoft/Cosy/gui/MGCosy.cc@ 2120

Last change on this file since 2120 was 2069, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 37.1 KB
Line 
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 <TGFrame.h> // TGGroupFrame
13#include <TSystem.h> // gSystem
14#include <TGLabel.h> // TGLabel
15#include <TG3DLine.h> // TGHorizontal3DLine (TGSplitter)
16#include <TGButton.h> // TGButton
17#include <TGTextView.h> // TGTextView
18#include <TGComboBox.h> // TGComboBox
19#include <TGTextEntry.h> // TGTextEntry
20#include <TApplication.h> // gApplication
21
22//#include "timer.h" // Timer
23
24#include "MCosy.h"
25#include "MGList.h"
26#include "MGAccuracy.h"
27#include "MGCoordinates.h"
28#include "MGSkyPosition.h"
29#include "MGVelocity.h"
30
31#include "SlaStars.h"
32
33#undef DEBUG
34#define EXPERT
35
36ClassImp(MGCosy);
37
38#define IDM_EXIT 1
39#define IDM_TEXT 2
40#define IDM_ASPECT 3
41
42enum
43{
44 kPB_POSITION,
45 kPB_TRACK,
46 kPB_STOP,
47 kPB_TRACKPOS,
48 kPB_CALCALTAZ,
49 kPB_TPOINT,
50 kPB_START,
51 kPB_DISPLAY1,
52 kPB_DISPLAY2,
53 kPB_RAp,
54 kPB_RAm,
55 kPB_DECp,
56 kPB_DECm,
57 kPB_LoadBending,
58 kPB_ResetBending,
59 kPB_CALIBSE,
60 kCB_PredefPos,
61
62 // kLog
63 kLogCopy, kLogClear, kLogSelect, kLogSearch, kLogSave, kLogAppend
64};
65
66void MGCosy::CreateMenu()
67{
68 TGLayoutHints *laymenubar = new TGLayoutHints (kLHintsNormal | kLHintsExpandX);
69 TGLayoutHints *laymenuitem = new TGLayoutHints (kLHintsNormal, 0, 4, 0, 0);
70 fList->Add(laymenubar);
71 fList->Add(laymenuitem);
72
73 //
74 // crate the menu bar
75 //
76 TGPopupMenu *filemenu = new TGPopupMenu(gClient->GetRoot());
77 filemenu->AddEntry("Set Aspect", IDM_ASPECT);
78 filemenu->AddEntry("Exit", IDM_EXIT);
79 filemenu->Associate(this);
80 fList->Add(filemenu);
81
82 //
83 // Log Menu
84 //
85 TGPopupMenu *logmenu = new TGPopupMenu(gClient->GetRoot());
86 logmenu->AddEntry("&Copy Selected", kLogCopy);
87 logmenu->AddEntry("Clear all", kLogClear);
88 logmenu->AddSeparator();
89 logmenu->AddEntry("Select All", kLogSelect);
90 /*
91 logmenu->AddSeparator();
92 logmenu->AddEntry("Search", kLogSearch);
93 */
94 logmenu->AddSeparator();
95 logmenu->AddEntry("Save", kLogSave);
96 logmenu->AddEntry("Save append", kLogAppend);
97 logmenu->Associate(this);
98
99 //
100 // the button messages are handled by main frame (this)
101 //
102 TGMenuBar *menubar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
103 menubar->AddPopup("File", filemenu, laymenuitem);
104 menubar->AddPopup("Lo&g", logmenu, laymenuitem);
105 AddFrame(menubar, laymenubar);
106 fList->Add(menubar);
107
108 //
109 // Seperator beyond menubar
110 //
111 TGHorizontal3DLine *linesep = new TGHorizontal3DLine(this);
112 AddFrame(linesep, laymenubar);
113 fList->Add(linesep);
114}
115
116void MGCosy::CreateLabel(TGCompositeFrame *f)
117{
118 const int x = 180;
119 const int y = 25;
120
121 TGLabel *l;
122
123 l = new TGLabel(f, "UTC:");
124 l->Move(x-60, y);
125 fList->Add(l);
126
127 l = new TGLabel(f, "Mjd:");
128 l->Move(x-60, y+17);
129 fList->Add(l);
130
131 fUtc = new TGLabel(f, "0000/00/00 00:00:00.0");
132 fMjd = new TGLabel(f, "00000.000000");
133 fUtc->Move(x-25, y);
134 fMjd->Move(x-25, y+17);
135 fList->Add(fUtc);
136 fList->Add(fMjd);
137
138 l = new TGLabel(f, "SE-Az:");
139 l->Move(x-60, y+40);
140 fList->Add(l);
141
142 l = new TGLabel(f, "SE-Zd1:");
143 l->Move(x-60, y+57);
144 fList->Add(l);
145
146 l = new TGLabel(f, "SE-Zd2:");
147 l->Move(x-60, y+74);
148 fList->Add(l);
149
150 fLabel1 = new TGLabel(f, "00000"); // Max: 16384
151 fLabel2 = new TGLabel(f, "00000");
152 fLabel3 = new TGLabel(f, "00000");
153 fLabel1->SetTextJustify(kTextRight);
154 fLabel2->SetTextJustify(kTextRight);
155 fLabel3->SetTextJustify(kTextRight);
156 fLabel1->Move(x, y+40);
157 fLabel2->Move(x, y+57);
158 fLabel3->Move(x, y+74);
159 fList->Add(fLabel1);
160 fList->Add(fLabel2);
161 fList->Add(fLabel3);
162
163 l = new TGLabel(f, "Offset-Zd:");
164 l->Move(x-60, y+102);
165 fList->Add(l);
166
167 l = new TGLabel(f, "Offset-Az:");
168 l->Move(x-60, y+119);
169 fList->Add(l);
170
171 fOffsetZd = new TGLabel(f, "000000000");
172 fOffsetAz = new TGLabel(f, "000000000");
173 fOffsetZd->SetTextJustify(kTextRight);
174 fOffsetAz->SetTextJustify(kTextRight);
175 fOffsetZd->Move(x+15, y+102);
176 fOffsetAz->Move(x+15, y+119);
177 fList->Add(fOffsetZd);
178 fList->Add(fOffsetAz);
179
180 l = new TGLabel(f, "Ra (estimated):");
181 l->Move(x-60, y+142);
182 fList->Add(l);
183
184 l = new TGLabel(f, "Ra (nominal):");
185 l->Move(x-60, y+159);
186 fList->Add(l);
187
188 l = new TGLabel(f, "Dec (estimated):");
189 l->Move(x-60, y+182);
190 fList->Add(l);
191
192 l = new TGLabel(f, "Dec (nominal):");
193 l->Move(x-60, y+199);
194 fList->Add(l);
195
196 l = new TGLabel(f, "Zd (nominal):");
197 l->Move(x-60, y+222);
198 fList->Add(l);
199
200 l = new TGLabel(f, "Az (nominal):");
201 l->Move(x-60, y+239);
202 fList->Add(l);
203
204 fRaEst = new TGLabel(f, "+000h 00.0m");
205 fDecEst = new TGLabel(f, "+000h 00.0m");
206 fRaSoll = new TGLabel(f, "+000h 00.0m");
207 fDecSoll = new TGLabel(f, "+000h 00.0m");
208 fZdSoll = new TGLabel(f, "+000h 00.0m");
209 fAzSoll = new TGLabel(f, "+000h 00.0m");
210 fRaEst->SetTextJustify(kTextRight);
211 fDecEst->SetTextJustify(kTextRight);
212 fRaSoll->SetTextJustify(kTextRight);
213 fDecSoll->SetTextJustify(kTextRight);
214 fZdSoll->SetTextJustify(kTextRight);
215 fAzSoll->SetTextJustify(kTextRight);
216 fRaEst->Move(x+30, y+142);
217 fRaSoll->Move(x+30, y+159);
218 fDecEst->Move(x+30, y+182);
219 fDecSoll->Move(x+30, y+199);
220 fZdSoll->Move(x+30, y+222);
221 fAzSoll->Move(x+30, y+239);
222 fList->Add(fRaEst);
223 fList->Add(fDecEst);
224 fList->Add(fRaSoll);
225 fList->Add(fDecSoll);
226 fList->Add(fZdSoll);
227 fList->Add(fAzSoll);
228
229 fError = new TGLabel(f, "Error");
230 fMoving = new TGLabel(f, "Moving");
231 fTracking = new TGLabel(f, "Tracking");
232 fStopping = new TGLabel(f, "Stopping");
233 fStopped = new TGLabel(f, "Stopped");
234 fAvailMac1 = new TGLabel(f, "- MAC1 -");
235 fAvailMac2 = new TGLabel(f, "- MAC2 -");
236 //fAvailMac3 = new TGLabel(f, "- MAC3 -");
237 fAvailSe1 = new TGLabel(f, "-SE/Zd1-");
238 fAvailSe2 = new TGLabel(f, "-SE/Zd2-");
239 fAvailSe3 = new TGLabel(f, "- SE/Az -");
240
241 ULong_t color;
242
243 gClient->GetColorByName("Red", color);
244 fError->SetBackgroundColor(color);
245 fAvailMac1->SetBackgroundColor(color);
246 fAvailMac2->SetBackgroundColor(color);
247 //fAvailMac3->SetBackgroundColor(color);
248 fAvailSe1->SetBackgroundColor(color);
249 fAvailSe2->SetBackgroundColor(color);
250 fAvailSe3->SetBackgroundColor(color);
251 gClient->GetColorByName("LightBlue", color);
252 fMoving->SetBackgroundColor(color);
253 gClient->GetColorByName("Blue", color);
254 fTracking->SetBackgroundColor(color);
255 gClient->GetColorByName("Orange", color);
256 fStopping->SetBackgroundColor(color);
257 gClient->GetColorByName("Green", color);
258 fStopped->SetBackgroundColor(color);
259
260 fError ->Move(10, 25);
261 fMoving ->Move(10, 25+20);
262 fTracking->Move(10, 25+40);
263 fStopping->Move(10, 25+60);
264 fStopped ->Move(10, 25+80);
265 fAvailMac1->Move(10, 25+120);
266 fAvailMac2->Move(10, 25+140);
267 //fAvailMac3->Move(10, 25+160);
268 fAvailSe1->Move(10, 25+180);
269 fAvailSe2->Move(10, 25+200);
270 fAvailSe3->Move(10, 25+220);
271
272 fError ->Resize(60, 20);
273 fMoving ->Resize(60, 20);
274 fTracking->Resize(60, 20);
275 fStopping->Resize(60, 20);
276 fStopped ->Resize(60, 20);
277 fAvailMac1->Resize(60, 20);
278 fAvailMac2->Resize(60, 20);
279 //fAvailMac3->Resize(60, 20);
280 fAvailSe1->Resize(60, 20);
281 fAvailSe2->Resize(60, 20);
282 fAvailSe3->Resize(60, 20);
283
284 fList->Add(fError);
285 fList->Add(fMoving);
286 fList->Add(fTracking);
287 fList->Add(fStopping);
288 fList->Add(fStopped);
289 fList->Add(fAvailMac1);
290 fList->Add(fAvailMac2);
291 //fList->Add(fAvailMac3);
292 fList->Add(fAvailSe1);
293 fList->Add(fAvailSe2);
294 fList->Add(fAvailSe3);
295}
296
297void MGCosy::CreatePredefinedPos(TGCompositeFrame *tf1)
298{
299 TGComboBox *box = new TGComboBox(tf1, kCB_PredefPos);
300 box->Resize(120, 20);
301 box->Associate(this);
302
303 TGLayoutHints *lay = new TGLayoutHints(kLHintsLeft|kLHintsTop,
304 27, 0, 200, 0);
305 tf1->AddFrame(box, lay);
306
307 fList->Add(box);
308 fList->Add(lay);
309
310 ifstream fin("prepos.txt");
311 if (!fin)
312 {
313 cout << "ERROR: Predifined posiion in 'prepos.txt' not found." << endl;
314 return;
315 }
316
317 int i=0;
318 while (1)
319 {
320 TString str;
321 Double_t zd, az;
322 fin >> str >> zd >> az;
323 if (!fin)
324 break;
325 box->AddEntry(str, i++);
326
327 fStarList.Add(zd, az);
328 }
329}
330
331void MGCosy::CreateTabs(TGTab *fTab)
332{
333 TGCompositeFrame *tf1 = fTab->AddTab("Position");
334 TGCompositeFrame *tf2 = fTab->AddTab("Track");
335#ifdef EXPERT
336 TGCompositeFrame *tf4 = fTab->AddTab("Calib");
337 TGCompositeFrame *tf5 = fTab->AddTab("Test SE");
338 TGCompositeFrame *tf6 = fTab->AddTab("Gear");
339#endif
340 /*TGCompositeFrame *tf3 =*/// fTab->AddTab("Demo");
341
342 fCZdAz = new MGCoordinates(tf1, kETypeZdAz);
343 fCZdAz->Move(27, 105);
344 fList->Add(fCZdAz);
345
346 CreatePredefinedPos(tf1);
347
348 fCRaDec = new MGCoordinates(tf2, kETypeRaDec);
349 fCRaDec->Move(27, 105);
350 fList->Add(fCRaDec);
351
352#ifdef EXPERT
353 fCCalib = new MGCoordinates(tf4, kETypeRaDec);
354 fCCalib->Move(27, 105);
355 fList->Add(fCCalib);
356#endif
357
358 const int x=15;
359 const int y=12;
360 const int h=16;
361
362 TGLabel *l1 = new TGLabel(tf1, "Move the telescope to a position given in");
363 TGLabel *l2 = new TGLabel(tf1, "local coordinates. The given coordinates");
364 TGLabel *l3 = new TGLabel(tf1, "are pointing coordinates. Enter the coordinates");
365 TGLabel *l4 = new TGLabel(tf1, "manually or choose a predefined position");
366 TGLabel *l5 = new TGLabel(tf1, "from the combobox below.");
367 l1->Move(x, y);
368 l2->Move(x, y+h);
369 l3->Move(x, y+2*h);
370 l4->Move(x, y+3*h);
371 l5->Move(x, y+4*h);
372 fList->Add(l1);
373 fList->Add(l2);
374 fList->Add(l3);
375 fList->Add(l4);
376 fList->Add(l5);
377
378 l1 = new TGLabel(tf2, "Track a position given in sky coordinates.");
379 l2 = new TGLabel(tf2, "Right Ascension and declination must be given");
380 l3 = new TGLabel(tf2, "in the FK5, J2000 coordinate system.");
381 l1->Move(x, y);
382 l2->Move(x, y+h);
383 l3->Move(x, y+2*h);
384 fList->Add(l1);
385 fList->Add(l2);
386 fList->Add(l3);
387
388#ifdef EXPERT
389 l1 = new TGLabel(tf4, "Start the calibration using the Start button.");
390 l2 = new TGLabel(tf4, "Write a coordinate pair to a TPoint file using");
391 l3 = new TGLabel(tf4, "the TPoint button.");
392 //l3 = new TGLabel(tf4, "the TPoint button. To set the Shaftencoder offset");
393 //l4 = new TGLabel(tf4, "use the Calib SE button.");
394 l1->Move(x, y);
395 l2->Move(x, y+h);
396 l3->Move(x, y+2*h);
397 l4->Move(x, y+3*h);
398 fList->Add(l1);
399 fList->Add(l2);
400 fList->Add(l3);
401 fList->Add(l4);
402
403 l1 = new TGLabel(tf5, "START starts histograming the differences of");
404 l2 = new TGLabel(tf5, "the two shaftencoders at the elevation axis.");
405 l3 = new TGLabel(tf5, "Use STOP to stop histograming and display the");
406 l4 = new TGLabel(tf5, "results on the screen.");
407 l1->Move(x, y);
408 l2->Move(x, y+h);
409 l3->Move(x, y+2*h);
410 l4->Move(x, y+3*h);
411 fList->Add(l1);
412 fList->Add(l2);
413 fList->Add(l3);
414 fList->Add(l4);
415
416 l1 = new TGLabel(tf6, "FIXME Text missing / Only one axis?");
417 l1->Move(x, y);
418 fList->Add(l1);
419#endif
420
421 //
422 // light green: 3 light red: 2 blue?: 2
423 // dark green: 8 dark red: 50 dark blue?: 1
424
425 //
426 // blue: 0-7, 9, 10,11, 14, 15, 18, 19, 22, 23, 27, 31, 33-39, 41-43
427 // 46, 47
428 // green: 8, 12,13, 16, 17, 20, 21, 24, 25, 26, 28, 29, 30, 40, 44
429 // 45, 48
430 // gray: 31, 113-
431 // red: 164, 192, 224, 232
432 //
433 TGTextButton *but;
434
435 but= new TGTextButton(tf2, "Ra -", kPB_RAm);
436 but->Resize(50, 25);
437 but->Move(25, 210);
438 but->SetToolTipText("Right ascension -= 1'");
439 but->Associate(this);
440 fList->Add(but);
441 but= new TGTextButton(tf2, "RA +", kPB_RAp);
442 but->Resize(50, 25);
443 but->Move(90, 210);
444 but->SetToolTipText("Right ascension += 1'");
445 but->Associate(this);
446 fList->Add(but);
447 but= new TGTextButton(tf2, "DEC +", kPB_DECp);
448 but->Resize(50, 25);
449 but->Move(55, 185);
450 but->SetToolTipText("Declination += 1'");
451 but->Associate(this);
452 fList->Add(but);
453 but= new TGTextButton(tf2, "DEC -", kPB_DECm);
454 but->Resize(50, 25);
455 but->Move(55, 235);
456 but->SetToolTipText("Declination -= 1'");
457 but->Associate(this);
458 fList->Add(but);
459
460 but = new TGTextButton(tf1, "Move'n'Track", kPB_TRACKPOS);
461 but->Resize(100, 25);
462 but->Move(25, 242);
463 but->SetToolTipText("Move telescope to a Zd/Az position and start tracking.");
464 but->Associate(this);
465 fList->Add(but);
466
467 but= new TGTextButton(tf2, "Calc Zd/Az", kPB_CALCALTAZ);
468 but->Resize(80, 25);
469 but->Move(165, 197);
470 but->SetToolTipText("Calculate Zd/Az corresponding to Ra/Dec.");
471 but->Associate(this);
472 fList->Add(but);
473
474#ifdef EXPERT
475 but = new TGTextButton(tf5, "Display", kPB_DISPLAY1);
476 but->Resize(80, 25);
477 but->Move(160, 197);
478 but->SetToolTipText("Display Histogram.");
479 but->Associate(this);
480 fList->Add(but);
481
482 but = new TGTextButton(tf6, "Display", kPB_DISPLAY2);
483 but->Resize(80, 25);
484 but->Move(160, 197);
485 but->SetToolTipText("Display Histogram.");
486 but->Associate(this);
487 fList->Add(but);
488
489 /*
490 but = new TGTextButton(tf4, "Calib SE", kPB_CALIBSE);
491 but->Resize(80, 25);
492 but->Move(160, 197);
493 but->SetToolTipText("Set SE to given coordinates.");
494 but->Associate(this);
495 fList->Add(but);
496 */
497 but = new TGTextButton(tf4, "Load", kPB_LoadBending);
498 but->Resize(80, 25);
499 but->Move(25, 190);
500 but->SetToolTipText("Load bending corrections from file 'bending.txt'");
501 but->Associate(this);
502 fList->Add(but);
503
504 but = new TGTextButton(tf4, "Reset", kPB_ResetBending);
505 but->Resize(80, 25);
506 but->Move(25, 220);
507 but->SetToolTipText("Reset bending correction (coefficients=0)");
508 but->Associate(this);
509 fList->Add(but);
510
511 but = new TGTextButton(tf4, "TPoint", kPB_TPOINT);
512 but->Resize(80, 25);
513 but->Move(25, 250);
514 but->SetToolTipText("Trigger writing a tpoint coordinate pair.");
515 but->Associate(this);
516 fList->Add(but);
517#endif
518
519 ULong_t color;
520
521 but = new TGTextButton(this, "Start", kPB_START);
522 gClient->GetColorByName("Green", color);
523 but->SetBackgroundColor(color);
524 but->Move(147, 295);
525 but->Resize(62, 25);
526 but->SetToolTipText("Start a telescope movement.");
527 fList->Add(but);
528
529 but = new TGTextButton(this, "Stop", kPB_STOP);
530
531 gClient->GetColorByName("Red", color);
532 but->SetBackgroundColor(color);
533 but->Move(212, 295);
534 but->Resize(62, 25);
535 but->SetToolTipText("Stop any movement of telescope.");
536 fList->Add(but);
537
538 /*
539 const Double_t ca = 0; // Left-Right Collimation Error
540 const Double_t an = 0; // Azimuth Axis Misalignment (N-S)
541 const Double_t aw = 0; // Azimuth Axis Misalignment (E-W)
542 const Double_t npae = 0; // Az-El Nonperpendicularity
543 const Double_t nrx = 0; // Nasmyth rotator displacement, horizontan
544 const Double_t nry = 0; // Nasmyth rotator displacement, vertical
545 const Double_t crx = 0; // Alt/Az Coude Displacement (N-S)
546 const Double_t cry = 0; // Alt/Az Coude Displacement (E-W)
547 l1 = new TGLabel(tf5, "CA");
548 l1->SetTextJustify(kTextLeft);
549 l1->Move(x, y+2*h*1.5);
550 l1->MapWindow();
551 fList->Add(l1);
552 l1 = new TGLabel(tf5, "AN");
553 l1->SetTextJustify(kTextLeft);
554 l1->Move(x, y+3*h*1.5);
555 l1->MapWindow();
556 fList->Add(l1);
557 l1 = new TGLabel(tf5, "AW");
558 l1->SetTextJustify(kTextLeft);
559 l1->Move(x, y+4*h*1.5);
560 l1->MapWindow();
561 fList->Add(l1);
562 l1 = new TGLabel(tf5, "NPAE");
563 l1->SetTextJustify(kTextLeft);
564 l1->Move(x, y+5*h*1.5);
565 l1->MapWindow();
566 fList->Add(l1);
567 l1 = new TGLabel(tf5, "NRX");
568 l1->SetTextJustify(kTextLeft);
569 l1->Move(x, y+6*h*1.5);
570 l1->MapWindow();
571 fList->Add(l1);
572 l1 = new TGLabel(tf5, "NRY");
573 l1->SetTextJustify(kTextLeft);
574 l1->Move(x, y+7*h*1.5);
575 l1->MapWindow();
576 fList->Add(l1);
577 l1 = new TGLabel(tf5, "CRX");
578 l1->SetTextJustify(kTextLeft);
579 l1->Move(x, y+8*h*1.5);
580 l1->MapWindow();
581 fList->Add(l1);
582 l1 = new TGLabel(tf5, "CRY");
583 l1->SetTextJustify(kTextLeft);
584 l1->Move(x, y+9*h*1.5);
585 l1->MapWindow();
586 fList->Add(l1);
587 const Double_t ie = 0; // Index Error in Elevation
588 const Double_t ia = 0; // Index Error in Azimuth
589 const Double_t eces = 0; // Elevation Centering Error (sin)
590 const Double_t ecec = 0; // Elevation Centering Error (cos)
591 const Double_t aces = 0; // Azimuth Centering Error (sin)
592 const Double_t acec = 0; // Azimuth Centering Error (cos)
593 l1 = new TGLabel(tf5, "IE");
594 l1->SetTextJustify(kTextLeft);
595 l1->Move(x+150, y+3*h*1.5);
596 l1->MapWindow();
597 fList->Add(l1);
598 l1 = new TGLabel(tf5, "IA");
599 l1->SetTextJustify(kTextLeft);
600 l1->Move(x+150, y+4*h*1.5);
601 l1->MapWindow();
602 fList->Add(l1);
603 l1 = new TGLabel(tf5, "ECES");
604 l1->SetTextJustify(kTextLeft);
605 l1->Move(x+150, y+5*h*1.5);
606 l1->MapWindow();
607 fList->Add(l1);
608 l1 = new TGLabel(tf5, "ECEC");
609 l1->SetTextJustify(kTextLeft);
610 l1->Move(x+150, y+6*h*1.5);
611 l1->MapWindow();
612 fList->Add(l1);
613 l1 = new TGLabel(tf5, "ACES");
614 l1->SetTextJustify(kTextLeft);
615 l1->Move(x+150, y+4*h*1.5);
616 l1->MapWindow();
617 fList->Add(l1);
618 l1 = new TGLabel(tf5, "IA");
619 l1->SetTextJustify(kTextLeft);
620 l1->Move(x+150, y+4*h*1.5);
621 l1->MapWindow();
622 fList->Add(l1);
623
624
625 TGTextEntry *entry = new TGTextEntry(tf5, "****", kEF_BendIE);
626 entry->Associate(this);
627 entry->Move(x+50, y+2*h*1.5);
628 entry->MapWindow();
629 fList->Add(entry);
630
631 entry = new TGTextEntry(tf5, "*****", kEF_BendIA);
632 entry->Associate(this);
633 entry->Move(x+50, y+3*h*1.5);
634 entry->MapWindow();
635 fList->Add(entry);
636 */
637}
638
639MGCosy::MGCosy(MObservatory::LocationName_t key, MsgQueue *q, const TGWindow *p, UInt_t w, UInt_t h)
640 : TGMainFrame(p, w, h), fObservatory(key), fQueue(q)
641{
642 fList = new MGList;
643
644 fFont = gVirtualX->LoadQueryFont("7x13bold");
645
646#ifdef DEBUG
647 cout << "MGCosy: Creating Menu" << endl;
648#endif
649 CreateMenu();
650
651#ifdef DEBUG
652 cout << "MGCosy: Creating TGCompositeFrame" << endl;
653#endif
654 TGHorizontalFrame *f1 = new TGHorizontalFrame(this, 0, 0);
655 TGHorizontalFrame *f2 = new TGHorizontalFrame(this, 0, 0);
656 fList->Add(f1);
657 fList->Add(f2);
658
659#ifdef DEBUG
660 cout << "MGCosy: Creating TGTab" << endl;
661#endif
662 fTab = new TGTab(f1, 300, 300);
663 fList->Add(fTab);
664
665#ifdef DEBUG
666 cout << "MGCosy: Creating MGSkyPosition" << endl;
667#endif
668 fSkyPosition = new MGSkyPosition(fObservatory, f1, 300);
669#ifdef DEBUG
670 cout << "MGCosy: Creating MGAccuracy" << endl;
671#endif
672 fAccuracy = new MGAccuracy(f1, 300);
673#ifdef DEBUG
674 cout << "MGCosy: Creating MGVelocity" << endl;
675#endif
676 fVelocity = new MGVelocity(f2, "Velocity [\"/min]", 300);
677// fOffset = new MGVelocity (f, "Offset se-re [']", 300);
678
679 fList->Add(fSkyPosition);
680 fList->Add(fAccuracy);
681 fList->Add(fVelocity);
682// fList->Add(fOffset);
683
684#ifdef DEBUG
685 cout << "MGCosy: Creating TGGroupFrame" << endl;
686#endif
687 TGGroupFrame *frame = new TGGroupFrame(f2, "Status");
688 fList->Add(frame);
689
690#ifdef DEBUG
691 cout << "MGCosy: Creating TGTextView" << endl;
692#endif
693 fLog = new TGTextView(f2, 300, 300);
694 if (fFont)
695 fLog->SetFont(fFont);
696 fList->Add(fLog);
697
698 TGLayoutHints *hints1 = new TGLayoutHints(kLHintsNormal | kLHintsExpandX|kLHintsExpandY, 6, 6, 6, 3);
699 TGLayoutHints *hints2 = new TGLayoutHints(kLHintsNormal | kLHintsExpandX|kLHintsExpandY, 6, 6, 3, 6);
700 TGLayoutHints *hints1a = new TGLayoutHints(kLHintsLeft | kLHintsTop |kLHintsExpandX|kLHintsExpandY);
701 TGLayoutHints *hints2a = new TGLayoutHints(kLHintsCenterY | kLHintsTop |kLHintsExpandX|kLHintsExpandY, 6, 6);
702 TGLayoutHints *hints3a = new TGLayoutHints(kLHintsRight | kLHintsTop |kLHintsExpandX|kLHintsExpandY);
703 TGLayoutHints *hints1b = new TGLayoutHints(kLHintsLeft | kLHintsBottom|kLHintsExpandX|kLHintsExpandY);
704 TGLayoutHints *hints2b = new TGLayoutHints(kLHintsCenterY | kLHintsBottom|kLHintsExpandX|kLHintsExpandY, 6, 6);
705 TGLayoutHints *hints3b = new TGLayoutHints(kLHintsRight | kLHintsBottom|kLHintsExpandX|kLHintsExpandY);
706
707 fList->Add(hints1);
708 fList->Add(hints2);
709 fList->Add(hints1a);
710 fList->Add(hints2a);
711 fList->Add(hints3a);
712 fList->Add(hints1b);
713 fList->Add(hints2b);
714 fList->Add(hints3b);
715
716 // Layout upper frame
717 f1->AddFrame(fTab, hints1a);
718 f1->AddFrame(fSkyPosition, hints2a);
719 f1->AddFrame(fAccuracy, hints3a);
720
721 // Layout upper frame
722 f2->AddFrame(frame, hints1b);
723 f2->AddFrame(fVelocity, hints2b);
724 f2->AddFrame(fLog, hints3b);
725
726 // Layout window
727 AddFrame(f1, hints1);
728 AddFrame(f2, hints2);
729
730 //
731 // FIXME!
732 //
733#ifdef DEBUG
734 cout << "MGCosy: Creating Tabs" << endl;
735#endif
736 CreateTabs(fTab);
737#ifdef DEBUG
738 cout << "MGCosy: Creating Label" << endl;
739#endif
740 CreateLabel(frame);
741
742 //
743 // Map the window, set up the layout, etc.
744 //
745#ifdef DEBUG
746 cout << "MGCosy: Setting Size" << endl;
747#endif
748 const Int_t w = 940;
749 const Int_t h = 660;
750 SetWMSizeHints(w, h, 1280, 900, 10, 10); // set the smallest and biggest size of the Main frame
751
752 SetWindowName("Cosy Main Window");
753 SetIconName("Cosy");
754
755#ifdef DEBUG
756 cout << "MGCosy: Map Window" << endl;
757#endif
758 MapSubwindows();
759 Resize(w, h); //GetDefaultSize());
760 MapWindow();
761}
762
763// ======================================================================
764
765MGCosy::~MGCosy()
766{
767#ifdef DEBUG
768 cout << "MGCosy::~MGCosy called." << endl;
769#endif
770 delete fList;
771#ifdef DEBUG
772 cout << "Deleting MGCosy::fFont" << endl;
773#endif
774 if (fFont)
775 gVirtualX->DeleteFont(fFont);
776#ifdef DEBUG
777 cout << "MGCosy::~MGCosy done." << endl;
778#endif
779}
780
781void MGCosy::SetLabelColor(TGLabel *label, Bool_t col)
782{
783 ULong_t red, green;
784
785 gClient->GetColorByName("Red", red);
786 gClient->GetColorByName("Green", green);
787
788 if (col && label->TestBit(BIT(14)))
789 return;
790
791 if (!col && !label->TestBit(BIT(14)))
792 return;
793
794 col ? label->SetBit(BIT(14)) : label->ResetBit(BIT(14));
795
796 label->UnmapWindow();
797 label->SetBackgroundColor(col ? green : red);
798 label->MapWindow();
799}
800
801// ======================================================================
802void MGCosy::EnableLabel(TGLabel *label, Bool_t stat)
803{
804 stat ? label->MapWindow() : label->UnmapWindow();
805
806 /*
807 TGGC *fRedTextGC(TGButton::GetDefaultGC())
808 // Set foreground color in graphics context for drawing of
809 // TGlabel and TGButtons with text in red.
810 ULong_t red;
811 gClient->GetColorByName("red", red);
812 fRedTextGC.SetForeground(red);
813 */
814}
815
816void MGCosy::UpdateRaDec(ZdAz &pos, double mjd, RaDec &radec)
817{
818 static Int_t rai=~0;
819 static Int_t deci=~0;
820 static Int_t ras=~0;
821 static Int_t decs=~0;
822
823 static SlaStars sla(fObservatory);
824 sla.SetMjd(mjd);
825
826 RaDec rd = sla.CalcRaDec(pos*2*TMath::Pi()/360);
827
828 char text[64];
829
830 rd.Ra(rd.Ra() * 24/2/TMath::Pi());
831 rd.Dec(rd.Dec()*360/2/TMath::Pi());
832
833 radec.Ra(radec.Ra() * 24/2/TMath::Pi());
834 radec.Dec(radec.Dec()*360/2/TMath::Pi());
835
836 RaDec test = rd*600;
837
838 if (rai!=(int)test.Ra())
839 {
840 rai = (int)test.Ra();
841 sprintf(text, "%c%dh %.1fm", rd.Ra()<0?'-':'+', abs((int)rd.Ra()), 0.1*(abs((int)test.Ra())%600));
842 fRaEst->SetText(new TGString(text));
843 }
844 if (deci!=(int)test.Dec())
845 {
846 deci = (int)test.Dec();
847 sprintf(text, "%c%dd %.1fm", rd.Dec()<0?'-':'+' , abs((int)rd.Dec()), 0.1*(abs((int)test.Dec())%600));
848 fDecEst->SetText(new TGString(text));
849 }
850
851 if (radec.Dec()>90|| radec.Dec()<-90)
852 {
853 radec.Ra(radec.Ra()+12);
854 radec.Dec(180-radec.Dec());
855 }
856 radec.Ra(fmod((radec.Ra()+48), 24));
857
858 test = radec*600;
859
860 if (ras!=(int)test.Ra())
861 {
862 ras = (int)test.Ra();
863 sprintf(text, "%c%dh %.1fm", radec.Ra()<0?'-':'+', abs((int)radec.Ra()), 0.1*(abs((int)test.Ra())%600));
864 fRaSoll->SetText(new TGString(text));
865 }
866 if (decs!=(int)test.Dec())
867 {
868 decs = (int)test.Dec();
869 sprintf(text, "%c%dd %.1fm", radec.Dec()<0?'-':'+' , abs((int)radec.Dec()), 0.1*(abs((int)test.Dec())%600));
870 fDecSoll->SetText(new TGString(text));
871 }
872}
873
874void MGCosy::UpdateOffset(ZdAz &off)
875{
876 static Int_t zd=~0;
877 static Int_t az=~0;
878
879 char text[21];
880
881 if (zd!=(Int_t)off.Zd())
882 {
883 zd = (Int_t)off.Zd();
884 sprintf(text, "%dre", zd);
885 fOffsetZd->SetText(new TGString(text));
886 }
887 if (az!=(Int_t)off.Az())
888 {
889 az = (Int_t)off.Az();
890 sprintf(text, "%dre", az);
891 fOffsetAz->SetText(new TGString(text));
892 }
893}
894
895void MGCosy::UpdateZdAz(ZdAz &soll)
896{
897 soll *= 360/2/TMath::Pi();
898
899 static Int_t zd=~0;
900 static Int_t az=~0;
901
902 char text[21];
903
904 ZdAz test = soll*600;
905
906 if (zd!=(int)test.Zd())
907 {
908 zd = (int)test.Zd();
909 sprintf(text, "%c%dd %.1fm", soll.Zd()<0?'-':'+', abs((int)soll.Zd()), 0.1*(abs((int)test.Zd())%600));
910 fZdSoll->SetText(new TGString(text));
911 }
912 if (az!=(int)test.Az())
913 {
914 az = (int)test.Az();
915 sprintf(text, "%c%dd %.1fm", soll.Az()<0?'-':'+' , abs((int)soll.Az()), 0.1*(abs((int)test.Az())%600));
916 fAzSoll->SetText(new TGString(text));
917 }
918}
919
920double MGCosy::UpdateTime()
921{
922 Timer time;
923 time.Now();
924
925 static char oldtxt[256];
926
927 char text[256];
928
929 strcpy(text, time.GetTimeStr());
930
931 char *dot = strrchr(text, '.');
932
933 if (dot)
934 dot[2] = 0;
935
936 if (strcmp(oldtxt, text))
937 {
938 fUtc->SetText(new TGString(text));
939 strcpy(oldtxt, text);
940 }
941
942 static long oldmjd;
943 double mjd = time.GetMjd();
944
945 if (oldmjd != 1000000*mjd)
946 {
947 sprintf(text, "%12.6f", mjd);
948 fMjd->SetText(new TGString(text));
949
950 oldmjd = (long)(1000000*mjd);
951 }
952
953 return mjd;
954}
955
956void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, RaDec radec,
957 ZdAz soll, UInt_t stat, UInt_t stat2)
958{
959 // acc [rad]
960 acc *= kRad2Deg; // [deg]
961
962 double mjd = UpdateTime();
963 fSkyPosition->Update(pos, mjd);
964 fAccuracy->Update(pos, acc);
965 fVelocity->Update(vel);
966 UpdateOffset(off);
967 UpdateRaDec(pos, mjd, radec);
968 UpdateZdAz(soll);
969
970#define kError 0x01
971#define kMoving 0x02
972#define kTracking 0x04
973#define kStopping 0x08
974#define kStopped 0x10
975
976 EnableLabel(fError, stat&kError);
977 EnableLabel(fMoving, stat&kMoving);
978 EnableLabel(fTracking, stat&kTracking);
979 EnableLabel(fStopping, stat&kStopping);
980 EnableLabel(fStopped, stat&kStopped);
981 EnableLabel(fRaSoll, stat&kTracking);
982 EnableLabel(fDecSoll, stat&kTracking);
983 EnableLabel(fZdSoll, stat&kMoving);
984 EnableLabel(fAzSoll, stat&kMoving);
985
986 SetLabelColor(fAvailMac1, stat2&0x01);
987 SetLabelColor(fAvailMac2, stat2&0x02);
988 //SetLabelColor(fAvailMac3, stat2&0x04);
989 SetLabelColor(fAvailSe1, stat2&0x08);
990 SetLabelColor(fAvailSe2, stat2&0x10);
991 SetLabelColor(fAvailSe3, stat2&0x20);
992
993 stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow();
994 stat&kTracking ? fVelocity->MapWindow() : fVelocity->UnmapWindow();
995 // stat&kTracking ? fOffset->MapWindow() : fOffset->UnmapWindow();
996
997/*
998 if (fLog->TestBit(kHasChanged))
999 {
1000 fLog->MapSubwindows();
1001 fLog->Layout();
1002 fLog->ResetBit(kHasChanged);
1003 }*/
1004}
1005// ======================================================================
1006
1007void MGCosy::CloseWindow()
1008{
1009 // Got close message for this MainFrame. Calls parent CloseWindow()
1010 // (which destroys the window) and terminate the application.
1011 // The close message is generated by the window manager when its close
1012 // window menu item is selected.
1013
1014 // gSystem->ExitLoop();
1015 // gSystem->DispatchOneEvent(kTRUE);
1016
1017 // TGMainFrame::CloseWindow();
1018 cout << "Closing window - waiting until all nodes are stopped." << endl;
1019 fQueue->PostMsg(WM_QUIT, 0, 0);
1020 cout << "Closing window - done." << endl;
1021 // gApplication->Terminate(0);
1022}
1023
1024void MGCosy::StartTrack()
1025{
1026 cout << "Start tracking." << endl;
1027
1028 XY xy = fCRaDec->GetCoordinates();
1029 RaDec dest(xy.X()*15., xy.Y()); // xy.X() [h]->[ø]
1030
1031 cout << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl;
1032
1033 fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
1034
1035 cout << "PostMsg (WM_Track) returned." << endl;
1036}
1037
1038void MGCosy::StartTrackPos()
1039{
1040 cout << "Start tracking Zd/Az pos." << endl;
1041
1042 const XY &xy = fCZdAz->GetCoordinates();
1043
1044 ZdAz za(xy.X(), xy.Y());
1045
1046 cout << za.Zd() << "\xb0 " << za.Az() << "\xb0" << endl;
1047
1048 fQueue->PostMsg(WM_TRACKPOS, &za, sizeof(za));
1049
1050 cout << "PostMsg (WM_TrackPos) returned." << endl;
1051}
1052
1053void MGCosy::StartPos()
1054{
1055 cout << "Start positioning." << endl;
1056
1057 XY xy = fCZdAz->GetCoordinates();
1058 ZdAz dest(xy.X(), xy.Y());
1059
1060 cout << dest.Zd() << kDEG << " " << dest.Az() << kDEG << endl;
1061
1062 fQueue->PostMsg(WM_POSITION, &dest, sizeof(dest));
1063
1064 cout << "PostMsg (WM_Position) returned." << endl;
1065}
1066
1067//
1068// ************************** For demo purpose **********************
1069//
1070/*
1071#include <TRandom.h>
1072class MDemo : public MThread
1073{
1074private:
1075 MsgQueue *fQueue;
1076 TRandom fRand;
1077
1078public:
1079 MDemo() : MThread(false) {}
1080
1081 void SetQueue(MsgQueue *q) { fQueue = q; }
1082
1083 virtual void *Thread()
1084 {
1085 while (1)
1086 {
1087 Timer tm;
1088 tm.Now();
1089
1090 //fQueue->PostMsg(WM_STOP, 0, 0);
1091
1092 ZdAz dest1((float)fRand.Integer(120)-60., 0);//fRand.Integer(25)+90);
1093
1094 cout << "Demo: Zd=" << dest1.Zd() << "° Az=" << dest1.Az() << "°" << endl;
1095
1096 fQueue->PostMsg(WM_POSITION, &dest1, sizeof(dest1));
1097
1098 int i = 0;
1099 while (!HasStopFlag() && i++<5) // 30s
1100 usleep(1000000);
1101 if (HasStopFlag())
1102 break;
1103
1104 //ZdAz dest2(5, 30);
1105 //fQueue->PostMsg(WM_POSITION, &dest2, sizeof(dest2));
1106 //if (HasStopFlag())
1107 // break;
1108 }
1109 cout << "Demo Thread: done." << endl;
1110 return NULL;
1111 }
1112};
1113
1114MDemo demo;
1115
1116void MGCosy::StartDemo()
1117{
1118 cout << "Start Demo." << endl;
1119
1120 demo.SetQueue(fQueue);
1121 demo.Start();
1122
1123 cout << "PostMsg (WM_Demo) returned." << endl;
1124}
1125
1126void StopDemo()
1127{
1128 cout << "Stopping demo." << endl;
1129 demo.Stop();
1130}
1131*/
1132/*
1133void MGCosy::StartCalib()
1134{
1135 cout << "Start Calibration." << endl;
1136
1137 XY xy = fCCalib->GetCoordinates();
1138 RaDec pos(xy.X()*360/24, xy.Y());
1139
1140 fQueue->PostMsg(WM_CALIB, &pos, sizeof(pos));
1141
1142 cout << "PostMsg (WM_Calib) returned." << endl;
1143}
1144*/
1145void MGCosy::StartTPoint()
1146{
1147 cout << "Start writing tpoint pair." << endl;
1148
1149 XY xy = fCCalib->GetCoordinates();
1150 RaDec pos(xy.X()*360/24, xy.Y());
1151
1152 //fQueue->PostMsg(WM_TPOINT, &pos, sizeof(pos));
1153 fQueue->Proc(WM_TPOINT, &pos);
1154
1155 cout << "PostMsg (WM_TPoint) returned." << endl;
1156}
1157//
1158// ******************************************************************
1159//
1160
1161Bool_t MGCosy::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2)
1162{
1163 //
1164 // This processing is serialized!
1165 //
1166 switch (GET_MSG(msg))
1167 {
1168 case kC_COMMAND:
1169 switch (GET_SUBMSG(msg))
1170 {
1171 case kCM_COMBOBOX:
1172 if (mp1==kCB_PredefPos)
1173 {
1174 MStar *pos = fStarList[mp2];
1175 if (!pos)
1176 return kTRUE;
1177 fCZdAz->SetCoordinates(ZdAz(pos->GetX(), pos->GetY()));
1178 }
1179 return kTRUE;
1180
1181 case kCM_TAB:
1182 //cout << "Tab: " << mp1 << endl;
1183 return kTRUE;
1184
1185 case kCM_BUTTON:
1186
1187 switch (mp1)
1188 {
1189 /*
1190 case kPB_POSITION:
1191 Start(0);
1192 return kTRUE;
1193
1194 case kPB_TRACK:
1195 Start(1);
1196 return kTRUE;
1197 */
1198 case kPB_START:
1199 switch (fTab->GetCurrent())
1200 {
1201 case 0:
1202 StartPos();
1203 return kTRUE;
1204 case 1:
1205 StartTrack();
1206 return kTRUE;
1207 case 2:
1208 fCRaDec->SetCoordinates(fCCalib->GetCoordinates());
1209 return kTRUE;
1210 case 3:
1211 fQueue->Proc(WM_TESTSE, (void*)1);
1212 return kTRUE;
1213 case 4:
1214 fQueue->Proc(WM_GEAR, (void*)1);
1215 return kTRUE;
1216 /*
1217 case 5:
1218 StartDemo();
1219 return kTRUE;
1220 */
1221 }
1222 return kTRUE;
1223
1224 case kPB_STOP:
1225 cout << "Sending stop movement msg." << endl;
1226 //StopDemo();
1227 fQueue->PostMsg(WM_STOP, 0, 0);
1228 if (fTab->GetCurrent()==3)
1229 fQueue->Proc(WM_TESTSE, NULL);
1230 if (fTab->GetCurrent()==4)
1231 fQueue->Proc(WM_GEAR, NULL);
1232 cout << "PostMsg (WM_Stop) returned." << endl;
1233 return kTRUE;
1234
1235 case kPB_CALCALTAZ:
1236 {
1237 XY xy = fCRaDec->GetCoordinates();
1238 fQueue->Proc(WM_CALCALTAZ, &xy);
1239 }
1240 return kTRUE;
1241
1242 case kPB_RAp:
1243 case kPB_RAm:
1244 case kPB_DECp:
1245 case kPB_DECm:
1246 {
1247 XY xy = fCRaDec->GetCoordinates();
1248 switch (mp1)
1249 {
1250 case kPB_RAp:
1251 xy.X(xy.X()+1./60);
1252 break;
1253 case kPB_RAm:
1254 xy.X(xy.X()-1./60);
1255 break;
1256 case kPB_DECp:
1257 xy.Y(xy.Y()+1./60);
1258 break;
1259 case kPB_DECm:
1260 xy.Y(xy.Y()-1./60);
1261 break;
1262 }
1263 RaDec dest(xy.X()*15., xy.Y()); // xy.X() [h]->[ø]
1264 fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
1265 //fQueue->Proc(WM_NEWTRACK, &dest);
1266 fCRaDec->SetCoordinates(xy);
1267
1268 cout << "New Ra/Dec: " << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl;
1269 }
1270 return kTRUE;
1271
1272 case kPB_TPOINT:
1273 StartTPoint();
1274 return kTRUE;
1275 /*
1276 case kPB_CALIBSE:
1277 StartCalib();
1278 return kTRUE;
1279 */
1280 case kPB_LoadBending:
1281 fQueue->Proc(WM_LOADBENDING, NULL);
1282 return kTRUE;
1283 case kPB_ResetBending:
1284 fQueue->Proc(WM_RESETBENDING, NULL);
1285 return kTRUE;
1286 /*
1287 case kPB_HOME:
1288 fQueue->PostMsg(WM_HOME, 0, 0);
1289 return kTRUE;
1290 */
1291 case kPB_TRACKPOS:
1292 StartTrackPos();
1293 return kTRUE;
1294 case kPB_DISPLAY1:
1295 case kPB_DISPLAY2:
1296 fQueue->PostMsg(WM_DISPLAY, 0, 0);
1297 return kTRUE;
1298
1299 default:
1300 return kTRUE;
1301 }
1302 return kTRUE;
1303
1304 case kCM_MENU:
1305
1306 switch (mp1)
1307 {
1308 case IDM_EXIT:
1309 cout << "IDM_EXIT: Posting WM_QUIT." << endl;
1310 fQueue->PostMsg(WM_QUIT, 0, 0);
1311 cout << "IDM_EXIT: WM_QUIT done." << endl;
1312 //cout << "Idm_Exit." << endl;
1313 //CloseWindow();
1314 return kTRUE;
1315 case IDM_ASPECT:
1316 {
1317 Int_t w = GetWidth();
1318 Int_t h = GetHeight();
1319 if (w>940*h/660)
1320 w = 940*h/660;
1321 else
1322 h = 660*w/940;
1323 Resize(w, h);
1324 }
1325 return kTRUE;
1326 case kLogClear:
1327 fLog->Clear();
1328 return kTRUE;
1329 case kLogCopy:
1330 fLog->Copy();
1331 return kTRUE;
1332 case kLogSelect:
1333 fLog->SelectAll();
1334 return kTRUE;
1335 case kLogSearch:
1336 //virtual Bool_t Search(const char *string, Bool_t direction, Bool_t caseSensitive);
1337 return kTRUE;
1338 case kLogSave:
1339 cout << "Saving log... " << flush;
1340 if (fLog->GetText()->Save("cosylog.txt"))
1341 cout << "done." << endl;
1342 else
1343 cout << "failed!" << endl;
1344 return kTRUE;
1345
1346 case kLogAppend:
1347 cout << "Appending log... " << flush;
1348 if (fLog->GetText()->Append("cosylog.txt"))
1349 cout << "done." << endl;
1350 else
1351 cout << "failed!" << endl;
1352 return kTRUE;
1353 }
1354 return kTRUE;
1355 }
1356 }
1357
1358 //
1359 // Start a thread to process the message.
1360 //
1361 // fQueue->PostMsg(msg, mp1, mp2);
1362 return kTRUE;
1363
1364}
Note: See TracBrowser for help on using the repository browser.