Index: trunk/MagicSoft/Mars/mmain/MEventDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MEventDisplay.cc	(revision 8617)
+++ trunk/MagicSoft/Mars/mmain/MEventDisplay.cc	(revision 8632)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.61 2007-06-28 19:49:30 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.62 2007-07-03 14:18:03 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -120,5 +120,5 @@
 //  Constructor.
 //
-MEventDisplay::MEventDisplay(const char *fname, const char *path) : MStatusDisplay(), fEvtLoop(0)
+MEventDisplay::MEventDisplay(const char *fname, const char *path) : MStatusDisplay(756), fEvtLoop(0)
 {
     //
@@ -517,13 +517,30 @@
     fList->Add(laystd2);
     frame->AddFrame(top2, laystd2);
-
-    //
-    // Add trailing line...
-    //
-    TGHorizontal3DLine *line = new TGHorizontal3DLine(frame);
-    TGLayoutHints *layline = new TGLayoutHints(kLHintsExpandX);
-    fList->Add(line);
-    fList->Add(layline);
-    frame->AddFrame(line, layline);
+}
+
+void MEventDisplay::AddMiddleFrame(TGCompositeFrame *frame)
+{
+    //
+    // Create the gui elements
+    //
+    TGCheckButton *imgpar = new TGCheckButton(frame, "ImgPar", kShowImgPar);
+    imgpar->SetState(kButtonDown);
+    imgpar->Associate(this);
+    fList->Add(imgpar);
+
+    TGCheckButton *muon = new TGCheckButton(frame, "Muon", kShowMuon);
+    muon->Associate(this);
+    muon->SetState(kButtonDown);
+    fList->Add(muon);
+
+    //
+    // add the gui elements to the frame
+    //
+//    TGLayoutHints *laystd = new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 5, 5);
+//    fList->Add(laystd);
+//    top2->AddFrame(prevevt,    laystd);
+
+    frame->AddFrame(imgpar);
+    frame->AddFrame(muon);
 }
 
@@ -538,7 +555,28 @@
     TGCompositeFrame *vf1 = new TGVerticalFrame(fUserFrame, 1, 1);
     TGCompositeFrame *vf2 = new TGVerticalFrame(fUserFrame, 1, 1);
-
-    AddTopFramePart1(vf1, filename, "Events");
-    AddTopFramePart2(vf1);
+    TGCompositeFrame *hor = new TGHorizontalFrame(vf1, 1, 1);
+    TGCompositeFrame *ver = new TGVerticalFrame(hor, 1, 1);
+    TGCompositeFrame *vfb = new TGVerticalFrame(hor, 1, 1);
+
+    TGHorizontal3DLine *line = new TGHorizontal3DLine(vf1);
+    TGLayoutHints *expx = new TGLayoutHints(kLHintsExpandX);
+    TGLayoutHints *right = new TGLayoutHints(kLHintsRight|kLHintsTop);
+    fList->Add(line);
+    fList->Add(expx);
+    fList->Add(right);
+
+    hor->AddFrame(ver);
+    hor->AddFrame(vfb, right);
+
+    AddMiddleFrame(vfb);
+
+    //
+    // Add trailing line...
+    //
+    vf1->AddFrame(hor,  expx);
+    vf1->AddFrame(line, expx);
+
+    AddTopFramePart1(ver, filename, "Events");
+    AddTopFramePart2(ver);
 
     // create root embedded canvas and add it to the tab
@@ -555,6 +593,5 @@
     //fCanvas->SetFillColor(16);
 
-    TGLayoutHints *lay = new TGLayoutHints(kLHintsExpandX);
-    fUserFrame->AddFrame(vf1, lay);
+    fUserFrame->AddFrame(vf1, expx);
     fUserFrame->AddFrame(vf2);
 }
@@ -635,4 +672,59 @@
 }
 
+void MEventDisplay::ShowHide()
+{
+    TGCheckButton *but1 = (TGCheckButton*)fList->FindWidget(kShowMuon);
+    TGCheckButton *but2 = (TGCheckButton*)fList->FindWidget(kShowImgPar);
+
+    const Bool_t imgpar = but1 && but1->IsDown();
+    const Bool_t muon   = but2 && but2->IsDown();
+
+    //
+    // Get parlist
+    //
+    MParList *plist = fEvtLoop->GetParList();
+    if (!plist)
+        return;
+
+    //
+    // Draw ellipse on top of all pads
+    //
+    const Int_t n = 5;
+
+    TObject *obj[n] = {
+        plist->FindObject("MHillas"),
+        plist->FindObject("MHillasSrc"),
+        plist->FindObject("MHillasExt"),
+        plist->FindObject("MSrcPosCam"),
+        plist->FindObject("MMuonSearchPar")
+    };
+
+    const Bool_t state[n] = {
+        imgpar,
+        imgpar,
+        imgpar,
+        imgpar,
+        muon,
+    };
+
+
+    for (int i=1; i<7; i++)
+    {
+        TCanvas *c = GetCanvas(i);
+        c->GetPad(1)->cd(1);
+
+        TList *list = gPad->GetListOfPrimitives();
+
+        for (int j=0;j<n; j++)
+            if (obj[j])
+                if (state[j] && !list->FindObject(obj[j]))
+                    list->Add(obj[j]);
+                else
+                    list->Remove(obj[j]);
+
+        gPad->Modified(kTRUE);
+    }
+}
+
 // --------------------------------------------------------------------------
 //
@@ -648,9 +740,4 @@
 
     //
-    // Get parlist
-    //
-    MParList *plist = (MParList*)fEvtLoop->GetParList();
-
-    //
     // Add Geometry tab
     //
@@ -668,20 +755,5 @@
     fNumOfEvts->SetText(txt);
 
-    //
-    // Draw ellipse on top of all pads
-    //
-    TObject *hillas1 = plist->FindObject("MHillas");
-    TObject *hillas2 = plist->FindObject("MHillasSrc");
-    TObject *hillas3 = plist->FindObject("MHillasExt");
-    TObject *hmuon   = plist->FindObject("MMuonSearchPar");
-    for (int i=1; i<7;i++)
-    {
-        TCanvas *c = GetCanvas(i);
-        c->GetPad(1)->cd(1);
-        hmuon->Draw();
-        hillas1->Draw();
-        hillas2->Draw();
-        hillas3->Draw();
-    }
+    ShowHide();
 }
 
@@ -777,4 +849,14 @@
             }
             return kTRUE;
+
+        case kCM_CHECKBUTTON:
+            switch (mp1)
+            {
+            case kShowMuon:
+            case kShowImgPar:
+                ShowHide();
+                return kTRUE;
+            }
+            return kTRUE;
         }
         break;
Index: trunk/MagicSoft/Mars/mmain/MEventDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MEventDisplay.h	(revision 8617)
+++ trunk/MagicSoft/Mars/mmain/MEventDisplay.h	(revision 8632)
@@ -21,5 +21,7 @@
         kEvtPrev = MStatusDisplay::kSearch + 1,
         kEvtNext,
-        kEvtNumber
+        kEvtNumber,
+        kShowMuon,
+        kShowImgPar
     };
 
@@ -34,6 +36,8 @@
                           const char *filename, const char *treename);
     void AddTopFramePart2(TGCompositeFrame *frame);
+    void AddMiddleFrame(TGCompositeFrame *frame);
     void AddGeometryTabs();
     void AddUserFrame(const char *filename);
+    void ShowHide();
 
     void UpdateDisplay();
