Changeset 1690 for trunk/MagicSoft/Cosy/gui
- Timestamp:
- 12/18/02 17:48:44 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy/gui
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r1531 r1690 30 30 #include "SlaStars.h" 31 31 32 #undef DEBUG 33 32 34 ClassImp(MGCosy); 33 35 34 #define IDM_EXIT 1 35 #define IDM_TEXT 2 36 #define IDM_EXIT 1 37 #define IDM_TEXT 2 38 #define IDM_ASPECT 3 36 39 37 40 enum … … 60 63 // 61 64 TGPopupMenu *fFileMenu = new TGPopupMenu(gClient->GetRoot()); 65 fFileMenu->AddEntry("Set Aspect", IDM_ASPECT); 62 66 fFileMenu->AddEntry("Exit", IDM_EXIT); 63 67 fFileMenu->Associate(this); … … 477 481 fList = new MGList; 478 482 483 #ifdef DEBUG 479 484 cout << "MGCosy: Creating Menu" << endl; 485 #endif 480 486 CreateMenu(); 481 487 488 #ifdef DEBUG 482 489 cout << "MGCosy: Creating TGCompositeFrame" << endl; 483 TGCompositeFrame *f = new TGCompositeFrame(this, 0, 0); 484 f->SetLayoutManager(new TGMatrixLayout(f, 3, 2, 10)); 485 fList->Add(f); 486 490 #endif 491 TGHorizontalFrame *f1 = new TGHorizontalFrame(this, 0, 0); 492 TGHorizontalFrame *f2 = new TGHorizontalFrame(this, 0, 0); 493 fList->Add(f1); 494 fList->Add(f2); 495 496 #ifdef DEBUG 487 497 cout << "MGCosy: Creating TGTab" << endl; 488 fTab = new TGTab(f, 300, 300); 498 #endif 499 fTab = new TGTab(f1, 300, 300); 489 500 fList->Add(fTab); 490 501 502 #ifdef DEBUG 491 503 cout << "MGCosy: Creating MGSkyPosition" << endl; 492 fSkyPosition = new MGSkyPosition(f, 300); 504 #endif 505 fSkyPosition = new MGSkyPosition(f1, 300); 506 #ifdef DEBUG 493 507 cout << "MGCosy: Creating MGAccuracy" << endl; 494 fAccuracy = new MGAccuracy (f, 300); 508 #endif 509 fAccuracy = new MGAccuracy (f1, 300); 510 #ifdef DEBUG 495 511 cout << "MGCosy: Creating MGVelocity" << endl; 496 fVelocity = new MGVelocity (f, "Velocity [\"/min]", 300); 512 #endif 513 fVelocity = new MGVelocity (f2, "Velocity [\"/min]", 300); 497 514 // fOffset = new MGVelocity (f, "Offset se-re [']", 300); 498 515 … … 502 519 // fList->Add(fOffset); 503 520 521 #ifdef DEBUG 504 522 cout << "MGCosy: Creating TGGroupFrame" << endl; 505 TGGroupFrame *frame = new TGGroupFrame(f, "Status"); 523 #endif 524 TGGroupFrame *frame = new TGGroupFrame(f2, "Status"); 506 525 frame->Resize(300, 300); 507 526 fList->Add(frame); 508 527 528 #ifdef DEBUG 509 529 cout << "MGCosy: Creating TGListBox" << endl; 510 fLog = new TGListBox(f, -1, kSunkenFrame); //kSunkenFrame|kDoubleBorder, 530 #endif 531 fLog = new TGListBox(f2, -1, kSunkenFrame); //kSunkenFrame|kDoubleBorder, 511 532 fLog->Resize(300, 300); 512 533 fLog->ChangeBackground(TGFrame::GetBlackPixel()); 513 534 fList->Add(fLog); 514 535 515 // 516 // Layout the window, tile by tile... 517 // 518 f->AddFrame(fTab); 519 f->AddFrame(fSkyPosition); 520 f->AddFrame(fAccuracy); 521 f->AddFrame(frame); 522 f->AddFrame(fVelocity); 523 f->AddFrame(fLog); 524 525 AddFrame(f, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 1, 0)); 536 TGLayoutHints *hints1 = new TGLayoutHints(kLHintsNormal | kLHintsExpandX|kLHintsExpandY, 6, 6, 6, 3); 537 TGLayoutHints *hints2 = new TGLayoutHints(kLHintsNormal | kLHintsExpandX|kLHintsExpandY, 6, 6, 3, 6); 538 TGLayoutHints *hints1a = new TGLayoutHints(kLHintsLeft | kLHintsTop |kLHintsExpandX|kLHintsExpandY); 539 TGLayoutHints *hints2a = new TGLayoutHints(kLHintsCenterY | kLHintsTop |kLHintsExpandX|kLHintsExpandY, 6, 6); 540 TGLayoutHints *hints3a = new TGLayoutHints(kLHintsRight | kLHintsTop |kLHintsExpandX|kLHintsExpandY); 541 TGLayoutHints *hints1b = new TGLayoutHints(kLHintsLeft | kLHintsBottom|kLHintsExpandX|kLHintsExpandY); 542 TGLayoutHints *hints2b = new TGLayoutHints(kLHintsCenterY | kLHintsBottom|kLHintsExpandX|kLHintsExpandY, 6, 6); 543 TGLayoutHints *hints3b = new TGLayoutHints(kLHintsRight | kLHintsBottom|kLHintsExpandX|kLHintsExpandY); 544 545 fList->Add(hints1); 546 fList->Add(hints2); 547 fList->Add(hints1a); 548 fList->Add(hints2a); 549 fList->Add(hints3a); 550 fList->Add(hints1b); 551 fList->Add(hints2b); 552 fList->Add(hints3b); 553 554 // Layout upper frame 555 f1->AddFrame(fTab, hints1a); 556 f1->AddFrame(fSkyPosition, hints2a); 557 f1->AddFrame(fAccuracy, hints3a); 558 559 // Layout upper frame 560 f2->AddFrame(frame, hints1b); 561 f2->AddFrame(fVelocity, hints2b); 562 f2->AddFrame(fLog, hints3b); 563 564 // Layout window 565 AddFrame(f1, hints1); 566 AddFrame(f2, hints2); 526 567 527 568 // 528 569 // FIXME! 529 570 // 571 #ifdef DEBUG 530 572 cout << "MGCosy: Creating Tabs" << endl; 573 #endif 531 574 CreateTabs(fTab); 575 #ifdef DEBUG 532 576 cout << "MGCosy: Creating Label" << endl; 577 #endif 533 578 CreateLabel(frame); 534 579 … … 536 581 // Map the window, set up the layout, etc. 537 582 // 583 #ifdef DEBUG 538 584 cout << "MGCosy: Setting Size" << endl; 585 #endif 539 586 const Int_t w = 940; 540 587 const Int_t h = 660; 541 SetWMSizeHints(w, h, w, h, 10, 10); // set the smallest and biggest size of the Main frame588 SetWMSizeHints(w, h, 1280, 900, 10, 10); // set the smallest and biggest size of the Main frame 542 589 543 590 SetWindowName("Cosy Main Window"); 544 591 SetIconName("Cosy"); 545 592 593 #ifdef DEBUG 546 594 cout << "MGCosy: Map Window" << endl; 595 #endif 547 596 MapSubwindows(); 548 Resize( GetDefaultSize());597 Resize(w, h); //GetDefaultSize()); 549 598 MapWindow(); 550 599 } … … 930 979 //CloseWindow(); 931 980 return kTRUE; 981 case IDM_ASPECT: 982 Int_t w = GetWidth(); 983 Int_t h = GetHeight(); 984 if (w>940*h/660) 985 w = 940*h/660; 986 else 987 h = 660*w/940; 988 Resize(w, h); 989 return kTRUE; 932 990 } 933 991 return kTRUE; -
trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc
r1275 r1690 12 12 #include <TCanvas.h> 13 13 14 #undef DEBUG 15 14 16 ClassImp(MGEmbeddedCanvas); 15 17 … … 19 21 fModified(kFALSE), fWidth(width), fRange(range), fPix(2.*range/width) 20 22 { 23 #ifdef DEBUG 21 24 cout << "MGEmbeddedCanvas: Initializing." << endl; 25 #endif 26 22 27 fCanvas = GetCanvas(); 23 28 29 #ifdef DEBUG 24 30 cout << "MGEmbeddedCanvas: fCanvas = 0x" << fCanvas << endl; 25 31 26 32 cout << "MGEmbeddedCanvas: SetFillColor." << endl; 33 #endif 27 34 fCanvas->SetFillColor(39); // s. TAttFill 35 #ifdef DEBUG 28 36 cout << "MGEmbeddedCanvas: fRange=" << fRange << endl; 37 #endif 29 38 if (fRange>0) 30 39 fCanvas->Range(-fRange, -fRange, fRange, fRange); … … 33 42 fList->SetOwner(); 34 43 44 #ifdef DEBUG 35 45 cout << "MGEmbeddedCanvas: Initializing done." << endl; 46 #endif 36 47 } 37 48 -
trunk/MagicSoft/Cosy/gui/MGImage.cc
r1343 r1690 11 11 #include <iostream.h> 12 12 #include <pthread.h> 13 14 #include <TTimer.h> 15 #include <TSystem.h> 16 #include <TVirtualX.h> 17 #include <TGX11.h> 13 18 14 19 ClassImp(MGImage); … … 97 102 98 103 // 99 // get frame id100 //101 fId = GetId();102 103 //104 104 // Create Default Graphic Context (XCreateGC) 105 105 // 106 fDefGC = gVirtualX->CreateGC(fId, 0); // GetBckgndGC() ; //106 fDefGC = gVirtualX->CreateGC(fId, 0); // GetBckgndGC().GetGC(); // 107 107 108 108 // … … 120 120 121 121 Resize(w, h); 122 123 //fTimer=new TTimer(Form("gClient->ProcessEventsFor((TGWindow*)0x%p);", this), 250, kTRUE); 124 // fTimer=new TTimer("printf(\"Timer!\\n\"); gSystem->ProcessEvents();", 250, kTRUE); 125 //fTimer->Start(); 122 126 } 123 127 124 128 void MGImage::Resize(UInt_t w, UInt_t h) 125 129 { 126 TGFrame::Resize(w+2*GetBorderWidth(), h+2*GetBorderWidth());130 // TGFrame::Resize(w+2*GetBorderWidth(), h+2*GetBorderWidth()); 127 131 // FIXME: RESIZE THE PIXMAP 128 132 } … … 130 134 void MGImage::Resize(TGDimension size) 131 135 { 132 TGFrame::Resize(size.fWidth+2*GetBorderWidth(), size.fHeight+2*GetBorderWidth());136 // TGFrame::Resize(size.fWidth+2*GetBorderWidth(), size.fHeight+2*GetBorderWidth()); 133 137 // FIXME: RESIZE THE PIXMAP 134 138 } … … 136 140 void MGImage::MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h) 137 141 { 138 TGFrame::MoveResize(x, y, w+2*GetBorderWidth(), h+2*GetBorderWidth());142 // TGFrame::MoveResize(x, y, w+2*GetBorderWidth(), h+2*GetBorderWidth()); 139 143 // FIXME: RESIZE THE PIXMAP 140 144 } … … 142 146 MGImage::~MGImage() 143 147 { 148 //fTimer->Stop(); 149 //delete fTimer; 150 144 151 pthread_mutex_lock((pthread_mutex_t*)fMuxPixmap); 145 152 … … 154 161 155 162 if (fPixmap!=kNone) // @@@ 163 { 164 cout << "Delete Pixmap" << endl; 156 165 gVirtualX->DeletePixmap(fPixmap); // XFreePixmap(fDisplay, (Pixmap) pmap); 166 } 157 167 158 168 cout << "Deleting GC..." << endl; 159 169 170 160 171 gVirtualX->DeleteGC(fDefGC); // XFreeGC(fDisplay, (GC) gc); 161 172 … … 165 176 } 166 177 178 #include <X11/Xlib.h> 167 179 /* 168 #include <X11/Xlib.h>169 180 #include <X11/Xutil.h> 170 181 #include <X11/Intrinsic.h> … … 174 185 void MGImage::DoRedraw() 175 186 { 176 // Pixmap_t pm = gVirtualX->CreatePixmap(this->GetId(), buffer, 177 // 768, 576, 0, 0xff, 8); 178 TGFrame::DrawBorder(); 187 // TGFrame::DrawBorder(); 179 188 pthread_mutex_lock((pthread_mutex_t*)fMuxPixmap); 189 190 //=========================== 191 if (TestBit(kNeedRecreate)) 192 { 193 Pixmap_t mask = kNone; 194 PictureAttributes_t attr; 195 attr.fMask = kNone; 196 197 if (fPixmap!=kNone) 198 gVirtualX->DeletePixmap(fPixmap); 199 200 fPixmap=kNone; 201 202 if (!gVirtualX->CreatePictureFromData(fId, fBuffer, fPixmap, 203 mask, attr)) 204 { 205 cout << "Warning: Error in CreatePictureFromData" << endl; 206 fPixmap=kNone; 207 } 208 ResetBit(kNeedRecreate); 209 } 210 211 //=========================== 180 212 181 213 // Copy a drawable (i.e. pixmap) to another drawable (pixmap, window). … … 185 217 // dest_x, dest_y); 186 218 if (fPixmap!=kNone) //@@@ 187 gVirtualX->CopyArea(fPixmap, fId, fDefGC, 188 0, 0, fWidth, fHeight, 189 GetBorderWidth(), GetBorderWidth()); 219 { 220 // gVirtualX->DrawString(fId, fDefGC, 20, 20, "HELLO WORLD!", 12); 221 // gVirtualX->FillRectangle(fId, fDefGC, 10, 10, 50, 50); 222 223 // cout << gVirtualX->IsA()->GetName() << endl; 224 gVirtualX->CopyArea(fPixmap, fId, fDefGC, 225 0, 0, fWidth, fHeight, 226 GetBorderWidth(), GetBorderWidth()); 227 228 /* 229 XCopyArea((Display*)gVirtualX->GetDisplay(), pm, fId, 230 (GC)fDefGC, 0, 0, fWidth, fHeight, 231 GetBorderWidth(), GetBorderWidth()); 232 */ 233 } 190 234 /* 191 235 if (fPix) … … 271 315 cout << "Done " << (void*)fPix << endl; 272 316 */ 317 318 /* 273 319 Pixmap_t mask = kNone; 274 320 PictureAttributes_t attr; 275 321 attr.fMask = kNone; 276 322 if (fPixmap!=kNone) // @@@ 277 gVirtualX->DeletePixmap(fPixmap); // XFreePixmap(fDisplay, (Pixmap) pmap);323 gVirtualX->DeletePixmap(fPixmap); // XFreePixmap(fDisplay, (Pixmap) pmap); 278 324 279 325 // Create a pixture pixmap from data. The picture attributes … … 310 356 fPixmap=kNone; 311 357 } 312 358 */ 359 SetBit(kNeedRecreate); 313 360 pthread_mutex_unlock((pthread_mutex_t*)fMuxPixmap); 314 DoRedraw(); 361 //gClient->NeedRedraw(this); 362 //fTimer->Start(10, kTRUE); 363 //gVirtualX->UpdateWindow(1); 364 // ((TGX11*)gVirtualX)->Sync(1); 365 //new TTimer(Form("gClient->ProcessEventsFor((TGWindow*)0x%p);", this), 1, kFALSE); 366 // DoRedraw(); 315 367 } 316 368 … … 339 391 } 340 392 } 341 393 /* 342 394 Pixmap_t mask = kNone; 343 395 PictureAttributes_t attr; … … 346 398 if (fPixmap!=kNone) 347 399 gVirtualX->DeletePixmap(fPixmap); 400 348 401 fPixmap=kNone; 349 402 … … 354 407 fPixmap=kNone; 355 408 } 356 409 */ 410 SetBit(kNeedRecreate); 357 411 pthread_mutex_unlock((pthread_mutex_t*)fMuxPixmap); 358 DoRedraw(); 359 } 360 412 //gClient->NeedRedraw(this); 413 //fTimer->Start(10, kTRUE); 414 //gVirtualX->UpdateWindow(1); 415 // ((TGX11*)gVirtualX)->Sync(1); 416 //new TTimer(Form("gClient->ProcessEventsFor((TGWindow*)0x%p);", this), 1, kFALSE); 417 // DoRedraw(); 418 } 419 -
trunk/MagicSoft/Cosy/gui/MGImage.h
r1111 r1690 10 10 #include <TGFrame.h> 11 11 12 class TTimer; 13 12 14 typedef unsigned char byte; 13 15 … … 20 22 21 23 GContext_t fDefGC; 22 Drawable_t fId;23 24 Pixmap_t fPixmap; 24 25 … … 28 29 void *fMuxPixmap; //! test 29 30 30 public: 31 TTimer *fTimer; 32 33 enum { kNeedRecreate = BIT(17) }; 31 34 32 35 public: -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
r1275 r1690 172 172 : MGEmbeddedCanvas("SkyPosition", p, w, 110) 173 173 { 174 cout << "MGSkyPosition: Initilizing." << endl;175 174 DrawCoordinateSystem(); 176 175 InitPlanets(); … … 178 177 InitText(); 179 178 InitCanvas(); 180 cout << "MGSkyPosition: Initilizing done." << endl;181 179 } 182 180 … … 278 276 static int Y = ~0; 279 277 280 int xd = (int) floor(x);281 int yd = (int) floor(y);278 int xd = (int)/*floor*/(x); 279 int yd = (int)/*floor*/(y); 282 280 x *= 60.; 283 281 y *= 60.; 284 282 285 int fx = (int) floor(x*10.);286 int fy = (int) floor(y*10.);283 int fx = (int)/*floor*/(x*10.); 284 int fy = (int)/*floor*/(y*10.); 287 285 288 286 if (X==fx && Y==fy) … … 296 294 297 295 char txt[100]; 298 sprintf(txt, "Zd=% d\xb0%02.1f'\nAz=%d\xb0%02.1f'",299 x d, xm, yd, ym);296 sprintf(txt, "Zd=%s%d\xb0%02.1f'\nAz=%s%d\xb0%02.1f'", 297 x<0?"-":"", abs(xd), xm, y<0?"-":"", abs(yd), ym); 300 298 301 299 fText->SetText(fText->GetX(), fText->GetY(), txt); … … 305 303 306 304 307 void MGSkyPosition::Update(ZdAz &pos )305 void MGSkyPosition::Update(ZdAz &pos, double mjd) 308 306 { 309 307 // 310 308 // calculate actual time for planet positions 311 309 // 312 fSlaPlanet->SetMjd 2Now();313 fSlaStar->SetMjd 2Now();310 fSlaPlanet->SetMjd(mjd); 311 fSlaStar->SetMjd(mjd); 314 312 315 313 UpdatePlanet(kESun, fSun); -
trunk/MagicSoft/Cosy/gui/MGSkyPosition.h
r1273 r1690 66 66 ~MGSkyPosition(); 67 67 68 void Update(ZdAz &pos );68 void Update(ZdAz &pos, double mjd); 69 69 70 70 ClassDef(MGSkyPosition, 0) -
trunk/MagicSoft/Cosy/gui/MGStarguider.cc
r1531 r1690 3 3 #include <fstream.h> // ifstream 4 4 #include <iostream.h> // cout 5 # 5 6 #include <TTimer.h> 7 6 8 #include <TGMenu.h> 7 9 #include <TSystem.h> … … 61 63 }; 62 64 65 Bool_t MGStarguider::HandleTimer(TTimer *t) 66 { 67 fImage->DoRedraw(); 68 fZoomImage->DoRedraw(); 69 return kTRUE; 70 } 71 63 72 #define kZOOM 96 64 73 … … 199 208 // Create Image Display 200 209 // 210 fZoomImage = new MGImage(this, kZOOM, kZOOM); 211 fZoomImage->Move(768-kZOOM-2, 700-kZOOM-2); 212 AddFrame(fZoomImage); 213 fList->Add(fZoomImage); 214 201 215 fImage = new MGImage(this, 768, 576); 202 216 fImage->Move(0, fMenu->GetDefaultHeight()); … … 204 218 fList->Add(fImage); 205 219 206 fZoomImage = new MGImage(this, kZOOM, kZOOM);207 fZoomImage->Move(768-kZOOM-2, 700-kZOOM-2);208 AddFrame(fZoomImage);209 fList->Add(fZoomImage);210 211 220 // 212 221 // Make everything visible … … 217 226 MapSubwindows(); 218 227 MapWindow(); 228 229 fTimer=new TTimer(this, 100); // 100ms 230 fTimer->TurnOn(); 219 231 } 220 232 221 233 MGStarguider::~MGStarguider() 222 234 { 235 fTimer->TurnOff(); 236 delete fTimer; 237 223 238 delete fSao; 224 239 delete fRaDec; -
trunk/MagicSoft/Cosy/gui/MGStarguider.h
r1531 r1690 14 14 class AltAz; 15 15 class RaDec; 16 17 class TTimer; 16 18 17 19 class TGMenuBar; … … 52 54 RaDec *fRaDec; 53 55 56 TTimer *fTimer; 57 54 58 Int_t fDx; 55 59 Int_t fDy; … … 62 66 void GetCoordinates(); 63 67 void CalcTrackingError(MStarList &, MStarList &); 68 69 Bool_t HandleTimer(TTimer *t); 64 70 65 71 public: -
trunk/MagicSoft/Cosy/gui/MGVelocity.cc
r1111 r1690 279 279 vy /= 60.; //['/min] 280 280 281 int fx = (int) floor(vx*10.);282 int fy = (int) floor(vy*10.);281 int fx = (int)/*floor*/(vx*10.); 282 int fy = (int)/*floor*/(vy*10.); 283 283 284 284 if (X==fx && Y==fy) … … 290 290 char txt[100]; 291 291 sprintf(txt, "Zd=%.1f'\nAz=%.1f'", 292 v x, vy);292 vy, vx); 293 293 294 294 fTextVel->SetText(fTextVel->GetX(), fTextVel->GetY(), txt);
Note:
See TracChangeset
for help on using the changeset viewer.