Changeset 7825 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 07/30/06 19:10:53 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r7458 r7825 265 265 //savemenu->AddEntry("Save status.x&cf", kFileSaveAsXCF); 266 266 //savemenu->AddEntry("Save status.&tiff", kFileSaveAsTIFF); 267 //savemenu->AddEntry("Save status.&bmp", kFileSaveAsBMP); 267 savemenu->AddEntry("Save status.&bmp", kFileSaveAsBMP); 268 savemenu->AddEntry("Save status.&xml", kFileSaveAsXML); 268 269 savemenu->AddSeparator(); 269 270 savemenu->AddEntry(MString::Form("%s&C", fname.Data()), kFileSaveAsC); … … 303 304 //savemenu->AddEntry("Save status.x&cf", kFileSaveAsXCF); 304 305 //savemenu->AddEntry("Save status.&tiff", kFileSaveAsTIFF); 305 //savemenu->AddEntry("Save status.&bmp", kFileSaveAsBMP); 306 savemenu->AddEntry("Save status.&bmp", kFileSaveAsBMP); 307 savemenu->AddEntry("Save status.&xml", kFileSaveAsXML); 306 308 savemenu2->AddSeparator(); 307 309 savemenu2->AddEntry(MString::Form("%s&C", fname2.Data()), kTabSaveAsC); … … 822 824 TRootEmbeddedCanvas *ec = GetEmbeddedCanvas(cf); 823 825 return ec ? ec->GetCanvas() : NULL; 826 } 827 828 // -------------------------------------------------------------------------- 829 // 830 // Returns the range of tabs containing valid canvases for the condition 831 // num. 832 // 833 void MStatusDisplay::GetCanvasRange(Int_t &from, Int_t &to, Int_t num) const 834 { 835 const Int_t max = gROOT->IsBatch() ? fBatch->GetSize()+1 : fTab->GetNumberOfTabs(); 836 837 from = num<0 ? 1 : num; 838 to = num<0 ? max : num+1; 824 839 } 825 840 … … 1510 1525 // return kTRUE; 1511 1526 1512 //case kFileSaveAsBMP: 1513 // SaveAsBMP(); 1514 // return kTRUE; 1527 case kFileSaveAsBMP: 1528 SaveAsBMP(); 1529 return kTRUE; 1530 1531 case kFileSaveAsXML: 1532 SaveAsXML(); 1533 return kTRUE; 1515 1534 1516 1535 case kFileSaveAsC: … … 1562 1581 // return kTRUE; 1563 1582 1564 //case kTabSaveAsBMP:1565 // SaveAsBMP(fTab->GetCurrent());1566 // return kTRUE;1567 1568 1583 //case kTabSaveAsTIFF: 1569 1584 // SaveAsTIFF(fTab->GetCurrent()); 1570 1585 // return kTRUE; 1586 1587 case kTabSaveAsBMP: 1588 SaveAsBMP(fTab->GetCurrent()); 1589 return kTRUE; 1590 1591 case kTabSaveAsXML: 1592 SaveAsXML(fTab->GetCurrent()); 1593 return kTRUE; 1571 1594 1572 1595 case kTabSaveAsC: … … 1918 1941 { 1919 1942 type = 'M'; 1920 val /= 10 24;1943 val /= 1000; 1921 1944 } 1922 1945 if (val>999) 1923 1946 { 1924 1947 type = 'G'; 1925 val /= 10 24;1948 val /= 1000; 1926 1949 } 1927 1950 const TString txt = MString::Form("%.1f%c", val, type); … … 2142 2165 list.Add(&named); 2143 2166 2144 const Int_t max = gROOT->IsBatch() ? fBatch->GetSize()+1 : fTab->GetNumberOfTabs(); 2145 const Int_t from = num<0 ? 1 : num; 2146 const Int_t to = num<0 ? max : num+1; 2167 Int_t from, to; 2168 GetCanvasRange(from, to, num); 2147 2169 2148 2170 TCanvas *c; … … 2305 2327 static_cast<TPostScript&>(vps).Range(psw, psh); 2306 2328 // if (vps.InheritsFrom(TPDF::Class())) 2307 // static_cast<TPDF&>(vps).Range(psw /2, psh/2);2329 // static_cast<TPDF&>(vps).Range(psw*0.69, psh*0.69); 2308 2330 // if (vps.InheritsFrom(TSVG::Class())) 2309 2331 // static_cast<TSVG&>(vps).Range(psw, psh); … … 2314 2336 if (vps.InheritsFrom(TPostScript::Class())) 2315 2337 static_cast<TPostScript&>(vps).TextNDC(u, v, string); 2316 //if (vps.InheritsFrom(TPDF::Class()))2317 //static_cast<TPDF&>(vps).TextNDC(u, v, string);2338 if (vps.InheritsFrom(TPDF::Class())) 2339 static_cast<TPDF&>(vps).TextNDC(u, v, string); 2318 2340 // if (vps.InheritsFrom(TSVG::Class())) 2319 2341 // static_cast<TSVG&>(vps).TextNDC(u, v, string); … … 2406 2428 // Maintain tab numbers 2407 2429 // 2408 const Int_t max = gROOT->IsBatch() ? fBatch->GetSize()+1 : fTab->GetNumberOfTabs(); 2409 const Int_t from = num<0 ? 1 : num; 2410 const Int_t to = num<0 ? max : num+1; 2430 Int_t from, to; 2431 GetCanvasRange(from, to, num); 2411 2432 2412 2433 for (int i=from; i<to; i++) … … 2534 2555 Bool_t MStatusDisplay::SaveAsImage(Int_t num, TString name, TImage::EImageFileTypes type) 2535 2556 { 2536 //#if ROOT_VERSION_CODE < ROOT_VERSION(4,04,00)2557 #if ROOT_VERSION_CODE < ROOT_VERSION(5,12,00) 2537 2558 if (gROOT->IsBatch()) 2538 2559 { … … 2540 2561 return 0; 2541 2562 } 2542 //#endif2563 #endif 2543 2564 2544 2565 SetStatusLine1("Writing image file..."); … … 2585 2606 // ext = AddExtension(name, "cur", num); 2586 2607 // break; 2587 //case TImage::kBmp:2588 //ext = AddExtension(name, "bmp", num);2589 //break;2608 case TImage::kBmp: 2609 ext = AddExtension(name, "bmp", num); 2610 break; 2590 2611 // case TImage::kXcf: 2591 2612 // ext = AddExtension(name, "xcf", num); … … 2600 2621 // ext = AddExtension(name, "tga", num); 2601 2622 // break; 2602 //case TImage::kXml:2603 //ext = AddExtension(name, "xml", num);2604 //break;2623 case TImage::kXml: 2624 ext = AddExtension(name, "xml", num); 2625 break; 2605 2626 default: 2606 2627 *fLog << warn << "Sorry, unknown or unsupported file type..." << endl; … … 2618 2639 // Maintain tab numbers 2619 2640 // 2620 const Int_t from = num<0 ? 1 : num;2621 const Int_t to = num<0 ? fTab->GetNumberOfTabs() : num+1;2641 Int_t from, to; 2642 GetCanvasRange(from, to, num); 2622 2643 2623 2644 for (int i=from; i<to; i++) … … 2714 2735 // Maintain tab numbers 2715 2736 // 2716 const Int_t from = num<0 ? 1 : num;2717 const Int_t to = num<0 ? fTab->GetNumberOfTabs() : num+1;2737 Int_t from, to; 2738 GetCanvasRange(from, to, num); 2718 2739 2719 2740 for (int i=from; i<to; i++) … … 2819 2840 if (name.EndsWith(".gif")) return SaveAsGIF(num, name); 2820 2841 if (name.EndsWith(".png")) return SaveAsPNG(num, name); 2842 if (name.EndsWith(".bmp")) return SaveAsBMP(num, name); 2843 if (name.EndsWith(".xml")) return SaveAsXML(num, name); 2821 2844 if (name.EndsWith(".jpg")) return SaveAsJPG(num, name); 2822 2845 if (name.EndsWith(".xpm")) return SaveAsXPM(num, name); … … 2841 2864 "Jpeg files", "*.jpeg", 2842 2865 "Xpm files", "*.xpm", 2866 "Bmp files", "*.bmp", 2867 "Xml files", "*.xml", 2843 2868 "Macro files", "*.C", 2844 2869 "ROOT files", "*.root", -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
r7458 r7825 46 46 kFileSaveAsPS, kFileSaveAsPDF, kFileSaveAsSVG, kFileSaveAsRoot, 47 47 kFileSaveAsPNG, kFileSaveAsGIF, kFileSaveAsJPG, kFileSaveAsXPM, 48 /*kFileSaveAsBMP,kFileSaveAsXCF, kFileSaveAsTIFF,*/49 kFileSaveAs C, kFilePrint, kFilePrinterName,48 kFileSaveAsBMP, /*kFileSaveAsXCF, kFileSaveAsTIFF,*/ 49 kFileSaveAsXML, kFileSaveAsC, kFilePrint, kFilePrinterName, 50 50 kFileClose, kFileExit, kFileReset, 51 51 // kLoop … … 54 54 kTabSave, kTabSaveAs, kTabSaveAsPS, kTabSaveAsPDF, kTabSaveAsSVG, 55 55 kTabSaveAsRoot, kTabSaveAsPNG, kTabSaveAsGIF, kTabSaveAsJPG, 56 kTabSaveAsXPM, /*kTabSaveAsBMP,kTabSaveAsXCF, kTabSaveAsTIFF,*/57 kTabSaveAs C,56 kTabSaveAsXPM, kTabSaveAsBMP, /*kTabSaveAsXCF, kTabSaveAsTIFF,*/ 57 kTabSaveAsXML, kTabSaveAsC, 58 58 kTabPrint, kTabNext, kTabPrevious, kTabRemove, 59 59 // kSize … … 154 154 TString PrintDialog(TString &p, TString &c, TString &t, const char *ext=0); 155 155 156 void GetCanvasRange(Int_t &from, Int_t &to, Int_t num=-1) const; 156 157 157 158 public: … … 220 221 //Bool_t SaveAsTIFF(TString name="") { return SaveAsTIFF(-1, name); } 221 222 //Bool_t SaveAsXCF(TString name="") { return SaveAsXCF(-1, name); } 222 //Bool_t SaveAsBMP(TString name="") { return SaveAsBMP(-1, name); } 223 Bool_t SaveAsBMP(TString name="") { return SaveAsBMP(-1, name); } 224 Bool_t SaveAsXML(TString name="") { return SaveAsXML(-1, name); } 223 225 Bool_t SaveAsC(TString name="") { return SaveAsC(-1, name); } 224 226 Int_t SaveAsRoot(TString name="") { return SaveAsRoot(-1, name); } … … 235 237 //Bool_t SaveAsTIFF(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kTiff); } 236 238 //Bool_t SaveAsXCF(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kXcf); } 237 //Bool_t SaveAsBMP(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kBmp); } 239 Bool_t SaveAsBMP(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kBmp); } 240 Bool_t SaveAsXML(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kXml); } 238 241 Bool_t SaveAsC(Int_t num, TString name=""); 239 242 Int_t SaveAsRoot(Int_t num, TString name="");
Note:
See TracChangeset
for help on using the changeset viewer.