Index: trunk/MagicSoft/Cosy/gui/MGCoordinate.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCoordinate.cc	(revision 740)
+++ trunk/MagicSoft/Cosy/gui/MGCoordinate.cc	(revision 808)
@@ -25,5 +25,5 @@
 MGCoordinate::MGCoordinate(const TGWindow* p,
                            const Bool_t flag, const char *txt,
-                           const UInt_t deg, const UInt_t min, const UInt_t sec)
+                           const Int_t deg, const UInt_t min, const UInt_t sec)
 : TGFrame(p, 114, flag?76:46, kSunkenFrame|kFixedSize), fDeg(deg), fMin(min), fSec(sec)
 {
@@ -131,5 +131,8 @@
 Double_t MGCoordinate::GetVal() const
 {
-    return (Double_t)(60*(60*fDeg+fMin)+fSec)/3600;
+    const Int_t deg = fDeg<0 ? -fDeg : fDeg;
+    const Int_t sgn = fDeg<0 ? -1 : 1;
+
+    return (Double_t)sgn*(60*(60*deg+fMin)+fSec)/3600;
 }
 
@@ -139,5 +142,5 @@
 }
 
-void MGCoordinate::Set(TGLabel *label, UInt_t val)
+void MGCoordinate::Set(TGLabel *label, Int_t val)
 {
     char txt[20];
@@ -148,5 +151,5 @@
 }
 
-void MGCoordinate::Set(TGTextEntry *entry, UInt_t val)
+void MGCoordinate::Set(TGTextEntry *entry, Int_t val)
 {
     char txt[20];
@@ -184,9 +187,9 @@
 
 
-Bool_t MGCoordinate::Set(TGLabel *label, UInt_t &val, TGTextEntry *entry)
-{
-    UInt_t newval = atoi(entry->GetText());
-
-    Bool_t ok = (entry == fTextEntryDeg || newval<60);
+Bool_t MGCoordinate::Set(TGLabel *label, Int_t &val, TGTextEntry *entry)
+{
+    Int_t newval = atoi(entry->GetText());
+
+    Bool_t ok = (entry == fTextEntryDeg || (newval>=0 && newval<60));
 
     if (ok)
Index: trunk/MagicSoft/Cosy/gui/MGCoordinate.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCoordinate.h	(revision 740)
+++ trunk/MagicSoft/Cosy/gui/MGCoordinate.h	(revision 808)
@@ -20,7 +20,7 @@
 class MGCoordinate : public TGFrame
 {
-    UInt_t fDeg;
-    UInt_t fMin;
-    UInt_t fSec;
+    Int_t fDeg;
+    Int_t fMin;
+    Int_t fSec;
 
     MGList fList;
@@ -36,12 +36,12 @@
     TGLabel     *fLabel;
 
-    void   Set(TGLabel     *label, const UInt_t val);
-    void   Set(TGTextEntry *entry, const UInt_t val);
-    Bool_t Set(TGLabel     *label, UInt_t &val, TGTextEntry *label);
+    void   Set(TGLabel     *label, const Int_t val);
+    void   Set(TGTextEntry *entry, const Int_t val);
+    Bool_t Set(TGLabel     *label, Int_t &val, TGTextEntry *label);
 
 public:
     MGCoordinate(const TGWindow* p,
                  const Bool_t flag=kTRUE, const char *txt="Coordinates:",
-                 const UInt_t deg=0, const UInt_t min=0, const UInt_t sec=0);
+                 const Int_t deg=0, const UInt_t min=0, const UInt_t sec=0);
     ~MGCoordinate();
 
Index: trunk/MagicSoft/Cosy/gui/MGCoordinates.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCoordinates.cc	(revision 740)
+++ trunk/MagicSoft/Cosy/gui/MGCoordinates.cc	(revision 808)
@@ -14,6 +14,6 @@
                              const Bool_t flag,
                              const char *txt1, const char *txt2,
-                             const UInt_t deg1, const UInt_t min1, const UInt_t sec1,
-                             const UInt_t deg2, const UInt_t min2, const UInt_t sec2)
+                             const Int_t deg1, const UInt_t min1, const UInt_t sec1,
+                             const Int_t deg2, const UInt_t min2, const UInt_t sec2)
 : TGFrame(p, 234, 76, kFixedSize)
 {
Index: trunk/MagicSoft/Cosy/gui/MGCoordinates.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCoordinates.h	(revision 740)
+++ trunk/MagicSoft/Cosy/gui/MGCoordinates.h	(revision 808)
@@ -27,6 +27,6 @@
                   const char *txt1="Coordinate1:",
                   const char *txt2="Coordinate2:",
-                  const UInt_t deg1=0, const UInt_t min1=0, const UInt_t sec1=0,
-                  const UInt_t deg2=0, const UInt_t min2=0, const UInt_t sec2=0);
+                  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);
     ~MGCoordinates();
 
Index: trunk/MagicSoft/Cosy/gui/MGCosy.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 740)
+++ trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 808)
@@ -16,4 +16,6 @@
 #include "MGList.h"
 #include "MGCoordinates.h"
+
+#include "Slalib.h"
 
 #define IDM_EXIT 1
@@ -242,9 +244,12 @@
                     t.GetTime();
 
+                    Slalib sla;
+                    sla.Set(t.GetMjd());
+
                     XY xy = fCoord->GetCoordinates();
                     RaDec rd(xy.X(), xy.Y());
 
                     cout << "Ra/Dec: " << rd.Ra() << kDEG << " " << rd.Dec() << kDEG << endl;
-                    ZdAz aa=MCosy::RaDec2ZdAz(t.GetMjd(), rd*D2PI/360.0)*360.0/D2PI;
+                    ZdAz aa=sla.CalcZdAz(rd*D2PI/360.0)*360.0/D2PI;
                     cout << "Zd/Az: " << aa.Zd() << kDEG << " " << aa.Az() << kDEG << endl;
                 }
Index: trunk/MagicSoft/Cosy/gui/MGImage.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGImage.cc	(revision 740)
+++ trunk/MagicSoft/Cosy/gui/MGImage.cc	(revision 808)
@@ -195,6 +195,6 @@
 
 
-#include <TGClient.h>
-void MGImage::DrawImg(const char *buffer)
+//#include <TGClient.h>
+void MGImage::DrawImg(const byte *buffer)
 {
     if (pthread_mutex_trylock((pthread_mutex_t*)fMuxPixmap))
@@ -205,5 +205,5 @@
         for (UInt_t x=0; x<fWidth; x++)
         {
-            const unsigned char col = buffer[y*fWidth+x];
+            const byte col = buffer[y*fWidth+x];
 
             fBody[y][x*2]   = fColors[col][0];
@@ -306,5 +306,5 @@
 }
 
-void MGImage::DrawColImg(const char *gbuf, const char *cbuf)
+void MGImage::DrawColImg(const byte *gbuf, const byte *cbuf)
 {
     if (pthread_mutex_trylock((pthread_mutex_t*)fMuxPixmap))
@@ -315,5 +315,5 @@
         for (UInt_t x=0; x<fWidth; x++)
         {
-            const unsigned char ccol = cbuf[y*fWidth+x];
+            const byte ccol = cbuf[y*fWidth+x];
 
             if (ccol)
@@ -324,5 +324,5 @@
             else
             {
-                const unsigned char gcol = gbuf[y*fWidth+x];
+                const byte gcol = gbuf[y*fWidth+x];
                 fBody[y][x*2]   = fColors[gcol][0];
                 fBody[y][x*2+1] = fColors[gcol][1];
Index: trunk/MagicSoft/Cosy/gui/MGImage.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGImage.h	(revision 740)
+++ trunk/MagicSoft/Cosy/gui/MGImage.h	(revision 808)
@@ -9,4 +9,6 @@
 
 #include <TGFrame.h>
+
+typedef unsigned char byte;
 
 class MGImage : public TGFrame
@@ -38,6 +40,6 @@
     void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h);
 
-    void DrawImg(const char *buffer);
-    void DrawColImg(const char *gbuf, const char *cbuf);
+    void DrawImg(const byte *buffer);
+    void DrawColImg(const byte *gbuf, const byte *cbuf);
 };
 
