Index: trunk/MagicSoft/Mars/macros/tutorials/calendar.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/calendar.C	(revision 7890)
+++ trunk/MagicSoft/Mars/macros/tutorials/calendar.C	(revision 7890)
@@ -0,0 +1,183 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz 8/2006 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2004-2006
+!
+!
+\* ======================================================================== */
+
+///////////////////////////////////////////////////////////////////////////
+//
+// calendar.C
+//
+// example of how to use MCalendar to draw your calendar
+//
+// For more details of the usage and the resources resources please
+// refer to the class reference of MCalendar and the descriptions
+// of its member functions.
+//
+// To write an output file check the end of the loop.
+//
+// For more information on the setup see also
+//   macros/tutorials/calendar.rc
+//   macros/tutorials/holidays.rc
+//
+///////////////////////////////////////////////////////////////////////////
+
+void calendar()
+{
+    // 2, 10, 13
+    gStyle->SetTextFont(6*10+2);
+
+    // Define the path where your resource files are located
+    TString rcpath  = "macros/tutorials/";
+
+    // Define the path where your images are
+    TString imgpath = "./";
+
+    // Create the object containing your setup
+    MEnv env(rcpath+"calendar.rc");
+
+    // Create the display to show your calendar
+    MStatusDisplay *d = new MStatusDisplay(1426, 1050);
+
+    // Define the first and last month which you want to make a
+    // piece of
+    Int_t first=1;
+    Int_t last=12;
+
+    // Loop over all months
+    for (Int_t month=first; month<=last; month++)
+    {
+        // Create an object do draw your calendar
+        MCalendar *cal=new MCalendar;
+        cal->SetBit(kCanDelete);
+
+        // Set the month and year you want to draw it for
+        cal->SetDate(month, 2006);
+
+        // Read resource file defining the layout.
+        // You could also skip this line. In this case a nice
+        // default layout is used instead
+        cal->ReadResourceFile(rcpath+"calendar.rc");
+
+        // Read file containing the holidays.
+        // You could also skip this file. In this case
+        // only New Year, Easter and Christmas are shown.
+        cal->ReadHolidayFile(rcpath+"holidays.rc");
+
+        // Get the image corresponding to the month
+        TASImage *img = cal->GetImage(&env, imgpath);
+        if (!img)
+        {
+            delete cal;
+            continue;
+        }
+
+        // Check whether the layout should be horizontal or vertical
+        Bool_t hor = img->GetWidth()>img->GetHeight();
+        Int_t background = kWhite;
+
+        // Define layout of day-table for this month
+        if (hor)
+            cal->SetLayout(2, 0.05, 0.1, 0.015, 0.03);
+        else
+            cal->SetLayout(1, 0.05, 0.05, 0.005, 0);
+
+        // Get the name of the month
+        TString strmonth = cal->GetStringFmt("%b");
+        // convert Umlauts to "StatusDisplay-charset"
+        MCalendar::ConvertUTF8(strmonth, kFALSE);
+
+        // Add a new tab for this month
+        TCanvas &c = d->AddTab(strmonth);
+        // Set background color for the tab
+        c.SetFillColor(background);
+
+        // conver month name to latex format
+        MCalendar::Convert2Latex(strmonth);
+
+        // Create the main pad
+        TPad *pad2;
+        if (hor)
+            pad2=new TPad("Dat", "Data", 0, 0.01, 1, 0.3);
+        else
+            pad2=new TPad("Dat", "Data", 0.5, 0.19, 1, 0.81);
+        pad2->SetBorderMode(0);
+        pad2->SetFillColor(background);
+        pad2->SetBit(kCanDelete);
+
+        // Draw the image to your month-tab
+        c.cd();
+
+        if (hor)
+            cal->DrawImage(*img, 0, 0.305, 0.628, 1, kTRUE);
+        else
+            cal->DrawImage(*img, 0, 0, 0.5, 0.99, kTRUE);
+
+        gPad->SetFixedAspectRatio();
+        delete img;
+
+        // Draw the date to your month-tab
+        Double_t x1, y1, x2, y2;
+        gPad->GetPadPar(x1, y1, x2, y2);
+
+        c.cd();
+
+        if (hor)
+            cal->DrawTTFDate(0.64, 0.83, 1, 1, "%B %Y", 0.072, "minynbi_");
+        else
+            cal->DrawTTFDate(0.5, 0.83, 1, 1, "%B %Y", 0.085, "minynbi_");
+
+
+        c.cd();
+
+        // Get description and draw description
+        TString txt = env.GetValue(Form("%02d.Text", month), "");
+        if (!txt.IsNull())
+        {
+            MCalendar::Convert2Latex(txt);
+
+            TAttText att1(11, 0, kBlack, 42, 0.023);
+            if (hor)
+                cal->DrawDate(0.63, 0.31, txt, att1);
+            else
+                cal->DrawDate(0.5, 0.01, txt, att1);
+
+        }
+
+        // Now make sure that everything is displayed as expected...
+        pad2->Draw();
+
+        gROOT->SetSelectedPad(0);
+        pad2->cd();
+        cal->Draw();
+
+        pad2->Modified();
+        pad2->Update();
+
+        c.Update();
+
+        // Uncomment this lines to write a postscript (or pdf) file
+        //TString psfile = "calendar.ps";
+        //if (month==first) psfile+="(";
+        //if (month==last)  psfile+=")";
+        //c.Print(psfile, "portrait");
+    }
+}
Index: trunk/MagicSoft/Mars/macros/tutorials/calendar.rc
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/calendar.rc	(revision 7890)
+++ trunk/MagicSoft/Mars/macros/tutorials/calendar.rc	(revision 7890)
@@ -0,0 +1,151 @@
+# -------------------------------------------------------------
+#  THIS RESOURCE FILES IS AN EXAMPLE AND BELONGS TO calendar.C
+# -------------------------------------------------------------
+
+# Define the images for the 12 months
+01: magic_t.xpm
+02: marslogo.xpm
+03: marslogo.xpm
+04: magic_t.xpm
+05: marslogo.xpm
+06: marslogo.xpm
+07: magic_t.xpm
+08: marslogo.xpm
+09: marslogo.xpm
+10: magic_t.xpm
+11: marslogo.xpm
+12: marslogo.xpm
+
+# define descriptions for your images
+01.Text: All File types supported by TASImage are supported
+02.Text: 
+03.Text: 
+04.Text: 
+05.Text: 
+06.Text: 
+07.Text: 
+08.Text: 
+09.Text: 
+10.Text: 
+11.Text: 
+12.Text: 
+
+# ------------------------------------------------------------
+# General information
+#
+# This are the most important settings. For more details of
+# more resources please have a look at the class reference 
+# of MCalendar and the descriptions of its member functions.
+
+# For something in the box for each day (defined in "Contents")
+# you have several options which are always known (as an example
+# "Day" is used here):
+#
+#  - Day.TextAlign: Center
+#    Defines the position of the output in the box. For more 
+#    details about what is allowed see MEnv::GetAlign
+#
+#  - Day.Format: %e
+#    available if a number (month, week, day, etc) should be
+#    formatted (or converted into text) For more details on
+#    the allowed formats see MTime::GetFormatStr or strftime
+#
+#  - Day.TextColor: Blue
+#    Defined the output color. For more details see
+#    MEnv::GetColor
+#
+#  - Day.TextFont: 62
+#    Define the font for the output text. For more details
+#    see TAttText
+#
+#  - To change the settings depending on the day of the week
+#    (0=sonday, 1=monday, etc) put the number of the day
+#    behind the Name of your resource, eg. To diaply the day-number
+#    of sundays in red (while all others are black) use
+#       Day.TextColor: Black
+#       Day.Active.0.TextColor: Red
+#    The term Active before the 0 defines that only the active
+#    days are printed in red. Active days are the days which belong 
+#    to the current month (sometimes before the beginning or end
+#    of a month the days of the previous or next month are shown,
+#    the are called Inactive) To change the color of the inactive
+#    sundays to red do
+#       Day.Inactive.0.TextColor: Red
+#    You can also change the text font to green for all active
+#    days (except the sunday which is already set to red):
+#       Day.Active.TextColor: red
+#
+# ------------------------------------------------------------
+
+# Which contents should the calendar have?
+# Possible options are: Day Date Holiday Birthday DayName Week
+Contents: Day Date Holiday Birthday DayName
+
+# What is the language for the month and day names?
+Language: de_DE
+
+# Where in the boxes should the moon grafic and text be aligned?
+# (The numbers are according to TAttText, 0 means off)
+Moon.Graf.Align: 11
+Moon.Text.Align: 0
+
+# This lines can be used to draw the week number somewhere
+# Restriction is string containing the number of all days
+# at which the week should be printed (eg. "0" for sundays,
+# "1" for mondays or "01" for sunday and monday
+#Week.TextAlign:    top right
+#Week.Format:       KW%V
+#Week.Restriction:  1
+#Week.TextSize:     0.1
+#Week.Active.TextColor: Grey8
+#Week.Inactive.TextFont:   42
+#Week.Inactive.TextColor: 17
+
+# Define the layout of the day-name.
+Day.TextAlign:            top left
+Day.Format:               %e
+#Day.TextFont: 62
+#Day.Active.TextFont:      22
+Day.Inactive.TextFont:    42
+Day.Inactive.TextColor:   17
+Day.Inactive.0.TextColor: 17
+
+# Define the layout of the date (number)
+Date.TextAlign:           bottom right
+Date.Format:              %a
+Date.Active.0.TextColor:  2
+#Date.Active.TextFont:     22
+Date.Inactive.TextFont:   42
+Date.Inactive.FillColor: 19
+Date.Inactive.TextColor:  17
+Date.Active.0.FillColor: 17
+Date.Inactive.0.FillColor: 18
+Date.Inactive.0.TextColor: 17
+
+# Define the layout of holidays, including the easter holidays
+# (see holiday.rc)
+Holiday.TextAlign:        center
+Holiday.TextSize:         0.13
+Holiday.TextColor:        4
+Holiday.Inactive.TextColor: 17
+Holiday.TextFont:         62
+
+# Define the layout of birthdays (see holiday.rc)
+Birthday.TextAlign:       center
+Birthday.TextSize:        0.13
+Birthday.TextColor:       Dark Green
+Birthday.Inactive.TextColor: 17
+Birthday.TextFont:        62
+
+# Define the layout for days with a name (eg. "Good Friday") which
+# might not be holidays
+DayName.TextColor:        13
+DayName.TextAlign:        Center
+DayName.TextFont:         62
+DayName.TextSize:         0.13
+DayName.Inactive.TextColor: 17
+DayName.Inactive.0.TextColor: 17
+
+# This is the definition of the moon grafic color
+Moon.Inactive.FillColor: 18
+Moon.Inactive.0.FillColor: 17
Index: trunk/MagicSoft/Mars/macros/tutorials/holidays.rc
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/holidays.rc	(revision 7890)
+++ trunk/MagicSoft/Mars/macros/tutorials/holidays.rc	(revision 7890)
@@ -0,0 +1,94 @@
+# -------------------------------------------------------------
+#  THIS RESOURCE FILES IS AN EXAMPLE AND BELONGS TO calendar.C
+# -------------------------------------------------------------
+
+# --------------------------------------------------
+# Use this file to change the holidays to your local
+# holidays with the corresponding names
+# --------------------------------------------------
+#
+# There are sevral kind of holidays:
+#
+#   - Holiday.mm/dd: Name
+#     A holiday at the date defined by mm/dd
+#      eg. Holiday.01/01: New Year
+#
+#   - Holiday.n: Name
+#     A holiday n days after easter (sunday)
+#      eg. Holiday.1: Easter Monday
+#
+#   - Holiday.-n: Name
+#     A holiday n days before easter (sunday)
+#      eg. Holiday.-2: Good Friday
+#
+# If it is not a holiday (as "Good Friday" might be) replace
+# Holiday by DayName which is used for days which have a name
+# but which are no holidays, eg.
+#
+#      DayName.-2: Good Friday
+#
+# For Birthdays use:
+#  
+#    - Birthday.mm/dd: Name
+#      eg. Birthday.09/09: Thomas
+#
+# ----------------- Fixed holidays -----------------
+Holiday.01/01: Neujahr
+Holiday.01/06: Hl. drei Könige
+#Holiday.05/01: #splitline{Tag der}{ Arbeit}
+Holiday.05/01: Maifeiertag
+Holiday.08/15: #splitline{      Mariä}{Himmelfahrt}
+Holiday.10/03: #splitline{  Tag der}{dt. Einheit}
+Holiday.11/01: Allerheiligen
+Holiday.12/25: 1.Weihnachtstag
+Holiday.12/26: 2.Weihnachtstag
+Holiday.12/31: Silvester
+
+# --------- Days with a name w.r.t. Easter ---------
+DayName.-48: Rosenmontag
+DayName.-47: #splitline{Faschings-}{  dienstag}
+DayName.-46: #splitline{ Ascher-}{mittwoch}
+DayName.-7: Palmsonntag
+DayName.-3: Gründonnerstag
+DayName.-2: Karfreitag
+DayName.7: Weißer Sonntag
+DayName.02/14: Valentinstag
+DayName.05/05: Europatag
+DayName.06/27: Siebenschläfer
+DayName.10/31: Reformationstag
+DayName.11/02: Allerseelen
+DayName.11/11: Martin
+DayName.12/06: Nikolaus
+DayName.12/24: Heiligabend
+
+DayName.03/20: Frühlingsanfang
+DayName.06/21: Sommeranfang
+DayName.09/22: Herbstanfang
+DayName.12/21: Winteranfang
+
+# ------------------- Birthdays -------------------
+Birthday.09/09: Thomas
+Birthday.07/16: Daniela
+
+# -------------- Holidays wrt. easter -------------
+Holiday.0: Ostersonntag
+Holiday.1: Ostermontag
+Holiday.39: #splitline{    Christi}{Himmelfahrt}
+Holiday.49: Pfingstsonntag
+Holiday.50: Pfingstmontag
+Holiday.60: Fronleichnam
+
+# ------------ Last Sunday before -----------------
+DayName.05/14-0: Muttertag
+DayName.11/19-0: Volkstrauertag
+DayName.11/26-4: Buß- und Bettag
+DayName.11/11-0: Totensonntag
+DayName.12/03-0: 1.Advent
+DayName.12/10-0: 2.Advent
+DayName.12/17-0: 3.Advent
+DayName.12/24-0: 4.Advent
+
+# "T+" and "T-" are used to display the symbols
+# to show the change between summer and winter time
+DayName.03/31-0: T+
+DayName.10/31-0: T-
