Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 586)
+++ trunk/MagicSoft/Mars/Changelog	(revision 587)
@@ -1,3 +1,24 @@
                                                                   -*-*- END -*-*-
+ 
+ 2000/01/23: Harald Kornmayer
+
+   *  the integration of the class FadcDisp in the mars enviroment
+      and further developments in the display
+
+      changed: 
+	meventdisp/MGFadcDisp.h
+	meventdisp/MGFadcDisp.cc
+	mgui/GuiIncl.h
+	mgui/GuiLinkDef.h
+	mgui/MGMarsMain.cc
+	mgui/MGPrototyp.cc
+	mgui/MGPrototyp.h
+	mgui/Makefile
+
+      added: 
+	mgui/MGEventDispMain.h
+	mgui/MGEventDispMain.cc
+
+
  2000/01/22: Harald Kornmayer
 
Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 586)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 587)
@@ -83,6 +83,7 @@
   fTop2->AddFrame( fLabelEvtNr, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 
 
-  fTxtEvtNr = new TGTextEntry(fTop2, fTxtBufEvtNr = new TGTextBuffer(100), 9999 );
+  fTxtEvtNr = new TGTextEntry(fTop2, fTxtBufEvtNr = new TGTextBuffer(100), M_EVTNUMBER);
   fTxtEvtNr->Resize(60, fTxtEvtNr->GetDefaultHeight());
+  fTxtEvtNr->Associate(this) ; 
   fTop2->AddFrame(fTxtEvtNr, new TGLayoutHints(kLHintsTop | kLHintsLeft,
                                                        5, 5, 5, 5)); 
@@ -171,8 +172,10 @@
  
   
-  fButtonPrint = new TGTextButton(fFrameLow, "Print", 9999) ; 
+  fButtonPrint = new TGTextButton(fFrameLow, "Print", M_PRINT) ; 
+  fButtonPrint->Associate(this) ; 
   fFrameLow->AddFrame( fButtonPrint, new TGLayoutHints(kLHintsLeft , 10, 10, 10, 10 ) )  ; 
 
-  fButtonClose = new TGTextButton(fFrameLow, "Close", 9999) ; 
+  fButtonClose = new TGTextButton(fFrameLow, "Close", M_CLOSE) ; 
+  fButtonClose->Associate(this) ; 
   fFrameLow->AddFrame( fButtonClose, new TGLayoutHints(kLHintsLeft, 10, 10, 10, 10 ) )  ; 
 
@@ -210,12 +213,27 @@
 MGFadcDisp::~MGFadcDisp()
 {
+  // close the file 
+
+  readin->PostProcess() ; 
+
+  delete  runheader ; 
+  delete  evtheader ; 
+  delete  evttime   ; 
+  delete  evtdata ; 
+  delete  evtcrate  ; 
+
+  delete  plist ;
+
+  delete  readin ; 
+
+  //   destruct the graphical members  
 
   delete  fButtonPrint ; 
   delete  fButtonClose ; 
-
-  delete  fCan ; 
+ 
+  //  delete  fCan ; 
   delete  fECanDigScope ; 
   delete  fTabDisplay ; 
-
+ 
   delete  fPixSlider ; 
   delete  fButtonPrevPix ; 
@@ -224,9 +242,9 @@
   delete  fPixelList; 
   delete  fTabControl  ; 
-
+ 
   delete  fLabelEvtNr ; 
   delete  fLabelTotNr ; 
+  //delete  fTxtBufEvtNr ; 
   delete  fTxtEvtNr ; 
-  delete  fTxtBufEvtNr ; 
   delete  fButtonNextEvt ; 
   delete  fButtonPrevEvt ; 
@@ -237,5 +255,5 @@
   delete  fTop2 ; 
   delete  fTop1 ; 
-
+  
   delete  fFrameLow ; 
   delete  fLineSep2 ; 
@@ -246,4 +264,15 @@
 
 
+void MGFadcDisp::CloseWindow()
+{
+   // Got close message for this MainFrame. Calls parent CloseWindow()
+   // (which destroys the window) and terminate the application.
+   // The close message is generated by the window manager when its close
+   // window menu item is selected.
+
+  delete this ;
+}
+       
+
 void MGFadcDisp::CreatePixelList() {
   //
@@ -260,6 +289,4 @@
   redraw = fPixelList->GetSelected() ; 
   
-  cout << "redraw: " << redraw << endl ; 
-
   fPixelList->RemoveEntries(0, fPixelsinList) ; 
   fPixelsinList = 0 ; 
@@ -338,4 +365,5 @@
   		 "The event number is out of range!!!",
   		 kMBIconExclamation, buttons, &retval); 
+    UpdateEventCounter() ; 
     return ; 
   }
@@ -364,4 +392,5 @@
   //------------------------------------------------------------------
   char wortdummy[256] ; 
+  Int_t   buttons = 4, retval = 0 ;
 
   switch(GET_MSG(msg)) 
@@ -387,5 +416,18 @@
 
 	      break; 
+
+
+	    case M_PRINT:
+	      new TGMsgBox(fClient->GetRoot(), this,
+			   "INFORMATION!",
+			   "Your are invited to program that!!",
+			   kMBIconExclamation, buttons, &retval); 
 	      
+	      break ; 
+	    case M_CLOSE:
+
+	      CloseWindow() ; 
+	      break; 
+
 	    }
 	  
@@ -410,4 +452,27 @@
 	  
 	}
+    
+    case kC_TEXTENTRY:
+      
+      switch(GET_SUBMSG(msg)) 
+	{
+	case kTE_TEXTCHANGED:
+	  
+	  break ; 
+	case kTE_ENTER:
+	  
+	  sprintf(wortdummy, "%s",  fTxtEvtNr->GetText()) ; 
+	  cout << wortdummy<< endl  ; 
+	  
+	  cout << atoi(wortdummy) << endl ; 
+	  
+	  
+	  ReadinEvent( atoi(wortdummy) ) ; 
+
+	  break; 
+	}
+      
+      break; 
+      
     default:
       break;     
Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h	(revision 586)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h	(revision 587)
@@ -34,5 +34,12 @@
   M_PIXELLIST = 4201 , 
   M_PREVEVT, 
-  M_NEXTEVT 
+  M_NEXTEVT,
+  M_EVTNUMBER, 
+
+  M_PREVPIXEL, 
+  M_NEXTPIXEL, 
+
+  M_PRINT, 
+  M_CLOSE 
   
 
@@ -104,4 +111,6 @@
   ~MGFadcDisp()  ; 
 
+  void CloseWindow() ; 
+
   void CreatePixelList() ; 
   void UpdateEventCounter() ; 
Index: trunk/MagicSoft/Mars/mgui/GuiIncl.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/GuiIncl.h	(revision 586)
+++ trunk/MagicSoft/Mars/mgui/GuiIncl.h	(revision 587)
@@ -9,4 +9,7 @@
 #include <TGSplitter.h>     // TGHorizontal3DLine
 #include <TGFSContainer.h>  // TGFileContainer
+#include <TGLabel.h>       // TGLabel
+#include <TGTextEntry.h>  
+
 
 #endif // __CINT__
Index: trunk/MagicSoft/Mars/mgui/GuiLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/GuiLinkDef.h	(revision 586)
+++ trunk/MagicSoft/Mars/mgui/GuiLinkDef.h	(revision 587)
@@ -6,4 +6,5 @@
 
 #pragma link C++ class MGMarsMain;
+#pragma link C++ class MGEventDispMain;
 #pragma link C++ class MGDataCheckMain;
 #pragma link C++ class MGMonteCarloMain;
Index: trunk/MagicSoft/Mars/mgui/MGEventDispMain.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGEventDispMain.cc	(revision 587)
+++ trunk/MagicSoft/Mars/mgui/MGEventDispMain.cc	(revision 587)
@@ -0,0 +1,492 @@
+#include "MGEventDispMain.h"
+
+#include <TSystem.h>        // gSystem
+
+#include <TGTab.h>          // TGTab
+#include <TGMenu.h>         // TGPopupMenu
+#include <TGButton.h>       // TGTextButton
+#include <TGMsgBox.h>       // TGMsgBox
+#include <TGListBox.h>      // TGListBox
+#include <TGFSContainer.h>  // TGFileContainer
+#include <TGSplitter.h>    // TGHorizontal3DLine
+#include <TGTextEntry.h> 
+#include <TGLabel.h>       // TGLabel
+
+#include "MGFadcDisp.h"
+
+// FIXME: Move to MAGIC.h
+#define S_ISDIR(m) (((m)&(0170000)) == (0040000))  
+
+ClassImp(MGEventDispMain)
+
+enum CommandEventDispMain {
+  M_FILE_CLOSE , 
+  M_BUT_DISP1_EVT, 
+  M_BUT_DISP1_PED, 
+  M_BUT_DISP1_CAL, 
+
+  M_FILERESET, 
+  M_PBUTTON_CDIR_UP, 
+  M_PBUTTON_LIST_MODE, 
+  M_PBUTTON_DETAIL_MODE 
+} ; 
+
+
+MGEventDispMain::MGEventDispMain(const TGWindow *p, const TGWindow *main, 
+                            UInt_t w, UInt_t h ) 
+        : TGTransientFrame(p, main, w, h ) 
+{
+  //
+  //    Main window to controll the october test
+  //
+
+  //    set non-gui members to starting values 
+
+  sprintf ( fInputFile, "\n" ) ; 
+
+  //
+  //    First create the MenuBar.   
+  //
+
+  //     Layout objects for menue. 
+
+  fLayMenuBar = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2 ) ; 
+  fLayMenuItem = new TGLayoutHints ( kLHintsTop | kLHintsLeft , 0, 4, 0, 0 ) ; 
+  
+  //  crate the menu bar
+
+  fFileMenu = new TGPopupMenu ( fClient->GetRoot() ) ; 
+  fFileMenu->AddEntry ("Close", M_FILE_CLOSE ) ; 
+  fFileMenu->Associate(this) ; 
+  
+  //  the button messages are handled by main frame (this) 
+
+  fMenuBar = new TGMenuBar ( this, 1, 1, kHorizontalFrame ) ; 
+  fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem ) ;   
+  AddFrame(fMenuBar, fLayMenuBar ) ; 
+  
+  fLineSep1 = new TGHorizontal3DLine(this) ; 
+  AddFrame(fLineSep1, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
+
+  
+  //
+  //    Create the top window with a lot of buttons 
+  //
+
+  fFrameTop = new TGCompositeFrame (this, 300,100, kVerticalFrame ) ; 
+  
+  fTop1 = new TGHorizontalFrame (fFrameTop, 300, 100 ) ; 
+
+  fButFadcDispEvts = new TGTextButton(fTop1, "FADC Disp for Events", M_BUT_DISP1_EVT );
+  fButFadcDispEvts->Associate(this) ;   
+  fTop1->AddFrame (fButFadcDispEvts, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
+  
+  fButFadcDispPed  = new TGTextButton(fTop1, "FADC Disp for PedEvts", M_BUT_DISP1_PED );
+  fButFadcDispPed->Associate(this) ;   
+  fTop1->AddFrame (fButFadcDispPed, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
+  
+  fButFadcDispCal  = new TGTextButton(fTop1, "FADC Disp for CalEvts", M_BUT_DISP1_CAL );
+  fButFadcDispCal->Associate(this) ;   
+  fTop1->AddFrame (fButFadcDispCal, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
+  
+  
+
+  fFrameTop->AddFrame (fTop1, new TGLayoutHints(kLHintsCenterX, 10, 10, 5, 5) );
+
+  AddFrame(fFrameTop, new TGLayoutHints (kLHintsTop ) ) ;   
+
+  //   a line between top and low frame
+  
+  fLineSep2 = new TGHorizontal3DLine(this) ; 
+  AddFrame(fLineSep2, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
+
+  //
+  //    Create the low window with a tabs in it
+  //
+
+  fFrameLow = new TGCompositeFrame (this, 300,100, kHorizontalFrame ) ; 
+  
+  fLayTab = new TGLayoutHints ( kLHintsExpandX   , 5, 5, 5, 5 ) ;
+
+  //    create the first tab
+
+  fTab = new TGTab ( fFrameLow, 400, 400 ) ;   
+
+  TGCompositeFrame *tf = fTab->AddTab("Input File") ; 
+  
+  fTabF1 = new TGCompositeFrame (tf, 100, 100, kHorizontalFrame) ; 
+  //  tf->AddFrame(fTabF1, fLayTab ) ; 
+
+  fTabF1a = new TGCompositeFrame (tf, 100, 100, kHorizontalFrame) ; 
+  tf->AddFrame(fTabF1a,  new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ; 
+
+  fTabF1b = new TGCompositeFrame (tf, 100, 100, kHorizontalFrame) ; 
+  tf->AddFrame(fTabF1b,  new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ; 
+
+  fTabF1c = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ; 
+  //  tf->AddFrame(fTabF1c,  new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY  , 5, 5, 5, 5 ) ) ; 
+  tf->AddFrame(fTabF1c,  new TGLayoutHints ( kLHintsExpandX | kLHintsExpandY  , 5, 5, 5, 5 ) ) ; 
+  
+  //   the items in the first subframe
+
+  fLabFileName = new TGLabel(fTabF1a, new TGString("selected File:") );
+  fTabF1a->AddFrame( fLabFileName, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 
+
+  fTxtFileName = new TGTextEntry(fTabF1a, fTxtBufFileName = new TGTextBuffer(100) );
+  fTxtFileName->Resize(60, fTxtFileName->GetDefaultHeight());
+  fTabF1a->AddFrame(fTxtFileName, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5)); 
+
+  fButFileReset = new TGTextButton (fTabF1a, "Reset", M_FILERESET ) ;
+  fButFileReset->Associate(this) ; 
+  fTabF1a->AddFrame (fButFileReset, new TGLayoutHints (kLHintsRight, 10, 10, 10, 10  ) ) ; 
+  
+  
+  
+  //   the items in the second subfraem
+
+  fLabDir = new TGLabel(fTabF1b, new TGString("Directory:") );
+  fTabF1b->AddFrame( fLabDir, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 
+
+  fDir = new TGListBox(fTabF1b, -1) ; 
+  fDir->Resize(350,20) ;
+  char temp[100] ; 
+  //  sprintf ( temp, "%s", START_DIRECTORY ) ; 
+  sprintf ( temp, "%s", gSystem->WorkingDirectory()  ) ; 
+  fDir->AddEntry(temp, 1) ; 
+  fTabF1b->AddFrame( fDir, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ; 
+
+
+  fPicCdup = fClient->GetPicture("tb_uplevel.xpm") ; 
+  fCdup = new TGPictureButton(fTabF1b, fPicCdup, M_PBUTTON_CDIR_UP ) ; 
+  fCdup->SetToolTipText("One Level up!") ; 
+  fCdup->Associate(this) ; 
+  fTabF1b->AddFrame (fCdup, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ; 
+
+  fPicList = fClient->GetPicture("tb_list.xpm") ; 
+  fListMode = new TGPictureButton(fTabF1b, fPicList, M_PBUTTON_LIST_MODE ) ; 
+  fListMode->SetToolTipText("List Mode") ; 
+  fListMode->Associate(this) ; 
+  fListMode->SetState(kButtonUp) ; 
+  fListMode->AllowStayDown(kTRUE) ; 
+  fListMode->AllowStayDown(kTRUE) ;  fTabF1b->AddFrame (fListMode, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ;
+
+  fPicDetail = fClient->GetPicture("tb_details.xpm") ; 
+  fDetail = new TGPictureButton(fTabF1b, fPicDetail, M_PBUTTON_DETAIL_MODE ) ; 
+  fDetail->SetToolTipText("Details Mode") ; 
+  fDetail->Associate(this) ; 
+  fDetail->SetState(kButtonEngaged) ; 
+  fDetail->AllowStayDown(kTRUE) ; 
+  fTabF1b->AddFrame (fDetail, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ; 
+
+  // the items in the third subframe
+
+  fFileView = new TGListView(fTabF1c, 540, 380 ) ; 
+  fFileCont = new TGFileContainer(fFileView->GetViewPort(), 100, 100,
+				  kVerticalFrame, fgWhitePixel) ; 
+
+  fFileCont->Associate(this) ; 
+  fFileView->GetViewPort()->SetBackgroundColor(fgWhitePixel) ; 
+  fFileView->SetContainer(fFileCont) ; 
+  fFileCont->SetFilter("*") ; 
+  //  fFileCont->ChangeDirectory(START_DIRECTORY) ; 
+  fFileCont->ChangeDirectory(gSystem->WorkingDirectory()) ; 
+  fFileView->SetViewMode(kLVDetails); 
+  fFileCont->Sort(kSortByName) ; 
+  
+  fTabF1c->AddFrame(fFileView, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5) ) ; 
+
+  tf->AddFrame(fTabF1, fLayTab) ;
+ 
+  fFrameLow->AddFrame ( fTab, new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5) ); 
+
+  AddFrame(fFrameLow, new TGLayoutHints (kLHintsExpandX|kLHintsExpandY) ) ; 
+
+  //
+  //   Map the window, set up the layout, etc. 
+  //
+
+  SetWMSizeHints(200, 250, 1000, 1000, 10, 10 ) ;      // set the smallest and biggest size of the Main frame
+
+  MapSubwindows();
+  
+  Layout();
+  
+  SetWindowName("EventDispMain");
+  SetIconName("EventDispMain");
+  
+  MapWindow();
+
+} 
+
+
+// ======================================================================
+// ======================================================================
+
+MGEventDispMain::~MGEventDispMain()
+{
+  //delete  fPicCdup, fPicList, fPicDetail; 
+  
+    delete fLayTab;
+    delete fLayMenuBar;
+    delete fLayMenuItem;
+
+    delete fFileView;
+    delete fFileCont;
+
+    delete fCdup;
+    delete fListMode;
+    delete fDetail;
+    delete fDir ;
+    delete fLabDir ; 
+
+    delete fButFileReset ; 
+    delete fTxtFileName  ; 
+    delete fLabFileName  ; 
+    
+    delete fTabF1c;
+    delete fTabF1b;
+    delete fTabF1a;
+    delete fTabF1;
+
+    delete fButFadcDispCal; 
+    delete fButFadcDispPed; 
+    delete fButFadcDispEvts; 
+    delete fTop1;
+    delete fTab;
+
+    delete fLineSep2 ; 
+    delete fLineSep1 ; 
+
+    delete fFrameTop;
+    delete fFrameLow;
+
+    delete fFileMenu;
+    delete fMenuBar;
+} 
+
+
+// ======================================================================
+// ======================================================================
+
+void MGEventDispMain::CloseWindow()
+{
+   // Got close message for this MainFrame. Calls parent CloseWindow()
+   // (which destroys the window) and terminate the application.
+   // The close message is generated by the window manager when its close
+   // window menu item is selected.
+
+  delete this ; 
+}
+
+
+// ======================================================================
+// ======================================================================
+
+Bool_t MGEventDispMain::InputFileSelected() 
+{
+  //   Checks if there is a selected input root file
+   
+  if ( strcmp ( fInputFile, "\n") == 0 )
+    { 
+      return ( kFALSE ) ; 
+    } 
+  
+  return (kTRUE) ; 
+} 
+
+
+// ======================================================================
+// ======================================================================
+
+Bool_t MGEventDispMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
+{     
+  // Process events generated by the buttons in the frame.
+  
+  Int_t   buttons = 4, retval = 0 ; 
+  Char_t  wort[100] ;
+  Char_t  extens[5] ;
+  Char_t  command[110] ;
+ 
+  TGFileItem *item ;     // to process items in the file view container
+  void *np = NULL ;      // null pointer
+
+  switch (GET_MSG(msg)) 
+    {
+    case kC_COMMAND:
+      switch (GET_SUBMSG(msg)) 
+	{
+	case kCM_BUTTON:
+	  
+	  switch (parm1)
+	    {  
+
+	    case M_BUT_DISP1_EVT:
+	      	
+	      if ( InputFileSelected() == kFALSE ) {              // it is not selected
+		
+		new TGMsgBox(fClient->GetRoot(), this, "ERROR!", 
+			     "No Input (root) File selected!", kMBIconExclamation, buttons, &retval);
+		break ; 
+	      }      
+	      
+	      new MGFadcDisp( fInputFile , "Events", 
+			      fClient->GetRoot(), this, 600, 500 ) ; 
+	      break ; 
+		
+	    case M_BUT_DISP1_PED:
+	      	
+	      if ( InputFileSelected() == kFALSE ) {              // it is not selected
+		
+		new TGMsgBox(fClient->GetRoot(), this, "ERROR!", 
+			     "No Input (root) File selected!", kMBIconExclamation, buttons, &retval);
+		break ; 
+	      }      
+	      new MGFadcDisp( fInputFile , "PedEvts", 
+			      fClient->GetRoot(), this, 600, 500 ) ; 
+	      break ; 
+
+	    case M_BUT_DISP1_CAL:
+	      
+	      if ( InputFileSelected() == kFALSE ) {              // it is not selected
+		new TGMsgBox(fClient->GetRoot(), this, "ERROR!", 
+			     "No Input (root) File selected!", kMBIconExclamation, buttons, &retval);
+		break ; 
+	      }      
+	      
+	      new MGFadcDisp( fInputFile , "CalEvts", 
+			      fClient->GetRoot(), this, 600, 500 ) ; 
+	      break ; 
+		
+	    case M_FILERESET:
+	      
+	      sprintf ( fInputFile, "\n" ) ; 
+	      fTxtFileName->SetText( fInputFile ) ; 
+	      
+	      break; 
+
+	    case M_PBUTTON_CDIR_UP :
+
+	      //  goto the parent directory
+	      
+	      gSystem->ChangeDirectory("..") ; 
+	      fDir->RemoveEntry(1) ; 
+	      sprintf (wort, "%s", gSystem->WorkingDirectory() ) ; 
+	      fDir->AddEntry(wort,1) ; 
+	      fDir->MapSubwindows() ; 
+	      fDir->Layout() ; 
+	      fFileCont->ChangeDirectory( wort ) ; 
+	      fFileCont->DisplayDirectory() ; 
+	      
+	      break ; 
+	    
+	    case M_PBUTTON_LIST_MODE:
+	      fFileView->SetViewMode(kLVList) ; 
+	      fDetail->SetState(kButtonUp) ; 
+	      
+	      break ; 
+	      
+	    case M_PBUTTON_DETAIL_MODE:
+	      fFileView->SetViewMode(kLVDetails) ; 
+	      fListMode->SetState(kButtonUp) ; 
+	      
+	      break ;
+	      
+	    default:
+	      break ;
+	    } 
+
+	case kCM_MENU:
+
+	  switch (parm1) {
+	  case M_FILE_CLOSE:
+	    CloseWindow() ; 
+
+	    break; 
+	  }
+	  break ;
+	  
+	default:
+	  break ;
+	  
+	}
+      
+    case kC_CONTAINER: 
+      switch (GET_SUBMSG(msg)) {
+	
+	//      case kCT_ITEMCLICK:
+	// 	printf ("itemclick\n"); 
+	//      break; 
+	
+      
+      case kCT_ITEMDBLCLICK: 
+	//
+	//  process the double click in the file view container
+	//
+	
+	if ( parm1 == kButton1) {
+	  if ( fFileCont->NumSelected() == 1 ) {   
+	    //
+	    //  one file selected
+	    //	  
+	    item = (TGFileItem *) fFileCont->GetNextSelected(&np) ; 
+	    
+	    if ( S_ISDIR(item->GetType()) )   // file is directory
+	      {  
+		//  goto directory 
+		
+		sprintf (wort, "%s", item->GetItemName()->GetString()) ;
+		fFileCont->ChangeDirectory ( wort ) ; 
+		gSystem->ChangeDirectory( wort ) ; 
+		
+		sprintf (wort, "%s", gSystem->WorkingDirectory() ) ; 
+		fDir->RemoveEntry(1) ; 
+		fDir->AddEntry( wort, 1 ) ; 
+		fDir->MapSubwindows() ; 
+		fDir->Layout() ; 
+	      }
+	    else                              // file is no directory, is a file 
+	      { 
+		sprintf (wort, "%s", item->GetItemName()->GetString() ) ; 
+	    
+		//    determine the file type by extensions
+		
+		for (Int_t i = 0 ; i<5; i++) 
+		  extens[i] = '\0' ; 
+		
+		for ( Int_t i=0; wort[i] != '\0'; i++) {
+		  if ( wort[i] == '.') {
+		    strncpy (extens, &wort[i+1], 4 ) ; 
+		    break ; 
+		  }
+		}
+		
+		if ( ! strcmp(extens, "ps") ) {              //     postscript file
+		  sprintf ( command, "gv %s/%s &", 
+			    gSystem->WorkingDirectory(), 
+			    wort ) ; 
+		  gSystem->Exec(command) ; 
+		  break ; 
+		}
+		else if  ( ! strcmp(extens, "root") ) {      //     root file
+		  sprintf ( fInputFile, "%s/%s" , gSystem->WorkingDirectory(), wort ) ;  
+		  fTxtFileName->SetText( fInputFile ) ;
+
+		  break ; 
+		}
+		
+	      } 
+	  }
+	}
+	break; 
+	
+      default:
+	break ;
+      }
+      
+      
+      
+    default:
+      break;
+    }
+  return kTRUE;
+} 
Index: trunk/MagicSoft/Mars/mgui/MGEventDispMain.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGEventDispMain.h	(revision 587)
+++ trunk/MagicSoft/Mars/mgui/MGEventDispMain.h	(revision 587)
@@ -0,0 +1,105 @@
+#ifndef MGEVENTDISPMAIN_H
+#define MGEVENTDISPMAIN_H
+
+#ifndef MAGIC_H
+#include "MAGIC.h"
+#endif
+
+#ifndef ROOT_TGFrame
+#include <TGFrame.h>
+#endif
+
+
+class TGMenuBar;
+class TGPopupMenu;
+class TGTab;
+class TGTextButton;
+class TGListBox;
+class TGPictureButton;
+class TGFileContainer;
+class TGListView;
+class TGHorizontal3DLine;
+class TGLabel ; 
+class TGTextEntry ; 
+class TGTextBuffer; 
+
+class MGEventDispMain : public TGTransientFrame {
+ private:
+  
+  //
+  // Create a main frame with a number of different buttons.
+  //
+
+  //   some member not connected with Gui 
+  
+  Char_t            fInputFile[256] ; 
+
+  //  the things for the menu bar 
+    
+  TGMenuBar         *fMenuBar ; 
+  TGPopupMenu       *fFileMenu ;
+  TGHorizontal3DLine *fLineSep1, *fLineSep2 ; 
+
+
+  //   divide the Window in two different parts
+  
+  TGCompositeFrame  *fFrameTop ;   // top part of the main window
+  TGCompositeFrame  *fFrameLow ;   // low part of the main window
+  TGTab             *fTab      ;   // different tabs in the low window
+  
+  //     the horizontal frame in the top part
+
+  TGHorizontalFrame *fTop1 ; 
+  
+  //   the buttons in the Top Part
+  
+  TGTextButton      *fButFadcDispEvts ; 
+  TGTextButton      *fButFadcDispPed  ; 
+  TGTextButton      *fButFadcDispCal  ; 
+  
+  //   the things in the file selector
+
+  TGCompositeFrame  *fTabF1 ;                       // first tab of low part 
+  TGCompositeFrame  *fTabF1a, *fTabF1b, *fTabF1c ;  // subpart of the file selector in low window
+
+  TGLabel           *fLabFileName ; 
+  TGTextEntry       *fTxtFileName ; 
+  TGTextBuffer      *fTxtBufFileName ; //!
+  TGTextButton      *fButFileReset ; 
+ 
+  TGLabel           *fLabDir ; 
+  TGListBox         *fDir ; 
+  TGPictureButton   *fCdup, *fListMode, *fDetail ; 
+ 
+  TGFileContainer   *fFileCont ; 
+  TGListView        *fFileView ;
+
+  //     Layout hints for different uses 
+   
+  TGLayoutHints     *fLayMenuBar, *fLayMenuItem ; 
+  TGLayoutHints     *fLayTab ; 
+  
+  //     some icons and pictures often used
+  
+  const TGPicture   *fPicCdup;   //!
+  const TGPicture   *fPicList;   //!
+  const TGPicture   *fPicDetail; //!
+  
+ public: 
+  MGEventDispMain(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h) ;
+  
+  ~MGEventDispMain(); 
+  
+  void   CloseWindow()  ; 
+
+  Bool_t InputFileSelected() ; 
+  
+  Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
+
+  ClassDef(MGEventDispMain, 1)
+
+} ; 
+
+#endif
+
+
Index: trunk/MagicSoft/Mars/mgui/MGMarsMain.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGMarsMain.cc	(revision 586)
+++ trunk/MagicSoft/Mars/mgui/MGMarsMain.cc	(revision 587)
@@ -9,4 +9,5 @@
 #include <TGSplitter.h>    // TGHorizontal3DLine
 
+#include "MGEventDispMain.h"
 #include "MGDataCheckMain.h"
 #include "MGMonteCarloMain.h"
@@ -193,9 +194,6 @@
 
 	    case M_BUTTON_EVTDISP:
-
-	      new TGMsgBox(fClient->GetRoot(), this,
-			   "WARNING!", 
-			   "EventDisplay not yet implemented!", 
-			   kMBIconExclamation, buttons, &retval);
+	      
+	      new MGEventDispMain (fClient->GetRoot(), this, 400, 650 ) ; 
 	      break ;
 	      
@@ -205,5 +203,7 @@
 
 	    case M_BUTTON_ANALYSE:
-	      new TGMsgBox(fClient->GetRoot(), this,
+	      //new MGPrototyp(fClient->GetRoot(), this, 400, 650 ) ;
+
+	       new TGMsgBox(fClient->GetRoot(), this,
 			   "WARNING!", 
 			   "Analysis not yet implemented!", 
Index: trunk/MagicSoft/Mars/mgui/MGPrototyp.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGPrototyp.cc	(revision 586)
+++ trunk/MagicSoft/Mars/mgui/MGPrototyp.cc	(revision 587)
@@ -9,4 +9,8 @@
 #include <TGListBox.h>      // TGListBox
 #include <TGFSContainer.h>  // TGFileContainer
+#include <TGSplitter.h>    // TGHorizontal3DLine
+#include <TGTextEntry.h> 
+#include <TGLabel.h>       // TGLabel
+
 
 // FIXME: Move to MAGIC.h
@@ -15,8 +19,9 @@
 ClassImp(MGPrototyp)
 
-enum CommandDataChecker {
+enum CommandPrototyp {
   M_FILE_CLOSE , 
   M_BUTTON_ACTION, 
 
+  M_FILERESET, 
   M_PBUTTON_CDIR_UP, 
   M_PBUTTON_LIST_MODE, 
@@ -58,4 +63,8 @@
   AddFrame(fMenuBar, fLayMenuBar ) ; 
   
+  fLineSep1 = new TGHorizontal3DLine(this) ; 
+  AddFrame(fLineSep1, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
+
+  
   //
   //    Create the top window with a lot of buttons 
@@ -74,4 +83,8 @@
   AddFrame(fFrameTop, new TGLayoutHints (kLHintsTop ) ) ;   
 
+  //   a line between top and low frame
+  
+  fLineSep2 = new TGHorizontal3DLine(this) ; 
+  AddFrame(fLineSep2, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
 
   //
@@ -92,14 +105,35 @@
   //  tf->AddFrame(fTabF1, fLayTab ) ; 
 
-  
   fTabF1a = new TGCompositeFrame (tf, 100, 100, kHorizontalFrame) ; 
   tf->AddFrame(fTabF1a,  new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ; 
 
-  fTabF1b = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ; 
-  //  tf->AddFrame(fTabF1b,  new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY  , 5, 5, 5, 5 ) ) ; 
-  tf->AddFrame(fTabF1b,  new TGLayoutHints ( kLHintsExpandX | kLHintsExpandY  , 5, 5, 5, 5 ) ) ; 
-
-  
-  fDir = new TGListBox(fTabF1a, -1) ; 
+  fTabF1b = new TGCompositeFrame (tf, 100, 100, kHorizontalFrame) ; 
+  tf->AddFrame(fTabF1b,  new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ; 
+
+  fTabF1c = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ; 
+  //  tf->AddFrame(fTabF1c,  new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY  , 5, 5, 5, 5 ) ) ; 
+  tf->AddFrame(fTabF1c,  new TGLayoutHints ( kLHintsExpandX | kLHintsExpandY  , 5, 5, 5, 5 ) ) ; 
+  
+  //   the items in the first subframe
+
+  fLabFileName = new TGLabel(fTabF1a, new TGString("selected File:") );
+  fTabF1a->AddFrame( fLabFileName, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 
+
+  fTxtFileName = new TGTextEntry(fTabF1a, fTxtBufFileName = new TGTextBuffer(256) );
+  fTxtFileName->Resize(60, fTxtFileName->GetDefaultHeight());
+  fTabF1a->AddFrame(fTxtFileName, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5)); 
+
+  fButFileReset = new TGTextButton (fTabF1a, "Reset", M_FILERESET ) ;
+  fButFileReset->Associate(this) ; 
+  fTabF1a->AddFrame (fButFileReset, new TGLayoutHints (kLHintsRight, 10, 10, 10, 10  ) ) ; 
+  
+  
+  
+  //   the items in the second subfraem
+
+  fLabDir = new TGLabel(fTabF1b, new TGString("Directory:") );
+  fTabF1b->AddFrame( fLabDir, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 
+
+  fDir = new TGListBox(fTabF1b, -1) ; 
   fDir->Resize(350,20) ;
   char temp[100] ; 
@@ -107,31 +141,32 @@
   sprintf ( temp, "%s", gSystem->WorkingDirectory()  ) ; 
   fDir->AddEntry(temp, 1) ; 
-  fTabF1a->AddFrame( fDir, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ; 
+  fTabF1b->AddFrame( fDir, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ; 
 
 
   fPicCdup = fClient->GetPicture("tb_uplevel.xpm") ; 
-  fCdup = new TGPictureButton(fTabF1a, fPicCdup, M_PBUTTON_CDIR_UP ) ; 
+  fCdup = new TGPictureButton(fTabF1b, fPicCdup, M_PBUTTON_CDIR_UP ) ; 
   fCdup->SetToolTipText("One Level up!") ; 
   fCdup->Associate(this) ; 
-  fTabF1a->AddFrame (fCdup, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ; 
+  fTabF1b->AddFrame (fCdup, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ; 
 
   fPicList = fClient->GetPicture("tb_list.xpm") ; 
-  fListMode = new TGPictureButton(fTabF1a, fPicList, M_PBUTTON_LIST_MODE ) ; 
+  fListMode = new TGPictureButton(fTabF1b, fPicList, M_PBUTTON_LIST_MODE ) ; 
   fListMode->SetToolTipText("List Mode") ; 
   fListMode->Associate(this) ; 
   fListMode->SetState(kButtonUp) ; 
   fListMode->AllowStayDown(kTRUE) ; 
-  fListMode->AllowStayDown(kTRUE) ;  fTabF1a->AddFrame (fListMode, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ;
+  fListMode->AllowStayDown(kTRUE) ;  fTabF1b->AddFrame (fListMode, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ;
 
   fPicDetail = fClient->GetPicture("tb_details.xpm") ; 
-  fDetail = new TGPictureButton(fTabF1a, fPicDetail, M_PBUTTON_DETAIL_MODE ) ; 
+  fDetail = new TGPictureButton(fTabF1b, fPicDetail, M_PBUTTON_DETAIL_MODE ) ; 
   fDetail->SetToolTipText("Details Mode") ; 
   fDetail->Associate(this) ; 
   fDetail->SetState(kButtonEngaged) ; 
   fDetail->AllowStayDown(kTRUE) ; 
-  fTabF1a->AddFrame (fDetail, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ; 
-
-    
-  fFileView = new TGListView(fTabF1b, 540, 380 ) ; 
+  fTabF1b->AddFrame (fDetail, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ; 
+
+  // the items in the third subframe
+
+  fFileView = new TGListView(fTabF1c, 540, 380 ) ; 
   fFileCont = new TGFileContainer(fFileView->GetViewPort(), 100, 100,
 				  kVerticalFrame, fgWhitePixel) ; 
@@ -146,5 +181,5 @@
   fFileCont->Sort(kSortByName) ; 
   
-  fTabF1b->AddFrame(fFileView, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5) ) ; 
+  fTabF1c->AddFrame(fFileView, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5) ) ; 
 
   tf->AddFrame(fTabF1, fLayTab) ;
@@ -187,4 +222,11 @@
     delete fDetail;
     delete fDir ;
+    delete fLabDir ; 
+
+    delete fButFileReset ; 
+    delete fTxtFileName  ; 
+    delete fLabFileName  ; 
+    
+    delete fTabF1c;
     delete fTabF1b;
     delete fTabF1a;
@@ -193,6 +235,10 @@
     delete fTop1;
     delete fTab;
+
     delete fFrameTop;
     delete fFrameLow;
+    delete fLineSep2 ; 
+    delete fLineSep1 ; 
+
     delete fFileMenu;
     delete fMenuBar;
@@ -269,5 +315,12 @@
 
 	      break ; 
-		  
+		
+
+	    case M_FILERESET:
+	      
+	      sprintf ( fInputFile, "\n" ) ; 
+	      fTxtFileName->SetText( fInputFile ) ; 
+	      
+	      break; 
 	    case M_PBUTTON_CDIR_UP :
 
@@ -375,6 +428,6 @@
 		else if  ( ! strcmp(extens, "root") ) {      //     root file
 		  sprintf ( fInputFile, "%s/%s" , gSystem->WorkingDirectory(), wort ) ;  
-
-		  printf (" %s \n", fInputFile ) ; 
+		  fTxtFileName->SetText( fInputFile ) ;
+
 		  break ; 
 		}
Index: trunk/MagicSoft/Mars/mgui/MGPrototyp.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGPrototyp.h	(revision 586)
+++ trunk/MagicSoft/Mars/mgui/MGPrototyp.h	(revision 587)
@@ -19,4 +19,8 @@
 class TGFileContainer;
 class TGListView;
+class TGHorizontal3DLine;
+class TGLabel ; 
+class TGTextEntry ; 
+class TGTextBuffer; 
 
 class MGPrototyp : public TGTransientFrame {
@@ -35,4 +39,6 @@
   TGMenuBar         *fMenuBar ; 
   TGPopupMenu       *fFileMenu ;
+  TGHorizontal3DLine *fLineSep1, *fLineSep2 ; 
+
 
   //   divide the Window in two different parts
@@ -53,5 +59,12 @@
 
   TGCompositeFrame  *fTabF1 ;                       // first tab of low part 
-  TGCompositeFrame  *fTabF1a, *fTabF1b ;            // subpart of the file selector in low window
+  TGCompositeFrame  *fTabF1a, *fTabF1b, *fTabF1c ;  // subpart of the file selector in low window
+
+  TGLabel           *fLabFileName ; 
+  TGTextEntry       *fTxtFileName ; 
+  TGTextBuffer      *fTxtBufFileName ; //!
+  TGTextButton      *fButFileReset ; 
+ 
+  TGLabel           *fLabDir ; 
   TGListBox         *fDir ; 
   TGPictureButton   *fCdup, *fListMode, *fDetail ; 
Index: trunk/MagicSoft/Mars/mgui/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mgui/Makefile	(revision 586)
+++ trunk/MagicSoft/Mars/mgui/Makefile	(revision 587)
@@ -27,5 +27,5 @@
 #  connect the include files defined in the config.mk file
 #
-INCLUDES = -I. -I../mbase -I../mraw -I../mdatacheck
+INCLUDES = -I. -I../mbase -I../mraw -I../mdatacheck -I../meventdisp
 
 #
@@ -53,4 +53,5 @@
 
 SRCFILES = MGMarsMain.cc \
+	   MGEventDispMain.cc \
 	   MGDataCheckMain.cc \
 	   MGMonteCarloMain.cc \
