Ignore:
Timestamp:
05/12/03 10:09:47 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mmain
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc

    r2109 r2110  
    6161#include "MStatusDisplay.h"
    6262
    63 #include <iostream.h>
     63#include <fstream.h>              // fstream
    6464
    6565#include <TLine.h>                // TLine
     
    13381338// --------------------------------------------------------------------------
    13391339//
     1340// Insert the following two lines into the postscript header:
     1341//
     1342//   %%DocumentPaperSizes: a4
     1343//   %%Orientation: Landscape
     1344//
     1345void MStatusDisplay::UpdatePSHeader(const TString &name) const
     1346{
     1347    const TString newstr("%%DocumentPaperSizes: a4\n%%Orientation: Landscape");
     1348
     1349    fstream f(name, ios::in|ios::out|ios::nocreate);
     1350
     1351    TString str;
     1352    f >> str;
     1353
     1354    streampos p = f.tellg()+1;
     1355
     1356    char *c1 = new char[newstr.Length()];
     1357    char *c2 = new char[newstr.Length()];
     1358
     1359    f.read(c1, newstr.Length());
     1360
     1361    f.seekp(p);
     1362
     1363    f << newstr;
     1364
     1365    while (1)
     1366    {
     1367        streampos p1 = f.tellg();
     1368        f.read(c2, newstr.Length());
     1369        streampos p2 = f.tellg();
     1370        f.seekp(p1);
     1371        if (f)
     1372        {
     1373            f.write(c1, newstr.Length());
     1374            memcpy(c1, c2, newstr.Length());
     1375            continue;
     1376        }
     1377
     1378        f.clear();
     1379        f.write(c1, newstr.Length());
     1380        f.write(c2, p2-p1);
     1381        break;
     1382    }
     1383
     1384    delete c2;
     1385    delete c1;
     1386}
     1387
     1388// --------------------------------------------------------------------------
     1389//
    13401390// In case of num<0 all tabs are written into the PS file. If num>0
    13411391// the canvas in the corresponding tab is written to the file.
     
    13671417    TPostScript ps(name, 112);
    13681418    ps.SetBit(TPad::kPrintingPS);
    1369 
    1370     //%%DocumentPaperSizes: a4
    1371     //%%Orientation: Portrait
    1372 
    13731419    ps.PrintFast(13, "/nan {1} def ");
    13741420
     
    14791525
    14801526    ps.Close();
     1527    UpdatePSHeader(name);
    14811528
    14821529    gVirtualPS = psave;
     
    17491796    return TGMainFrame::HandleEvent(event);
    17501797}
     1798
  • trunk/MagicSoft/Mars/mmain/MStatusDisplay.h

    r2109 r2110  
    9898    void AddExtension(TString &name, const TString &ext, Int_t num) const;
    9999
     100    void UpdatePSHeader(const TString &name) const;
     101
    100102    enum {
    101103        kIsLocked = BIT(14)
Note: See TracChangeset for help on using the changeset viewer.