Changeset 918 for trunk/MagicSoft/Cosy/gui
- Timestamp:
- 08/29/01 11:23:55 (24 years ago)
- Location:
- trunk/MagicSoft/Cosy/gui
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGAccuracy.cc
r913 r918 58 58 line.DrawLine( 0, -65*4, 0, 65*4); 59 59 60 // 61 // Can be replaced by TGaxis axe; in a later root version 62 // than 3.01/06. I talked to Rene 63 // 60 64 TGaxis *axe; 61 65 axe = new TGaxis(-60*4, 0, 60*4, 0, -4, 4, 30204, "+-N"); … … 175 179 MGAccuracy::~MGAccuracy() 176 180 { 177 cout << "MGAccuracy destroyed." << endl; 178 } 179 180 void MGAccuracy::UpdateText(Float_t x, Float_t y) 181 { 182 /* 183 int xs = (int)floor(fmod(fabs(x), 60.)); 184 int ys = (int)floor(fmod(fabs(y), 60.)); 185 x /= 60.; 186 y /= 60.; 187 int xm = (int)floor(fmod(fabs(x), 60.)); 188 int ym = (int)floor(fmod(fabs(y), 60.)); 189 190 char tx[100]; 191 char ty[100]; 192 193 xm ? sprintf(tx, "%d'%02d\"", xm, xs) : sprintf(tx, "%d\"", xs); 194 ym ? sprintf(ty, "%d'%02d\"", ym, ys) : sprintf(ty, "%d\"", ys); 195 196 char txt[200]; 197 sprintf(txt, "%s / %s", tx, ty); 198 */ 199 200 // FIXME: We are on a sphere 201 202 float r = sqrt(x*x+y*y); 203 204 int rs = (int)floor(fmod(r, 60.)); 205 r /= 60.; 206 int rm = (int)floor(fmod(r, 60.)); 181 // cout << "MGAccuracy destroyed." << endl; 182 } 183 184 void MGAccuracy::UpdateText(Float_t pzd, Float_t azd, Float_t aaz) 185 { 186 const Float_t d2r = TMath::Pi()/360.; 187 188 pzd *= d2r; 189 azd *= d2r; 190 aaz *= d2r; 191 192 const float dphi2 = aaz/2.; 193 const float cos2 = cos(dphi2)*cos(dphi2); 194 const float sin2 = sin(dphi2)*sin(dphi2); 195 196 float dist = acos(cos(azd)*cos2 - cos(2*pzd+azd)*sin2); 197 198 dist *= 3600./d2r; 199 200 int rs = (int)floor(fmod(dist, 60.)); 201 dist /= 60.; 202 int rm = (int)floor(fmod(dist, 60.)); 207 203 208 204 char txt[100]; … … 227 223 } 228 224 229 void MGAccuracy::Update(ZdAz & zdaz)225 void MGAccuracy::Update(ZdAz &pos, ZdAz &acc) 230 226 { 231 227 // … … 235 231 static int Y = ~0; 236 232 237 float x = zdaz.Az()*3600.; // ["]238 float y = zdaz.Zd()*3600.; // ["]233 float x = acc.Az()*3600.; // ["] 234 float y = acc.Zd()*3600.; // ["] 239 235 240 236 int pixx = (int)(x/fPix); // [pix] … … 248 244 249 245 UpdateCross(x, y); 250 UpdateText( x, y);246 UpdateText(pos.Zd(), acc.Az(), acc.Zd()); 251 247 252 248 SetModified(); -
trunk/MagicSoft/Cosy/gui/MGAccuracy.h
r913 r918 32 32 void InitCross(); 33 33 34 void UpdateText(Float_t x, Float_t y);34 void UpdateText(Float_t zd, Float_t x, Float_t y); 35 35 void UpdateCross(Float_t x, Float_t y); 36 36 … … 39 39 ~MGAccuracy(); 40 40 41 void Update(ZdAz &pos );41 void Update(ZdAz &pos, ZdAz &acc); 42 42 }; 43 43 -
trunk/MagicSoft/Cosy/gui/MGCoordinate.cc
r808 r918 126 126 MGCoordinate::~MGCoordinate() 127 127 { 128 cout << "MGCoordinate destroyed." << endl;128 // cout << "MGCoordinate destroyed." << endl; 129 129 } 130 130 -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r913 r918 1 1 #include "MGCosy.h" 2 2 3 #include <iostream.h> 4 3 5 #include "msgqueue.h" 4 6 5 7 #include <TROOT.h> 6 8 9 #include <TGTab.h> // TGTab 7 10 #include <TGMenu.h> // TGPopupMenu 8 11 #include <TGButton.h> // TGButton … … 10 13 #include <TGLabel.h> // TGLabel 11 14 #include <TG3DLine.h> // TGHorizontal3DLine (TGSplitter) 15 #include <TGFrame.h> // TGGroupFrame 12 16 #include <TApplication.h> // gApplication 13 17 … … 31 35 #define kPB_CALCALTAZ 0x1004 32 36 #define kPB_POLARIS 0x1005 37 #define kPB_START 0x1006 33 38 34 39 #define kEF_A 0x1010 … … 43 48 // crate the menu bar 44 49 // 45 TGPopupMenu *fFileMenu = new TGPopupMenu( fClient->GetRoot());50 TGPopupMenu *fFileMenu = new TGPopupMenu(gClient->GetRoot()); 46 51 fFileMenu->AddEntry ("Exit", IDM_EXIT) ; 47 fFileMenu->Associate(this);52 //fFileMenu->Associate(this); 48 53 fList->Add(fFileMenu); 49 54 … … 53 58 TGMenuBar *fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame); 54 59 fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem); 55 AddFrame(fMenuBar );60 AddFrame(fMenuBar, fLayMenuBar); 56 61 fList->Add(fMenuBar); 57 62 58 63 // 59 // Seperator beyonf menubar 60 // 64 // Seperator beyond menubar 65 // 66 61 67 TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this); 62 68 AddFrame(fLineSep, fLayMenuBar); 63 69 fList->Add(fLineSep); 64 65 } 66 67 void MGCosy::CreateLabel() 68 { 70 } 71 72 void MGCosy::CreateLabel(TGCompositeFrame *f) 73 { 74 const int y = 25; 75 const int x = 180; 76 69 77 fLabel1 = new TGLabel*[3]; 70 fLabel1[0] = new TGLabel(this, "00000"); // Max: 16384 78 fLabel1[0] = new TGLabel(f, "00000"); // Max: 16384 79 fLabel1[1] = new TGLabel(f, "000"); // Max: 256 80 fLabel1[2] = new TGLabel(f, "000"); // Max: 256 71 81 fLabel1[0]->SetTextJustify(kTextRight); 72 fLabel1[0]->Move(5, 40); 82 fLabel1[1]->SetTextJustify(kTextRight); 83 fLabel1[2]->SetTextJustify(kTextRight); 84 fLabel1[0]->Move(x, y); 85 fLabel1[1]->Move(x+43, y); 86 fLabel1[2]->Move(x+70, y); 73 87 fList->Add(fLabel1[0]); 74 // AddFrame(fLabel1[0], new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));75 fLabel1[1] = new TGLabel(this, "000"); // Max: 25676 fLabel1[1]->SetTextJustify(kTextRight);77 fLabel1[1]->Move(48, 40);78 88 fList->Add(fLabel1[1]); 79 // AddFrame(fLabel1[1], new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));80 fLabel1[2] = new TGLabel(this, "000"); // Max: 25681 fLabel1[2]->SetTextJustify(kTextRight);82 fLabel1[2]->Move(75, 40);83 89 fList->Add(fLabel1[2]); 84 // AddFrame(fLabel1[2], new TGLayoutHints(kLHintsNormal, 9, 9, 9, 9)); 90 //f->AddFrame(fLabel1[0]); 91 //f->AddFrame(fLabel1[1]); 92 //f->AddFrame(fLabel1[2]); 85 93 86 94 fLabel2 = new TGLabel*[3]; 87 fLabel2[0] = new TGLabel(this, "00000"); 95 fLabel2[0] = new TGLabel(f, "00000"); 96 fLabel2[1] = new TGLabel(f, "000"); 97 fLabel2[2] = new TGLabel(f, "000"); 88 98 fLabel2[0]->SetTextJustify(kTextRight); 89 fLabel2[0]->Move(5, 60); 99 fLabel2[1]->SetTextJustify(kTextRight); 100 fLabel2[2]->SetTextJustify(kTextRight); 101 fLabel2[0]->Move(x, y+20); 102 fLabel2[1]->Move(x+43, y+20); 103 fLabel2[2]->Move(x+70, y+20); 90 104 fList->Add(fLabel2[0]); 91 // AddFrame(fLabel2[0], new TGLayoutHints); //(kLHintsNormal, 0, 0, 0, 0));92 fLabel2[1] = new TGLabel(this, "000");93 fLabel2[1]->SetTextJustify(kTextRight);94 fLabel2[1]->Move(48, 60);95 105 fList->Add(fLabel2[1]); 96 // AddFrame(fLabel2[1], new TGLayoutHints); //(kLHintsNormal, 1, 0, 0, 0));97 fLabel2[2] = new TGLabel(this, "000");98 fLabel2[2]->SetTextJustify(kTextRight);99 fLabel2[2]->Move(75, 60);100 106 fList->Add(fLabel2[2]); 101 // AddFrame(fLabel2[2], new TGLayoutHints); //(kLHintsNormal, 2, 0, 0, 0)); 107 //f->AddFrame(fLabel2[0]); 108 //f->AddFrame(fLabel2[1]); 109 //f->AddFrame(fLabel2[2]); 102 110 103 111 fLabel3 = new TGLabel*[3]; 104 fLabel3[0] = new TGLabel(this, "00000"); 112 fLabel3[0] = new TGLabel(f, "00000"); 113 fLabel3[1] = new TGLabel(f, "000"); 114 fLabel3[2] = new TGLabel(f, "000"); 105 115 fLabel3[0]->SetTextJustify(kTextRight); 106 fLabel3[0]->Move(5, 80); 116 fLabel3[1]->SetTextJustify(kTextRight); 117 fLabel3[2]->SetTextJustify(kTextRight); 118 fLabel3[0]->Move(x, y+40); 119 fLabel3[1]->Move(x+43, y+40); 120 fLabel3[2]->Move(x+70, y+40); 107 121 fList->Add(fLabel3[0]); 108 // AddFrame(fLabel3[0]); //, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));109 fLabel3[1] = new TGLabel(this, "000");110 fLabel3[1]->SetTextJustify(kTextRight);111 fLabel3[1]->Move(48, 80);112 122 fList->Add(fLabel3[1]); 113 // AddFrame(fLabel3[1]); //, new TGLayoutHints(kLHintsNormal, 1, 0, 0, 0));114 fLabel3[2] = new TGLabel(this, "000");115 fLabel3[2]->SetTextJustify(kTextRight);116 fLabel3[2]->Move(75, 80);117 123 fList->Add(fLabel3[2]); 118 // AddFrame(fLabel3[2]); //, new TGLayoutHints(kLHintsNormal, 2, 0, 0, 0)); 119 } 120 121 void MGCosy::CreateButton() 122 { 123 TGTextButton *fButton1 = new TGTextButton(this, "Position Zd/Az", kPB_POSITION); 124 TGTextButton *fButton2 = new TGTextButton(this, "Track Ra/Dec", kPB_TRACK); 125 TGTextButton *fButton3 = new TGTextButton(this, "Stop", kPB_STOP); 126 TGTextButton *fButton4 = new TGTextButton(this, "Calc Zd/Az", kPB_CALCALTAZ); 127 TGTextButton *fButton5 = new TGTextButton(this, "Set Polaris", kPB_POLARIS); 128 fButton1->Move(110, 40); 129 fButton2->Move(110, 65); 130 fButton3->Move(260, 90); 131 fButton4->Move(110, 90); 132 fButton5->Move(110, 115); 133 fButton1->SetToolTipText("Move Telescope to Zd/Az position."); 134 fButton2->SetToolTipText("Track the coordinates given in Ra/Dec."); 135 fButton3->SetToolTipText("Stop movement of telescope."); 124 //f->AddFrame(fLabel3[0]); 125 //f->AddFrame(fLabel3[1]); 126 //f->AddFrame(fLabel3[2]); 127 128 129 fError = new TGLabel(f, "Error"); 130 fMoving = new TGLabel(f, "Moving"); 131 fTracking = new TGLabel(f, "Tracking"); 132 fStopping = new TGLabel(f, "Stopping"); 133 fStopped = new TGLabel(f, "Stopped"); 134 135 fError ->SetBackgroundColor(224); // red 136 fMoving ->SetBackgroundColor(10); // blue 137 fTracking->SetBackgroundColor(47); // blue 138 fStopping->SetBackgroundColor(164); // orange 139 fStopped ->SetBackgroundColor(20); // green 140 141 fError ->Move(10, 25); 142 fMoving ->Move(10, 25+20); 143 fTracking->Move(10, 25+40); 144 fStopping->Move(10, 25+60); 145 fStopped ->Move(10, 25+80); 146 147 fError ->Resize(60, 20); 148 fMoving ->Resize(60, 20); 149 fTracking->Resize(60, 20); 150 fStopping->Resize(60, 20); 151 fStopped ->Resize(60, 20); 152 153 fList->Add(fError); 154 fList->Add(fMoving); 155 fList->Add(fTracking); 156 fList->Add(fStopping); 157 fList->Add(fStopped); 158 } 159 160 void MGCosy::CreateButton(TGCompositeFrame *tf1, TGCompositeFrame *tf2) 161 { 162 const int x=15; 163 const int y=12; 164 const int h=16; 165 166 TGLabel *l1 = new TGLabel(tf1, "Move the telescope to a position given in"); 167 TGLabel *l2 = new TGLabel(tf1, "local coordinates. The given coordinates"); 168 TGLabel *l3 = new TGLabel(tf1, "are pointing coordinates, which means that the"); 169 TGLabel *l4 = new TGLabel(tf1, "coordinates are corrected for the bending of"); 170 TGLabel *l5 = new TGLabel(tf1, "the telescope."); 171 l1->Move(x, y); 172 l2->Move(x, y+h); 173 l3->Move(x, y+2*h); 174 l4->Move(x, y+3*h); 175 l5->Move(x, y+4*h); 176 fList->Add(l1); 177 fList->Add(l2); 178 fList->Add(l3); 179 fList->Add(l4); 180 fList->Add(l5); 181 182 l1 = new TGLabel(tf2, "Track a position given in sky coordinates."); 183 l2 = new TGLabel(tf2, "Right Ascension and declination must be given"); 184 l3 = new TGLabel(tf2, "in the FK5, J2000 coordinate system"); 185 l1->Move(x, y); 186 l2->Move(x, y+h); 187 l3->Move(x, y+2*h); 188 fList->Add(l1); 189 fList->Add(l2); 190 fList->Add(l3); 191 192 // 193 // light green: 3 light red: 2 blue?: 2 194 // dark green: 8 dark red: 50 dark blue?: 1 195 196 // 197 // blue: 0-7, 9, 10,11, 14, 15, 18, 19, 22, 23, 27, 31, 33-39, 41-43 198 // 46, 47 199 // green: 8, 12,13, 16, 17, 20, 21, 24, 25, 26, 28, 29, 30, 40, 44 200 // 45, 48 201 // gray: 31, 113- 202 // red: 164, 192, 224, 232 203 // 204 205 // TGTextButton *fButton1 = new TGTextButton(this, "Position Zd/Az", kPB_POSITION); 206 // TGTextButton *fButton2 = new TGTextButton(this, "Track Ra/Dec", kPB_TRACK); 207 TGTextButton *fButton4 = new TGTextButton(this, "Calc Zd/Az", kPB_CALCALTAZ); 208 TGTextButton *fButton5 = new TGTextButton(this, "Set Polaris", kPB_POLARIS); 209 // fButton1->Move(120, 40); 210 // fButton2->Move(120, 65); 211 fButton4->Resize(80, 25); 212 fButton5->Resize(80, 25); 213 214 fButton4->Move(40, 257); 215 fButton5->Move(40, 288); 216 //fButton4->SetBackgroundColor(12); 217 //fButton5->SetBackgroundColor(16); 218 // fButton1->SetToolTipText("Move Telescope to Zd/Az position."); 219 // fButton2->SetToolTipText("Track the coordinates given in Ra/Dec."); 136 220 fButton4->SetToolTipText("Calculate Zd/Az corresponding to Ra/Dec."); 137 221 fButton5->SetToolTipText("Set the actual position as the position of Polaris."); 138 fList->Add(fButton1); 139 fList->Add(fButton2); 140 fList->Add(fButton3); 222 // fList->Add(fButton1); 223 // fList->Add(fButton2); 141 224 fList->Add(fButton4); 142 225 fList->Add(fButton5); 226 227 TGTextButton *fStart = new TGTextButton(this, "Start", kPB_START); 228 TGTextButton *fStop = new TGTextButton(this, "Stop", kPB_STOP); 229 fStart->SetBackgroundColor(20); 230 fStop ->SetBackgroundColor(224); 231 fStart->Move(147, 275); 232 fStop ->Move(212, 275); 233 fStart->Resize(60, 25); 234 fStop ->Resize(60, 25); 235 fStart->SetToolTipText("Start a telescope movement."); 236 fStop ->SetToolTipText("Stop any movement of telescope."); 237 fList->Add(fStart); 238 fList->Add(fStop); 143 239 } 144 240 … … 149 245 150 246 CreateMenu(); 151 CreateLabel(); 152 CreateButton(); 153 247 248 TGCompositeFrame *f = new TGCompositeFrame(this, 0, 0); 249 f->SetLayoutManager(new TGMatrixLayout(f, 3, 2, 10)); 250 fList->Add(f); 251 252 fTab = new TGTab(f, 300, 300); 253 TGCompositeFrame *tf1 = fTab->AddTab("Position Zd/Az"); 254 TGCompositeFrame *tf2 = fTab->AddTab("Track Ra/Dec"); 255 fList->Add(fTab); 256 257 fSkyPosition = new MGSkyPosition(f, 300); 258 fAccuracy = new MGAccuracy (f, 300); 259 fVelocity = new MGVelocity (f, "Velocity ['/min]", 300); 260 fOffset = new MGVelocity (f, "Offset se-re [']", 300); 261 262 fList->Add(fSkyPosition); 263 fList->Add(fAccuracy); 264 fList->Add(fVelocity); 265 fList->Add(fOffset); 266 267 TGGroupFrame *frame = new TGGroupFrame(f, "Status"); 268 frame->Resize(300, 300); 269 fList->Add(frame); 270 271 // 272 // Layout the window, tile by tile... 273 // 274 f->AddFrame(fTab); 275 f->AddFrame(fSkyPosition); 276 f->AddFrame(fAccuracy); 277 f->AddFrame(frame); 278 f->AddFrame(fVelocity); 279 f->AddFrame(fOffset); 280 281 AddFrame(f, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 1, 0)); 282 283 // 284 // FIXME! 285 // 154 286 fCoord = new MGCoordinates(this, kTRUE, 155 287 "Coordinate 1 [\xb0]:", "Coordinate 2 [\xb0]:"); 156 fCoord->Move( 10, 160);288 fCoord->Move(40, 165); 157 289 fList->Add(fCoord); 158 290 159 fSkyPosition = new MGSkyPosition(this, 300); 160 fSkyPosition->Move(320, 40); 161 fList->Add(fSkyPosition); 162 163 fAccuracy = new MGAccuracy(this, 300); 164 fAccuracy->Move(320, 360); 165 fList->Add(fAccuracy); 166 167 fVelocity = new MGVelocity(this, "Velocity ['/min]", 300); 168 fVelocity->Move(10, 360); 169 fList->Add(fVelocity); 170 171 fOffset = new MGVelocity(this, "Offset se-re [']", 300); 172 fOffset->Move(630, 360); 173 fList->Add(fOffset); 291 CreateButton(tf1, tf2); 292 CreateLabel(frame); 174 293 175 294 // 176 295 // Map the window, set up the layout, etc. 177 296 // 178 const Int_t w = 650+310;179 const Int_t h = 6 90;297 const Int_t w = 940; 298 const Int_t h = 660; 180 299 SetWMSizeHints(w, h, w, h, 10, 10); // set the smallest and biggest size of the Main frame 181 182 MapSubwindows();183 Layout();184 300 185 301 SetWindowName("Cosy Main Window"); 186 302 SetIconName("Cosy"); 187 303 304 MapSubwindows(); 305 Resize(GetDefaultSize()); 188 306 MapWindow(); 189 307 } … … 193 311 MGCosy::~MGCosy() 194 312 { 195 cout << " Deleting MGCosy." << endl;313 cout << "MGCosy::~MGCosy called." << endl; 196 314 197 315 delete fLayMenuBar; … … 202 320 delete fList; 203 321 204 cout << "MGCosy deleted." << endl;322 cout << "MGCosy::~MGCosy done." << endl; 205 323 } 206 324 // ====================================================================== 207 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off) 325 void MGCosy::EnableLabel(TGLabel *label, Bool_t stat) 326 { 327 stat ? label->MapWindow() : label->UnmapWindow(); 328 329 /* 330 TGGC *fRedTextGC(TGButton::GetDefaultGC()) 331 // Set foreground color in graphics context for drawing of 332 // TGlabel and TGButtons with text in red. 333 ULong_t red; 334 gClient->GetColorByName("red", red); 335 fRedTextGC.SetForeground(red); 336 */ 337 } 338 339 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, UInt_t stat) 208 340 { 209 341 fSkyPosition->Update(pos); 210 fAccuracy->Update( acc);342 fAccuracy->Update(pos, acc); 211 343 fVelocity->Update(vel); 212 344 fOffset->Update(off); 345 346 #define kError 0x01 347 #define kMoving 0x02 348 #define kTracking 0x04 349 #define kStopping 0x08 350 #define kStopped 0x10 351 352 EnableLabel(fError, stat&kError); 353 EnableLabel(fMoving, stat&kMoving); 354 EnableLabel(fTracking, stat&kTracking); 355 EnableLabel(fStopping, stat&kStopping); 356 EnableLabel(fStopped, stat&kStopped); 357 358 stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow(); 359 stat&kTracking ? fVelocity->MapWindow() : fVelocity->UnmapWindow(); 360 stat&kTracking ? fOffset->MapWindow() : fOffset->UnmapWindow(); 213 361 } 214 362 // ====================================================================== … … 221 369 // window menu item is selected. 222 370 223 //gSystem->ExitLoop(); 224 // gSystem->DispatchOneEvent(kTRUE); 225 226 // TGMainFrame::CloseWindow(); 227 gApplication->Terminate(0); 228 } 229 230 #include <iostream.h> 371 // gSystem->ExitLoop(); 372 // gSystem->DispatchOneEvent(kTRUE); 373 374 // TGMainFrame::CloseWindow(); 375 fQueue->PostMsg(WM_QUIT, 0, 0); 376 // gApplication->Terminate(0); 377 } 378 379 void MGCosy::Start(UInt_t id) 380 { 381 cout << "Start " << (id?"tracking.":"positioning.") << endl; 382 383 XY xy = fCoord->GetCoordinates(); 384 385 if (id) 386 { 387 RaDec dest(xy.X(), xy.Y()); 388 cout << dest.Ra() << kDEG << " " << dest.Dec() << kDEG << endl; 389 fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest)); 390 } 391 else 392 { 393 ZdAz dest(xy.X(), xy.Y()); 394 cout << dest.Zd() << kDEG << " " << dest.Az() << kDEG << endl; 395 fQueue->PostMsg(WM_POSITION, &dest, sizeof(dest)); 396 } 397 398 cout << "PostMsg (" << (id?"WM_Track":"WM_Position") << ") returned." << endl; 399 } 231 400 232 401 Bool_t MGCosy::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2) … … 240 409 switch (GET_SUBMSG(msg)) 241 410 { 411 case kCM_TAB: 412 //cout << "Tab: " << mp1 << endl; 413 return kTRUE; 414 242 415 case kCM_BUTTON: 243 416 … … 245 418 { 246 419 case kPB_POSITION: 247 cout << "Start positioning." << endl; 248 { 249 XY xy = fCoord->GetCoordinates(); 250 ZdAz dest(xy.X(), xy.Y()); 251 cout << dest.Zd() << kDEG << " " << dest.Az() << kDEG << endl; 252 fQueue->PostMsg(WM_POSITION, &dest, sizeof(dest)); 253 } 254 cout << "PostMsg(WM_POSITION) returned." << endl; 420 Start(0); 255 421 return kTRUE; 256 422 257 423 case kPB_TRACK: 258 cout << "Start tracking." << endl; 259 { 260 XY xy = fCoord->GetCoordinates(); 261 RaDec dest(xy.X(), xy.Y()); 262 cout << dest.Ra() << kDEG << " " << dest.Dec() << kDEG << endl; 263 fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest)); 264 } 265 cout << "PostMsg(WM_TRACK) returned." << endl; 424 Start(1); 425 return kTRUE; 426 427 case kPB_START: 428 Start(fTab->GetCurrent()); 266 429 return kTRUE; 267 430 … … 269 432 cout << "Sending stop movement msg." << endl; 270 433 fQueue->PostMsg(WM_STOP, 0, 0); 271 cout << "PostMsg (WM_STOP) returned." << endl;434 cout << "PostMsg (WM_Stop) returned." << endl; 272 435 return kTRUE; 273 436 … … 293 456 return kTRUE; 294 457 } 295 break;458 return kTRUE; 296 459 297 460 case kCM_MENU: … … 300 463 { 301 464 case IDM_EXIT: 302 cout << "Idm_Exit." << endl; 303 CloseWindow(); 304 return kTRUE; 305 306 default: 465 fQueue->PostMsg(WM_QUIT, 0, 0); 466 //cout << "Idm_Exit." << endl; 467 //CloseWindow(); 307 468 return kTRUE; 308 469 } 309 470 return kTRUE; 310 311 default:312 return kTRUE;313 471 } 314 315 default:316 return kTRUE;317 472 } 318 473 -
trunk/MagicSoft/Cosy/gui/MGCosy.h
r913 r918 31 31 class MGAccuracy; 32 32 class MGVelocity; 33 class TGCompositeFrame; 34 class TGTab; 33 35 34 36 class MGCosy : public TGMainFrame … … 56 58 MsgQueue *fQueue; 57 59 60 TGTab *fTab; 61 62 TGLabel *fError; 63 TGLabel *fMoving; 64 TGLabel *fTracking; 65 TGLabel *fStopping; 66 TGLabel *fStopped; 67 58 68 void CreateMenu(); 59 void CreateLabel(); 60 void CreateButton(); 69 void CreateLabel(TGCompositeFrame *f); 70 void CreateButton(TGCompositeFrame *tf1, TGCompositeFrame *tf2); 71 72 void Start(UInt_t id); 73 74 void EnableLabel(TGLabel *label, Bool_t stat); 61 75 62 76 public: … … 70 84 TGLabel **GetLabel3() { return fLabel3; } 71 85 72 void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off );86 void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, UInt_t stat); 73 87 74 88 Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2); -
trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc
r913 r918 12 12 MGEmbeddedCanvas::MGEmbeddedCanvas(const char *name, const TGWindow* p, 13 13 const UInt_t width, Float_t range) 14 : TRootEmbeddedCanvas(name, p, width , width, kRaisedFrame),//, 0) //234, 76, kFixedSize)14 : TRootEmbeddedCanvas(name, p, width+1, width+1, kRaisedFrame),//, 0) //234, 76, kFixedSize) 15 15 fModified(kFALSE), fWidth(width), fRange(range), fPix(2.*range/width) 16 16 { … … 33 33 MapSubwindows(); 34 34 35 Resize(fWidth -1, fWidth-1); //GetDefaultSize()); // ???35 Resize(fWidth, fWidth); //GetDefaultSize()); // ??? 36 36 MapWindow(); 37 37 … … 44 44 return; 45 45 46 // 46 47 // FIXME: Sometimes (if the canvas couldn't be created correctly: 47 48 // X11 Pixmap error) Update hangs the Gui system. 49 // 50 // Fixed: Using root 3.01/06 and doing the update from within the 51 // mainthread. 52 // 48 53 49 54 fCanvas->Modified(); -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
r913 r918 98 98 { 99 99 fText = new TText(105, 105, ""); 100 fText->SetFillStyle(4000); // transparent100 //fText->SetFillStyle(4000); // transparent 101 101 fText->SetTextAlign(33); // right, top 102 102 fText->SetTextColor(10); // white … … 323 323 return; 324 324 325 cout << "Sun: x=" << x << " y=" << y;326 cout << " Zd=" << deg << " Az=" << 360./D2PI*zdaz.Az() << endl;325 // cout << "Sun: x=" << x << " y=" << y; 326 // cout << " Zd=" << deg << " Az=" << 360./D2PI*zdaz.Az() << endl; 327 327 328 328 fSunL[0]->SetX1(x-3.5); fSunL[0]->SetX2(x+3.5); -
trunk/MagicSoft/Cosy/gui/MGVelocity.cc
r913 r918 109 109 line.DrawLine( 0, -65*2, 0, 65*2); 110 110 111 // 112 // Can be replaced by TGaxis axe; in a later root version 113 // than 3.01/06. I talked to Rene 114 // 111 115 TGaxis *axe; 112 116 axe = new TGaxis(-60*2, 0, 60*2, 0, -2, 2, 304, "+-N"); … … 179 183 MGVelocity::~MGVelocity() 180 184 { 181 delete fList;182 183 185 delete fOld; 184 186 delete fAvg; 185 187 186 cout << "MGVelocity destroyed." << endl;188 // cout << "MGVelocity destroyed." << endl; 187 189 } 188 190 … … 270 272 // static int Y = 0xaffe; 271 273 272 float x = zdaz.Az()*3600. *4;273 float y = zdaz.Zd()*3600. *4;274 float x = zdaz.Az()*3600.; 275 float y = zdaz.Zd()*3600.; 274 276 275 277 int pixx = (int)(x*fScale/fPix);
Note:
See TracChangeset
for help on using the changeset viewer.