Changeset 7825 for trunk


Ignore:
Timestamp:
07/30/06 19:10:53 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7824 r7825  
    3131     - special solution for SavePrimitive because it calls a function
    3232       from the base class which also needs ofstream or ostream
     33
     34   * mbase/MStatusDisplay.[h,cc]:
     35     - switched on writing bmp and xml (I still found no program able
     36       to read this bmp, but they are written)
     37     - removed check for writing images in batch mode for root
     38       >= 5.12/00. It is working now.
     39     - calculate kB and MB correctly by dividing by 1000 instead of
     40       1024 (would be kiB and MiB)
    3341
    3442
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc

    r7458 r7825  
    265265    //savemenu->AddEntry("Save status.x&cf",  kFileSaveAsXCF);
    266266    //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);
    268269    savemenu->AddSeparator();
    269270    savemenu->AddEntry(MString::Form("%s&C",    fname.Data()), kFileSaveAsC);
     
    303304    //savemenu->AddEntry("Save status.x&cf",  kFileSaveAsXCF);
    304305    //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);
    306308    savemenu2->AddSeparator();
    307309    savemenu2->AddEntry(MString::Form("%s&C",    fname2.Data()), kTabSaveAsC);
     
    822824    TRootEmbeddedCanvas *ec = GetEmbeddedCanvas(cf);
    823825    return ec ? ec->GetCanvas() : NULL;
     826}
     827
     828// --------------------------------------------------------------------------
     829//
     830// Returns the range of tabs containing valid canvases for the condition
     831// num.
     832//
     833void 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;
    824839}
    825840
     
    15101525    //    return kTRUE;
    15111526
    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;
    15151534
    15161535    case kFileSaveAsC:
     
    15621581    //    return kTRUE;
    15631582
    1564     //case kTabSaveAsBMP:
    1565     //    SaveAsBMP(fTab->GetCurrent());
    1566     //    return kTRUE;
    1567 
    15681583    //case kTabSaveAsTIFF:
    15691584    //    SaveAsTIFF(fTab->GetCurrent());
    15701585    //    return kTRUE;
     1586
     1587    case kTabSaveAsBMP:
     1588        SaveAsBMP(fTab->GetCurrent());
     1589        return kTRUE;
     1590
     1591    case kTabSaveAsXML:
     1592        SaveAsXML(fTab->GetCurrent());
     1593        return kTRUE;
    15711594
    15721595    case kTabSaveAsC:
     
    19181941    {
    19191942        type = 'M';
    1920         val /= 1024;
     1943        val /= 1000;
    19211944    }
    19221945    if (val>999)
    19231946    {
    19241947        type = 'G';
    1925         val /= 1024;
     1948        val /= 1000;
    19261949    }
    19271950    const TString txt = MString::Form("%.1f%c", val, type);
     
    21422165    list.Add(&named);
    21432166
    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);
    21472169
    21482170    TCanvas *c;
     
    23052327        static_cast<TPostScript&>(vps).Range(psw, psh);
    23062328    // 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);
    23082330    // if (vps.InheritsFrom(TSVG::Class()))
    23092331    //     static_cast<TSVG&>(vps).Range(psw, psh);
     
    23142336    if (vps.InheritsFrom(TPostScript::Class()))
    23152337        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);
    23182340    // if (vps.InheritsFrom(TSVG::Class()))
    23192341    //    static_cast<TSVG&>(vps).TextNDC(u, v, string);
     
    24062428    // Maintain tab numbers
    24072429    //
    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);
    24112432
    24122433    for (int i=from; i<to; i++)
     
    25342555Bool_t MStatusDisplay::SaveAsImage(Int_t num, TString name, TImage::EImageFileTypes type)
    25352556{
    2536 //#if ROOT_VERSION_CODE < ROOT_VERSION(4,04,00)
     2557#if ROOT_VERSION_CODE < ROOT_VERSION(5,12,00)
    25372558    if (gROOT->IsBatch())
    25382559    {
     
    25402561        return 0;
    25412562    }
    2542 //#endif
     2563#endif
    25432564
    25442565    SetStatusLine1("Writing image file...");
     
    25852606//        ext = AddExtension(name, "cur", num);
    25862607//        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;
    25902611//    case TImage::kXcf:
    25912612//        ext = AddExtension(name, "xcf", num);
     
    26002621//        ext = AddExtension(name, "tga", num);
    26012622//        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;
    26052626    default:
    26062627        *fLog << warn << "Sorry, unknown or unsupported file type..." << endl;
     
    26182639    // Maintain tab numbers
    26192640    //
    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);
    26222643
    26232644    for (int i=from; i<to; i++)
     
    27142735    // Maintain tab numbers
    27152736    //
    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);
    27182739
    27192740    for (int i=from; i<to; i++)
     
    28192840    if (name.EndsWith(".gif"))  return SaveAsGIF(num, name);
    28202841    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);
    28212844    if (name.EndsWith(".jpg"))  return SaveAsJPG(num, name);
    28222845    if (name.EndsWith(".xpm"))  return SaveAsXPM(num, name);
     
    28412864        "Jpeg files",   "*.jpeg",
    28422865        "Xpm files",    "*.xpm",
     2866        "Bmp files",    "*.bmp",
     2867        "Xml files",    "*.xml",
    28432868        "Macro files",  "*.C",
    28442869        "ROOT files",   "*.root",
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.h

    r7458 r7825  
    4646        kFileSaveAsPS, kFileSaveAsPDF, kFileSaveAsSVG, kFileSaveAsRoot,
    4747        kFileSaveAsPNG, kFileSaveAsGIF, kFileSaveAsJPG, kFileSaveAsXPM,
    48         /*kFileSaveAsBMP, kFileSaveAsXCF, kFileSaveAsTIFF,*/
    49         kFileSaveAsC, kFilePrint, kFilePrinterName,
     48        kFileSaveAsBMP, /*kFileSaveAsXCF, kFileSaveAsTIFF,*/
     49        kFileSaveAsXML, kFileSaveAsC, kFilePrint, kFilePrinterName,
    5050        kFileClose, kFileExit, kFileReset,
    5151        // kLoop
     
    5454        kTabSave, kTabSaveAs, kTabSaveAsPS, kTabSaveAsPDF, kTabSaveAsSVG,
    5555        kTabSaveAsRoot, kTabSaveAsPNG, kTabSaveAsGIF, kTabSaveAsJPG,
    56         kTabSaveAsXPM, /*kTabSaveAsBMP, kTabSaveAsXCF, kTabSaveAsTIFF,*/
    57         kTabSaveAsC,
     56        kTabSaveAsXPM, kTabSaveAsBMP, /*kTabSaveAsXCF, kTabSaveAsTIFF,*/
     57        kTabSaveAsXML, kTabSaveAsC,
    5858        kTabPrint, kTabNext, kTabPrevious, kTabRemove,
    5959        // kSize
     
    154154    TString PrintDialog(TString &p, TString &c, TString &t, const char *ext=0);
    155155
     156    void GetCanvasRange(Int_t &from, Int_t &to, Int_t num=-1) const;
    156157
    157158public:
     
    220221     //Bool_t SaveAsTIFF(TString name="") { return SaveAsTIFF(-1, name); }
    221222     //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); }
    223225     Bool_t SaveAsC(TString name="")    { return SaveAsC(-1, name); }
    224226     Int_t  SaveAsRoot(TString name="") { return SaveAsRoot(-1, name); }
     
    235237     //Bool_t SaveAsTIFF(Int_t num, TString name="") { return SaveAsImage(num, name, TImage::kTiff); }
    236238     //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); }
    238241     Bool_t SaveAsC(Int_t num, TString name="");
    239242     Int_t  SaveAsRoot(Int_t num, TString name="");
Note: See TracChangeset for help on using the changeset viewer.