Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2493)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2494)
@@ -70,12 +70,19 @@
      - show when updating postscript header
 
-   * mmain/MStatusDisplay.[h,cc]:
+   * mmain/MStatusDisplay.[h,cc], mmain/MSearch.[h,cc], mmain/MGMenu.[h,cc],
+     mmain/MSearch.[h,cc]:
      - moved to mbase
 
    * mmain/Makefile, mmain/MainLinkDef.h:
      - removed MStatusDisplay
+     - removed MSearch
+     - removed MGMenu
+     - removed MProgressBar
 
    * mbase/Makefile, mbase/MainLinkDef.h:
      - added MStatusDisplay
+     - added MSearch
+     - added MGMenu
+     - added MProgressBar
 
 
Index: trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 2493)
+++ trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 2494)
@@ -29,5 +29,8 @@
 
 #pragma link C++ class MEvtLoop+;
+
 #pragma link C++ class MStatusDisplay+;
+#pragma link C++ class MProgressBar+;
+#pragma link C++ class MSearch+;
 
 #pragma link C++ class MInputStreamID+;
Index: trunk/MagicSoft/Mars/mbase/MGMenu.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MGMenu.cc	(revision 2494)
+++ trunk/MagicSoft/Mars/mbase/MGMenu.cc	(revision 2494)
@@ -0,0 +1,226 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 4/2003 <mailto:tbretz@astro-uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2003
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MGMenu, MGPopupMenu
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MGMenu.h"
+
+
+MGMenuEntry::MGMenuEntry(TGMenuEntry *ent)
+{
+    memcpy(this, ent, sizeof(*ent));
+}
+
+// -------------------------------------------------------------
+//
+// Return the keycode corresponding to the hot string of
+// a TGmenuEntry
+//
+UInt_t MGPopupMenu::GetKeyCode(TGMenuEntry *el)
+{
+    TGHotString *str = MGMenuEntry(el).GetLabel();
+    return gVirtualX->KeysymToKeycode(str->GetHotChar());
+}
+
+// -------------------------------------------------------------
+//
+// Bind all hot keys used in this popup menu subsequentlt
+// to the TGMainFrame and send a HandleKey message to the
+// TGWindow
+//
+void MGPopupMenu::BindKeys(const TGWindow *w, TGMainFrame *frame)
+{
+    TIter Next(fEntryList);
+    TGMenuEntry *el;
+
+    //
+    // Loop Through all entries
+    //
+    while ((el=(TGMenuEntry*)Next()))
+    {
+        switch (el->GetType())
+        {
+            //
+            // For seperators and labels nothing to do
+            //
+        case kMenuSeparator:
+        case kMenuLabel:
+            continue;
+
+            //
+            // For an entry and a popup menu bind the hot key
+            // In case of a popup menu call BindKeys subsequently
+            //
+        case kMenuEntry:
+        case kMenuPopup:
+            frame->BindKey(w, GetKeyCode(el), kKeyMod1Mask);
+            if (el->GetType()==kMenuPopup)
+                MGMenuEntry(el).GetPopup()->BindKeys(w, frame);
+            continue;
+        }
+    }
+}
+
+/*
+ kMenuActiveMask  = BIT(0),
+ kMenuEnableMask  = BIT(1),
+ kMenuDefaultMask = BIT(2),
+ kMenuCheckedMask = BIT(3),
+ kMenuRadioMask   = BIT(4),
+ kMenuHideMask    = BIT(5)
+ */
+
+// -------------------------------------------------------------
+//
+//  Handle a keyboard event. Return kFALSE in case of a
+//  successfully send message, which means: close all open
+//  popups.
+//
+Bool_t MGPopupMenu::HandleKey(Event_t *evt)
+{
+    //
+    // Loop through all entries in this popup menu. If the entry is
+    // an open popup menu send the key event to the open popup.
+    //
+    TIter Next(fEntryList);
+    TGMenuEntry *el;
+    while ((el=(TGMenuEntry*)Next()))
+    {
+        if (el->GetType()==kMenuPopup && el->GetStatus()&kMenuActiveMask)
+            return MGMenuEntry(el).GetPopup()->HandleKey(evt);
+    }
+
+    Next.Reset();
+
+    //
+    // If no open popup is found search the pressed key in this
+    // popup menu.
+    //
+    while ((el=(TGMenuEntry*)Next()))
+    {
+        switch (el->GetType())
+        {
+            //
+            // Do nothing
+            //
+        case kMenuSeparator:
+        case kMenuLabel:
+            continue;
+
+            //
+            // If the keycode corresponds to the hot key
+            // of this entry and the entry is enabled activate the entry
+            // and send the corresponding message/
+            //
+        case kMenuEntry:
+            if (GetKeyCode(el)==evt->fCode && el->GetStatus()&kMenuEnableMask)
+            {
+                Activate(el);
+                SendMessage(fMsgWindow, MK_MSG(kC_COMMAND, kCM_MENU),
+                            el->GetEntryId(), (Long_t)MGMenuEntry(el).GetUserData());
+                return kFALSE;
+            }
+            continue;
+
+            //
+            // If the keycode corresponds to the hot key
+            // of this popup menu activate the popup menu.
+            //
+        case kMenuPopup:
+            if (GetKeyCode(el)!=evt->fCode)
+                continue;
+
+            Activate(el);
+            HandleTimer(NULL);
+            return kTRUE;
+        }
+    }
+    return kTRUE;
+}
+
+// -------------------------------------------------------------
+//
+// Bind the keys of all popups subsequently to the given main
+// frame. The menu bar hot keys are already bound by TGMenuBar.
+// Bind the Escape key to close the popups, too.
+//
+void MGMenuBar::BindKeys(TGMainFrame *frame)
+{
+    TGFrameElement *el=NULL;
+    TIter Next(fList);
+    while ((el = (TGFrameElement *)Next()))
+        ((MGPopupMenu*)((TGMenuTitle *) el->fFrame)->GetMenu())->BindKeys(this, frame);
+
+    frame->BindKey(this, 9/*ESC*/, 0);
+}
+
+// -------------------------------------------------------------
+//
+// Handle the keyboard event send to this menu bar.
+//
+Bool_t MGMenuBar::HandleKey(Event_t *event)
+{
+    //
+    // If this isn't a pressed key do nothing
+    //
+    if (event->fType != kGKeyPress)
+        return kTRUE;
+
+    //
+    // Check whether one popup is alreadu open
+    //
+    TGFrameElement *el=NULL;
+    TIter Next(fList);
+    while ((el = (TGFrameElement *)Next()))
+    {
+        if (!((TGMenuTitle*)el->fFrame)->GetState())
+            continue;
+
+        TGMenuTitle &f = *(TGMenuTitle*)el->fFrame;
+
+        //
+        // If a open popup is found redirect the key event to this
+        // popup menu
+        //
+        Bool_t rc = ((MGPopupMenu*)f.GetMenu())->HandleKey(event);
+
+        //
+        // If a message could be successfully send or the escape key
+        // was pressed close the popup.
+        //
+        if (rc && event->fCode!=9/*ESC*/)
+            return kTRUE;
+
+        f.SetState(kFALSE);
+        gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);  // ungrab pointer
+        gVirtualX->SetKeyAutoRepeat(kTRUE); // set in TGMainFrame::HandleKey
+        fCurrent = 0;
+        return kTRUE;
+    }
+
+    return TGMenuBar::HandleKey(event);
+}
Index: trunk/MagicSoft/Mars/mbase/MGMenu.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MGMenu.h	(revision 2494)
+++ trunk/MagicSoft/Mars/mbase/MGMenu.h	(revision 2494)
@@ -0,0 +1,53 @@
+#ifndef MARS_MGMenu
+#define MARS_MGMenu
+
+#ifndef ROOT_TGMenu
+#include <TGMenu.h>
+#endif
+
+class MGPopupMenu;
+
+class MGMenuEntry : public TGMenuEntry
+{
+    /*
+     Workaround for the protected data mambers of TGMenuEntry
+     */
+public:
+    MGMenuEntry(TGMenuEntry *ent);
+    ~MGMenuEntry()
+    {
+        fLabel=0;
+    }
+
+    MGPopupMenu *GetPopup() { return (MGPopupMenu*)fPopup; }
+    TGHotString *GetLabel() { return fLabel; }
+    void *GetUserData()     { return fUserData; }
+};
+
+class MGPopupMenu : public TGPopupMenu
+{
+public:
+    MGPopupMenu(const TGWindow* p = 0, UInt_t w = 10, UInt_t h = 10, UInt_t options = 0) :
+        TGPopupMenu(p, w, h, options)
+    {
+    }
+
+    UInt_t GetKeyCode(TGMenuEntry *el);
+
+    void BindKeys(const TGWindow *w, TGMainFrame *frame);
+
+    Bool_t HandleKey(Event_t *evt);
+};
+
+class MGMenuBar : public TGMenuBar
+{
+public:
+    MGMenuBar(const TGWindow* p, UInt_t w, UInt_t h, UInt_t options = kHorizontalFrame|kRaisedFrame) :
+        TGMenuBar(p, w, h, options) {}
+
+    void BindKeys(TGMainFrame *frame);
+
+    Bool_t HandleKey(Event_t *event);
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mbase/MProgressBar.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MProgressBar.cc	(revision 2494)
+++ trunk/MagicSoft/Mars/mbase/MProgressBar.cc	(revision 2494)
@@ -0,0 +1,89 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 9/2002 <mailto:tbretz@astro-uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MProgressBar
+//
+// Simple window with progress bar. Can be used in an eventloop.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "MProgressBar.h"
+
+#include <TSystem.h>        // gSystem
+#include <TGProgressBar.h>  // TGHProgressBar
+
+#include "MGList.h"
+
+ClassImp(MProgressBar);
+
+// --------------------------------------------------------------------------
+//
+// Default constructor. Opens a window with a progress bar. Get a pointer
+// to the bar by calling GetBar. This pointer can be used for the
+// eventloop.
+//
+// Be carefull: killing or closing the window while the progress meter
+//   is still in use may cause segmentation faults. Please kill the window
+//   always by deleting the corresponding object.
+//
+MProgressBar::MProgressBar() : TGTransientFrame(gClient->GetRoot(), gClient->GetRoot(), 1, 1)
+{
+    fList = new MGList;
+    fList->SetOwner();
+
+    //SetMWMHints(0, 0, 0);
+
+    SetWMSizeHints(150, 15, 640, 480, 10, 10); // set the smallest and biggest size of the Main frame
+    Move(rand()%100+50, rand()%100+50);
+
+    TGLayoutHints *laybar=new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 2,2,2,2);
+    fList->Add(laybar);
+
+    fBar=new TGHProgressBar(this);
+    fBar->ShowPosition();
+    AddFrame(fBar, laybar);
+    fList->Add(fBar);
+
+    Layout();
+
+    MapSubwindows();
+
+    SetWindowName("Progress");
+    SetIconName("Progress");
+
+    MapWindow();
+}
+
+// --------------------------------------------------------------------------
+//
+// Destruct the window with all its tiles. Also the Progress Bar object
+// is deleted.
+//
+MProgressBar::~MProgressBar()
+{
+    delete fList;
+} 
+
Index: trunk/MagicSoft/Mars/mbase/MProgressBar.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MProgressBar.h	(revision 2494)
+++ trunk/MagicSoft/Mars/mbase/MProgressBar.h	(revision 2494)
@@ -0,0 +1,33 @@
+#ifndef MARS_MProgressBar
+#define MARS_MProgressBar
+
+#ifndef MARS_MAGIC
+#include "MAGIC.h"
+#endif
+
+#ifndef ROOT_TGFrame
+#include <TGFrame.h>
+#endif
+
+class MGList;
+class TGProgressBar;
+class TGHProgressBar;
+
+class MProgressBar : public TGTransientFrame
+{
+private:
+    MGList         *fList;
+    TGHProgressBar *fBar;
+
+public:
+     MProgressBar();
+     virtual ~MProgressBar();
+
+     TGProgressBar *GetBar() const { return (TGProgressBar*)fBar; }
+
+     ClassDef(MProgressBar, 0)   // A simple progress bar window for the Eventloop
+};
+
+#endif
+
+
Index: trunk/MagicSoft/Mars/mbase/MSearch.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MSearch.cc	(revision 2494)
+++ trunk/MagicSoft/Mars/mbase/MSearch.cc	(revision 2494)
@@ -0,0 +1,210 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 9/2002 <mailto:tbretz@astro-uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MSearch
+//
+// Simple search dialog (usefull for TGTextViews)
+//
+// Sends: kC_USER, KS_START, mp1, txt
+//
+//   with mp1: bit0 on=case sensitive
+//             bit1 on=backward
+//        mp2: char* pointing to the text to search for
+//
+// WARNING: Do not store mp2, immeditaly copy the text to a local
+//          location!
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MSearch.h"
+
+#include <TSystem.h>      // gSystem
+#include <TGLabel.h>      // TGLabel
+#include <TGButton.h>     // TGButton
+#include <TGTextEntry.h>  // TGTextEntry
+
+#include "MGList.h"
+
+ClassImp(MSearch);
+
+enum
+{
+    kSearchText, kCase, kDirection, kSearch, kCancel
+};
+
+// --------------------------------------------------------------------------
+//
+// Default constructor. w is the window which will receive the message.
+// Id is currently useless.
+//
+MSearch::MSearch(const TGWindow *w, Int_t id) : TGTransientFrame(gClient->GetRoot(), gClient->GetRoot(), 1, 1), TGWidget(id)
+{
+    Associate(w);
+
+    fList = new MGList;
+    fList->SetOwner();
+
+    // set the smallest and biggest size of the Main frame
+    SetWMSizeHints(320, 110, 250, 50, 0, 0);
+    Move(rand()%100+50, rand()%100+50);
+
+    // -------------------------------------------------------------
+
+    TGLayoutHints *lay4=new TGLayoutHints(kLHintsNormal|kLHintsExpandX);
+    TGLayoutHints *lay0=new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 4, 8, 4);
+    TGLayoutHints *lay1=new TGLayoutHints(kLHintsNormal,  6, 4, 8);
+    TGLayoutHints *lay2=new TGLayoutHints(kLHintsNormal, 69, 4, 4, 4);
+    TGLayoutHints *lay3=new TGLayoutHints(kLHintsNormal, 69, 4, 4, 4);
+    TGLayoutHints *lay5=new TGLayoutHints(kLHintsNormal,  5, 5, 5);
+    TGLayoutHints *lay7=new TGLayoutHints(kLHintsCenterX);
+
+    // -------------------------------------------------------------
+    //  Create Widgets
+    // -------------------------------------------------------------
+
+    TGHorizontalFrame  *f = new TGHorizontalFrame(this, 1, 1);
+    TGLabel        *label = new TGLabel(this, "Find Text:");
+    TGTextEntry    *entry = new TGTextEntry(f, "", kSearchText);
+    TGCheckButton   *box1 = new TGCheckButton(this, "Match upper/lower case", kCase);
+    TGCheckButton   *box2 = new TGCheckButton(this, "Search backward", kDirection);
+    TGHorizontalFrame *f2 = new TGHorizontalFrame(this, 1, 1);
+    TGHorizontalFrame *f3 = new TGHorizontalFrame(f2, 1, 1);
+    TGTextButton    *txt1 = new TGTextButton(f3, "Search", kSearch);
+    TGTextButton    *txt2 = new TGTextButton(f3, "Cancel", kCancel);
+
+    txt1->Associate(this);
+    txt2->Associate(this);
+
+    // -------------------------------------------------------------
+    //  Layout the widgets in the frame
+    // -------------------------------------------------------------
+
+    AddFrame(f, lay4);
+    f->AddFrame(label, lay1);
+    f->AddFrame(entry, lay0);
+    AddFrame(box1, lay2);
+    AddFrame(box2, lay3);
+    AddFrame(f2, lay4);
+    f2->AddFrame(f3, lay7);
+    f3->AddFrame(txt1, lay5);
+    f3->AddFrame(txt2, lay5);
+
+    // -------------------------------------------------------------
+
+    entry->Associate(this);
+    txt1->Associate(this);
+    txt1->Associate(this);
+
+    // -------------------------------------------------------------
+
+    fList->Add(lay0);
+    fList->Add(lay1);
+    fList->Add(lay2);
+    fList->Add(lay3);
+    fList->Add(lay4);
+    fList->Add(lay5);
+    fList->Add(lay7);
+    fList->Add(f);
+    fList->Add(f2);
+    fList->Add(f3);
+    fList->Add(label);
+    fList->Add(entry);
+    fList->Add(box1);
+    fList->Add(box2);
+    fList->Add(txt1);
+    fList->Add(txt2);
+
+    // -------------------------------------------------------------
+
+    Layout();
+
+    MapSubwindows();
+
+    SetWindowName("Search in Text");
+    SetIconName("Search");
+
+    MapWindow();
+}
+
+// --------------------------------------------------------------------------
+//
+// Destruct the window with all its tiles and widgets.
+//
+MSearch::~MSearch()
+{
+    delete fList;
+}
+
+// --------------------------------------------------------------------------
+//
+// Send the search message to the associated TGWindow.
+// See class description.
+//
+Bool_t MSearch::SendSearch()
+{
+    if (!fMsgWindow)
+        return kTRUE;
+
+    const TGCheckButton &b1 = *(TGCheckButton*)fList->FindWidget(kCase);
+    const TGCheckButton &b2 = *(TGCheckButton*)fList->FindWidget(kDirection);
+    const TGTextEntry   &e  = *(TGTextEntry*)  fList->FindWidget(kSearchText);
+
+    const Long_t msg = MK_MSG(kC_USER, (EWidgetMessageTypes)kS_START);
+    const Long_t mp1 = (b1.GetState()<<1) | b2.GetState();
+    const Long_t mp2 = (Long_t)e.GetText();
+
+    SendMessage(fMsgWindow, msg, mp1, mp2);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Process messages from the widgets.
+//
+Bool_t MSearch::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2)
+{
+    // Can be found in WidgetMessageTypes.h
+    switch (GET_MSG(msg))
+    {
+    case kC_COMMAND:
+        switch (GET_SUBMSG(msg))
+        {
+        case kCM_BUTTON:
+            switch (mp1)
+            {
+            case kSearch:
+                return SendSearch();
+            case kCancel:
+                delete this;
+                return kTRUE;
+            }
+            return kTRUE;
+
+        }
+        return kTRUE;
+    }
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/mbase/MSearch.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MSearch.h	(revision 2494)
+++ trunk/MagicSoft/Mars/mbase/MSearch.h	(revision 2494)
@@ -0,0 +1,41 @@
+#ifndef MARS_MSearch
+#define MARS_MSearch
+
+#ifndef MARS_MAGIC
+#include "MAGIC.h"
+#endif
+
+#ifndef ROOT_TGFrame
+#include <TGFrame.h>
+#endif
+
+#ifndef ROOT_TGWidget
+#include <TGWidget.h>
+#endif
+
+enum EMarsWidgetMessageTypes {
+    kS_START = 1
+};
+
+class MGList;
+
+class MSearch : public TGTransientFrame, public TGWidget
+{
+private:
+    MGList *fList;
+
+    Bool_t SendSearch();
+    void CloseWindow() { delete this; }
+
+public:
+    MSearch(const TGWindow *w, Int_t id=-1);
+    virtual ~MSearch();
+
+    Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2);
+
+    ClassDef(MSearch, 0)   // A simple progress bar window for the Eventloop
+};
+
+#endif
+
+
Index: trunk/MagicSoft/Mars/mbase/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mbase/Makefile	(revision 2493)
+++ trunk/MagicSoft/Mars/mbase/Makefile	(revision 2494)
@@ -20,5 +20,5 @@
 # @endcode 
 
-INCLUDES = -I. -I../mmain -I../mfileio -I../mfilter
+INCLUDES = -I. -I../mgui -I../mfileio -I../mfilter
 # MStatusDisplay (MTask), MRead (MEvtLoop), MF (MContinue)
 
@@ -44,4 +44,7 @@
            MEvtLoop.cc \
            MStatusDisplay.cc \
+           MProgressBar.cc \
+           MSearch.cc \
+           MGMenu.cc \
            MIter.cc \
            MReadSocket.cc \
Index: trunk/MagicSoft/Mars/mmain/MGMenu.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MGMenu.cc	(revision 2493)
+++ 	(revision )
@@ -1,226 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Thomas Bretz, 4/2003 <mailto:tbretz@astro-uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2003
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// MGMenu, MGPopupMenu
-//
-/////////////////////////////////////////////////////////////////////////////
-#include "MGMenu.h"
-
-
-MGMenuEntry::MGMenuEntry(TGMenuEntry *ent)
-{
-    memcpy(this, ent, sizeof(*ent));
-}
-
-// -------------------------------------------------------------
-//
-// Return the keycode corresponding to the hot string of
-// a TGmenuEntry
-//
-UInt_t MGPopupMenu::GetKeyCode(TGMenuEntry *el)
-{
-    TGHotString *str = MGMenuEntry(el).GetLabel();
-    return gVirtualX->KeysymToKeycode(str->GetHotChar());
-}
-
-// -------------------------------------------------------------
-//
-// Bind all hot keys used in this popup menu subsequentlt
-// to the TGMainFrame and send a HandleKey message to the
-// TGWindow
-//
-void MGPopupMenu::BindKeys(const TGWindow *w, TGMainFrame *frame)
-{
-    TIter Next(fEntryList);
-    TGMenuEntry *el;
-
-    //
-    // Loop Through all entries
-    //
-    while ((el=(TGMenuEntry*)Next()))
-    {
-        switch (el->GetType())
-        {
-            //
-            // For seperators and labels nothing to do
-            //
-        case kMenuSeparator:
-        case kMenuLabel:
-            continue;
-
-            //
-            // For an entry and a popup menu bind the hot key
-            // In case of a popup menu call BindKeys subsequently
-            //
-        case kMenuEntry:
-        case kMenuPopup:
-            frame->BindKey(w, GetKeyCode(el), kKeyMod1Mask);
-            if (el->GetType()==kMenuPopup)
-                MGMenuEntry(el).GetPopup()->BindKeys(w, frame);
-            continue;
-        }
-    }
-}
-
-/*
- kMenuActiveMask  = BIT(0),
- kMenuEnableMask  = BIT(1),
- kMenuDefaultMask = BIT(2),
- kMenuCheckedMask = BIT(3),
- kMenuRadioMask   = BIT(4),
- kMenuHideMask    = BIT(5)
- */
-
-// -------------------------------------------------------------
-//
-//  Handle a keyboard event. Return kFALSE in case of a
-//  successfully send message, which means: close all open
-//  popups.
-//
-Bool_t MGPopupMenu::HandleKey(Event_t *evt)
-{
-    //
-    // Loop through all entries in this popup menu. If the entry is
-    // an open popup menu send the key event to the open popup.
-    //
-    TIter Next(fEntryList);
-    TGMenuEntry *el;
-    while ((el=(TGMenuEntry*)Next()))
-    {
-        if (el->GetType()==kMenuPopup && el->GetStatus()&kMenuActiveMask)
-            return MGMenuEntry(el).GetPopup()->HandleKey(evt);
-    }
-
-    Next.Reset();
-
-    //
-    // If no open popup is found search the pressed key in this
-    // popup menu.
-    //
-    while ((el=(TGMenuEntry*)Next()))
-    {
-        switch (el->GetType())
-        {
-            //
-            // Do nothing
-            //
-        case kMenuSeparator:
-        case kMenuLabel:
-            continue;
-
-            //
-            // If the keycode corresponds to the hot key
-            // of this entry and the entry is enabled activate the entry
-            // and send the corresponding message/
-            //
-        case kMenuEntry:
-            if (GetKeyCode(el)==evt->fCode && el->GetStatus()&kMenuEnableMask)
-            {
-                Activate(el);
-                SendMessage(fMsgWindow, MK_MSG(kC_COMMAND, kCM_MENU),
-                            el->GetEntryId(), (Long_t)MGMenuEntry(el).GetUserData());
-                return kFALSE;
-            }
-            continue;
-
-            //
-            // If the keycode corresponds to the hot key
-            // of this popup menu activate the popup menu.
-            //
-        case kMenuPopup:
-            if (GetKeyCode(el)!=evt->fCode)
-                continue;
-
-            Activate(el);
-            HandleTimer(NULL);
-            return kTRUE;
-        }
-    }
-    return kTRUE;
-}
-
-// -------------------------------------------------------------
-//
-// Bind the keys of all popups subsequently to the given main
-// frame. The menu bar hot keys are already bound by TGMenuBar.
-// Bind the Escape key to close the popups, too.
-//
-void MGMenuBar::BindKeys(TGMainFrame *frame)
-{
-    TGFrameElement *el=NULL;
-    TIter Next(fList);
-    while ((el = (TGFrameElement *)Next()))
-        ((MGPopupMenu*)((TGMenuTitle *) el->fFrame)->GetMenu())->BindKeys(this, frame);
-
-    frame->BindKey(this, 9/*ESC*/, 0);
-}
-
-// -------------------------------------------------------------
-//
-// Handle the keyboard event send to this menu bar.
-//
-Bool_t MGMenuBar::HandleKey(Event_t *event)
-{
-    //
-    // If this isn't a pressed key do nothing
-    //
-    if (event->fType != kGKeyPress)
-        return kTRUE;
-
-    //
-    // Check whether one popup is alreadu open
-    //
-    TGFrameElement *el=NULL;
-    TIter Next(fList);
-    while ((el = (TGFrameElement *)Next()))
-    {
-        if (!((TGMenuTitle*)el->fFrame)->GetState())
-            continue;
-
-        TGMenuTitle &f = *(TGMenuTitle*)el->fFrame;
-
-        //
-        // If a open popup is found redirect the key event to this
-        // popup menu
-        //
-        Bool_t rc = ((MGPopupMenu*)f.GetMenu())->HandleKey(event);
-
-        //
-        // If a message could be successfully send or the escape key
-        // was pressed close the popup.
-        //
-        if (rc && event->fCode!=9/*ESC*/)
-            return kTRUE;
-
-        f.SetState(kFALSE);
-        gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);  // ungrab pointer
-        gVirtualX->SetKeyAutoRepeat(kTRUE); // set in TGMainFrame::HandleKey
-        fCurrent = 0;
-        return kTRUE;
-    }
-
-    return TGMenuBar::HandleKey(event);
-}
Index: trunk/MagicSoft/Mars/mmain/MGMenu.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MGMenu.h	(revision 2493)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#ifndef MARS_MGMenu
-#define MARS_MGMenu
-
-#ifndef ROOT_TGMenu
-#include <TGMenu.h>
-#endif
-
-class MGPopupMenu;
-
-class MGMenuEntry : public TGMenuEntry
-{
-    /*
-     Workaround for the protected data mambers of TGMenuEntry
-     */
-public:
-    MGMenuEntry(TGMenuEntry *ent);
-    ~MGMenuEntry()
-    {
-        fLabel=0;
-    }
-
-    MGPopupMenu *GetPopup() { return (MGPopupMenu*)fPopup; }
-    TGHotString *GetLabel() { return fLabel; }
-    void *GetUserData()     { return fUserData; }
-};
-
-class MGPopupMenu : public TGPopupMenu
-{
-public:
-    MGPopupMenu(const TGWindow* p = 0, UInt_t w = 10, UInt_t h = 10, UInt_t options = 0) :
-        TGPopupMenu(p, w, h, options)
-    {
-    }
-
-    UInt_t GetKeyCode(TGMenuEntry *el);
-
-    void BindKeys(const TGWindow *w, TGMainFrame *frame);
-
-    Bool_t HandleKey(Event_t *evt);
-};
-
-class MGMenuBar : public TGMenuBar
-{
-public:
-    MGMenuBar(const TGWindow* p, UInt_t w, UInt_t h, UInt_t options = kHorizontalFrame|kRaisedFrame) :
-        TGMenuBar(p, w, h, options) {}
-
-    void BindKeys(TGMainFrame *frame);
-
-    Bool_t HandleKey(Event_t *event);
-};
-
-#endif
Index: trunk/MagicSoft/Mars/mmain/MProgressBar.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MProgressBar.cc	(revision 2493)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Thomas Bretz, 9/2002 <mailto:tbretz@astro-uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2003
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// MProgressBar
-//
-// Simple window with progress bar. Can be used in an eventloop.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#include "MProgressBar.h"
-
-#include <TSystem.h>        // gSystem
-#include <TGProgressBar.h>  // TGHProgressBar
-
-#include "MGList.h"
-
-ClassImp(MProgressBar);
-
-// --------------------------------------------------------------------------
-//
-// Default constructor. Opens a window with a progress bar. Get a pointer
-// to the bar by calling GetBar. This pointer can be used for the
-// eventloop.
-//
-// Be carefull: killing or closing the window while the progress meter
-//   is still in use may cause segmentation faults. Please kill the window
-//   always by deleting the corresponding object.
-//
-MProgressBar::MProgressBar() : TGTransientFrame(gClient->GetRoot(), gClient->GetRoot(), 1, 1)
-{
-    fList = new MGList;
-    fList->SetOwner();
-
-    //SetMWMHints(0, 0, 0);
-
-    SetWMSizeHints(150, 15, 640, 480, 10, 10); // set the smallest and biggest size of the Main frame
-    Move(rand()%100+50, rand()%100+50);
-
-    TGLayoutHints *laybar=new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 2,2,2,2);
-    fList->Add(laybar);
-
-    fBar=new TGHProgressBar(this);
-    fBar->ShowPosition();
-    AddFrame(fBar, laybar);
-    fList->Add(fBar);
-
-    Layout();
-
-    MapSubwindows();
-
-    SetWindowName("Progress");
-    SetIconName("Progress");
-
-    MapWindow();
-}
-
-// --------------------------------------------------------------------------
-//
-// Destruct the window with all its tiles. Also the Progress Bar object
-// is deleted.
-//
-MProgressBar::~MProgressBar()
-{
-    delete fList;
-} 
-
Index: trunk/MagicSoft/Mars/mmain/MProgressBar.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MProgressBar.h	(revision 2493)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#ifndef MARS_MProgressBar
-#define MARS_MProgressBar
-
-#ifndef MARS_MAGIC
-#include "MAGIC.h"
-#endif
-
-#ifndef ROOT_TGFrame
-#include <TGFrame.h>
-#endif
-
-class MGList;
-class TGProgressBar;
-class TGHProgressBar;
-
-class MProgressBar : public TGTransientFrame
-{
-private:
-    MGList         *fList;
-    TGHProgressBar *fBar;
-
-public:
-     MProgressBar();
-     virtual ~MProgressBar();
-
-     TGProgressBar *GetBar() const { return (TGProgressBar*)fBar; }
-
-     ClassDef(MProgressBar, 0)   // A simple progress bar window for the Eventloop
-};
-
-#endif
-
-
Index: trunk/MagicSoft/Mars/mmain/MSearch.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MSearch.cc	(revision 2493)
+++ 	(revision )
@@ -1,210 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Thomas Bretz, 9/2002 <mailto:tbretz@astro-uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2003
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// MSearch
-//
-// Simple search dialog (usefull for TGTextViews)
-//
-// Sends: kC_USER, KS_START, mp1, txt
-//
-//   with mp1: bit0 on=case sensitive
-//             bit1 on=backward
-//        mp2: char* pointing to the text to search for
-//
-// WARNING: Do not store mp2, immeditaly copy the text to a local
-//          location!
-//
-/////////////////////////////////////////////////////////////////////////////
-#include "MSearch.h"
-
-#include <TSystem.h>      // gSystem
-#include <TGLabel.h>      // TGLabel
-#include <TGButton.h>     // TGButton
-#include <TGTextEntry.h>  // TGTextEntry
-
-#include "MGList.h"
-
-ClassImp(MSearch);
-
-enum
-{
-    kSearchText, kCase, kDirection, kSearch, kCancel
-};
-
-// --------------------------------------------------------------------------
-//
-// Default constructor. w is the window which will receive the message.
-// Id is currently useless.
-//
-MSearch::MSearch(const TGWindow *w, Int_t id) : TGTransientFrame(gClient->GetRoot(), gClient->GetRoot(), 1, 1), TGWidget(id)
-{
-    Associate(w);
-
-    fList = new MGList;
-    fList->SetOwner();
-
-    // set the smallest and biggest size of the Main frame
-    SetWMSizeHints(320, 110, 250, 50, 0, 0);
-    Move(rand()%100+50, rand()%100+50);
-
-    // -------------------------------------------------------------
-
-    TGLayoutHints *lay4=new TGLayoutHints(kLHintsNormal|kLHintsExpandX);
-    TGLayoutHints *lay0=new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 4, 8, 4);
-    TGLayoutHints *lay1=new TGLayoutHints(kLHintsNormal,  6, 4, 8);
-    TGLayoutHints *lay2=new TGLayoutHints(kLHintsNormal, 69, 4, 4, 4);
-    TGLayoutHints *lay3=new TGLayoutHints(kLHintsNormal, 69, 4, 4, 4);
-    TGLayoutHints *lay5=new TGLayoutHints(kLHintsNormal,  5, 5, 5);
-    TGLayoutHints *lay7=new TGLayoutHints(kLHintsCenterX);
-
-    // -------------------------------------------------------------
-    //  Create Widgets
-    // -------------------------------------------------------------
-
-    TGHorizontalFrame  *f = new TGHorizontalFrame(this, 1, 1);
-    TGLabel        *label = new TGLabel(this, "Find Text:");
-    TGTextEntry    *entry = new TGTextEntry(f, "", kSearchText);
-    TGCheckButton   *box1 = new TGCheckButton(this, "Match upper/lower case", kCase);
-    TGCheckButton   *box2 = new TGCheckButton(this, "Search backward", kDirection);
-    TGHorizontalFrame *f2 = new TGHorizontalFrame(this, 1, 1);
-    TGHorizontalFrame *f3 = new TGHorizontalFrame(f2, 1, 1);
-    TGTextButton    *txt1 = new TGTextButton(f3, "Search", kSearch);
-    TGTextButton    *txt2 = new TGTextButton(f3, "Cancel", kCancel);
-
-    txt1->Associate(this);
-    txt2->Associate(this);
-
-    // -------------------------------------------------------------
-    //  Layout the widgets in the frame
-    // -------------------------------------------------------------
-
-    AddFrame(f, lay4);
-    f->AddFrame(label, lay1);
-    f->AddFrame(entry, lay0);
-    AddFrame(box1, lay2);
-    AddFrame(box2, lay3);
-    AddFrame(f2, lay4);
-    f2->AddFrame(f3, lay7);
-    f3->AddFrame(txt1, lay5);
-    f3->AddFrame(txt2, lay5);
-
-    // -------------------------------------------------------------
-
-    entry->Associate(this);
-    txt1->Associate(this);
-    txt1->Associate(this);
-
-    // -------------------------------------------------------------
-
-    fList->Add(lay0);
-    fList->Add(lay1);
-    fList->Add(lay2);
-    fList->Add(lay3);
-    fList->Add(lay4);
-    fList->Add(lay5);
-    fList->Add(lay7);
-    fList->Add(f);
-    fList->Add(f2);
-    fList->Add(f3);
-    fList->Add(label);
-    fList->Add(entry);
-    fList->Add(box1);
-    fList->Add(box2);
-    fList->Add(txt1);
-    fList->Add(txt2);
-
-    // -------------------------------------------------------------
-
-    Layout();
-
-    MapSubwindows();
-
-    SetWindowName("Search in Text");
-    SetIconName("Search");
-
-    MapWindow();
-}
-
-// --------------------------------------------------------------------------
-//
-// Destruct the window with all its tiles and widgets.
-//
-MSearch::~MSearch()
-{
-    delete fList;
-}
-
-// --------------------------------------------------------------------------
-//
-// Send the search message to the associated TGWindow.
-// See class description.
-//
-Bool_t MSearch::SendSearch()
-{
-    if (!fMsgWindow)
-        return kTRUE;
-
-    const TGCheckButton &b1 = *(TGCheckButton*)fList->FindWidget(kCase);
-    const TGCheckButton &b2 = *(TGCheckButton*)fList->FindWidget(kDirection);
-    const TGTextEntry   &e  = *(TGTextEntry*)  fList->FindWidget(kSearchText);
-
-    const Long_t msg = MK_MSG(kC_USER, (EWidgetMessageTypes)kS_START);
-    const Long_t mp1 = (b1.GetState()<<1) | b2.GetState();
-    const Long_t mp2 = (Long_t)e.GetText();
-
-    SendMessage(fMsgWindow, msg, mp1, mp2);
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-//  Process messages from the widgets.
-//
-Bool_t MSearch::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2)
-{
-    // Can be found in WidgetMessageTypes.h
-    switch (GET_MSG(msg))
-    {
-    case kC_COMMAND:
-        switch (GET_SUBMSG(msg))
-        {
-        case kCM_BUTTON:
-            switch (mp1)
-            {
-            case kSearch:
-                return SendSearch();
-            case kCancel:
-                delete this;
-                return kTRUE;
-            }
-            return kTRUE;
-
-        }
-        return kTRUE;
-    }
-    return kTRUE;
-}
Index: trunk/MagicSoft/Mars/mmain/MSearch.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MSearch.h	(revision 2493)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#ifndef MARS_MSearch
-#define MARS_MSearch
-
-#ifndef MARS_MAGIC
-#include "MAGIC.h"
-#endif
-
-#ifndef ROOT_TGFrame
-#include <TGFrame.h>
-#endif
-
-#ifndef ROOT_TGWidget
-#include <TGWidget.h>
-#endif
-
-enum EMarsWidgetMessageTypes {
-    kS_START = 1
-};
-
-class MGList;
-
-class MSearch : public TGTransientFrame, public TGWidget
-{
-private:
-    MGList *fList;
-
-    Bool_t SendSearch();
-    void CloseWindow() { delete this; }
-
-public:
-    MSearch(const TGWindow *w, Int_t id=-1);
-    virtual ~MSearch();
-
-    Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2);
-
-    ClassDef(MSearch, 0)   // A simple progress bar window for the Eventloop
-};
-
-#endif
-
-
Index: trunk/MagicSoft/Mars/mmain/MainLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MainLinkDef.h	(revision 2493)
+++ trunk/MagicSoft/Mars/mmain/MainLinkDef.h	(revision 2494)
@@ -13,6 +13,6 @@
 #pragma link C++ class MDataCheck+;
 #pragma link C++ class MMonteCarlo+;
-#pragma link C++ class MSearch+;
-#pragma link C++ class MProgressBar+;
+//#pragma link C++ class MSearch+;
+//#pragma link C++ class MProgressBar+;
 #pragma link C++ class MCameraDisplay+;
 #pragma link C++ class MEventDisplay+;
Index: trunk/MagicSoft/Mars/mmain/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mmain/Makefile	(revision 2493)
+++ trunk/MagicSoft/Mars/mmain/Makefile	(revision 2494)
@@ -38,5 +38,4 @@
            MSearch.cc \
 	   MEventDisplay.cc \
-	   MProgressBar.cc \
            MCameraDisplay.cc
 
