Changeset 2110 for trunk/MagicSoft
- Timestamp:
- 05/12/03 10:09:47 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2109 r2110 1 1 -*-*- END OF LINE -*-*- 2 3 2003/05/12: Thomas Bretz 4 5 * mmain/MStatusDisplay.[h,cc]: 6 - implemented UpdatePSHeader 7 8 2 9 3 10 2003/05/10: Thomas Bretz -
trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
r2109 r2110 61 61 #include "MStatusDisplay.h" 62 62 63 #include < iostream.h>63 #include <fstream.h> // fstream 64 64 65 65 #include <TLine.h> // TLine … … 1338 1338 // -------------------------------------------------------------------------- 1339 1339 // 1340 // Insert the following two lines into the postscript header: 1341 // 1342 // %%DocumentPaperSizes: a4 1343 // %%Orientation: Landscape 1344 // 1345 void 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 // 1340 1390 // In case of num<0 all tabs are written into the PS file. If num>0 1341 1391 // the canvas in the corresponding tab is written to the file. … … 1367 1417 TPostScript ps(name, 112); 1368 1418 ps.SetBit(TPad::kPrintingPS); 1369 1370 //%%DocumentPaperSizes: a41371 //%%Orientation: Portrait1372 1373 1419 ps.PrintFast(13, "/nan {1} def "); 1374 1420 … … 1479 1525 1480 1526 ps.Close(); 1527 UpdatePSHeader(name); 1481 1528 1482 1529 gVirtualPS = psave; … … 1749 1796 return TGMainFrame::HandleEvent(event); 1750 1797 } 1798 -
trunk/MagicSoft/Mars/mmain/MStatusDisplay.h
r2109 r2110 98 98 void AddExtension(TString &name, const TString &ext, Int_t num) const; 99 99 100 void UpdatePSHeader(const TString &name) const; 101 100 102 enum { 101 103 kIsLocked = BIT(14)
Note:
See TracChangeset
for help on using the changeset viewer.