Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2057)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2058)
@@ -1,6 +1,20 @@
-
-
-
                                                  -*-*- END OF LINE -*-*-
+
+ 2003/05/05: Thomas Bretz
+ 
+   * mbase/MEvtLoop.cc:
+     - underline Instatiation Message
+     - small change to a warning output
+     
+   * mbase/MLog.[h,cc]:
+     - added stuff for underlining
+     - changed from TGListBox to TGViewText
+     
+   * mmain/MStatusDisplay.[h,cc]:
+     - changed fLogBox from TGListBox to TGViewText
+     - added menu 'Log'
+     - changed division of status line to 'Goldener Schnitt'
+
+
 
  2003/05/05: Wolfgang Wittek
@@ -10,6 +24,27 @@
 
 
+
  2003/05/02: Thomas Bretz
+
+   * Makefile.conf.general, Makefile.conf.linux, Makefile.conf.linux-gnu,
+     Makefile.conf.osf1, Makefile.conf.osf5.1:
+     - added MARSDEFINES, MARSFLAGS, MARSLIBS
+     
+   * mars.cc:
+     - replaces HAVE_LOGO by HAVE_XPM
  
+   * NEWS:
+     - updated
+     
+   * mbase/MLogo.cc:
+     - replaces marslogo_neu by marslogo
+     - encapsulated in HAVE_XPM
+     
+   * mbase/Makefile:
+     - added MLogo.cc
+     
+   * mmain/MGMenu.cc:
+     - fixed the 'KeyAutoRepeat' bug
+
    * manalysis/MCerPhotEvt.[h,cc:
      - added RemoveUnusedPixels
@@ -24,4 +59,5 @@
    * mbase/MLog.[h,cc]:
      - added flushing and tab conversion to GUI
+     - added color support
      
    * mbase/MParList.cc:
@@ -44,4 +80,5 @@
      - added writing C
      - changes SaveAs to non-const (added output to status lines)
+     - replaced TGLabels by TGStatusBar
 
 
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 2057)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 2058)
@@ -108,5 +108,6 @@
     fName = name;
 
-    *fLog << inf << "Instantiated MEvtLoop (" << name << "), using ROOT v" << ROOTVER << endl;
+    fLog->Underline();
+    *fLog << inf << "Instantiated MEvtLoop (" << name << "), using ROOT v" << ROOTVER << "\033[0m" << endl;
 }
 
@@ -240,6 +241,6 @@
             return kTRUE;
         default:
+            *fLog << warn << "MEvtloop: fDisplay->ChecStatus() has returned unknown status #" << fDisplay->CheckStatus() << "... cleared." << endl;
             fDisplay->ClearStatus();
-            *fLog << warn << "Display shows unknown status... cleared." << endl;
             break;
         }
Index: trunk/MagicSoft/Mars/mbase/MLog.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 2057)
+++ trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 2058)
@@ -80,5 +80,5 @@
 #include <pthread.h>
 #endif
-#include <TGListBox.h>
+#include <TGTextView.h>
 
 #include "MLogManip.h"
@@ -133,5 +133,5 @@
 // which is used for the output (i)
 //
-MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), fGuiLineId(0), fout(NULL), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)
+MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), fout(NULL), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)
 {
     Init();
@@ -143,5 +143,5 @@
 // ofstream as the default output device
 //
-MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGuiLineId(0),  fout(&out), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)
+MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fout(&out), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)
 {
     Init();
@@ -151,7 +151,7 @@
 //
 // default constructor which initializes the streamer and sets the given
-// TGListBox as the default output device
-//
-MLog::MLog(TGListBox &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eGui), fGuiLineId(0),  fout(NULL), fOutAllocated(kFALSE), fgui(&out), fNumLines(0)
+// TGTextView as the default output device
+//
+MLog::MLog(TGTextView &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eGui), fout(NULL), fOutAllocated(kFALSE), fgui(&out), fNumLines(0)
 {
     Init();
@@ -164,5 +164,5 @@
 // or not.
 //
-MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGuiLineId(0),  fgui(NULL), fNumLines(0)
+MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fgui(NULL), fNumLines(0)
 {
     Init();
@@ -193,4 +193,13 @@
     fDebugLevel  = log.fDebugLevel;
     fDevice      = log.fDevice;
+}
+
+void MLog::Underline()
+{
+    if (fDevice&eStdout)
+        cout << kUnderline;
+
+    if (fDevice&eStderr)
+        cerr << kUnderline;
 }
 
@@ -272,4 +281,5 @@
 }
 
+#include <TVirtualX.h>
 void MLog::UpdateGui()
 {
@@ -279,4 +289,6 @@
     // lock mutex
     Lock();
+
+    TGText &txt=*fgui->GetText();
 
     // copy lines to TGListBox
@@ -285,5 +297,5 @@
         // Replace all tabs by 7 white spaces
         fGuiLines[i]->ReplaceAll("\t", "       ");
-        fgui->AddEntry(*fGuiLines[i], fGuiLineId++);
+        txt.InsText(TGLongPosition(0, txt.RowCount()), *fGuiLines[i]);
         delete fGuiLines[i];
     }
@@ -292,8 +304,12 @@
     fNumLines=0;
 
-    // cut list box top 1000 lines
-    fgui->RemoveEntries(0, fGuiLineId-1000);
+    // cut text box top 1000 lines
+    while (txt.RowCount()>1000)
+        txt.DelLine(0);
+
     // show last entry
-    fgui->SetTopEntry(fGuiLineId-1);
+    fgui->Layout();
+    fgui->SetVsbPosition(txt.RowCount()-1);
+
     // tell a main loop, that list box contents have changed
     fgui->SetBit(kHasChanged);
Index: trunk/MagicSoft/Mars/mbase/MLog.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLog.h	(revision 2057)
+++ trunk/MagicSoft/Mars/mbase/MLog.h	(revision 2058)
@@ -18,5 +18,5 @@
 
 
-class TGListBox;
+class TGTextView;
 
 class MLog : public streambuf, public ostream, public TObject
@@ -54,9 +54,7 @@
     Bool_t fIsNull;           //! Switch output completely off
 
-    Int_t fGuiLineId;         //!
-
-    ofstream  *fout;          //! possible file output stream
-    Bool_t     fOutAllocated; //! flag if fout is created by MLogging
-    TGListBox *fgui;          //! Listbox output
+    ofstream   *fout;          //! possible file output stream
+    Bool_t      fOutAllocated; //! flag if fout is created by MLogging
+    TGTextView *fgui;          //! Text View output
 
     Bool_t     fIsDirectGui;  //! Pipe text directly to the GUI (for single threaded environments)
@@ -84,5 +82,5 @@
     MLog(int i=eStdout);
     MLog(ofstream &out);
-    MLog(TGListBox &out);
+    MLog(TGTextView &out);
     MLog(const char *fname, int flag=-1);
 
@@ -97,4 +95,6 @@
     void UpdateGui();
 
+    void Underline();
+
     void SetDebugLevel(int i)           { fDebugLevel  =  i;  }
     int  GetDebugLevel() const          { return fDebugLevel; }
@@ -104,9 +104,9 @@
     void DisableOutputDevice(Flags_t f) { fDevice     &= ~f;  }
     void operator=(ofstream &out)       { SetOutputFile(out); }
-    void operator=(TGListBox *out)      { SetOutputGui(out);  }
+    void operator=(TGTextView *out)     { SetOutputGui(out);  }
 
     Bool_t IsOutputDeviceEnabled(int i) const { return fDevice & i; }
 
-    void SetOutputGui(TGListBox *out, int flag=-1)
+    void SetOutputGui(TGTextView *out, int flag=-1)
     {
         fgui = out;
Index: trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc	(revision 2057)
+++ trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc	(revision 2058)
@@ -79,5 +79,5 @@
 #include <TG3DLine.h>             // TGHorizontal3DLine
 #include <TGButton.h>             // TGPictureButton
-#include <TGListBox.h>            // TGListBox
+#include <TGTextView.h>           // TGTextView
 #include <TGStatusBar.h>          // TGStatusBar
 #include <TGProgressBar.h>        // TGHProgressBar
@@ -153,11 +153,29 @@
 
     //
+    // Log Menu
+    //
+    MGPopupMenu *logmenu = new MGPopupMenu(gClient->GetRoot());
+    logmenu->AddEntry("&Copy Selected", kLogCopy);
+    logmenu->AddEntry("Clear all",      kLogClear);
+    logmenu->AddSeparator();
+    logmenu->AddEntry("Select All",     kLogSelect);
+    /*
+     logmenu->AddSeparator();
+     logmenu->AddEntry("Search",         kLogSearch);
+     */
+    logmenu->AddSeparator();
+    logmenu->AddEntry("Save",           kLogSave);
+    logmenu->AddEntry("Save append",    kLogAppend);
+    logmenu->Associate(this);
+
+    //
     // Menu Bar
     //
     MGMenuBar *menubar = new MGMenuBar(this, 1, 1, kHorizontalFrame);
     menubar->AddPopup("&File", filemenu, NULL);
+    menubar->AddPopup("Lo&g",  logmenu,  NULL);
+    menubar->AddPopup("&Size", sizemenu, NULL);
     menubar->AddPopup("&Tab",  tabmenu,  NULL);
     menubar->AddPopup("&Loop", loopmenu, NULL);
-    menubar->AddPopup("&Size", sizemenu, NULL);
     menubar->BindKeys(this);
     AddFrame(menubar);
@@ -180,4 +198,5 @@
     fList->Add(menubar);
     fList->Add(tabmenu);
+    fList->Add(logmenu);
     fList->Add(linesep);
 }
@@ -220,11 +239,4 @@
         f->AddFrame(mars, lay2);
     }
-    /*
-     TGShutter *s = new TGShutter(f);
-     fList->Add(s);
-     f->AddFrame(s, lay);
-     s->AddItem(new TGShutterItem(s, new TGHotString("Hallo1")));
-     s->AddItem(new TGShutterItem(s, new TGHotString("Hallo2")));
-     */
 
     // Add date and time
@@ -261,7 +273,9 @@
         TGCompositeFrame *f = fTab->AddTab("-Logbook-");
 
-        // Create TGListBox(p, id=-1, opt, back) for logging contents
-        fLogBox = new TGListBox(f, -1, kSunkenFrame);
-        //fLogBox->Associate(this);
+
+        fLogBox = new TGTextView(f, 1, 1/*, -1, 0, TGTextView::GetBlackPixel()*/);
+        if (fFont)
+            fLogBox->SetFont(fFont);
+        fLogBox->Associate(this);
 
         // Add List box to the tab
@@ -334,5 +348,4 @@
 }
 
-
 // --------------------------------------------------------------------------
 //
@@ -343,5 +356,15 @@
     fStatusBar = new TGStatusBar(this, 1, 1);
 
-    fStatusBar->SetParts(2);
+    //
+    //     1-a     a
+    // 1: ------|----
+    //
+    // a/(1-a) = (1-a)/1
+    // a^2+a-1 = 0
+    //       a = (-1+-sqrt(1+4))/2 = sqrt(5)/2-1/2 = 0.618
+    //
+    Int_t p[2] = {38, 62};
+
+    fStatusBar->SetParts(p, 2);
 
     TGLayoutHints *layb = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 5, 4, 0, 3);
@@ -399,4 +422,5 @@
     gROOT->GetListOfCleanups()->Add(this);
 
+    fFont = gVirtualX->LoadQueryFont("7x13bold");
 
     //
@@ -452,4 +476,7 @@
 
     delete fList;
+
+    if (fFont)
+        gVirtualX->DeleteFont(fFont);
 
     gROOT->GetListOfSpecials()->Remove(this);
@@ -643,4 +670,14 @@
 }
 
+/*
+    if (...)
+       fMenu->AddPopup("&CaOs", fCaOs, NULL);
+    else
+       fMenu->RemovePopup("CaOs");
+    fMenu->Resize(fMenu->GetDefaultSize());
+    MapSubwindows();
+    MapWindow();
+ */
+
 // --------------------------------------------------------------------------
 //
@@ -728,4 +765,48 @@
     case kSize1280:
         Resize(1280, 980);
+        return kTRUE;
+
+    case kLogClear:
+        fLogBox->Clear();
+        return kTRUE;
+    case kLogCopy:
+        fLogBox->Copy();
+        return kTRUE;
+    case kLogSelect:
+        fLogBox->SelectAll();
+        return kTRUE;
+    case kLogSearch:
+        //virtual Bool_t Search(const char *string, Bool_t direction, Bool_t caseSensitive);
+        return kTRUE;
+    case kLogSave:
+        SetStatusLine1("Saving log...");
+        SetStatusLine2("");
+        *fLog << inf << "Saving log... " << flush;
+        if (fLogBox->GetText()->Save("statusdisplay.log"))
+        {
+            *fLog << "done." << endl;
+            SetStatusLine2("done.");
+        }
+        else
+        {
+            *fLog << "failed!" << endl;
+            SetStatusLine2("Failed!");
+        }
+        return kTRUE;
+
+    case kLogAppend:
+        SetStatusLine1("Appending logg...");
+        SetStatusLine2("");
+        *fLog << inf << "Appending log... " << flush;
+        if (fLogBox->GetText()->Append("statusdisplay.log"))
+        {
+            *fLog << "done." << endl;
+            SetStatusLine2("done.");
+        }
+        else
+        {
+            *fLog << "failed!" << endl;
+            SetStatusLine2("Failed!");
+        }
         return kTRUE;
 
@@ -795,4 +876,57 @@
 // --------------------------------------------------------------------------
 //
+// Process the kC_TEXTVIEW messages
+//
+Bool_t MStatusDisplay::ProcessMessageTextview(Long_t submsg, Long_t mp1, Long_t mp2)
+{
+    // kC_TEXTVIEW, kTXT_ISMARKED, widget id, [true|false]                  //
+    // kC_TEXTVIEW, kTXT_DATACHANGE, widget id, 0                           //
+    // kC_TEXTVIEW, kTXT_CLICK2, widget id, position (y << 16) | x)         //
+    // kC_TEXTVIEW, kTXT_CLICK3, widget id, position (y << 16) | x)         //
+    // kC_TEXTVIEW, kTXT_F3, widget id, true                                //
+    // kC_TEXTVIEW, kTXT_OPEN, widget id, 0                                 //
+    // kC_TEXTVIEW, kTXT_CLOSE, widget id, 0                                //
+    // kC_TEXTVIEW, kTXT_SAVE, widget id, 0                                 //
+    switch (submsg)
+    {
+    case kTXT_ISMARKED:
+        cout << "Textview-IsMarked #" << mp1 << " " << (mp2?"yes":"no") << endl;
+        return kTRUE;
+
+    case kTXT_DATACHANGE:
+        cout << "Textview-DataChange #" << mp1 << endl;
+        return kTRUE;
+
+    case kTXT_CLICK2:
+        cout << "Textview-Click2 #" << mp1 << " x=" << (mp2&0xffff) << " y= " << (mp2>>16) << endl;
+        return kTRUE;
+
+    case kTXT_CLICK3:
+        cout << "Textview-Click3 #" << mp1 << " x=" << (mp2&0xffff) << " y= " << (mp2>>16) << endl;
+        return kTRUE;
+
+    case kTXT_F3:
+        cout << "Textview-F3 #" << mp1 << endl;
+        return kTRUE;
+
+    case kTXT_OPEN:
+        cout << "Textview-Open #" << mp1 << endl;
+        return kTRUE;
+
+    case kTXT_CLOSE:
+        cout << "Textview-Close #" << mp1 << endl;
+        return kTRUE;
+
+    case kTXT_SAVE:
+        cout << "Textview-Save #" << mp1 << endl;
+        return kTRUE;
+    }
+
+    cout << "Textview: " << "Submsg:" << submsg << " Mp1=" << mp1 << " Mp2=" << mp2 << endl;
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
 // Process the messages from the GUI
 //
@@ -804,4 +938,7 @@
     case kC_COMMAND:
         return ProcessMessageCommand(GET_SUBMSG(msg), mp1, mp2);
+
+    case kC_TEXTVIEW:
+        return ProcessMessageTextview(GET_SUBMSG(msg), mp1, mp2);
     }
 
@@ -866,10 +1003,10 @@
         fLog->UpdateGui();
 
+        /*
         if (!fLogBox->TestBit(kHasChanged))
             return kTRUE;
 
-        fLogBox->MapSubwindows();
-        fLogBox->Layout();
-        fLogBox->ResetBit(kHasChanged);
+            fLogBox->ResetBit(kHasChanged);
+            */
         return kTRUE;
     }
Index: trunk/MagicSoft/Mars/mmain/MStatusDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MStatusDisplay.h	(revision 2057)
+++ trunk/MagicSoft/Mars/mmain/MStatusDisplay.h	(revision 2058)
@@ -23,5 +23,5 @@
 
 class TGTab;
-class TGListBox;
+class TGTextView;
 class TGStatusBar;
 class TGProgressBar;
@@ -32,31 +32,19 @@
 public:
     typedef enum {
-        kLoopNone,
-        kLoopStop,
-        kFileSave,
-        kFileSaveAs,
-        kFileSaveAsPS,
-        kFileSaveAsRoot,
-        kFileSaveAsGIF,
-        kFileSaveAsC,
-        kFilePrint,
-        kFilePrinterName,
-        kTabSave,
-        kTabSaveAs,
-        kTabSaveAsPS,
-        kTabSaveAsRoot,
-        kTabSaveAsGIF,
-        kTabSaveAsC,
-        kTabPrint,
-        kTabNext,
-        kTabPrevious,
-        kSize640,
-        kSize800,
-        kSize960,
-        kSize1024,
-        kSize1280,
+        // KFile
+        kFileSave, kFileSaveAs, kFileSaveAsPS, kFileSaveAsRoot,
+        kFileSaveAsGIF, kFileSaveAsC, kFilePrint, kFilePrinterName,
         kFileExit,
-        kPicMagic,
-        kPicMars
+        // kLoop
+        kLoopNone, kLoopStop,
+        // kTab
+        kTabSave, kTabSaveAs, kTabSaveAsPS, kTabSaveAsRoot, kTabSaveAsGIF,
+        kTabSaveAsC, kTabPrint, kTabNext, kTabPrevious,
+        // kSize
+        kSize640, kSize800, kSize960, kSize1024, kSize1280,
+        // kLog
+        kLogCopy, kLogClear, kLogSelect, kLogSearch, kLogSave, kLogAppend,
+        // kPic
+        kPicMagic, kPicMars
     } Status_t;
 
@@ -78,5 +66,7 @@
     Int_t fLogIdx;
     TTimer fLogTimer;
-    TGListBox *fLogBox;
+    TGTextView *fLogBox;
+
+    FontStruct_t fFont;
 
     void AddMenuBar();
@@ -91,4 +81,5 @@
     Bool_t ProcessMessageCommandMenu(Long_t mp1);
     Bool_t ProcessMessageCommand(Long_t submsg, Long_t mp1, Long_t mp2);
+    Bool_t ProcessMessageTextview(Long_t submsg, Long_t mp1, Long_t mp2);
     Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2);
     void   CloseWindow();
