Index: trunk/MagicSoft/Cosy/Changelog
===================================================================
--- trunk/MagicSoft/Cosy/Changelog	(revision 8849)
+++ trunk/MagicSoft/Cosy/Changelog	(revision 8852)
@@ -1,3 +1,11 @@
                                                                   -*-*- END -*-*-
+
+ 2008/02/02 Thomas Bretz
+
+   * main/MCosy.cc, candrv/vmodican.cc, gui/MGCoordinates.cc,
+     gui/MGSkyPosition.cc:
+     - added stream modifiers
+
+
 
  2008/01/31 Thomas Bretz
Index: trunk/MagicSoft/Cosy/candrv/vmodican.cc
===================================================================
--- trunk/MagicSoft/Cosy/candrv/vmodican.cc	(revision 8849)
+++ trunk/MagicSoft/Cosy/candrv/vmodican.cc	(revision 8852)
@@ -41,4 +41,5 @@
 
 #include "MLog.h"
+#include "MLogManip.h"
 
 ClassImp(VmodIcan);
@@ -81,5 +82,5 @@
     while (!Send(&msg));
 
-    gLog << "- CAN Bus Termination set to " << (state?"on":"off") << endl;
+    gLog << inf2 << "- CAN Bus Termination set to " << (state?"on":"off") << endl;
 }
 
@@ -95,5 +96,5 @@
         return 0;
 
-    gLog << "- Starting Receiver Loop." << endl;
+    gLog << inf2 << "- Starting Receiver Loop." << endl;
 
     while (1)
@@ -313,5 +314,5 @@
     while (!Send(&msg));      /* transmitt to module */
 
-    gLog << "- Baudrate set to " << rate << "kbps" << endl;
+    gLog << inf2 << "- Baudrate set to " << rate << "kbps" << endl;
 }
 
@@ -342,5 +343,5 @@
     while (!Send(&msg));
 
-    gLog << "- Controller connected to bus" << endl;
+    gLog << inf2 << "- Controller connected to bus" << endl;
 }
 
@@ -387,5 +388,5 @@
         return -1;
 
-    gLog << "- Fast Host Interface Enabled" << endl;
+    gLog << inf2 << "- Fast Host Interface Enabled" << endl;
 
     return 0;
@@ -415,5 +416,5 @@
 void VmodIcan::DisableCanBusConnection()
 {
-    gLog << "- Disconnect VmodIcan module from Bus!" << endl;
+    gLog << inf2 << "- Disconnect VmodIcan module from Bus!" << endl;
 
     Message msg;                  /* buffer for module messages */
@@ -424,5 +425,5 @@
     while (!Send(&msg));
 
-    gLog << "- VmodIcan disconnected." << endl;
+    gLog << inf2 << "- VmodIcan disconnected." << endl;
 }
 
@@ -451,5 +452,5 @@
 void VmodIcan::Close()
 {
-    gLog << "- Closing device VmodIcan #" << (int)fd << endl;
+    gLog << inf2 << "- Closing device VmodIcan #" << (int)fd << endl;
 
     Message msg; /* disconnect message */
@@ -462,5 +463,5 @@
     close(fd);
 
-    gLog << "- Device closed." << endl;
+    gLog << inf2 << "- Device closed." << endl;
 }
 
@@ -479,5 +480,5 @@
     while (!Send(&msg));
 
-    gLog << "- Fifo enabled" << endl;
+    gLog << inf2 << "- Fifo enabled" << endl;
 
     return TRUE;
@@ -492,5 +493,5 @@
     const int rc = Ioctl(DPM_RESET, 0);
 
-    gLog << "- Reset done." << endl;
+    gLog << inf2 << "- Reset done." << endl;
 
     return rc;
@@ -516,10 +517,10 @@
     if (fd < 0)
     {
-        gLog << "Error: Opening device '" << devname << "' (rc=" << fd << ")" << endl;
+        gLog << err << "Error: Opening device '" << devname << "' (rc=" << fd << ")" << endl;
         gLog << strerror(errno) << endl;
         return FALSE;
     }
 
-    gLog << "- Device " << devname << " #" << fd << " open." << endl;
+    gLog << inf << "- Device " << devname << " #" << fd << " open." << endl;
 
     return TRUE;
@@ -582,5 +583,5 @@
     Ioctl(DPM_INIT_NEW_HOSTIF_PRIO, &hdp);
 
-    gLog << "- New style host interface enabled" << endl;
+    gLog << inf2 << "- New style host interface enabled" << endl;
 
     return 0;
@@ -757,5 +758,5 @@
     while (!Send(&msg));
 
-    gLog << "- All CobIds disabled." << endl;
+    gLog << inf2 << "- All CobIds disabled." << endl;
 }
 
@@ -868,5 +869,5 @@
      */
 
-    gLog << "- VmodIcan initialized." << endl;
+    gLog << inf << "- VmodIcan initialized." << endl;
 
 }
@@ -879,8 +880,8 @@
 VmodIcan::~VmodIcan()
 {
-    gLog << "- Stopping VmodIcan module." << endl;
+    gLog << inf2 << "- Stopping VmodIcan module." << endl;
     CancelThread();
     DisableCanBusConnection();
     Close();
-    gLog << "- VmodIcan stopped." << endl;
-}
+    gLog << inf << "- VmodIcan stopped." << endl;
+}
Index: trunk/MagicSoft/Cosy/gui/MGCoordinates.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGCoordinates.cc	(revision 8849)
+++ trunk/MagicSoft/Cosy/gui/MGCoordinates.cc	(revision 8852)
@@ -7,7 +7,8 @@
 #include "MGCoordinates.h"
 
-#include <iostream>  // cout
+#include "MGCoordinate.h"
 
-#include "MGCoordinate.h"
+#include "MLog.h"
+#include "MLogManip.h"
 
 ClassImp(MGCoordinates);
@@ -41,5 +42,5 @@
     delete fX;
 
-    cout << "MGCoordinates destroyed." << endl;
+    gLog << inf2 << "MGCoordinates destroyed." << endl;
 }
 
Index: trunk/MagicSoft/Cosy/gui/MGImage.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGImage.cc	(revision 8849)
+++ trunk/MagicSoft/Cosy/gui/MGImage.cc	(revision 8852)
@@ -20,8 +20,9 @@
 #include "MGImage.h"
 
-#include <iostream>
-
 #include <TGX11.h>
 #include <TMutex.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
 
 ClassImp(MGImage);
@@ -49,5 +50,5 @@
     fImage  = (XImage*)gVirtualX->CreateImage(fWidth, fHeight);
 
-    cout << "Detected Color Depth: " << gVirtualX->GetDepth() << endl;
+    gLog << all << "Detected Color Depth: " << gVirtualX->GetDepth() << endl;
 }
 
@@ -57,12 +58,14 @@
         cout << "MGImage::~MGImage - mutex is already locked by this thread" << endl;
 
-    cout << "Deleting MGImage..." << endl;
+    gLog << inf2 << "Deleting MGImage..." << endl;
 
     gVirtualX->DeleteGC(fDefGC);
     gVirtualX->DeleteImage((Drawable_t)fImage);
 
+    //cout << fMuxPixmap->UnLock() << endl;
+
     delete fMuxPixmap;
 
-    cout << "MGImage destroyed." << endl;
+    gLog << inf2 << "MGImage destroyed." << endl;
 }
 
@@ -87,5 +90,5 @@
     if (TestBit(kSyncMode))
         if (fMuxPixmap->UnLock()==13)
-            cout << "MGImage::DoRedraw - tried to unlock mutex locked by other thread." << endl;
+            gLog << warn << "MGImage::DoRedraw - tried to unlock mutex locked by other thread." << endl;
 }
 
Index: trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
===================================================================
--- trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 8849)
+++ trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 8852)
@@ -7,6 +7,4 @@
 #include "MGSkyPosition.h"
 
-#include <iostream>  // cout
-
 #include <TArc.h>
 #include <TLine.h>
@@ -14,4 +12,7 @@
 #include <TList.h>
 #include <TCanvas.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
 
 #include "MAstro.h"
@@ -249,5 +250,5 @@
     delete fSlaStar;
 
-    cout << "MGSkyPosition destroyed." << endl;
+    gLog << inf2 << "MGSkyPosition destroyed." << endl;
 }
 
Index: trunk/MagicSoft/Cosy/main/MCosy.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 8849)
+++ trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 8852)
@@ -214,5 +214,5 @@
 
     MTime t(-1);
-    gLog << t << " - MCosy::WaitForEndMovement aborted...";
+    gLog << inf << t << " - MCosy::WaitForEndMovement aborted...";
     if (Break())
         gLog << " Break signal...";
@@ -279,5 +279,5 @@
     if (d.Zd()<fMin.Zd())
     {
-        gLog << "ERROR: Requested Zenith Angle below negative endswitch." << endl;
+        gLog << err << "ERROR: Requested Zenith Angle below negative endswitch." << endl;
         return kFALSE;
     }
@@ -285,5 +285,5 @@
     if (d.Zd()>fMax.Zd())
     {
-        gLog << "ERROR: Requested Zenith Angle behind positive endswitch." << endl;
+        gLog << err << "ERROR: Requested Zenith Angle behind positive endswitch." << endl;
         return kFALSE;
     }
@@ -291,5 +291,5 @@
     if (d.Az()<fMin.Az())
     {
-        gLog << "ERROR: Requested Azimuth Angle below negative endswitch." << endl;
+        gLog << err << "ERROR: Requested Azimuth Angle below negative endswitch." << endl;
         return kFALSE;
     }
@@ -297,5 +297,5 @@
     if (d.Az()>fMax.Az())
     {
-        gLog << "ERROR: Requested Azimuth Angle behind positive endswitch." << endl;
+        gLog << err << "ERROR: Requested Azimuth Angle behind positive endswitch." << endl;
         return kFALSE;
     }
@@ -497,5 +497,5 @@
     // set deceleration to 50%
     //
-    cout << "Stopping movement (dec=30%)..." << endl;
+    gLog << inf2 << "Stopping movement (dec=30%)..." << endl;
     if (fMac1 && fMac2)
     {
@@ -575,5 +575,5 @@
     {
     case WM_WAIT:
-        cout << "Wait for execution of Proc(WM_*, ): done." << endl;
+        gLog << inf2 << "Wait for execution of Proc(WM_*, ): done." << endl;
         return 0;
 
@@ -913,5 +913,5 @@
         if (!CheckNetwork())
         {
-            gLog << "ERROR: Cannot shutdown CANbus network." << endl;
+            gLog << err << "ERROR: Cannot shutdown CANbus network." << endl;
             return 0xebb0;
         }
@@ -932,9 +932,9 @@
 void MCosy::ReadConfig()
 {
-    cout << "Reading configuration file..." << flush;
+    gLog << inf2 << "Reading configuration file..." << flush;
     TEnv env(".cosyrc");
-    cout << "done." << endl;
-
-    cout << "Reading telescope range..." << flush;
+    gLog << "done." << endl;
+
+    gLog << inf2 << "Reading telescope range..." << flush;
     const Double_t amin = env.GetValue("Az_Min[deg]", -95.0);
     const Double_t zmin = env.GetValue("Zd_Min[deg]", -75.0);
@@ -944,16 +944,16 @@
     const Double_t zmax = env.GetValue("Zd_Max[deg]", 98.25);
     fMax.Set(zmax, amax);
-    cout << "done." << endl;
-
-    cout << " * Min:  " << zmin << "deg  " << amin << "deg" << endl;
-    cout << " * Max:  " << zmax << "deg  " << amax << "deg" << endl;
+    gLog << "done." << endl;
+
+    gLog << all << " * Min:  " << zmin << "deg  " << amin << "deg" << endl;
+    gLog << all << " * Max:  " << zmax << "deg  " << amax << "deg" << endl;
 
     fMin = fBending.AddOffsets(fMin/TMath::RadToDeg());
     fMax = fBending.AddOffsets(fMax/TMath::RadToDeg());
 
-    cout << " * Min': " << fMin.Zd()*TMath::RadToDeg() << "deg  " << fMin.Az()*TMath::RadToDeg() << "deg" << endl;
-    cout << " * Max': " << fMax.Zd()*TMath::RadToDeg() << "deg  " << fMax.Az()*TMath::RadToDeg() << "deg" << endl;
-
-    cout << "Reading gear ratios..." << flush;
+    gLog << all << " * Min': " << fMin.Zd()*TMath::RadToDeg() << "deg  " << fMin.Az()*TMath::RadToDeg() << "deg" << endl;
+    gLog << all << " * Max': " << fMax.Zd()*TMath::RadToDeg() << "deg  " << fMax.Az()*TMath::RadToDeg() << "deg" << endl;
+
+    gLog << inf2 << "Reading gear ratios..." << flush;
 //    kGear.X(env.GetValue("Zd_GearRatio[U_mot/U_tel]", 1000.0));
 //    kGear.Y(env.GetValue("Az_GearRatio[U_mot/U_tel]", 1000.0));
@@ -1019,10 +1019,11 @@
 //    kGearTot = kResRE*kGear;
 
-    cout << "done." << endl;
-
-    cout << " * Setting Gear Ratios:" << endl;
-    cout << "   --------------------" << endl;
-    cout << " *  X: " << kGear.X() << "*" << kResRE.X()/4 << "/" << kResSE.X() << "=4*" << kGearTot.X() << "/" << kResSE.X() << endl;
-    cout << " *  Y: " << kGear.Y() << "*" << kResRE.Y()/4 << "/" << kResSE.Y() << "=4*" << kGearTot.Y() << "/" << kResSE.Y() << endl;
+    gLog << "done." << endl;
+
+    gLog << all;
+    gLog << " * Setting Gear Ratios:" << endl;
+    gLog << "   --------------------" << endl;
+    gLog << " *  X: " << kGear.X() << "*" << kResRE.X()/4 << "/" << kResSE.X() << "=4*" << kGearTot.X() << "/" << kResSE.X() << endl;
+    gLog << " *  Y: " << kGear.Y() << "*" << kResRE.Y()/4 << "/" << kResSE.Y() << "=4*" << kGearTot.Y() << "/" << kResSE.Y() << endl;
 }
 /*
@@ -1050,5 +1051,5 @@
     if (fHist)
     {
-        gLog << "You are much too fast... try again." << endl;
+        gLog << err << "You are much too fast... try again." << endl;
         return;
     }
@@ -1063,5 +1064,5 @@
     int cnt = 0;
 
-    gLog << "Starting Shaftencoder Test..." << endl;
+    gLog << inf2 << "Starting Shaftencoder Test..." << endl;
 
     while (fBackground==kBgdSeTest)
@@ -1102,5 +1103,5 @@
     }
 
-    gLog << "Shaftencoder Test Stopped... displaying Histogram." << endl;
+    gLog << inf2 << "Shaftencoder Test Stopped... displaying Histogram." << endl;
 
     fBackground=kBgdSeTestDispl;
@@ -1114,5 +1115,5 @@
     if (fHist)
     {
-        gLog << "You are much too fast... try again." << endl;
+        gLog << err << "You are much too fast... try again." << endl;
         return;
     }
@@ -1127,5 +1128,5 @@
     fHist->SetZTitle("Re/Se");
 
-    gLog << "Starting Gear determination..." << endl;
+    gLog << inf2 << "Starting Gear determination..." << endl;
 
     ZdAz se0 = GetSePos();
@@ -1173,5 +1174,5 @@
         }
     }
-    gLog << "Gear Test Stopped... displaying Histogram." << endl;
+    gLog << inf2 << "Gear Test Stopped... displaying Histogram." << endl;
 
     fBackground=kBgdGearDispl;
@@ -1249,9 +1250,9 @@
     const Int_t rc = fMutexGui.TryLock();
     if (rc==13)
-        cout << "MCosy::HandleTimer - mutex is already locked by this thread" << endl;
+        gLog << warn << "MCosy::HandleTimer - mutex is already locked by this thread" << endl;
 
     if (rc)
     {
-        gLog << "* GUI update skipped due to locked mutex." << endl;
+        gLog << warn << "* GUI update skipped due to locked mutex." << endl;
         return kTRUE;
     }
@@ -1303,5 +1304,5 @@
 
     if (fMutexGui.UnLock()==13)
-        cout << "MCosy::HandleTimer - tried to unlock mutex locked by other thread." << endl;
+        gLog << warn << "MCosy::HandleTimer - tried to unlock mutex locked by other thread." << endl;
 
     return kTRUE;
@@ -1310,5 +1311,5 @@
 void MCosy::DisplayHistTestSe(Bool_t del)
 {
-    gLog << "Displaying histogram..." << endl;
+    gLog << inf2 << "Displaying histogram..." << endl;
 
     TH2F &hist = *(TH2F*)fHist;
@@ -1348,5 +1349,5 @@
 void MCosy::DisplayHistGear(Bool_t del)
 {
-    gLog << "Displaying histogram..." << endl;
+    gLog << inf2 << "Displaying histogram..." << endl;
 
     TH3F &hist = *(TH3F*)fHist;
@@ -1442,8 +1443,8 @@
     ReadConfig();
 
-    gLog << "- Starting TX Thread." << endl;
+    gLog << inf << "- Starting TX Thread." << endl;
     fTTalk = new MTTalk(this);
 
-    gLog << "- Starting GUI update." << endl;
+    gLog << inf << "- Starting GUI update." << endl;
     fUpdateGui->TurnOn();
 }
@@ -1486,5 +1487,5 @@
     // Create Nodes
     //
-    gLog << "- Setting up network." << endl;
+    gLog << inf << "- Setting up network." << endl;
 
     fMac1=new Macs(id1, "Mac/Az");
@@ -1505,5 +1506,5 @@
     fZd2->SetMotor(fMac2);
  
-    gLog << "- Connecting devices to network." << endl;
+    gLog << inf << "- Connecting devices to network." << endl;
 
     //
@@ -1521,8 +1522,8 @@
     // Create Gui Event timer and Gui
     //
-    gLog << "- Initializing GUI Timer." << endl;
+    gLog << inf << "- Initializing GUI Timer." << endl;
     fUpdateGui = new TTimer(this, 100); // 100ms
 
-    gLog << "- Starting GUI." << endl;
+    gLog << all << "- Starting GUI." << endl;
     fWin=new MGCosy(fObservatory, this, gClient->GetRoot(), 1, 1);
 }
@@ -1624,5 +1625,5 @@
 
     TString name = GetFileName("rep", "cosy", "rep");
-    cout << "Open Repfile: " << name << endl;
+    gLog << inf << "Open Repfile: " << name << endl;
     fOutRep = new MLog(name, kTRUE);
     *fOutRep << "[Drive Report File]" << endl;
@@ -1662,5 +1663,5 @@
 void MCosy::TerminateApp()
 {
-    cout << "MCosy::TerminateApp()" << endl;
+    gLog << inf2 << "MCosy::TerminateApp()" << endl;
 /*
     Int_t rc;
@@ -1682,5 +1683,5 @@
 MCosy::~MCosy()
 {
-    cout << "Deleting GUI timer." << endl;
+    gLog << inf2 << "Deleting GUI timer." << endl;
     // FIXME: Wait until last Update was finished!!!
     delete fUpdateGui;
@@ -1689,5 +1690,5 @@
 
     // Now the files can safely be closed
-    cout << "Closing output files." << endl;
+    gLog << inf2 << "Closing output files." << endl;
     if (fOutTp)
     {
@@ -1697,8 +1698,8 @@
     delete fOutRep;
 
-    cout << "Deleting CC communication." << endl;
+    gLog << inf2 << "Deleting CC communication." << endl;
     delete fCom;
 
-    cout << "Deleting Nodes." << endl;
+    gLog << inf2 << "Deleting Nodes." << endl;
     fZd1->SetReport(0);
     fZd2->SetReport(0);
@@ -1713,5 +1714,5 @@
         delete fMac3;
 
-    cout << "Deleting MGCosy." << endl;
+    gLog << inf2 << "Deleting MGCosy." << endl;
 
     gLog.DisableOutputDevice(MLog::eGui);
@@ -1719,4 +1720,4 @@
     delete fWin;
 
-    cout << "MGCosy destructed." << endl;
-}
+    gLog << inf2 << "MGCosy destructed." << endl;
+}
