summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sweet <michael.r.sweet@gmail.com>2017-03-08 16:07:09 -0500
committerMichael Sweet <michael.r.sweet@gmail.com>2017-03-08 16:07:09 -0500
commit1fbd0cabfb917b9e4eca8f38a62809fa4c138b21 (patch)
tree4ad5d8d4777ceb0f2258f096087840048a2e6cde
parent9c0c89124b4d251674905fc8560cf9ed21040a46 (diff)
First half of the changes for Issue #4960, Issue #4961, and Issue #4962 - add
a cupsIPPFinishings mapping for standard/common keywords when cupsIPPFinishings is not specified in the PPD file (as it should be for CUPS drivers).
-rw-r--r--CHANGES.txt2
-rw-r--r--cups/ppd-cache.c139
-rw-r--r--doc/help/man-client.conf.html2
-rw-r--r--doc/help/man-cups-files.conf.html2
-rw-r--r--doc/help/man-cups-lpd.html2
-rw-r--r--doc/help/man-cups-snmp.html2
-rw-r--r--doc/help/man-cupsaddsmb.html2
-rw-r--r--doc/help/man-cupsd.conf.html2
-rw-r--r--doc/help/man-cupsd.html2
-rw-r--r--doc/help/man-lpoptions.html2
-rw-r--r--scheduler/printers.c3
11 files changed, 150 insertions, 10 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index b9cb71f40..999dcf269 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,8 @@ CHANGES IN CUPS V2.2.3
causing a hung queue (<rdar://problem/28008717>)
- The scheduler could pause responding to client requests in order to
save state changes to disk (<rdar://problem/28690656>)
+ - Added support for PPD finishing keywords (Issue #4960, Issue #4961,
+ Issue #4962)
- Fixed some localization issues on macOS (<rdar://problem/27245567>)
diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c
index e8b05e43a..163e18c93 100644
--- a/cups/ppd-cache.c
+++ b/cups/ppd-cache.c
@@ -32,6 +32,7 @@
* Local functions...
*/
+static void pwg_add_finishing(cups_array_t *finishings, ipp_finishings_t template, const char *name, const char *value);
static int pwg_compare_finishings(_pwg_finishings_t *a,
_pwg_finishings_t *b);
static void pwg_free_finishings(_pwg_finishings_t *f);
@@ -1714,6 +1715,10 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
if ((ppd_attr = ppdFindAttr(ppd, "cupsIPPFinishings", NULL)) != NULL)
{
+ /*
+ * Have proper vendor mapping of IPP finishings values to PPD options...
+ */
+
pc->finishings = cupsArrayNew3((cups_array_func_t)pwg_compare_finishings,
NULL, NULL, 0, NULL,
(cups_afree_func_t)pwg_free_finishings);
@@ -1733,6 +1738,114 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
while ((ppd_attr = ppdFindNextAttr(ppd, "cupsIPPFinishings",
NULL)) != NULL);
}
+ else
+ {
+ /*
+ * No IPP mapping data, try to map common/standard PPD keywords...
+ */
+
+ ppd_option_t *ppd_option; /* PPD option */
+
+ pc->finishings = cupsArrayNew3((cups_array_func_t)pwg_compare_finishings, NULL, NULL, 0, NULL, (cups_afree_func_t)pwg_free_finishings);
+
+ if ((ppd_option = ppdFindOption(ppd, "StapleLocation")) != NULL)
+ {
+ /*
+ * Add staple finishings...
+ */
+
+ if (ppdFindChoice(ppd_option, "SinglePortrait"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_LEFT, "StapleLocation", "SinglePortrait");
+ if (ppdFindChoice(ppd_option, "UpperLeft")) /* Ricoh extension */
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_LEFT, "StapleLocation", "UpperLeft");
+ if (ppdFindChoice(ppd_option, "UpperRight")) /* Ricoh extension */
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_RIGHT, "StapleLocation", "UpperRight");
+ if (ppdFindChoice(ppd_option, "SingleLandscape"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_BOTTOM_LEFT, "StapleLocation", "SingleLandscape");
+ if (ppdFindChoice(ppd_option, "DualLandscape"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_DUAL_LEFT, "StapleLocation", "DualLandscape");
+ }
+
+ if ((ppd_option = ppdFindOption(ppd, "RIPunch")) != NULL)
+ {
+ /*
+ * Add (Ricoh) punch finishings...
+ */
+
+ if (ppdFindChoice(ppd_option, "Left2"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_LEFT, "RIPunch", "Left2");
+ if (ppdFindChoice(ppd_option, "Left3"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_LEFT, "RIPunch", "Left3");
+ if (ppdFindChoice(ppd_option, "Left4"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_LEFT, "RIPunch", "Left4");
+ if (ppdFindChoice(ppd_option, "Right2"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_RIGHT, "RIPunch", "Right2");
+ if (ppdFindChoice(ppd_option, "Right3"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_RIGHT, "RIPunch", "Right3");
+ if (ppdFindChoice(ppd_option, "Right4"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_RIGHT, "RIPunch", "Right4");
+ if (ppdFindChoice(ppd_option, "Upper2"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_TOP, "RIPunch", "Upper2");
+ if (ppdFindChoice(ppd_option, "Upper3"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_TOP, "RIPunch", "Upper3");
+ if (ppdFindChoice(ppd_option, "Upper4"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_TOP, "RIPunch", "Upper4");
+ }
+
+ if ((ppd_option = ppdFindOption(ppd, "BindEdge")) != NULL)
+ {
+ /*
+ * Add bind finishings...
+ */
+
+ if (ppdFindChoice(ppd_option, "Left"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_LEFT, "BindEdge", "Left");
+ if (ppdFindChoice(ppd_option, "Right"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_RIGHT, "BindEdge", "Right");
+ if (ppdFindChoice(ppd_option, "Top"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_TOP, "BindEdge", "Top");
+ if (ppdFindChoice(ppd_option, "Bottom"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_BOTTOM, "BindEdge", "Bottom");
+ }
+
+ if ((ppd_option = ppdFindOption(ppd, "FoldType")) != NULL)
+ {
+ /*
+ * Add (Adobe) fold finishings...
+ */
+
+ if (ppdFindChoice(ppd_option, "ZFold"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_Z, "FoldType", "ZFold");
+ if (ppdFindChoice(ppd_option, "Saddle"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_HALF, "FoldType", "Saddle");
+ if (ppdFindChoice(ppd_option, "DoubleGate"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_DOUBLE_GATE, "FoldType", "DoubleGate");
+ if (ppdFindChoice(ppd_option, "LeftGate"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LEFT_GATE, "FoldType", "LeftGate");
+ if (ppdFindChoice(ppd_option, "RightGate"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_RIGHT_GATE, "FoldType", "RightGate");
+ if (ppdFindChoice(ppd_option, "Letter"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LETTER, "FoldType", "Letter");
+ if (ppdFindChoice(ppd_option, "XFold"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_POSTER, "FoldType", "XFold");
+ }
+
+ if ((ppd_option = ppdFindOption(ppd, "RIFoldType")) != NULL)
+ {
+ /*
+ * Add (Ricoh) fold finishings...
+ */
+
+ if (ppdFindChoice(ppd_option, "OutsideTwoFold"))
+ pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LETTER, "RIFoldType", "OutsideTwoFold");
+ }
+
+ if (cupsArrayCount(pc->finishings) == 0)
+ {
+ cupsArrayDelete(pc->finishings);
+ pc->finishings = NULL;
+ }
+ }
/*
* Max copies...
@@ -4095,10 +4208,34 @@ _pwgPageSizeForMedia(
/*
+ * 'pwg_add_finishing()' - Add a finishings value.
+ */
+
+static void
+pwg_add_finishing(
+ cups_array_t *finishings, /* I - Finishings array */
+ ipp_finishings_t template, /* I - Finishing template */
+ const char *name, /* I - PPD option */
+ const char *value) /* I - PPD choice */
+{
+ _pwg_finishings_t *f; /* New finishings value */
+
+
+ if ((f = (_pwg_finishings_t *)calloc(1, sizeof(_pwg_finishings_t))) != NULL)
+ {
+ f->value = template;
+ f->num_options = cupsAddOption(name, value, 0, &f->options);
+
+ cupsArrayAdd(finishings, f);
+ }
+}
+
+
+/*
* 'pwg_compare_finishings()' - Compare two finishings values.
*/
-static int /* O- Result of comparison */
+static int /* O - Result of comparison */
pwg_compare_finishings(
_pwg_finishings_t *a, /* I - First finishings value */
_pwg_finishings_t *b) /* I - Second finishings value */
diff --git a/doc/help/man-client.conf.html b/doc/help/man-client.conf.html
index 0fef0d479..6febe5e32 100644
--- a/doc/help/man-client.conf.html
+++ b/doc/help/man-client.conf.html
@@ -76,7 +76,7 @@ On Linux and other systems using GNU TLS, the <i>/etc/cups/ssl/site.crl</i> file
<b>default</b>(1),
CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
<h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
</body>
</html>
diff --git a/doc/help/man-cups-files.conf.html b/doc/help/man-cups-files.conf.html
index 046a642ea..7dfcd211d 100644
--- a/doc/help/man-cups-files.conf.html
+++ b/doc/help/man-cups-files.conf.html
@@ -164,7 +164,7 @@ The default is "lp".
<a href="man-subscriptions.conf.html?TOPIC=Man+Pages"><b>subscriptions.conf</b>(5),</a>
CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
<h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
</body>
</html>
diff --git a/doc/help/man-cups-lpd.html b/doc/help/man-cups-lpd.html
index e7b4fb9cf..7a6b6396d 100644
--- a/doc/help/man-cups-lpd.html
+++ b/doc/help/man-cups-lpd.html
@@ -108,7 +108,7 @@ service using the corresponding control program.
CUPS Online Help (<a href="http://localhost:631/help)">http://localhost:631/help)</a>,
RFC 2569
<h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
</body>
</html>
diff --git a/doc/help/man-cups-snmp.html b/doc/help/man-cups-snmp.html
index 546014726..9baf07065 100644
--- a/doc/help/man-cups-snmp.html
+++ b/doc/help/man-cups-snmp.html
@@ -48,7 +48,7 @@ The CUPS SNMP backend uses the information from the Host, Printer, and Port Moni
<a href="man-lpinfo.html?TOPIC=Man+Pages"><b>lpinfo</b>(8),</a>
CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
<h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
</body>
</html>
diff --git a/doc/help/man-cupsaddsmb.html b/doc/help/man-cupsaddsmb.html
index 14c0e0130..454174ee2 100644
--- a/doc/help/man-cupsaddsmb.html
+++ b/doc/help/man-cupsaddsmb.html
@@ -115,7 +115,7 @@ This is useful for debugging SAMBA configuration problems.
<b>smb.conf</b>(5),
CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
<h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
</body>
</html>
diff --git a/doc/help/man-cupsd.conf.html b/doc/help/man-cupsd.conf.html
index 85e601edf..2fae0b7f9 100644
--- a/doc/help/man-cupsd.conf.html
+++ b/doc/help/man-cupsd.conf.html
@@ -596,7 +596,7 @@ Require authentication for accesses from outside the 10. network:
<a href="man-subscriptions.conf.html?TOPIC=Man+Pages"><b>subscriptions.conf</b>(5),</a>
CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
<h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
</body>
</html>
diff --git a/doc/help/man-cupsd.html b/doc/help/man-cupsd.html
index e10961b01..009485128 100644
--- a/doc/help/man-cupsd.html
+++ b/doc/help/man-cupsd.html
@@ -117,7 +117,7 @@ in the foreground with a test configuration file called
<b>systemd</b>(8),
CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
<h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
</body>
</html>
diff --git a/doc/help/man-lpoptions.html b/doc/help/man-lpoptions.html
index e4eaf714e..20c578285 100644
--- a/doc/help/man-lpoptions.html
+++ b/doc/help/man-lpoptions.html
@@ -119,7 +119,7 @@ The <b>lpoptions</b> command is unique to CUPS.
<a href="man-lprm.html?TOPIC=Man+Pages"><b>lprm</b>(1),</a>
CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
<h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright &copy; 2007-2017 by Apple Inc.
+Copyright &copy; 2007-2016 by Apple Inc.
</body>
</html>
diff --git a/scheduler/printers.c b/scheduler/printers.c
index 63ca80d67..985f86622 100644
--- a/scheduler/printers.c
+++ b/scheduler/printers.c
@@ -1,7 +1,7 @@
/*
* Printer routines for the CUPS scheduler.
*
- * Copyright 2007-2016 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -4584,6 +4584,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
if (ppdFindOption(ppd, "Collate") != NULL)
p->type |= CUPS_PRINTER_COLLATE;
+ /* TODO: look at finishings array for values */
if (ppdFindOption(ppd, "StapleLocation") != NULL)
{
p->type |= CUPS_PRINTER_STAPLE;