Index: trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc	(revision 2173)
+++ trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc	(revision 2178)
@@ -181,4 +181,6 @@
     filemenu->AddEntry("Save As status.&root", kFileSaveAsRoot);
     filemenu->AddSeparator();
+    filemenu->AddEntry("Re&set",               kFileReset);
+    filemenu->AddSeparator();
     filemenu->AddEntry("Print with &lpr",      kFilePrint);
     //filemenu->AddEntry("Set printer &name",    kFilePrinterName);
@@ -196,4 +198,6 @@
     tabmenu->AddEntry("Save As tab-i.&C",    kTabSaveAsC);
     tabmenu->AddEntry("Save As tab-i.&root", kTabSaveAsRoot);
+    tabmenu->AddSeparator();
+    tabmenu->AddEntry("Re&move",             kTabRemove);
     tabmenu->AddSeparator();
     tabmenu->AddEntry("Print with &lpr",     kFilePrint);
@@ -560,5 +564,5 @@
 // to the corresponding TCanvas. If it isn't found NULL is returned.
 //
-TCanvas *MStatusDisplay::GetCanvas(TGCompositeFrame *cf) const
+TRootEmbeddedCanvas *MStatusDisplay::GetEmbeddedCanvas(TGCompositeFrame *cf) const
 {
     TIter Next(cf->GetList());
@@ -567,7 +571,19 @@
     while ((f=(TGFrameElement*)Next()))
         if (f->fFrame->InheritsFrom(TRootEmbeddedCanvas::Class()))
-            return ((TRootEmbeddedCanvas*)f->fFrame)->GetCanvas();
+            return (TRootEmbeddedCanvas*)f->fFrame;
 
     return NULL;
+}
+
+// --------------------------------------------------------------------------
+//
+// Takes a TGCompositeFrame as argument. Searches for the first
+// TRootEmbeddedCanvas which is contained by it and returns a pointer
+// to the corresponding TCanvas. If it isn't found NULL is returned.
+//
+TCanvas *MStatusDisplay::GetCanvas(TGCompositeFrame *cf) const
+{
+    TRootEmbeddedCanvas *ec = GetEmbeddedCanvas(cf);
+    return ec ? ec->GetCanvas() : NULL;
 }
 
@@ -654,5 +670,5 @@
     c.SetBorderMode(0);
 
-    // If kNoContaxtMenu set set kNoCOntextMenu of the canvas
+    // If kNoContextMenu set set kNoContextMenu of the canvas
     if (TestBit(kNoContextMenu))
         c.SetBit(kNoContextMenu);
@@ -738,4 +754,57 @@
 
     return pages;
+}
+
+// --------------------------------------------------------------------------
+//
+// Remove tab no i if this tab contains a TRootEmbeddedCanvas
+//
+void MStatusDisplay::RemoveTab(int i)
+{
+    TGCompositeFrame *f = fTab->GetTabContainer(i);
+    if (!f)
+        return;
+
+    TRootEmbeddedCanvas *ec = GetEmbeddedCanvas(f);
+    if (!ec)
+        return;
+
+    TCanvas *c = ec->GetCanvas();
+    if (!c)
+        return;
+
+    const TString name(c->GetName());
+
+    f->RemoveFrame(ec);
+    delete fList->Remove(ec);
+
+    fTab->RemoveTab(i);
+
+    // layout and map new tab
+#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,00)
+    MapSubwindows();
+    Layout();
+#else
+    Layout();
+    MapSubwindows();
+#endif
+
+    // display new tab in the main frame
+    gClient->ProcessEventsFor(fTab);
+
+    *fLog << inf << "Removed Tab #" << i << " '" << name << "'" << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+// Use this to check whether the MStatusDisplay still contains the
+// TCanvas c. It could be removed meanwhile by menu usage.
+//
+Bool_t MStatusDisplay::HasCanvas(const TCanvas *c) const
+{
+    for (int i=1; i<fTab->GetNumberOfTabs(); i++)
+        if (c==GetCanvas(i))
+            return kTRUE;
+    return kFALSE;
 }
 
@@ -773,4 +842,8 @@
         return kTRUE;
 
+    case kFileReset:
+        for (int i=fTab->GetNumberOfTabs()-1; i>0; i--)
+            RemoveTab(i);
+        return kTRUE;
         /*
     case kFileSave:
@@ -828,4 +901,8 @@
     case kTabPrevious:
         fTab->SetTab(fTab->GetCurrent()-1);
+        return kTRUE;
+
+    case kTabRemove:
+        RemoveTab(fTab->GetCurrent());
         return kTRUE;
 
Index: trunk/MagicSoft/Mars/mmain/MStatusDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MStatusDisplay.h	(revision 2173)
+++ trunk/MagicSoft/Mars/mmain/MStatusDisplay.h	(revision 2178)
@@ -27,4 +27,5 @@
 class TGProgressBar;
 class TGHProgressBar;
+class TRootEmbeddedCanvas;
 
 class MStatusDisplay : public TGMainFrame
@@ -35,10 +36,10 @@
         kFileBrowser, kFileCanvas, kFileSave, kFileSaveAs, kFileSaveAsPS,
         kFileSaveAsRoot, kFileSaveAsGIF, kFileSaveAsC, kFilePrint,
-        kFilePrinterName, kFileExit,
+        kFilePrinterName, kFileExit, kFileReset,
         // kLoop
         kLoopNone, kLoopStop,
         // kTab
         kTabSave, kTabSaveAs, kTabSaveAsPS, kTabSaveAsRoot, kTabSaveAsGIF,
-        kTabSaveAsC, kTabPrint, kTabNext, kTabPrevious,
+        kTabSaveAsC, kTabPrint, kTabNext, kTabPrevious, kTabRemove,
         // kSize
         kSize640, kSize800, kSize960, kSize1024, kSize1280,
@@ -102,4 +103,9 @@
     void UpdatePSHeader(const TString &name) const;
 
+    void Reset();
+    void RemoveTab(int i);
+
+    TRootEmbeddedCanvas *GetEmbeddedCanvas(TGCompositeFrame *cf) const;
+
 public:
      MStatusDisplay(Long_t t=1000);
@@ -122,4 +128,5 @@
      TCanvas &AddTab(const char *name);
 
+     Bool_t   HasCanvas(const TCanvas *c) const;
      TCanvas *GetCanvas(int i) const;
      TCanvas *GetCanvas(const TString &name) const;
