Index: /trunk/MagicSoft/Cosy/gui/MGCosy.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 2068)
+++ /trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 2069)
@@ -58,37 +58,58 @@
     kPB_ResetBending,
     kPB_CALIBSE,
-    kCB_PredefPos
-
+    kCB_PredefPos,
+
+    // kLog
+    kLogCopy, kLogClear, kLogSelect, kLogSearch, kLogSave, kLogAppend
 };
 
 void MGCosy::CreateMenu()
 {
-    fLayMenuBar  = new TGLayoutHints (kLHintsNormal | kLHintsExpandX);
-    fLayMenuItem = new TGLayoutHints (kLHintsNormal, 0, 4, 0, 0);
+    TGLayoutHints *laymenubar  = new TGLayoutHints (kLHintsNormal | kLHintsExpandX);
+    TGLayoutHints *laymenuitem = new TGLayoutHints (kLHintsNormal, 0, 4, 0, 0);
+    fList->Add(laymenubar);
+    fList->Add(laymenuitem);
 
     //
     //  crate the menu bar
     //
-    TGPopupMenu *fFileMenu = new TGPopupMenu(gClient->GetRoot());
-    fFileMenu->AddEntry("Set Aspect", IDM_ASPECT);
-    fFileMenu->AddEntry("Exit", IDM_EXIT);
-    fFileMenu->Associate(this);
-    fList->Add(fFileMenu);
+    TGPopupMenu *filemenu = new TGPopupMenu(gClient->GetRoot());
+    filemenu->AddEntry("Set Aspect", IDM_ASPECT);
+    filemenu->AddEntry("Exit", IDM_EXIT);
+    filemenu->Associate(this);
+    fList->Add(filemenu);
+
+    //
+    // Log Menu
+    //
+    TGPopupMenu *logmenu = new TGPopupMenu(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);
 
     //
     //  the button messages are handled by main frame (this)
     //
-    TGMenuBar *fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
-    fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem);
-    AddFrame(fMenuBar, fLayMenuBar);
-    fList->Add(fMenuBar);
+    TGMenuBar *menubar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
+    menubar->AddPopup("File", filemenu, laymenuitem);
+    menubar->AddPopup("Lo&g", logmenu,  laymenuitem);
+    AddFrame(menubar, laymenubar);
+    fList->Add(menubar);
 
     //
     //  Seperator beyond menubar
     //
-
-    TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this);
-    AddFrame(fLineSep, fLayMenuBar);
-    fList->Add(fLineSep);
+    TGHorizontal3DLine *linesep = new TGHorizontal3DLine(this);
+    AddFrame(linesep, laymenubar);
+    fList->Add(linesep);
 }
 
@@ -746,9 +767,4 @@
 #ifdef DEBUG
     cout << "MGCosy::~MGCosy called." << endl;
-#endif
-    delete fLayMenuBar;
-    delete fLayMenuItem;
-#ifdef DEBUG
-    cout << "Deleting MGCosy::fList" << endl;
 #endif
     delete fList;
@@ -1298,11 +1314,40 @@
                 return kTRUE;
             case IDM_ASPECT:
-                Int_t w = GetWidth();
-                Int_t h = GetHeight();
-                if (w>940*h/660)
-                    w = 940*h/660;
+                {
+                    Int_t w = GetWidth();
+                    Int_t h = GetHeight();
+                    if (w>940*h/660)
+                        w = 940*h/660;
+                    else
+                        h = 660*w/940;
+                    Resize(w, h);
+                }
+                return kTRUE;
+            case kLogClear:
+                fLog->Clear();
+                return kTRUE;
+            case kLogCopy:
+                fLog->Copy();
+                return kTRUE;
+            case kLogSelect:
+                fLog->SelectAll();
+                return kTRUE;
+            case kLogSearch:
+                //virtual Bool_t Search(const char *string, Bool_t direction, Bool_t caseSensitive);
+                return kTRUE;
+            case kLogSave:
+                cout << "Saving log... " << flush;
+                if (fLog->GetText()->Save("cosylog.txt"))
+                    cout << "done." << endl;
                 else
-                    h = 660*w/940;
-                Resize(w, h); 
+                    cout << "failed!" << endl;
+                return kTRUE;
+
+            case kLogAppend:
+                cout << "Appending log... " << flush;
+                if (fLog->GetText()->Append("cosylog.txt"))
+                    cout << "done." << endl;
+                else
+                    cout << "failed!" << endl;
                 return kTRUE;
             }
Index: /trunk/MagicSoft/Cosy/gui/MGCosy.h
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGCosy.h	(revision 2068)
+++ /trunk/MagicSoft/Cosy/gui/MGCosy.h	(revision 2069)
@@ -44,7 +44,4 @@
     // Create a main frame with a number of different buttons.
     //
-    TGLayoutHints *fLayMenuBar;
-    TGLayoutHints *fLayMenuItem;
-
     MGList        *fList;
 
