Changeset 2178 for trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
- Timestamp:
- 06/16/03 13:45:01 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
r2173 r2178 181 181 filemenu->AddEntry("Save As status.&root", kFileSaveAsRoot); 182 182 filemenu->AddSeparator(); 183 filemenu->AddEntry("Re&set", kFileReset); 184 filemenu->AddSeparator(); 183 185 filemenu->AddEntry("Print with &lpr", kFilePrint); 184 186 //filemenu->AddEntry("Set printer &name", kFilePrinterName); … … 196 198 tabmenu->AddEntry("Save As tab-i.&C", kTabSaveAsC); 197 199 tabmenu->AddEntry("Save As tab-i.&root", kTabSaveAsRoot); 200 tabmenu->AddSeparator(); 201 tabmenu->AddEntry("Re&move", kTabRemove); 198 202 tabmenu->AddSeparator(); 199 203 tabmenu->AddEntry("Print with &lpr", kFilePrint); … … 560 564 // to the corresponding TCanvas. If it isn't found NULL is returned. 561 565 // 562 T Canvas *MStatusDisplay::GetCanvas(TGCompositeFrame *cf) const566 TRootEmbeddedCanvas *MStatusDisplay::GetEmbeddedCanvas(TGCompositeFrame *cf) const 563 567 { 564 568 TIter Next(cf->GetList()); … … 567 571 while ((f=(TGFrameElement*)Next())) 568 572 if (f->fFrame->InheritsFrom(TRootEmbeddedCanvas::Class())) 569 return ( (TRootEmbeddedCanvas*)f->fFrame)->GetCanvas();573 return (TRootEmbeddedCanvas*)f->fFrame; 570 574 571 575 return NULL; 576 } 577 578 // -------------------------------------------------------------------------- 579 // 580 // Takes a TGCompositeFrame as argument. Searches for the first 581 // TRootEmbeddedCanvas which is contained by it and returns a pointer 582 // to the corresponding TCanvas. If it isn't found NULL is returned. 583 // 584 TCanvas *MStatusDisplay::GetCanvas(TGCompositeFrame *cf) const 585 { 586 TRootEmbeddedCanvas *ec = GetEmbeddedCanvas(cf); 587 return ec ? ec->GetCanvas() : NULL; 572 588 } 573 589 … … 654 670 c.SetBorderMode(0); 655 671 656 // If kNoCont axtMenu set set kNoCOntextMenu of the canvas672 // If kNoContextMenu set set kNoContextMenu of the canvas 657 673 if (TestBit(kNoContextMenu)) 658 674 c.SetBit(kNoContextMenu); … … 738 754 739 755 return pages; 756 } 757 758 // -------------------------------------------------------------------------- 759 // 760 // Remove tab no i if this tab contains a TRootEmbeddedCanvas 761 // 762 void MStatusDisplay::RemoveTab(int i) 763 { 764 TGCompositeFrame *f = fTab->GetTabContainer(i); 765 if (!f) 766 return; 767 768 TRootEmbeddedCanvas *ec = GetEmbeddedCanvas(f); 769 if (!ec) 770 return; 771 772 TCanvas *c = ec->GetCanvas(); 773 if (!c) 774 return; 775 776 const TString name(c->GetName()); 777 778 f->RemoveFrame(ec); 779 delete fList->Remove(ec); 780 781 fTab->RemoveTab(i); 782 783 // layout and map new tab 784 #if ROOT_VERSION_CODE < ROOT_VERSION(3,03,00) 785 MapSubwindows(); 786 Layout(); 787 #else 788 Layout(); 789 MapSubwindows(); 790 #endif 791 792 // display new tab in the main frame 793 gClient->ProcessEventsFor(fTab); 794 795 *fLog << inf << "Removed Tab #" << i << " '" << name << "'" << endl; 796 } 797 798 // -------------------------------------------------------------------------- 799 // 800 // Use this to check whether the MStatusDisplay still contains the 801 // TCanvas c. It could be removed meanwhile by menu usage. 802 // 803 Bool_t MStatusDisplay::HasCanvas(const TCanvas *c) const 804 { 805 for (int i=1; i<fTab->GetNumberOfTabs(); i++) 806 if (c==GetCanvas(i)) 807 return kTRUE; 808 return kFALSE; 740 809 } 741 810 … … 773 842 return kTRUE; 774 843 844 case kFileReset: 845 for (int i=fTab->GetNumberOfTabs()-1; i>0; i--) 846 RemoveTab(i); 847 return kTRUE; 775 848 /* 776 849 case kFileSave: … … 828 901 case kTabPrevious: 829 902 fTab->SetTab(fTab->GetCurrent()-1); 903 return kTRUE; 904 905 case kTabRemove: 906 RemoveTab(fTab->GetCurrent()); 830 907 return kTRUE; 831 908
Note:
See TracChangeset
for help on using the changeset viewer.