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