Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1085)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1086)
@@ -1,3 +1,132 @@
                                                                   -*-*- END -*-*-
+
+ 2001/11/16: Thomas Bretz
+
+   * mbase/MEvtLoop.cc:
+     - removed clock.Print()
+
+   * mbase/MGList.[cc,h]:
+     - added support for TGPictures
+
+   * mbase/MReadTree.[h,cc]:
+     - set ReadyToSave-bit only if reading was successfull
+     - made SetReadyToSave private
+
+   * mbase/MTaskList.cc:
+     - corrected a small bug in the output
+
+   * mbase/MWriteRootFile.cc:
+     - added a workaround in Print (don't know why it fails for me)
+     - removed fTrees.SetOwner()
+
+   * mbase/MTask.cc:
+     - removed include of TOrdCollection, TMethod
+     - some changes to the output
+
+   * mbase/MParContainer.h:
+     - removed old comments
+
+   * mmain/MAnalysis.cc, mmain/MCameraDisplay.cc, mmain/MDataCheck.cc,
+     mmain/MEvtDisp.cc, mmain/MMonteCarlo.cc:
+     - changed Widget IDs to root style enums
+     - moved enumerations in the range below 0x100
+
+   * mmain/MBrowser.[h,cc]:
+     - removed some of the member variables, accessed via MGList now
+     - changed TList to MGList
+     - added a file-filter combo-box
+
+   * mars.cc:
+     - changed output
+
+
+
+ 2001/11/15: Thomas Bretz
+
+   * mbase/MArray.cc, mbase/MArrayB.cc,mbase/MArrayS.cc,
+     mbase/MClone.cc, mbase/MEvtLoop.cc, mbase/MFilter.cc,
+     mbase/MFilterList.cc, mbase/MGGroupFrame.cc, mbase/MGList.cc,
+     mbase/MGTask.cc, mbase/MInputStreamID.cc, mbase/MLog.cc,
+     mbase/MLogManip.cc, mbase/MParContainer.cc, mbase/MParList.cc,
+     mbase/MPrint.cc, mbase/MReadMarsFile.cc, mbase/MReadTree.cc,
+     mbase/MTime.cc, mbase/MWriteAsciiFile.cc, mbase/MWriteFile.cc,
+     mbase/MWriteRootFile.cc, manalysis/MCT1ReadAscii.cc,
+     manalysis/MCerPhotCalc.cc, manalysis/MHillas.cc,
+     manalysis/MHillasCalc.cc, manalysis/MMcPedestalCopy.cc,
+     manalysis/MPedCalcPedRun.cc, manalysis/MPedestalCam.cc,
+     manalysis/MPedestalPix.cc, manalysis/MCerPhotEvt.cc,
+     manalysis/MCerPhotPix.cc, manalysis/MImgCleanStd.cc,
+     manalysis/MImgCleanStd.cc, mdatacheck/MDumlEvtHeader.cc,
+     mdatacheck/MGDisplayAdc.cc, meventdisp/MGCamDisplay.cc,
+     meventdisp/MGEvtDisplay.cc, meventdisp/MGFadcDisp.cc,
+     mfilter/MFTriggerLvl1.cc, mgui/MGeomCam.cc, mgui/MGeomCamMagic.cc,
+     mgui/MGeomCamCT1.cc, mgui/MgeomPix.cc, mgui/Mhexagon.cc,
+     hist/MFillH.cc, mhist/MH.cc, mhist/MHFadcCam.cc, mhist/MHFadcPix.cc,
+     hist/MHHillas.cc, mhist/MHMcCollectionArea.cc, mhist/MHMcEnergy.cc,
+     mhist/MHMcRate.cc, mhist/MHStarMap.cc, mmain/MAnalysis.cc,
+     mmain/MBrowser.cc, mmain/MCameraDisplay.cc, mmain/MDataCheck.cc,
+     mmain/MEvtDisp.cc, mmain/MMars.cc, mmain/MMonteCarlo.cc,
+     mmontcarlo/MMcCollectionAreaCalc.cc, mmontecarlo/MMcThresholdCalc.cc,
+     mmontecarlo/MMcTriggerRateCalc.cc, mraw/MrawCrateArray.cc,
+     mraw/MRawCrateData.cc, mraw/MRawEvtData.cc, mraw/MRawEvtHeader.cc
+     mraw/MRawEvtPixelIter.cc, mraw/MRawEvtFileRead.cc, 
+     mraw/MRawEvtFileWrite.cc, mraw/MRawEvtRunHeader.cc
+     - changed mailing address of author according to THtml of root 3.02
+
+   * mbase/MClone.cc, mbase/MEvtLoop.cc, mbase/MFilterList.cc,
+     mbase/MGTask.cc, mbase/MParContainer.cc, mbase/MParList.cc,
+     mbase/MPrint.cc, mbase/MReadMarsFile.cc, mbase/MReadTree.cc,
+     mbase/MWriteAsciiFile.cc, mbase/MWriteFile.cc,
+     mbase/MWriteRootFile.cc, manalysis/MCerPhotEvt.cc, 
+     manalysis/MCerPhotPix.cc, manalysis/MImgCleanStd.cc,
+     mgui/MGeomCam.cc, mgui/MGeomCamMagic.cc, mgui/MGeomCamCT1.cc, 
+     mgui/MgeomPix.cc, mgui/Mhexagon.cc, hist/MFillH.cc, mhist/MHMcEnergy.cc,
+     mhist/MHMcRate.cc, mmontcarlo/MMcCollectionAreaCalc.cc,
+     mmontecarlo/MMcThresholdCalc.cc, mmontecarlo/MMcTriggerRateCalc.cc
+     mraw/MRawCrateData.cc, mraw/MRawEvtData.cc, mraw/MRawEvtHeader.cc
+     mraw/MRawEvtPixelIter.cc, mraw/MRawEvtFileRead.cc, 
+     mraw/MRawEvtFileWrite.cc, mraw/MRawEvtRunHeader.cc
+     - changed output to new style logging (verbosity level introduced)
+
+   * mbase/MGTask.h:
+     - added default to CreateGui
+
+   * mbase/MLog.cc
+     - chnaged comparision between output and debug level from >= to >
+
+   * mbase/MLogManip.h:
+     - added defintions for debug levels
+
+   * mbase/MReadTree.[h,cc]:
+      - added support for filters
+      - SetReadyToSave added
+      - Print added
+
+   * mbase/MTaskList.[h,cc], MTask.[h,cc]:
+     - changed TOrCollection to TList, because TList can be stored in a 
+       root file.
+
+   * mbase/MTask.[h,cc]:
+     - added GetFilter function (used in MReadTree)
+
+   * manalysis/MImgCleanStd.cc:
+     - same changed to the GUI layout
+     - added Print member function
+
+   * meventdisp/MGCamDisplay.cc:
+     - added group frame around some gui elements
+
+   * mfilter/MFTriggerLvl1.cc:
+     - fixed missing Init call
+     - added missing AddToBranchList call
+
+   * mars.cc:
+     - added command line option to set the verbosity level
+
+   * merpp.cc:
+     - added setup for highest verbosity level
+
+
+
  2001/11/14: Thomas Bretz
 
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 1085)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 1086)
@@ -1,5 +1,16 @@
                                                                -*-*- END -*-*-
 
- *** Version 0.5
+ *** Version 0.6
+
+   - Introduced verbosity levels
+
+   - Introduced a task (MReadMarsFile) which reads the RunHeader tree, too.
+
+   - Fixed several bugs in MFTriggerLvl1 which caused to filter not to
+     work correctly (thanks to Abelardo)
+
+
+
+ *** Version 0.5 (2001/11/06)
 
    - Added new GUI functionality (Analysis)
Index: /trunk/MagicSoft/Mars/mars.cc
===================================================================
--- /trunk/MagicSoft/Mars/mars.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mars.cc	(revision 1086)
@@ -32,10 +32,10 @@
 int main(int argc, char **argv )
 {
-    gLog << all;
+    gLog << all << endl;
 
     //                1         2         3         4         5
     //       12345678901234567890123456789012345678901234567890
     gLog << "==================================================" << endl;
-    gLog << "                    MARS v0.5                     " << endl;
+    gLog << "                    MARS V0.6                     " << endl;
     gLog << "    Magic Analysis and Reconstruction Software    " << endl;
     gLog << "            Compiled on <" << __DATE__ << ">"       << endl;
@@ -106,4 +106,6 @@
     app.Run();
 
+    gLog << all << endl;
+
     return 0;
 }
Index: /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1086)
@@ -221,6 +221,4 @@
     *fLog << all << "Ready!" << endl << endl;
 
-    clock.Print();
-
     *fLog << dec << endl << "CPU  - "
         << "Time: " << clock.CpuTime() << "s"
Index: /trunk/MagicSoft/Mars/mbase/MGList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MGList.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mbase/MGList.cc	(revision 1086)
@@ -38,8 +38,35 @@
 
 #include <TClass.h>
+#include <TGClient.h>
 #include <TGWidget.h>
+#include <TGPicture.h>
 
 
 ClassImp(MGList);
+
+// --------------------------------------------------------------------------
+//
+//  Before destroying the list with all its contents free all TGPicture
+//  objects in the list.
+//
+#include <TRefCnt.h>
+
+MGList::~MGList()
+{
+    TObject *obj;
+    TIter Next(this);
+    while ((obj=Next()))
+    {
+        if (!obj->InheritsFrom(TGPicture::Class()))
+            continue;
+
+        //
+        // Remove the object first. Otherwise we would remove
+        // a non existing object...
+        //
+        Remove(obj);
+        gClient->FreePicture((TGPicture*)obj);
+    }
+}
 
 // --------------------------------------------------------------------------
@@ -137,4 +164,63 @@
 // --------------------------------------------------------------------------
 //
+//  Adds the picture physically to the list. The list takes care of that
+//   - The picture is freed as often as it was retrieved from gClient
+//
+void MGList::AddPicture(const TGPicture *pic)
+{
+    //
+    // Check whether the picture exists
+    //
+    if (!pic)
+    {
+        cout << "Warning: Requested picture not found... ignored." << endl;
+        return;
+    }
+
+    //
+    // Add the picture to the list
+    //
+    TList::Add(const_cast<TGPicture*>(pic));
+}
+
+// --------------------------------------------------------------------------
+//
+//  This gets a picture from the picture pool of the TGClient-object.
+//  The pictures are freed automatically in the dstructor of the list.
+//  The picture counts itself how often it got used, so that only
+//  the first call to GetPicture will craete it and the last call to
+//  FreePicture will destroy it. If you access the picture only via
+//  MGList::GetPicture you don't have to care about.
+//
+//  Don't try to call FreePicture by yourself for a picture gotten by
+//  GetPicture. This is independant of the kIsOwner bit.
+//
+const TGPicture *MGList::GetPicture(const char *name)
+{
+    const TGPicture *pic = gClient->GetPicture(name);
+    AddPicture(pic);
+    return pic;
+}
+
+// --------------------------------------------------------------------------
+//
+//  This gets a picture from the picture pool of the TGClient-object.
+//  The pictures are freed automatically in the dstructor of the list.
+//  The picture counts itself how often it got used, so that only
+//  the first call to GetPicture will craete it and the last call to
+//  FreePicture will destroy it. If you access the picture only via
+//  MGList::GetPicture you don't have to care about.
+//
+//  Don't try to call FreePicture by yourself for a picture gotten by
+//  GetPicture. This is independant of the kIsOwner bit.
+//
+const TGPicture *MGList::GetPicture(const char *name, Int_t width, Int_t height)
+{
+    const TGPicture *pic = gClient->GetPicture(name, width, height);
+    AddPicture(pic);
+    return pic;
+}
+// --------------------------------------------------------------------------
+//
 //  Search the list for a object derived from TGidget which has the given
 //  widget id. Returns a pointer to this object otherwise NULL.
Index: /trunk/MagicSoft/Mars/mbase/MGList.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MGList.h	(revision 1085)
+++ /trunk/MagicSoft/Mars/mbase/MGList.h	(revision 1086)
@@ -7,4 +7,5 @@
 
 class TGWidget;
+class TGPicture;
 
 class MGList : public TList
@@ -14,10 +15,15 @@
     Bool_t    IsExisting(TObject *obj) const;
 
+    void      AddPicture(const TGPicture *pic);
+
 public:
     MGList() : TList() {}
+    virtual ~MGList();
 
     void Add(TObject *obj);
     void Add(TObject *obj, Option_t *opt);
 
+    const TGPicture *GetPicture(const char *name);
+    const TGPicture *GetPicture(const char *name, Int_t width, Int_t height);
 
     TObject *FindWidget(Int_t id) const;
Index: /trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1085)
+++ /trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1086)
@@ -22,63 +22,4 @@
 class ofstream;
 class ifstream;
-/*
-class MParContainer : public TObject
-{
-private:
-    void Init(const char *name, const char *title)
-    {
-        fName = new TString;
-        (*fName) = name;
-        fTitle = new TString;
-        (*fTitle) = title;
-
-        cout << " <***> " << flush;
-    }
-
-protected:
-    MLog    *fLog;         //! The general log facility for this object, initialized with the global object
-
-    TString *fName;        //! parameter container identifier (name)
-    TString *fTitle;       //! parameter container title
-
-    Bool_t   fReadyToSave; //! should be set to true if the contents of the container is changed somehow
-
-public:
-    MParContainer(const char *name="", const char *title="") : fLog(&gLog), fReadyToSave(kFALSE) { Init(name, title); }
-    MParContainer(const TString &name, const TString &title) : fLog(&gLog), fReadyToSave(kFALSE) { Init(name, title); }
-    MParContainer(const MParContainer &named);
-    MParContainer& operator=(const MParContainer& rhs);
-
-    void SetLogStream(MLog *lg) { fLog = lg; }
-
-    virtual ~MParContainer() { 
-      //delete fName; delete fTitle;
-    }
-    virtual TObject *Clone(const char *newname) const;
-    virtual Int_t    Compare(const TObject *obj) const;
-    virtual void     Copy(TObject &named);
-    virtual void     FillBuffer(char *&buffer);
-    virtual const char  *GetName() const {return fName->Data();}
-    virtual const char  *GetTitle() const {return fTitle->Data();}
-    virtual ULong_t  Hash() { return fName->Hash(); }
-    virtual Bool_t   IsSortable() const { return kTRUE; }
-    virtual void     SetName(const char *name); // *MENU*
-    virtual void     SetObject(const char *name, const char *title);
-    virtual void     SetTitle(const char *title=""); // *MENU*
-    virtual void     ls(Option_t *option="") const;
-    virtual void     Print(Option_t *option="") const;
-    virtual Int_t    Sizeof() const;
-
-    virtual void     Reset() {};
-
-    virtual Bool_t IsReadyToSave() { return fReadyToSave; }
-    virtual void   SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
-
-    virtual void AsciiRead(ifstream &fin);
-    virtual void AsciiWrite(ofstream &fout) const;
-
-    ClassDef(MParContainer, 0)  //The basis for all parameter containers
-};
-*/
 
 class MParContainer : public TObject
Index: /trunk/MagicSoft/Mars/mbase/MReadTree.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MReadTree.h	(revision 1085)
+++ /trunk/MagicSoft/Mars/mbase/MReadTree.h	(revision 1086)
@@ -24,5 +24,5 @@
     TList  *fNotify;           // List of TObjects to notify when switching files
 
-    TGProgressBar *fProgress;  // Possible display of status
+    TGProgressBar  *fProgress; //! Possible display of status
 
     void SetBranchStatus(const TList *list, Bool_t status);
@@ -32,4 +32,6 @@
     void EnableBranches(MParList *plist);
     void EnableBranchChoosing();
+
+    virtual void SetReadyToSave(Bool_t flag=kTRUE);
 
     enum { kIsOwner = BIT(14) };
@@ -58,5 +60,4 @@
     virtual void   AddNotify(TObject *obj);
     virtual void   SetOwner(Bool_t flag=kTRUE);
-    virtual void   SetReadyToSave(Bool_t flag=kTRUE);
     virtual void   Print(Option_t *opt="") const;
 
Index: /trunk/MagicSoft/Mars/mbase/MTask.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 1086)
@@ -16,5 +16,5 @@
 !
 !
-!   Author(s): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
+!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2001
@@ -67,7 +67,4 @@
 #include "MTask.h"
 
-#include <TMethod.h>
-#include <TOrdCollection.h>
-
 #include "MLog.h"
 #include "MLogManip.h"
@@ -227,5 +224,5 @@
 void MTask::PrintStatistics(const Int_t lvl) const
 {
-    *fLog << setw(lvl) << " " << GetDescriptor() << "\t";
+    *fLog << all << setw(lvl) << " " << GetDescriptor() << "\t";
     *fLog << dec << fNumExecutions << endl;
 }
Index: /trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1086)
@@ -240,5 +240,5 @@
     }
 
-    *fLog << endl;
+    *fLog << all << endl;
 
     return kTRUE;
Index: /trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc	(revision 1086)
@@ -72,5 +72,11 @@
     //
     fBranches.SetOwner();
-    fTrees.SetOwner();
+
+    //
+    // Believing the root user guide, TTree instanced are owned by the
+    // directory (file) in which they are. This means we don't have to
+    // care about their destruction.
+    //
+    //fTrees.SetOwner();
 
     //
@@ -118,11 +124,12 @@
 void MWriteRootFile::Print(Option_t *) const
 {
-    cout << all << " File: " << GetFileName() << endl;
-    cout << setfill('-') << setw(strlen(GetFileName())+8) << "" << endl;
-
-    TTree *t;
+    *fLog << all << " File: " << GetFileName() << endl;
+    *fLog << setfill('-') << setw(strlen(GetFileName())+8) << "" << endl;
+    *fLog << setfill(' '); // FIXME: not resetting setfill results in strange output???
+
+    TTree *t = NULL;
     TIter Next(&fTrees);
     while ((t=(TTree*)Next()))
-        cout << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;
+        *fLog << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;
 }
 
Index: /trunk/MagicSoft/Mars/mmain/MAnalysis.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 1086)
@@ -31,4 +31,5 @@
 #include <TGTextEntry.h>   // TGNumberEntry
 
+#include "MGList.h"
 #include "MImgCleanStd.h"  // MImgCleanStd
 
@@ -36,5 +37,5 @@
 
 enum {
-    kButHillas
+    kButHillas = 0x100
 };
 
Index: /trunk/MagicSoft/Mars/mmain/MBrowser.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmain/MBrowser.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mmain/MBrowser.cc	(revision 1086)
@@ -26,12 +26,15 @@
 #include "MBrowser.h"
 
+#include <iostream.h>
+#include <sys/stat.h>       // S_ISDIR
+
 #include <TSystem.h>        // gSystem
 
 #include <TGTab.h>          // TGTab
 #include <TGMenu.h>         // TGPopupMenu
+#include <TG3DLine.h>       // TGHorizontal3DLine
 #include <TGButton.h>       // TGTextButton
 #include <TGMsgBox.h>       // TGMsgBox
 #include <TBrowser.h>       // TBrowser
-#include <TGListBox.h>      // TGListBox
 #include <TGTextEntry.h>    // TGTextEntry
 #include <TGFSComboBox.h>   // TGFSComboBox, TGFSLboxEntry
@@ -39,10 +42,5 @@
 #include <TGFSContainer.h>  // TGFileContainer
 
-#include <TG3DLine.h>       // TGHorizontal3DLine
-                            // use TGSplitter.h for root<3.00
-
-#include <sys/stat.h>       // S_ISDIR
-
-#include <iostream.h>
+#include "MGList.h"
 
 ClassImp(MBrowser);
@@ -55,4 +53,5 @@
     kButDetailMode,
     kCBDirectory,
+    kCBFilter,
     kTEFileName
 };
@@ -116,49 +115,49 @@
     // Create Dir-Listbox and buttons in first frame
     //
-    fDir = new TGFSComboBox(frame, kCBDirectory);
-    fDir->Resize(350, 20);
+    TGFSComboBox *dir = new TGFSComboBox(frame, kCBDirectory);
+    dir->SetHeight(fEntry->GetHeight());
 
     //
     // Get the three picturs from the system (must be deleted by FreePicture)
     //
-    fPic1 = fClient->GetPicture("tb_uplevel.xpm");
-    fPic2 = fClient->GetPicture("tb_list.xpm");
-    fPic3 = fClient->GetPicture("tb_details.xpm");
+    const TGPicture *pic1 = fList->GetPicture("tb_uplevel.xpm");
+    const TGPicture *pic2 = fList->GetPicture("tb_list.xpm");
+    const TGPicture *pic3 = fList->GetPicture("tb_details.xpm");
 
     //
     // Create the corresponding picture buttons
     //
-    fCdup     = new TGPictureButton(frame, fPic1, kButDirUp);
-    fListMode = new TGPictureButton(frame, fPic2, kButListMode);
-    fDetail   = new TGPictureButton(frame, fPic3, kButDetailMode);
+    TGPictureButton *cdup   = new TGPictureButton(frame, pic1, kButDirUp);
+    TGPictureButton *list   = new TGPictureButton(frame, pic2, kButListMode);
+    TGPictureButton *detail = new TGPictureButton(frame, pic3, kButDetailMode);
 
     //
     // setup the buttons
     //
-    fCdup    ->SetToolTipText("One Level up!");
-    fListMode->SetToolTipText("List Mode");
-    fDetail  ->SetToolTipText("Details Mode");
-
-    fListMode->SetState(kButtonUp);
-    fDetail  ->SetState(kButtonEngaged);
-
-    fListMode->AllowStayDown(kTRUE);
-    fDetail  ->AllowStayDown(kTRUE);
+    cdup  ->SetToolTipText("One Level up!");
+    list  ->SetToolTipText("List Mode");
+    detail->SetToolTipText("Details Mode");
+
+    list  ->SetState(kButtonUp);
+    detail->SetState(kButtonEngaged);
+
+    list  ->AllowStayDown(kTRUE);
+    detail->AllowStayDown(kTRUE);
 
     //
     // send messages to 'this' object
     //
-    fDir     ->Associate(this);
-    fCdup    ->Associate(this);
-    fDetail  ->Associate(this);
-    fListMode->Associate(this);
+    dir   ->Associate(this);
+    cdup  ->Associate(this);
+    detail->Associate(this);
+    list  ->Associate(this);
 
     //
     // Add to list for 'automatic' deletion
     //
-    fList->Add(fDir);
-    fList->Add(fCdup);
-    fList->Add(fListMode);
-    fList->Add(fDetail);
+    fList->Add(dir);
+    fList->Add(cdup);
+    fList->Add(list);
+    fList->Add(detail);
 
     //
@@ -175,8 +174,8 @@
     fList->Add(layout);
 
-    frame->AddFrame(fDir,      laydir);
-    frame->AddFrame(fListMode, layout);
-    frame->AddFrame(fDetail,   layout);
-    frame->AddFrame(fCdup,     layout);
+    frame->AddFrame(dir,    laydir);
+    frame->AddFrame(list,   layout);
+    frame->AddFrame(detail, layout);
+    frame->AddFrame(cdup,   layout);
 }
 
@@ -198,5 +197,5 @@
     fFileView->SetViewMode(kLVDetails);
 
-    fFileCont->SetFilter("*");
+    fFileCont->SetFilter("*.root");
     fFileCont->Associate(this);
     fFileCont->Sort(kSortByName);
@@ -210,4 +209,11 @@
 void MBrowser::CreateTab1()
 {
+    static const char *filters[] =
+    {
+        "*.root <root-files>",
+        "*      <All Files>",
+        NULL
+    };
+
     TGCompositeFrame *frame = CreateNewTab("Input File");
 
@@ -215,31 +221,36 @@
     // Create three frames for the first tab
     //
-    TGHorizontalFrame *tab1a = new TGHorizontalFrame(frame, 100, 100);
-    TGHorizontalFrame *tab1b = new TGHorizontalFrame(frame, 100, 100);
-    TGVerticalFrame   *tab2  = new TGVerticalFrame  (frame, 100, 100);
-
-    TGLayoutHints *laytab1  = new TGLayoutHints(kLHintsNormal|kLHintsExpandX,  10, 10, 10);
-    TGLayoutHints *laytab2  = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 10, 10, 10, 10);
-    TGLayoutHints *layentry = new TGLayoutHints(kLHintsNormal|kLHintsExpandX); //,  5, 5, 5);
-
-    frame->AddFrame(tab1a, laytab1);
-    frame->AddFrame(tab1b, laytab1);
-    frame->AddFrame(tab2,  laytab2);
-
-    fEntry = new TGTextEntry(tab1a, "", kTEFileName);
-    fEntry->Resize(350, 20);
+    TGHorizontalFrame *tab1 = new TGHorizontalFrame(frame, 100, 100);
+    TGVerticalFrame   *tab2 = new TGVerticalFrame  (frame, 100, 100);
+
+    TGLayoutHints *laytab1   = new TGLayoutHints(kLHintsNormal|kLHintsExpandX,  10, 10, 10);
+    TGLayoutHints *laytab2   = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 10, 10, 10, 10);
+    TGLayoutHints *layfilter = new TGLayoutHints(kLHintsNormal|kLHintsExpandX,  10, 10, 10);
+
+    fEntry = new TGTextEntry(frame, "", kTEFileName);
     fEntry->Associate(this);
-    tab1a->AddFrame(fEntry, layentry);
-
-    CreateDirListMenu(tab1b);
+
+    TGComboBox *filter = new TGComboBox(frame, kCBFilter);
+    filter->SetHeight(fEntry->GetHeight());
+    filter->Associate(this);
+    for (int i=0; filters[i]; i++)
+        filter->AddEntry(filters[i], i);
+    filter->Select(0);
+
+    frame->AddFrame(fEntry, laytab1);
+    frame->AddFrame(tab1,   laytab1);
+    frame->AddFrame(filter, layfilter);
+    frame->AddFrame(tab2,   laytab2);
+
+    CreateDirListMenu(tab1);
     CreateDirListBox(tab2);
 
     fList->Add(laytab1);
     fList->Add(laytab2);
-    fList->Add(tab1a);
-    fList->Add(tab1b);
+    fList->Add(tab1);
     fList->Add(tab2);
-    fList->Add(layentry);
+    fList->Add(layfilter);
     fList->Add(fEntry);
+    fList->Add(filter);
 }
 
@@ -279,5 +290,5 @@
     fInputFile[0] = '\0';
 
-    fList = new TList;
+    fList = new MGList;
     fList->SetOwner();
 
@@ -331,8 +342,4 @@
 MBrowser::~MBrowser()
 {
-    fClient->FreePicture(fPic1);
-    fClient->FreePicture(fPic2);
-    fClient->FreePicture(fPic3);
-
     delete fList;
 } 
@@ -412,5 +419,8 @@
 
     const char *dir = fFileCont->GetDirectory();
-    fDir->Update(dir);
+
+    TGFSComboBox *cbox = (TGFSComboBox*)fList->FindWidget(kCBDirectory);
+    if (cbox)
+        cbox->Update(dir);
 }
 
@@ -454,4 +464,61 @@
     *slash = '\0';
     ChangeDir(fname);
+}
+
+void MBrowser::SetDir()
+{
+    TGFSComboBox *cbox = (TGFSComboBox*)fList->FindWidget(kCBDirectory);
+    if(!cbox)
+        return;
+
+    const TGTreeLBEntry *entry = (TGTreeLBEntry*)cbox->GetSelectedEntry();
+
+    ChangeDir(entry->GetPath()->GetString());
+}
+
+void MBrowser::SetFilter()
+{
+    //
+    // Try to get widget from list
+    //
+    TGComboBox *filter = (TGComboBox*)fList->FindWidget(kCBFilter);
+    if (!filter)
+        return;
+
+    //
+    // Get the selected text from the list box
+    //
+    const TGTextLBEntry *selected = (TGTextLBEntry*)filter->GetListBox()->GetSelectedEntry();
+
+    const char *txt = StrDup(selected->GetText()->GetString());
+
+    //
+    // find filter and remove leading spaces
+    //
+    char *lt = strchr(txt, '<');
+    if (lt)
+    {
+        do *lt-- = '\0';
+        while (lt>txt && *lt==' ');
+
+        //
+        // Set new filter and refresh the file container
+        //
+        fFileCont->SetFilter(txt);
+        fFileCont->DisplayDirectory();
+    }
+
+    delete [] txt;
+}
+
+void MBrowser::SetViewMode(const Int_t mode)
+{
+    fFileView->SetViewMode(mode ? kLVList : kLVDetails);
+
+    TGButton *but = (TGButton*)fList->FindWidget(mode);
+    if(!but)
+        return;
+
+    but->SetState(kButtonUp);
 }
 
@@ -498,11 +565,6 @@
 
             case kButListMode:
-                fFileView->SetViewMode(kLVList);
-                fDetail->SetState(kButtonUp);
-                return kTRUE;
-
             case kButDetailMode:
-                fFileView->SetViewMode(kLVDetails);
-                fListMode->SetState(kButtonUp);
+                SetViewMode(parm1);
                 return kTRUE;
             }
@@ -510,8 +572,13 @@
 
         case kCM_COMBOBOX:
-            if (parm1 != kCBDirectory)
-                return kTRUE;
-
-            ChangeDir(((TGTreeLBEntry*)fDir->GetSelectedEntry())->GetPath()->GetString());
+            switch (parm1)
+            {
+            case kCBDirectory:
+                SetDir();
+                return kTRUE;
+            case kCBFilter:
+                SetFilter();
+                return kTRUE;
+            }
             return kTRUE;
         }
Index: /trunk/MagicSoft/Mars/mmain/MBrowser.h
===================================================================
--- /trunk/MagicSoft/Mars/mmain/MBrowser.h	(revision 1085)
+++ /trunk/MagicSoft/Mars/mmain/MBrowser.h	(revision 1086)
@@ -10,5 +10,5 @@
 #endif
 
-class TList;
+class MGList;
 class TGTab;
 class TGListView;
@@ -24,17 +24,8 @@
     TGTab            *fTabs;
 
-    TGFSComboBox     *fDir;
     TGTextEntry      *fEntry;
-
-    TGPictureButton  *fCdup;
-    TGPictureButton  *fListMode;
-    TGPictureButton  *fDetail;
 
     TGFileContainer  *fFileCont;
     TGListView       *fFileView;
-
-    const TGPicture  *fPic1;
-    const TGPicture  *fPic2;
-    const TGPicture  *fPic3;
 
     void CreateMenuBar();
@@ -47,6 +38,10 @@
     void SetFileName(const char *name);
 
+    void SetFilter();
+    void SetDir();
+    void SetViewMode(const Int_t mode);
+
 protected:
-    TList  *fList; 
+    MGList *fList;
     Char_t  fInputFile[256];
 
Index: /trunk/MagicSoft/Mars/mmain/MCameraDisplay.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmain/MCameraDisplay.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mmain/MCameraDisplay.cc	(revision 1086)
@@ -28,4 +28,5 @@
 #include <TGButton.h>  // TGTextButton
 
+#include "MGList.h"
 #include "MGCamDisplay.h"
 
@@ -33,5 +34,5 @@
 
 enum {
-    M_BUTTON_DISP
+    kButDisplay = 0x100
 };
 
@@ -46,5 +47,5 @@
 : MBrowser(main, p, w, h)
 {
-    TGTextButton *disp = new TGTextButton(fTop2, "Display Events", M_BUTTON_DISP);
+    TGTextButton *disp = new TGTextButton(fTop2, "Display Events", kButDisplay);
     fList->Add(disp);
 
@@ -79,5 +80,5 @@
     switch (parm1)
     {
-    case M_BUTTON_DISP:
+    case kButDisplay:
         if (!InputFileSelected())
         {
@@ -88,5 +89,5 @@
         switch (parm1)
         {
-        case M_BUTTON_DISP:
+        case kButDisplay:
             new MGCamDisplay(fInputFile,
                              fClient->GetRoot(), this, 600, 500);
Index: /trunk/MagicSoft/Mars/mmain/MDataCheck.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmain/MDataCheck.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mmain/MDataCheck.cc	(revision 1086)
@@ -28,9 +28,10 @@
 #include <TGButton.h>  // TGTextButton
 
+#include "MGList.h"
+#include "MFillH.h"
 #include "MParList.h"
 #include "MTaskList.h"
 #include "MEvtLoop.h"
 #include "MReadTree.h"
-#include "MFillH.h"
 #include "MGDisplayAdc.h"
 
@@ -40,8 +41,8 @@
 
 enum {
-    kButPedAdc,
-    kButEvtAdc,
-    kButPedTdc,
-    kButEvtTdc
+    kButPedAdc = 0x100,
+    kButEvtAdc = 0x101,
+    kButPedTdc = 0x102,
+    kButEvtTdc = 0x103
 };
 
Index: /trunk/MagicSoft/Mars/mmain/MEvtDisp.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmain/MEvtDisp.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mmain/MEvtDisp.cc	(revision 1086)
@@ -28,4 +28,5 @@
 #include <TGButton.h>       // TGTextButton
 
+#include "MGList.h"
 #include "MGFadcDisp.h"
 
@@ -33,7 +34,7 @@
 
 enum {
-  M_BUT_DISP1_EVT,
-  M_BUT_DISP1_PED,
-  M_BUT_DISP1_CAL
+  kButDispEvt          = 0x100,
+  kButDispPedestal     = 0x101,
+  kButDispCalibration  = 0x102
 };
 
@@ -42,7 +43,7 @@
 : MBrowser(main, p, w, h)
 {
-    TGTextButton *fadcevt = new TGTextButton(fTop1, "FADC Disp for Events",  M_BUT_DISP1_EVT);
-    TGTextButton *fadcped = new TGTextButton(fTop1, "FADC Disp for PedEvts", M_BUT_DISP1_PED);
-    TGTextButton *fadccal = new TGTextButton(fTop1, "FADC Disp for CalEvts", M_BUT_DISP1_CAL);
+    TGTextButton *fadcevt = new TGTextButton(fTop1, "FADC Disp for Events",  kButDispEvt);
+    TGTextButton *fadcped = new TGTextButton(fTop1, "FADC Disp for PedEvts", kButDispPedestal);
+    TGTextButton *fadccal = new TGTextButton(fTop1, "FADC Disp for CalEvts", kButDispCalibration);
 
     fadcevt->Associate(this);
@@ -82,7 +83,7 @@
     switch (parm1)
     {
-    case M_BUT_DISP1_EVT:
-    case M_BUT_DISP1_PED:
-    case M_BUT_DISP1_CAL:
+    case kButDispEvt:
+    case kButDispPedestal:
+    case kButDispCalibration:
         if (!InputFileSelected())
         {        
@@ -93,15 +94,15 @@
         switch (parm1)
         {
-        case M_BUT_DISP1_EVT:
+        case kButDispEvt:
             new MGFadcDisp(fInputFile, "Events",
                            fClient->GetRoot(), this, 600, 500);
             return kTRUE;
 
-        case M_BUT_DISP1_PED:
+        case kButDispPedestal:
             new MGFadcDisp(fInputFile , "PedEvts",
                            fClient->GetRoot(), this, 600, 500);
             return kTRUE;
 
-        case M_BUT_DISP1_CAL:
+        case kButDispCalibration:
             new MGFadcDisp(fInputFile , "CalEvts",
                            fClient->GetRoot(), this, 600, 500);
Index: /trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc	(revision 1085)
+++ /trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc	(revision 1086)
@@ -35,17 +35,19 @@
 #include <TGButtonGroup.h>  // TGVButtonGroup
 
+#include "MGList.h"
+
 ClassImp(MMonteCarlo)
 
 enum {
-    M_BUTTON_COLAREA,
-    M_BUTTON_RATE,
-    M_BUTTON_THRESHOLD
+    kButCollArea  = 0x100,
+    kButTrigRate  = 0x101,
+    kButThreshold = 0x102
 };
 
 void MMonteCarlo::AddButtons()
 {
-    TGTextButton *carea = new TGTextButton(fTop2, "Collection Area", M_BUTTON_COLAREA);
-    TGTextButton *trate = new TGTextButton(fTop2, "Trigger Rate",    M_BUTTON_RATE);
-    TGTextButton *thold = new TGTextButton(fTop2, "Threshold",       M_BUTTON_THRESHOLD);
+    TGTextButton *carea = new TGTextButton(fTop2, "Collection Area", kButCollArea);
+    TGTextButton *trate = new TGTextButton(fTop2, "Trigger Rate",    kButTrigRate);
+    TGTextButton *thold = new TGTextButton(fTop2, "Threshold",       kButThreshold);
 
     fList->Add(carea);
@@ -492,13 +494,13 @@
         switch (parm1)
         {
-        case M_BUTTON_COLAREA:
+        case kButCollArea:
             CalculateCollectionArea();
             return kTRUE;
 
-        case M_BUTTON_RATE:
+        case kButTrigRate:
             CalculateTriggerRate();
             return kTRUE;
 
-        case M_BUTTON_THRESHOLD:
+        case kButThreshold:
             CalculateThreshold();
             return kTRUE;
