Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 7263)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 7264)
@@ -24,4 +24,11 @@
      - fixed abug which caused problems if now source position was
        defined in the dataset.
+
+   * mastro/MAstroCatalog.[h,cc]:
+     - added new base class TAttMarker
+     - added new data mebers MAttLine for the two line types
+     - some simplification to the atoi/atof stuff
+     - added new helper class MAttLine
+     - increased class version to 2
 
 
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 7263)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 7264)
@@ -16,4 +16,7 @@
 
    - general: MHillas - the case of CorrXY==0 is now handled properly
+
+   - general: implemnetd the possibility to change the line and
+     marker style of a sky-grid drawn by MAstroCatalog
 
    - general: Runs in sequences and datasets are now automatically 
Index: /trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc
===================================================================
--- /trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc	(revision 7263)
+++ /trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc	(revision 7264)
@@ -17,7 +17,6 @@
 !
 !   Author(s): Thomas Bretz, 03/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
-!   Author(s): Robert Wagner, 08/2004 <mailto:rwagner@mppmu.mpg.de>
 !
-!   Copyright: MAGIC Software Development, 2002-2004
+!   Copyright: MAGIC Software Development, 2002-2005
 !
 !
@@ -121,4 +120,9 @@
 //     http://heasarc.gsfc.nasa.gov/W3Browse/star-catalog/
 //
+//  Class Version 2:
+//    + MAttLine fAttLineSky;    // Line Style and color for sky coordinates
+//    + MAttLine fAttLineLocal;  // Line Style and color for local coordinates
+//    + added new base class TAttMarker
+//
 //////////////////////////////////////////////////////////////////////////////
 #include "MAstroCatalog.h"
@@ -154,4 +158,5 @@
 #endif
 
+ClassImp(MAttLine);
 ClassImp(MAstroCatalog);
 
@@ -170,4 +175,13 @@
 
     fToolTip = gROOT->IsBatch() || !gClient ? 0 : new TGToolTip(0, "", 0);
+
+    fAttLineSky.SetLineStyle(kDashDotted);
+    fAttLineLocal.SetLineStyle(kDashDotted);
+
+    fAttLineSky.SetLineColor(kRed);
+    fAttLineLocal.SetLineColor(kBlue);
+
+    SetMarkerColor(kBlack);
+    SetMarkerStyle(kCircle);
 }
 
@@ -221,27 +235,9 @@
 // --------------------------------------------------------------------------
 //
-// return int correspoding to TSubString
-//
-Int_t MAstroCatalog::atoi(const TSubString &sub)
-{
-    return atoi(TString(sub));
-}
-
-// --------------------------------------------------------------------------
-//
-// return float correspoding to TSubString
-//
-Float_t MAstroCatalog::atof(const TSubString &sub)
-{
-    return atof(TString(sub));
-}
-
-// --------------------------------------------------------------------------
-//
 // return int correspoding to TString
 //
 Int_t MAstroCatalog::atoi(const TString &s)
 {
-    return std::atoi(s);
+    return const_cast<TString&>(s).Atoi();
 }
 
@@ -252,5 +248,5 @@
 Float_t MAstroCatalog::atof(const TString &s)
 {
-    return std::atof(s);
+    return const_cast<TString&>(s).Atof();
 }
 
@@ -678,5 +674,5 @@
 {
     if (gPad)
-        SetRangePad(o);
+        SetRangePad(o);
 
     if (TestBit(kHasChanged))
@@ -748,13 +744,11 @@
 
     // draw star on the camera display
-    TMarker *tip=new TMarker(x, y, col<0 ? kDot : kFullDotMedium);;
-    tip->SetMarkerColor(col);
+    TMarker *tip=new TMarker(x, y, kDot);
+    TAttMarker::Copy(*tip);
+
     fMapG.Add(tip, new TString(str));
 
-    if (!resize)
-        return;
-
-    tip->SetMarkerSize((10 - (mag>1 ? mag : 1))/15);
-    tip->SetMarkerStyle(kCircle);
+    if (resize)
+        tip->SetMarkerSize((10 - (mag>1 ? mag : 1))/15);
 }
 
@@ -870,6 +864,8 @@
 
     TLine *line = new TLine(v0.X(), v0.Y(), v1.X(), v1.Y());
-    line->SetLineStyle(kDashDotted); //kDashed, kDotted, kDashDotted
-    line->SetLineColor(kWhite+type*2);
+    if (type==1)
+        dynamic_cast<TAttLine&>(fAttLineSky).Copy(dynamic_cast<TAttLine&>(*line));
+    else
+        dynamic_cast<TAttLine&>(fAttLineLocal).Copy(dynamic_cast<TAttLine&>(*line));
     fMapG.Add(line);
 
@@ -1152,4 +1148,7 @@
     const Bool_t yellow = o.Contains("yellow",  TString::kIgnoreCase) && !white;
 
+    if (white)
+        SetMarkerColor(kWhite);
+
     // X is vice versa, because ra is defined anti-clockwise
     mirx || mirror ? ResetBit(kMirrorX) : SetBit(kMirrorX);
@@ -1208,10 +1207,41 @@
 // --------------------------------------------------------------------------
 //
-// First delete all gui elements.
-// Set the correct range of the pad.
-// Create all gui primitives
-// If "this" is not in the current pad add it to the current pad.
-// Reset vit kHasChanged
-//
+// Bends some pointers into the right direction...
+// Calls TAttLine::SetLineAttributes and connects some signals
+// to the gui to recreate the gui elements if something has changed.
+//
+void MAstroCatalog::SetLineAttributes(MAttLine &att)
+{
+    if (!gPad)
+        return;
+
+    gPad->SetSelected(&att);
+    gROOT->SetSelectedPrimitive(&att);
+
+    att.SetLineAttributes();
+
+    TQObject::Connect("TGColorSelect", "ColorSelected(Pixel_t)", "MAstroCatalog", this, "ForceUpdate()");
+    TQObject::Connect("TGListBox",     "Selected(Int_t)",        "MAstroCatalog", this, "ForceUpdate()");
+}
+
+// --------------------------------------------------------------------------
+//
+// Calls TAttMarker::SetMarkerAttributes and connects some signals
+// to the gui to recreate the gui elements if something has changed.
+//
+void MAstroCatalog::SetMarkerAttributes()
+{
+    if (!gPad)
+        return;
+
+    TAttMarker::SetMarkerAttributes();
+
+    // Make sure that if something is changed the gui elements
+    // are recreated
+    TQObject::Connect("TGedMarkerSelect", "MarkerSelected(Style_t)", "MAstroCatalog", this, "ForceUpdate()");
+    TQObject::Connect("TGColorSelect",    "ColorSelected(Pixel_t)",  "MAstroCatalog", this, "ForceUpdate()");
+    TQObject::Connect("TGListBox",        "Selected(Int_t)",         "MAstroCatalog", this, "ForceUpdate()");
+}
+
 void MAstroCatalog::DrawPrimitives(Option_t *o)
 {
Index: /trunk/MagicSoft/Mars/mastro/MAstroCatalog.h
===================================================================
--- /trunk/MagicSoft/Mars/mastro/MAstroCatalog.h	(revision 7263)
+++ /trunk/MagicSoft/Mars/mastro/MAstroCatalog.h	(revision 7264)
@@ -7,4 +7,10 @@
 #ifndef ROOT_TList
 #include <TList.h>
+#endif
+#ifndef ROOT_TAttLine
+#include <TAttLine.h>
+#endif
+#ifndef ROOT_TAttMarker
+#include <TAttMarker.h>
 #endif
 #ifndef MARS_MGMap
@@ -17,24 +23,33 @@
 class TGToolTip;
 
-class MAstroCatalog : public TObject
+class MAttLine : public TObject, public TAttLine
+{
+public:
+    MAttLine() { }
+    ClassDef(MAttLine, 1) // Helper class to have a TAttLine derving from TObject (for standalone GED editor)
+};
+
+class MAstroCatalog : public TObject, public TAttMarker
 {
 private:
-    Double_t   fLimMag;    // [1]   Limiting Magnitude
-    Double_t   fRadiusFOV; // [deg] Radius of Field of View
+    Double_t   fLimMag;     // [1]   Limiting Magnitude
+    Double_t   fRadiusFOV;  // [deg] Radius of Field of View
 
-    TGToolTip *fToolTip;   //! The tooltip currently displayed
+    TGToolTip *fToolTip;    //! The tooltip currently displayed
+
+    MAttLine fAttLineSky;   // Line Style and color for sky coordinates
+    MAttLine fAttLineLocal; // Line Style and color for local coordinates
 
     void ShowToolTip(Int_t px, Int_t py, const char *txt);
+    void SetLineAttributes(MAttLine &att);
 
     TString FindToken(TString &line, Char_t tok=',');
 
-    Int_t   atoi(const TSubString &sub);
-    Float_t atof(const TSubString &sub);
     Int_t   atoi(const TString &s);
     Float_t atof(const TString &s);
 
 //#if ROOT_VERSION_CODE < ROOT_VERSION(4,00,03)
-    Bool_t fPlainScreen;  //! Just a dummy!!!! ([Set,Is]Freezed)
-    Bool_t fNoToolTips;   //! Just a dummy!!!! ([Set,Is]Freezed)
+//    Bool_t fPlainScreen;  //! Just a dummy!!!! ([Set,Is]Freezed)
+//    Bool_t fNoToolTips;   //! Just a dummy!!!! ([Set,Is]Freezed)
 //#endif
 
@@ -84,4 +99,7 @@
     ~MAstroCatalog();
 
+    void ForceUpdate() { Update(kTRUE); } // Slot for marker handling
+
+    // Setter to control the sky position and behaviour
     void SetTime(const MTime &time);
     void SetObservatory(const MObservatory &obs);
@@ -109,32 +127,31 @@
     } // Set Radius of FOV using the pixsize [arcsec/pix], width and height [pixel] of image
 
-    void SetRaDec(Double_t ra, Double_t dec) { fRaDec.SetRaDec(ra, dec, 1); Update(); }
-    void SetRaDec(const TVector3 &v)         { fRaDec=v; Update(); }
-    void SetGuiActive(Bool_t b=kTRUE)        { b ? SetBit(kGuiActive) : ResetBit(kGuiActive); }
+    void     SetRaDec(Double_t ra, Double_t dec) { fRaDec.SetRaDec(ra, dec, 1); Update(); }
+    void     SetRaDec(const TVector3 &v)         { fRaDec=v; Update(); }
+    void     SetGuiActive(Bool_t b=kTRUE)        { b ? SetBit(kGuiActive) : ResetBit(kGuiActive); }
 
-    void   SetPlainScreen(Bool_t b=kTRUE)    { b ? SetBit(kPlainScreen) : ResetBit(kPlainScreen); Update(); } // *TOGGLE* *GETTER=IsPlainScreen
-    Bool_t IsPlainScreen() const             { return TestBit(kPlainScreen); }
+    void     SetPlainScreen(Bool_t b=kTRUE)    { b ? SetBit(kPlainScreen) : ResetBit(kPlainScreen); Update(); } // *TOGGLE* *GETTER=IsPlainScreen
+    Bool_t   IsPlainScreen() const             { return TestBit(kPlainScreen); }
 
-    void   SetNoToolTips(Bool_t b=kTRUE)     { b ? SetBit(kNoToolTips) : ResetBit(kNoToolTips); } // *TOGGLE* *GETTER=HasNoToolTips
-    Bool_t HasNoToolTips() const             { return TestBit(kNoToolTips); }
+    void     SetNoToolTips(Bool_t b=kTRUE)     { b ? SetBit(kNoToolTips) : ResetBit(kNoToolTips); } // *TOGGLE* *GETTER=HasNoToolTips
+    Bool_t   HasNoToolTips() const             { return TestBit(kNoToolTips); }
 
     Double_t GetLimMag() const { return fLimMag; } // Get Limiting Magnitude
     Double_t GetRadiusFOV() const { return fRadiusFOV; } // Get maximum radius of Field Of View
 
-    void Delete(Option_t *o="") { fList.Delete(); fMapG.Delete(); } // Delete list of stars
-
-    Int_t ReadXephem(TString catalog = "/usr/X11R6/lib/xephem/catalogs/YBS.edb");
-    Int_t ReadNGC2000(TString catalog = "ngc2000.dat");
-    Int_t ReadBSC(TString catalog = "bsc5.dat");
-    Int_t ReadHeasarcPPM(TString catalog = "heasarc_ppm.tdat", TString fout="");
-    Int_t ReadCompressed(TString catalog);
+    // Interface to set stars
+    Int_t  ReadXephem(TString catalog = "/usr/X11R6/lib/xephem/catalogs/YBS.edb");
+    Int_t  ReadNGC2000(TString catalog = "ngc2000.dat");
+    Int_t  ReadBSC(TString catalog = "bsc5.dat");
+    Int_t  ReadHeasarcPPM(TString catalog = "heasarc_ppm.tdat", TString fout="");
+    Int_t  ReadCompressed(TString catalog);
     Bool_t AddObject(Float_t ra, Float_t dec, Float_t mag, TString name="");
 
-    void Print(Option_t *o="") const { fList.Print(); } // Print all stars
-
+    // Interface to get stars
     TList *GetList() { return &fList; } // Return list of stars
 
-    //void PaintImg(Int_t id=0, Option_t *o="");
-    void PaintImg(unsigned char *buf, int w=768, int h=576, Option_t *o=0);
+    // TObject
+    void Delete(Option_t *o="") { fList.Delete(); fMapG.Delete(); } // Delete list of stars
+    void Print(Option_t *o="") const { fList.Print(); } // Print all stars
     void Draw(Option_t *o="");
     void SetDrawOption(Option_t *option="")
@@ -144,7 +161,15 @@
     } //*MENU*
 
+    // Interface to Cosy
+    void PaintImg(unsigned char *buf, int w=768, int h=576, Option_t *o=0);
+
+    // Interface to line styles
+    void SetLineAttributesLocal() { SetLineAttributes(fAttLineLocal); } //*MENU*
+    void SetLineAttributesSky()   { SetLineAttributes(fAttLineSky);   } //*MENU*
+    void SetMarkerAttributes();   //*MENU*
+
     virtual void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected=0);
 
-    ClassDef(MAstroCatalog, 1) // Display class for star catalogs
+    ClassDef(MAstroCatalog, 2) // Display class for star catalogs
 };
 
