From d2c03b1becfffdc387807bfc52b475b71c83558c Mon Sep 17 00:00:00 2001 From: Michael Pfeiffer Date: Fri, 30 Jan 2004 17:12:00 +0000 Subject: [PATCH] Renamed many constants and fields according to Open BeOS coding style guide. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6434 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../print/drivers/canon_lips/lips3/Lips3.cpp | 62 ++++++------ .../print/drivers/canon_lips/lips3/Lips3.h | 6 +- .../drivers/canon_lips/lips3/Lips3Cap.cpp | 58 ++++++------ .../print/drivers/canon_lips/lips3/Lips3Cap.h | 6 +- .../print/drivers/canon_lips/lips4/Lips4.cpp | 76 +++++++-------- .../print/drivers/canon_lips/lips4/Lips4.h | 6 +- .../drivers/canon_lips/lips4/Lips4Cap.cpp | 94 +++++++++---------- .../print/drivers/canon_lips/lips4/Lips4Cap.h | 6 +- src/add-ons/print/drivers/pcl5/PCL5.cpp | 48 ++++------ src/add-ons/print/drivers/pcl5/PCL5.h | 4 +- src/add-ons/print/drivers/pcl5/PCL5Cap.cpp | 52 +++++----- src/add-ons/print/drivers/pcl5/PCL5Cap.h | 6 +- .../print/drivers/pcl5/PCL5_Protocol.txt | 16 +++- src/add-ons/print/drivers/pcl6/PCL6.cpp | 85 ++++++++--------- src/add-ons/print/drivers/pcl6/PCL6.h | 13 +-- src/add-ons/print/drivers/pcl6/PCL6Cap.cpp | 52 +++++----- src/add-ons/print/drivers/pcl6/PCL6Cap.h | 14 +-- src/add-ons/print/drivers/postscript/PS.cpp | 32 +++---- src/add-ons/print/drivers/postscript/PS.h | 6 +- .../print/drivers/postscript/PSCap.cpp | 52 +++++----- src/add-ons/print/drivers/postscript/PSCap.h | 6 +- 21 files changed, 352 insertions(+), 348 deletions(-) diff --git a/src/add-ons/print/drivers/canon_lips/lips3/Lips3.cpp b/src/add-ons/print/drivers/canon_lips/lips3/Lips3.cpp index 4fdcbe2217..63bb52735c 100644 --- a/src/add-ons/print/drivers/canon_lips/lips3/Lips3.cpp +++ b/src/add-ons/print/drivers/canon_lips/lips3/Lips3.cpp @@ -26,7 +26,7 @@ using namespace std; LIPS3Driver::LIPS3Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap) : GraphicsDriver(msg, printer_data, printer_cap) { - __halftone = NULL; + fHalftone = NULL; } bool LIPS3Driver::startDoc() @@ -41,7 +41,7 @@ bool LIPS3Driver::startDoc() paperFeedMode(); disableAutoFF(); setNumberOfCopies(); - __halftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma()); + fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma()); return true; } catch (TransportException &err) { @@ -52,8 +52,8 @@ bool LIPS3Driver::startDoc() bool LIPS3Driver::startPage(int) { try { - __current_x = 0; - __current_y = 0; + fCurrentX = 0; + fCurrentY = 0; memorizedPosition(); return true; } @@ -76,8 +76,8 @@ bool LIPS3Driver::endPage(int) bool LIPS3Driver::endDoc(bool) { try { - if (__halftone) { - delete __halftone; + if (fHalftone) { + delete fHalftone; } jobEnd(); return true; @@ -117,7 +117,7 @@ bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset) DBGMSG(("x = %d\n", x)); DBGMSG(("y = %d\n", y)); - if (get_valid_rect(bitmap, __halftone->getPalette(), &rc)) { + if (get_valid_rect(bitmap, &rc)) { DBGMSG(("validate rect = %d, %d, %d, %d\n", rc.left, rc.top, rc.right, rc.bottom)); @@ -138,11 +138,11 @@ bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset) DBGMSG(("in_size = %d\n", in_size)); DBGMSG(("out_size = %d\n", out_size)); DBGMSG(("delta = %d\n", delta)); - DBGMSG(("renderobj->get_pixel_depth() = %d\n", __halftone->getPixelDepth())); + DBGMSG(("renderobj->get_pixel_depth() = %d\n", fHalftone->getPixelDepth())); uchar *ptr = (uchar *)bitmap->Bits() + rc.top * delta - + (rc.left * __halftone->getPixelDepth()) / 8; + + (rc.left * fHalftone->getPixelDepth()) / 8; int compression_method; int compressed_size; @@ -161,7 +161,7 @@ bool LIPS3Driver::nextBand(BBitmap *bitmap, BPoint *offset) move(x, y); for (int i = rc.top; i <= rc.bottom; i++) { - __halftone->dither(ptr2, ptr, x, y, width); + fHalftone->dither(ptr2, ptr, x, y, width); ptr += delta; ptr2 += widthByte; y++; @@ -247,47 +247,47 @@ void LIPS3Driver::selectPageFormat() int height = 0; switch (getJobData()->getPaper()) { - case JobData::A3: + case JobData::kA3: i = 12; break; - case JobData::A4: + case JobData::kA4: i = 14; break; - case JobData::A5: + case JobData::kA5: i = 16; break; - case JobData::JAPANESE_POSTCARD: + case JobData::kJapanesePostcard: i = 18; break; - case JobData::B4: + case JobData::kB4: i = 24; break; - case JobData::B5: + case JobData::kB5: i = 26; break; - case JobData::LETTER: + case JobData::kLetter: i = 30; break; - case JobData::LEGAL: + case JobData::kLegal: i = 32; break; -// case JobData::EXECUTIVE: +// case JobData::kExecutive: // i = 40; // break; // -// case JobData::JENV_YOU4: +// case JobData::kJEnvYou4: // i = 50; // break; // -// case JobData::USER: +// case JobData::kUser: // i = 90; // break; // @@ -298,7 +298,7 @@ void LIPS3Driver::selectPageFormat() break; } - if (JobData::LANDSCAPE == getJobData()->getOrientation()) + if (JobData::kLandscape == getJobData()->getOrientation()) i++; if (i < 80) { @@ -328,16 +328,16 @@ void LIPS3Driver::paperFeedMode() int i; switch (getJobData()->getPaperSource()) { - case JobData::MANUAL: + case JobData::kManual: i = 1; break; - case JobData::LOWER: + case JobData::kLower: i = 2; break; - case JobData::UPPER: + case JobData::kUpper: i = 3; break; - case JobData::AUTO: + case JobData::kAuto: default: i = 0; break; @@ -408,17 +408,17 @@ void LIPS3Driver::jobEnd() void LIPS3Driver::move(int x, int y) { - if (__current_x != x) { + if (fCurrentX != x) { if (x) { moveAbsoluteHorizontal(x); } else { carriageReturn(); } - __current_x = x; + fCurrentX = x; } - if (__current_y != y) { - int dy = y - __current_y; + if (fCurrentY != y) { + int dy = y - fCurrentY; moveDown(dy); - __current_y = y; + fCurrentY = y; } } diff --git a/src/add-ons/print/drivers/canon_lips/lips3/Lips3.h b/src/add-ons/print/drivers/canon_lips/lips3/Lips3.h index db369a540e..102a571ed3 100644 --- a/src/add-ons/print/drivers/canon_lips/lips3/Lips3.h +++ b/src/add-ons/print/drivers/canon_lips/lips3/Lips3.h @@ -45,9 +45,9 @@ private: void formFeed(); void jobEnd(); - int __current_x; - int __current_y; - Halftone *__halftone; + int fCurrentX; + int fCurrentY; + Halftone *fHalftone; }; #endif /* __LIPS3_H */ diff --git a/src/add-ons/print/drivers/canon_lips/lips3/Lips3Cap.cpp b/src/add-ons/print/drivers/canon_lips/lips3/Lips3Cap.cpp index bb80599194..bada75c976 100644 --- a/src/add-ons/print/drivers/canon_lips/lips3/Lips3Cap.cpp +++ b/src/add-ons/print/drivers/canon_lips/lips3/Lips3Cap.cpp @@ -11,63 +11,63 @@ const PaperCap a3( "A3", false, - JobData::A3, + JobData::kA3, BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f))); const PaperCap a4( "A4", true, - JobData::A4, + JobData::kA4, BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f))); const PaperCap a5( "A5", false, - JobData::A5, + JobData::kA5, BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f))); const PaperCap japanese_postcard( "Japanese Postcard", false, - JobData::JAPANESE_POSTCARD, + JobData::kJapanesePostcard, BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f))); const PaperCap b4( "B4", false, - JobData::B4, + JobData::kB4, BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f))); const PaperCap b5( "B5", false, - JobData::B5, + JobData::kB5, BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f))); const PaperCap letter( "Letter", false, - JobData::LETTER, + JobData::kLetter, BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f))); const PaperCap legal( "Legal", false, - JobData::LEGAL, + JobData::kLegal, BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f))); -const PaperSourceCap autobin("Auto", true, JobData::AUTO); -const PaperSourceCap manual("Manual", false, JobData::MANUAL); -const PaperSourceCap upper("Upper", false, JobData::UPPER); -const PaperSourceCap lower("Lower", false, JobData::LOWER); +const PaperSourceCap autobin("Auto", true, JobData::kAuto); +const PaperSourceCap manual("Manual", false, JobData::kManual); +const PaperSourceCap upper("Upper", false, JobData::kUpper); +const PaperSourceCap lower("Lower", false, JobData::kLower); const ResolutionCap dpi300("300dpi", true, 300, 300); @@ -92,8 +92,8 @@ const ResolutionCap *resolutions[] = { &dpi300 }; -const ColorCap color("Color", false, JobData::kCOLOR); -const ColorCap monochrome("Monochrome", true, JobData::kMONOCHROME); +const ColorCap color("Color", false, JobData::kColor); +const ColorCap monochrome("Monochrome", true, JobData::kMonochrome); const ColorCap *colors[] = { &color, @@ -105,45 +105,45 @@ Lips3Cap::Lips3Cap(const PrinterData *printer_data) { } -int Lips3Cap::countCap(CAPID capid) const +int Lips3Cap::countCap(CapID capid) const { switch (capid) { - case PAPER: + case kPaper: return sizeof(papers) / sizeof(papers[0]); - case PAPERSOURCE: + case kPaperSource: return sizeof(papersources) / sizeof(papersources[0]); - case RESOLUTION: + case kResolution: return sizeof(resolutions) / sizeof(resolutions[0]); - case COLOR: + case kColor: return sizeof(colors) / sizeof(colors[0]); default: return 0; } } -const BaseCap **Lips3Cap::enumCap(CAPID capid) const +const BaseCap **Lips3Cap::enumCap(CapID capid) const { switch (capid) { - case PAPER: + case kPaper: return (const BaseCap **)papers; - case PAPERSOURCE: + case kPaperSource: return (const BaseCap **)papersources; - case RESOLUTION: + case kResolution: return (const BaseCap **)resolutions; - case COLOR: + case kColor: return (const BaseCap **)colors; default: return NULL; } } -bool Lips3Cap::isSupport(CAPID capid) const +bool Lips3Cap::isSupport(CapID capid) const { switch (capid) { - case PAPER: - case PAPERSOURCE: - case RESOLUTION: - case COLOR: + case kPaper: + case kPaperSource: + case kResolution: + case kColor: return true; default: return false; diff --git a/src/add-ons/print/drivers/canon_lips/lips3/Lips3Cap.h b/src/add-ons/print/drivers/canon_lips/lips3/Lips3Cap.h index d895d6c349..95fd40cac2 100644 --- a/src/add-ons/print/drivers/canon_lips/lips3/Lips3Cap.h +++ b/src/add-ons/print/drivers/canon_lips/lips3/Lips3Cap.h @@ -11,9 +11,9 @@ class Lips3Cap : public PrinterCap { public: Lips3Cap(const PrinterData *printer_data); - virtual int countCap(CAPID) const; - virtual bool isSupport(CAPID) const; - virtual const BaseCap **enumCap(CAPID) const; + virtual int countCap(CapID) const; + virtual bool isSupport(CapID) const; + virtual const BaseCap **enumCap(CapID) const; }; #endif /* __LIPS3CAP_H */ diff --git a/src/add-ons/print/drivers/canon_lips/lips4/Lips4.cpp b/src/add-ons/print/drivers/canon_lips/lips4/Lips4.cpp index 0c42b98991..8eb720f456 100644 --- a/src/add-ons/print/drivers/canon_lips/lips4/Lips4.cpp +++ b/src/add-ons/print/drivers/canon_lips/lips4/Lips4.cpp @@ -25,7 +25,7 @@ using namespace std; LIPS4Driver::LIPS4Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap) : GraphicsDriver(msg, printer_data, printer_cap) { - __halftone = NULL; + fHalftone = NULL; } bool LIPS4Driver::startDoc() @@ -43,7 +43,7 @@ bool LIPS4Driver::startDoc() setNumberOfCopies(); sidePrintingControl(); setBindingMargin(); - __halftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma()); + fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma()); return true; } catch (TransportException &err) { @@ -54,8 +54,8 @@ bool LIPS4Driver::startDoc() bool LIPS4Driver::startPage(int) { try { - __current_x = 0; - __current_y = 0; + fCurrentX = 0; + fCurrentY = 0; memorizedPosition(); return true; } @@ -78,8 +78,8 @@ bool LIPS4Driver::endPage(int) bool LIPS4Driver::endDoc(bool) { try { - if (__halftone) { - delete __halftone; + if (fHalftone) { + delete fHalftone; } jobEnd(); return true; @@ -128,7 +128,7 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset) DBGMSG(("x = %d\n", x)); DBGMSG(("y = %d\n", y)); - if (get_valid_rect(bitmap, __halftone->getPalette(), &rc)) { + if (get_valid_rect(bitmap, &rc)) { DBGMSG(("validate rect = %d, %d, %d, %d\n", rc.left, rc.top, rc.right, rc.bottom)); @@ -149,11 +149,11 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset) DBGMSG(("in_size = %d\n", in_size)); DBGMSG(("out_size = %d\n", out_size)); DBGMSG(("delta = %d\n", delta)); - DBGMSG(("__halftone_engine->get_pixel_depth() = %d\n", __halftone->getPixelDepth())); + DBGMSG(("fHalftone_engine->get_pixel_depth() = %d\n", fHalftone->getPixelDepth())); uchar *ptr = (uchar *)bitmap->Bits() + rc.top * delta - + (rc.left * __halftone->getPixelDepth()) / 8; + + (rc.left * fHalftone->getPixelDepth()) / 8; int compression_method; int compressed_size; @@ -172,7 +172,7 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset) move(x, y); for (int i = rc.top; i <= rc.bottom; i++) { - __halftone->dither(ptr2, ptr, x, y, width); + fHalftone->dither(ptr2, ptr, x, y, width); ptr += delta; ptr2 += widthByte; y++; @@ -281,19 +281,19 @@ void LIPS4Driver::paperFeedMode() int i; switch (getJobData()->getPaperSource()) { - case JobData::MANUAL: + case JobData::kManual: i = 10; break; - case JobData::UPPER: + case JobData::kUpper: i = 11; break; - case JobData::MIDDLE: + case JobData::kMiddle: i = 12; break; - case JobData::LOWER: + case JobData::kLower: i = 13; break; - case JobData::AUTO: + case JobData::kAuto: default: i = 0; break; @@ -307,47 +307,47 @@ void LIPS4Driver::selectPageFormat() int i; switch (getJobData()->getPaper()) { - case JobData::A3: + case JobData::kA3: i = 12; break; - case JobData::A4: + case JobData::kA4: i = 14; break; - case JobData::A5: + case JobData::kA5: i = 16; break; - case JobData::JAPANESE_POSTCARD: + case JobData::kJapanesePostcard: i = 18; break; - case JobData::B4: + case JobData::kB4: i = 24; break; - case JobData::B5: + case JobData::kB5: i = 26; break; - case JobData::LETTER: + case JobData::kLetter: i = 30; break; - case JobData::LEGAL: + case JobData::kLegal: i = 32; break; - case JobData::EXECUTIVE: + case JobData::kExecutive: i = 40; break; - case JobData::JENV_YOU4: + case JobData::kJEnvYou4: i = 50; break; - case JobData::USER: + case JobData::kUser: i = 90; break; @@ -356,7 +356,7 @@ void LIPS4Driver::selectPageFormat() break; } - if (JobData::LANDSCAPE == getJobData()->getOrientation()) + if (JobData::kLandscape == getJobData()->getOrientation()) i++; writeSpoolString("\033[%d;;p", i); @@ -374,7 +374,7 @@ void LIPS4Driver::setNumberOfCopies() void LIPS4Driver::sidePrintingControl() { - if (getJobData()->getPrintStyle() == JobData::SIMPLEX) + if (getJobData()->getPrintStyle() == JobData::kSimplex) writeSpoolString("\033[0#x"); else writeSpoolString("\033[2;0#x"); @@ -382,19 +382,19 @@ void LIPS4Driver::sidePrintingControl() void LIPS4Driver::setBindingMargin() { - if (getJobData()->getPrintStyle() == JobData::DUPLEX) { + if (getJobData()->getPrintStyle() == JobData::kDuplex) { int i; // switch (job_data()->binding_location()) { -// case LONG_EDGE_LEFT: +// case kLongEdgeLeft: i = 0; // break; -// case LONG_EDGE_RIGHT: +// case kLongEdgeRight: // i = 1; // break; -// case SHORT_EDGE_TOP: +// case kShortEdgeTop: // i = 2; // break; -// case SHORT_EDGE_BOTTOM: +// case kShortEdgeBottom: // i = 3; // break; // } @@ -456,17 +456,17 @@ void LIPS4Driver::jobEnd() void LIPS4Driver::move(int x, int y) { - if (__current_x != x) { + if (fCurrentX != x) { if (x) { moveAbsoluteHorizontal(x); } else { carriageReturn(); } - __current_x = x; + fCurrentX = x; } - if (__current_y != y) { - int dy = y - __current_y; + if (fCurrentY != y) { + int dy = y - fCurrentY; moveDown(dy); - __current_y = y; + fCurrentY = y; } } diff --git a/src/add-ons/print/drivers/canon_lips/lips4/Lips4.h b/src/add-ons/print/drivers/canon_lips/lips4/Lips4.h index 89faa44723..14a8d1ed6a 100644 --- a/src/add-ons/print/drivers/canon_lips/lips4/Lips4.h +++ b/src/add-ons/print/drivers/canon_lips/lips4/Lips4.h @@ -48,9 +48,9 @@ private: void formFeed(); void jobEnd(); - int __current_x; - int __current_y; - Halftone *__halftone; + int fCurrentX; + int fCurrentY; + Halftone *fHalftone; }; #endif /* __LIPS4_H */ diff --git a/src/add-ons/print/drivers/canon_lips/lips4/Lips4Cap.cpp b/src/add-ons/print/drivers/canon_lips/lips4/Lips4Cap.cpp index a8813f4e0b..3564193397 100644 --- a/src/add-ons/print/drivers/canon_lips/lips4/Lips4Cap.cpp +++ b/src/add-ons/print/drivers/canon_lips/lips4/Lips4Cap.cpp @@ -10,105 +10,105 @@ const PaperCap a3( "A3", false, - JobData::A3, + JobData::kA3, BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f))); const PaperCap a4( "A4", true, - JobData::A4, + JobData::kA4, BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f))); const PaperCap a5( "A5", false, - JobData::A5, + JobData::kA5, BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f))); const PaperCap japanese_postcard( "Japanese Postcard", false, - JobData::JAPANESE_POSTCARD, + JobData::kJapanesePostcard, BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f))); const PaperCap b4( "B4", false, - JobData::B4, + JobData::kB4, BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f))); const PaperCap b5( "B5", false, - JobData::B5, + JobData::kB5, BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f))); const PaperCap letter( "Letter", false, - JobData::LETTER, + JobData::kLetter, BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f))); const PaperCap legal( "Legal", false, - JobData::LEGAL, + JobData::kLegal, BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f))); const PaperCap tabloid( "Tabloid", false, - JobData::TABLOID, + JobData::kTabloid, BRect(0.0f, 0.0f, TO72DPI(6600.0), TO72DPI(10200.0)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6480.0), TO72DPI(10080.0))); const PaperCap executive( "Executive", false, - JobData::EXECUTIVE, + JobData::kExecutive, BRect(0.0f, 0.0f, TO72DPI(4350.0f), TO72DPI(6300.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4230.0f), TO72DPI(6180.0f))); const PaperCap japanese_envelope_you4( "Japanese Envelope You#4", false, - JobData::JENV_YOU4, + JobData::kJEnvYou4, BRect(0.0f, 0.0f, TO72DPI(2480.0f), TO72DPI(5550.0f)), BRect(TO72DPI(236.0f), TO72DPI(236.0f), TO72DPI(2244.0f), TO72DPI(5314.0f))); /* const PaperCap japanese_envelope_kaku2( "Japanese Envelope Kaku#2", false, - JobData::JENV_KAKU2, + JobData::kJEnvKaku2, BRect(0.0f, 0.0f, TO72DPI(5568.0f), TO72DPI(7842.0f)), BRect(TO72DPI(236.0f), TO72DPI(236.0f), TO72DPI(5432.0f), TO72DPI(7606.0f))); */ -const PaperSourceCap autobin("Auto", true, JobData::AUTO); -const PaperSourceCap manual("Manual", false, JobData::MANUAL); -const PaperSourceCap upper("Upper", false, JobData::UPPER); -const PaperSourceCap middle("Middle", false, JobData::MIDDLE); -const PaperSourceCap lower("Lower", false, JobData::LOWER); +const PaperSourceCap autobin("Auto", true, JobData::kAuto); +const PaperSourceCap manual("Manual", false, JobData::kManual); +const PaperSourceCap upper("Upper", false, JobData::kUpper); +const PaperSourceCap middle("Middle", false, JobData::kMiddle); +const PaperSourceCap lower("Lower", false, JobData::kLower); const ResolutionCap dpi1200("1200dpi", false, 1200, 1200); const ResolutionCap dpi600("600dpi", true, 600, 600); const ResolutionCap dpi300("300dpi", false, 300, 300); -const PrintStyleCap simplex("Simplex", true, JobData::SIMPLEX); -const PrintStyleCap duplex("Duplex", false, JobData::DUPLEX); -const PrintStyleCap booklet("Booklet", false, JobData::BOOKLET); +const PrintStyleCap simplex("Simplex", true, JobData::kSimplex); +const PrintStyleCap duplex("Duplex", false, JobData::kDuplex); +const PrintStyleCap booklet("Booklet", false, JobData::kBooklet); -const BindingLocationCap longedge1("Long Edge (left)", true, JobData::LONG_EDGE_LEFT); -const BindingLocationCap longedge2("Long Edge (right)", false, JobData::LONG_EDGE_RIGHT); -const BindingLocationCap shortedge1("Short Edge (top)", false, JobData::SHORT_EDGE_TOP); -const BindingLocationCap shortedge2("Short Edge (bottom)", false, JobData::SHORT_EDGE_BOTTOM); +const BindingLocationCap longedge1("Long Edge (left)", true, JobData::kLongEdgeLeft); +const BindingLocationCap longedge2("Long Edge (right)", false, JobData::kLongEdgeRight); +const BindingLocationCap shortedge1("Short Edge (top)", false, JobData::kShortEdgeTop); +const BindingLocationCap shortedge2("Short Edge (bottom)", false, JobData::kShortEdgeBottom); const PaperCap *papers[] = { &a4, @@ -151,8 +151,8 @@ const BindingLocationCap *bindinglocations[] = { &shortedge2 }; -const ColorCap color("Color", false, JobData::kCOLOR); -const ColorCap monochrome("Monochrome", true, JobData::kMONOCHROME); +const ColorCap color("Color", false, JobData::kColor); +const ColorCap monochrome("Monochrome", true, JobData::kMonochrome); const ColorCap *colors[] = { &color, @@ -160,55 +160,55 @@ const ColorCap *colors[] = { }; -int Lips4Cap::countCap(CAPID capid) const +int Lips4Cap::countCap(CapID capid) const { switch (capid) { - case PAPER: + case kPaper: return sizeof(papers) / sizeof(papers[0]); - case PAPERSOURCE: + case kPaperSource: return sizeof(papersources) / sizeof(papersources[0]); - case RESOLUTION: + case kResolution: return sizeof(resolutions) / sizeof(resolutions[0]); - case PRINTSTYLE: + case kPrintStyle: return sizeof(printstyles) / sizeof(printstyles[0]); - case BINDINGLOCATION: + case kBindingLocation: return sizeof(bindinglocations) / sizeof(bindinglocations[0]); - case COLOR: + case kColor: return sizeof(colors) / sizeof(colors[0]); default: return 0; } } -const BaseCap **Lips4Cap::enumCap(CAPID capid) const +const BaseCap **Lips4Cap::enumCap(CapID capid) const { switch (capid) { - case PAPER: + case kPaper: return (const BaseCap **)papers; - case PAPERSOURCE: + case kPaperSource: return (const BaseCap **)papersources; - case RESOLUTION: + case kResolution: return (const BaseCap **)resolutions; - case PRINTSTYLE: + case kPrintStyle: return (const BaseCap **)printstyles; - case BINDINGLOCATION: + case kBindingLocation: return (const BaseCap **)bindinglocations; - case COLOR: + case kColor: return (const BaseCap **)colors; default: return NULL; } } -bool Lips4Cap::isSupport(CAPID capid) const +bool Lips4Cap::isSupport(CapID capid) const { switch (capid) { - case PAPER: - case PAPERSOURCE: - case RESOLUTION: - case PRINTSTYLE: - case BINDINGLOCATION: - case COLOR: + case kPaper: + case kPaperSource: + case kResolution: + case kPrintStyle: + case kBindingLocation: + case kColor: return true; default: return false; diff --git a/src/add-ons/print/drivers/canon_lips/lips4/Lips4Cap.h b/src/add-ons/print/drivers/canon_lips/lips4/Lips4Cap.h index 6e6b070f2a..01d67f29bc 100644 --- a/src/add-ons/print/drivers/canon_lips/lips4/Lips4Cap.h +++ b/src/add-ons/print/drivers/canon_lips/lips4/Lips4Cap.h @@ -11,9 +11,9 @@ class Lips4Cap : public PrinterCap { public: Lips4Cap(const PrinterData *printer_data) : PrinterCap(printer_data) {} - virtual int countCap(CAPID) const; - virtual bool isSupport(CAPID) const; - virtual const BaseCap **enumCap(CAPID) const; + virtual int countCap(CapID) const; + virtual bool isSupport(CapID) const; + virtual const BaseCap **enumCap(CapID) const; }; #endif /* __LIPS4CAP_H */ diff --git a/src/add-ons/print/drivers/pcl5/PCL5.cpp b/src/add-ons/print/drivers/pcl5/PCL5.cpp index 767d155100..75d57c6dba 100644 --- a/src/add-ons/print/drivers/pcl5/PCL5.cpp +++ b/src/add-ons/print/drivers/pcl5/PCL5.cpp @@ -27,14 +27,14 @@ using namespace std; PCL5Driver::PCL5Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap) : GraphicsDriver(msg, printer_data, printer_cap) { - __halftone = NULL; + fHalftone = NULL; } bool PCL5Driver::startDoc() { try { jobStart(); - __halftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma()); + fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma()); return true; } catch (TransportException &err) { @@ -61,8 +61,8 @@ bool PCL5Driver::endPage(int) bool PCL5Driver::endDoc(bool) { try { - if (__halftone) { - delete __halftone; + if (fHalftone) { + delete fHalftone; } jobEnd(); return true; @@ -102,7 +102,7 @@ bool PCL5Driver::nextBand(BBitmap *bitmap, BPoint *offset) DBGMSG(("x = %d\n", x)); DBGMSG(("y = %d\n", y)); - if (get_valid_rect(bitmap, __halftone->getPalette(), &rc)) { + if (get_valid_rect(bitmap, &rc)) { DBGMSG(("validate rect = %d, %d, %d, %d\n", rc.left, rc.top, rc.right, rc.bottom)); @@ -123,11 +123,11 @@ bool PCL5Driver::nextBand(BBitmap *bitmap, BPoint *offset) DBGMSG(("in_size = %d\n", in_size)); DBGMSG(("out_size = %d\n", out_size)); DBGMSG(("delta = %d\n", delta)); - DBGMSG(("renderobj->get_pixel_depth() = %d\n", __halftone->getPixelDepth())); + DBGMSG(("renderobj->get_pixel_depth() = %d\n", fHalftone->getPixelDepth())); uchar *ptr = (uchar *)bitmap->Bits() + rc.top * delta - + (rc.left * __halftone->getPixelDepth()) / 8; + + (rc.left * fHalftone->getPixelDepth()) / 8; int compression_method; int compressed_size; @@ -144,31 +144,21 @@ bool PCL5Driver::nextBand(BBitmap *bitmap, BPoint *offset) move(x, y); startRasterGraphics(width, height); - const bool color = getJobData()->getColor() == JobData::kCOLOR; + const bool color = getJobData()->getColor() == JobData::kColor; const int num_planes = color ? 3 : 1; const int fill_bits = in_size * 8 - width; const uchar fill_mask = 0xff >> (8 - fill_bits); // ASSERT(0 <= fill_bits && fill_bits < 8); + if (color) { + fHalftone->setPlanes(Halftone::kPlaneRGB1); + } + for (int i = rc.top; i <= rc.bottom; i++) { for (int plane = 0; plane < num_planes; plane ++) { - - if (color) { - switch (plane) { - // XXX maybe order should be red, green, blue. This could be - // a bug in __halftone dither where it passes rgb_color to - // a gray function in wrong order! - case 0: __halftone->setGrayFunction(Halftone::kBlueChannel); - break; - case 1: __halftone->setGrayFunction(Halftone::kGreenChannel); - break; - case 2: __halftone->setGrayFunction(Halftone::kRedChannel); - break; - } - } - - __halftone->dither(in_buffer, ptr, x, y, width); + + fHalftone->dither(in_buffer, ptr, x, y, width); if (color) { // in color mode a value of 1 in all three planes means white @@ -224,7 +214,7 @@ bool PCL5Driver::nextBand(BBitmap *bitmap, BPoint *offset) void PCL5Driver::jobStart() { - const bool color = getJobData()->getColor() == JobData::kCOLOR; + const bool color = getJobData()->getColor() == JobData::kColor; // enter PCL5 writeSpoolString("\033%%-12345X@PJL ENTER LANGUAGE=PCL\n"); // reset @@ -259,7 +249,7 @@ void PCL5Driver::startRasterGraphics(int width, int height) writeSpoolString("\033*r%dT", height); // start raster graphics writeSpoolString("\033*r1A"); - __compression_method = -1; + fCompressionMethod = -1; } void PCL5Driver::endRasterGraphics() @@ -273,9 +263,9 @@ void PCL5Driver::rasterGraphics( int size, bool lastPlane) { - if (__compression_method != compression_method) { + if (fCompressionMethod != compression_method) { writeSpoolString("\033*b%dM", compression_method); - __compression_method = compression_method; + fCompressionMethod = compression_method; } writeSpoolString("\033*b%d", size); if (lastPlane) { @@ -299,7 +289,7 @@ void PCL5Driver::move(int x, int y) int PCL5Driver::bytesToEnterCompressionMethod(int compression_method) { - if (__compression_method == compression_method) { + if (fCompressionMethod == compression_method) { return 0; } else { return 5; diff --git a/src/add-ons/print/drivers/pcl5/PCL5.h b/src/add-ons/print/drivers/pcl5/PCL5.h index eddbaa2aaa..1ee66a26c8 100644 --- a/src/add-ons/print/drivers/pcl5/PCL5.h +++ b/src/add-ons/print/drivers/pcl5/PCL5.h @@ -34,8 +34,8 @@ private: void jobEnd(); int bytesToEnterCompressionMethod(int compression_method); - int __compression_method; - Halftone *__halftone; + int fCompressionMethod; + Halftone *fHalftone; }; #endif /* __PCL5_H */ diff --git a/src/add-ons/print/drivers/pcl5/PCL5Cap.cpp b/src/add-ons/print/drivers/pcl5/PCL5Cap.cpp index 83cc35fd8f..ce847e8a98 100644 --- a/src/add-ons/print/drivers/pcl5/PCL5Cap.cpp +++ b/src/add-ons/print/drivers/pcl5/PCL5Cap.cpp @@ -11,60 +11,60 @@ const PaperCap a3( "A3", false, - JobData::A3, + JobData::kA3, BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f))); const PaperCap a4( "A4", true, - JobData::A4, + JobData::kA4, BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f))); const PaperCap a5( "A5", false, - JobData::A5, + JobData::kA5, BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f))); const PaperCap japanese_postcard( "Japanese Postcard", false, - JobData::JAPANESE_POSTCARD, + JobData::kJapanesePostcard, BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f))); const PaperCap b4( "B4", false, - JobData::B4, + JobData::kB4, BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f))); const PaperCap b5( "B5", false, - JobData::B5, + JobData::kB5, BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f))); const PaperCap letter( "Letter", false, - JobData::LETTER, + JobData::kLetter, BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f))); const PaperCap legal( "Legal", false, - JobData::LEGAL, + JobData::kLegal, BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f))); -const PaperSourceCap autobin("Auto", true, JobData::AUTO); +const PaperSourceCap autobin("Auto", true, JobData::kAuto); const ResolutionCap dpi300("300dpi", true, 300, 300); const ResolutionCap dpi600("600dpi", false, 600, 600); @@ -90,8 +90,8 @@ const ResolutionCap *resolutions[] = { &dpi1200, }; -const ColorCap color("Color", false, JobData::kCOLOR); -const ColorCap monochrome("Monochrome", true, JobData::kMONOCHROME); +const ColorCap color("Color", false, JobData::kColor); +const ColorCap monochrome("Monochrome", true, JobData::kMonochrome); const ColorCap *colors[] = { &color, @@ -103,45 +103,45 @@ PCL5Cap::PCL5Cap(const PrinterData *printer_data) { } -int PCL5Cap::countCap(CAPID capid) const +int PCL5Cap::countCap(CapID capid) const { switch (capid) { - case PAPER: + case kPaper: return sizeof(papers) / sizeof(papers[0]); - case PAPERSOURCE: + case kPaperSource: return sizeof(papersources) / sizeof(papersources[0]); - case RESOLUTION: + case kResolution: return sizeof(resolutions) / sizeof(resolutions[0]); - case COLOR: + case kColor: return sizeof(colors) / sizeof(colors[0]); default: return 0; } } -const BaseCap **PCL5Cap::enumCap(CAPID capid) const +const BaseCap **PCL5Cap::enumCap(CapID capid) const { switch (capid) { - case PAPER: + case kPaper: return (const BaseCap **)papers; - case PAPERSOURCE: + case kPaperSource: return (const BaseCap **)papersources; - case RESOLUTION: + case kResolution: return (const BaseCap **)resolutions; - case COLOR: + case kColor: return (const BaseCap **)colors; default: return NULL; } } -bool PCL5Cap::isSupport(CAPID capid) const +bool PCL5Cap::isSupport(CapID capid) const { switch (capid) { - case PAPER: - case PAPERSOURCE: - case RESOLUTION: - case COLOR: + case kPaper: + case kPaperSource: + case kResolution: + case kColor: return true; default: return false; diff --git a/src/add-ons/print/drivers/pcl5/PCL5Cap.h b/src/add-ons/print/drivers/pcl5/PCL5Cap.h index 2bf0f6e5e7..20f65505b1 100644 --- a/src/add-ons/print/drivers/pcl5/PCL5Cap.h +++ b/src/add-ons/print/drivers/pcl5/PCL5Cap.h @@ -11,9 +11,9 @@ class PCL5Cap : public PrinterCap { public: PCL5Cap(const PrinterData *printer_data); - virtual int countCap(CAPID) const; - virtual bool isSupport(CAPID) const; - virtual const BaseCap **enumCap(CAPID) const; + virtual int countCap(CapID) const; + virtual bool isSupport(CapID) const; + virtual const BaseCap **enumCap(CapID) const; }; #endif /* __PCL5CAP_H */ diff --git a/src/add-ons/print/drivers/pcl5/PCL5_Protocol.txt b/src/add-ons/print/drivers/pcl5/PCL5_Protocol.txt index 5593cb638a..76303809a8 100644 --- a/src/add-ons/print/drivers/pcl5/PCL5_Protocol.txt +++ b/src/add-ons/print/drivers/pcl5/PCL5_Protocol.txt @@ -44,6 +44,16 @@ Job Separation Command Image Transfer +Simple Color Command + Esc*rU + mode: + -3 ... 3 planes, device CMY palette + (0 = white, 1 = cyan, 2 = magenta, 3 = blue, 4 = yellow, 5 = green, 6 = red, 7 = black) + 1 ... single plane K (black) palette (default) + (0 = white, 1 = black) + 3 ... 3 planes, device RGB palette + (0 = black, 1 = red, 2 = green, 3 = yellow, 4 = blue, 5 = magenta, 6 = cyan, 7 = white) + Raster Presentation Esc*rF mode ... 0 in orientation of logical page @@ -67,14 +77,16 @@ Start Raster Graphics lines ... number of raster lines of vertical movement Raster Compression Esc*bM - mode ... 0 unencoded + mode + ... 0 unencoded (default) ... 1 run length encoding ... 2 tagged image file format (TIFF) rev. 4.0 ... 3 delta row compression ... 4 reserved ... 5 adaptie compression {Transfer Raster Data - Esc*bW + [Esc*bV # ] + Esc*bW # for last plane moves cursor X pos to 0 length ... 0 to 32767 } } diff --git a/src/add-ons/print/drivers/pcl6/PCL6.cpp b/src/add-ons/print/drivers/pcl6/PCL6.cpp index b26523f393..8420938e77 100644 --- a/src/add-ons/print/drivers/pcl6/PCL6.cpp +++ b/src/add-ons/print/drivers/pcl6/PCL6.cpp @@ -27,8 +27,8 @@ using namespace std; PCL6Driver::PCL6Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap) : GraphicsDriver(msg, printer_data, printer_cap) { - __halftone = NULL; - __stream = NULL; + fHalftone = NULL; + fStream = NULL; } void PCL6Driver::FlushOutBuffer(HP_StreamHandleType pStream, unsigned long cookie, HP_pUByte pOutBuffer, HP_SInt32 currentBufferLen) @@ -41,7 +41,7 @@ bool PCL6Driver::startDoc() { try { jobStart(); - __halftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma()); + fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma()); return true; } catch (TransportException &err) { @@ -52,8 +52,8 @@ bool PCL6Driver::startDoc() bool PCL6Driver::endDoc(bool) { try { - if (__halftone) { - delete __halftone; + if (fHalftone) { + delete fHalftone; } jobEnd(); return true; @@ -93,7 +93,7 @@ bool PCL6Driver::nextBand(BBitmap *bitmap, BPoint *offset) DBGMSG(("x = %d\n", x)); DBGMSG(("y = %d\n", y)); - if (get_valid_rect(bitmap, __halftone->getPalette(), &rc)) { + if (get_valid_rect(bitmap, &rc)) { DBGMSG(("validate rect = %d, %d, %d, %d\n", rc.left, rc.top, rc.right, rc.bottom)); @@ -110,7 +110,7 @@ bool PCL6Driver::nextBand(BBitmap *bitmap, BPoint *offset) int out_size; int delta; - color = getJobData()->getColor() == JobData::kCOLOR; + color = getJobData()->getColor() == JobData::kColor; width = rc.right - rc.left + 1; height = rc.bottom - rc.top + 1; @@ -132,11 +132,11 @@ bool PCL6Driver::nextBand(BBitmap *bitmap, BPoint *offset) DBGMSG(("height = %d\n", height)); DBGMSG(("out_size = %d\n", out_size)); DBGMSG(("delta = %d\n", delta)); - DBGMSG(("renderobj->get_pixel_depth() = %d\n", __halftone->getPixelDepth())); + DBGMSG(("renderobj->get_pixel_depth() = %d\n", fHalftone->getPixelDepth())); uchar *ptr = (uchar *)bitmap->Bits() + rc.top * delta - + (rc.left * __halftone->getPixelDepth()) / 8; + + (rc.left * fHalftone->getPixelDepth()) / 8; int compression_method; int compressed_size; @@ -169,7 +169,7 @@ bool PCL6Driver::nextBand(BBitmap *bitmap, BPoint *offset) in += 4; } } else { - __halftone->dither(out_ptr, ptr, x, y, width); + fHalftone->dither(out_ptr, ptr, x, y, width); // invert pixels for (int w = widthByte; w > 0; w --, out ++) { *out = ~*out; @@ -223,38 +223,38 @@ void PCL6Driver::jobStart() "Comment Copyright (c) 2003 OBOS\n", getJobData()->getXres()); // PCL6 begin - __stream = HP_NewStream(16 * 1024, this); - HP_BeginSession_2(__stream, getJobData()->getXres(), getJobData()->getYres(), HP_eInch, HP_eBackChAndErrPage); - HP_OpenDataSource_1(__stream, HP_eDefaultDataSource, HP_eBinaryLowByteFirst); + fStream = HP_NewStream(16 * 1024, this); + HP_BeginSession_2(fStream, getJobData()->getXres(), getJobData()->getYres(), HP_eInch, HP_eBackChAndErrPage); + HP_OpenDataSource_1(fStream, HP_eDefaultDataSource, HP_eBinaryLowByteFirst); } bool PCL6Driver::startPage(int) { // XXX orientation - HP_BeginPage_3(__stream, HP_ePortraitOrientation, mediaSize(getJobData()->getPaper()), HP_eAutoSelect); + HP_BeginPage_3(fStream, HP_ePortraitOrientation, mediaSize(getJobData()->getPaper()), HP_eAutoSelect); // PageOrigin from Windows NT printer driver int x = 142 * getJobData()->getXres() / 600; int y = 100 * getJobData()->getYres() / 600; - bool color = getJobData()->getColor() == JobData::kCOLOR; - HP_SetPageOrigin_1(__stream, x, y); - HP_SetColorSpace_1(__stream, color ? HP_eRGB : HP_eGray); - HP_SetPaintTxMode_1(__stream, HP_eOpaque); - HP_SetSourceTxMode_1(__stream, HP_eOpaque); - HP_SetROP_1(__stream, 204); + bool color = getJobData()->getColor() == JobData::kColor; + HP_SetPageOrigin_1(fStream, x, y); + HP_SetColorSpace_1(fStream, color ? HP_eRGB : HP_eGray); + HP_SetPaintTxMode_1(fStream, HP_eOpaque); + HP_SetSourceTxMode_1(fStream, HP_eOpaque); + HP_SetROP_1(fStream, 204); return true; } void PCL6Driver::startRasterGraphics(int x, int y, int width, int height) { - bool color = getJobData()->getColor() == JobData::kCOLOR; - __compression_method = -1; - HP_BeginImage_1(__stream, HP_eDirectPixel, color ? HP_e8Bit : HP_e1Bit, width, height, width, height); - HP_ReadImage_1(__stream, 0, height, HP_eNoCompression); + bool color = getJobData()->getColor() == JobData::kColor; + fCompressionMethod = -1; + HP_BeginImage_1(fStream, HP_eDirectPixel, color ? HP_e8Bit : HP_e1Bit, width, height, width, height); + HP_ReadImage_1(fStream, 0, height, HP_eNoCompression); } void PCL6Driver::endRasterGraphics() { - HP_EndImage_1(__stream); + HP_EndImage_1(fStream); } void PCL6Driver::rasterGraphics( @@ -262,17 +262,17 @@ void PCL6Driver::rasterGraphics( const uchar *buffer, int size) { - if (__compression_method != compression_method) { - __compression_method = compression_method; + if (fCompressionMethod != compression_method) { + fCompressionMethod = compression_method; } - HP_EmbeddedDataPrefix32(__stream, size); - HP_RawUByteArray(__stream, (uchar*)buffer, size); + HP_EmbeddedDataPrefix32(fStream, size); + HP_RawUByteArray(fStream, (uchar*)buffer, size); } bool PCL6Driver::endPage(int) { try { - HP_EndPage_2(__stream, getJobData()->getCopies()); + HP_EndPage_2(fStream, getJobData()->getCopies()); return true; } catch (TransportException &err) { @@ -282,9 +282,9 @@ bool PCL6Driver::endPage(int) void PCL6Driver::jobEnd() { - HP_CloseDataSource_1(__stream); - HP_EndSession_1(__stream); - HP_FinishStream(__stream); + HP_CloseDataSource_1(fStream); + HP_EndSession_1(fStream); + HP_FinishStream(fStream); // PJL footer writeSpoolString("\033%%-12345X@PJL EOJ\n" "\033%%-12345X"); @@ -292,18 +292,18 @@ void PCL6Driver::jobEnd() void PCL6Driver::move(int x, int y) { - HP_SetCursor_1(__stream, x, y); + HP_SetCursor_1(fStream, x, y); } -HP_UByte PCL6Driver::mediaSize(JobData::PAPER paper) +HP_UByte PCL6Driver::mediaSize(JobData::Paper paper) { switch (paper) { - case JobData::LETTER: return HP_eLetterPaper; - case JobData::LEGAL: return HP_eLegalPaper; - case JobData::A4: return HP_eA4Paper; - case JobData::EXECUTIVE: return HP_eExecPaper; - case JobData::LEDGER: return HP_eLedgerPaper; - case JobData::A3: return HP_eA3Paper; + case JobData::kLetter: return HP_eLetterPaper; + case JobData::kLegal: return HP_eLegalPaper; + case JobData::kA4: return HP_eA4Paper; + case JobData::kExecutive: return HP_eExecPaper; + case JobData::kLedger: return HP_eLedgerPaper; + case JobData::kA3: return HP_eA3Paper; /* case : return HP_eCOM10Envelope; case : return HP_eMonarchEnvelope; @@ -322,7 +322,8 @@ HP_UByte PCL6Driver::mediaSize(JobData::PAPER paper) case : return HP_eJIS16KPaper; case : return HP_eJISExecPaper; */ - default: HP_eLegalPaper; + default: + return HP_eLegalPaper; } } diff --git a/src/add-ons/print/drivers/pcl6/PCL6.h b/src/add-ons/print/drivers/pcl6/PCL6.h index fe2d0d71ab..9811792ef3 100644 --- a/src/add-ons/print/drivers/pcl6/PCL6.h +++ b/src/add-ons/print/drivers/pcl6/PCL6.h @@ -1,6 +1,7 @@ /* - * PCL5.h + * PCL6.h * Copyright 1999-2000 Y.Takagi. All Rights Reserved. + * Copyright 2003 Michael Pfeiffer. */ #ifndef __PCL6_H @@ -28,7 +29,7 @@ protected: virtual bool endDoc(bool success); private: - HP_UByte mediaSize(JobData::PAPER paper); + HP_UByte mediaSize(JobData::Paper paper); void move(int x, int y); void jobStart(); void startRasterGraphics(int x, int y, int width, int height); @@ -39,9 +40,9 @@ private: int size); void jobEnd(); - HP_StreamHandleType __stream; - int __compression_method; - Halftone *__halftone; + HP_StreamHandleType fStream; + int fCompressionMethod; + Halftone *fHalftone; }; -#endif /* __PCL5_H */ +#endif /* __PCL6_H */ diff --git a/src/add-ons/print/drivers/pcl6/PCL6Cap.cpp b/src/add-ons/print/drivers/pcl6/PCL6Cap.cpp index 122fb559e6..262195ff98 100644 --- a/src/add-ons/print/drivers/pcl6/PCL6Cap.cpp +++ b/src/add-ons/print/drivers/pcl6/PCL6Cap.cpp @@ -11,60 +11,60 @@ const PaperCap a3( "A3", false, - JobData::A3, + JobData::kA3, BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f))); const PaperCap a4( "A4", true, - JobData::A4, + JobData::kA4, BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f))); const PaperCap a5( "A5", false, - JobData::A5, + JobData::kA5, BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f))); const PaperCap japanese_postcard( "Japanese Postcard", false, - JobData::JAPANESE_POSTCARD, + JobData::kJapanesePostcard, BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f))); const PaperCap b4( "B4", false, - JobData::B4, + JobData::kB4, BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f))); const PaperCap b5( "B5", false, - JobData::B5, + JobData::kB5, BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f))); const PaperCap letter( "Letter", false, - JobData::LETTER, + JobData::kLetter, BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f))); const PaperCap legal( "Legal", false, - JobData::LEGAL, + JobData::kLegal, BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f))); -const PaperSourceCap autobin("Auto", true, JobData::AUTO); +const PaperSourceCap autobin("Auto", true, JobData::kAuto); const ResolutionCap dpi300("300dpi", true, 300, 300); const ResolutionCap dpi600("600dpi", false, 600, 600); @@ -90,8 +90,8 @@ const ResolutionCap *resolutions[] = { &dpi1200, }; -const ColorCap color("Color", false, JobData::kCOLOR); -const ColorCap monochrome("Monochrome", true, JobData::kMONOCHROME); +const ColorCap color("Color", false, JobData::kColor); +const ColorCap monochrome("Monochrome", true, JobData::kMonochrome); const ColorCap *colors[] = { &color, @@ -103,45 +103,45 @@ PCL6Cap::PCL6Cap(const PrinterData *printer_data) { } -int PCL6Cap::countCap(CAPID capid) const +int PCL6Cap::countCap(CapID capid) const { switch (capid) { - case PAPER: + case kPaper: return sizeof(papers) / sizeof(papers[0]); - case PAPERSOURCE: + case kPaperSource: return sizeof(papersources) / sizeof(papersources[0]); - case RESOLUTION: + case kResolution: return sizeof(resolutions) / sizeof(resolutions[0]); - case COLOR: + case kColor: return sizeof(colors) / sizeof(colors[0]); default: return 0; } } -const BaseCap **PCL6Cap::enumCap(CAPID capid) const +const BaseCap **PCL6Cap::enumCap(CapID capid) const { switch (capid) { - case PAPER: + case kPaper: return (const BaseCap **)papers; - case PAPERSOURCE: + case kPaperSource: return (const BaseCap **)papersources; - case RESOLUTION: + case kResolution: return (const BaseCap **)resolutions; - case COLOR: + case kColor: return (const BaseCap **)colors; default: return NULL; } } -bool PCL6Cap::isSupport(CAPID capid) const +bool PCL6Cap::isSupport(CapID capid) const { switch (capid) { - case PAPER: - case PAPERSOURCE: - case RESOLUTION: - case COLOR: + case kPaper: + case kPaperSource: + case kResolution: + case kColor: return true; default: return false; diff --git a/src/add-ons/print/drivers/pcl6/PCL6Cap.h b/src/add-ons/print/drivers/pcl6/PCL6Cap.h index c9b4ba126b..667ee03a79 100644 --- a/src/add-ons/print/drivers/pcl6/PCL6Cap.h +++ b/src/add-ons/print/drivers/pcl6/PCL6Cap.h @@ -1,19 +1,19 @@ /* - * PCL5Cap.h + * PCL6Cap.h * Copyright 1999-2000 Y.Takagi. All Rights Reserved. */ -#ifndef __PCL5CAP_H -#define __PCL5CAP_H +#ifndef __PCL6CAP_H +#define __PCL6CAP_H #include "PrinterCap.h" class PCL6Cap : public PrinterCap { public: PCL6Cap(const PrinterData *printer_data); - virtual int countCap(CAPID) const; - virtual bool isSupport(CAPID) const; - virtual const BaseCap **enumCap(CAPID) const; + virtual int countCap(CapID) const; + virtual bool isSupport(CapID) const; + virtual const BaseCap **enumCap(CapID) const; }; -#endif /* __PCL5CAP_H */ +#endif /* __PCL6CAP_H */ diff --git a/src/add-ons/print/drivers/postscript/PS.cpp b/src/add-ons/print/drivers/postscript/PS.cpp index d08549c7ea..1afe42c023 100644 --- a/src/add-ons/print/drivers/postscript/PS.cpp +++ b/src/add-ons/print/drivers/postscript/PS.cpp @@ -28,15 +28,15 @@ using namespace std; PSDriver::PSDriver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap) : GraphicsDriver(msg, printer_data, printer_cap) { - __printed_pages = 0; - __halftone = NULL; + fPrintedPages = 0; + fHalftone = NULL; } bool PSDriver::startDoc() { try { jobStart(); - __halftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma()); + fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma()); return true; } catch (TransportException &err) { @@ -54,7 +54,7 @@ bool PSDriver::startPage(int page) bool PSDriver::endPage(int) { try { - __printed_pages ++; + fPrintedPages ++; writeSpoolString("showpage\n"); return true; } @@ -66,8 +66,8 @@ bool PSDriver::endPage(int) bool PSDriver::endDoc(bool) { try { - if (__halftone) { - delete __halftone; + if (fHalftone) { + delete fHalftone; } jobEnd(); return true; @@ -113,7 +113,7 @@ bool PSDriver::nextBand(BBitmap *bitmap, BPoint *offset) DBGMSG(("x = %d\n", x)); DBGMSG(("y = %d\n", y)); - if (get_valid_rect(bitmap, __halftone->getPalette(), &rc)) { + if (get_valid_rect(bitmap, &rc)) { DBGMSG(("validate rect = %d, %d, %d, %d\n", rc.left, rc.top, rc.right, rc.bottom)); @@ -121,7 +121,7 @@ bool PSDriver::nextBand(BBitmap *bitmap, BPoint *offset) x = rc.left; y += rc.top; - bool color = getJobData()->getColor() == JobData::kCOLOR; + bool color = getJobData()->getColor() == JobData::kColor; int width = rc.right - rc.left + 1; int widthByte = (width + 7) / 8; /* byte boundary */ int height = rc.bottom - rc.top + 1; @@ -134,11 +134,11 @@ bool PSDriver::nextBand(BBitmap *bitmap, BPoint *offset) DBGMSG(("height = %d\n", height)); DBGMSG(("out_size = %d\n", out_size)); DBGMSG(("delta = %d\n", delta)); - DBGMSG(("renderobj->get_pixel_depth() = %d\n", __halftone->getPixelDepth())); + DBGMSG(("renderobj->get_pixel_depth() = %d\n", fHalftone->getPixelDepth())); uchar *ptr = (uchar *)bitmap->Bits() + rc.top * delta - + (rc.left * __halftone->getPixelDepth()) / 8; + + (rc.left * fHalftone->getPixelDepth()) / 8; int compression_method; int compressed_size; @@ -169,7 +169,7 @@ bool PSDriver::nextBand(BBitmap *bitmap, BPoint *offset) in += 4; } } else { - __halftone->dither(in_buffer, ptr, x, y, width); + fHalftone->dither(in_buffer, ptr, x, y, width); uchar* in = in_buffer; uchar* out = out_buffer; @@ -248,8 +248,8 @@ void PSDriver::jobStart() void PSDriver::startRasterGraphics(int x, int y, int width, int height, int widthByte) { - bool color = getJobData()->getColor() == JobData::kCOLOR; - __compression_method = -1; + bool color = getJobData()->getColor() == JobData::kColor; + fCompressionMethod = -1; writeSpoolString("gsave\n"); writeSpoolString("/s %d string def\n", widthByte); writeSpoolString("%d %d translate\n", x, y); @@ -279,8 +279,8 @@ void PSDriver::rasterGraphics( const uchar *buffer, int size) { - if (__compression_method != compression_method) { - __compression_method = compression_method; + if (fCompressionMethod != compression_method) { + fCompressionMethod = compression_method; } writeSpoolData(buffer, size); writeSpoolString("\n"); @@ -288,6 +288,6 @@ void PSDriver::rasterGraphics( void PSDriver::jobEnd() { - writeSpoolString("%%%%Pages: %d\n", __printed_pages); + writeSpoolString("%%%%Pages: %d\n", fPrintedPages); writeSpoolString("%%%%EOF\n"); } diff --git a/src/add-ons/print/drivers/postscript/PS.h b/src/add-ons/print/drivers/postscript/PS.h index ace8dd8e05..fd06e5941c 100644 --- a/src/add-ons/print/drivers/postscript/PS.h +++ b/src/add-ons/print/drivers/postscript/PS.h @@ -32,9 +32,9 @@ private: int size); void jobEnd(); - int __printed_pages; - int __compression_method; - Halftone *__halftone; + int fPrintedPages; + int fCompressionMethod; + Halftone *fHalftone; }; #endif /* __PS_H */ diff --git a/src/add-ons/print/drivers/postscript/PSCap.cpp b/src/add-ons/print/drivers/postscript/PSCap.cpp index 0904ab900c..8f98361a6a 100644 --- a/src/add-ons/print/drivers/postscript/PSCap.cpp +++ b/src/add-ons/print/drivers/postscript/PSCap.cpp @@ -11,60 +11,60 @@ const PaperCap a3( "A3", false, - JobData::A3, + JobData::kA3, BRect(0.0f, 0.0f, TO72DPI(7014.0f), TO72DPI(9920.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f))); const PaperCap a4( "A4", true, - JobData::A4, + JobData::kA4, BRect(0.0f, 0.0f, TO72DPI(4960.0f), TO72DPI(7014.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f))); const PaperCap a5( "A5", false, - JobData::A5, + JobData::kA5, BRect(0.0f, 0.0f, TO72DPI(3506.0f), TO72DPI(4960.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f))); const PaperCap japanese_postcard( "Japanese Postcard", false, - JobData::JAPANESE_POSTCARD, + JobData::kJapanesePostcard, BRect(0.0f, 0.0f, TO72DPI(2362.0f), TO72DPI(3506.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f))); const PaperCap b4( "B4", false, - JobData::B4, + JobData::kB4, BRect(0.0f, 0.0f, TO72DPI(6070.0f), TO72DPI(8598.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f))); const PaperCap b5( "B5", false, - JobData::B5, + JobData::kB5, BRect(0.0f, 0.0f, TO72DPI(4298.0f), TO72DPI(6070.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f))); const PaperCap letter( "Letter", false, - JobData::LETTER, + JobData::kLetter, BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(6600.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f))); const PaperCap legal( "Legal", false, - JobData::LEGAL, + JobData::kLegal, BRect(0.0f, 0.0f, TO72DPI(5100.0f), TO72DPI(8400.0f)), BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f))); -const PaperSourceCap autobin("Auto", true, JobData::AUTO); +const PaperSourceCap autobin("Auto", true, JobData::kAuto); const ResolutionCap dpi300("300dpi", true, 300, 300); const ResolutionCap dpi600("600dpi", false, 600, 600); @@ -90,8 +90,8 @@ const ResolutionCap *resolutions[] = { &dpi1200, }; -const ColorCap color("Color", false, JobData::kCOLOR); -const ColorCap monochrome("Monochrome", true, JobData::kMONOCHROME); +const ColorCap color("Color", false, JobData::kColor); +const ColorCap monochrome("Monochrome", true, JobData::kMonochrome); const ColorCap *colors[] = { &color, @@ -103,45 +103,45 @@ PSCap::PSCap(const PrinterData *printer_data) { } -int PSCap::countCap(CAPID capid) const +int PSCap::countCap(CapID capid) const { switch (capid) { - case PAPER: + case kPaper: return sizeof(papers) / sizeof(papers[0]); - case PAPERSOURCE: + case kPaperSource: return sizeof(papersources) / sizeof(papersources[0]); - case RESOLUTION: + case kResolution: return sizeof(resolutions) / sizeof(resolutions[0]); - case COLOR: + case kColor: return sizeof(colors) / sizeof(colors[0]); default: return 0; } } -const BaseCap **PSCap::enumCap(CAPID capid) const +const BaseCap **PSCap::enumCap(CapID capid) const { switch (capid) { - case PAPER: + case kPaper: return (const BaseCap **)papers; - case PAPERSOURCE: + case kPaperSource: return (const BaseCap **)papersources; - case RESOLUTION: + case kResolution: return (const BaseCap **)resolutions; - case COLOR: + case kColor: return (const BaseCap **)colors; default: return NULL; } } -bool PSCap::isSupport(CAPID capid) const +bool PSCap::isSupport(CapID capid) const { switch (capid) { - case PAPER: - case PAPERSOURCE: - case RESOLUTION: - case COLOR: + case kPaper: + case kPaperSource: + case kResolution: + case kColor: return true; default: return false; diff --git a/src/add-ons/print/drivers/postscript/PSCap.h b/src/add-ons/print/drivers/postscript/PSCap.h index d917f230e3..5a6de2483c 100644 --- a/src/add-ons/print/drivers/postscript/PSCap.h +++ b/src/add-ons/print/drivers/postscript/PSCap.h @@ -11,9 +11,9 @@ class PSCap : public PrinterCap { public: PSCap(const PrinterData *printer_data); - virtual int countCap(CAPID) const; - virtual bool isSupport(CAPID) const; - virtual const BaseCap **enumCap(CAPID) const; + virtual int countCap(CapID) const; + virtual bool isSupport(CapID) const; + virtual const BaseCap **enumCap(CapID) const; }; #endif /* __PSCAP_H */