summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2004-07-07 15:17:54 +0000
committerJohannes Hofmann <johannes.hofmann@gmx.de>2004-07-07 15:17:54 +0000
commit917bfed7eb316851d2c67c748a0dbf56f41ea667 (patch)
tree677343259711887941938cf744678eca84fe0d88
parent82cf6e3d6b0849fa902f4e0206520409ed0c083b (diff)
add PS Level 1 stuff
add PS Level 1 stuff
-rw-r--r--src/GsWidget.cxx10
-rw-r--r--src/PSEditWidget.cxx25
2 files changed, 25 insertions, 10 deletions
diff --git a/src/GsWidget.cxx b/src/GsWidget.cxx
index ec0a73d..2228650 100644
--- a/src/GsWidget.cxx
+++ b/src/GsWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: GsWidget.cxx,v 1.5 2004/06/28 19:43:16 hofmann Exp $"
+// "$Id: GsWidget.cxx,v 1.6 2004/07/07 17:17:54 hofmann Exp $"
//
// GsWidget routines.
//
@@ -148,10 +148,10 @@ int GsWidget::load(int fd) {
argv[1] = "-dSAFER";
argv[2] = "-dQUIET";
argv[3] = "-sDEVICE=x11alpha";
- argv[4] = "-sPAPERSIZE=a4";
- argv[5] = "-dNOPLATFONTS";
- argv[6] = "-";
- argv[7] = NULL;
+ // argv[4] = "-sPAPERSIZE=a4";
+ argv[4] = "-dNOPLATFONTS";
+ argv[5] = "-";
+ argv[6] = NULL;
execvp(argv[0], argv);
fprintf(stderr, "Could not exec gs (errno %d)\n", errno);
fprintf(stderr, "Please install ghostscript and make sure 'gs' "
diff --git a/src/PSEditWidget.cxx b/src/PSEditWidget.cxx
index a0c39f3..ba7cc54 100644
--- a/src/PSEditWidget.cxx
+++ b/src/PSEditWidget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: PSEditWidget.cxx,v 1.12 2004/07/06 16:57:37 hofmann Exp $"
+// "$Id: PSEditWidget.cxx,v 1.13 2004/07/07 17:17:54 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -258,7 +258,8 @@ void PSEditWidget::to_ps(FILE *f, int p) {
text[p]->to_ps(f);
fprintf(f, "} if\n");
}
-#define PS_HEADER "%% Begin PSEditWidget\n" \
+
+#define PS_HEADER_L2 "%% Begin PSEditWidget\n" \
"/PSEditWidgetPageCount 0 def\n" \
"<< /EndPage {\n" \
"pop\n" \
@@ -269,7 +270,21 @@ void PSEditWidget::to_ps(FILE *f, int p) {
"} ifelse\n"
-#define PS_TRAILER "true } >> setpagedevice\n" \
+#define PS_TRAILER_L2 "true } >> setpagedevice\n" \
+"%% End PSEditWidget\n"
+
+#define PS_HEADER_L1 "%% Begin PSEditWidget\n" \
+"/PSEditWidgetPageCount 0 def\n" \
+"/PSEditWidgetPC 0 def\n" \
+"/PSEditWidgetshowpage /showpage load def\n" \
+"/showpage {\n" \
+"PSEditWidgetPageCount 0 eq { %% if PSEditWidgetPageCount is undefined,\n" \
+"/PSEditWidgetPC PSEditWidgetPC 1 add def PSEditWidgetPC\n" \
+"} {\n" \
+"PSEditWidgetPageCount\n" \
+"} ifelse\n"
+
+#define PS_TRAILER_L1 "PSEditWidgetshowpage} def\n" \
"%% End PSEditWidget\n"
int PSEditWidget::save(const char* savefile) {
@@ -286,13 +301,13 @@ int PSEditWidget::save(const char* savefile) {
if (!done && strncmp(linebuf, "%%EndSetup", 10) == 0) {
done++;
- fprintf(sfp, PS_HEADER);
+ fprintf(sfp, PS_HEADER_L1);
for (int i=1;i<max_pages;i++) {
to_ps(sfp, i);
}
- fprintf(sfp, PS_TRAILER);
+ fprintf(sfp, PS_TRAILER_L1);
}