| 1 |
// -*- C++ -*- |
| 2 |
// $Id: CupsFilterLabelWriter.cpp 10899 2010-02-08 18:21:16Z vbuzuev $ |
| 3 |
|
| 4 |
// DYMO LabelWriter Drivers |
| 5 |
// Copyright (C) 2008 Sanford L.P. |
| 6 |
|
| 7 |
// This program is free software; you can redistribute it and/or |
| 8 |
// modify it under the terms of the GNU General Public License |
| 9 |
// as published by the Free Software Foundation; either version 2 |
| 10 |
// of the License, or (at your option) any later version. |
| 11 |
|
| 12 |
// This program is distributed in the hope that it will be useful, |
| 13 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
// GNU General Public License for more details. |
| 16 |
|
| 17 |
// You should have received a copy of the GNU General Public License |
| 18 |
// along with this program; if not, write to the Free Software |
| 19 |
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 |
|
| 21 |
#include "CupsFilterLabelWriter.h" |
| 22 |
|
| 23 |
namespace DymoPrinterDriver |
| 24 |
{ |
| 25 |
|
| 26 |
void CDriverInitializerLabelWriter::ProcessPPDOptions(CLabelWriterDriver& Driver, CDummyLanguageMonitor& LM, ppd_file_t* ppd) |
| 27 |
{ |
| 28 |
ppd_choice_t* choice = ppdFindMarkedChoice(ppd, "Resolution"); |
| 29 |
if (choice) |
| 30 |
{ |
| 31 |
if (!strcasecmp(choice->choice, "203dpi")) |
| 32 |
Driver.SetResolution(CLabelWriterDriver::res204); |
| 33 |
else if (!strcasecmp(choice->choice, "203x138dpi")) |
| 34 |
Driver.SetResolution(CLabelWriterDriver::res136); |
| 35 |
} |
| 36 |
else |
| 37 |
fputs("WARNING: unable to get Resolution choice\n", stderr); |
| 38 |
|
| 39 |
choice = ppdFindMarkedChoice(ppd, "DymoPrintQuality"); |
| 40 |
if (choice) |
| 41 |
{ |
| 42 |
if (!strcasecmp(choice->choice, "Text")) |
| 43 |
Driver.SetQuality(CLabelWriterDriver::pqText); |
| 44 |
else if (!strcasecmp(choice->choice, "Graphics")) |
| 45 |
Driver.SetQuality(CLabelWriterDriver::pqBarcodeAndGraphics); |
| 46 |
} |
| 47 |
else |
| 48 |
fputs("WARNING: unable to get PrintQuality choice\n", stderr); |
| 49 |
|
| 50 |
|
| 51 |
choice = ppdFindMarkedChoice(ppd, "DymoPrintDensity"); |
| 52 |
if (choice) |
| 53 |
{ |
| 54 |
if (!strcasecmp(choice->choice, "Light")) |
| 55 |
Driver.SetDensity(CLabelWriterDriver::pdLow); |
| 56 |
else if (!strcasecmp(choice->choice, "Medium")) |
| 57 |
Driver.SetDensity(CLabelWriterDriver::pdMedium); |
| 58 |
else if (!strcasecmp(choice->choice, "Normal")) |
| 59 |
Driver.SetDensity(CLabelWriterDriver::pdNormal); |
| 60 |
else if (!strcasecmp(choice->choice, "Dark")) |
| 61 |
Driver.SetDensity(CLabelWriterDriver::pdHigh); |
| 62 |
} |
| 63 |
else |
| 64 |
fputs("WARNING: unable to get PrintDensity choice\n", stderr); |
| 65 |
|
| 66 |
if (!strcasecmp(ppd->modelname, "DYMO LabelWriter 300") |
| 67 |
|| !strcasecmp(ppd->modelname, "DYMO LabelWriter 310") |
| 68 |
|| !strcasecmp(ppd->modelname, "DYMO LabelWriter 315")) |
| 69 |
Driver.SetMaxPrintWidth(58); |
| 70 |
|
| 71 |
if (!strcasecmp(ppd->modelname, "DYMO LabelWriter 4XL")) |
| 72 |
Driver.SetMaxPrintWidth(156); |
| 73 |
|
| 74 |
if (!strcasecmp(ppd->modelname, "DYMO LabelWriter SE450")) |
| 75 |
Driver.SetMaxPrintWidth(56); |
| 76 |
} |
| 77 |
|
| 78 |
void |
| 79 |
CDriverInitializerLabelWriter::ProcessPageOptions(CLabelWriterDriver& Driver, CDummyLanguageMonitor& LM, cups_page_header2_t& PageHeader) |
| 80 |
{ |
| 81 |
|
| 82 |
if ((PageHeader.cupsMediaType == int(CLabelWriterDriver::ptRegular)) || (PageHeader.cupsMediaType == int(CLabelWriterDriver::ptContinuous))) |
| 83 |
{ |
| 84 |
Driver.SetPaperType(CLabelWriterDriver::paper_type_t(PageHeader.cupsMediaType)); |
| 85 |
} |
| 86 |
else |
| 87 |
{ |
| 88 |
fprintf(stderr, "WARNING: Invalid value for cupsMediaType (%d)\n", PageHeader.cupsMediaType); |
| 89 |
Driver.SetPaperType(CLabelWriterDriver::ptRegular); |
| 90 |
} |
| 91 |
Driver.SetPageHeight(PageHeader.PageSize[1] * PageHeader.HWResolution[1] / 72); |
| 92 |
|
| 93 |
// page offset |
| 94 |
Driver.SetPageOffset(CLabelWriterDriver::point_t(PageHeader.cupsInteger[0], 0)); |
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
void |
| 99 |
CDriverInitializerLabelWriterTwinTurbo::ProcessPPDOptions(CLabelWriterDriverTwinTurbo& Driver, CDummyLanguageMonitor& LM, ppd_file_t* ppd) |
| 100 |
{ |
| 101 |
CDriverInitializerLabelWriter::ProcessPPDOptions(Driver, LM, ppd); |
| 102 |
|
| 103 |
ppd_choice_t* choice = ppdFindMarkedChoice(ppd, "InputSlot"); |
| 104 |
if (choice) |
| 105 |
{ |
| 106 |
if (!strcasecmp(choice->choice, "Left")) |
| 107 |
Driver.SetRoll(CLabelWriterDriverTwinTurbo::rtLeft); |
| 108 |
else if (!strcasecmp(choice->choice, "Right")) |
| 109 |
Driver.SetRoll(CLabelWriterDriverTwinTurbo::rtRight); |
| 110 |
else |
| 111 |
Driver.SetRoll(CLabelWriterDriverTwinTurbo::rtAuto); |
| 112 |
} |
| 113 |
else |
| 114 |
fputs("WARNING: unable to get InputSlot choice\n", stderr); |
| 115 |
} |
| 116 |
|
| 117 |
void |
| 118 |
CDriverInitializerLabelWriterTwinTurbo::ProcessPageOptions(CLabelWriterDriverTwinTurbo& Driver, CDummyLanguageMonitor& LM, cups_page_header2_t& PageHeader) |
| 119 |
{ |
| 120 |
CDriverInitializerLabelWriter::ProcessPageOptions(Driver, LM, PageHeader); |
| 121 |
} |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
void CDriverInitializerLabelWriterWithLM::ProcessPPDOptions(CLabelWriterDriver& Driver, CLabelWriterLanguageMonitor& LM, ppd_file_t* ppd) |
| 126 |
{ |
| 127 |
CDriverInitializerLabelWriter::ProcessPPDOptions(Driver, (CDummyLanguageMonitor&)LM, ppd); |
| 128 |
} |
| 129 |
|
| 130 |
void |
| 131 |
CDriverInitializerLabelWriterWithLM::ProcessPageOptions(CLabelWriterDriver& Driver, CLabelWriterLanguageMonitor& LM, cups_page_header2_t& PageHeader) |
| 132 |
{ |
| 133 |
CDriverInitializerLabelWriter::ProcessPageOptions(Driver, (CDummyLanguageMonitor&)LM, PageHeader); |
| 134 |
LM.SetPaperType(Driver.GetPaperType()); |
| 135 |
} |
| 136 |
|
| 137 |
|
| 138 |
void |
| 139 |
CDriverInitializerLabelWriterTwinTurboWithLM::ProcessPPDOptions(CLabelWriterDriverTwinTurbo& Driver, CLabelWriterLanguageMonitor& LM, ppd_file_t* ppd) |
| 140 |
{ |
| 141 |
CDriverInitializerLabelWriterTwinTurbo::ProcessPPDOptions(Driver, (CDummyLanguageMonitor&)LM, ppd); |
| 142 |
LM.SetRoll(Driver.GetRoll()); |
| 143 |
} |
| 144 |
|
| 145 |
void |
| 146 |
CDriverInitializerLabelWriterTwinTurboWithLM::ProcessPageOptions(CLabelWriterDriverTwinTurbo& Driver, CLabelWriterLanguageMonitor& LM, cups_page_header2_t& PageHeader) |
| 147 |
{ |
| 148 |
CDriverInitializerLabelWriterTwinTurbo::ProcessPageOptions(Driver, (CDummyLanguageMonitor&)LM, PageHeader); |
| 149 |
} |
| 150 |
|
| 151 |
|
| 152 |
} // namespace |
| 153 |
|
| 154 |
/* |
| 155 |
* End of "$Id: CupsFilterLabelWriter.cpp 10899 2010-02-08 18:21:16Z vbuzuev $". |
| 156 |
*/ |