| 764 | // |
| 765 | |
| 766 | void |
| 767 | ppdcSource::get_duplex(ppdcFile *fp, // I - File to read from |
| 768 | ppdcDriver *d) // I - Current driver |
| 769 | { |
| 770 | char temp[256]; // Duplex keyword |
| 771 | ppdcAttr *attr; // cupsFlipDuplex attribute |
| 772 | ppdcGroup *g; // Current group |
| 773 | ppdcOption *o; // Duplex option |
| 774 | |
| 775 | |
| 776 | // Duplex {boolean|none|normal|flip} |
| 777 | if (!get_token(fp, temp, sizeof(temp))) |
| 778 | { |
| 779 | _cupsLangPrintf(stderr, |
| 780 | _("ppdc: Expected duplex type after Duplex on line %d of " |
| 781 | "%s."), fp->line, fp->filename); |
| 782 | return; |
| 783 | } |
| 784 | |
| 785 | if (cond_state) |
| 786 | return; |
| 787 | |
| 788 | if (!_cups_strcasecmp(temp, "none") || !_cups_strcasecmp(temp, "false") || |
| 789 | !_cups_strcasecmp(temp, "no") || !_cups_strcasecmp(temp, "off")) |
| 790 | { |
| 791 | g = d->find_group("General"); |
| 792 | if ((o = g->find_option("Duplex")) != NULL) |
| 793 | g->options->remove(o); |
| 794 | |
| 795 | for (attr = (ppdcAttr *)d->attrs->first(); |
| 796 | attr; |
| 797 | attr = (ppdcAttr *)d->attrs->next()) |
| 798 | if (!strcmp(attr->name->value, "cupsFlipDuplex")) |
| 799 | { |
| 800 | d->attrs->remove(attr); |
| 801 | break; |
| 802 | } |
| 803 | } |
| 804 | else if (!_cups_strcasecmp(temp, "normal") || !_cups_strcasecmp(temp, "true") || |
| 805 | !_cups_strcasecmp(temp, "yes") || !_cups_strcasecmp(temp, "on") || |
| 806 | !_cups_strcasecmp(temp, "flip") || !_cups_strcasecmp(temp, "rotated") || |
| 807 | !_cups_strcasecmp(temp, "manualtumble")) |
| 808 | { |
| 809 | g = d->find_group("General"); |
| 810 | o = g->find_option("Duplex"); |
| 811 | |
| 812 | if (!o) |
| 813 | { |
| 814 | o = new ppdcOption(PPDC_PICKONE, "Duplex", "2-Sided Printing", |
| 815 | !_cups_strcasecmp(temp, "flip") ? PPDC_SECTION_PAGE : |
| 816 | PPDC_SECTION_ANY, 10.0f); |
| 817 | o->add_choice(new ppdcChoice("None", "Off (1-Sided)", |
| 818 | "<</Duplex false>>setpagedevice")); |
| 819 | o->add_choice(new ppdcChoice("DuplexNoTumble", "Long-Edge (Portrait)", |
| 820 | "<</Duplex true/Tumble false>>setpagedevice")); |
| 821 | o->add_choice(new ppdcChoice("DuplexTumble", "Short-Edge (Landscape)", |
| 822 | "<</Duplex true/Tumble true>>setpagedevice")); |
| 823 |
nothing calls this directly
no test coverage detected