Changeset 1030 for trunk/MagicSoft/Mars/meventdisp
- Timestamp:
- 11/05/01 10:35:36 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/meventdisp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
r1015 r1030 115 115 plist->AddToList(pedest); 116 116 117 fInitOk = fEvtLoop->PreProcess();118 119 if (fInitOk)120 GetTaskList()->Process();121 122 117 return geom; 123 118 } … … 147 142 fDisplay = new MCamDisplay(geom); 148 143 fDisplay->Draw(); 149 150 144 fList->Add(fDisplay); 145 146 ReadFirstEvent(); 151 147 152 148 // … … 161 157 SetWindowName("Hillas Event Display"); 162 158 SetIconName("Hillas"); 163 164 UpdateDisplay();165 UpdateNumOfEvts();166 UpdateEventCounter();167 159 168 160 MapWindow(); … … 177 169 void MGCamDisplay::UpdateDisplay() 178 170 { 179 if (! fInitOk)171 if (!IsInitOk()) 180 172 return; 181 173 -
trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc
r1023 r1030 139 139 // -------------------------------------------------------------------------- 140 140 // 141 // Show the correct number of events142 //143 void MGEvtDisplay::UpdateNumOfEvts()144 {145 char txt[100];146 sprintf(txt, "out of %d Events", GetReader()->GetEntries());147 148 fNumOfEvts->SetText(new TGString(txt));149 }150 151 // --------------------------------------------------------------------------152 //153 141 // Add the second part of the top frame: This are the event number controls 154 142 // … … 405 393 AddMenuBar(); 406 394 AddFrames(fname, tname); 407 UpdateEventCounter();408 395 } 409 396 … … 435 422 // and updates the display 436 423 // 437 void MGEvtDisplay::ReadinEvent(UInt_t iEvt) 438 { 439 if (!fInitOk) 440 return; 441 442 Int_t buttons = 4; 443 Int_t retval = 0; 444 445 // 446 // first check if the new event is in the range of possible events 447 // 448 if (iEvt >= GetReader()->GetEntries()) 424 void MGEvtDisplay::ReadinEvent() 425 { 426 if (GetTaskList()->Process()) 449 427 { 450 new TGMsgBox(gClient->GetRoot(), this, "WARNING!", 451 "The event number is out of range!!!", 452 kMBIconExclamation, buttons, &retval); 428 GetReader()->DecEventNum(); 429 UpdateDisplay(); 453 430 } 454 else 455 { 456 GetReader()->SetEventNum(iEvt); 457 458 if (GetTaskList()->Process()) 459 UpdateDisplay(); 460 } 461 462 UpdateEventCounter(); 463 } 464 465 // -------------------------------------------------------------------------- 466 // 467 // Update the event counter 468 // 469 void MGEvtDisplay::UpdateEventCounter() 470 { 471 char txt[256]; 472 473 sprintf(txt, "%d", GetReader()->GetEventNum()); 474 475 fTxtEvtNr->SetText(txt); 431 432 fTxtEvtNr->SetText(Form("%d", GetReader()->GetEventNum()+1)); 433 } 434 435 void MGEvtDisplay::ReadFirstEvent() 436 { 437 fInitOk = fEvtLoop->PreProcess(); 438 439 if (fInitOk) 440 ReadinEvent(); 441 442 TGString *txt = new TGString(Form("out of %d Events", GetReader()->GetEntries())); 443 fNumOfEvts->SetText(txt); 476 444 } 477 445 … … 526 494 // -------------------------------------------------------------------------- 527 495 // 528 // 496 // ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 529 497 // 530 498 // Processes information from all GUI items. … … 535 503 Bool_t MGEvtDisplay::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 536 504 { 537 switch(GET_MSG(msg)) 505 if (GET_MSG(msg)!=kC_TEXTENTRY && GET_MSG(msg)!=kC_COMMAND) 506 return kTRUE; 507 508 switch(GET_SUBMSG(msg)) 538 509 { 539 case kC_COMMAND: 510 case kTE_ENTER: 511 case kCM_BUTTON: 512 if (parm1==kClose) 513 { 514 CloseWindow(); 515 return kTRUE; 516 } 517 518 if (!fInitOk) 519 return kTRUE; 520 540 521 switch(GET_SUBMSG(msg)) 541 522 { 523 case kTE_ENTER: 524 if (GetReader()->SetEventNum(atoi(fTxtEvtNr->GetText())-1)) 525 ReadinEvent(); 526 return kTRUE; 527 542 528 case kCM_BUTTON: 543 529 switch (parm1) 544 530 { 545 531 case kEvtPrev: 546 // 547 // '-2' is because MReadTree::Process increases the 548 // Event number by one - this is the natural behaviour 549 // after reading one event 550 // 551 ReadinEvent(GetReader()->GetEventNum()-2); 532 if (GetReader()->DecEventNum()) 533 ReadinEvent(); 552 534 return kTRUE; 553 535 554 536 case kEvtNext: 555 // 556 // '+0' is because MReadTree::Process increases the 557 // Event number by one - this is the natural behaviour 558 // after reading one event 559 // 560 ReadinEvent(GetReader()->GetEventNum()); 561 return kTRUE; 562 563 case kClose: 564 CloseWindow(); 565 return kTRUE; 566 } 567 return kTRUE; 568 569 case kCM_MENU: 570 switch (parm1) 571 { 572 case kFileSaveAs: 573 SaveAsDialog(); 574 return kTRUE; 575 case kFileSaveAsRoot: 576 fCanvas->SaveAs("display.root"); 577 return kTRUE; 578 case kFileSaveAsC: 579 fCanvas->SaveSource("display.C"); 580 return kTRUE; 581 case kFileSaveAsPS: 582 fCanvas->SaveAs("display.ps"); 583 return kTRUE; 584 case kFileSaveAsEPS: 585 fCanvas->SaveAs("display.eps"); 586 return kTRUE; 587 case kFileSaveAsGIF: 588 fCanvas->SaveAs("display.gif"); 589 return kTRUE; 590 case kFilePrint: 591 fCanvas->Print(); 592 return kTRUE; 593 case kClose: 594 CloseWindow(); 537 if (GetReader()->IncEventNum()) 538 ReadinEvent(); 595 539 return kTRUE; 596 540 } … … 599 543 return kTRUE; 600 544 601 case kC_TEXTENTRY: 602 if (GET_SUBMSG(msg) == kTE_ENTER) 603 ReadinEvent(atoi(fTxtEvtNr->GetText())-1); 545 case kCM_MENU: 546 switch (parm1) 547 { 548 case kFileSaveAs: 549 SaveAsDialog(); 550 return kTRUE; 551 case kFileSaveAsRoot: 552 fCanvas->SaveAs("display.root"); 553 return kTRUE; 554 case kFileSaveAsC: 555 // FIXME: The line opening the canvas is wrong. 556 fCanvas->SaveSource("display.C"); 557 return kTRUE; 558 case kFileSaveAsPS: 559 fCanvas->SaveAs("display.ps"); 560 return kTRUE; 561 case kFileSaveAsEPS: 562 fCanvas->SaveAs("display.eps"); 563 return kTRUE; 564 case kFileSaveAsGIF: 565 fCanvas->SaveAs("display.gif"); 566 return kTRUE; 567 case kFilePrint: 568 fCanvas->Print(); 569 return kTRUE; 570 case kClose: 571 CloseWindow(); 572 return kTRUE; 573 } 604 574 return kTRUE; 605 575 } 606 607 576 return kTRUE; 608 577 } -
trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h
r1023 r1030 40 40 41 41 void SaveAsDialog() const; 42 void ReadinEvent(); 42 43 43 void ReadinEvent(UInt_t iEvt);44 Bool_t fInitOk; 44 45 45 46 protected: … … 54 55 TGVerticalFrame *fMidFrame; 55 56 56 Bool_t fInitOk;57 58 57 MParList *GetParList() const; 59 58 MTaskList *GetTaskList() const; 60 59 MReadTree *GetReader() const; 61 60 62 void UpdateEventCounter();63 void UpdateNumOfEvts();61 void ReadFirstEvent(); 62 Bool_t IsInitOk() { return fInitOk; } 64 63 65 64 virtual void UpdateDisplay() = 0; -
trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
r991 r1030 125 125 // preprocess eventloop and read in first event (process) 126 126 // 127 fInitOk = fEvtLoop->PreProcess(); 128 129 if (fInitOk) 130 GetTaskList()->Process(); 127 GetReader()->DisableAutoScheme(); 128 ReadFirstEvent(); 131 129 132 130 // … … 144 142 SetWindowName("Fadc Event Display"); 145 143 SetIconName("Fadc"); 146 147 UpdateDisplay();148 UpdateNumOfEvts();149 UpdateEventCounter();150 144 151 145 MapWindow(); … … 220 214 void MGFadcDisp::UpdateDisplay() 221 215 { 222 if (! fInitOk)216 if (!IsInitOk()) 223 217 return; 224 218
Note:
See TracChangeset
for help on using the changeset viewer.