summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2010-02-18 18:43:37 +0000
committerRoger Leigh <rleigh@debian.org>2010-02-18 18:43:37 +0000
commitb7a746079a87b24dc0e64362e83463029e26c98f (patch)
tree4cd968e10cb18bdcd7ed21489f6fdb3e9dc1e0ff /src/main
parent0f09a5be038c93c1bd5ca2988e152345bbf74c00 (diff)
Imported Upstream version 5.2.5
Diffstat (limited to 'src/main')
-rw-r--r--src/main/print-escp2.c11
-rw-r--r--src/main/print-olympus.c4
-rw-r--r--src/main/print-pcl.c45
-rw-r--r--src/main/print-ps.c120
-rw-r--r--src/main/printers.c36
-rw-r--r--src/main/xmlppd.c62
6 files changed, 245 insertions, 33 deletions
diff --git a/src/main/print-escp2.c b/src/main/print-escp2.c
index 0ccc74c..c3aaf05 100644
--- a/src/main/print-escp2.c
+++ b/src/main/print-escp2.c
@@ -1,5 +1,5 @@
/*
- * "$Id: print-escp2.c,v 1.424 2009/07/21 11:07:06 rlk Exp $"
+ * "$Id: print-escp2.c,v 1.426 2009/11/15 01:50:50 rlk Exp $"
*
* Print plug-in EPSON ESC/P2 driver for the GIMP.
*
@@ -922,7 +922,7 @@ static const int_param_t int_parameters[] =
{
{
{
- "QualityEnhancement", N_("Quality Enhancement"), N_("Advanced Printer Functionality"),
+ "BandEnhancement", N_("Quality Enhancement"), N_("Advanced Printer Functionality"),
N_("Enhance print quality by additional passes"),
STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
STP_PARAMETER_LEVEL_ADVANCED2, 0, 1, STP_CHANNEL_NONE, 1, 0
@@ -2737,7 +2737,7 @@ escp2_parameters(const stp_vars_t *v, const char *name,
if (stp_escp2_has_media_feature(v, name))
description->is_active = 1;
}
- else if (strcmp(name, "QualityEnhancement") == 0)
+ else if (strcmp(name, "BandEnhancement") == 0)
{
description->is_active = 1;
}
@@ -3908,7 +3908,10 @@ setup_head_parameters(stp_vars_t *v)
pd->printer_weave = get_printer_weave(v);
- pd->extra_vertical_passes = 1 << stp_get_int_parameter(v, "QualityEnhancement");
+ pd->extra_vertical_passes = 1;
+ if (stp_check_int_parameter(v, "BandEnhancement", STP_PARAMETER_ACTIVE))
+ pd->extra_vertical_passes =
+ 1 << stp_get_int_parameter(v, "BandEnhancement");
if (stp_escp2_has_cap(v, MODEL_FAST_360, MODEL_FAST_360_YES) &&
(pd->inkname->inkset == INKSET_CMYK || pd->physical_channels == 1) &&
pd->res->hres == pd->physical_xdpi && pd->res->vres == 360)
diff --git a/src/main/print-olympus.c b/src/main/print-olympus.c
index 29836ed..6d3a719 100644
--- a/src/main/print-olympus.c
+++ b/src/main/print-olympus.c
@@ -1,5 +1,5 @@
/*
- * "$Id: print-olympus.c,v 1.94 2009/06/22 11:58:34 rlk Exp $"
+ * "$Id: print-olympus.c,v 1.95 2010/01/04 14:04:25 m0m Exp $"
*
* Print plug-in DyeSub driver (formerly Olympus driver) for the GIMP.
*
@@ -1665,7 +1665,7 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow,
NULL,
},
- { /* Canon CP-520 */
+ { /* Canon CP-520, SELPHY CP-530 */
1004,
&ymc_ink_list,
&res_300dpi_list,
diff --git a/src/main/print-pcl.c b/src/main/print-pcl.c
index fa107cd..4dfe787 100644
--- a/src/main/print-pcl.c
+++ b/src/main/print-pcl.c
@@ -1,5 +1,5 @@
/*
- * "$Id: print-pcl.c,v 1.156 2008/08/06 22:49:05 rlk Exp $"
+ * "$Id: print-pcl.c,v 1.157 2010/02/12 01:02:12 rlk Exp $"
*
* Print plug-in HP PCL driver for the GIMP.
*
@@ -204,6 +204,7 @@ static const pcl_t pcl_media_types[] =
#define PCL_PAPERSOURCE_STANDARD 0 /* Don't output code */
#define PCL_PAPERSOURCE_MANUAL 2
+#define PCL_PAPERSOURCE_MANUAL_ADJ (PCL_PAPERSOURCE_MANUAL + PAPERSOURCE_ADJ_GUIDE)
#define PCL_PAPERSOURCE_ENVELOPE 3 /* Not used */
/* LaserJet types */
@@ -235,6 +236,7 @@ static const pcl_t pcl_media_sources[] =
{
{ "Standard", N_ ("Standard"), PCL_PAPERSOURCE_STANDARD},
{ "Manual", N_ ("Manual"), PCL_PAPERSOURCE_MANUAL},
+ { "ManualAdj", N_ ("Manual - Movable Guides"), PCL_PAPERSOURCE_MANUAL_ADJ},
/* {"Envelope", PCL_PAPERSOURCE_ENVELOPE}, */
{ "MultiPurposeAdj", N_ ("Tray 1 - Movable Guides"), PCL_PAPERSOURCE_LJ_TRAY1_ADJ},
{ "MultiPurpose", N_ ("Tray 1"), PCL_PAPERSOURCE_LJ_TRAY1},
@@ -610,6 +612,7 @@ static const short new_papertypes[] =
static const short laserjet_papersources[] =
{
PCL_PAPERSOURCE_STANDARD,
+ PCL_PAPERSOURCE_MANUAL_ADJ,
PCL_PAPERSOURCE_MANUAL,
PCL_PAPERSOURCE_LJ_TRAY1_ADJ,
PCL_PAPERSOURCE_LJ_TRAY1,
@@ -1051,6 +1054,19 @@ static const pcl_cap_t pcl_model_capabilities[] =
emptylist,
laserjet_papersources,
},
+ /* PCL-4 with large paper, no expanded A4 margins */
+ { 24,
+ 13 * 72, 19 * 72,
+ 1, 1, /* Min paper size */
+ PCL_RES_150_150 | PCL_RES_300_300,
+ {12, 12, 18, 18},
+ {12, 12, 18, 18}, /* Check/Fix */
+ PCL_COLOR_NONE,
+ PCL_PRINTER_LJ,
+ ljbig_papersizes,
+ emptylist,
+ laserjet_papersources,
+ },
/* LaserJet III series */
{ 3,
17 * 72 / 2, 14 * 72,
@@ -1103,6 +1119,19 @@ static const pcl_cap_t pcl_model_capabilities[] =
emptylist,
laserjet_papersources,
},
+ /* PCL-5 with large paper, no expanded margins */
+ { 34,
+ 13 * 72, 19 * 72,
+ 1, 1, /* Min paper size */
+ PCL_RES_150_150 | PCL_RES_300_300,
+ {12, 12, 18, 18},
+ {12, 12, 18, 18}, /* Check/Fix */
+ PCL_COLOR_NONE,
+ PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE,
+ ljbig_papersizes,
+ emptylist,
+ laserjet_papersources,
+ },
/* LaserJet 4L */
{ 4,
17 * 72 / 2, 14 * 72,
@@ -1185,6 +1214,20 @@ static const pcl_cap_t pcl_model_capabilities[] =
emptylist,
laserjet_papersources,
},
+ /* PCL-5c/5e/6/XL with large paper, no expanded A4 margins */
+ { 63,
+ 13 * 72, 19 * 72,
+ 1, 1, /* Min paper size */
+ PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
+ {12, 12, 18, 18},
+ {12, 12, 18, 18}, /* Check/Fix */
+ PCL_COLOR_NONE,
+ PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE |
+ PCL_PRINTER_DUPLEX,
+ ljbig_papersizes,
+ emptylist,
+ laserjet_papersources,
+ },
/* LaserJet 5Si */
{ 7,
13 * 72, 19 * 72,
diff --git a/src/main/print-ps.c b/src/main/print-ps.c
index 728718e..228d241 100644
--- a/src/main/print-ps.c
+++ b/src/main/print-ps.c
@@ -1,5 +1,5 @@
/*
- * "$Id: print-ps.c,v 1.101 2008/08/18 02:00:18 rlk Exp $"
+ * "$Id: print-ps.c,v 1.102 2009/09/03 00:33:52 rlk Exp $"
*
* Print plug-in Adobe PostScript driver for the GIMP.
*
@@ -771,6 +771,121 @@ ps_external_options(const stp_vars_t *v)
}
/*
+ * 'ps_print_device_settings()' - output postscript code from PPD into the
+ * postscript stream.
+ */
+
+static void
+ps_print_device_settings(stp_vars_t *v)
+{
+ int i;
+ stp_parameter_list_t param_list = ps_list_parameters(v);
+ if (! param_list)
+ return;
+ stp_puts("%%BeginSetup\n", v);
+ for (i = 0; i < stp_parameter_list_count(param_list); i++)
+ {
+ const stp_parameter_t *param = stp_parameter_list_param(param_list, i);
+ stp_parameter_t desc;
+ stp_describe_parameter(v, param->name, &desc);
+ if (desc.is_active)
+ {
+ switch (desc.p_type)
+ {
+ case STP_PARAMETER_TYPE_STRING_LIST:
+ case STP_PARAMETER_TYPE_BOOLEAN:
+ {
+ const char *val=NULL;
+ const char *defval=NULL;
+
+ /* If this is a bool parameter, set val to "True" or "False" - otherwise fetch from string parameter. */
+ if(desc.p_type==STP_PARAMETER_TYPE_BOOLEAN)
+ {
+ val=stp_get_boolean_parameter(v,desc.name) ? "True" : "False";
+ defval=desc.deflt.boolean ? "True" : "False";
+ }
+ else
+ {
+ val=stp_get_string_parameter(v,desc.name);
+ defval=desc.deflt.str;
+ }
+
+ /* We only include the option's code if it's set to a value other than the default. */
+ if(val && defval && (strcmp(val,defval)!=0))
+ {
+ if(m_ppd)
+ {
+ /* If we have a PPD xml tree we hunt for the appropriate "option" and "choice"... */
+ stp_mxml_node_t *node=m_ppd;
+ node=stp_mxmlFindElement(node,node, "option", "name", desc.name, STP_MXML_DESCEND);
+ if(node)
+ {
+ node=stp_mxmlFindElement(node,node, "choice", "name", val, STP_MXML_DESCEND);
+ if(node)
+ {
+ if(node->child && node->child->value.opaque && (strlen(node->child->value.opaque)>1))
+ {
+ /* If we have opaque data for the child, we use %%BeginFeature and copy the code verbatim. */
+ stp_puts("[{\n", v);
+ stp_zprintf(v, "%%%%BeginFeature: *%s %s\n", desc.name, val);
+ if(node->child->value.opaque)
+ stp_puts(node->child->value.opaque,v);
+ stp_puts("\n%%EndFeature\n", v);
+ stp_puts("} stopped cleartomark\n", v);
+ }
+ else
+ {
+ /* If we don't have code, we use %%IncludeFeature instead. */
+ stp_puts("[{\n", v);
+ stp_zprintf(v, "%%%%IncludeFeature: *%s %s\n", desc.name, val);
+ if(node->child->value.opaque)
+ stp_puts(node->child->value.opaque,v);
+ stp_puts("} stopped cleartomark\n", v);
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ case STP_PARAMETER_TYPE_INT:
+ if(stp_get_int_parameter(v,desc.name)!=desc.deflt.integer)
+ {
+ stp_puts("[{\n", v);
+ stp_zprintf(v, "%%%%IncludeFeature: *%s %d\n", desc.name,
+ stp_get_int_parameter(v, desc.name));
+ stp_puts("} stopped cleartomark\n", v);
+ }
+ break;
+ case STP_PARAMETER_TYPE_DOUBLE:
+ if(stp_get_float_parameter(v,desc.name)!=desc.deflt.dbl)
+ {
+ stp_puts("[{\n", v);
+ stp_zprintf(v, "%%%%IncludeFeature: *%s %f\n", desc.name,
+ stp_get_float_parameter(v, desc.name));
+ stp_puts("} stopped cleartomark\n", v);
+ }
+ break;
+ case STP_PARAMETER_TYPE_DIMENSION:
+ if(stp_get_dimension_parameter(v,desc.name)!=desc.deflt.dimension)
+ {
+ stp_puts("[{\n", v);
+ stp_zprintf(v, "%%%%IncludeFeature: *%s %d\n", desc.name,
+ stp_get_dimension_parameter(v, desc.name));
+ stp_puts("} stopped cleartomark\n", v);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ stp_parameter_description_destroy(&desc);
+ }
+ stp_puts("%%EndSetup\n", v);
+ stp_parameter_list_destroy(param_list);
+}
+
+/*
* 'ps_print()' - Print an image to a PostScript printer.
*/
@@ -867,10 +982,7 @@ ps_print_internal(stp_vars_t *v, stp_image_t *image)
stp_puts("%%Orientation: Portrait\n", v);
stp_puts("%%EndComments\n", v);
-#if 0
- /* This is still not correct -- rlk 20070601 */
ps_print_device_settings(v);
-#endif
/*
* Output the page...
diff --git a/src/main/printers.c b/src/main/printers.c
index 8df5ea9..af2a670 100644
--- a/src/main/printers.c
+++ b/src/main/printers.c
@@ -1,5 +1,5 @@
/*
- * "$Id: printers.c,v 1.85 2008/06/03 11:40:39 rlk Exp $"
+ * "$Id: printers.c,v 1.86 2009/10/05 12:37:30 rlk Exp $"
*
* Print plug-in driver utility functions for the GIMP.
*
@@ -65,6 +65,7 @@ struct stp_printer
char *long_name; /* Long name for UI */
char *family; /* Printer family */
char *manufacturer; /* Printer manufacturer */
+ char *device_id; /* IEEE 1284 device ID */
int model; /* Model number */
int vars_initialized;
const stp_printfuncs_t *printfuncs;
@@ -187,6 +188,12 @@ stpi_printer_long_namefunc(const void *item)
}
const char *
+stp_printer_get_device_id(const stp_printer_t *printer)
+{
+ return printer->device_id;
+}
+
+const char *
stp_printer_get_family(const stp_printer_t *printer)
{
return printer->family;
@@ -243,6 +250,30 @@ stp_get_printer_by_driver(const char *driver)
return (const stp_printer_t *) stp_list_item_get_data(printer_item);
}
+const stp_printer_t *
+stp_get_printer_by_device_id(const char *device_id)
+{
+ stp_list_item_t *printer_item;
+ if (printer_list == NULL)
+ {
+ stp_erprintf("No printer drivers found: "
+ "are STP_DATA_PATH and STP_MODULE_PATH correct?\n");
+ stpi_init_printer_list();
+ }
+ if (! device_id || strcmp(device_id, "") == 0)
+ return NULL;
+
+ printer_item = stp_list_get_start(printer_list);
+ while (printer_item)
+ {
+ if (strcmp(((const stp_printer_t *) stp_list_item_get_data(printer_item)),
+ device_id) == 0)
+ return ((const stp_printer_t *) stp_list_item_get_data(printer_item));
+ printer_item = stp_list_item_next(printer_item);
+ }
+ return NULL;
+}
+
int
stp_get_printer_index_by_driver(const char *driver)
{
@@ -1054,6 +1085,9 @@ stp_printer_create_from_xmltree(stp_mxml_node_t *printer, /* The printer node */
outprinter->manufacturer = stp_strdup(stp_mxmlElementGetAttr(printer, "manufacturer"));
outprinter->model = stp_xmlstrtol(stp_mxmlElementGetAttr(printer, "model"));
outprinter->family = stp_strdup((const char *) family);
+ stmp = stp_mxmlElementGetAttr(printer, "deviceid");
+ if (stmp)
+ outprinter->device_id = stp_strdup(stmp);
if (stp_get_driver(outprinter->printvars))
driver = 1;
diff --git a/src/main/xmlppd.c b/src/main/xmlppd.c
index 10c2bb9..c633694 100644
--- a/src/main/xmlppd.c
+++ b/src/main/xmlppd.c
@@ -23,6 +23,8 @@
#include <stdio.h>
#include <gutenprint/mxml.h>
+#include <gutenprint/util.h>
+#include <gutenprint/string-list.h>
#include <stdlib.h>
#include "xmlppd.h"
@@ -213,6 +215,8 @@ stpi_xmlppd_read_ppd_file(const char *filename) /* I - PPD file */
int order_length;
char *order_list;
int in_comment;
+ stp_string_list_t *ialist = stp_string_list_create();
+ stp_string_list_t *pdlist = stp_string_list_create();
/*
@@ -478,35 +482,51 @@ stpi_xmlppd_read_ppd_file(const char *filename) /* I - PPD file */
}
else if (!option && !strcmp(buffer, "*ImageableArea"))
{
- stp_mxml_node_t *psize = stpi_xmlppd_find_page_size(ppd, keyword);
- if (psize)
+ stp_string_list_add_string(ialist, keyword, value);
+ }
+ else if (!option && !strcmp(buffer, "*PaperDimension"))
+ {
+ stp_string_list_add_string(pdlist, keyword, value);
+ }
+ }
+ for (i = 0; i < stp_string_list_count(ialist); i++)
+ {
+ stp_param_string_t *pstr = stp_string_list_param(ialist, i);
+ stp_mxml_node_t *psize = stpi_xmlppd_find_page_size(ppd, pstr->name);
+ if (psize)
+ {
+ const char *data[4];
+ value = stp_strdup(pstr->text);
+ parse_values(data, 4, value);
+ if (data[3])
{
- const char *data[4];
- parse_values(data, 4, value);
- if (data[3])
- {
- stp_mxmlElementSetAttr(psize, "left", data[0]);
- stp_mxmlElementSetAttr(psize, "bottom", data[1]);
- stp_mxmlElementSetAttr(psize, "right", data[2]);
- stp_mxmlElementSetAttr(psize, "top", data[3]);
- }
+ stp_mxmlElementSetAttr(psize, "left", data[0]);
+ stp_mxmlElementSetAttr(psize, "bottom", data[1]);
+ stp_mxmlElementSetAttr(psize, "right", data[2]);
+ stp_mxmlElementSetAttr(psize, "top", data[3]);
}
+ stp_free(value);
}
- else if (!option && !strcmp(buffer, "*PaperDimension"))
+ }
+ stp_string_list_destroy(ialist);
+ for (i = 0; i < stp_string_list_count(pdlist); i++)
+ {
+ stp_param_string_t *pstr = stp_string_list_param(pdlist, i);
+ stp_mxml_node_t *psize = stpi_xmlppd_find_page_size(ppd, pstr->name);
+ if (psize)
{
- stp_mxml_node_t *psize = stpi_xmlppd_find_page_size(ppd, keyword);
- if (psize)
+ const char *data[2];
+ value = stp_strdup(pstr->text);
+ parse_values(data, 2, value);
+ if (data[1])
{
- const char *data[2];
- parse_values(data, 2, value);
- if (data[1])
- {
- stp_mxmlElementSetAttr(psize, "width", data[0]);
- stp_mxmlElementSetAttr(psize, "height", data[1]);
- }
+ stp_mxmlElementSetAttr(psize, "width", data[0]);
+ stp_mxmlElementSetAttr(psize, "height", data[1]);
}
+ stp_free(value);
}
}
+ stp_string_list_destroy(pdlist);
option_count = stpi_xmlppd_find_option_count(ppd);
order_length = 1; /* Terminating null */
order_array = malloc(sizeof(order_t) * option_count);