Index: /trunk/MagicSoft/Mars/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/Makefile	(revision 1404)
+++ /trunk/MagicSoft/Mars/Makefile	(revision 1405)
@@ -38,4 +38,5 @@
           mmc         \
           mgui        \
+          mfileio     \
 	  manalysis   \
           mfileio     \
Index: /trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
===================================================================
--- /trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 1404)
+++ /trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 1405)
@@ -316,12 +316,14 @@
     }
 
+    //
+    // Setup the correct environment
+    //
     fDrawingPad->SetBorderMode(0);
     fDrawingPad->SetFillColor(22);
 
     //
-    // Append this object, so that the aspect ratio is maintained
-    // (Paint-function is called)
-    //
-    AppendPad(option);
+    // Set the initial coordinate range
+    //
+    Paint();
 
     //
@@ -384,4 +386,13 @@
     }
 
+    //
+    // Append this object, so that the aspect ratio is maintained
+    // (Paint-function is called)
+    // Add it here so that root will have it first in the internal list:
+    // This means, that root 'sees' the whole camera instead of all the
+    // single hexagons.
+    //
+    AppendPad(option);
+
     //fDrawingPad->SetEditable(kFALSE);
 }
@@ -403,5 +414,5 @@
         num += i;
 
-        const MHexagon &h = (MHexagon&)*(*fPixels)[i];
+        const MHexagon &h = (*this)[i];
         TText *nt = txt.DrawText(h.GetX(), h.GetY(), num);
         nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius());
@@ -545,2 +556,34 @@
     out << fDrawingPad->GetWw() << "," << fDrawingPad->GetWh() << ");" << endl;
 }
+
+// ------------------------------------------------------------------------
+//
+// compute the distance of a point (px,py) to the Camera
+// this functions needed for graphical primitives, that
+// means without this function you are not able to interact
+// with the graphical primitive with the mouse!!!
+//
+// All calcutations are running in pixel coordinates
+//
+Int_t MCamDisplay::DistancetoPrimitive(Int_t px, Int_t py)
+{
+    Int_t dist = 999999;
+
+    for (UInt_t i=0; i<fNumPixels; i++)
+    {
+        Int_t d = (*fPixels)[i]->DistancetoPrimitive(px, py);
+
+        if (d<dist)
+            dist=d;
+    }
+    return dist==0?0:999999;
+}
+
+// ------------------------------------------------------------------------
+//
+// Execute a mouse event on the camera
+//
+void MCamDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
+{
+    cout << "Execute Event Camera " << event << " @ " << px << " " << py << endl;
+}
Index: /trunk/MagicSoft/Mars/mgui/MHexagon.cc
===================================================================
--- /trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 1404)
+++ /trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 1405)
@@ -123,4 +123,7 @@
     const Double_t disthex = TMath::Sqrt((Double_t)((pxhex-px)*(pxhex-px) + (pyhex-py)*(pyhex-py)));
 
+    if (disthex==0)
+        return 0;
+
     const Double_t cosa = TMath::Abs(px-pxhex) / disthex;
     const Double_t sina = TMath::Abs(py-pyhex) / disthex;
@@ -280,2 +283,3 @@
     out << "   hexagon->Draw();" << endl;
 }
+
