Index: trunk/MagicSoft/Cosy/gui/GuiLinkDef.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/GuiLinkDef.h	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/GuiLinkDef.h	(revision 2278)
@@ -18,5 +18,4 @@
 
 #pragma link C++ class MGCosy+;
-#pragma link C++ class MGStarguider+;
 
 #endif
Index: trunk/MagicSoft/Cosy/gui/MGAccuracy.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGAccuracy.cc	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGAccuracy.cc	(revision 2278)
@@ -170,5 +170,5 @@
 
 MGAccuracy::MGAccuracy(const TGWindow* p, const UInt_t w)
-: MGEmbeddedCanvas("Accuracy", p, w, 75*4)
+: MGEmbeddedCanvas("Accuracy", p, w, 300)
 {
     DrawCoordinateSystem();
Index: trunk/MagicSoft/Cosy/gui/MGCosy.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 2278)
@@ -55,8 +55,13 @@
     kPB_DECp,
     kPB_DECm,
+    kPB_ZDp,
+    kPB_ZDm,
+    kPB_AZp,
+    kPB_AZm,
     kPB_LoadBending,
     kPB_ResetBending,
     kPB_CALIBSE,
     kCB_PredefPos,
+    kCB_StarList,
 
     // kLog
@@ -85,7 +90,7 @@
     TGPopupMenu *logmenu = new TGPopupMenu(gClient->GetRoot());
     logmenu->AddEntry("&Copy Selected", kLogCopy);
-    logmenu->AddEntry("Clear all",      kLogClear);
+    logmenu->AddEntry("&Select All",    kLogSelect);
     logmenu->AddSeparator();
-    logmenu->AddEntry("Select All",     kLogSelect);
+    logmenu->AddEntry("Clear &all",     kLogClear);
     /*
      logmenu->AddSeparator();
@@ -93,6 +98,6 @@
      */
     logmenu->AddSeparator();
-    logmenu->AddEntry("Save",           kLogSave);
-    logmenu->AddEntry("Save append",    kLogAppend);
+    logmenu->AddEntry("Sa&ve",          kLogSave);
+    logmenu->AddEntry("Save a&ppend",   kLogAppend);
     logmenu->Associate(this);
 
@@ -160,5 +165,5 @@
     fList->Add(fLabel2);
     fList->Add(fLabel3);
-
+/*
     l = new TGLabel(f, "Offset-Zd:");
     l->Move(x-60, y+102);
@@ -177,19 +182,19 @@
     fList->Add(fOffsetZd);
     fList->Add(fOffsetAz);
-
+*/
     l = new TGLabel(f, "Ra (estimated):");
-    l->Move(x-60, y+142);
+    l->Move(x-60, y+142-20);
     fList->Add(l);
 
     l = new TGLabel(f, "Ra (nominal):");
-    l->Move(x-60, y+159);
+    l->Move(x-60, y+159-20);
     fList->Add(l);
 
     l = new TGLabel(f, "Dec (estimated):");
-    l->Move(x-60, y+182);
+    l->Move(x-60, y+182-20);
     fList->Add(l);
 
     l = new TGLabel(f, "Dec (nominal):");
-    l->Move(x-60, y+199);
+    l->Move(x-60, y+199-20);
     fList->Add(l);
 
@@ -214,8 +219,8 @@
     fZdSoll->SetTextJustify(kTextRight);
     fAzSoll->SetTextJustify(kTextRight);
-    fRaEst->Move(x+30, y+142);
-    fRaSoll->Move(x+30, y+159);
-    fDecEst->Move(x+30, y+182);
-    fDecSoll->Move(x+30, y+199);
+    fRaEst->Move(x+30, y+142-20);
+    fRaSoll->Move(x+30, y+159-20);
+    fDecEst->Move(x+30, y+182-20);
+    fDecSoll->Move(x+30, y+199-20);
     fZdSoll->Move(x+30, y+222);
     fAzSoll->Move(x+30, y+239);
@@ -311,5 +316,5 @@
     if (!fin)
     {
-        cout << "ERROR: Predifined posiion in 'prepos.txt' not found." << endl;
+        cout << "ERROR: Predifined positions in 'prepos.txt' not found." << endl;
         return;
     }
@@ -329,10 +334,47 @@
 }
 
-void MGCosy::CreateTabs(TGTab *fTab)
+void MGCosy::CreateStarList(TGCompositeFrame *tf1)
+{
+    /*
+    TGComboBox *box = new TGComboBox(tf1, kCB_StarList);
+    box->Resize(120, 20);
+    box->Associate(this);
+
+    TGLayoutHints *lay = new TGLayoutHints(kLHintsLeft|kLHintsTop,
+                                           27, 0, 200, 0);
+    tf1->AddFrame(box, lay);
+
+    fList->Add(box);
+    fList->Add(lay);
+
+    ifstream fin("stars.txt");
+    if (!fin)
+    {
+        cout << "ERROR: Star List 'stars.txt' not found." << endl;
+        return;
+    }
+
+    int i=0;
+    while (1)
+    {
+        TString str;
+        Int_t h, m, s, d, am, as;
+        fin >> h >> m >> s >> d >> am >> as;
+        if (!fin)
+            break;
+
+        box->AddEntry(str, i++);
+
+        fStarList.Add(zd, az);
+        }
+        */
+}
+
+void MGCosy::CreateTabs()
 {
     TGCompositeFrame *tf1 = fTab->AddTab("Position");
     TGCompositeFrame *tf2 = fTab->AddTab("Track");
+    TGCompositeFrame *tf4 = fTab->AddTab("Calib");
 #ifdef EXPERT
-    TGCompositeFrame *tf4 = fTab->AddTab("Calib");
     TGCompositeFrame *tf5 = fTab->AddTab("Test SE");
     TGCompositeFrame *tf6 = fTab->AddTab("Gear");
@@ -345,4 +387,5 @@
 
     CreatePredefinedPos(tf1);
+    CreateStarList(tf4);
 
     fCRaDec = new MGCoordinates(tf2, kETypeRaDec);
@@ -350,9 +393,7 @@
     fList->Add(fCRaDec);
 
-#ifdef EXPERT
     fCCalib = new MGCoordinates(tf4, kETypeRaDec);
     fCCalib->Move(27, 105);
     fList->Add(fCCalib);
-#endif
 
     const int x=15;
@@ -386,5 +427,4 @@
     fList->Add(l3);
 
-#ifdef EXPERT
     l1 = new TGLabel(tf4, "Start the calibration using the Start button.");
     l2 = new TGLabel(tf4, "Write a coordinate pair to a TPoint file using");
@@ -401,4 +441,5 @@
     fList->Add(l4);
 
+#ifdef EXPERT
     l1 = new TGLabel(tf5, "START starts histograming the differences of");
     l2 = new TGLabel(tf5, "the two shaftencoders at the elevation axis.");
@@ -495,7 +536,8 @@
     fList->Add(but);
     */
+#ifdef EXPERT
     but = new TGTextButton(tf4, "Load", kPB_LoadBending);
-    but->Resize(80, 25);
-    but->Move(25, 190);
+    but->Resize(50, 25);
+    but->Move(151, 185);
     but->SetToolTipText("Load bending corrections from file 'bending.txt'");
     but->Associate(this);
@@ -503,14 +545,40 @@
 
     but = new TGTextButton(tf4, "Reset", kPB_ResetBending);
-    but->Resize(80, 25);
-    but->Move(25, 220);
+    but->Resize(50, 25);
+    but->Move(206, 185);
     but->SetToolTipText("Reset bending correction (coefficients=0)");
     but->Associate(this);
     fList->Add(but);
+#endif EXPERT
 
     but = new TGTextButton(tf4, "TPoint", kPB_TPOINT);
-    but->Resize(80, 25);
-    but->Move(25, 250);
+    but->Resize(50, 25);
+    but->Move(176/*231*/, 213);
     but->SetToolTipText("Trigger writing a tpoint coordinate pair.");
+    but->Associate(this);
+    fList->Add(but);
+
+    but= new TGTextButton(tf4, "Zd -",  kPB_ZDm);
+    but->Resize(50, 25);
+    but->Move(25, 210);
+    but->SetToolTipText("Zenith Distance -= 1SE");
+    but->Associate(this);
+    fList->Add(but);
+    but= new TGTextButton(tf4, "Zd +",  kPB_ZDp);
+    but->Resize(50, 25);
+    but->Move(90, 210);
+    but->SetToolTipText("Zenith Distance += 1SE");
+    but->Associate(this);
+    fList->Add(but);
+    but= new TGTextButton(tf4, "Az +",  kPB_AZp);
+    but->Resize(50, 25);
+    but->Move(55, 185);
+    but->SetToolTipText("Azimuth += 1SE");
+    but->Associate(this);
+    fList->Add(but);
+    but= new TGTextButton(tf4, "Az -",  kPB_AZm);
+    but->Resize(50, 25);
+    but->Move(55, 235);
+    but->SetToolTipText("Azimuth -= 1SE");
     but->Associate(this);
     fList->Add(but);
@@ -728,11 +796,8 @@
     AddFrame(f2, hints2);
 
-    //
-    // FIXME!
-    //
 #ifdef DEBUG
     cout << "MGCosy: Creating Tabs" << endl;
 #endif
-    CreateTabs(fTab);
+    CreateTabs();
 #ifdef DEBUG
     cout << "MGCosy: Creating Label" << endl;
@@ -871,5 +936,5 @@
     }
 }
-
+/*
 void MGCosy::UpdateOffset(ZdAz &off)
 {
@@ -892,5 +957,5 @@
     }
 }
-
+*/
 void MGCosy::UpdateZdAz(ZdAz &soll)
 {
@@ -954,5 +1019,5 @@
 }
 
-void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, RaDec radec,
+void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, /*ZdAz off,*/ RaDec radec,
                     ZdAz soll, UInt_t stat, UInt_t stat2)
 {
@@ -962,7 +1027,5 @@
     double mjd = UpdateTime();
     fSkyPosition->Update(pos, mjd);
-    fAccuracy->Update(pos, acc);
-    fVelocity->Update(vel);
-    UpdateOffset(off);
+    //UpdateOffset(off);
     UpdateRaDec(pos, mjd, radec);
     UpdateZdAz(soll);
@@ -991,6 +1054,16 @@
     SetLabelColor(fAvailSe3,  stat2&0x20);
 
-    stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow();
-    stat&kTracking ? fVelocity->MapWindow() : fVelocity->UnmapWindow();
+    if (stat&kTracking)
+    {
+        fAccuracy->Update(pos, acc);
+        fVelocity->Update(vel);
+        fAccuracy->MapWindow();
+        fVelocity->MapWindow();
+    }
+    else
+    {
+        fAccuracy->UnmapWindow();
+        fVelocity->UnmapWindow();
+    }
     //    stat&kTracking ? fOffset->MapWindow()   : fOffset->UnmapWindow();
 
@@ -1022,12 +1095,18 @@
 }
 
-void MGCosy::StartTrack()
+void MGCosy::StartTrack(bool track)
 {
     cout << "Start tracking." << endl;
 
-    XY xy = fCRaDec->GetCoordinates();
-    RaDec dest(xy.X()*15., xy.Y()); // xy.X()  [h]->[ø]
-
-    cout << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl;
+    XY xy0 = fCRaDec->GetCoordinates();
+    XY xy1 = track ? xy0 : fCCalib->GetCoordinates();
+
+    RaDec dest0(xy0.X()*15., xy0.Y()); // xy.X()  [h]->[ø]
+    RaDec dest1(xy1.X()*15., xy1.Y()); // xy.X()  [h]->[ø]
+
+    cout << "TrackPos: " << dest0.Ra() << "h " << dest0.Dec() << "\xb0" << endl;
+    cout << "CalibPos: " << dest1.Ra() << "h " << dest1.Dec() << "\xb0" << endl;
+
+    RaDec dest[2] = { dest0, dest1 };
 
     fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
@@ -1036,5 +1115,5 @@
 }
 
-void MGCosy::StartTrackPos()
+void MGCosy::StartTrackPos(Long_t mp1)
 {
     cout << "Start tracking Zd/Az pos." << endl;
@@ -1043,4 +1122,20 @@
 
     ZdAz za(xy.X(), xy.Y());
+
+    switch (mp1)
+    {
+    case kPB_ZDm:
+        za.Zd(za.Zd()-360/16384.);
+        break;
+    case kPB_ZDp:
+        za.Zd(za.Zd()+360/16384.);
+        break;
+    case kPB_AZm:
+        za.Az(za.Az()-360/16384.);
+        break;
+    case kPB_AZp:
+        za.Az(za.Az()+360/16384.);
+        break;
+    }
 
     cout << za.Zd() << "\xb0 " << za.Az() << "\xb0" << endl;
@@ -1203,8 +1298,9 @@
                     return kTRUE;
                 case 1:
-                    StartTrack();
+                    StartTrack(true);
                     return kTRUE;
                 case 2:
                     fCRaDec->SetCoordinates(fCCalib->GetCoordinates());
+                    StartTrack(false);
                     return kTRUE;
                 case 3:
@@ -1261,11 +1357,20 @@
                         break;
                     }
-                    RaDec dest(xy.X()*15., xy.Y()); // xy.X()  [h]->[ø]
-                    fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
-                    //fQueue->Proc(WM_NEWTRACK, &dest);
                     fCRaDec->SetCoordinates(xy);
-
-                    cout << "New Ra/Dec: " << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl;
+                    StartTrack(false);
+                    /*
+                     RaDec dest(xy.X()*15., xy.Y()); // xy.X()  [h]->[ø]
+                     fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
+                     //fQueue->Proc(WM_NEWTRACK, &dest);
+                     */
+                    //cout << "New Ra/Dec: " << dest.Ra() << "h " << dest.Dec() << "\xb0" << endl;
                 }
+                return kTRUE;
+
+            case kPB_ZDp:
+            case kPB_ZDm:
+            case kPB_AZp:
+            case kPB_AZm:
+                StartTrackPos(mp1);
                 return kTRUE;
 
Index: trunk/MagicSoft/Cosy/gui/MGCosy.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCosy.h	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGCosy.h	(revision 2278)
@@ -50,6 +50,6 @@
     TGLabel       *fLabel3;
 
-    TGLabel       *fOffsetZd;
-    TGLabel       *fOffsetAz;
+    // TGLabel       *fOffsetZd;
+    // TGLabel       *fOffsetAz;
 
     TGLabel       *fRaEst;
@@ -98,10 +98,11 @@
     void CreateMenu();
     void CreateLabel(TGCompositeFrame *f);
-    void CreateTabs(TGTab *fTab);
+    void CreateTabs();
     void CreatePredefinedPos(TGCompositeFrame *tf1);
+    void CreateStarList(TGCompositeFrame *tf1);
 
     void StartPos();
-    void StartTrack();
-    void StartTrackPos();
+    void StartTrack(bool track);
+    void StartTrackPos(Long_t mp1=0);
     void StartDemo();
     //void StartCalib();
@@ -110,5 +111,5 @@
     void EnableLabel(TGLabel *label, Bool_t stat);
     void SetLabelColor(TGLabel *label, Bool_t col);
-    void UpdateOffset(ZdAz &off);
+    //void UpdateOffset(ZdAz &off);
     void UpdateZdAz(ZdAz &off);
     void UpdateRaDec(ZdAz &pos, double mjd, RaDec &radec);
@@ -127,5 +128,5 @@
     TGTextView *GetLog() const { return fLog; }
 
-    void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, RaDec radec, ZdAz soll, UInt_t stat, UInt_t stat2);
+    void Update(ZdAz pos, ZdAz acc, ZdAz vel, /*ZdAz off,*/ RaDec radec, ZdAz soll, UInt_t stat, UInt_t stat2);
 
     Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2);
Index: trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc	(revision 2278)
@@ -17,7 +17,7 @@
 
 MGEmbeddedCanvas::MGEmbeddedCanvas(const char *name, const TGWindow* p,
-                                   const UInt_t width, Float_t range)
+                                   UInt_t width, Double_t range)
     : TRootEmbeddedCanvas(name, p, width+1, width+1, 0/*kRaisedFrame*/),
-      fModified(kFALSE), fWidth(width), fRange(range), fPix(2.*range/width)
+      fModified(kFALSE), fWidth(width), fRange(fabs(range)), fPix(2.*fabs(range)/width)
 {
 #ifdef DEBUG
@@ -34,8 +34,8 @@
     fCanvas->SetFillColor(39); // s. TAttFill
 #ifdef DEBUG
-    cout << "MGEmbeddedCanvas: fRange=" << fRange << endl;
+    cout << "MGEmbeddedCanvas." << endl;
 #endif
-    if (fRange>0)
-        fCanvas->Range(-fRange, -fRange, fRange, fRange);
+
+    fCanvas->Range(-fRange, -fRange, fRange, fRange);
 
     fList = new TList;
Index: trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.h	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.h	(revision 2278)
@@ -34,5 +34,5 @@
 public:
     MGEmbeddedCanvas(const char *name, const TGWindow* p,
-                     const UInt_t width, const Float_t range);
+                     UInt_t width, Double_t range);
     ~MGEmbeddedCanvas();
 
Index: trunk/MagicSoft/Cosy/gui/MGImage.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGImage.cc	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGImage.cc	(revision 2278)
@@ -12,4 +12,6 @@
 #include <pthread.h>
 
+#include <X11/Xlib.h>
+
 #include <TTimer.h>
 #include <TSystem.h>
@@ -18,4 +20,14 @@
 
 ClassImp(MGImage);
+/*
+class MyX11 : public TGX11
+{
+public:
+    Display *GetDisplay() { return fDisplay; }
+    Drawable GetRootWin() { return fRootWin; }
+    Drawable GetVisRootWin() { return fVisRootWin; }
+    Int_t    GetDepth() { return fDepth; }
+};
+*/
 
 MGImage::MGImage(const TGWindow* p, UInt_t w, UInt_t h, UInt_t options, ULong_t back)
@@ -27,84 +39,4 @@
 
     //
-    // Set Color Table (Gray scale)
-    //
-    const int cols = 0x100+4*4*4;
-
-    for (int c=0; c<0x100; c++)
-        sprintf(fColors[c], "%02x", c);
-
-    //
-    // create space for the pixmap buffer, initialize pointer to data area
-    //
-    fBuffer = new char*[1+cols+fHeight+1];
-    fBody   = &fBuffer[1+cols];
-
-    //
-    // fill buffer with header informations
-    //
-    fBuffer[0] = new char[14];
-    sprintf(fBuffer[0], "%3d %3d %3d %1d", fWidth, fHeight, cols, 2);
-
-    for (int k=0; k<0x100; k++)
-    {
-        const int l = k+1;
-        fBuffer[l] = new char[13];
-        fBuffer[l][0]  = fColors[k][0];
-        fBuffer[l][1]  = fColors[k][1];
-        fBuffer[l][2]  = '\t';
-        fBuffer[l][3]  = 'c';
-        fBuffer[l][4]  = ' ';
-        fBuffer[l][5]  = '#';
-        fBuffer[l][6]  = fColors[k][0];
-        fBuffer[l][7]  = fColors[k][1];
-        fBuffer[l][8]  = fColors[k][0];
-        fBuffer[l][9]  = fColors[k][1];
-        fBuffer[l][10] = fColors[k][0];
-        fBuffer[l][11] = fColors[k][1];
-        fBuffer[l][12] = '\0';
-    }
-
-    for (int b=0; b<4; b++)
-        for (int g=0; g<4; g++)
-            for (int r=0; r<4; r++)
-            {
-                const int nr = r+(g<<2)+(b<<4);
-                const int l = 0x100+nr+1;
-
-                fBuffer[l] = new char[13];
-                fBuffer[l][0]  = 'f'+nr/8+1;
-                fBuffer[l][1]  = 'f'+nr%8+1;
-                fBuffer[l][2]  = '\t';
-                fBuffer[l][3]  = 'c';
-                fBuffer[l][4]  = ' ';
-                fBuffer[l][5]  = '#';
-                fBuffer[l][6]  = fColors[r*85][0];
-                fBuffer[l][7]  = fColors[r*85][1];
-                fBuffer[l][8]  = fColors[g*85][0];
-                fBuffer[l][9]  = fColors[g*85][1];
-                fBuffer[l][10] = fColors[b*85][0];
-                fBuffer[l][11] = fColors[b*85][1];
-                fBuffer[l][12] = '\0';
-            }
-
-    //
-    // mark end of lines of the data area
-    //
-    for (UInt_t y=0; y<fHeight; y++)
-    {
-        fBody[y] = new char[fWidth*2+1];
-        fBody[y][fWidth*2] = '\0';
-    }
-    //
-    // mark end of buffer
-    //
-    fBuffer[1+cols+fHeight] = '\0';
-
-    //
-    // Create Default Graphic Context (XCreateGC)
-    //
-    fDefGC = gVirtualX->CreateGC(fId, 0); // GetBckgndGC().GetGC(); //
-
-    //
     // Creat drawing semaphore
     //
@@ -112,62 +44,23 @@
     pthread_mutex_init((pthread_mutex_t*)fMuxPixmap, NULL);
 
-    //
-    // create empty (black) pixmap
-    //   return (Pixmap_t) XCreatePixmap(fDisplay, (Drawable) id, w, h,
-    //          DefaultDepth(fDisplay, DefaultScreen(fDisplay)));
-    //
-    fPixmap = kNone; //@@@gVirtualX->CreatePixmap(fId, fWidth, fHeight);
-
     Resize(w, h);
 
-    //fTimer=new TTimer(Form("gClient->ProcessEventsFor((TGWindow*)0x%p);", this), 250, kTRUE);
-//    fTimer=new TTimer("printf(\"Timer!\\n\"); gSystem->ProcessEvents();", 250, kTRUE);
-    //fTimer->Start();
-}
-
-void MGImage::Resize(UInt_t w, UInt_t h)
-{
-//    TGFrame::Resize(w+2*GetBorderWidth(), h+2*GetBorderWidth());
-    // FIXME: RESIZE THE PIXMAP
-}
-
-void MGImage::Resize(TGDimension size)
-{
-//    TGFrame::Resize(size.fWidth+2*GetBorderWidth(), size.fHeight+2*GetBorderWidth());
-    // FIXME: RESIZE THE PIXMAP
-}
-
-void MGImage::MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
-{
-//   TGFrame::MoveResize(x, y, w+2*GetBorderWidth(), h+2*GetBorderWidth());
-   // FIXME: RESIZE THE PIXMAP
+    //
+    // create empty pixmap
+    //
+    fPixmap = gVirtualX->CreatePixmap(fId, fWidth, fHeight);
+    fDefGC  = gVirtualX->CreateGC(fId, 0);
+    fImage  = (XImage*)gVirtualX->CreateImage(fWidth, fHeight);
 }
 
 MGImage::~MGImage()
 {
-    //fTimer->Stop();
-    //delete fTimer;
-
     pthread_mutex_lock((pthread_mutex_t*)fMuxPixmap);
 
-    cout << "Deleting fBuffer..." << endl;
+    cout << "Deleting MGImage..." << endl;
 
-    char **b = fBuffer;
-    while (*b)
-        delete[] *b++;
-    delete[] fBuffer;
-
-    cout << "Deleting Pixmap..." << endl;
-
-    if (fPixmap!=kNone) // @@@
-    {
-        cout << "Delete Pixmap" << endl;
-        gVirtualX->DeletePixmap(fPixmap);  // XFreePixmap(fDisplay, (Pixmap) pmap);
-    }
-
-    cout << "Deleting GC..." << endl;
-
-
-    gVirtualX->DeleteGC(fDefGC);       // XFreeGC(fDisplay, (GC) gc);
+    gVirtualX->DeletePixmap(fPixmap);
+    gVirtualX->DeleteGC(fDefGC);
+    gVirtualX->DeleteImage((Drawable_t)fImage);
 
     pthread_mutex_destroy((pthread_mutex_t*)fMuxPixmap);
@@ -176,77 +69,17 @@
 }
 
-#include <X11/Xlib.h>
-/*
-#include <X11/Xutil.h>
-#include <X11/Intrinsic.h>
-XImage *fPix=NULL;
-*/
-
 void MGImage::DoRedraw()
 {
-//    TGFrame::DrawBorder();
     pthread_mutex_lock((pthread_mutex_t*)fMuxPixmap);
 
-    //===========================
-    if (TestBit(kNeedRecreate))
+    if (TestBit(kNeedRedraw))
     {
-        Pixmap_t mask = kNone;
-        PictureAttributes_t attr;
-        attr.fMask = kNone;
-
-        if (fPixmap!=kNone)
-            gVirtualX->DeletePixmap(fPixmap);
-
-        fPixmap=kNone;
-
-        if (!gVirtualX->CreatePictureFromData(fId, fBuffer, fPixmap,
-                                              mask, attr))
-        {
-            cout << "Warning: Error in CreatePictureFromData" << endl;
-            fPixmap=kNone;
-        }
-        ResetBit(kNeedRecreate);
+        gVirtualX->PutImage(fId, fDefGC, (Drawable_t)fImage, 0, 0, 0, 0, fWidth, fHeight);
+        ResetBit(kNeedRedraw);
     }
 
-    //===========================
-
-    // Copy a drawable (i.e. pixmap) to another drawable (pixmap, window).
-    // The graphics context gc will be used and the source will be copied
-    // from src_x,src_y,src_x+width,src_y+height to dest_x,dest_y.
-    // XCopyArea(fDisplay, src, dest, (GC) gc, src_x, src_y, width, height,
-    //           dest_x, dest_y);
-    if (fPixmap!=kNone) //@@@
-    {
-//        gVirtualX->DrawString(fId, fDefGC, 20, 20, "HELLO WORLD!", 12);
-//        gVirtualX->FillRectangle(fId, fDefGC, 10, 10, 50, 50);
-
-        //        cout << gVirtualX->IsA()->GetName() << endl;
-        gVirtualX->CopyArea(fPixmap, fId, fDefGC,
-                            0, 0, fWidth, fHeight,
-                            GetBorderWidth(), GetBorderWidth());
-
-        /*
-        XCopyArea((Display*)gVirtualX->GetDisplay(), pm, fId,
-                  (GC)fDefGC, 0, 0, fWidth, fHeight,
-                  GetBorderWidth(), GetBorderWidth());
-                  */
-    }
-/*
-     if (fPix)
-    {
-        cout << "put" << flush;
-        XPutImage((Display*)gVirtualX->GetDisplay(), fId,
-                  fDefGC, fPix,
-                  0, 0, GetBorderWidth(), GetBorderWidth(),
-                  fWidth, fHeight);
-
-    cout << "done " << endl;
-    }
-*/
     pthread_mutex_unlock((pthread_mutex_t*)fMuxPixmap);
 }
 
-
-//#include <TGClient.h>
 void MGImage::DrawImg(const byte *buffer)
 {
@@ -254,115 +87,20 @@
         return;
 
-    for (UInt_t y=0; y<fHeight; y++)
+    char *d = fImage->data;
+    char *e = (char*)(buffer+fWidth*fHeight);
+    char *s = (char*)buffer;
+
+    // FIXME: This loop depends on the screen color depth
+    while (s<e)
     {
-        for (UInt_t x=0; x<fWidth; x++)
-        {
-            const byte col = buffer[y*fWidth+x];
-
-            fBody[y][x*2]   = fColors[col][0];
-            fBody[y][x*2+1] = fColors[col][1];
-        }
+        *d++ = *s;
+        *d++ = *s;
+        *d++ = *s++;
+        d++;
     }
 
-/*
-    cout << "CreateImage" << flush;
-    if (!fPix)
-    {
-        Display *dsp = (Display*)gVirtualX->GetDisplay();
-        Screen  *scr = DefaultScreenOfDisplay(dsp);
-        Visual  *vis = DefaultVisualOfScreen(scr);
+    SetBit(kNeedRedraw);
 
-        cout << vis->visualid << endl;
-        cout << vis->c_class << endl;
-        cout << vis->bits_per_rgb << endl;
-        cout << vis->map_entries << endl;
-        Visual visual;
-        visual.c_class = StaticGray;
-
-        int n;
-        XPixmapFormatValues *fmt = XListPixmapFormats(dsp, &n);
-
-        cout << "N: " << n << endl;
-        for (int i=0; i<n; i++)
-        {
-            cout << fmt[i].dww.epth << " " << fmt[i].bits_per_pixel << " "
-                << fmt[i].scanline_pad << endl;
-        }
-
-        Colormap colormap = XCreateColormap(dsp, fId, vis, AllocNone);
-
-        for (int i=0; i<vis->map_entries; i++)
-        {
-            XColor color;
-            char data[4];
-
-            color.flags = DoRed | DoGreen | DoBlue;
-            color.pixel = i;
-            color.red   = (256*i/vis->map_entries) << 8;
-            color.green = (256*i/vis->map_entries) << 8;
-            color.blue  = (256*i/vis->map_entries) << 8;
-
-            XAllocColor(dsp, colormap, &color);
-
-            cout << color.pixel <<" " << flush;
-        }
-        fPix = XCreateImage(dsp, vis, 8, ZPixmap, 0,
-                            buffer, 768, 576, 32, 0);
-
-        cout << "Colors" << visual.visualid << flush;
-
-    }
-    cout << "Done " << (void*)fPix << endl;
-    */
-
-/*
-    Pixmap_t mask = kNone;
-    PictureAttributes_t attr;
-    attr.fMask = kNone;
-    if (fPixmap!=kNone) // @@@
-        gVirtualX->DeletePixmap(fPixmap); // XFreePixmap(fDisplay, (Pixmap) pmap);
-
-    // Create a pixture pixmap from data. The picture attributes
-    // are used for input and output. Returns kTRUE in case of success,
-    // kFALSE otherwise. If mask does not exist it is set to kNone.
-    //
-    // XpmAttributes xpmattr;
-    //
-    // MapPictureAttributes(attr, xpmattr);
-    //
-    // Int_t res = XpmCreatePixmapFromData(fDisplay, id, data, (Pixmap*)&pict,
-    //                                     (Pixmap*)&pict_mask, &xpmattr);
-    //
-    // MapPictureAttributes(attr, xpmattr, kFALSE);
-    // XpmFreeAttributes(&xpmattr);
-    //
-    // if (res == XpmSuccess || res == XpmColorError)
-    //   return kTRUE;
-    //
-    // if (pict) {
-    //    XFreePixmap(fDisplay, (Pixmap)pict);
-    //    pict = kNone;
-    // }
-    // if (pict_mask) {
-    //    XFreePixmap(fDisplay, (Pixmap)pict_mask);
-    //    pict_mask = kNone;
-    // }
-    // return kFALSE;
-    fPixmap=kNone;
-    if (!gVirtualX->CreatePictureFromData(fId, fBuffer, fPixmap,
-                                          mask, attr))
-    {
-        cout << "Warning: Error in CreatePictureFromData" << endl;
-        fPixmap=kNone;
-    }
-*/
-    SetBit(kNeedRecreate);
     pthread_mutex_unlock((pthread_mutex_t*)fMuxPixmap);
-    //gClient->NeedRedraw(this);
-    //fTimer->Start(10, kTRUE);
-    //gVirtualX->UpdateWindow(1);
-    //    ((TGX11*)gVirtualX)->Sync(1);
-    //new TTimer(Form("gClient->ProcessEventsFor((TGWindow*)0x%p);", this), 1, kFALSE);
-    //    DoRedraw();
 }
 
@@ -372,48 +110,44 @@
         return;
 
-    for (UInt_t y=0; y<fHeight; y++)
+    char *d  = fImage->data;
+    char *e  = (char*)(gbuf+fWidth*fHeight);
+    char *s1 = (char*)gbuf;
+    char *s2 = (char*)cbuf;
+
+    // FROM libAfterImage:
+    // -------------------
+    //#define ALPHA_TRANSPARENT      	0x00
+    //#define ALPHA_SEMI_TRANSPARENT 	0x7F
+    //#define ALPHA_SOLID            	0xFF
+    // * Lowermost 8 bits - Blue channel
+    // * bits 8 to 15     - Green channel
+    // * bits 16 to 23    - Red channel
+    // * bits 24 to 31    - Alpha channel
+    //#define ARGB32_White    		0xFFFFFFFF
+    //#define ARGB32_Black    		0xFF000000
+
+    // FIXME: This loop depends on the screen color depth
+    while (s1<e)
     {
-        for (UInt_t x=0; x<fWidth; x++)
+        if (*s2)
         {
-            const byte ccol = cbuf[y*fWidth+x];
-
-            if (ccol)
-            {
-                fBody[y][x*2]   = 'f'+ccol/8+1;
-                fBody[y][x*2+1] = 'f'+ccol%8+1;
-            }
-            else
-            {
-                const byte gcol = gbuf[y*fWidth+x];
-                fBody[y][x*2]   = fColors[gcol][0];
-                fBody[y][x*2+1] = fColors[gcol][1];
-            }
+            *d++ = ((*s2>>4)&0x3)*85;
+            *d++ = ((*s2>>2)&0x3)*85;
+            *d++ = ((*s2++ )&0x3)*85;
+            d++;
+            s1++;
+        }
+        else
+        {
+            *d++ = *s1;
+            *d++ = *s1;
+            *d++ = *s1++;
+            d++;
+            s2++;
         }
     }
-/*
-    Pixmap_t mask = kNone;
-    PictureAttributes_t attr;
-    attr.fMask = kNone;
 
-    if (fPixmap!=kNone)
-        gVirtualX->DeletePixmap(fPixmap);
+    SetBit(kNeedRedraw);
 
-    fPixmap=kNone;
-
-    if (!gVirtualX->CreatePictureFromData(fId, fBuffer, fPixmap,
-                                          mask, attr))
-    {
-        cout << "Warning: Error in CreatePictureFromData" << endl;
-        fPixmap=kNone;
-    }
-    */
-    SetBit(kNeedRecreate);
     pthread_mutex_unlock((pthread_mutex_t*)fMuxPixmap);
-    //gClient->NeedRedraw(this);
-    //fTimer->Start(10, kTRUE);
-    //gVirtualX->UpdateWindow(1);
-    //    ((TGX11*)gVirtualX)->Sync(1);
-    //new TTimer(Form("gClient->ProcessEventsFor((TGWindow*)0x%p);", this), 1, kFALSE);
-    //    DoRedraw();
 }
-
Index: trunk/MagicSoft/Cosy/gui/MGImage.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGImage.h	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGImage.h	(revision 2278)
@@ -8,5 +8,10 @@
 //   Version: V1.0 (1-8-2000)
 
+#ifndef ROOT_TGFrame
 #include <TGFrame.h>
+#endif
+#ifndef ROOT_TGX11
+#include <TGX11.h>
+#endif
 
 class TTimer;
@@ -16,8 +21,5 @@
 class MGImage : public TGFrame
 {
-    char fColors[0x100][3];
-
-    char **fBuffer;
-    char **fBody;
+    XImage *fImage;
 
     GContext_t fDefGC;
@@ -31,5 +33,5 @@
     TTimer *fTimer;
 
-    enum { kNeedRecreate = BIT(17) };
+    enum { kNeedRedraw = BIT(17) };
 
 public:
@@ -38,8 +40,4 @@
 
     void DoRedraw();
-
-    void Resize(UInt_t w, UInt_t h);
-    void Resize(TGDimension size);
-    void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h);
 
     void DrawImg(const byte *buffer);
Index: trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 2278)
@@ -69,5 +69,5 @@
     InitArc(fSaturn,  1001, kYellow/*17*/, 16);
 
-    for (int i=0; i<13; i++)
+    for (int i=0; i<14; i++)
     {
         fStars[i] = new TArc(0, 0, 1);
@@ -110,27 +110,33 @@
 }
 
-static const RaDec stars[13] =
+static const RaDec stars[14] =
 {
     // 32349   Sirius           -1.44 1.45    2.64      0.009   A0m
-    (RaDec(Slalib::Hms2Rad(  6, 45, 0), Slalib::Dms2Rad(-16, 42, 0))),
+    (RaDec(Slalib::Hms2Rad(  6, 45,  0), Slalib::Dms2Rad(-16, 42,  0))),
     // 30438   Canopus          -0.62 -5.53   95.88     0.164   F0Ib
-    (RaDec(Slalib::Hms2Rad(  6, 23, 0), Slalib::Dms2Rad(-52, 41, 0))),
+    (RaDec(Slalib::Hms2Rad(  6, 23,  0), Slalib::Dms2Rad(-52, 41,  0))),
     // 69673   Arcturus         -0.05 -0.31   11.25     1.239   K2IIIp
-    (RaDec(Slalib::Hms2Rad( 14, 15, 0), Slalib::Dms2Rad( 19, 10, 0))),
-    (RaDec(Slalib::Hms2Rad( 01, 37, 6), Slalib::Dms2Rad(-57, 14, 0))),
-    (RaDec(Slalib::Hms2Rad( 12, 26, 6), Slalib::Dms2Rad(-63, 06, 0))),
-    (RaDec(Slalib::Hms2Rad( 13, 25, 2), Slalib::Dms2Rad(-11, 10, 0))),
-    (RaDec(Slalib::Hms2Rad(  5, 14, 0), Slalib::Dms2Rad(- 8, 12, 5))),
-    (RaDec(Slalib::Hms2Rad( 19, 50, 0), Slalib::Dms2Rad(- 8, 52, 6))),
-    (RaDec(Slalib::Hms2Rad( 18, 37, 0), Slalib::Dms2Rad( 38, 47, 0))),
-    (RaDec(Slalib::Hms2Rad(  5, 16, 0), Slalib::Dms2Rad( 46, 00, 0))),
-    (RaDec(Slalib::Hms2Rad(  7, 39, 0), Slalib::Dms2Rad(  5, 14, 0))),
-    (RaDec(Slalib::Hms2Rad(  5, 55, 0), Slalib::Dms2Rad(  7, 24, 0))),
-    (RaDec(Slalib::Hms2Rad( 19, 50, 0), Slalib::Dms2Rad(  8, 52, 0)))
+    (RaDec(Slalib::Hms2Rad( 14, 15,  0), Slalib::Dms2Rad( 19, 10,  0))),
+    //         Vega              0.03
+    (RaDec(Slalib::Hms2Rad( 18, 37,  0), Slalib::Dms2Rad( 38, 47,  0))),
+    //         Altair            0.77
+    (RaDec(Slalib::Hms2Rad( 19, 50,  0), Slalib::Dms2Rad(  8, 52,  6))),
+    //         Antares           0.96
+    (RaDec(Slalib::Hms2Rad( 16, 29, 25), Slalib::Dms2Rad(-26, 25, 55))),
+    //         Spica             0.98
+    (RaDec(Slalib::Hms2Rad( 13, 25, 13), Slalib::Dms2Rad(-11,  9, 41))),
+    //         Deneb             1.25
+    (RaDec(Slalib::Hms2Rad( 20, 41, 26), Slalib::Dms2Rad( 45, 16, 49))),
+    (RaDec(Slalib::Hms2Rad(  1, 37,  6), Slalib::Dms2Rad(-57, 14,  0))),
+    (RaDec(Slalib::Hms2Rad( 12, 26,  6), Slalib::Dms2Rad(-63, 06,  0))),
+    (RaDec(Slalib::Hms2Rad(  5, 14,  0), Slalib::Dms2Rad(- 8, 12,  5))),
+    (RaDec(Slalib::Hms2Rad(  5, 16,  0), Slalib::Dms2Rad( 46, 00,  0))),
+    (RaDec(Slalib::Hms2Rad(  7, 39,  0), Slalib::Dms2Rad(  5, 14,  0))),
+    (RaDec(Slalib::Hms2Rad(  5, 55,  0), Slalib::Dms2Rad(  7, 24,  0)))
 };
 
 void MGSkyPosition::UpdateStars()
 {
-    for (int i=0; i<13; i++)
+    for (int i=0; i<14; i++)
         SetDot(fStars[i], stars[i], 0);
 }
@@ -138,11 +144,18 @@
 void MGSkyPosition::InitText()
 {
-    fText = new TText(105, 105, "");
-    //fText->SetFillStyle(4000);  // transparent
-    fText->SetTextAlign(33);  // right, top
-    fText->SetTextColor(10);  // white
-    fText->Draw();
-
-    fList->Add(fText);
+    fText1 = new TText(-105, 105, "");
+    fText2 = new TText(105, 105, "");
+
+    fText1->SetTextAlign(13);  // left, top
+    fText2->SetTextAlign(33);  // right, top
+
+    fText1->SetTextColor(10);  // white
+    fText2->SetTextColor(10);  // white
+
+    fText1->Draw();
+    fText2->Draw();
+
+    fList->Add(fText1);
+    fList->Add(fText2);
 }
 
@@ -339,8 +352,9 @@
 
     char txt[100];
-    sprintf(txt, "Zd=%s%d\xb0%02.1f'\nAz=%s%d\xb0%02.1f'",
-            x<0?"-":"", abs(xd), xm, y<0?"-":"", abs(yd), ym);
-
-    fText->SetText(fText->GetX(), fText->GetY(), txt);
+    sprintf(txt, "Zd=%s%d\xb0%02.1f'", x<0?"-":"", abs(xd), xm);
+    fText1->SetText(fText1->GetX(), fText1->GetY(), txt);
+
+    sprintf(txt, "Az=%s%d\xb0%02.1f'", y<0?"-":"", abs(yd), ym);
+    fText2->SetText(fText2->GetX(), fText2->GetY(), txt);
 
     SetModified();
@@ -379,6 +393,6 @@
             return false;
 
-        x=-100;
-        y= 100;
+        x= 100;
+        y=-100;
     }
 
Index: trunk/MagicSoft/Cosy/gui/MGSkyPosition.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGSkyPosition.h	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGSkyPosition.h	(revision 2278)
@@ -35,5 +35,5 @@
     TArc       *fSaturn;
 
-    TArc       *fStars[13];
+    TArc       *fStars[14];
 
     TArc       *fSaturnRing;
@@ -47,5 +47,6 @@
     TLine      *fSunL[4];
 
-    TText      *fText;
+    TText      *fText1;
+    TText      *fText2;
 
     SlaStars   *fSlaStar;
Index: trunk/MagicSoft/Cosy/gui/MGStarguider.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGStarguider.cc	(revision 2069)
+++ 	(revision )
@@ -1,1221 +1,0 @@
-#include "MGStarguider.h"
-
-#include <fstream.h>    // ifstream
-#include <iostream.h>   // cout
-#include <iomanip.h>   // cout
-
-#include <TTimer.h>
-
-#include <TGMenu.h>
-#include <TGLabel.h>
-#include <TSystem.h>
-#include <TGSplitter.h>    // TGHorizontal3DLine
-#include <TGTextEntry.h>
-
-#include "MGImage.h"
-#include "MGCoordinates.h"
-
-#include "coord.h"
-
-#include "StarCatalog.h"
-
-#include "Filter.h"
-#include "Filter2.h"
-#include "CaosFilter.h"
-#include "Writer.h"
-#include "base/timer.h"
-
-#include "MStarList.h"
-
-#include <TH1.h>
-#include <TH2.h>
-#include <TGraph.h>
-#include <TCanvas.h>
-
-#include <TFile.h>
-#include <TTree.h>
-#include <TBranch.h>
-
-#include "Led.h"
-#include "Leds.h"
-#include "Rings.h"
-
-#include "MGMenu.h"
-
-ClassImp(MGStarguider);
-
-enum {
-    IDM_kFilter,
-    IDM_kCaosFilter,
-    IDM_kCatalog,
-    IDM_kStarguider,
-    IDM_kStart,
-    IDM_kStop,
-    IDM_kFileType,
-    IDM_kPPM,
-    IDM_kPNG,
-    IDM_kOnce,
-    IDM_kStretch,
-    IDM_kUseFileRaDec,
-    IDM_kContinous,
-    IDM_kRate25ps,
-    IDM_kRate5ps,
-    IDM_kRate1s,
-    IDM_kRate5s,
-    IDM_kRate30s,
-    IDM_kRate1m,
-    IDM_kRate5m,
-    IDM_kSetup,
-    IDM_kLimMag3,
-    IDM_kLimMag4,
-    IDM_kLimMag5,
-    IDM_kLimMag6,
-    IDM_kLimMag7,
-    IDM_kLimMag8,
-    IDM_kLimMag9,
-    IDM_kPixSize,
-    IDM_kAngle,
-    IDM_kInterpol125,
-    IDM_kInterpol25,
-    IDM_kInterpol10,
-    IDM_kInterpol5,
-    IDM_kInterpol2,
-    IDM_kInterpol1,
-    IDM_kPositions,
-    IDM_kRings,
-    IDM_kLeds,
-    IDM_kStartAnalyse,
-    IDM_kStopAnalyse,
-    IDM_kResetHistograms
-};
-
-Bool_t MGStarguider::HandleTimer(TTimer *t)
-{
-    fImage->DoRedraw();
-    fZoomImage->DoRedraw();
-    return kTRUE;
-}
-
-#define kZOOM 96
-
-void MGStarguider::InitHists()
-{
-    Double_t xmin = 480.1-1.0;
-    Double_t xmax = 480.1+1.0;
-
-    Double_t ymin = 217.5-1.0;
-    Double_t ymax = 217.5+1.0;
-
-    Double_t rmin = 117.4-1.0;
-    Double_t rmax = 117.4+1.0;
-
-    Int_t xbin = 60;
-    Int_t ybin = 60;
-    Int_t rbin = 60;
-
-    fHistpr = new TH1F;
-    fHistpr->SetNameTitle("pr","Radius of the ring");
-    fHistpr->SetBins(rbin, rmin, rmax);
-    fHistpr->SetXTitle("r [mm]");
-    fHistpr->SetYTitle("counts");
-
-    fHistprx = new TH1F;
-    fHistprx->SetNameTitle("prx","x-coordinate of the ring-center");
-    fHistprx->SetBins(xbin, xmin, xmax);
-    fHistprx->SetXTitle("x [mm]");
-    fHistprx->SetYTitle("counts");
-
-    fHistpry = new TH1F;
-    fHistpry->SetNameTitle("pry","y-coordniate of the ring-center");
-    fHistpry->SetBins(ybin, ymin, ymax);
-    fHistpry->SetXTitle("y [mm]");
-    fHistpry->SetYTitle("counts");
-
-    for (int i=0; i<6; i++)
-    {
-        TString name  = "Angle";
-        TString title = "Angle of Led ";
-
-        name += i;
-        title += i;
-
-        fHistw[i] = new TH1F;
-        fHistw[i]->SetNameTitle(name, title);
-        fHistw[i]->SetBins(26, -25, 25);
-        fHistw[i]->SetXTitle("\\Phi [arcmin]");
-        fHistw[i]->SetYTitle("counts");
-
-        name = "Angles";
-        title = "Angles of the Leds ";
-
-        name += i;
-        title += i;
-
-        fHistv[i] = new TH1F;
-        fHistv[i]->SetNameTitle(name, title);
-        fHistv[i]->SetBins(721, -180.5, 180.5);
-        fHistv[i]->SetXTitle("\\Phi [deg]");
-        fHistv[i]->SetYTitle("counts");
-    }
-
-    fHistallw = new TH1F;
-    fHistallw->SetNameTitle("allw","Rotation angel");
-    fHistallw->SetBins(26, -25, 25);
-    fHistallw->SetXTitle("\\Phi [arcmin]");
-    fHistallw->SetYTitle("counts");
-
-    fHistprxpry = new TH2F;
-    fHistprxpry->SetNameTitle("prx und pry","x- and y-coordniate of the ring-center");
-    fHistprxpry->SetBins(xbin, xmin, xmax, ybin, ymin, ymax);
-    fHistprxpry->SetXTitle("x [mm]");
-    fHistprxpry->SetYTitle("y [mm]");
-    fHistprxpry->SetZTitle("counts");
-}
-
-void MGStarguider::InitGraphs()
-{
-    fGraphprx = new TGraph;
-    fGraphprx->SetTitle("time-developement of the x-coordinate of the ring-center");
-
-    fGraphpry = new TGraph;
-    fGraphpry->SetTitle("time-developement of the y-coordinate of the ring-center");
-
-    for (int i=0; i<6; i++)
-    {
-        TString title = "Time-developement of the angle ";
-        title += i;
-
-        fGraphw[i] = new TGraph;
-        fGraphw[i]->SetTitle(title);
-    }
-}
-
-void MGStarguider::InitGui()
-{
-    fList = new MGList;
-
-    const TGWindow *p=gClient->GetRoot();
-
-    //
-    // Create Menu for MGStarguider Display
-    //
-    fDisplay = new MGPopupMenu(p);
-    fDisplay->AddEntry("&Filter",      IDM_kFilter);
-    fDisplay->AddEntry("C&aosFilter",  IDM_kCaosFilter);
-    fDisplay->AddEntry("Sao &Catalog", IDM_kCatalog);
-    fDisplay->AddEntry("Starguider",   IDM_kStarguider);
-    fDisplay->AddEntry("Stretch",      IDM_kStretch);
-    fDisplay->DisableEntry(IDM_kStarguider);
-    fDisplay->CheckEntry(IDM_kStretch);
-    fDisplay->Associate(this);
-    fList->Add(fDisplay);
-
-    fFileType = new MGPopupMenu(p);
-    fFileType->AddEntry("PP&M", IDM_kPPM);
-    fFileType->AddEntry("&PNG", IDM_kPNG);
-    fFileType->CheckEntry(IDM_kPNG);
-    fFileType->Associate(this);
-    fList->Add(fFileType);
-
-    fWriteType = new MGPopupMenu(p);
-    fWriteType->AddEntry("&Once",      IDM_kOnce);
-    fWriteType->AddEntry("&Continous", IDM_kContinous);
-    fWriteType->CheckEntry(IDM_kOnce);
-    fWriteType->Associate(this);
-    fList->Add(fWriteType);
-
-    fWriteRate = new MGPopupMenu(p);
-    fWriteRate->AddEntry("25/s", IDM_kRate25ps);
-    fWriteRate->AddEntry("5/s",  IDM_kRate5ps);
-    fWriteRate->AddEntry("1s",   IDM_kRate1s);
-    fWriteRate->AddEntry("5s",   IDM_kRate5s);
-    fWriteRate->AddEntry("30s",  IDM_kRate30s);
-    fWriteRate->AddEntry("1min", IDM_kRate1m);
-    fWriteRate->AddEntry("5min", IDM_kRate5m);
-    fWriteRate->CheckEntry(IDM_kRate1m);
-    fWriteRate->Associate(this);
-    fList->Add(fWriteRate);
-
-    fWrtRate = 25*60;
-
-    fWritePictures = new MGPopupMenu(p);
-    fWritePictures->AddEntry("&Start",      IDM_kStart);
-    fWritePictures->AddEntry("Sto&p",       IDM_kStop);
-    fWritePictures->AddSeparator();
-    fWritePictures->AddPopup("File &Type",  fFileType);
-    fWritePictures->AddPopup("&Write Type", fWriteType);
-    fWritePictures->AddPopup("Write &Rate", fWriteRate);
-    fWritePictures->DisableEntry(IDM_kStop);
-    fWritePictures->Associate(this);
-    fList->Add(fWritePictures);
-
-    fLimMag = new MGPopupMenu(p);
-    fLimMag->AddEntry("3", IDM_kLimMag3);
-    fLimMag->AddEntry("4", IDM_kLimMag4);
-    fLimMag->AddEntry("5", IDM_kLimMag5);
-    fLimMag->AddEntry("6", IDM_kLimMag6);
-    fLimMag->AddEntry("7", IDM_kLimMag7);
-    fLimMag->AddEntry("8", IDM_kLimMag8);
-    fLimMag->AddEntry("9", IDM_kLimMag9);
-    fLimMag->CheckEntry(IDM_kLimMag8);
-    fLimMag->Associate(this);
-    fList->Add(fLimMag);
-
-    fSao->SetLimitMag(7.0);
-
-    fInterpol = new MGPopupMenu(p);
-    fInterpol->AddEntry("125", IDM_kInterpol125);
-    fInterpol->AddEntry("25",  IDM_kInterpol25);
-    fInterpol->AddEntry("10",  IDM_kInterpol10);
-    fInterpol->AddEntry("5",   IDM_kInterpol5);
-    fInterpol->AddEntry("2",   IDM_kInterpol2);
-    fInterpol->AddEntry("Off", IDM_kInterpol1);
-    fInterpol->CheckEntry(IDM_kInterpol1);
-    fInterpol->Associate(this);
-    fList->Add(fInterpol);
-
-    fIntRate = 1;
-
-    fSetup = new MGPopupMenu(p);
-    fSetup->AddPopup("Lim. &Magnitude",      fLimMag);
-    fSetup->AddPopup("Disp. &Interpolation", fInterpol);
-    fSetup->AddEntry("Use Ra/Dec from file", IDM_kUseFileRaDec);
-    fSetup->Associate(this);
-    fList->Add(fSetup);
-
-    fWrite = new MGPopupMenu(p);
-    fWrite->AddEntry("&Positions",  IDM_kPositions);
-    fWrite->AddEntry("&Leds", IDM_kLeds);
-    fWrite->AddEntry("&Rings", IDM_kRings);
-    fWrite->Associate(this);
-    fList->Add(fWrite);
-
-    fAnalyse = new MGPopupMenu(p);
-    fAnalyse->AddEntry("S&tart Analyse", IDM_kStartAnalyse);
-    fAnalyse->AddEntry("St&opp Analyse", IDM_kStopAnalyse);
-    fAnalyse->DisableEntry(IDM_kStopAnalyse);
-    fAnalyse->AddEntry("&Reset Histograms", IDM_kResetHistograms);
-//    fAnalyse->AddEntry("Reset &Graph", IDM_kResetGraph);
-    fAnalyse->Associate(this);
-    fList->Add(fAnalyse);
-
-    fMenu = new MGMenuBar(this, 0, 0, kHorizontalFrame);
-    fMenu->AddPopup("&Display", fDisplay, NULL);
-    fMenu->AddPopup("&WritePics",   fWritePictures,   NULL);
-    fMenu->AddPopup("&Setup",   fSetup,   NULL);
-    fMenu->Resize(fMenu->GetDefaultSize());
-    fMenu->BindKeys(this);
-    AddFrame(fMenu); //, new TGLayoutHints (kLHintsNormal, 0, 4, 0, 0));
-    fList->Add(fMenu);
-
-    fCaOs = new MGPopupMenu(p);
-    fCaOs->AddPopup("&Write", fWrite);
-    fCaOs->AddPopup("&Analyse", fAnalyse);
-    fCaOs->Associate(this);
-    fCaOs->BindKeys(fMenu, this);
-    fList->Add(fCaOs);
-
-    fCRaDec = new MGCoordinates(this, kETypeRaDec);
-    fCRaDec->Move(1, fMenu->GetDefaultHeight()+584);
-    AddFrame(fCRaDec);
-    fList->Add(fCRaDec);
-
-    fCZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE);
-    fCZdAz->Move(240+12+10, fMenu->GetDefaultHeight()+584);
-    AddFrame(fCZdAz);
-    fList->Add(fCZdAz);
-
-    fPZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE);
-    fPZdAz->Move(240+12+10, fMenu->GetDefaultHeight()+630);
-    AddFrame(fPZdAz);
-    fList->Add(fPZdAz);
-
-    TGLabel *l = new TGLabel(this, "Arb.-Sky Pos");
-    l->SetTextJustify(kTextLeft);
-    l->Move(480+32, fMenu->GetDefaultHeight()+590);
-    AddFrame(l);
-    fList->Add(l);
-
-    l = new TGLabel(this, "arcsec/pix");
-    l->SetTextJustify(kTextLeft);
-    l->Move(605, fMenu->GetDefaultHeight()+619+13);
-    AddFrame(l);
-    fList->Add(l);
-
-    l = new TGLabel(this, "deg");
-    l->SetTextJustify(kTextLeft);
-    l->Move(605, fMenu->GetDefaultHeight()+619-10);
-    AddFrame(l);
-    fList->Add(l);
-
-    l = new TGLabel(this, "Pointing Pos");
-    l->SetTextJustify(kTextLeft);
-    l->Move(480+32, fMenu->GetDefaultHeight()+655);
-    AddFrame(l);
-    fList->Add(l);
-
-    const Double_t pixsize = 23.4;
-
-    fSao->SetPixSize(pixsize/3600);
-    fSao->SetRotationAngle(0);
-
-    TString txt;
-    txt += pixsize;
-
-    fPixSize = new TGTextEntry(this, txt, IDM_kPixSize);
-    fPixSize->SetAlignment(kTextCenterX);
-    fPixSize->Move(547, fMenu->GetDefaultHeight()+617+13);
-    AddFrame(fPixSize);
-    fList->Add(fPixSize);
-
-    fAngle = new TGTextEntry(this, "         0", IDM_kAngle);
-    fAngle->SetAlignment(kTextCenterX);
-    fAngle->Move(547, fMenu->GetDefaultHeight()+617-10);
-    AddFrame(fAngle);
-    fList->Add(fAngle);
-
-    // TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this);
-    // AddFrame(fLineSep, new TGLayoutHints (kLHintsNormal | kLHintsExpandX));
-    // fList->Add(fLineSep);
-
-    //
-    // Create Image Display
-    //
-    fZoomImage = new MGImage(this, kZOOM, kZOOM);
-    fZoomImage->Move(768-kZOOM-2, 700-kZOOM-2);
-    AddFrame(fZoomImage);
-    fList->Add(fZoomImage);
-
-    fImage = new MGImage(this, 768, 576);
-    fImage->Move(0, fMenu->GetDefaultHeight());
-    AddFrame(fImage);
-    fList->Add(fImage);
-
-    //
-    // Make everything visible
-    //
-    SetWindowName("MGStarguider Main Window");
-    SetIconName("MGStarguider");
-
-    MapSubwindows();
-    MapWindow();
-
-    //------------------------------------------------------------
-    //    XY xy(3.819444, 24.05333);
-    //    fCRaDec->SetCoordinates(xy);
-    //    fRaDec->Set(xy.X()*360/24, xy.Y());
-    //------------------------------------------------------------
-}
-
-MGStarguider::MGStarguider(MObservatory::LocationName_t obs)
-: TGMainFrame(gClient->GetRoot(), 768, 740), fFile(NULL), fDx((768-kZOOM)/2), fDy((512-kZOOM)/2)
-{
-    fSao = new StarCatalog(obs);
-    fRaDec = new RaDec(180, 40);
-
-    InitHists();
-    InitGraphs();
-
-    InitGui();
-
-    gVirtualX->GrabButton(fId, kButton2, 0, 0, 0, 0, kTRUE);
-
-    fTimer=new TTimer(this, 100); // 100ms
-    fTimer->TurnOn();
-}
-
-MGStarguider::~MGStarguider()
-{
-    gVirtualX->GrabButton(fId, kButton2, 0, 0, 0, 0, kFALSE);
-
-    fTimer->TurnOff();
-    delete fTimer;
-
-    delete fList;
-
-    delete fSao;
-    delete fRaDec;
-
-    delete fHistpr;
-    delete fHistprx;
-    delete fHistpry;
-    delete fHistprxpry;
-    delete fHistallw;
-    delete fGraphprx;
-    delete fGraphpry;
-
-    for (int i=0; i<6; i++)
-    {
-        delete fHistw[i];
-        delete fHistv[i];
-        delete fGraphw[i];
-    }
-
-    cout << "Camera Display destroyed." << endl;
-}
-
-void MGStarguider::Layout()
-{
-    // Resize(GetDefaultSize());
-}
-
-void MGStarguider::CloseWindow()
-{
-    cout << "EventDisplay::CloseWindow: Exit Application Loop." << endl;
-
-    //fClient.ExitLoop();
-    //    cout << "FIXME: ExitLoop not called!!!!!!" << endl;
-    gSystem->ExitLoop();
-}
-
-void MGStarguider::Toggle(MGPopupMenu *p, UInt_t id)
-{
-    if (p->IsEntryChecked(id))
-        p->UnCheckEntry(id);
-    else
-        p->CheckEntry(id);
-}
-
-void MGStarguider::ResetHists()
-{
-    fHistprx->Reset();
-    fHistpry->Reset();
-    fHistpr->Reset();
-    fHistprxpry->Reset();
-    fHistallw->Reset();
-    for (int i=0; i<6; i++)
-    {
-        fHistw[i]->Reset();
-        fHistv[i]->Reset();
-    }
-}
-
-void MGStarguider::DisplayAnalysis()
-{
-    TCanvas *c = new TCanvas("cring", "Center of the ring", 800, 800);
-    c->Divide(2,2);
-    c->cd(1);
-    fHistprx->Fit("gaus");
-    fHistprx->DrawCopy();
-    c->cd(2);
-    fHistpry->Fit("gaus");
-    fHistpry->DrawCopy();
-    c->cd(3);
-    fHistpr->Fit("gaus");
-    fHistpr->DrawCopy();
-    c->cd(4);
-    fHistprxpry->DrawCopy(/*"surf2"*/);
-    c->Update();
-
-    c = new TCanvas("c3", "Absolute angles of the leds", 800, 800);
-    c->Divide(2,3);
-    for (int i=0; i<6; i++)
-    {
-        c->cd(i+1);
-        TH1 *h = fHistv[i]->DrawCopy();
-        h->SetLineColor(i+1);
-        cout << "Led #" << i << ": MeanPhi=" << h->GetMean() << endl;
-    }
-    c->Update();
-
-    c = new TCanvas("c5", "timedevelopement of prx", 800, 800);
-    fGraphprx->Draw("ALP*");
-    fGraphprx->GetHistogram()->SetXTitle("time [1/25 s]");
-    fGraphprx->GetHistogram()->SetYTitle("x-coordinate");
-    c->Modified();
-    c->Update();
-
-    c = new TCanvas("c6", "timedevelopement of pry", 800, 800);
-    fGraphpry->Draw("ALP*");
-    fGraphpry->GetHistogram()->SetXTitle("time [1/25 s]");
-    fGraphpry->GetHistogram()->SetYTitle("y-coordinate");
-    c->Modified();
-    c->Update();
-
-    c = new TCanvas("c2", "Relative angles of the Leds", 800, 800);
-    c->Divide(2,3);
-    for (int i=0; i<6; i++)
-    {
-        c->cd(i+1);
-        fHistw[i]->DrawCopy();
-    }
-    c->Update();
-
-    c = new TCanvas("c7", "timedevelopement of the relative angles of the Leds", 800, 800);
-    c->Divide(2,3);
-    for (int i=0; i<6; i++)
-    {
-        c->cd(i+1);
-        fGraphw[i]->Draw("ALP*");
-        fGraphw[i]->GetHistogram()->SetXTitle("t [1/25s]");
-        fGraphw[i]->GetHistogram()->SetYTitle("[deg]");
-    }
-    c->Modified();
-    c->Update();
-
-    c = new TCanvas("c4", "rotation angle ", 800, 800);
-    fHistallw->Fit("gaus");
-    fHistallw->DrawCopy();
-}
-
-void MGStarguider::OpenFile()
-{
-    int i=0;
-    char name[100];
-    while (1)
-    {
-        sprintf(name, "data/data%03d.root", i++);
-        if (gSystem->AccessPathName(name, kFileExists))
-            break;
-    }
-
-    fFile = new TFile(name, "RECREATE");
-
-    if (!fFile->IsOpen())
-    {
-        delete fFile;
-        fFile = NULL;
-
-        cout << "Error: Cannot open file '" << name << "'" << endl;
-
-    }
-
-    fTree = new TTree("Data", "Real CaOs Data");
-
-    fLeds = NULL;
-    fRings = NULL;
-    fTime = 0;
-
-    fBranchL = fTree->Branch("Leds.",  "Leds",  &fLeds);
-    fBranchR = fTree->Branch("Rings.", "Rings", &fRings);
-    fBranchT = fTree->Branch("Time.", &fTime, "fTime/D");//, &fTime);
-
-    cout << "Root file '" << name << "' open." << endl;
-}
-
-Bool_t MGStarguider::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2)
-{
-    switch (GET_MSG(msg))
-    {
-    case kC_TEXTENTRY:
-        if (GET_SUBMSG(msg)==kTE_ENTER)
-            switch (mp1)
-            {
-            case IDM_kPixSize:
-                {
-                    const Float_t pixsize = atof(fPixSize->GetText());
-                    cout << "Pixel Size changed to " << pixsize << "\"/pix" << endl;
-                    fSao->SetPixSize(pixsize/3600);
-                    return kTRUE;
-                }
-            case IDM_kAngle:
-                {
-                    const Float_t angle = atof(fAngle->GetText());
-                    cout << "Rotation Angle changed to " << angle << "deg" << endl;
-                    fSao->SetRotationAngle(angle);
-                    return kTRUE;
-                }
-            }
-        return kTRUE;
-
-    case kC_COMMAND:
-        //cout << "kC_COMMAND" << endl;
-        switch (GET_SUBMSG(msg))
-        {
-        case kCM_MENU:
-            //cout << "kCM_MENU #" << mp1 << endl;
-            switch (mp1)
-            {
-            case IDM_kCatalog:
-                Toggle(fDisplay, IDM_kCatalog);
-                if (fDisplay->IsEntryChecked(IDM_kCatalog))
-                    fDisplay->EnableEntry(IDM_kStarguider);
-                else
-                {
-                    fDisplay->UnCheckEntry(IDM_kStarguider);
-                    fDisplay->DisableEntry(IDM_kStarguider);
-                }
-                return kTRUE;
-
-            case IDM_kStarguider:
-                Toggle(fDisplay, IDM_kStarguider);
-                gSystem->Unlink("tracking_error.txt");
-                return kTRUE;
-
-            case IDM_kFilter:
-                Toggle(fDisplay, IDM_kFilter);
-                if (fDisplay->IsEntryChecked(IDM_kFilter))
-                    fDisplay->EnableEntry(IDM_kStarguider);
-                else
-                {
-                    fDisplay->UnCheckEntry(IDM_kStarguider);
-                    fDisplay->DisableEntry(IDM_kStarguider);
-                }
-                return kTRUE;
-
-            case IDM_kStretch:
-                Toggle(fDisplay, IDM_kStretch);
-                return kTRUE;
-
-            case IDM_kCaosFilter:
-                if (!fDisplay->IsEntryChecked(IDM_kCaosFilter))
-                    OpenFile();
-                Toggle(fDisplay, IDM_kCaosFilter);
-                if (fDisplay->IsEntryChecked(IDM_kCaosFilter))
-                    fMenu->AddPopup("&CaOs", fCaOs, NULL);
-                else
-                {
-                    fFile->Write();
-                    delete fFile;
-                    fFile = NULL;
-
-                    cout << "Root file closed." << endl;
-
-                    if(fWrite->IsEntryChecked(IDM_kPositions))
-                       fWrite->UnCheckEntry(IDM_kPositions);
-                    if(fWrite->IsEntryChecked(IDM_kLeds))
-                       fWrite->UnCheckEntry(IDM_kLeds);
-                    if(fWrite->IsEntryChecked(IDM_kRings))
-                        fWrite->UnCheckEntry(IDM_kRings);
-                    if(fAnalyse->IsEntryEnabled(IDM_kStopAnalyse))
-                    {
-                        fAnalyse->DisableEntry(IDM_kStopAnalyse);
-                        fAnalyse->EnableEntry(IDM_kStartAnalyse);
-                        ResetHists();
-                        // Graphs are not reset !!!
-                    }
-                    fMenu->RemovePopup("CaOs");
-                }
-                fMenu->Resize(fMenu->GetDefaultSize());
-                MapSubwindows();
-                MapWindow();
-                return kTRUE;
-
-            case IDM_kPositions:
-                Toggle(fWrite, IDM_kPositions);
-                return kTRUE;
-
-            case IDM_kLeds:
-                Toggle(fWrite, IDM_kLeds);
-                return kTRUE;
-
-            case IDM_kRings:
-                Toggle(fWrite, IDM_kRings);
-                return kTRUE;
-
-            case IDM_kStartAnalyse:
-                fAnalyse->DisableEntry(IDM_kStartAnalyse);
-                fAnalyse->EnableEntry(IDM_kStopAnalyse);
-                return kTRUE;
-
-            case IDM_kStopAnalyse:
-                {
-                    fAnalyse->DisableEntry(IDM_kStopAnalyse);
-                    fAnalyse->EnableEntry(IDM_kStartAnalyse);
-
-                    DisplayAnalysis();
-
-                    return kTRUE;
-                }
-
-            case IDM_kResetHistograms:
-                ResetHists();
-                return kTRUE;
-
-/*            case IDM_kResetGraph:
-                {
-                    fGraphx->GetHistogram()->Reset();
-
-                }
-*/
-
-            case IDM_kUseFileRaDec:
-                Toggle(fSetup, IDM_kUseFileRaDec);
-                return kTRUE;
-
-            case IDM_kStart:
-                fWritePictures->DisableEntry(IDM_kStart);
-                fWritePictures->EnableEntry(IDM_kStop);
-                return kTRUE;
-
-            case IDM_kStop:
-                fWritePictures->DisableEntry(IDM_kStop);
-                fWritePictures->EnableEntry(IDM_kStart);
-                return kTRUE;
-
-            case IDM_kPNG:
-                fFileType->CheckEntry(IDM_kPNG);
-                fFileType->UnCheckEntry(IDM_kPPM);
-                return kTRUE;
-
-            case IDM_kPPM:
-                fFileType->CheckEntry(IDM_kPPM);
-                fFileType->UnCheckEntry(IDM_kPNG);
-                return kTRUE;
-
-            case IDM_kOnce:
-                fWriteType->CheckEntry(IDM_kOnce);
-                fWriteType->UnCheckEntry(IDM_kContinous);
-                return kTRUE;
-
-            case IDM_kContinous:
-                fWriteType->CheckEntry(IDM_kContinous);
-                fWriteType->UnCheckEntry(IDM_kOnce);
-                return kTRUE;
-
-            case IDM_kRate25ps:
-            case IDM_kRate5ps:
-            case IDM_kRate1s:
-            case IDM_kRate5s:
-            case IDM_kRate30s:
-            case IDM_kRate1m:
-            case IDM_kRate5m:
-                for (int i=IDM_kRate25ps; i<=IDM_kRate5m; i++)
-                    if (mp1==i)
-                        fWriteRate->CheckEntry(i);
-                    else
-                        fWriteRate->UnCheckEntry(i);
-                switch (mp1)
-                {
-                case IDM_kRate25ps:
-                    fWrtRate = 1;
-                    return kTRUE;
-                case IDM_kRate5ps:
-                    fWrtRate = 5;
-                    return kTRUE;
-                case IDM_kRate1s:
-                    fWrtRate = 25;
-                    return kTRUE;
-                case IDM_kRate5s:
-                    fWrtRate = 5*25;
-                    return kTRUE;
-                case IDM_kRate30s:
-                    fWrtRate = 30*25;
-                    return kTRUE;
-                case IDM_kRate1m:
-                    fWrtRate = 60*25;
-                    return kTRUE;
-                case IDM_kRate5m:
-                    fWrtRate = 5*60*25;
-                    return kTRUE;
-                }
-                return kTRUE;
-
-            case IDM_kInterpol125:
-            case IDM_kInterpol25:
-            case IDM_kInterpol10:
-            case IDM_kInterpol5:
-            case IDM_kInterpol2:
-            case IDM_kInterpol1:
-                for (int i=IDM_kInterpol125; i<=IDM_kInterpol1; i++)
-                    if (mp1==i)
-                        fInterpol->CheckEntry(i);
-                    else
-                        fInterpol->UnCheckEntry(i);
-                switch (mp1)
-                {
-                case IDM_kInterpol1:
-                    fIntRate = 1;
-                    return kTRUE;
-                case IDM_kInterpol2:
-                    fIntRate = 2;
-                    return kTRUE;
-                case IDM_kInterpol5:
-                    fIntRate = 5;
-                    return kTRUE;
-                case IDM_kInterpol10:
-                    fIntRate = 10;
-                    return kTRUE;
-                case IDM_kInterpol25:
-                    fIntRate = 25;
-                    return kTRUE;
-                case IDM_kInterpol125:
-                    fIntRate = 125;
-                    return kTRUE;
-                }
-                return kTRUE;
-
-            case IDM_kLimMag3:
-            case IDM_kLimMag4:
-            case IDM_kLimMag5:
-            case IDM_kLimMag6:
-            case IDM_kLimMag7:
-            case IDM_kLimMag8:
-            case IDM_kLimMag9:
-                for (int i=IDM_kLimMag3; i<=IDM_kLimMag9; i++)
-                    if (mp1==i)
-                        fLimMag->CheckEntry(i);
-                    else
-                        fLimMag->UnCheckEntry(i);
-
-                fSao->SetLimitMag(mp1-IDM_kLimMag3+3);
-                return kTRUE;
-            }
-            break;
-        }
-        break;
-    }
-
-    return kTRUE;
-}
-
-void MGStarguider::GetCoordinates()
-{
-    XY xy = fCRaDec->GetCoordinates();
-
-    if (fSetup->IsEntryChecked(IDM_kUseFileRaDec))
-    {
-        ifstream fin("coordinates.txt");
-        if (!fin)
-            cout << "Error: Cannot open 'coordinates.txt' using fall back solution." << endl;
-        else
-            fin >> xy;
-    }
-
-    fCRaDec->SetCoordinates(xy);
-    fRaDec->Set(xy.X()*360/24, xy.Y());
-}
-
-ZdAz MGStarguider::TrackingError(TArrayF &x, TArrayF &y, TArrayF &mag) const
-{
-    //
-    // Viewable area (FIXME: AZ)
-    //
-    TH2F h("Hist", "dX/dY",  77, -768/2-.5,  768/2+.5, 58, -576/2-.5,  576/2+.5); // 3
-
-    /*
-    TH1F hmag("HistMag", "Mag", 19, 0, 100);
-    for (int i=0; i<mag.GetSize(); i++)
-        hmag.Fill(mag[i]);
-        */
-
-    //
-    // Search for matching Magnitudes
-    //
-    for (int i=0; i<mag.GetSize(); i++)
-    {
-        if (mag[i]>48-15 && mag[i]<48+15)
-            h.Fill(x[i], y[i]);
-    }
-
-    //
-    // Serach for an excess in the histogram
-    //
-    Int_t mx, my, dummy;
-    h.GetMaximumBin(mx, my, dummy);
-
-    const double xmax = h.GetXaxis()->GetBinCenter(mx);
-    const double dx   = h.GetXaxis()->GetBinWidth(mx);
-
-    const double ymax = h.GetYaxis()->GetBinCenter(my);
-    const double dy   = h.GetYaxis()->GetBinWidth(my);
-
-    cout << setprecision(3);
-    cout << "Cut-XY:       " << xmax << " +- " << dx << " / " << ymax << " +- " << dy << endl;
-
-    TGraph g;
-    for (int i=0; i<mag.GetSize(); i++)
-    {
-        if (!(x[i]>xmax-dx && x[i]<xmax+dx &&
-              y[i]>ymax-dy && y[i]<ymax+dy &&
-              mag[i]>48-15 && mag[i]<48+15))
-            continue;
-
-        g.SetPoint(g.GetN(), x[i], y[i]);
-    }
-
-    cout << "Offset-XY:    " << g.GetMean(1) << " +- " << g.GetRMS(1) << " / ";
-    cout << g.GetMean(2) << " +- " << g.GetRMS(2) << endl;
-
-    AltAz pos0 = fSao->CalcAltAzFromPix(768/2,              576/2)*kRad2Deg;
-    AltAz pos1 = fSao->CalcAltAzFromPix(768/2+g.GetMean(1), 576/2+g.GetMean(2))*kRad2Deg;
-
-    ofstream fout1("pointingpos.txt");
-    fout1 << setprecision(10) << fSao->GetMjd()-52000 << " " << -pos1.Alt() << " " << pos1.Az() << endl;
-
-    pos1 -= pos0;
-
-    ofstream fout2("tracking_error.txt", ios::app);
-    fout2 << setprecision(10) << fSao->GetMjd()-52000 << " " << -pos1.Alt() << " " << pos1.Az() << endl;
-
-    return ZdAz(-pos1.Alt(), pos1.Az());
-}
-
-void MGStarguider::CalcTrackingError(Leds &leds, MStarList &stars)
-{
-    const Int_t max = leds.GetEntries();
-
-    if (stars.GetRealEntries() < 3)
-    {
-        cout << "Sorry, less than 3 stars in FOV!" << endl;
-        return;
-    }
-
-    if (max < 1)
-    {
-        cout << "Sorry, less than 1 detected spot in FOV!" << endl;
-        return;
-    }
-
-    stars.Sort(); // Sort by magnitude
-
-    TString str = "data/tracking_";
-    str += fSao->GetMjd()-52000;
-    str += ".txt";
-
-    ofstream fout(str);
-
-    TArrayF x, y, mag;
-
-    Int_t num = 0;
-
-    // FIXME: Is predifined value 3 a good idea?
-
-    MStar *star;
-    MStarListIter NextStar(&stars);
-    while ((star=NextStar()) && num++<max+3)
-    {
-        TIter NextSp(&leds);
-        Led *spot=NULL;
-        while ((spot=(Led*)NextSp()))
-        {
-            const XY dpos(spot->GetX()-star->GetX(), spot->GetY()-star->GetY());
-
-            const Int_t idx = x.GetSize();
-
-            x.Set(idx+1);
-            y.Set(idx+1);
-            mag.Set(idx+1);
-
-            x.AddAt(dpos.X(), idx);
-            y.AddAt(dpos.Y(), idx);
-            mag.AddAt(spot->GetMag()/star->GetMag(), idx);
-
-            if (fout)
-                fout << x[idx] << " " << y[idx] << " " << mag[idx] << endl;
-        }
-    }
-
-    ZdAz d = TrackingError(x, y, mag);
-
-    //
-    // Calculated offsets
-    //
-
-    // round= floor(x+.5)
-    cout << "Offset-ZdAz: " << d.Zd()*60 << "' / " << d.Az()*60 << "'" << endl;
-    cout << "Offset-ZdAz: " << d.Zd()/360*16384 << " / " << d.Az()/360*16384 << " (SE) " << endl;
-
-    //
-    // Current Pointing position
-    //
-    ZdAz cpos = fSao->GetZdAz()-d;
-    fPZdAz->SetCoordinates(cpos);
-}
-
-
-void MGStarguider::ProcessFrame(const unsigned long n, byte *img, struct timeval *tm)
-{
-    static float myimg[768*576];
-
-    for (int i=0; i<768*576; i++)
-        myimg[i] += img[i];
-
-    if (n%fIntRate)
-        return;
-
-    //cout << "Img: " << n << endl;
-
-    byte c[768*576];
-    for (int i=0; i<768*576; i++)
-        c[i] = (byte)(myimg[i]/fIntRate+.5);
-
-    if (fDisplay->IsEntryChecked(IDM_kStretch))
-        Filter::Stretch(c);
-
-    if (!fWritePictures->IsEntryEnabled(IDM_kStart) &&
-        (!(n%fWrtRate) || fWriteType->IsEntryChecked(IDM_kOnce)))
-    {
-        if (fFileType->IsEntryChecked(IDM_kPNG))
-            Writer::Png("pix/file", c, tm);
-
-        if (fFileType->IsEntryChecked(IDM_kPPM))
-            Writer::Ppm("pix/file", c, tm);
-
-        if (fWriteType->IsEntryChecked(IDM_kOnce))
-            ProcessMessage(MK_MSG(kC_COMMAND, kCM_MENU), IDM_kStop, 0);
-    }
-
-    MStarList spots;
-
-    /*
-    if (fDisplay->IsEntryChecked(IDM_kStarguider))
-        Filter2::Execute(spots, c);
-    else
-     */
-    if (fDisplay->IsEntryChecked(IDM_kFilter))
-        Filter::Execute(c);
-
-    if (fDisplay->IsEntryChecked(IDM_kCaosFilter))
-    {
-        // Double_t kConv = 0.502; // [pix/mm]
-
-        static Timer t0(tm);
-        Timer t(tm);
-
-        fTime = (t.GetMjd()-t0.GetMjd())*24*60*60;
-
-        Leds leds;
-        CaosFilter::Execute(c, leds, 1);
-
-        if (fWrite->IsEntryChecked(IDM_kPositions))
-            leds.Print();
-
-        CaosFilter::FilterLeds(leds);
-        leds.Compress();
-
-        if (fWrite->IsEntryChecked(IDM_kLeds))
-            leds.Print();
-
-        Rings rings;
-        rings.CalcRings(leds);
-
-        leds.Sort();
-
-        fLeds  = &leds;
-        fRings = &rings;
-
-        if (fFile)
-            fTree->Fill();
-
-        if (fWrite->IsEntryChecked(IDM_kRings))
-            rings.Print();
-
-        if (fAnalyse->IsEntryEnabled(IDM_kStopAnalyse))
-        {
-            const Ring &center = rings.GetCenter();
-
-            Double_t phi[6] =
-            {
-                -124.727,
-                 -61.0495,
-                 -16.7907,
-                  49.3119,
-                 139.086
-            };
-
-            fHistpr->Fill(center.GetR());
-            fHistprx->Fill(center.GetX());
-            fHistpry->Fill(center.GetY());
-            fHistprxpry->Fill(center.GetX(), center.GetY());
-
-            Double_t sum = 0;
-            for (int i=0; i<6 && leds.At(i); i++)
-            {
-                const Double_t w = (leds(i).GetPhi()-phi[i])*60;
-
-                sum += w;
-
-                fHistw[i]->Fill(w);
-                fHistv[i]->Fill(leds(i).GetPhi());
-                fGraphw[i]->SetPoint(fGraphw[i]->GetN(), fTime, w);
-            }
-            fHistallw->Fill(sum/5);
-
-            fGraphprx->SetPoint(fGraphprx->GetN(), fTime, center.GetX());
-            fGraphpry->SetPoint(fGraphpry->GetN(), fTime, center.GetY());
-        }
-    }
-
-    byte zimg[kZOOM*kZOOM];
-    for (int y=0; y<kZOOM; y++)
-        for (int x=0; x<kZOOM; x++)
-            zimg[x+y*kZOOM] = c[(fDx+(x-kZOOM/2)/2)+(fDy+(y-kZOOM/2)/2)*768];
-
-    fZoomImage->DrawImg(zimg);
-
-    if (fDisplay->IsEntryChecked(IDM_kCatalog))
-    {
-        Timer time(tm);
-
-        GetCoordinates();
-
-        MStarList stars;
-        fSao->GetStars(stars, time.GetMjd(), *fRaDec);
-
-        if (fDisplay->IsEntryChecked(IDM_kStarguider))
-        {
-            Leds leds;
-            CaosFilter::Execute(c, leds, 1);
-
-            cout << "Found: " << leds.GetEntries() << " leds" << endl;
-
-            CaosFilter::RemoveTwins(leds, 3);
-            leds.Compress();
-
-            cout << "Rest: " << leds.GetEntries() << " leds" << endl;
-
-            CalcTrackingError(leds, stars);
-        }
-
-        byte cimg[768*576];
-        fSao->GetImg(c, cimg, stars);
-
-        DrawCircle(c, 0.5);
-        DrawCircle(c, 1.0);
-        DrawCircle(c, 1.5);
-
-        fCZdAz->SetCoordinates(fSao->GetZdAz());
-
-        fImage->DrawColImg(c, cimg);
-    }
-    else
-        fImage->DrawImg(c);
-
-    memset(myimg, 0, 768*576*sizeof(float));
-}
-
-void MGStarguider::DrawCircle(byte *img, double r)
-{
-    const double rpix = r*60*60/fSao->GetPixSize()+1;
-    const int cx = 768/2;
-    const int cy = 576/2;
-    for (int dx=-(int)(rpix*0.7); dx<(int)(rpix*0.7); dx++)
-    {
-        const int dy = (int)sqrt(rpix*rpix-dx*dx);
-        img[cx+dx + (cy-dy)*768] = 0x40;
-        img[cx+dx + (cy+dy)*768] = 0x40;
-        img[cx-dy + (cy+dx)*768] = 0x40;
-        img[cx+dy + (cy+dx)*768] = 0x40;
-    }
-}
-
-Bool_t MGStarguider::HandleDoubleClick(Event_t *event)
-{
-    const Int_t w = fImage->GetWidth();
-    const Int_t h = fImage->GetHeight();
-    const Int_t x = fImage->GetX();
-    const Int_t y = fImage->GetY();
-
-    if (!(event->fX>x && event->fX<x+w && event->fY>y && event->fY<y+h))
-        return kTRUE;
-
-    Int_t dx = event->fX-x;
-    Int_t dy = event->fY-y;
-
-    if (dx<kZOOM/4) dx=kZOOM/4;
-    if (dy<kZOOM/4) dy=kZOOM/4;
-    if (dx>766-kZOOM/2) dx=766-kZOOM/4;
-    if (dy>510-kZOOM/2) dy=510-kZOOM/4;
-
-    fDx = dx;
-    fDy = dy;
-
-    fSao->Now();
-    AltAz aa = fSao->CalcAltAzFromPix(fDx, fDy)*kRad2Deg;
-
-    cout << "New coordinates for zoom - x, y   : " << fDx << " " << fDy << endl;
-    cout << "New coordinates for zoom - Alt, az: " << aa.Alt() << " " << aa.Az() << endl;
-
-    return kTRUE;
-}
Index: trunk/MagicSoft/Cosy/gui/MGStarguider.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGStarguider.h	(revision 2069)
+++ 	(revision )
@@ -1,145 +1,0 @@
-#ifndef COSY_MGStarguider
-#define COSY_MGStarguider
-
-#ifndef ROOT_TGFrame
-#include <TGFrame.h>
-#endif
-#include "PixClient.h"
-#ifndef MARS_MObservatory
-#include "MObservatory.h"
-#endif
-
-#include "MGList.h"
-#include "MGImage.h"
-
-#include "coord.h"
-
-class TArrayF;
-class TH1F;
-class TH2F;
-class TGraph;
-
-class TTimer;
-
-class MGMenuBar;
-class MGPopupMenu;
-class TGTextEntry;
-
-class MGImage;
-class MGCoordinates;
-
-class StarCatalog;
-class MStarList;
-
-class TFile;
-class TTree;
-class TBranch;
-
-class Leds;
-class Rings;
-
-class MGStarguider : public PixClient, public TGMainFrame
-{
-private:
-    MGList        *fList;
-
-    MGMenuBar     *fMenu;
-    MGImage       *fImage;
-    MGImage       *fZoomImage;
-
-    MGPopupMenu   *fDisplay;
-    MGPopupMenu   *fWrite;
-    MGPopupMenu   *fWritePictures;
-    MGPopupMenu   *fFileType;
-    MGPopupMenu   *fWriteType;
-    MGPopupMenu   *fAnalyse;
-    MGPopupMenu   *fCaOs;
-    MGPopupMenu   *fWriteRate;
-    MGPopupMenu   *fInterpol;
-    MGPopupMenu   *fSetup;
-    MGPopupMenu   *fLimMag;
-
-    TFile         *fFile;
-    TTree         *fTree;
-    TBranch       *fBranchL;
-    TBranch       *fBranchT;
-    TBranch       *fBranchR;
-
-    Leds *fLeds;
-    Rings *fRings;
-    Double_t fTime;
-
-    TH1F          *fHistpr;
-    TH1F          *fHistprx;
-    TH1F          *fHistpry;
-    TH1F          *fHistw[6];
-    TH1F          *fHistallw;
-    TH1F          *fHistv[6];
-
-    TH2F          *fHistprxpry;
-
-    TGraph        *fGraphprx;
-    TGraph        *fGraphpry;
-    TGraph        *fGraphw[6];
-
-    MGCoordinates *fCRaDec;
-    MGCoordinates *fCZdAz;
-
-    MGCoordinates *fPZdAz;
-
-    TGTextEntry   *fPixSize;
-    TGTextEntry   *fAngle;
-
-    StarCatalog   *fSao;
-
-    RaDec *fRaDec;
-
-    TTimer *fTimer;
-
-    Int_t fDx;
-    Int_t fDy;
-
-    int fIntRate;
-    int fWrtRate;
-
-    void SetPixSize(const double pixsize);
-    void Toggle(MGPopupMenu *p, UInt_t id);
-    void GetCoordinates();
-    void CalcTrackingError(Leds &, MStarList &);
-    ZdAz TrackingError(TArrayF &alt, TArrayF &az, TArrayF &mag) const;
-
-    void InitHists();
-    void InitGraphs();
-    void InitGui();
-
-    void OpenFile();
-
-    void ResetHists();
-    void DisplayAnalysis();
-
-    Bool_t HandleTimer(TTimer *t);
-    //Bool_t HandleKey(Event_t* event);
-
-    void DrawCircle(byte *img, double r);
-
-public:
-    MGStarguider(MObservatory::LocationName_t obs);
-    virtual ~MGStarguider();
-
-    //void Update();
-
-    void Layout();
-    void CloseWindow();
-
-    Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
-    Bool_t HandleDoubleClick(Event_t *event);
-
-    //
-    // Execution of one frame - this function may be overloaded!
-    //
-    void ProcessFrame(const unsigned long n, byte *img, struct timeval *tm);
-
-    ClassDef(MGStarguider, 0)
-};
-
-#endif
Index: trunk/MagicSoft/Cosy/gui/MGVelocity.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGVelocity.cc	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGVelocity.cc	(revision 2278)
@@ -24,79 +24,4 @@
 void MGVelocity::DrawCoordinateSystem()
 {
-    /*
-    TArc arc;
-    arc.SetFillStyle(4000);  // transparent
-    arc.SetFillColor(39);
-    arc.SetLineColor(3);     // green
-    arc.SetLineStyle(2);     // dashed  (s. TAttLine)
-    arc.DrawArc(0, 0,  20);
-
-    arc.SetLineColor(5);     // yellow
-    arc.DrawArc(0, 0,  40);
-
-    arc.SetLineColor(2);     // red
-    arc.DrawArc(0, 0, 60);
-    */
-    //
-    // FIXME? Use TAxis?
-    //
-/*
-    TLine line;
-    line.SetLineColor(13);
-    line.SetLineStyle(3);  // dotted  (s. TAttLine)
-    line.DrawLine(-30., -65., -30.,  65.);
-    line.DrawLine(-65., -30.,  65., -30.);
-    line.DrawLine( 30., -65.,  30.,  65.);
-    line.DrawLine( -6.,  30.,  65.,  30.);
-
-    line.DrawLine(-15., -65., -15.,  65.);
-    line.DrawLine(-65., -15.,  65., -15.);
-    line.DrawLine( 15., -65.,  15.,  65.);
-    line.DrawLine(-65.,  15.,  65.,  15.);
-
-    line.DrawLine(-45., -65., -45.,  65.);
-    line.DrawLine(-65., -45.,  65., -45.);
-    line.DrawLine( 45., -65.,  45.,  65.);
-    line.DrawLine(-65.,  45.,  65.,  45.);
-
-    line.SetLineColor(12);
-    line.SetLineStyle(2);  // dashed  (s. TAttLine)
-    line.DrawLine(-60., -65., -60.,  65.);
-    line.DrawLine(-65., -60.,  65., -60.);
-    line.DrawLine( 60., -65.,  60.,  65.);
-    line.DrawLine(-65.,  60.,  65.,  60.);
-
-    line.SetLineColor(1);  // black
-    line.SetLineStyle(1);  // solid  (s. TAttLine)
-    line.DrawLine(-65.,   0, 65.,  0);
-    line.DrawLine(  0, -65.,  0, 65.);
-
-    line.DrawLine(-1.,  60., 1.,  60.);
-    line.DrawLine(-1., -60., 1., -60.);
-    line.DrawLine(-1.,  30., 1.,  30.);
-    line.DrawLine(-1., -30., 1., -30.);
-
-    line.DrawLine( 60., -1.,  60., 1.);
-    line.DrawLine(-60., -1., -60., 1.);
-    line.DrawLine( 30., -1.,  30., 1.);
-    line.DrawLine(-30., -1., -30., 1.);
-
-    TText text;
-    text.SetTextAlign(22);  // centered, centered (s.TAttText)
-    text.DrawText(60., 5., "vAz['/min]");
-    text.DrawText(0,  70., "vZd['/min]");
-
-    text.SetTextAlign(23);  // centered, centered (s.TAttText)
-    text.DrawText(-60., -2., "-1'");
-    text.DrawText( 60., -2., "1'");
-    text.DrawText(-30., -2., "-.5'");
-    text.DrawText( 30., -2., ".5'");
-
-    text.SetTextAlign(32);  // centered, centered (s.TAttText)
-    text.DrawText(-2., -60., "-1'");
-    text.DrawText(-2.,  60., "1'");
-    text.DrawText(-2., -30., "-.5'");
-    text.DrawText(-2.,  30., ".5'");
-    */
     TWbox box;
     box.DrawWbox(-145, 145, -35, 120,  18,  2, 1);
@@ -130,19 +55,4 @@
 void MGVelocity::InitVelocity()
 {
-    /*
-     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->Draw();
-    fLin2->Draw();
-
-    fList->Add(fLin1);
-    fList->Add(fLin2);
-    */
     fArrow    = new TArrow(0, 0, 0, 0, 0.01);
     fArrowX   = new TArrow(0, 0, 0, 0, 0.01);
@@ -170,10 +80,4 @@
     fText->Draw();
     fList->Add(fText);
-
-    fTextVel = new TText(2*70, 2*70, "");
-    fTextVel->SetTextAlign(33);  // right, top
-    fTextVel->SetTextColor(10);  // white
-    fTextVel->Draw();
-    fList->Add(fTextVel);
 }
 
@@ -255,6 +159,4 @@
     fArrowAvg->SetX2(avgx);
     fArrowAvg->SetY2(avgy);
-
-    //    cout << avgx << " " << avgy << endl;
 
     if ((fabs(avgx)>/*40.*/110. || fabs(avgy)>/*40.*/110.))
@@ -274,28 +176,4 @@
 }
 
-void MGVelocity::UpdateVelText(Float_t vx, Float_t vy)
-{
-    static int X = ~0;
-    static int Y = ~0;
-
-    vx /= 60.;  //['/min]
-    vy /= 60.;  //['/min]
-
-    int fx = (int)/*floor*/(vx*10.);
-    int fy = (int)/*floor*/(vy*10.);
-
-    if (X==fx && Y==fy)
-        return;
-
-    X = fx;
-    Y = fy;
-
-    char txt[100];
-    sprintf(txt, "Zd=%.1f'\nAz=%.1f'",
-            vy, vx);
-
-    fTextVel->SetText(fTextVel->GetX(), fTextVel->GetY(), txt);
-}
-
 void MGVelocity::Update(ZdAz &zdaz)
 {
@@ -303,12 +181,7 @@
     // calculate actual time for planet positions
     //
-    //    static int X = 0xaffe;
-    //    static int Y = 0xaffe;
-
     float vx = zdaz.Az()*3600.; // ["/min]
     float vy = zdaz.Zd()*3600.; // ["/min]
 
-    UpdateVelText(vx, vy);
-
     int pixx = (int)(vx*fScale/fPix);
     int pixy = (int)(vy*fScale/fPix);
@@ -328,8 +201,4 @@
         return;
 
-    //    cout << fScale << ": " << pixx << " " << pixy;
-    //    cout << fScale << ": " << (int)rc << (int)((int)fOld->X()==pixx) << (int)((int)fOld->Y()==pixy) << "  ";
-    //    cout << zdaz.Az()*3600. << " " << zdaz.Zd()*3600. << endl;
-
     vx *= fScale;
     vy *= fScale;
Index: trunk/MagicSoft/Cosy/gui/MGVelocity.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGVelocity.h	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/MGVelocity.h	(revision 2278)
@@ -31,5 +31,5 @@
 
     TText *fText;
-    TText *fTextVel;
+//    TText *fTextVel;
 
     XY *fOld;
@@ -44,5 +44,5 @@
     void DrawCoordinateSystem();
     void UpdateText();
-    void UpdateVelText(Float_t x, Float_t y);
+    //void UpdateVelText(Float_t x, Float_t y);
 
 public:
Index: trunk/MagicSoft/Cosy/gui/Makefile
===================================================================
--- trunk/MagicSoft/Cosy/gui/Makefile	(revision 2069)
+++ trunk/MagicSoft/Cosy/gui/Makefile	(revision 2278)
@@ -32,15 +32,14 @@
 .SUFFIXES: .c .cc .cxx .h .hxx .o 
 
-SRCFILES = MGCoordinate.cc \
+SRCFILES = MGCosy.cc \
+           MGCoordinate.cc \
 	   MGCoordinates.cc \
-	   MGCosy.cc \
 	   MGImage.cc \
 	   MGEmbeddedCanvas.cc \
 	   MGAccuracy.cc \
 	   MGVelocity.cc \
-           MGStarguider.cc \
 	   MGSkyPosition.cc \
-           MGMenu.cc
-
+           MGMenu.cc 
+	   
 SRCS        = $(SRCFILES)
 HEADERS     = $(SRCFILES:.cc=.h)
