Changeset 1690 for trunk/MagicSoft/Cosy
- Timestamp:
- 12/18/02 17:48:44 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/base/MGList.h
r918 r1690 1 #ifndef M GLIST_H2 #define M GLIST_H1 #ifndef MARS_MGList 2 #define MARS_MGList 3 3 4 #if def DBG_MGLIST5 #include < iostream.h>4 #ifndef ROOT_TList 5 #include <TList.h> 6 6 #endif 7 7 8 #ifndef ROOT_TOrdCollection 9 #include <TOrdCollection.h> 10 #endif 8 class TGWidget; 9 class TGPicture; 11 10 12 class MGList : public T OrdCollection11 class MGList : public TList 13 12 { 13 private: 14 TGWidget *GetWidget(TObject *obj) const; 15 Bool_t IsExisting(TObject *obj) const; 16 17 void AddPicture(const TGPicture *pic, const char *name); 18 14 19 public: 15 ~MGList() 16 { 17 #ifdef DBG_MGLIST 18 cout << "Deleting:" << flush; 19 #endif 20 MGList() : TList() {} 21 virtual ~MGList(); 20 22 21 TIter Next(this); 23 void Add(TObject *obj); 24 void Add(TObject *obj, Option_t *opt); 22 25 23 TObject *obj; 24 while ((obj=Next())) 25 { 26 #ifdef DBG_MGLIST 27 cout << " <" << ((TGObject*)obj)->GetName() << ">" << flush; 28 #endif 29 delete (TGObject*)obj; 30 } 31 #ifdef DBG_MGLIST 32 cout << endl; 33 #endif 34 } 35 void Add(TGObject *obj) 36 { 37 TOrdCollection::Add(obj); 38 } 26 const TGPicture *GetPicture(const char *name); 27 const TGPicture *GetPicture(const char *name, Int_t width, Int_t height); 28 29 TObject *FindWidget(Int_t id) const; 30 31 ClassDef(MGList, 0) 39 32 }; 40 33 -
trunk/MagicSoft/Cosy/candrv/network.cc
r1273 r1690 237 237 lout << "- Setting up Node #" << dec << i << endl; 238 238 fNodes[i]->InitDevice(this); 239 fNodeInitialized[i] = TRUE; 239 if (!fNodes[i]->IsZombieNode()) 240 fNodeInitialized[i] = TRUE; 241 else 242 fNodes[i]=NULL; 240 243 } 241 244 lout << "- All Nodes setup." << endl; -
trunk/MagicSoft/Cosy/candrv/nodedrv.cc
r1273 r1690 56 56 // and the node name. The name is a name for debug output. 57 57 // 58 NodeDrv::NodeDrv(BYTE_t nodeid, const char *name, MLog &out) : Log(out), fNetwork(NULL), fId(32), fError(0) 58 NodeDrv::NodeDrv(BYTE_t nodeid, const char *name, MLog &out) : Log(out), fNetwork(NULL), fId(32), fError(0), fIsZombie(kFALSE) 59 59 { 60 60 if (nodeid>0x1f) … … 311 311 // this device has been received. 312 312 // You can stop waiting by StopWaitingForSDO. 313 // 314 void NodeDrv::WaitForSdo(WORD_t idx, BYTE_t subidx, WORDS_t timeout) 315 { 316 fNetwork->WaitForSdo(fId, idx, subidx, timeout); 313 // Return false if waiting timed out. 314 // 315 bool NodeDrv::WaitForSdo(WORD_t idx, BYTE_t subidx, WORDS_t timeout) 316 { 317 return fNetwork->WaitForSdo(fId, idx, subidx, timeout); 317 318 } 318 319 -
trunk/MagicSoft/Cosy/candrv/nodedrv.h
r1272 r1690 34 34 void DelError() { fError = 0; } 35 35 36 Bool_t fIsZombie; 37 36 38 public: 37 39 NodeDrv(BYTE_t nodeid, const char *name=NULL, MLog &out=gLog); … … 47 49 int GetError() const { return fError; } 48 50 bool HasError() const { return fError; } 51 52 bool IsZombieNode() const { return fIsZombie; } 49 53 50 54 virtual void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, timeval_t *tv); … … 82 86 83 87 // void WaitForSdos(); 84 voidWaitForSdo(WORD_t idx, BYTE_t subidx=0, WORDS_t timeout=500);88 bool WaitForSdo(WORD_t idx, BYTE_t subidx=0, WORDS_t timeout=500); 85 89 86 90 void EnableCanMsg(BYTE_t fcode); -
trunk/MagicSoft/Cosy/devdrv/macs.cc
r1275 r1690 113 113 fVelRes = val; 114 114 return; 115 116 case 0x6501: 117 lout << "- Encoder resolution " << GetNodeName() << ": " << dec << val << " ticks/min" << endl; 118 fRes = val; 119 return; 115 120 } 116 121 cout << "Macs: SDO, idx=0x"<< hex << idx << "/" << (int)subidx; … … 211 216 void Macs::InitDevice(Network *net) 212 217 { 218 lout << "- MAC Init device." << endl; 213 219 NodeDrv::InitDevice(net); 220 lout << "- MAC Init device...done." << endl; 214 221 215 222 // SendSDO(0x4003, (LWORD_t)('E'<<24 | 'X'<<16 | 'I'<<8 'T')); … … 295 302 RequestSDO(0x6004); 296 303 WaitForSdo(0x6004); 304 } 305 306 void Macs::ReqRes() 307 { 308 lout << "- Requesting Encoder Resolution of " << GetNodeName() << endl; 309 RequestSDO(0x6501); 310 WaitForSdo(0x6501); 297 311 } 298 312 … … 491 505 case 100: 492 506 lout << "Connection timed out." << endl; 507 EnableTimeout(false); 493 508 return; 494 509 … … 592 607 void Macs::EnableTimeout(bool enable, LWORDS_t ms) 593 608 { 609 lout << "- MAC " << (enable?"En":"Dis") << "able timeout, " << dec << ms << "ms." << endl; 594 610 if (!enable) 595 611 { … … 597 613 WaitForSdo(0x4000, 1); 598 614 615 lout << "- Stopping handshake (PC)." << endl; 616 599 617 fTimeout->Stop(); //kTRUE); 600 618 … … 610 628 fTimerOn = kTRUE; 611 629 fTimeout->Start(fGuardTime/*/3*2*/, kTRUE); //kFALSE); //TRUE); 630 612 631 // 613 632 // Start with kFALSE would be a continous timer, but this … … 615 634 // any reason 616 635 // 617 618 //SendSDO(0x4000, 1, string('o', 'n'));619 //WaitForSdo(0x4000, 1);636 lout << "- MAC starting handshake." << endl; 637 SendSDO(0x4000, 1, string('o', 'n')); 638 WaitForSdo(0x4000, 1); 620 639 } 621 640 lout << "- Timeout timer of " << GetNodeName() << " turned " … … 666 685 // --- lout << edev(MLog::eGui); 667 686 668 if (time.Now() > fTimeoutTime +0.5)687 if (time.Now() > fTimeoutTime) 669 688 { 670 689 lout << ddev(MLog::eGui); … … 703 722 fGuardTime = ms/3; // how often do we send/request the handshake 704 723 705 SendSDO(0x4000, 2, ms ); // How often do we check for the handshake724 SendSDO(0x4000, 2, ms*2); // How often do we check for the handshake 706 725 WaitForSdo(0x4000, 2); 707 726 } -
trunk/MagicSoft/Cosy/devdrv/macs.h
r1140 r1690 18 18 Timer fPosTime; 19 19 20 LWORD_t fRes; // Encoder resolution 21 20 22 LWORDS_t fPdoPos; 21 23 Timer fPdoTime; … … 36 38 void ResetTimeout(); 37 39 Bool_t HandleTimer(TTimer *t); 40 41 void ReqRes(); 38 42 39 43 public: … … 100 104 LWORDS_t GetVel() { return fVel; } 101 105 LWORD_t GetVelRes() { return fVelRes; } // Velocity units (would be 100 for %) 106 LWORD_t GetRes() { return fRes; } // Encoder resolution 102 107 103 108 void HandleError(); -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
r1531 r1690 200 200 lout << "- Requesting Hardware Type (SDO 0x1000) of " << GetNodeName() << endl; 201 201 RequestSDO(0x1000); 202 WaitForSdo(0x1000); 202 if (!WaitForSdo(0x1000)) 203 { 204 lout << " ... failed." << endl; 205 fIsZombie = true; 206 return; 207 } 203 208 204 209 // -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.h
r1140 r1690 51 51 52 52 LWORDS_t GetPos() { return fPos+fTurn*fTicks; } 53 LWORD_t GetPhysRes() { return fTicks; } 53 54 54 55 double GetTime(); -
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); -
trunk/MagicSoft/Cosy/macros/rootlogon.C
r1139 r1690 40 40 } 41 41 42 gInterpreter->AddIncludePath("base"); 43 gInterpreter->AddIncludePath("main"); 44 42 45 cout << endl; 43 46
Note:
See TracChangeset
for help on using the changeset viewer.