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
This commit is contained in:
Michael Pfeiffer 2004-01-30 17:12:00 +00:00
parent 2f6e49a929
commit d2c03b1bec
21 changed files with 352 additions and 348 deletions

View File

@ -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;
}
}

View File

@ -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 */

View File

@ -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;

View File

@ -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 */

View File

@ -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;
}
}

View File

@ -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 */

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -34,8 +34,8 @@ private:
void jobEnd();
int bytesToEnterCompressionMethod(int compression_method);
int __compression_method;
Halftone *__halftone;
int fCompressionMethod;
Halftone *fHalftone;
};
#endif /* __PCL5_H */

View File

@ -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;

View File

@ -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 */

View File

@ -44,6 +44,16 @@ Job Separation Command
Image Transfer
Simple Color Command
Esc*r<mode>U
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*r<mode>F
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*b<mode>M
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*b<length>W<data>
[Esc*b<length>V<data> # ]
Esc*b<length>W<data> # for last plane moves cursor X pos to 0
length ... 0 to 32767
}
}

View File

@ -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;
}
}

View File

@ -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 */

View File

@ -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;

View File

@ -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 */

View File

@ -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");
}

View File

@ -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 */

View File

@ -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;

View File

@ -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 */