Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2804)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2805)
@@ -14,4 +14,5 @@
      - include MFFT
      - put MCurrents.cc back into the Makefile (was only in the LinkDef)
+
 
  2004/01/14: Abelardo Moralejo
@@ -22,4 +23,6 @@
        rms = 0 later resulted in the pixel being eliminated in the 
        image cleaning.
+
+
 
  2004/01/14: Thomas Bretz
@@ -62,4 +65,15 @@
      - removed forbidden underscore from member variable
      - changed wrong 0/1 in allocation of fResult into kFALSE/TRUE
+
+   * mbase/MStatusDisplay.[h,cc]:
+     - added new member function Open
+     - added new menu entry kFileOpen
+     - changed UpdatePSheader algorithm (the old one was much too slow)
+
+   * manalysis/MCurrents.[h,cc]:
+     - removed (old outdated)
+
+   * manalysis/Makefile, manalysis/AnalysisLinkDef.h:
+     - removed MCurrents
 
 
Index: trunk/MagicSoft/Mars/manalysis/MCurrents.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCurrents.cc	(revision 2804)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2003
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// MCurrents (PRELIMINARY)
-//
-/////////////////////////////////////////////////////////////////////////////
-#include "MCurrents.h"
-
-#include <TMath.h>
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-ClassImp(MCurrents);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// Default constructor.
-//
-MCurrents::MCurrents(Int_t size, const char *name, const char *title)
-    : fArray(size)
-{
-    fName  = name  ? name  : "MCurrents";
-    fTitle = title ? title : "Storage container for the pixel currents";
-}
-
-// --------------------------------------------------------------------------
-//
-// Print the hillas Parameters to *fLog
-//
-void MCurrents::Print(Option_t *) const
-{
-    *fLog << all << underline << GetDescriptor() << endl;
-    for (int i=0; i<fArray.GetSize(); i++)
-        *fLog << " " << GetCurrent(i);
-    *fLog << endl;
-}
-
-UInt_t MCurrents::GetMin() const
-{
-    UInt_t val = (UInt_t)-1;
-    for (int i=0; i<fArray.GetSize(); i++)
-        val = TMath::Min(val, GetCurrent(i));
-    return val;
-}
-
-UInt_t MCurrents::GetMax() const
-{
-    UInt_t val = 0;
-    for (int i=0; i<fArray.GetSize(); i++)
-        val = TMath::Max(val, GetCurrent(i));
-    return val;
-}
Index: trunk/MagicSoft/Mars/manalysis/MCurrents.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCurrents.h	(revision 2804)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#ifndef MARS_MCurrents
-#define MARS_MCurrents
-
-#ifndef MARS_MCamEvent
-#include "MCamEvent.h"
-#endif
-
-#ifndef ROOT_TArrayI
-#include <TArrayI.h>
-#endif
-
-class MCurrents : public MCamEvent
-{
-private:
-    /*
-       "DC %s %s %02d %02d %02d %03d 577*%05d \n",
-       status1, status2, hour, minute, second, ms,
-       577 * pixel_DC_readout_in_nAmp
-       */
-    TString fStatus[2];
-    TArrayI fArray; // [nA] Unsigned Int!
-
-public:
-    MCurrents(Int_t size=577, const char *name=NULL, const char *title=NULL);
-
-    void SetCurrent(Int_t i, UInt_t val) { fArray[i] = (Int_t)val; }
-    UInt_t GetCurrent(Int_t i) const { return (*this)[i]; }
-    UInt_t &operator[](Int_t i) { return (UInt_t&)fArray[i]; }
-    const UInt_t &operator[](Int_t i) const { return (*const_cast<MCurrents*>(this))[i]; }
-
-    UInt_t GetMin() const;
-    UInt_t GetMax() const;
-
-    void SetStatus1(const TString &str) { fStatus[0] = str; }
-    void SetStatus2(const TString &str) { fStatus[1] = str; }
-
-    void Print(Option_t *opt=NULL) const;
-
-    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const
-    {
-        val = (*this)[idx];
-        return val>0;
-    }
-    void DrawPixelContent(Int_t num) const
-    {
-    }
-
-    ClassDef(MCurrents, 1) // Storage Container for the Currents (PRELIMINARY)
-};
-
-#endif
Index: trunk/MagicSoft/Mars/manalysis/Makefile
===================================================================
--- trunk/MagicSoft/Mars/manalysis/Makefile	(revision 2804)
+++ trunk/MagicSoft/Mars/manalysis/Makefile	(revision 2805)
@@ -77,5 +77,4 @@
            MCT1PadONOFF.cc  \
            MPad.cc  \
-           MCurrents.cc  \
            MPedestalWorkaround.cc \
            MExtractedSignalCam.cc \
Index: trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 2804)
+++ trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 2805)
@@ -190,4 +190,5 @@
     filemenu->AddEntry("Save As status.&root", kFileSaveAsRoot);
     filemenu->AddSeparator();
+    filemenu->AddEntry("&Open...",             kFileOpen);
     filemenu->AddEntry("Save &As...",          kFileSaveAs);
     filemenu->AddSeparator();
@@ -1088,4 +1089,8 @@
         return kTRUE;
 
+    case kFileOpen:
+        Open();
+        return kTRUE;
+
     case kFileSaveAs:
         SaveAs();
@@ -1725,5 +1730,28 @@
 {
     const TString newstr("%%DocumentPaperSizes: a4\n%%Orientation: Landscape\n");
-    const Int_t   l = newstr.Length();
+
+    ifstream fin(name);
+    ofstream fout(name+".$$$");
+
+    char c;
+
+    TString str;
+    fin >> str >> c;                // Read "%!PS-Adobe-2.0\n"
+    fout << str << endl << newstr;
+
+    // Doing it in blocks seems not to gain much for small (MB) files
+    while (fin)
+    {
+        fin.read(&c, 1);
+        fout.write(&c, 1);
+    }
+
+    gSystem->Unlink(name);
+    gSystem->Rename(name+".$$$", name);
+/*
+    //
+    // Old style algorithm. Shifts blocks inside a single file --- SLOW!
+    //
+    const Int_t l = newstr.Length();
 
     Long_t t[4]; // { id, size, flags, modtime }
@@ -1768,4 +1796,5 @@
     delete c[1];
     delete c[0];
+*/
 }
 
@@ -2155,5 +2184,4 @@
     {
         "PostScript",   "*.ps",
-        // "Encapsulated PostScript", "*.eps",
         "Gif files",    "*.gif",
         "Macro files",  "*.C",
@@ -2186,4 +2214,50 @@
     Warning("MStatusDisplay::SaveAs", "Unknown Extension: %s", fi.fFilename);
     return 0;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Open contents of a MStatusDisplay with key name from file fname.
+//
+Int_t MStatusDisplay::Open(TString fname, const char *name)
+{
+    TFile file(fname, "READ");
+    if (file.IsZombie())
+    {
+        gLog << warn << "WARNING - Cannot open file " << fname << endl;
+        return 0;
+    }
+
+    return Read(name);
+}
+
+// --------------------------------------------------------------------------
+//
+//  Opens an open dialog
+//
+Int_t MStatusDisplay::Open()
+{
+    static const char *gOpenTypes[] =
+    {
+        "ROOT files", "*.root",
+        "All files",  "*",
+        NULL,           NULL
+    };
+
+    static TString dir(".");
+
+    TGFileInfo fi; // fFileName and fIniDir deleted in ~TGFileInfo
+
+    fi.fFileTypes = (const char**)gOpenTypes;
+    fi.fIniDir    = StrDup(dir);
+
+    new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
+
+    if (!fi.fFilename)
+        return 0;
+
+    dir = fi.fIniDir;
+
+    return Open(fi.fFilename);
 }
 
Index: trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusDisplay.h	(revision 2804)
+++ trunk/MagicSoft/Mars/mbase/MStatusDisplay.h	(revision 2805)
@@ -39,5 +39,5 @@
     typedef enum {
         // kFile
-        kFileBrowser, kFileCanvas, kFileSave, kFileSaveAs, kFileSaveAsPS,
+        kFileBrowser, kFileCanvas, kFileOpen, kFileSave, kFileSaveAs, kFileSaveAsPS,
         kFileSaveAsRoot, kFileSaveAsGIF, kFileSaveAsC, kFilePrint,
         kFilePrinterName, kFileClose, kFileExit, kFileReset,
@@ -183,4 +183,6 @@
 
      Int_t  SaveAs(Int_t num=-1);
+     Int_t  Open(TString fname, const char *name="MStatusDisplay");
+     Int_t  Open();
 
      Status_t CheckStatus() const { return fStatus; }
