Changeset 2386 for trunk/MagicSoft/Mars/mmain
- Timestamp:
- 10/15/03 19:15:13 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
r2299 r2386 75 75 #include <TObjArray.h> // TObjArray 76 76 #include <TPostScript.h> // TPostScript 77 #include <TInterpreter.h> // gInterpreter 77 78 78 79 #include <TGTab.h> // TGTab … … 186 187 //filemenu->AddEntry("Set printer &name", kFilePrinterName); 187 188 filemenu->AddSeparator(); 189 filemenu->AddEntry("C&lose", kFileClose); 188 190 filemenu->AddEntry("E&xit", kFileExit); 189 191 filemenu->Associate(this); … … 507 509 : TGMainFrame(gClient ? gClient->GetRoot() : NULL, 1, 1), fTimer(this, t, kTRUE), fStatus(kLoopNone), fLog(&gLog), fLogIdx(-1), fLogTimer(this, 250, kTRUE), fLogBox(NULL), fIsLocked(0) 508 510 { 511 // 512 // This is a possibility for the user to check whether this 513 // object has already been deleted. It will be removed 514 // from the list in the destructor. 515 // 509 516 gROOT->GetListOfSpecials()->Add(this); 510 517 511 518 fFont = gVirtualX->LoadQueryFont("7x13bold"); 512 519 520 // 521 // In case we are in batch mode use a list of canvases 522 // instead of the Root Embedded Canvases in the TGTab 523 // 513 524 fBatch = new TList; 514 525 fBatch->SetOwner(); … … 566 577 MStatusDisplay::~MStatusDisplay() 567 578 { 579 // 580 // Delete object from global object table so it cannot 581 // be deleted by chance a second time 582 // 583 gInterpreter->DeleteGlobal(this); 584 585 // 586 // This is a possibility for the user to check whether this 587 // object has already been deleted. It has been added 588 // to the list in the constructor. 589 // 568 590 gROOT->GetListOfSpecials()->Remove(this); 569 591 570 592 SetLogStream(NULL); 571 593 594 // 595 // Delete the list of objects corresponding to this object 596 // 572 597 delete fList; 598 599 // 600 // Delete the list list of canvases used in batch mode 601 // instead of the Root Embedded Canvases in the TGTab 602 // 573 603 delete fBatch; 574 604 605 // 606 // Delete the font used for the logging window 607 // 575 608 if (fFont) 576 609 gVirtualX->DeleteFont(fFont); … … 671 704 } 672 705 706 /* 707 class MCanvas : public TRootEmbeddedCanvas 708 { 709 public: 710 MCanvas(const char* name, const TGWindow* p, UInt_t w, UInt_t h, UInt_t o) : 711 TRootEmbeddedCanvas(name, p, w, h, o) {} 712 void Layout() 713 { 714 cout << "EmbLayout: " << GetCanvas()->GetName() << endl; 715 716 // Create layout for canvas. Depending on the size of the container 717 // we need to add the scrollbars. 718 TRootEmbeddedCanvas::Layout(); 719 } 720 }; 721 */ 722 723 TGCompositeFrame *MStatusDisplay::AddRawTab(const char *name) 724 { 725 // Add new tab 726 TGCompositeFrame *f = fTab->AddTab(name); 727 728 // layout and map new tab 729 Layout(); 730 MapSubwindows(); 731 Layout(); 732 733 // display new tab in the main frame 734 gClient->ProcessEventsFor(fTab); 735 736 *fLog << inf << "Adding Raw Tab '" << name << "' (" << f->GetWidth() << "x"; 737 *fLog << f->GetHeight() << ")" << endl; 738 739 // return pointer to new canvas 740 return f; 741 } 742 673 743 // -------------------------------------------------------------------------- 674 744 // … … 688 758 TGCompositeFrame *f = fTab->AddTab(name); 689 759 690 // create root emb 0edded canvas and add it to the tab760 // create root embedded canvas and add it to the tab 691 761 TRootEmbeddedCanvas *ec = new TRootEmbeddedCanvas(name, f, f->GetWidth(), f->GetHeight(), 0); 692 762 f->AddFrame(ec, fLayCanvas); … … 723 793 } 724 794 795 725 796 // -------------------------------------------------------------------------- 726 797 // … … 737 808 return; 738 809 739 // Code taken from TCanvas::Update() and TCanvas::Paint 740 c->FeedbackMode(kFALSE); // Goto double buffer mode 741 c->Paint(); // Repaint all pad's 742 c->Flush(); // Copy all pad pixmaps to the screen 810 // Code taken from TCanvas::Update() and TCanvas::Paint() 811 // replaces PaintModified() by Paint() 812 if (gThreadXAR) 813 { 814 void *arr[2] = { NULL, c }; 815 if (((*gThreadXAR)("CUPD", 2, arr, NULL))) 816 return; 817 } 818 819 if (!c->IsBatch()) 820 c->FeedbackMode(kFALSE); // Goto double buffer mode 821 822 c->Paint(); // Repaint all pads 823 c->Flush(); // Copy all pad pixmaps to the screen 824 743 825 //c->SetCursor(kCross); 744 826 … … 871 953 { 872 954 case kLoopStop: 955 case kFileClose: 873 956 case kFileExit: 874 if (id==kFileExit )875 delete this;957 if (id==kFileExit || id==kFileClose) 958 CloseWindow(); 876 959 fStatus = (Status_t)id; 877 960 return kTRUE; … … 1029 1112 return ProcessMessageCommandMenu(mp1); // mp2=userdata 1030 1113 case kCM_TAB: 1031 for (int i=1; i<fTab->GetNumberOfTabs(); i++) 1032 fTab->GetTabContainer(i)->UnmapWindow(); 1114 /* 1115 for (int i=0; i<fTab->GetNumberOfTabs(); i++) 1116 fTab->GetTabContainer(i)->UnmapWindow(); 1117 */ 1033 1118 UpdateTab(fTab->GetTabContainer(mp1)); 1034 fTab->GetTabContainer(mp1)->MapWindow(); 1119 //fTab->GetTabContainer(mp1)->MapWindow(); 1120 1035 1121 /* 1036 1122 if (mp1>0) … … 1187 1273 // and the destructor are calling DestroyWindow which seems to be 1188 1274 // in conflict with the TRootEmbeddedCanvas. 1189 delete this; 1275 1276 // FIXME: Make sure that the Status Display is deleted from every 1277 // where (eg Eventloop) first! 1278 1279 gLog << dbg << "MStatusDisplay is on heap: " << (int)IsOnHeap() << endl; 1280 1281 if (fIsLocked<=0 && IsOnHeap()) 1282 delete this; 1283 fStatus = kFileExit; 1190 1284 } 1191 1285 … … 1201 1295 1202 1296 flag ? SetBit(kNoContextMenu) : ResetBit(kNoContextMenu); 1297 1203 1298 for (int i=1; i<fTab->GetNumberOfTabs(); i++) 1204 1299 { … … 1563 1658 TVirtualPS *psave = gVirtualPS; 1564 1659 1660 TDatime d; 1661 1565 1662 TPostScript ps(name, 112); 1566 1663 ps.SetBit(TPad::kPrintingPS); … … 1608 1705 ps.NewPage(); 1609 1706 1610 Float_t psw = 26; // A4 - width 1611 Float_t psh = 20; // A4 - height 1707 // 1708 // 26 is used here to scale the canvas into a height of 26, 1709 // such that the page title can be set above the canvas... 1710 // 1711 Float_t psw = 26; //29.7; // A4 - width 1712 Float_t psh = 21.0; // A4 - height 1612 1713 1613 1714 const Float_t cw = c->GetWw(); … … 1655 1756 ps.TextNDC(0, 1.02, TString(" ")+n->GetName()); 1656 1757 ps.SetTextAlign(21); // cent top 1657 ps.TextNDC(0.5, 1.02, "MARS - Magic Analysis and Reconstruction Software");1758 ps.TextNDC(0.5, 1.02, TString("MARS - Magic Analysis and Reconstruction Software - ")+d.AsString()); 1658 1759 ps.SetTextAlign(31); // right top 1659 1760 ps.TextNDC(1, 1.02, Form("Page No.%i (%i) ", page++, i));
Note:
See TracChangeset
for help on using the changeset viewer.