summaryrefslogtreecommitdiff
path: root/src/cups
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2008-10-26 16:15:53 +0000
committerRoger Leigh <rleigh@debian.org>2008-10-26 16:15:53 +0000
commit97aedb05b271e9486f51eac1aee64fce92da64ca (patch)
tree9abd1bee206c4ea14bfebac318846e5fe32c6c67 /src/cups
parent162bb22c0a612c065ea77a88136fcf8ded9159a9 (diff)
Imported Upstream version 4.3.99+cvs20060121.dfsg.1
Diffstat (limited to 'src/cups')
-rw-r--r--src/cups/Makefile.in3
-rw-r--r--src/cups/cups-genppdupdate.in9
-rw-r--r--src/cups/genppd.c184
-rw-r--r--src/cups/rastertoprinter.c17
4 files changed, 33 insertions, 180 deletions
diff --git a/src/cups/Makefile.in b/src/cups/Makefile.in
index f506b11..9f1ccf9 100644
--- a/src/cups/Makefile.in
+++ b/src/cups/Makefile.in
@@ -351,10 +351,13 @@ exec_prefix = @exec_prefix@
gimp2_plug_indir = @gimp2_plug_indir@
gimp_plug_indir = @gimp_plug_indir@
gutenprint_cflags = @gutenprint_cflags@
+gutenprint_libdeps = @gutenprint_libdeps@
gutenprint_libs = @gutenprint_libs@
gutenprintui2_cflags = @gutenprintui2_cflags@
+gutenprintui2_libdeps = @gutenprintui2_libdeps@
gutenprintui2_libs = @gutenprintui2_libs@
gutenprintui_cflags = @gutenprintui_cflags@
+gutenprintui_libdeps = @gutenprintui_libdeps@
gutenprintui_libs = @gutenprintui_libs@
host = @host@
host_alias = @host_alias@
diff --git a/src/cups/cups-genppdupdate.in b/src/cups/cups-genppdupdate.in
index 94e9085..1b90140 100644
--- a/src/cups/cups-genppdupdate.in
+++ b/src/cups/cups-genppdupdate.in
@@ -1,5 +1,5 @@
#! @PERL@ -w
-# $Id: cups-genppdupdate.in,v 1.21 2005/08/14 10:07:36 rleigh Exp $
+# $Id: cups-genppdupdate.in,v 1.22 2005/12/24 22:41:11 rlk Exp $
# Update CUPS PPDs for Gutenprint queues.
# Copyright (C) 2002-2003 Roger Leigh (rleigh@debian.org)
#
@@ -173,6 +173,7 @@ sub update_ppd ($) {
open ORIG, $_ or die "$_: can't open PPD file: $!";
seek (ORIG, 0, 0) or die "can't seek to start of PPD file";
+ my @orig_metadata = stat(ORIG);
if ($debug) {
print "Source Filename: $ppd_source_filename\n";
}
@@ -277,8 +278,6 @@ sub update_ppd ($) {
# Save new PPD in a temporary file, for processing...
my($tmpfile, $tmpfilename) = tmpnam();
- chown(0, 0, $tmpfilename); # root.root
- chmod(0644, $tmpfilename);
unlink $tmpfilename or warn "can't unlink temporary file $tmpfile: $!\n";
print $tmpfile $source_data;
@@ -366,8 +365,6 @@ default_loop:
warn "Can't open $tmpnew for writing: $!\n";
return 0;
}
- chown(0, 0, $tmpnew); # Bad idea to hardcode this...
- chmod(0644, $tmpnew); # Bad idea to hardcode this...
print NEWPPD $source_data;
if (! close NEWPPD) {
warn "Can't close ${tmpnew}.new for writing: $!\n";
@@ -380,6 +377,8 @@ default_loop:
unlink $tmpnew;
return 0;
}
+ chown($orig_metadata[4], $orig_metadata[5], $ppd_source_filename);
+ chmod(($orig_metadata[2] & 0777), $ppd_source_filename);
if (!$quiet || $verbose) {
print STDOUT "Updated $ppd_source_filename using $source\n";
diff --git a/src/cups/genppd.c b/src/cups/genppd.c
index c39d768..bdff9fe 100644
--- a/src/cups/genppd.c
+++ b/src/cups/genppd.c
@@ -1,5 +1,5 @@
/*
- * "$Id: genppd.c,v 1.109 2005/10/18 02:08:16 rlk Exp $"
+ * "$Id: genppd.c,v 1.113 2005/12/31 21:27:29 rlk Exp $"
*
* PPD file generation program for the CUPS drivers.
*
@@ -1234,10 +1234,17 @@ write_ppd(const stp_printer_t *p, /* I - Printer driver */
stp_set_string_parameter(v, "Quality", opt->name);
stp_describe_resolution(v, &xdpi, &ydpi);
if (xdpi == -1 || ydpi == -1)
- gzprintf(fp, "*StpQuality %s/%s: \"\"\n", opt->name, opt->text);
- else
- gzprintf(fp, "*StpQuality %s/%s:\t\"<</HWResolution[%d %d]>>setpagedevice\"\n",
- opt->name, opt->text, xdpi, ydpi);
+ {
+ stp_parameter_t res_desc;
+ stp_clear_string_parameter(v, "Quality");
+ stp_describe_parameter(v, "Resolution", &res_desc);
+ stp_set_string_parameter(v, "Resolution", res_desc.deflt.str);
+ stp_describe_resolution(v, &xdpi, &ydpi);
+ stp_clear_string_parameter(v, "Resolution");
+ stp_parameter_description_destroy(&res_desc);
+ }
+ gzprintf(fp, "*StpQuality %s/%s:\t\"<</HWResolution[%d %d]/cupsRowFeed %d>>setpagedevice\"\n",
+ opt->name, opt->text, xdpi, ydpi, i + 1);
}
gzputs(fp, "*CloseUI: *StpQuality\n\n");
}
@@ -1300,7 +1307,7 @@ write_ppd(const stp_printer_t *p, /* I - Printer driver */
*/
gzprintf(fp, "*Resolution %s/%s:\t\"<</HWResolution[%d %d]/cupsCompression %d>>setpagedevice\"\n",
- opt->name, opt->text, xdpi, ydpi, i);
+ opt->name, opt->text, xdpi, ydpi, i + 1);
}
stp_parameter_description_destroy(&desc);
@@ -1488,169 +1495,6 @@ write_ppd(const stp_printer_t *p, /* I - Printer driver */
print_group_close(fp, j, k);
}
}
- if (has_quality_parameter)
- {
- stp_parameter_t qdesc;
- const char *tname = NULL;
- stp_describe_parameter(v, "Quality", &qdesc);
- if (qdesc.p_type == STP_PARAMETER_TYPE_STRING_LIST &&
- stp_string_list_count(qdesc.bounds.str) > 1)
- {
- for (l = 0; l < stp_string_list_count(qdesc.bounds.str); l++)
- {
- opt = stp_string_list_param(qdesc.bounds.str, l);
- if (opt && strcmp(opt->name, "None") != 0)
- {
- tname = opt->name;
- break;
- }
- }
- }
- for (l = 0; l < stp_parameter_list_count(param_list); l++)
- {
- const stp_parameter_t *lparam =
- stp_parameter_list_param(param_list, l);
- if (lparam->p_class > STP_PARAMETER_CLASS_OUTPUT ||
- lparam->p_level > STP_PARAMETER_LEVEL_ADVANCED4 ||
- strcmp(lparam->name, "Quality") == 0 ||
- (lparam->p_type != STP_PARAMETER_TYPE_STRING_LIST &&
- lparam->p_type != STP_PARAMETER_TYPE_BOOLEAN &&
- lparam->p_type != STP_PARAMETER_TYPE_DIMENSION &&
- lparam->p_type != STP_PARAMETER_TYPE_DOUBLE))
- continue;
- stp_clear_string_parameter(v, "Quality");
- stp_describe_parameter(v, lparam->name, &desc);
- if (desc.is_active)
- {
- stp_parameter_description_destroy(&desc);
- stp_set_string_parameter(v, "Quality", tname);
- stp_describe_parameter(v, lparam->name, &desc);
- if (!desc.is_active)
- {
- gzprintf(fp, "*UIConstraints: *StpQuality *Stp%s\n",
- lparam->name);
- gzprintf(fp, "*UIConstraints: *Stp%s *StpQuality\n\n",
- lparam->name);
- if (desc.p_type == STP_PARAMETER_TYPE_DOUBLE)
- {
- gzprintf(fp, "*UIConstraints: *StpQuality *StpFine%s\n",
- lparam->name);
- gzprintf(fp, "*UIConstraints: *StpFine%s *StpQuality\n\n",
- lparam->name);
- }
- }
- }
- stp_clear_string_parameter(v, "Quality");
- stp_parameter_description_destroy(&desc);
- }
- stp_parameter_description_destroy(&qdesc);
- }
- if (has_image_type_parameter)
- {
- stp_parameter_t qdesc;
- const char *tname = NULL;
- stp_describe_parameter(v, "ImageType", &qdesc);
- if (qdesc.p_type == STP_PARAMETER_TYPE_STRING_LIST &&
- stp_string_list_count(qdesc.bounds.str) > 1)
- {
- for (l = 0; l < stp_string_list_count(qdesc.bounds.str); l++)
- {
- opt = stp_string_list_param(qdesc.bounds.str, l);
- if (opt && strcmp(opt->name, "None") != 0)
- {
- tname = opt->name;
- break;
- }
- }
- }
- for (l = 0; l < stp_parameter_list_count(param_list); l++)
- {
- const stp_parameter_t *lparam =
- stp_parameter_list_param(param_list, l);
- if (lparam->p_class > STP_PARAMETER_CLASS_OUTPUT ||
- lparam->p_level > STP_PARAMETER_LEVEL_ADVANCED4 ||
- strcmp(lparam->name, "ImageType") == 0 ||
- (lparam->p_type != STP_PARAMETER_TYPE_STRING_LIST &&
- lparam->p_type != STP_PARAMETER_TYPE_BOOLEAN &&
- lparam->p_type != STP_PARAMETER_TYPE_DIMENSION &&
- lparam->p_type != STP_PARAMETER_TYPE_DOUBLE))
- continue;
- stp_clear_string_parameter(v, "ImageType");
- stp_describe_parameter(v, lparam->name, &desc);
- if (desc.is_active)
- {
- stp_parameter_description_destroy(&desc);
- stp_set_string_parameter(v, "ImageType", tname);
- stp_describe_parameter(v, lparam->name, &desc);
- if (!desc.is_active)
- {
- gzprintf(fp, "*UIConstraints: *StpImageType *Stp%s\n",
- lparam->name);
- gzprintf(fp, "*UIConstraints: *Stp%s *StpImageType\n\n",
- lparam->name);
- if (desc.p_type == STP_PARAMETER_TYPE_DOUBLE)
- {
- gzprintf(fp, "*UIConstraints: *StpImageType *StpFine%s\n",
- lparam->name);
- gzprintf(fp, "*UIConstraints: *StpFine%s *StpImageType\n\n",
- lparam->name);
- }
- }
- }
- stp_clear_string_parameter(v, "ImageType");
- stp_parameter_description_destroy(&desc);
- }
- stp_parameter_description_destroy(&qdesc);
- }
- if (printer_is_color)
- {
- for (l = 0; l < stp_parameter_list_count(param_list); l++)
- {
- const stp_parameter_t *lparam =
- stp_parameter_list_param(param_list, l);
- if (lparam->p_class > STP_PARAMETER_CLASS_OUTPUT ||
- lparam->p_level > STP_PARAMETER_LEVEL_ADVANCED4 ||
- strcmp(lparam->name, "Quality") == 0 ||
- is_special_option(lparam->name) ||
- (lparam->p_type != STP_PARAMETER_TYPE_STRING_LIST &&
- lparam->p_type != STP_PARAMETER_TYPE_BOOLEAN &&
- lparam->p_type != STP_PARAMETER_TYPE_DIMENSION &&
- lparam->p_type != STP_PARAMETER_TYPE_DOUBLE))
- continue;
- stp_set_string_parameter(v, "PrintingMode", "Color");
- stp_describe_parameter(v, lparam->name, &desc);
- if (desc.is_active)
- {
- stp_parameter_description_destroy(&desc);
- stp_set_string_parameter(v, "PrintingMode", "BW");
- stp_describe_parameter(v, lparam->name, &desc);
- if (!desc.is_active)
- {
- gzprintf(fp, "*UIConstraints: *ColorModel Gray *Stp%s\n",
- lparam->name);
- gzprintf(fp, "*UIConstraints: *ColorModel Black *Stp%s\n",
- lparam->name);
- gzprintf(fp, "*UIConstraints: *Stp%s *ColorModel Gray\n",
- lparam->name);
- gzprintf(fp, "*UIConstraints: *Stp%s *ColorModel Black\n\n",
- lparam->name);
- if (desc.p_type == STP_PARAMETER_TYPE_DOUBLE)
- {
- gzprintf(fp, "*UIConstraints: *ColorModel Gray *StpFine%s\n",
- lparam->name);
- gzprintf(fp, "*UIConstraints: *ColorModel Black *StpFine%s\n",
- lparam->name);
- gzprintf(fp, "*UIConstraints: *StpFine%s *ColorModel Gray\n",
- lparam->name);
- gzprintf(fp, "*UIConstraints: *StpFine%s *ColorModel Black\n\n",
- lparam->name);
- }
- }
- }
- stp_parameter_description_destroy(&desc);
- }
- stp_set_string_parameter(v, "PrintingMode", "Color");
- }
stp_parameter_list_destroy(param_list);
/*
@@ -1707,5 +1551,5 @@ write_ppd(const stp_printer_t *p, /* I - Printer driver */
/*
- * End of "$Id: genppd.c,v 1.109 2005/10/18 02:08:16 rlk Exp $".
+ * End of "$Id: genppd.c,v 1.113 2005/12/31 21:27:29 rlk Exp $".
*/
diff --git a/src/cups/rastertoprinter.c b/src/cups/rastertoprinter.c
index b9da368..64b0d0d 100644
--- a/src/cups/rastertoprinter.c
+++ b/src/cups/rastertoprinter.c
@@ -1,5 +1,5 @@
/*
- * "$Id: rastertoprinter.c,v 1.96 2005/04/23 00:26:07 rlk Exp $"
+ * "$Id: rastertoprinter.c,v 1.97 2005/12/24 23:15:23 rlk Exp $"
*
* Gutenprint based raster filter for the Common UNIX Printing System.
*
@@ -131,7 +131,13 @@ set_special_parameter(stp_vars_t *v, const char *name, int choice)
stp_describe_parameter(v, name, &desc);
if (desc.p_type == STP_PARAMETER_TYPE_STRING_LIST)
{
- if (choice >= stp_string_list_count(desc.bounds.str))
+ if (choice < 0)
+ {
+ stp_clear_string_parameter(v, name);
+ fprintf(stderr, "DEBUG: Gutenprint clear special parameter %s\n",
+ name);
+ }
+ else if (choice >= stp_string_list_count(desc.bounds.str))
fprintf(stderr, "ERROR: Gutenprint unable to set %s!\n", name);
else
{
@@ -368,8 +374,9 @@ initialize_page(cups_image_t *cups, const stp_vars_t *default_settings)
break;
}
- if (cups->header.cupsCompression >= 0)
- set_special_parameter(v, "Resolution", cups->header.cupsCompression);
+ set_special_parameter(v, "Resolution", cups->header.cupsCompression - 1);
+
+ set_special_parameter(v, "Quality", cups->header.cupsRowFeed - 1);
if (cups->header.MediaClass && strlen(cups->header.MediaClass) > 0)
set_string_parameter(v, "InputSlot", cups->header.MediaClass);
@@ -1091,5 +1098,5 @@ Image_width(stp_image_t *image) /* I - Image */
/*
- * End of "$Id: rastertoprinter.c,v 1.96 2005/04/23 00:26:07 rlk Exp $".
+ * End of "$Id: rastertoprinter.c,v 1.97 2005/12/24 23:15:23 rlk Exp $".
*/