Index: trunk/MagicSoft/Mars/mbase/MEnv.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEnv.cc	(revision 7413)
+++ trunk/MagicSoft/Mars/mbase/MEnv.cc	(revision 7432)
@@ -34,5 +34,11 @@
 #include "MEnv.h"
 
+#include <Gtypes.h>
 #include <TObjString.h>
+
+#include <TAttText.h>
+#include <TAttFill.h>
+#include <TAttLine.h>
+#include <TAttMarker.h>
 
 #include "MLog.h"
@@ -62,4 +68,155 @@
         fChecked.Add(new TObjString(name));
     return TEnv::GetValue(name, dflt);
+}
+
+Int_t MEnv::GetColor(const char *name, Int_t dftl)
+{
+    TString str = GetValue(name, "");
+
+    str = str.Strip(TString::kBoth);
+    if (str.IsNull())
+        return dftl;
+
+    str.ToLower();
+
+    switch (str.Hash())
+    {
+    case (unsigned)-1926423925/*2368543371*/: return kWhite;
+    case 1814927399: return kBlack;
+    case 7496964:    return kRed;
+    case (unsigned)-1397860222/*2897107074*/: return kGreen;
+    case 1702194402: return kBlue;
+    case (unsigned)-1920149414/* 2374817882*/: return kYellow;
+    case (unsigned)-1400748595/*2894218701*/: return kMagenta;
+    case 1851881955: return kCyan;
+    case 749623518: return 18; // grey1
+    case 749623517: return 17; // grey2
+    case 749623516: return 16; // grey3
+    case 749623515: return 15; // grey4
+    case 749623514: return 14; // grey5
+    case 741234910: return 18; // gray1
+    case 741234909: return 17; // gray2
+    case 741234908: return 16; // gray3
+    case 741234907: return 15; // gray4
+    case 741234906: return 14; // gray5
+    }
+    return str.Atoi();
+}
+
+TString MEnv::Compile(TString str, const char *post) const
+{
+    if (!str.IsNull() && str[str.Length()-1]!='.')
+        str += ".";
+
+    str += post;
+
+    return str;
+}
+
+void MEnv::GetAttLine(const char *name, TAttLine &line, TAttLine *dftl)
+{
+    const TString color = Compile(name, "LineColor");
+    const TString style = Compile(name, "LineStyle");
+    const TString width = Compile(name, "LineWidth");
+
+    if (!dftl)
+        dftl = &line;
+
+    const Color_t col = GetColor(color, dftl->GetLineColor());
+    const Style_t sty = GetValue(style, dftl->GetLineStyle());
+    const Style_t wid = GetValue(width, dftl->GetLineWidth());
+
+    line.SetLineColor(col);
+    line.SetLineStyle(sty);
+    line.SetLineWidth(wid);
+}
+
+void MEnv::GetAttText(const char *name, TAttText &text, TAttText *dftl)
+{
+   const TString color = Compile(name, "TextColor");
+   const TString align = Compile(name, "TextAlign");
+   const TString angle = Compile(name, "TextAngle");
+   const TString font  = Compile(name, "TextFont");
+   const TString size  = Compile(name, "TextSize");
+
+    if (!dftl)
+        dftl = &text;
+
+    const Color_t col = GetColor(color, dftl->GetTextColor());
+    const Short_t ali = GetValue(align, dftl->GetTextAlign());
+    const Float_t ang = GetValue(angle, dftl->GetTextAngle());
+    const Font_t  fon = GetValue(font,  dftl->GetTextFont());
+    const Float_t siz = GetValue(size,  dftl->GetTextSize());
+
+    text.SetTextColor(col);
+    text.SetTextAlign(ali);
+    text.SetTextAngle(ang);
+    text.SetTextFont(fon);
+    text.SetTextSize(siz);
+}
+
+void MEnv::GetAttFill(const char *name, TAttFill &fill, TAttFill *dftl)
+{
+    const TString color = Compile(name, "FillColor");
+    const TString style = Compile(name, "FillStyle");
+
+    if (!dftl)
+        dftl = &fill;
+
+    const Color_t col = GetColor(color, dftl->GetFillColor());
+    const Style_t sty = GetValue(style, dftl->GetFillStyle());
+
+    fill.SetFillColor(col);
+    fill.SetFillStyle(sty);
+}
+
+void MEnv::GetAttMarker(const char *name, TAttMarker &marker, TAttMarker *dftl)
+{
+    const TString color = Compile(name, "MarkerColor");
+    const TString style = Compile(name, "MarkerStyle");
+    const TString size  = Compile(name, "MarkerSize");
+
+    if (!dftl)
+        dftl = &marker;
+
+    const Color_t col = GetColor(color, dftl->GetMarkerColor());
+    const Style_t sty = GetValue(style, dftl->GetMarkerStyle());
+    const Size_t  siz = GetValue(size,  dftl->GetMarkerSize());
+
+    marker.SetMarkerColor(col);
+    marker.SetMarkerStyle(sty);
+    marker.SetMarkerSize(siz);
+}
+
+void MEnv::GetAttributes(const char *name, TObject *obj, TObject *dftl)
+{
+    //TAttAxis         *line = dynamic_cast<TAttAxis*>(obj);
+    //TAtt3D           *line = dynamic_cast<TAtt3D*>(obj);
+    //TAttCanvas       *line = dynamic_cast<TAttCanvas*>(obj);
+    //TAttFillCanvas   *line = dynamic_cast<TAttFillEitor*>(obj);
+    //TAttLineCanvas   *line = dynamic_cast<TAttLineCanvas*>(obj);
+    //TAttLineEditor   *line = dynamic_cast<TAttLineEditor*>(obj);
+    //TAttMarkerCanvas *line = dynamic_cast<TAttMarkerCanvas*>(obj);
+    //TAttMarkerEditor *line = dynamic_cast<TAttMarkerEditor*>(obj);
+    //TAttPad          *line = dynamic_cast<TAttPad*>(obj);
+    //TAttParticle     *line = dynamic_cast<TAttParticle*>(obj);
+    //TAttTextCanvas   *line = dynamic_cast<TAttTextCanvas*>(obj);
+    //TAttTextEditor   *line = dynamic_cast<TAttTextEditor*>(obj);
+
+    TAttLine   *line = dynamic_cast<TAttLine*>(/*(TAttLine*)*/obj);
+    TAttText   *text = dynamic_cast<TAttText*>(/*(TAttText*)*/obj);
+    TAttFill   *fill = dynamic_cast<TAttFill*>(/*(TAttFill*)*/obj);
+    TAttMarker *mark = dynamic_cast<TAttMarker*>(/*(TAttMarker*)*/obj);
+
+    cout << line << " " << text << " " << fill << " " << mark << endl;
+
+    if (line)
+        GetAttLine(name, *line, dynamic_cast<TAttLine*>(/*(TAttLine*)*/dftl));
+    if (text)
+        GetAttText(name, *text, dynamic_cast<TAttText*>(/*(TAttText*)*/dftl));
+    if (fill)
+        GetAttFill(name, *fill, dynamic_cast<TAttFill*>(/*(TAttFill*)*/dftl));
+    if (mark)
+        GetAttMarker(name, *mark, dynamic_cast<TAttMarker*>(/*(TAttMarker*)*/dftl));
 }
 
Index: trunk/MagicSoft/Mars/mbase/MEnv.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEnv.h	(revision 7413)
+++ trunk/MagicSoft/Mars/mbase/MEnv.h	(revision 7432)
@@ -10,8 +10,15 @@
 #endif
 
+class TAttLine;
+class TAttMarker;
+class TAttText;
+class TAttFill;
+
 class MEnv : public TEnv
 {
 private:
     TOrdCollection fChecked;
+
+    TString Compile(TString str, const char *post) const;
 
 public:
@@ -22,4 +29,12 @@
     const char *GetValue(const char *name, const char *dflt);
 
+    Int_t       GetColor(const char *name, Int_t dftl);
+
+    void        GetAttributes(const char *name, TObject *obj, TObject *dftl=0);
+    void        GetAttLine(const char *name, TAttLine &line, TAttLine *dftl=0);
+    void        GetAttText(const char *name, TAttText &text, TAttText *dftl=0);
+    void        GetAttFill(const char *name, TAttFill &fill, TAttFill *dftl=0);
+    void        GetAttMarker(const char *name, TAttMarker &marker, TAttMarker *dftl=0);
+
     void PrintUntouched() const;
 
Index: trunk/MagicSoft/Mars/mbase/MTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTime.cc	(revision 7413)
+++ trunk/MagicSoft/Mars/mbase/MTime.cc	(revision 7432)
@@ -239,4 +239,21 @@
 {
     SetMjd(time*1000/kDay+49718);
+}
+
+// --------------------------------------------------------------------------
+//
+// Set this to the date of easter corresponding to the given year.
+// If calculation was not possible it is set to MTime()
+//
+// The date corresponding to the year of MTime(-1) is returned
+// if year<0
+//
+// The date corresponding to the Year() is returned if year==0.
+//
+//  for more information see: GetEaster and MAstro::GetEasterOffset()
+//
+void MTime::SetEaster(Short_t year)
+{
+    *this = GetEaster(year==0 ? Year() : year);
 }
 
@@ -515,5 +532,25 @@
 // The maximum size of the return string is 128 (incl. NULL)
 //
-TString MTime::GetStringFmt(const char *fmt) const
+// For dates before 1.1.1902  a null string is returned
+// For dates after 31.12.2037 a null string is returned
+//
+// To change the localization use loc, eg loc = "da_DK", "de_DE".
+// Leaving the argument empty will just take the default localization.
+//
+// If loc is "", each part of the locale that should be modified is set
+// according  to the environment variables. The details are implementation
+// dependent.  For glibc, first (regardless of category), the  environment
+// variable  LC_ALL  is  inspected, next the environment variable with the
+// same name as the category (LC_COLLATE, LC_CTYPE, LC_MESSAGES,  LC_MONE?
+// TARY,  LC_NUMERIC,  LC_TIME) and finally the environment variable LANG.
+// The first existing environment variable is used.
+//
+// A  locale  name  is  typically  of the form language[_territory][.code?
+// set][@modifier], where language is an ISO 639 language code,  territory
+// is an ISO 3166 country code, and codeset is a character set or encoding
+// identifier like ISO-8859-1 or UTF-8.   For  a  list  of  all  supported
+// locales, try "locale -a", cf. locale(1).
+//
+TString MTime::GetStringFmt(const char *fmt, const char *loc) const
 {
     if (!fmt)
@@ -525,4 +562,7 @@
     GetDate(y, mon, d);
     GetTime(h, m, s, ms);
+
+    if (y<1902 || y>2037)
+        return "";
 
     struct tm time;
@@ -535,9 +575,17 @@
     time.tm_isdst = 0;
 
+    const TString locale = setlocale(LC_TIME, 0);
+
+    setlocale(LC_TIME, loc);
+
     // recalculate tm_yday and tm_wday
     mktime(&time);
 
     char ret[128];
-    return TString(strftime(ret, 127, fmt, &time) ? ret : "");
+    const size_t rc = strftime(ret, 127, fmt, &time);
+
+    setlocale(LC_TIME, locale);
+
+    return rc ? ret : "";
 }
 
@@ -549,5 +597,5 @@
 // For more information see GetStringFmt
 //
-Bool_t MTime::SetStringFmt(const char *time, const char *fmt)
+Bool_t MTime::SetStringFmt(const char *time, const char *fmt, const char *loc)
 {
     if (!fmt)
@@ -556,5 +604,10 @@
     struct tm t;
     memset(&t, 0, sizeof(struct tm));
+
+    const TString locale = setlocale(LC_TIME, 0);
+
+    setlocale(LC_TIME, loc);
     strptime(time, fmt, &t);
+    setlocale(LC_TIME, locale);
 
     return Set(t.tm_year+1900, t.tm_mon+1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
@@ -795,2 +848,29 @@
     return out;
 }
+
+// --------------------------------------------------------------------------
+//
+// Calculate the day of easter for the given year.
+// MTime() is returned if this was not possible.
+//
+// In case of the default argument or the year less than zero
+// the date of eastern of the current year (the year corresponding to
+// MTime(-1)) is returned.
+//
+//  for more information see: MAstro::GetDayOfEaster()
+//
+MTime MTime::GetEaster(Short_t year)
+{
+    if (year<0)
+        year = MTime(-1).Year();
+
+    const Int_t day = MAstro::GetEasterOffset(year);
+    if (day<0)
+        return MTime();
+
+    MTime t;
+    t.Set(year, 3, 1);
+    t.SetMjd(t.GetMjd() + day);
+
+    return t;
+}
Index: trunk/MagicSoft/Mars/mbase/MTime.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTime.h	(revision 7413)
+++ trunk/MagicSoft/Mars/mbase/MTime.h	(revision 7432)
@@ -83,9 +83,10 @@
     Bool_t   SetSqlTimeStamp(const char *str);
     void     SetCT1Time(UInt_t mjd, UInt_t t1, UInt_t t0);
-    Bool_t   SetStringFmt(const char *time, const char *fmt);
+    Bool_t   SetStringFmt(const char *time, const char *fmt, const char *loc=0);
     Bool_t   UpdMagicTime(Byte_t h, Byte_t m, Byte_t s, UInt_t ns);
     Bool_t   SetMjd(UInt_t mjd, ULong_t ms, UInt_t ns=0);
     void     SetMjd(Double_t m);
     void     SetAxisTime(Double_t time);
+    void     SetEaster(Short_t year=0);
 
     // Getter functions
@@ -93,5 +94,5 @@
     Double_t GetGmst() const;
     TString  GetString() const;
-    TString  GetStringFmt(const char *fmt=0) const;
+    TString  GetStringFmt(const char *fmt=0, const char *loc=0) const;
     TString  GetSqlDateTime() const;
     TString  GetSqlTimeStamp() const;
@@ -112,10 +113,11 @@
     }
 
-    UInt_t Year() const  { UShort_t y; Byte_t m, d; GetDate(y,m,d); return y; }
-    UInt_t Month() const { UShort_t y; Byte_t m, d; GetDate(y,m,d); return m; }
-    UInt_t Day() const   { UShort_t y; Byte_t m, d; GetDate(y,m,d); return d; }
-    UInt_t Hour() const  { Byte_t h, m, s; GetTime(h,m,s); return h; }
-    UInt_t Min() const   { Byte_t h, m, s; GetTime(h,m,s); return m; }
-    UInt_t Sec() const   { Byte_t h, m, s; GetTime(h,m,s); return s; }
+    UInt_t Year() const    { UShort_t y; Byte_t m, d; GetDate(y,m,d); return y; }
+    UInt_t Month() const   { UShort_t y; Byte_t m, d; GetDate(y,m,d); return m; }
+    UInt_t Day() const     { UShort_t y; Byte_t m, d; GetDate(y,m,d); return d; }
+    Byte_t WeekDay() const { return TMath::Nint(TMath::Floor(GetMjd()+3))%7; } // Return Day of the week: Sun=0, Mon=1, ..., Sat=6
+    UInt_t Hour() const    { Byte_t h, m, s; GetTime(h,m,s); return h; }
+    UInt_t Min() const     { Byte_t h, m, s; GetTime(h,m,s); return m; }
+    UInt_t Sec() const     { Byte_t h, m, s; GetTime(h,m,s); return s; }
 
     Bool_t IsMidnight() const { return (Long_t)fTime==0 && fNanoSec==0; }
@@ -155,4 +157,6 @@
     bool operator!() const;
 
+    static MTime GetEaster(Short_t year=-1);
+
     ClassDef(MTime, 3)	//A generalized MARS time stamp
 };
