Ignore:
Timestamp:
12/05/05 16:36:41 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MEnv.cc

    r7432 r7442  
    3737#include <TObjString.h>
    3838
     39#include <TPave.h>
    3940#include <TAttText.h>
    40 #include <TAttFill.h>
    41 #include <TAttLine.h>
     41//#include <TAttFill.h>
     42//#include <TAttLine.h>
    4243#include <TAttMarker.h>
    4344
     
    6869        fChecked.Add(new TObjString(name));
    6970    return TEnv::GetValue(name, dflt);
     71}
     72
     73Int_t MEnv::GetFillStyle(const char *name, Int_t dftl)
     74{
     75    TString str = GetValue(name, "");
     76    str = str.Strip(TString::kBoth);
     77    if (str.IsNull())
     78        return dftl;
     79
     80    str.ToLower();
     81
     82    switch (str.Hash())
     83    {
     84    case (unsigned)-1920099718/*2374867578*/: return 0;// hollow
     85    case 764279305:  return 1001;// solid
     86    case 1854683492: return 2001; // hatch
     87    }
     88
     89    return str.EndsWith("%") ? 4000+str.Atoi() : str.Atoi();
    7090}
    7191
     
    106126TString MEnv::Compile(TString str, const char *post) const
    107127{
    108     if (!str.IsNull() && str[str.Length()-1]!='.')
     128    if (!str.IsNull() && !str.EndsWith("."))
    109129        str += ".";
    110130
     
    165185
    166186    const Color_t col = GetColor(color, dftl->GetFillColor());
    167     const Style_t sty = GetValue(style, dftl->GetFillStyle());
    168 
     187    const Style_t sty = GetFillStyle(style, dftl->GetFillStyle());
     188 
    169189    fill.SetFillColor(col);
    170190    fill.SetFillStyle(sty);
     
    187207    marker.SetMarkerStyle(sty);
    188208    marker.SetMarkerSize(siz);
     209}
     210
     211void MEnv::GetAttPave(const char *str, TPave &pave, TPave *dftl)
     212{
     213    const TString post(str);
     214
     215    TString name(pave.GetName());
     216    if (!name.IsNull() && name!=pave.ClassName())
     217        name = Compile(name, post);
     218
     219    GetAttLine(name, pave, dftl);
     220    GetAttFill(name, pave, dftl);
     221
     222    const TString corner = Compile(name, "CornerRadius");
     223    const TString border = Compile(name, "BorderSize");
     224    const TString option = Compile(name, "Option");
     225
     226    if (!dftl)
     227        dftl = &pave;
     228
     229    const Double_t cor = GetValue(corner, dftl->GetCornerRadius());
     230    const Int_t    bor = GetValue(border, dftl->GetBorderSize());
     231
     232    pave.SetCornerRadius(cor);
     233    pave.SetBorderSize(bor);
     234
     235    TString  opt = GetValue(option, dftl->GetOption());
     236    opt.ToLower();
     237
     238    const Bool_t has = pave.GetCornerRadius()>0;
     239
     240    if (has && !opt.Contains("arc"))
     241        opt += "arc";
     242
     243    if (!has && opt.Contains("arc"))
     244        opt.ReplaceAll("arc", "");
     245
     246    pave.SetOption(opt);
     247
    189248}
    190249
     
    204263    //TAttTextEditor   *line = dynamic_cast<TAttTextEditor*>(obj);
    205264
     265    TPave      *pave = dynamic_cast<TPave*>(/*(TAttLine*)*/obj);
    206266    TAttLine   *line = dynamic_cast<TAttLine*>(/*(TAttLine*)*/obj);
    207267    TAttText   *text = dynamic_cast<TAttText*>(/*(TAttText*)*/obj);
     
    210270
    211271    cout << line << " " << text << " " << fill << " " << mark << endl;
     272
     273    if (pave)
     274    {
     275        GetAttPave(name, *pave, dynamic_cast<TPave*>(dftl));
     276        return;
     277    }
    212278
    213279    if (line)
     
    228294    TIter Next(GetTable());
    229295    TObject *o=0;
     296
    230297    while ((o=Next()))
    231298        if (!fChecked.FindObject(o->GetName()))
  • trunk/MagicSoft/Mars/mbase/MEnv.h

    r7432 r7442  
    1414class TAttText;
    1515class TAttFill;
     16class TPave;
    1617
    1718class MEnv : public TEnv
     
    3031
    3132    Int_t       GetColor(const char *name, Int_t dftl);
     33    Int_t       GetFillStyle(const char *name, Int_t dftl);
    3234
    3335    void        GetAttributes(const char *name, TObject *obj, TObject *dftl=0);
     
    3638    void        GetAttFill(const char *name, TAttFill &fill, TAttFill *dftl=0);
    3739    void        GetAttMarker(const char *name, TAttMarker &marker, TAttMarker *dftl=0);
     40    void        GetAttPave(const char *name, TPave &pave, TPave *dftl=0);
    3841
    3942    void PrintUntouched() const;
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r7432 r7442  
    532532// The maximum size of the return string is 128 (incl. NULL)
    533533//
    534 // For dates before 1.1.1902  a null string is returned
     534// For dates before 1. 1.1902  a null string is returned
    535535// For dates after 31.12.2037 a null string is returned
    536536//
Note: See TracChangeset for help on using the changeset viewer.