Index: trunk/MagicSoft/Mars/mmain/MAnalysis.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 1082)
+++ 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 1082)
+++ 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 1082)
+++ 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 1082)
+++ 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 1082)
+++ 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 1082)
+++ 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 1082)
+++ 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;
