Index: trunk/MagicSoft/Cosy/gui/GuiLinkDef.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/GuiLinkDef.h	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/GuiLinkDef.h	(revision 7790)
@@ -15,4 +15,5 @@
 #pragma link C++ class MGSkyPosition+;
 #pragma link C++ class MGStarg+;
+#pragma link C++ class MGNumStars+;
 
 #pragma link C++ class MGCosy+;
Index: trunk/MagicSoft/Cosy/gui/MGAccuracy.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGAccuracy.cc	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/MGAccuracy.cc	(revision 7790)
@@ -1,8 +1,2 @@
-//
-// This File contains the definition of the MGCoordinates-class
-//
-//   Author: Thomas Bretz
-//   Version: V1.0 (1-8-2000)
-
 #include "MGAccuracy.h"
 
@@ -13,5 +7,4 @@
 #include <TText.h>
 #include <TWbox.h>
-#include <TList.h>
 #include <TGaxis.h>
 #include <TGraph.h>
@@ -24,13 +17,30 @@
 ClassImp(MGAccuracy);
 
-void MGAccuracy::DrawCoordinateSystem()
-{
-    TWbox box;
-    box.DrawWbox(-145*2, 145*2, -15*2, 120*2,  18,  2, 1);
+void MGAccuracy::DrawText(const char *c1, const char *c2, const char *c3, const char*txt)
+{
+    fCanvas->SetEditable(kTRUE);
+    fCanvas->cd();
 
     TText text;
     text.SetTextAlign(22);  // centered, centered (s.TAttText)
-    text.DrawText(-80*2, 132.5*2, "Ctrl Deviation [min]");
-
+    text.DrawText(-150, 265, txt);
+
+    text.SetTextAlign(11);  // left, bottom (s.TAttText)
+    text.SetTextColor(3);
+    text.DrawText(220, -220, c1);
+
+    text.SetTextColor(5);
+    text.DrawText(220, -250, c2);
+
+    text.SetTextColor(2);
+    text.DrawText(220, -280, c3);
+
+    fCanvas->SetEditable(kFALSE);
+}
+
+void MGAccuracy::DrawCircles(Double_t rad)
+{
+    fCanvas->SetEditable(kTRUE);
+    fCanvas->cd();
 
     TArc arc;
@@ -39,27 +49,23 @@
     arc.SetLineColor(3);     // green
     arc.SetLineStyle(2);     // dashed  (s. TAttLine)
-    arc.DrawArc(0, 0, 79.1/2.);        // 0.5se
+    arc.DrawArc(0, 0, rad/2.);         // 0.5se
 
     arc.SetLineColor(5);     // yellow
-    arc.DrawArc(0, 0, 79.1);            // 1.0se
+    arc.DrawArc(0, 0, rad);            // 1.0se
 
     arc.SetLineColor(2);     // red
-    arc.DrawArc(0, 0, 79.1*2.);         // 2.0se
-
-
-    text.SetTextAlign(11);  // left, bottom (s.TAttText)
-    text.SetTextColor(3);
-    text.DrawText(220, -220, "0.5se");
-
-    text.SetTextColor(5);
-    text.DrawText(220, -250, "1.0se");
-
-    text.SetTextColor(2);
-    text.DrawText(220, -280, "2.0se");
-
-
-    TLine line;
-    line.DrawLine(-65*4,     0, 65*4,    0);
-    line.DrawLine(    0, -65*4,    0, 65*4);
+    arc.DrawArc(0, 0, rad*2.);         // 2.0se
+
+    fCanvas->SetEditable(kFALSE);
+}
+
+void MGAccuracy::DrawCoordinateSystem()
+{
+    TWbox box;
+    box.DrawWbox(-290, 290, -10, 240,  18,  2, 1);
+
+//    TLine line;
+//    line.DrawLine(-65*4,     0, 65*4,    0);
+//    line.DrawLine(    0, -65*4,    0, 65*4);
 
     //
@@ -122,5 +128,5 @@
 
 MGAccuracy::MGAccuracy(const TGWindow* p, const UInt_t w)
-: MGEmbeddedCanvas("Accuracy", p, w, 300)
+: MGEmbeddedCanvas("Accuracy", p, w, 300), fColorScale(360*60/16384)
 {
     // FIXME: Overload MapWindow in newer Root versions to remove
@@ -133,7 +139,4 @@
     fGraph->Draw("LP");
     fList->Add(fGraph);
-    //fGraph->SetNameTitle("AccVsT", "Accuracy vs Min of Time");
-    //fGraph->Draw("APL");
-    //fGraph->SetMarkerSize(2);
 
     DrawCoordinateSystem();
@@ -153,5 +156,4 @@
 MGAccuracy::~MGAccuracy()
 {
-    //    cout << "MGAccuracy destroyed." << endl;
 }
 
@@ -172,8 +174,8 @@
 
     fBar->SetY2(dist*60); // [sec]
-    if (dist*16384<1*360*60)
+    if (dist<fColorScale) //1*360*60/16384
         fBar->SetLineColor(kGreen);
     else
-        if (dist*16384<2*360*60)
+        if (dist<2*fColorScale) //2*360*60/16384
             fBar->SetLineColor(kYellow);
         else
@@ -227,12 +229,4 @@
 
     SetModified();
-
-    //cout << "N1 == " << fGraph->GetN() << endl;
-
-    //fGraph->GetHistogram()->SetXTitle("Time");
-    //fGraph->GetHistogram()->SetYTitle("\\Delta [arcmin]");
-    //fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%M %F1995-01-01 00:00:00");
-    //fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
-    //fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
 }
 
@@ -248,7 +242,4 @@
 {
     //
-    // calculate actual time for planet positions
-    // acc [deg]
-    //
     // x["], y["]
     //
Index: trunk/MagicSoft/Cosy/gui/MGAccuracy.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGAccuracy.h	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/MGAccuracy.h	(revision 7790)
@@ -1,4 +1,4 @@
-#ifndef MGACCURACY_H
-#define MGACCURACY_H
+#ifndef COSY_MGAccuracy
+#define COSY_MGAccuracy
 
 //
@@ -20,4 +20,5 @@
 class MGAccuracy : public MGEmbeddedCanvas
 {
+protected:
     TLine  *fLin1;
     TLine  *fLin2;
@@ -30,4 +31,5 @@
 
     Double_t fTime;
+    Double_t fColorScale;
 
     void DrawCoordinateSystem();
@@ -46,4 +48,9 @@
     ~MGAccuracy();
 
+    void DrawText(const char *c1, const char *c2, const char *c3, const char *txt);
+    void DrawCircles(Double_t rad=79.1);
+
+    void SetColorScale(Double_t scale=1) { fColorScale=scale; }
+
     void Update(ZdAz &pos, ZdAz &acc);
 
@@ -51,3 +58,3 @@
 };
 
-#endif // MGSKYPOSITION_H
+#endif // COSY_MGAccuracy
Index: trunk/MagicSoft/Cosy/gui/MGCoordinate.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCoordinate.cc	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/MGCoordinate.cc	(revision 7790)
@@ -26,12 +26,14 @@
 
 MGCoordinate::MGCoordinate(const TGWindow* p, const Int_t type=kETypeDeg,
-                           const Bool_t flag, const char *txt,
+                           const Int_t flag, const char *txt,
                            const Int_t deg, const UInt_t min, const UInt_t sec)
-: TGFrame(p, 119, flag?76:46, kSunkenFrame|kFixedSize), fSign('+'), fDeg(deg), fMin(min), fSec(sec)
+: TGFrame(p, 119, flag==1?76:46-(TString(txt).IsNull()?23:0), kSunkenFrame|kFixedSize), fSign('+'), fDeg(deg), fMin(min), fSec(sec), fLabel(0)
 {
     fList = new MGList;
 
+    const Int_t offset = TString(txt).IsNull() ? 23 : 0;
+
     // p = pointer to MainFrame (not owner)
-    if (flag)
+    if (flag==1)
     {
         fTextEntryDeg = new TGTextEntry(this, "****", IDM_kDeg);
@@ -41,7 +43,7 @@
         // fTextEntryMin->SetAlignment(kTextCenterX);
         // fTextEntrySec->SetAlignment(kTextCenterX);
-        fTextEntryDeg->Move( 7, 26);
-        fTextEntryMin->Move(47, 26);
-        fTextEntrySec->Move(81, 26);
+        fTextEntryDeg->Move( 7, 26-offset);
+        fTextEntryMin->Move(47, 26-offset);
+        fTextEntrySec->Move(81, 26-offset);
         fTextEntryDeg->MapWindow();
         fTextEntryMin->MapWindow();
@@ -56,5 +58,5 @@
     }
 
-    const int ypos = flag?56:26;
+    const int ypos = (flag==1?56:26)-offset;
 
     fLabelDeg = new TGLabel(this, "****");
@@ -78,9 +80,12 @@
     Set(fLabelSec, fSec);
 
-    fLabel = new TGLabel(this, txt);
-    fLabel->SetTextJustify(kTextLeft);
-    fLabel->Move(4, 4);
-    fLabel->MapWindow();
-    fList->Add(fLabel);
+    if (!TString(txt).IsNull())
+    {
+        fLabel = new TGLabel(this, txt);
+        fLabel->SetTextJustify(kTextLeft);
+        fLabel->Move(4, 4);
+        fLabel->MapWindow();
+        fList->Add(fLabel);
+    }
 
     TGLabel *label;
@@ -90,9 +95,9 @@
     const char *sec = type==kETypeDeg ? "\""   : "s";
 
-    if (flag)
+    if (flag==1)
     {
         label = new TGLabel(this, deg);
         label->SetTextJustify(kTextLeft);
-        label->Move(37, 29);
+        label->Move(37, 29-offset);
         label->MapWindow();
         fList->Add(label);
@@ -100,5 +105,5 @@
         label = new TGLabel(this, min);
         label->SetTextJustify(kTextLeft);
-        label->Move(71, 29);
+        label->Move(71, 29-offset);
         label->MapWindow();
         fList->Add(label);
@@ -106,5 +111,5 @@
         label = new TGLabel(this, sec);
         label->SetTextJustify(kTextLeft);
-        label->Move(107, 29);
+        label->Move(107, 29-offset);
         label->MapWindow();
         fList->Add(label);
@@ -146,5 +151,7 @@
 void MGCoordinate::Print()
 {
-    cout << fLabel->GetText()->GetString() << " " << fSign << fDeg << "\xb0 " << fMin << "' " << fSec << "\"" << endl;
+    if (fLabel)
+        cout << fLabel->GetText()->GetString() << " ";
+    cout << fSign << fDeg << "\xb0 " << fMin << "' " << fSec << "\"" << endl;
 }
 
Index: trunk/MagicSoft/Cosy/gui/MGCoordinate.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCoordinate.h	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/MGCoordinate.h	(revision 7790)
@@ -1,4 +1,4 @@
-#ifndef MGCOORDINATE_H
-#define MGCOORDINATE_H
+#ifndef COSY_MGCoordinate
+#define COSY_MGCoordinate
 
 //
@@ -49,5 +49,5 @@
 public:
     MGCoordinate(const TGWindow* p, const Int_t type=kETypeDeg,
-                 const Bool_t flag=kTRUE, const char *txt="Coordinates:",
+                 const Int_t flag=1, const char *txt="Coordinates:",
                  const Int_t deg=0, const UInt_t min=0, const UInt_t sec=0);
     ~MGCoordinate();
@@ -63,3 +63,3 @@
 };
 
-#endif // MGIMAGE_H
+#endif // COSY_MGCoordinates
Index: trunk/MagicSoft/Cosy/gui/MGCoordinates.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCoordinates.cc	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/MGCoordinates.cc	(revision 7790)
@@ -16,5 +16,5 @@
 MGCoordinates::MGCoordinates(const TGWindow* p,
                              const Int_t type,
-                             const Bool_t flag,
+                             const Int_t flag,
                              const Int_t deg1, const UInt_t min1, const UInt_t sec1,
                              const Int_t deg2, const UInt_t min2, const UInt_t sec2)
@@ -23,11 +23,11 @@
     const Int_t t    = type==kETypeZdAz ? kETypeDeg : kETypeH;
     const char *txt1 = type==kETypeZdAz ? "Zenith Dist [\xb0]:" : "Right Ascension [h]:";
-    const char *txt2 = type==kETypeZdAz ? "Azimuth [\xb0]:" : "Declination [\xb0]:";
+    const char *txt2 = type==kETypeZdAz ? "Azimuth [\xb0]:"     : "Declination [\xb0]:";
 
     // p = pointer to MainFrame (not owner)
-    fX = new MGCoordinate(this, t, flag, txt1, deg1, min1, sec1);
+    fX = new MGCoordinate(this, t, flag, flag>1?"":txt1, deg1, min1, sec1);
     fX->Move(0, 0);
 
-    fY = new MGCoordinate(this, kETypeDeg, flag, txt2, deg2, min2, sec2);
+    fY = new MGCoordinate(this, kETypeDeg, flag, flag>1?"":txt2, deg2, min2, sec2);
     fY->Move(125, 0);
 
Index: trunk/MagicSoft/Cosy/gui/MGCoordinates.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCoordinates.h	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/MGCoordinates.h	(revision 7790)
@@ -1,4 +1,4 @@
-#ifndef MGCOORDINATES_H
-#define MGCOORDINATES_H
+#ifndef COSY_MGCoordinates
+#define COSY_MGCoordinates
 
 //
@@ -15,6 +15,7 @@
 
 enum {
-    kETypeZdAz,
-    kETypeRaDec
+    kETypeZdAz = BIT(0),
+    kETypeRaDec= BIT(1),
+    kETypeNone = BIT(3)
 };
 
@@ -28,5 +29,5 @@
 public:
     MGCoordinates(const TGWindow* p, const Int_t type=kETypeZdAz,
-                  const Bool_t flag=kTRUE,
+                  const Int_t flag=1,
                   const Int_t deg1=0, const UInt_t min1=0, const UInt_t sec1=0,
                   const Int_t deg2=0, const UInt_t min2=0, const UInt_t sec2=0);
@@ -41,3 +42,3 @@
 };
 
-#endif // MGIMAGE_H
+#endif // COSY_MGCoordinates
Index: trunk/MagicSoft/Cosy/gui/MGCosy.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 7790)
@@ -247,4 +247,5 @@
     fList->Add(fAzSoll);
 
+    fArmed     = new TGLabel(f, "Armed");
     fError     = new TGLabel(f, "Error");
     fMoving    = new TGLabel(f, "Moving");
@@ -261,4 +262,6 @@
     ULong_t color;
 
+    gClient->GetColorByName("Magenta", color);
+    fArmed->SetBackgroundColor(color);
     gClient->GetColorByName("Red", color);
     fError->SetBackgroundColor(color);
@@ -278,16 +281,18 @@
     fStopped->SetBackgroundColor(color);
 
-    fError   ->MoveResize(10, 25, 60, 20);
-    fMoving  ->MoveResize(10, 25+20, 60, 20);
-    fTracking->MoveResize(10, 25+40, 60, 20);
-    fStopping->MoveResize(10, 25+60, 60, 20);
-    fStopped ->MoveResize(10, 25+80, 60, 20);
-    fAvailMac1->MoveResize(10, 25+120, 60, 20);
-    fAvailMac2->MoveResize(10, 25+140, 60, 20);
+    fArmed   ->MoveResize(10,  25,        60, 20);
+    fError   ->MoveResize(10,  25+25,     60, 20);
+    fMoving  ->MoveResize(10,  25+25+20,  60, 20);
+    fTracking->MoveResize(10,  25+25+40,  60, 20);
+    fStopping->MoveResize(10,  25+25+60,  60, 20);
+    fStopped ->MoveResize(10,  25+25+80,  60, 20);
+    fAvailMac1->MoveResize(10, 25+25+120, 60, 20);
+    fAvailMac2->MoveResize(10, 25+25+140, 60, 20);
     //fAvailMac3->Move(10, 25+160);
-    fAvailSe1->MoveResize(10, 25+200, 60, 20);
-    fAvailSe2->MoveResize(10, 25+220, 60, 20);
-    fAvailSe3->MoveResize(10, 25+180, 60, 20);
-
+    fAvailSe1->MoveResize(10,  25+25+200, 60, 20);
+    fAvailSe2->MoveResize(10,  25+25+220, 60, 20);
+    fAvailSe3->MoveResize(10,  25+25+180, 60, 20);
+
+    fList->Add(fArmed);
     fList->Add(fError);
     fList->Add(fMoving);
@@ -737,4 +742,6 @@
 #endif
     fAccuracy = new MGAccuracy(f1, 300);
+    fAccuracy->DrawText("0.5se", "1.0se", "2.0se", "Ctrl Deviation [min]");
+    fAccuracy->DrawCircles();
 #ifdef DEBUG
     cout << "MGCosy: Creating MGVelocity" << endl;
@@ -822,5 +829,5 @@
     const Int_t w = 1010;
     const Int_t h =  700;
-    SetWMSizeHints(w, h, 1280, 900, 10, 10);  // set the smallest and biggest size of the Main frame
+    SetWMSizeHints(w, h, w, h, 1, 1);  // set the smallest and biggest size of the Main frame
 
     SetWindowName("Cosy Main Window");
@@ -1068,4 +1075,6 @@
     SetLabelColor(fAvailSe2,  stat2&0x10);
     SetLabelColor(fAvailSe3,  stat2&0x20);
+
+    EnableLabel(fArmed, 1);//stat2&0x40);
 
     if (stat&MDriveCom::kTracking)
Index: trunk/MagicSoft/Cosy/gui/MGCosy.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCosy.h	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/MGCosy.h	(revision 7790)
@@ -88,4 +88,5 @@
     TGTab         *fTab;
 
+    TGLabel *fArmed;
     TGLabel *fError;
     TGLabel *fMoving;
Index: trunk/MagicSoft/Cosy/gui/MGNumStars.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGNumStars.cc	(revision 7790)
+++ trunk/MagicSoft/Cosy/gui/MGNumStars.cc	(revision 7790)
@@ -0,0 +1,176 @@
+#include "MGNumStars.h"
+
+#include <iostream.h>  // cout
+
+#include <TLine.h>
+#include <TText.h>
+#include <TWbox.h>
+#include <TGaxis.h>
+#include <TGraph.h>
+#include <TCanvas.h>
+
+#include "MTime.h"
+
+ClassImp(MGNumStars);
+
+void MGNumStars::DrawText(const char*txt)
+{
+    fCanvas->SetEditable(kTRUE);
+    fCanvas->cd();
+
+    TText text;
+    text.SetTextAlign(22);  // centered, centered (s.TAttText)
+    text.SetTextSize(0.12);
+    text.DrawText(275, 44, txt);
+
+    fCanvas->SetEditable(kFALSE);
+}
+
+void MGNumStars::DrawCoordinateSystem()
+{
+    fCanvas->Range(-50, -4, 600, 50);
+
+    TWbox box;
+    box.DrawWbox(325-150-50, 38, 325+150-50, 48,  18,  2, 1);
+
+    TLine line;
+    line.DrawLine(0, 0, 600-25, 0);
+    line.SetLineStyle(kDashed);
+    line.SetLineColor(kRed);
+    line.DrawLine(0,  6.5, 600-25, 6.5);
+    line.SetLineColor(kYellow);
+    line.DrawLine(0, 10.5, 600-25, 10.5);
+
+    TGaxis *axe;
+    axe = new TGaxis(0, 0, 0, 47.5, 0, 47.5, 304, "-");
+    axe->SetLabelSize(0.1);
+    axe->SetLabelOffset(0.02);
+    axe->SetBit(kCanDelete);
+    axe->Draw();
+}
+
+void MGNumStars::InitText()
+{
+    fTxt = new TText(600*0.97, 50*0.92, "0/0");
+    fTxt->SetTextAlign(33); // right, top
+    fTxt->SetTextColor(10);
+    fTxt->SetTextSize(0.12);
+    fTxt->Draw();
+
+    fList->Add(fTxt);
+}
+
+void MGNumStars::InitBar(TLine* &bar)
+{
+    bar = new TLine(0, 0, 0, 0);
+    bar->SetLineColor(kBlack);
+    bar->SetLineStyle(1);
+    bar->SetLineWidth(5);
+    bar->Draw();
+
+    fList->Add(bar);
+}
+
+void MGNumStars::InitGraph(TGraph* &graph, Int_t col)
+{
+    graph = new TGraph;
+    graph->SetPoint(0, 0, 0);
+    graph->SetLineColor(col);
+    graph->SetMarkerColor(col);
+    graph->SetMarkerStyle(kFullDotMedium);
+    graph->Draw("LP");
+    fList->Add(graph);
+}
+
+MGNumStars::MGNumStars(const TGWindow* p, const UInt_t w)
+: MGEmbeddedCanvas("NumStars", p, w, 300)
+{
+    DrawCoordinateSystem();
+
+    InitGraph(fGraph1, kBlue);
+    InitGraph(fGraph2, kMagenta);
+
+    InitText();
+    InitBar(fBar1);
+    InitBar(fBar2);
+
+    InitCanvas();
+
+    Resize(245, 100);
+
+    SetNoContextMenu();
+
+    MTime t(-1);
+    fTime = t.GetAxisTime();
+}
+
+MGNumStars::~MGNumStars()
+{
+}
+
+// dist [deg]
+void MGNumStars::UpdateBar(TLine &bar, UInt_t num)
+{
+    bar.SetY2(num);
+    if (num<11)
+        bar.SetLineColor(kYellow);
+    else
+        if (num<7)
+            bar.SetLineColor(kRed);
+        else
+            bar.SetLineColor(kGreen);
+
+    SetModified();
+}
+
+// dist [deg]
+void MGNumStars::UpdateGraph(TGraph &graph, Double_t dtime, UInt_t num)
+{
+    graph.SetPoint(graph.GetN(), dtime, num);
+
+    const Double_t ntime = dtime;
+    for (int i=0; i<graph.GetN(); i++)
+    {
+        Double_t x, y;
+        graph.GetPoint(i, x,       y);
+        graph.SetPoint(i, x+ntime, y);
+    }
+    while (graph.GetN()>0)
+    {
+        Double_t x, y;
+        graph.GetPoint(0, x, y);
+
+        if (x==+ntime && y==0)
+        {
+            graph.RemovePoint(0);
+            continue;
+        }
+
+        if (x<2*4.75*60)
+            break;
+
+        graph.RemovePoint(0);
+    }
+
+    SetModified();
+}
+
+void MGNumStars::Update(UInt_t det, UInt_t cor)
+{
+    char txt[100];
+    sprintf(txt, "%d/%d", cor, det);
+    fTxt->SetText(fTxt->GetX(), fTxt->GetY(), txt);
+
+    UpdateBar(*fBar1, det);
+    UpdateBar(*fBar2, cor);
+
+    MTime t(-1);
+    const Double_t dtime = t.GetAxisTime()-fTime; // range [-0.5h, 0h]
+
+    UpdateGraph(*fGraph1, dtime, det);
+    UpdateGraph(*fGraph2, dtime, cor);
+
+    fTime = t.GetAxisTime();
+
+    UpdateCanvas();
+}
Index: trunk/MagicSoft/Cosy/gui/MGNumStars.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGNumStars.h	(revision 7790)
+++ trunk/MagicSoft/Cosy/gui/MGNumStars.h	(revision 7790)
@@ -0,0 +1,57 @@
+#ifndef COSY_MGNumStars
+#define COSY_MGNumStars
+
+//
+// This File contains the declaration of the MGCoordinates-class
+//
+//   Author: Thomas Bretz
+//   Version: V1.0 (1-8-2000)
+
+#ifndef COSY_MGEmbeddedCanvas
+#include "MGEmbeddedCanvas.h"
+#endif
+
+class TGraph;
+class TLine;
+class TText;
+
+class ZdAz;
+
+class MGNumStars : public MGEmbeddedCanvas
+{
+protected:
+    TLine  *fLin1;
+    TLine  *fLin2;
+
+    TText  *fTxt;
+
+    TLine  *fBar1;
+    TLine  *fBar2;
+
+    TGraph *fGraph1;
+    TGraph *fGraph2;
+
+    Double_t fTime;
+
+    void DrawCoordinateSystem();
+
+    void InitText();
+    void InitCross();
+    void InitBar(TLine* &bar);
+    void InitGraph(TGraph* &graph, Int_t col);
+
+    void UpdateBar(TLine &bar, UInt_t num);
+    void UpdateGraph(TGraph &graph, Double_t dtime, UInt_t num);
+
+public:
+    MGNumStars(const TGWindow* p, const UInt_t w);
+    ~MGNumStars();
+
+    void DrawText(const char *txt);
+
+    void Update(UInt_t det, UInt_t cor);
+
+    ClassDef(MGNumStars, 0)
+};
+
+#endif // COSY_MGNumStars
Index: trunk/MagicSoft/Cosy/gui/MGStarg.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGStarg.cc	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/MGStarg.cc	(revision 7790)
@@ -1,270 +1,26 @@
 #include "MGStarg.h"
 
-#include <iostream.h>  // cout
-
-#include <TArc.h>
-#include <TLine.h>
-#include <TText.h>
-#include <TWbox.h>
-#include <TList.h>
-#include <TGaxis.h>
-#include <TGraph.h>
 #include <TCanvas.h>
 
 #include <MHexagon.h>
 
-#include "coord.h"
-#include "MTime.h"
-#include "MAstro.h"
-
 ClassImp(MGStarg);
 
-void MGStarg::DrawCoordinateSystem()
+void MGStarg::DrawHexagon()
 {
-    TWbox box;
-    box.DrawWbox(-145*2, 145*2, -15*2, 120*2,  18,  2, 1);
-
-    TText text;
-    text.SetTextAlign(22);  // centered, centered (s.TAttText)
-    text.DrawText(-80*2, 132.5*2, "Misspointing [min]");
+    fCanvas->SetEditable(kTRUE);
+    fCanvas->cd();
 
     MHexagon hex;
-    hex.SetFillColor(39);
     hex.SetFillStyle(4000);
     hex.SetLineColor(17);
-    hex.DrawHexagon(0,0,177.5*2);
+    hex.DrawHexagon(0, 0, 177.5*2);
 
-    text.SetTextAlign(11);  // left, bottom (s.TAttText)
-    text.SetTextColor(3);
-    text.DrawText(220, -220, "0.75'");
-
-    text.SetTextColor(5);
-    text.DrawText(220, -250, "1.50'");
-
-    text.SetTextColor(2);
-    text.DrawText(220, -280, "3.00'");
-
-
-    TLine line;
-    line.DrawLine(-65*4,     0, 65*4,    0);
-    line.DrawLine(    0, -65*4,    0, 65*4);
-
-    //
-    // Can be replaced by TGaxis axe; in a later root version
-    // than 3.01/06. I talked to Rene
-    //
-    TGaxis *axe;
-    axe = new TGaxis(-60*4,   0, 60*4,  0,  -4, 4, 30204, "+-N");
-    axe->SetTitle("Az"); // \xb0
-    axe->SetBit(kCanDelete);
-    axe->Draw();
-
-    axe = new TGaxis(  0, -60*4,  0, 60*4,  -4, 4,   304, "+-N");
-    axe->SetTitle("Zd"); // \xb0
-    axe->SetLabelOffset(-0.02);
-    axe->SetBit(kCanDelete);
-    axe->Draw();
-}
-
-void MGStarg::InitText()
-{
-    fTxt = new TText(280, 280, "0' / 0'");
-    fTxt->SetTextAlign(33); // right, top
-    fTxt->SetTextColor(10);
-    fTxt->Draw();
-
-    fList->Add(fTxt);
-}
-
-void MGStarg::InitBar()
-{
-    fBar = new TLine(0, 0, 0, 0);
-    fBar->SetLineColor(kBlack);
-    fBar->SetLineStyle(1);
-    fBar->SetLineWidth(5);
-    fBar->Draw();
-
-    fList->Add(fBar);
-}
-
-void MGStarg::InitCross()
-{
-    fLin1 = new TLine(0, 0, 0, 0);
-    fLin2 = new TLine(0, 0, 0, 0);
-
-    fLin1->SetLineColor(10); // white (s. TAttFill)
-    fLin2->SetLineColor(10); // white
-    fLin1->SetLineStyle(1);  // solid (s. TAttLine)
-    fLin2->SetLineStyle(1); 
-
-    fLin1->SetLineWidth(2);
-    fLin2->SetLineWidth(2);
-
-    fLin1->Draw();
-    fLin2->Draw();
-
-    fList->Add(fLin1);
-    fList->Add(fLin2);
+    fCanvas->SetEditable(kFALSE);
 }
 
 MGStarg::MGStarg(const TGWindow* p, const UInt_t w)
-: MGEmbeddedCanvas("Starg", p, w, 300)
+: MGAccuracy(p, w)
 {
-    // FIXME: Overload MapWindow in newer Root versions to remove
-    //        the contents of the graph!
-    fGraph = new TGraph;
-    fGraph->SetPoint(0, 0, 0);
-    fGraph->SetLineColor(kBlue);
-    fGraph->SetMarkerColor(kBlue);
-    fGraph->SetMarkerStyle(kFullDotMedium);
-    fGraph->Draw("LP");
-    fList->Add(fGraph);
-    //fGraph->SetNameTitle("AccVsT", "Accuracy vs Min of Time");
-    //fGraph->Draw("APL");
-    //fGraph->SetMarkerSize(2);
-
-    DrawCoordinateSystem();
-
-    InitText();
-    InitCross();
-    InitBar();
-
-    InitCanvas();
-
-    SetNoContextMenu();
-
-    MTime t(-1);
-    fTime = t.GetAxisTime();
+    SetColorScale(1.5);
 }
-
-MGStarg::~MGStarg()
-{
-    //    cout << "MGStarg destroyed." << endl;
-}
-
-// dist [deg]
-void MGStarg::UpdateText(Float_t dist)
-{
-    dist *= 3600.; // [sec]
-
-    int rs = (int)floor(fmod(dist, 60.));
-
-    dist /= 60.;   // [min]
-    int rm = (int)dist;
-
-    char txt[100];
-    rm ? sprintf(txt, "%d'%02d\"", rm, rs) : sprintf(txt, "%d\"", rs);
-
-    fTxt->SetText(fTxt->GetX(), fTxt->GetY(), txt);
-
-    fBar->SetY2(dist*60); // [sec]
-    if (dist<1.5)
-        fBar->SetLineColor(kGreen);
-    else
-        if (dist<3)
-            fBar->SetLineColor(kYellow);
-        else
-            fBar->SetLineColor(kRed);
-
-    SetModified();
-}
-
-// dist [deg]
-void MGStarg::UpdateGraph(Float_t dist)
-{
-    MTime t(-1);
-    const Double_t dtime = t.GetAxisTime()-fTime; // range [-0.5h, 0h]
-
-    dist *= 60; // min
-
-    static int odist = -1;
-    if (odist==(int)(dist*10*60) && dtime<10)
-        return;
-
-    odist = (int)(dist*10*60);
-
-    fGraph->SetPoint(fGraph->GetN(), dtime, dist*60);
-
-    const Double_t ntime = dtime;
-    for (int i=0; i<fGraph->GetN(); i++)
-    {
-        Double_t x, y;
-        fGraph->GetPoint(i, x,       y);
-        fGraph->SetPoint(i, x-ntime, y);
-        //cout << i << ":  " << x-ntime << " / " << y << endl;
-    }
-    while (fGraph->GetN()>0)
-    {
-        Double_t x, y;
-        fGraph->GetPoint(0, x, y);
-
-        if (x==-ntime && y==0)
-        {
-            fGraph->RemovePoint(0);
-            continue;
-        }
-
-        if (x>-4.75*60)
-            break;
-
-        fGraph->RemovePoint(0);
-    }
-
-    fTime = t.GetAxisTime();
-
-    SetModified();
-
-}
-
-void MGStarg::Update(Float_t pzd, Float_t azd, Float_t aaz)
-{
-    const double dist = MAstro::GetDevAbs(pzd, azd, aaz);
-
-    UpdateText(dist);
-    UpdateGraph(dist);
-}
-
-void MGStarg::UpdateCross(Float_t x, Float_t y)
-{
-    //
-    // x["], y["]
-    //
-    static int X = ~0;
-    static int Y = ~0;
-
-    int pixx = (int)(x/fPix);  // [pix]
-    int pixy = (int)(y/fPix);  // [pix]
-
-    if (X==pixx && Y==pixy)
-        return;
-
-    X = pixx;
-    Y = pixy;
-
-    fLin1->SetX1(x-5.);
-    fLin1->SetX2(x+5.);
-
-    fLin2->SetX1(x-5.);
-    fLin2->SetX2(x+5.);
-
-    fLin1->SetY1(y-5.);
-    fLin1->SetY2(y+5.);
-
-    fLin2->SetY1(y+5.);
-    fLin2->SetY2(y-5.);
-
-    SetModified();
-}
-
-void MGStarg::Update(ZdAz &pos, ZdAz &dev)
-{
-    // Estimate the distance in az direction on the camera plane
-    const double daz = MAstro::GetDevAbs(pos.Zd(), 0, dev.Az())*3600.;
-
-    //cout << "--> S: " << dev.Az()*60 << " " << dev.Zd()*60. << endl;
-
-    UpdateCross(TMath::Sign(daz, dev.Az()), dev.Zd()*3600.);
-    Update(pos.Zd(), dev.Zd(), dev.Az());
-
-    UpdateCanvas();
-}
Index: trunk/MagicSoft/Cosy/gui/MGStarg.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGStarg.h	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/MGStarg.h	(revision 7790)
@@ -1,7 +1,7 @@
-#ifndef MGSTARG_H
-#define MGSTARG_H
+#ifndef COSY_MGStarg
+#define COSY_MGStarg
 
-#ifndef COSY_MGEmbeddedCanvas
-#include "MGEmbeddedCanvas.h"
+#ifndef COSY_MGAccuracy
+#include "MGAccuracy.h"
 #endif
 
@@ -12,36 +12,38 @@
 class ZdAz;
 
-class MGStarg : public MGEmbeddedCanvas
+class MGStarg : public MGAccuracy
 {
-    TLine  *fLin1;
-    TLine  *fLin2;
+//    TLine  *fLin1;
+//    TLine  *fLin2;
 
-    TText  *fTxt;
+//    TText  *fTxt;
 
-    TLine  *fBar;
+//    TLine  *fBar;
 
-    TGraph *fGraph;
+//    TGraph *fGraph;
 
-    Double_t fTime;
+//    Double_t fTime;
 
-    void DrawCoordinateSystem();
+//    void InitText();
+//    void InitCross();
+//    void InitBar();
 
-    void InitText();
-    void InitCross();
-    void InitBar();
+//    void UpdateCross(Float_t x, Float_t y);
+//    void UpdateText(Float_t dist);
+//    void UpdateGraph(Float_t acc);
+//    void Update(Float_t zd, Float_t x, Float_t y);
 
-    void UpdateCross(Float_t x, Float_t y);
-    void UpdateText(Float_t acc);
-    void UpdateGraph(Float_t acc);
-    void Update(Float_t zd, Float_t x, Float_t y);
 
 public:
     MGStarg(const TGWindow* p, const UInt_t w);
-    ~MGStarg();
+//    ~MGStarg();
 
-    void Update(ZdAz &pos, ZdAz &acc);
+//    virtual void DrawText();
+    void DrawHexagon();
+
+//    void Update(ZdAz &pos, ZdAz &acc);
 
     ClassDef(MGStarg, 0)
 };
 
-#endif // MGSTARG_H
+#endif // COSY_MGStarg
Index: trunk/MagicSoft/Cosy/gui/Makefile
===================================================================
--- trunk/MagicSoft/Cosy/gui/Makefile	(revision 7788)
+++ trunk/MagicSoft/Cosy/gui/Makefile	(revision 7790)
@@ -40,4 +40,5 @@
 	   MGAccuracy.cc \
 	   MGStarg.cc \
+	   MGNumStars.cc \
 	   MGSkyPosition.cc
   
