Index: trunk/Mars/macros/starvisday.C
===================================================================
--- trunk/Mars/macros/starvisday.C	(revision 12017)
+++ trunk/Mars/macros/starvisday.C	(revision 12764)
@@ -33,4 +33,20 @@
 ///////////////////////////////////////////////////////////////////////////
 
+void zoom()
+{
+    TH1 *h = (TH1*)gPad->FindObject("frame");
+    if (!h)
+        return;
+
+    Int_t mjd = TMath::FloorNint(h->GetXaxis()->GetXmin());
+
+    h->GetXaxis()->SetRangeUser(mjd+0.33*3600*24, mjd+0.85*3600*24);
+    h->GetYaxis()->SetRangeUser(35, 90);
+
+    gPad->Modified();
+    gPad->Update();
+}
+
+
 void starvisday()
 {
@@ -39,5 +55,5 @@
 
     // Setup a different time as you like
-    // time.Set(2006, 10, 10);
+    // time.Set(2006, 12, 20);
 
     // Current observatory (see class reference of MObservatory)
@@ -51,5 +67,5 @@
     // Read the stars from a star catalog. The catalogs can be downloaded
     // from the Mars web page. For more information see class reference.
-    stars.ReadXephem("/magic/datacenter/setup/magic_favorites.edb");
+    stars.ReadXephem("magic_favorites.edb");
 
     // Mark the stars you would like to display (see the names in the catalog)
@@ -58,7 +74,8 @@
     stars.MarkObject("1ES1426+428");
     stars.MarkObject("Mrk421");
-    stars.MarkObject("Mrk501");
-    stars.MarkObject("1ES1959+650");
-    stars.MarkObject("1ES2344+514");
+    // stars.MarkObject("Mrk501");
+    // stars.MarkObject("1ES1959+650");
+    // stars.MarkObject("1ES2344+514");
+    stars.MarkObject("M87");
 
     // --------------------------------------------------------------------------
@@ -77,26 +94,59 @@
     c->SetGridy();
 
+    // Setup the TGraph which is drawn
+    TGraph g;
+    g.SetTitle(Form("Visibility at %s, %s (MOON=%.1f%%)",
+                    obs.GetObservatoryName().Data(),
+                    time.GetStringFmt("%A %e.%B %Y").Data(),
+                    MAstro::GetMoonPhase(time.GetMjd())*100)
+              );
+    g.SetLineWidth(2);
+
+    // ===================
+    // Set graph name to object name
+    g.SetName("Moon");
+
+    // produce visibility curve
+    stars.GetVisibilityCurve(g, "Moon");
+
+    // Draw Frame
+    TH1F *hist = g.GetHistogram();
+    hist->SetName("frame");
+    hist->DrawCopy();
+
+    // Get x-range
+    TAxis *axex = g.GetXaxis();
+    Float_t mn = axex->GetBinLowEdge(axex->GetFirst());
+    Float_t mx = axex->GetBinUpEdge(axex->GetLast());
+
     // Draw the twilight and dark time
     TBox box;
-    box.SetFillStyle(4100);
-    for (int i=0; i<4; i++)
+
+    for (int i=3; i>=0; i--)
     {
         double set = obs.GetSunRiseSet(time.GetMjd()-1, -6*i)[1];
         double ris = obs.GetSunRiseSet(time.GetMjd(),   -6*i)[0];
 
-        box.SetFillColor(19-i);
-        box.DrawBox(MTime(set).GetAxisTime(),  5,
-                    MTime(ris).GetAxisTime(), 90);
+        box.SetFillStyle(3001);
+        box.SetFillColor(kGray+3-i);
+        box.DrawBox(mn, 5, MTime(set).GetAxisTime(), 90);
+        box.DrawBox(MTime(ris).GetAxisTime(), 5, mx, 90);
+        box.DrawBox(MTime(set).GetAxisTime(), 15+(i+1)*10,
+                    MTime(ris).GetAxisTime(),  5)+i*10;
     }
 
-    // Setup the TGraph which is drawn
-    TGraph g;
-    g.SetTitle(Form("Visibility at %s, %s",
-                    obs.GetObservatoryName().Data(),
-                    time.GetStringFmt("%A %e.%B %Y").Data()));
+    // Draw TGraph for Moon
+    g.SetFillStyle(3003);
+    g.SetFillColor(kRed+1);
+    g.SetLineColor(kRed+1);
+    g.SetLineWidth(1);
+    g.SetLineStyle(kDotted);
+    g.DrawClone("bc")->SetBit(kCanDelete);
     g.SetLineWidth(2);
 
+    // ===================
+
     // Some helper to iterate these three colors
-    Int_t col[] = { kBlack, kBlue, kRed };
+    Int_t col[] = { kBlack, kBlue, kRed+1, kMagenta+1, kGreen+2 };
 
     // Loop over all stars in the catalog
@@ -116,22 +166,24 @@
         stars.GetVisibilityCurve(g);
 
+        // Setup color and style of TGraph
+        g.SetLineColor(col[k%5]);
+        g.SetLineStyle(1+k/3);
+
+        // Draw TGraph
+        g.DrawClone("c")->SetBit(kCanDelete);
+
+        // Search for culmination
+        Long64_t max = TMath::LocMax(g.GetN(), g.GetY());
+
         // Setup description
         TText txt;
         txt.SetTextFont(102);
         txt.SetTextSize(0.03);
-        txt.SetTextColor(col[k%3]);
-
-        // Setup color and style of TGraph
-        g.SetLineColor(col[k%3]);
-        g.SetLineStyle(1+k/3);
-
-        // Draw TGraph
-        g.DrawClone(k++?"c":"ac")->SetBit(kCanDelete);
-
-        // Search for culmination
-        Long64_t max = TMath::LocMax(g.GetN(), g.GetY());
+        txt.SetTextColor(g.GetLineColor());
 
         // draw name at culmination
         txt.DrawText(g.GetX()[max]-1.0*3600, g.GetY()[max]+1, o->GetName());
+
+        k++;
     }
 
@@ -139,13 +191,5 @@
     c->Update();
 
-    // Draw a line for the "best observation conditions"
-    TLine line;
-    line.SetLineWidth(2);
-    line.SetLineStyle(9);
-    line.SetLineColor(13);
-
-    TAxis &axe = *g.GetHistogram()->GetXaxis();
-    line.DrawLine(axe.GetBinLowEdge(axe.GetFirst()), 65,
-                  axe.GetBinLowEdge(axe.GetLast()),  65);
-
+    TButton *but = new TButton("zoom", "zoom()", 0.88, 0.95, 0.99, 0.99);
+    but->Draw();
 }
