From af6cb84ce3a0b3c26e064dbf0d7514b9260f2ef2 Mon Sep 17 00:00:00 2001
From: Till Kamppeter <till.kamppeter@gmail.com>
Date: Fri, 23 Sep 2016 17:17:19 -0300
Subject: [PATCH] pxlcolor/pxlmono output devices: Make MediaPosition,
ManualFeed, and MediaType work
In the pxlcolor and pxlmono output devices (for PCL-XL printers) the
support for the attributes MediaPosition, ManualFeed, and MediaType
got broken when ESP Ghostscript got merged into GPL Ghostscript (Bug
---
base/gdevpx.c | 60 +++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 40 insertions(+), 20 deletions(-)
diff --git a/base/gdevpx.c b/base/gdevpx.c
index 8647332..82a3af1 100644
--- a/base/gdevpx.c
+++ b/base/gdevpx.c
@@ -1394,12 +1394,6 @@ pclxl_open_device(gx_device * dev)
xdev->media_size = pxeMediaSize_next; /* no size selected */
memset(&xdev->chars, 0, sizeof(xdev->chars));
xdev->chars.next_in = xdev->chars.next_out = 2;
- xdev->MediaPosition_set = false;
- xdev->MediaType_set = false;
- xdev->MediaPosition_old = eAutoSelect;
- xdev->MediaPosition = eAutoSelect;
- xdev->MediaType_old[0] = '\0';
- xdev->MediaType[0] = '\0';
return 0;
}
@@ -2185,17 +2179,18 @@ pclxl_get_params(gx_device *dev, /* I - Device info */
if ((code = param_write_bool(plist, "Duplex", &(xdev->Duplex))) < 0)
return (code);
- if (xdev->MediaPosition_set)
+ if ((code = param_write_bool(plist, "ManualFeed",
+ &(xdev->ManualFeed))) < 0)
+ return (code);
+
if ((code = param_write_int(plist, "MediaPosition",
&(xdev->MediaPosition))) < 0)
return (code);
- if (xdev->MediaType_set) {
if ((code = param_string_from_string(s, xdev->MediaType)) < 0)
return (code);
if ((code = param_write_string(plist, "MediaType", &s)) < 0)
return (code);
- }
if ((code = param_write_bool(plist, "Tumble", &(xdev->Tumble))) < 0)
return (code);
@@ -2220,6 +2215,10 @@ pclxl_put_params(gx_device *dev, /* I - Device info */
int intval; /* Integer value */
bool boolval; /* Boolean value */
gs_param_string stringval; /* String value */
+ bool ManualFeed;
+ bool ManualFeed_set = false;
+ int MediaPosition;
+ bool MediaPosition_set = false;
/*
* Process PCL-XL driver parameters...
@@ -2287,15 +2286,19 @@ pclxl_put_params(gx_device *dev, /* I - Device info */
if_debug0('|', "round up page count\n");
xdev->page = (xdev->page+1) & ~1 ;
}
- intoption(MediaPosition, "MediaPosition", int)
- if (code == 0) {
- xdev->MediaPosition_set = true;
- /* round up for duplex */
- if (xdev->MediaPosition_old != xdev->MediaPosition) {
- if_debug0('|', "round up page count\n");
- xdev->page = (xdev->page+1) & ~1 ;
- xdev->MediaPosition_old = xdev->MediaPosition;
- }
+
+ code = param_read_bool(plist, "ManualFeed", &ManualFeed);
+ if (code == 0)
+ ManualFeed_set = true;
+ if (code >= 0) {
+ code = param_read_int(plist, "MediaPosition", &MediaPosition);
+ if (code == 0)
+ MediaPosition_set = true;
+ else if (code < 0) {
+ if (param_read_null(plist, "MediaPosition") == 0) {
+ code = 0;
+ }
+ }
}
stringoption(MediaType, "MediaType")
if (code == 0) {
@@ -2314,8 +2317,25 @@ pclxl_put_params(gx_device *dev, /* I - Device info */
* Then process standard page device parameters...
*/
- if ((code = gdev_vector_put_params(dev, plist)) < 0)
- return (code);
+ if (code >= 0)
+ if ((code = gdev_vector_put_params(dev, plist)) < 0)
+ return (code);
+
+ if (code >= 0) {
+ if (ManualFeed_set) {
+ xdev->ManualFeed = ManualFeed;
+ xdev->ManualFeed_set = true;
+ }
+ if (MediaPosition_set) {
+ xdev->MediaPosition = MediaPosition;
+ xdev->MediaPosition_set = true;
+ if (xdev->MediaPosition_old != xdev->MediaPosition) {
+ if_debug0('|', "round up page count\n");
+ xdev->page = (xdev->page+1) & ~1 ;
+ xdev->MediaPosition_old = xdev->MediaPosition;
+ }
+ }
+ }
return (0);
}
--
2.14.3