Index: trunk/MagicSoft/Cosy/gui/MGCosy.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 8998)
+++ trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 9132)
@@ -131,5 +131,5 @@
 {
     const int x = 180;
-    const int y = 25;
+    const int y = 20;
 
     TGLabel *l;
@@ -150,72 +150,47 @@
     fList->Add(fMjd);
 
-    l = new TGLabel(f, "SE-Az:");
+    l = new TGLabel(f, "Encoder-Az:");
+    l->Move(x-60, y+57);
+    fList->Add(l);
+
+    l = new TGLabel(f, "Encoder-Zd:");
     l->Move(x-60, y+40);
     fList->Add(l);
 
-    l = new TGLabel(f, "SE-Zd1:");
-    l->Move(x-60, y+57);
-    fList->Add(l);
-
-    l = new TGLabel(f, "SE-Zd2:");
-    l->Move(x-60, y+74);
-    fList->Add(l);
-
     fWeather = new TGLabel(f, "");
-    fWeather->MoveResize(10, y+280, 280, 16);
+    fWeather->MoveResize(10, y+272, 280, 16);
     fList->Add(fWeather);
 
-    fLabel1 = new TGLabel(f, "00000000"); // Max: 16384
-    fLabel2 = new TGLabel(f, "00000000");
-    fLabel3 = new TGLabel(f, "00000000");
+    fLabel1 = new TGLabel(f, "0000000000");
+    fLabel2 = new TGLabel(f, "0000000000");
     fLabel1->SetTextJustify(kTextRight);
     fLabel2->SetTextJustify(kTextRight);
-    fLabel3->SetTextJustify(kTextRight);
-    fLabel1->Move(x, y+40);
-    fLabel2->Move(x, y+57);
-    fLabel3->Move(x, y+74);
+    fLabel1->Move(x+30, y+57);
+    fLabel2->Move(x+30, y+40);
     fList->Add(fLabel1);
     fList->Add(fLabel2);
-    fList->Add(fLabel3);
-/*
-    l = new TGLabel(f, "Offset-Zd:");
-    l->Move(x-60, y+102);
+
+    l = new TGLabel(f, "Ra (estimated):");
+    l->Move(x-60, y+57+23);
     fList->Add(l);
 
-    l = new TGLabel(f, "Offset-Az:");
-    l->Move(x-60, y+119);
+    l = new TGLabel(f, "Ra (nominal):");
+    l->Move(x-60, y+57+40);
     fList->Add(l);
 
-    fOffsetZd = new TGLabel(f, "000000000");
-    fOffsetAz = new TGLabel(f, "000000000");
-    fOffsetZd->SetTextJustify(kTextRight);
-    fOffsetAz->SetTextJustify(kTextRight);
-    fOffsetZd->Move(x+15, y+102);
-    fOffsetAz->Move(x+15, y+119);
-    fList->Add(fOffsetZd);
-    fList->Add(fOffsetAz);
-*/
-    l = new TGLabel(f, "Ra (estimated):");
-    l->Move(x-60, y+142-20);
+    l = new TGLabel(f, "Dec (estimated):");
+    l->Move(x-60, y+57+40+23);
     fList->Add(l);
 
-    l = new TGLabel(f, "Ra (nominal):");
-    l->Move(x-60, y+159-20);
+    l = new TGLabel(f, "Dec (nominal):");
+    l->Move(x-60, y+57+40+40);
     fList->Add(l);
 
-    l = new TGLabel(f, "Dec (estimated):");
-    l->Move(x-60, y+182-20);
+    l = new TGLabel(f, "Zd (nominal):");
+    l->Move(x-60, y+57+80+23);
     fList->Add(l);
 
-    l = new TGLabel(f, "Dec (nominal):");
-    l->Move(x-60, y+199-20);
-    fList->Add(l);
-
-    l = new TGLabel(f, "Zd (nominal):");
-    l->Move(x-60, y+222);
-    fList->Add(l);
-
     l = new TGLabel(f, "Az (nominal):");
-    l->Move(x-60, y+239);
+    l->Move(x-60, y+57+80+40);
     fList->Add(l);
 
@@ -232,10 +207,10 @@
     fZdSoll->SetTextJustify(kTextRight);
     fAzSoll->SetTextJustify(kTextRight);
-    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);
+    fRaEst->Move(x+30, y+57+23);
+    fRaSoll->Move(x+30, y+57+40);
+    fDecEst->Move(x+30, y+57+40+23);
+    fDecSoll->Move(x+30, y+57+40+40);
+    fZdSoll->Move(x+30, y+57+80+23);
+    fAzSoll->Move(x+30, y+57+80+40);
     fList->Add(fRaEst);
     fList->Add(fDecEst);
@@ -251,10 +226,19 @@
     fStopping  = new TGLabel(f, "Stopping");
     fStopped   = new TGLabel(f, "Stopped");
-    fAvailMac1 = new TGLabel(f, "- MACS1 -");
-    fAvailMac2 = new TGLabel(f, "- MACS2 -");
-    //fAvailMac3 = new TGLabel(f, "- MAC3 -");
-    fAvailSe1  = new TGLabel(f, "-SE/Zd1-");
-    fAvailSe2  = new TGLabel(f, "-SE/Zd2-");
-    fAvailSe3  = new TGLabel(f, "- SE/Az -");
+    //fAvailDkc1 = new TGLabel(f, "- DKC/Zd -");
+    //fAvailDkc2 = new TGLabel(f, "- DKC/Az -");
+    fAvailTcp  = new TGLabel(f, "- TCP/IP -");
+
+    fDkcReady1    = new TGLabel(f, "bb");
+    fDkcReady2    = new TGLabel(f, "bb");
+    fDkcEmergency = new TGLabel(f, "Emergency");
+    fDkcPcMode    = new TGLabel(f, "PC mode");
+    fDkcRF1       = new TGLabel(f, "AF");
+    fDkcRF2       = new TGLabel(f, "AF");
+    fDkcBrake     = new TGLabel(f, "Zd Brake");
+    fDkcPower     = new TGLabel(f, "Power on");
+
+    fMsgAz     = new TGLabel(f, " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
+    fMsgZd     = new TGLabel(f, " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
 
     ULong_t color;
@@ -264,10 +248,13 @@
     gClient->GetColorByName("Red", color);
     fError->SetBackgroundColor(color);
-    fAvailMac1->SetBackgroundColor(color);
-    fAvailMac2->SetBackgroundColor(color);
-    //fAvailMac3->SetBackgroundColor(color);
-    fAvailSe1->SetBackgroundColor(color);
-    fAvailSe2->SetBackgroundColor(color);
-    fAvailSe3->SetBackgroundColor(color);
+    fDkcReady1->SetBackgroundColor(color);
+    fDkcReady2->SetBackgroundColor(color);
+    fDkcEmergency->SetBackgroundColor(color);
+    fDkcPcMode->SetBackgroundColor(color);
+    fDkcRF1->SetBackgroundColor(color);
+    fDkcRF2->SetBackgroundColor(color);
+    fDkcBrake->SetBackgroundColor(color);
+    fDkcPower->SetBackgroundColor(color);
+    fAvailTcp->SetBackgroundColor(color);
     gClient->GetColorByName("LightBlue", color);
     fMoving->SetBackgroundColor(color);
@@ -279,16 +266,32 @@
     fStopped->SetBackgroundColor(color);
 
-    fArmed   ->MoveResize(10,  25,        70, 20);
-    fError   ->MoveResize(10,  25+25,     70, 20);
-    fMoving  ->MoveResize(10,  25+25+20,  70, 20);
-    fTracking->MoveResize(10,  25+25+40,  70, 20);
-    fStopping->MoveResize(10,  25+25+60,  70, 20);
-    fStopped ->MoveResize(10,  25+25+80,  70, 20);
-    fAvailMac1->MoveResize(10, 25+25+120, 70, 20);
-    fAvailMac2->MoveResize(10, 25+25+140, 70, 20);
-    //fAvailMac3->Move(10, 25+160);
-    fAvailSe1->MoveResize(10,  25+25+200, 70, 20);
-    fAvailSe2->MoveResize(10,  25+25+220, 70, 20);
-    fAvailSe3->MoveResize(10,  25+25+180, 70, 20);
+    gClient->GetColorByName("White", color);
+    fMsgAz->SetBackgroundColor(color);
+    fMsgZd->SetBackgroundColor(color);
+
+    fArmed   ->MoveResize(10,  20,        70, 20);
+    fError   ->MoveResize(10,  20+25,     70, 20);
+    fMoving  ->MoveResize(10,  20+25+20,  70, 20);
+    fTracking->MoveResize(10,  20+25+40,  70, 20);
+    fStopping->MoveResize(10,  20+25+60,  70, 20);
+    fStopped ->MoveResize(10,  20+25+80,  70, 20);
+
+    fAvailTcp    ->MoveResize( 10, 80+20+102, 75, 20);
+
+    fDkcEmergency->MoveResize( 10, 80+20+124, 75, 20);
+    fDkcPcMode   ->MoveResize( 89, 80+20+124, 75, 20);
+    fDkcPower    ->MoveResize(168, 80+20+124, 75, 20);
+    fDkcBrake    ->MoveResize(247, 80+20+124, 75, 20);
+
+    fDkcReady1->MoveResize( 10,    248+2, 16, 16);
+    fDkcReady2->MoveResize( 10,    268+0, 16, 16);
+    fDkcRF1   ->MoveResize( 10+18, 248+2, 18, 16);
+    fDkcRF2   ->MoveResize( 10+18, 268+0, 18, 16);
+
+    fMsgAz->MoveResize(10+38, 248+2, 310-34, 16); // x-95
+    fMsgZd->MoveResize(10+38, 268+0, 310-34, 16); // x-95
+
+    fMsgAz->SetTextJustify(kTextLeft);
+    fMsgZd->SetTextJustify(kTextLeft);
 
     fList->Add(fArmed);
@@ -298,10 +301,19 @@
     fList->Add(fStopping);
     fList->Add(fStopped);
-    fList->Add(fAvailMac1);
-    fList->Add(fAvailMac2);
-    //fList->Add(fAvailMac3);
-    fList->Add(fAvailSe1);
-    fList->Add(fAvailSe2);
-    fList->Add(fAvailSe3);
+    //fList->Add(fAvailDkc1);
+    //fList->Add(fAvailDkc2);
+    fList->Add(fAvailTcp);
+
+    fList->Add(fDkcReady1   );
+    fList->Add(fDkcReady2   );
+    fList->Add(fDkcEmergency);
+    fList->Add(fDkcPcMode   );
+    fList->Add(fDkcRF1      );
+    fList->Add(fDkcRF2      );
+    fList->Add(fDkcBrake    );
+    fList->Add(fDkcPower    );
+
+    fList->Add(fMsgZd);
+    fList->Add(fMsgAz);
 }
 
@@ -716,6 +728,6 @@
 }
 
-MGCosy::MGCosy(MObservatory::LocationName_t key, MsgQueue *q, const TGWindow *p, UInt_t w, UInt_t h)
-    : TGMainFrame(p, w, h), fObservatory(key), fQueue(q)
+MGCosy::MGCosy(MObservatory::LocationName_t key, MsgQueue *q)
+    : TGMainFrame(gClient->GetRoot(), 1, 1), fObservatory(key), fQueue(q)
 {
     // This means that all objects added with AddFrame are deleted
@@ -806,9 +818,10 @@
     CreateLabel(frame);
 
+    
     //
     //   Map the window, set up the layout, etc.
     //
     const Int_t ww = 1010;
-    const Int_t hh =  700;
+    const Int_t hh =  680;
     SetWMSizeHints(ww, hh, ww, hh, 1, 1);  // set the smallest and biggest size of the Main frame
 
@@ -1038,6 +1051,6 @@
 }
 
-void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, /*ZdAz off,*/ RaDec radec,
-                    ZdAz soll, UInt_t stat, UInt_t stat2, Bool_t armed)
+void MGCosy::Update(ZdAz pos, ZdAz acc, /*ZdAz vel, ZdAz off,*/ RaDec radec,
+                    ZdAz soll, UInt_t stat, UInt_t pdo3, UInt_t stat2, Bool_t armed, const TString &statzd, const TString &stataz)
 {
     // acc [rad]
@@ -1060,12 +1073,23 @@
     EnableLabel(fAzSoll,   stat&MDriveCom::kMoving);
 
-    SetLabelColor(fAvailMac1, stat2&0x01);
-    SetLabelColor(fAvailMac2, stat2&0x02);
-    //SetLabelColor(fAvailMac3, stat2&0x04);
-    SetLabelColor(fAvailSe1,  stat2&0x08);
-    SetLabelColor(fAvailSe2,  stat2&0x10);
-    SetLabelColor(fAvailSe3,  stat2&0x20);
-
-    EnableLabel(fArmed, armed);//stat2&0x40);
+    SetLabelColor(fAvailTcp, stat2);
+
+    if (!stat2)
+        pdo3 = 0;
+
+    SetLabelColor(fDkcReady1,       pdo3&0x0001);
+    SetLabelColor(fDkcReady2,       pdo3&0x0100);
+    SetLabelColor(fDkcEmergency,   (pdo3&0x0404)==0x0404);
+    SetLabelColor(fDkcPcMode,      (pdo3&0x1010)!=0x1010 && pdo3);
+    SetLabelColor(fDkcRF1,          pdo3&0x0020);
+    SetLabelColor(fDkcRF2,          pdo3&0x2000);
+    SetLabelColor(fDkcBrake,       (pdo3&0x4040)==0x4040);
+    SetLabelColor(fDkcPower,       (pdo3&0x8080)==0x8080);
+
+    EnableLabel(fArmed, armed);
+
+    fMsgZd->SetText(new TGString(TString(" Zd: ")+statzd));
+    fMsgAz->SetText(new TGString(TString(" Az: ")+stataz));
+
 
     if (stat&MDriveCom::kTracking)
Index: trunk/MagicSoft/Cosy/gui/MGCosy.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCosy.h	(revision 8998)
+++ trunk/MagicSoft/Cosy/gui/MGCosy.h	(revision 9132)
@@ -49,5 +49,5 @@
     TGLabel       *fLabel1;
     TGLabel       *fLabel2;
-    TGLabel       *fLabel3;
+    // TGLabel       *fLabel3;
 
     // TGLabel       *fOffsetZd;
@@ -62,4 +62,7 @@
     TGLabel       *fZdSoll;
     TGLabel       *fAzSoll;
+
+    TGLabel       *fMsgZd;
+    TGLabel       *fMsgAz;
 
     TGLabel       *fUtc;
@@ -77,5 +80,4 @@
     MGSkyPosition  *fSkyPosition;
     MGAccuracy     *fAccuracy;
-    //MGAccuracyTime *fAccuracyTime;
     MGVelocity     *fVelocity;
     MGVelocity     *fOffset;
@@ -93,10 +95,16 @@
     TGLabel *fStopping;
     TGLabel *fStopped;
-    TGLabel *fAvailMac1;
-    TGLabel *fAvailMac2;
-    TGLabel *fAvailMac3;
-    TGLabel *fAvailSe1;
-    TGLabel *fAvailSe2;
-    TGLabel *fAvailSe3;
+    //TGLabel *fAvailDkc1;
+    //TGLabel *fAvailDkc2;
+    TGLabel *fAvailTcp;
+
+    TGLabel *fDkcReady1;
+    TGLabel *fDkcReady2;
+    TGLabel *fDkcEmergency;
+    TGLabel *fDkcPcMode;
+    TGLabel *fDkcRF1;
+    TGLabel *fDkcRF2;
+    TGLabel *fDkcBrake;
+    TGLabel *fDkcPower;
 
     TGTextView *fLog;
@@ -125,5 +133,5 @@
 
 public:
-    MGCosy(MObservatory::LocationName_t key, MsgQueue *q, const TGWindow *p, UInt_t w, UInt_t h);
+    MGCosy(MObservatory::LocationName_t key, MsgQueue *q);
     ~MGCosy();
 
@@ -132,10 +140,10 @@
     TGLabel *GetLabel1() const { return fLabel1; }
     TGLabel *GetLabel2() const { return fLabel2; }
-    TGLabel *GetLabel3() const { return fLabel3; }
+    //TGLabel *GetLabel3() const { return fLabel3; }
 
     TGTextView *GetLog() const { return fLog; }
     MGImage    *GetImage()     { return fImage; }
 
-    void Update(ZdAz pos, ZdAz acc, ZdAz vel, /*ZdAz off,*/ RaDec radec, ZdAz soll, UInt_t stat, UInt_t stat2, Bool_t armed);
+    void Update(ZdAz pos, ZdAz acc, /*ZdAz vel, ZdAz off,*/ RaDec radec, ZdAz soll, UInt_t stat, UInt_t pdo3, UInt_t stat2, Bool_t armed, const TString &statzd, const TString &stataz);
     void UpdateWeather(const MCeCoCom &com);
 
Index: trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 8998)
+++ trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 9132)
@@ -74,5 +74,5 @@
     InitArc(fSaturn,  1001, kYellow/*17*/, 16);
 
-    for (int i=0; i<14; i++)
+    for (int i=0; i<15; i++)
     {
         fStars[i] = new TArc(0, 0, 1);
@@ -115,5 +115,5 @@
 }
 
-static const RaDec stars[14] =
+static const RaDec stars[15] =
 {
     // 32349   Sirius           -1.44 1.45    2.64      0.009   A0m
@@ -138,10 +138,12 @@
     (RaDec(MAstro::Hms2Rad(  5, 16,  0), MAstro::Dms2Rad( 46, 00,  0))),
     (RaDec(MAstro::Hms2Rad(  7, 39,  0), MAstro::Dms2Rad(  5, 14,  0))),
-    (RaDec(MAstro::Hms2Rad(  5, 55,  0), MAstro::Dms2Rad(  7, 24,  0)))
+    (RaDec(MAstro::Hms2Rad(  5, 55,  0), MAstro::Dms2Rad(  7, 24,  0))),
+    //         Polaris           2.02
+    (RaDec(MAstro::Hms2Rad(  2, 31, 49), MAstro::Dms2Rad( 89, 15, 51))),
 };
 
 void MGSkyPosition::UpdateStars()
 {
-    for (int i=0; i<14; i++)
+    for (int i=0; i<15; i++)
         SetDot(fStars[i], stars[i], 0);
 }
@@ -370,4 +372,6 @@
     fSlaStar->SetMjd(mjd);
 
+    UpdateStars();
+
     UpdatePlanet(kESun,     fSun);
     UpdatePlanet(kEMoon,    fMoon);
@@ -377,6 +381,4 @@
     UpdatePlanet(kESaturn,  fSaturn);
 
-    UpdateStars();
-
     RaDec radec = fSlaStar->CalcRaDecFast(pos*TMath::DegToRad());
     UpdatePosition(radec, pos.Zd(), pos.Az());
Index: trunk/MagicSoft/Cosy/gui/MGSkyPosition.h
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGSkyPosition.h	(revision 8998)
+++ trunk/MagicSoft/Cosy/gui/MGSkyPosition.h	(revision 9132)
@@ -35,5 +35,5 @@
     TArc       *fSaturn;
 
-    TArc       *fStars[14];
+    TArc       *fStars[15];
 
     TArc       *fSaturnRing;
