Style cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37365 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -39,12 +39,8 @@ private:
|
|||||||
void moveAbsoluteHorizontal(int x);
|
void moveAbsoluteHorizontal(int x);
|
||||||
void carriageReturn();
|
void carriageReturn();
|
||||||
void moveDown(int dy);
|
void moveDown(int dy);
|
||||||
void rasterGraphics(
|
void rasterGraphics(int size, int widthbyte, int height,
|
||||||
int size,
|
int compression_method, const uchar* buffer);
|
||||||
int widthbyte,
|
|
||||||
int height,
|
|
||||||
int compression_method,
|
|
||||||
const uchar* buffer);
|
|
||||||
void formFeed();
|
void formFeed();
|
||||||
void jobEnd();
|
void jobEnd();
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Lips3Cap.h"
|
#include "Lips3Cap.h"
|
||||||
|
|
||||||
#include "PrinterData.h"
|
#include "PrinterData.h"
|
||||||
|
|
||||||
#define TO72DPI(a) (a * 72.0f / 600.0f)
|
#define TO72DPI(a) (a * 72.0f / 600.0f)
|
||||||
|
|
||||||
|
|
||||||
const PaperCap a3(
|
const PaperCap a3(
|
||||||
"A3",
|
"A3",
|
||||||
false,
|
false,
|
||||||
@@ -114,16 +114,16 @@ int
|
|||||||
Lips3Cap::countCap(CapID capid) const
|
Lips3Cap::countCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
return sizeof(papers) / sizeof(papers[0]);
|
return sizeof(papers) / sizeof(papers[0]);
|
||||||
case kPaperSource:
|
case kPaperSource:
|
||||||
return sizeof(papersources) / sizeof(papersources[0]);
|
return sizeof(papersources) / sizeof(papersources[0]);
|
||||||
case kResolution:
|
case kResolution:
|
||||||
return sizeof(resolutions) / sizeof(resolutions[0]);
|
return sizeof(resolutions) / sizeof(resolutions[0]);
|
||||||
case kColor:
|
case kColor:
|
||||||
return sizeof(colors) / sizeof(colors[0]);
|
return sizeof(colors) / sizeof(colors[0]);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,16 +132,16 @@ const
|
|||||||
BaseCap **Lips3Cap::enumCap(CapID capid) const
|
BaseCap **Lips3Cap::enumCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
return (const BaseCap **)papers;
|
return (const BaseCap **)papers;
|
||||||
case kPaperSource:
|
case kPaperSource:
|
||||||
return (const BaseCap **)papersources;
|
return (const BaseCap **)papersources;
|
||||||
case kResolution:
|
case kResolution:
|
||||||
return (const BaseCap **)resolutions;
|
return (const BaseCap **)resolutions;
|
||||||
case kColor:
|
case kColor:
|
||||||
return (const BaseCap **)colors;
|
return (const BaseCap **)colors;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,13 +150,13 @@ bool
|
|||||||
Lips3Cap::isSupport(CapID capid) const
|
Lips3Cap::isSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
case kPaperSource:
|
case kPaperSource:
|
||||||
case kResolution:
|
case kResolution:
|
||||||
case kColor:
|
case kColor:
|
||||||
case kCopyCommand:
|
case kCopyCommand:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,18 +3,22 @@
|
|||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "Lips4Cap.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <memory>
|
|
||||||
|
#include "DbgMsg.h"
|
||||||
|
#include "Halftone.h"
|
||||||
|
#include "JobData.h"
|
||||||
#include "Lips4.h"
|
#include "Lips4.h"
|
||||||
#include "PackBits.h"
|
#include "PackBits.h"
|
||||||
#include "JobData.h"
|
|
||||||
#include "PrinterData.h"
|
#include "PrinterData.h"
|
||||||
#include "Lips4Cap.h"
|
|
||||||
#include "Halftone.h"
|
|
||||||
#include "ValidRect.h"
|
#include "ValidRect.h"
|
||||||
#include "DbgMsg.h"
|
|
||||||
|
|
||||||
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
|
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -22,13 +26,18 @@ using namespace std;
|
|||||||
#define std
|
#define std
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LIPS4Driver::LIPS4Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
|
||||||
: GraphicsDriver(msg, printer_data, printer_cap)
|
LIPS4Driver::LIPS4Driver(BMessage* msg, PrinterData* printer_data,
|
||||||
|
const PrinterCap *printer_cap)
|
||||||
|
:
|
||||||
|
GraphicsDriver(msg, printer_data, printer_cap)
|
||||||
{
|
{
|
||||||
fHalftone = NULL;
|
fHalftone = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS4Driver::startDoc()
|
|
||||||
|
bool
|
||||||
|
LIPS4Driver::startDoc()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
beginTextMode();
|
beginTextMode();
|
||||||
@@ -43,15 +52,19 @@ bool LIPS4Driver::startDoc()
|
|||||||
setNumberOfCopies();
|
setNumberOfCopies();
|
||||||
sidePrintingControl();
|
sidePrintingControl();
|
||||||
setBindingMargin();
|
setBindingMargin();
|
||||||
fHalftone = new Halftone(getJobData()->getSurfaceType(), getJobData()->getGamma(), getJobData()->getInkDensity(), getJobData()->getDitherType());
|
fHalftone = new Halftone(getJobData()->getSurfaceType(),
|
||||||
|
getJobData()->getGamma(), getJobData()->getInkDensity(),
|
||||||
|
getJobData()->getDitherType());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException& err) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS4Driver::startPage(int)
|
|
||||||
|
bool
|
||||||
|
LIPS4Driver::startPage(int)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
fCurrentX = 0;
|
fCurrentX = 0;
|
||||||
@@ -59,37 +72,43 @@ bool LIPS4Driver::startPage(int)
|
|||||||
memorizedPosition();
|
memorizedPosition();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException& err) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS4Driver::endPage(int)
|
|
||||||
|
bool
|
||||||
|
LIPS4Driver::endPage(int)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
formFeed();
|
formFeed();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException& err) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS4Driver::endDoc(bool)
|
|
||||||
|
bool
|
||||||
|
LIPS4Driver::endDoc(bool)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (fHalftone) {
|
if (fHalftone)
|
||||||
delete fHalftone;
|
delete fHalftone;
|
||||||
}
|
|
||||||
jobEnd();
|
jobEnd();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException& err) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|
||||||
|
bool
|
||||||
|
LIPS4Driver::nextBand(BBitmap* bitmap, BPoint* offset)
|
||||||
{
|
{
|
||||||
DBGMSG(("> nextBand\n"));
|
DBGMSG(("> nextBand\n"));
|
||||||
|
|
||||||
@@ -106,9 +125,9 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
BRect bounds = bitmap->Bounds();
|
BRect bounds = bitmap->Bounds();
|
||||||
|
|
||||||
RECT rc;
|
RECT rc;
|
||||||
rc.left = (int)bounds.left;
|
rc.left = (int)bounds.left;
|
||||||
rc.top = (int)bounds.top;
|
rc.top = (int)bounds.top;
|
||||||
rc.right = (int)bounds.right;
|
rc.right = (int)bounds.right;
|
||||||
rc.bottom = (int)bounds.bottom;
|
rc.bottom = (int)bounds.bottom;
|
||||||
|
|
||||||
int height = rc.bottom - rc.top + 1;
|
int height = rc.bottom - rc.top + 1;
|
||||||
@@ -118,9 +137,8 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
|
|
||||||
int page_height = getPageHeight();
|
int page_height = getPageHeight();
|
||||||
|
|
||||||
if (y + height > page_height) {
|
if (y + height > page_height)
|
||||||
height = page_height - y;
|
height = page_height - y;
|
||||||
}
|
|
||||||
|
|
||||||
rc.bottom = height - 1;
|
rc.bottom = height - 1;
|
||||||
|
|
||||||
@@ -136,12 +154,12 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
x = rc.left;
|
x = rc.left;
|
||||||
y += rc.top;
|
y += rc.top;
|
||||||
|
|
||||||
int width = rc.right - rc.left + 1;
|
int width = rc.right - rc.left + 1;
|
||||||
int widthByte = (width + 7) / 8;
|
int widthByte = (width + 7) / 8;
|
||||||
int height = rc.bottom - rc.top + 1;
|
int height = rc.bottom - rc.top + 1;
|
||||||
int in_size = widthByte * height;
|
int in_size = widthByte * height;
|
||||||
int out_size = (in_size * 6 + 4) / 5;
|
int out_size = (in_size * 6 + 4) / 5;
|
||||||
int delta = bitmap->BytesPerRow();
|
int delta = bitmap->BytesPerRow();
|
||||||
|
|
||||||
DBGMSG(("width = %d\n", width));
|
DBGMSG(("width = %d\n", width));
|
||||||
DBGMSG(("widthByte = %d\n", widthByte));
|
DBGMSG(("widthByte = %d\n", widthByte));
|
||||||
@@ -149,23 +167,24 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
DBGMSG(("in_size = %d\n", in_size));
|
DBGMSG(("in_size = %d\n", in_size));
|
||||||
DBGMSG(("out_size = %d\n", out_size));
|
DBGMSG(("out_size = %d\n", out_size));
|
||||||
DBGMSG(("delta = %d\n", delta));
|
DBGMSG(("delta = %d\n", delta));
|
||||||
DBGMSG(("fHalftone_engine->get_pixel_depth() = %d\n", fHalftone->getPixelDepth()));
|
DBGMSG(("fHalftone_engine->get_pixel_depth() = %d\n",
|
||||||
|
fHalftone->getPixelDepth()));
|
||||||
|
|
||||||
uchar *ptr = (uchar *)bitmap->Bits()
|
uchar* ptr = static_cast<uchar*>(bitmap->Bits())
|
||||||
+ rc.top * delta
|
+ rc.top * delta
|
||||||
+ (rc.left * fHalftone->getPixelDepth()) / 8;
|
+ (rc.left * fHalftone->getPixelDepth()) / 8;
|
||||||
|
|
||||||
int compression_method;
|
int compression_method;
|
||||||
int compressed_size;
|
int compressed_size;
|
||||||
const uchar *buffer;
|
const uchar* buffer;
|
||||||
|
|
||||||
uchar *in_buffer = new uchar[in_size];
|
uchar* in_buffer = new uchar[in_size];
|
||||||
uchar *out_buffer = new uchar[out_size];
|
uchar* out_buffer = new uchar[out_size];
|
||||||
|
|
||||||
auto_ptr<uchar> _in_buffer (in_buffer);
|
auto_ptr<uchar> _in_buffer (in_buffer);
|
||||||
auto_ptr<uchar> _out_buffer(out_buffer);
|
auto_ptr<uchar> _out_buffer(out_buffer);
|
||||||
|
|
||||||
uchar *ptr2 = (uchar *)in_buffer;
|
uchar* ptr2 = static_cast<uchar *>(in_buffer);
|
||||||
|
|
||||||
DBGMSG(("move\n"));
|
DBGMSG(("move\n"));
|
||||||
|
|
||||||
@@ -186,7 +205,7 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
compression_method = 11;
|
compression_method = 11;
|
||||||
buffer = out_buffer;
|
buffer = out_buffer;
|
||||||
} else if (compressed_size > out_size) {
|
} else if (compressed_size > out_size) {
|
||||||
BAlert *alert = new BAlert("memory overrun!!!", "warning", "OK");
|
BAlert* alert = new BAlert("memory overrun!!!", "warning", "OK");
|
||||||
alert->Go();
|
alert->Go();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -207,38 +226,42 @@ bool LIPS4Driver::nextBand(BBitmap *bitmap, BPoint *offset)
|
|||||||
compression_method,
|
compression_method,
|
||||||
buffer);
|
buffer);
|
||||||
|
|
||||||
} else {
|
} else
|
||||||
DBGMSG(("band bitmap is clean.\n"));
|
DBGMSG(("band bitmap is clean.\n"));
|
||||||
}
|
|
||||||
|
|
||||||
if (y >= page_height) {
|
if (y >= page_height) {
|
||||||
offset->x = -1.0;
|
offset->x = -1.0;
|
||||||
offset->y = -1.0;
|
offset->y = -1.0;
|
||||||
} else {
|
} else
|
||||||
offset->y += height;
|
offset->y += height;
|
||||||
}
|
|
||||||
|
|
||||||
DBGMSG(("< nextBand\n"));
|
DBGMSG(("< nextBand\n"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException &err) {
|
catch (TransportException& err) {
|
||||||
BAlert *alert = new BAlert("", err.what(), "OK");
|
BAlert* alert = new BAlert("", err.what(), "OK");
|
||||||
alert->Go();
|
alert->Go();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::beginTextMode()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::beginTextMode()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033%%@");
|
writeSpoolString("\033%%@");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::jobStart()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::jobStart()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033P41;%d;1J\033\\", getJobData()->getXres());
|
writeSpoolString("\033P41;%d;1J\033\\", getJobData()->getXres());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::colorModeDeclaration()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::colorModeDeclaration()
|
||||||
{
|
{
|
||||||
// if (color)
|
// if (color)
|
||||||
// writeSpoolString("\033[1\"p");
|
// writeSpoolString("\033[1\"p");
|
||||||
@@ -246,22 +269,30 @@ void LIPS4Driver::colorModeDeclaration()
|
|||||||
writeSpoolString("\033[0\"p");
|
writeSpoolString("\033[0\"p");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::softReset()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::softReset()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033<");
|
writeSpoolString("\033<");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::sizeUnitMode()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::sizeUnitMode()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[11h");
|
writeSpoolString("\033[11h");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::selectSizeUnit()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::selectSizeUnit()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[?7;%d I", getJobData()->getXres());
|
writeSpoolString("\033[?7;%d I", getJobData()->getXres());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::paperFeedMode()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::paperFeedMode()
|
||||||
{
|
{
|
||||||
// 0 auto
|
// 0 auto
|
||||||
// --------------
|
// --------------
|
||||||
@@ -281,79 +312,81 @@ void LIPS4Driver::paperFeedMode()
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (getJobData()->getPaperSource()) {
|
switch (getJobData()->getPaperSource()) {
|
||||||
case JobData::kManual:
|
case JobData::kManual:
|
||||||
i = 10;
|
i = 10;
|
||||||
break;
|
break;
|
||||||
case JobData::kUpper:
|
case JobData::kUpper:
|
||||||
i = 11;
|
i = 11;
|
||||||
break;
|
break;
|
||||||
case JobData::kMiddle:
|
case JobData::kMiddle:
|
||||||
i = 12;
|
i = 12;
|
||||||
break;
|
break;
|
||||||
case JobData::kLower:
|
case JobData::kLower:
|
||||||
i = 13;
|
i = 13;
|
||||||
break;
|
break;
|
||||||
case JobData::kAuto:
|
case JobData::kAuto:
|
||||||
default:
|
default:
|
||||||
i = 0;
|
i = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeSpoolString("\033[%dq", i);
|
writeSpoolString("\033[%dq", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::selectPageFormat()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::selectPageFormat()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (getJobData()->getPaper()) {
|
switch (getJobData()->getPaper()) {
|
||||||
case JobData::kA3:
|
case JobData::kA3:
|
||||||
i = 12;
|
i = 12;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::kA4:
|
case JobData::kA4:
|
||||||
i = 14;
|
i = 14;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::kA5:
|
case JobData::kA5:
|
||||||
i = 16;
|
i = 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::kJapanesePostcard:
|
case JobData::kJapanesePostcard:
|
||||||
i = 18;
|
i = 18;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::kB4:
|
case JobData::kB4:
|
||||||
i = 24;
|
i = 24;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::kB5:
|
case JobData::kB5:
|
||||||
i = 26;
|
i = 26;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::kLetter:
|
case JobData::kLetter:
|
||||||
i = 30;
|
i = 30;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::kLegal:
|
case JobData::kLegal:
|
||||||
i = 32;
|
i = 32;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::kExecutive:
|
case JobData::kExecutive:
|
||||||
i = 40;
|
i = 40;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::kJEnvYou4:
|
case JobData::kJEnvYou4:
|
||||||
i = 50;
|
i = 50;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobData::kUser:
|
case JobData::kUser:
|
||||||
i = 90;
|
i = 90;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
i = 0;
|
i = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JobData::kLandscape == getJobData()->getOrientation())
|
if (JobData::kLandscape == getJobData()->getOrientation())
|
||||||
@@ -362,17 +395,23 @@ void LIPS4Driver::selectPageFormat()
|
|||||||
writeSpoolString("\033[%d;;p", i);
|
writeSpoolString("\033[%d;;p", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::disableAutoFF()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::disableAutoFF()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[?2h");
|
writeSpoolString("\033[?2h");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::setNumberOfCopies()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::setNumberOfCopies()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[%ldv", getJobData()->getCopies());
|
writeSpoolString("\033[%ldv", getJobData()->getCopies());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::sidePrintingControl()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::sidePrintingControl()
|
||||||
{
|
{
|
||||||
if (getJobData()->getPrintStyle() == JobData::kSimplex)
|
if (getJobData()->getPrintStyle() == JobData::kSimplex)
|
||||||
writeSpoolString("\033[0#x");
|
writeSpoolString("\033[0#x");
|
||||||
@@ -380,7 +419,9 @@ void LIPS4Driver::sidePrintingControl()
|
|||||||
writeSpoolString("\033[2;0#x");
|
writeSpoolString("\033[2;0#x");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::setBindingMargin()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::setBindingMargin()
|
||||||
{
|
{
|
||||||
if (getJobData()->getPrintStyle() == JobData::kDuplex) {
|
if (getJobData()->getPrintStyle() == JobData::kDuplex) {
|
||||||
int i;
|
int i;
|
||||||
@@ -402,32 +443,38 @@ void LIPS4Driver::setBindingMargin()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::memorizedPosition()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::memorizedPosition()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[0;1;0x");
|
writeSpoolString("\033[0;1;0x");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::moveAbsoluteHorizontal(int x)
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::moveAbsoluteHorizontal(int x)
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[%ld`", x);
|
writeSpoolString("\033[%ld`", x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::carriageReturn()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::carriageReturn()
|
||||||
{
|
{
|
||||||
writeSpoolChar('\x0d');
|
writeSpoolChar('\x0d');
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::moveDown(int dy)
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::moveDown(int dy)
|
||||||
{
|
{
|
||||||
writeSpoolString("\033[%lde", dy);
|
writeSpoolString("\033[%lde", dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::rasterGraphics(
|
|
||||||
int compression_size,
|
void
|
||||||
int widthbyte,
|
LIPS4Driver::rasterGraphics(int compression_size, int widthbyte, int height,
|
||||||
int height,
|
int compression_method, const uchar* buffer)
|
||||||
int compression_method,
|
|
||||||
const uchar *buffer)
|
|
||||||
{
|
{
|
||||||
// 0 RAW
|
// 0 RAW
|
||||||
// 10 RLE
|
// 10 RLE
|
||||||
@@ -444,17 +491,23 @@ void LIPS4Driver::rasterGraphics(
|
|||||||
writeSpoolData(buffer, compression_size);
|
writeSpoolData(buffer, compression_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::formFeed()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::formFeed()
|
||||||
{
|
{
|
||||||
writeSpoolChar('\014');
|
writeSpoolChar('\014');
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::jobEnd()
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::jobEnd()
|
||||||
{
|
{
|
||||||
writeSpoolString("\033P0J\033\\");
|
writeSpoolString("\033P0J\033\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIPS4Driver::move(int x, int y)
|
|
||||||
|
void
|
||||||
|
LIPS4Driver::move(int x, int y)
|
||||||
{
|
{
|
||||||
if (fCurrentX != x) {
|
if (fCurrentX != x) {
|
||||||
if (x) {
|
if (x) {
|
||||||
|
|||||||
@@ -2,55 +2,53 @@
|
|||||||
* Lips4.h
|
* Lips4.h
|
||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LIPS4_H
|
#ifndef __LIPS4_H
|
||||||
#define __LIPS4_H
|
#define __LIPS4_H
|
||||||
|
|
||||||
|
|
||||||
#include "GraphicsDriver.h"
|
#include "GraphicsDriver.h"
|
||||||
|
|
||||||
|
|
||||||
class Halftone;
|
class Halftone;
|
||||||
|
|
||||||
|
|
||||||
class LIPS4Driver : public GraphicsDriver {
|
class LIPS4Driver : public GraphicsDriver {
|
||||||
public:
|
public:
|
||||||
LIPS4Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *cap);
|
LIPS4Driver(BMessage *msg, PrinterData *printer_data, const PrinterCap *cap);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool startDoc();
|
virtual bool startDoc();
|
||||||
virtual bool startPage(int page);
|
virtual bool startPage(int page);
|
||||||
virtual bool nextBand(BBitmap *bitmap, BPoint *offset);
|
virtual bool nextBand(BBitmap *bitmap, BPoint *offset);
|
||||||
virtual bool endPage(int page);
|
virtual bool endPage(int page);
|
||||||
virtual bool endDoc(bool success);
|
virtual bool endDoc(bool success);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void move(int x, int y);
|
void move(int x, int y);
|
||||||
void beginTextMode();
|
void beginTextMode();
|
||||||
void jobStart();
|
void jobStart();
|
||||||
void colorModeDeclaration();
|
void colorModeDeclaration();
|
||||||
void softReset();
|
void softReset();
|
||||||
void sizeUnitMode();
|
void sizeUnitMode();
|
||||||
void selectSizeUnit();
|
void selectSizeUnit();
|
||||||
void paperFeedMode();
|
void paperFeedMode();
|
||||||
void selectPageFormat();
|
void selectPageFormat();
|
||||||
void disableAutoFF();
|
void disableAutoFF();
|
||||||
void setNumberOfCopies();
|
void setNumberOfCopies();
|
||||||
void sidePrintingControl();
|
void sidePrintingControl();
|
||||||
void setBindingMargin();
|
void setBindingMargin();
|
||||||
void memorizedPosition();
|
void memorizedPosition();
|
||||||
void moveAbsoluteHorizontal(int x);
|
void moveAbsoluteHorizontal(int x);
|
||||||
void carriageReturn();
|
void carriageReturn();
|
||||||
void moveDown(int dy);
|
void moveDown(int dy);
|
||||||
void rasterGraphics(
|
void rasterGraphics(int size, int widthbyte, int height,
|
||||||
int size,
|
int compression_method, const uchar* buffer);
|
||||||
int widthbyte,
|
void formFeed();
|
||||||
int height,
|
void jobEnd();
|
||||||
int compression_method,
|
|
||||||
const uchar *buffer);
|
|
||||||
void formFeed();
|
|
||||||
void jobEnd();
|
|
||||||
|
|
||||||
int fCurrentX;
|
int fCurrentX;
|
||||||
int fCurrentY;
|
int fCurrentY;
|
||||||
Halftone *fHalftone;
|
Halftone* fHalftone;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __LIPS4_H */
|
#endif // __LIPS4_H
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Lips4Cap.h"
|
#include "Lips4Cap.h"
|
||||||
|
|
||||||
#define TO72DPI(a) (a * 72.0f / 600.0f)
|
#define TO72DPI(a) (a * 72.0f / 600.0f)
|
||||||
@@ -105,12 +106,16 @@ const PrintStyleCap simplex("Simplex", true, JobData::kSimplex);
|
|||||||
const PrintStyleCap duplex("Duplex", false, JobData::kDuplex);
|
const PrintStyleCap duplex("Duplex", false, JobData::kDuplex);
|
||||||
const PrintStyleCap booklet("Booklet", false, JobData::kBooklet);
|
const PrintStyleCap booklet("Booklet", false, JobData::kBooklet);
|
||||||
|
|
||||||
const BindingLocationCap longedge1("Long Edge (left)", true, JobData::kLongEdgeLeft);
|
const BindingLocationCap longedge1("Long Edge (left)", true,
|
||||||
const BindingLocationCap longedge2("Long Edge (right)", false, JobData::kLongEdgeRight);
|
JobData::kLongEdgeLeft);
|
||||||
const BindingLocationCap shortedge1("Short Edge (top)", false, JobData::kShortEdgeTop);
|
const BindingLocationCap longedge2("Long Edge (right)", false,
|
||||||
const BindingLocationCap shortedge2("Short Edge (bottom)", false, JobData::kShortEdgeBottom);
|
JobData::kLongEdgeRight);
|
||||||
|
const BindingLocationCap shortedge1("Short Edge (top)", false,
|
||||||
|
JobData::kShortEdgeTop);
|
||||||
|
const BindingLocationCap shortedge2("Short Edge (bottom)", false,
|
||||||
|
JobData::kShortEdgeBottom);
|
||||||
|
|
||||||
const PaperCap *papers[] = {
|
const PaperCap* papers[] = {
|
||||||
&a4,
|
&a4,
|
||||||
&a3,
|
&a3,
|
||||||
&a5,
|
&a5,
|
||||||
@@ -124,7 +129,7 @@ const PaperCap *papers[] = {
|
|||||||
&japanese_envelope_you4
|
&japanese_envelope_you4
|
||||||
};
|
};
|
||||||
|
|
||||||
const PaperSourceCap *papersources[] = {
|
const PaperSourceCap* papersources[] = {
|
||||||
&autobin,
|
&autobin,
|
||||||
&manual,
|
&manual,
|
||||||
&upper,
|
&upper,
|
||||||
@@ -132,13 +137,13 @@ const PaperSourceCap *papersources[] = {
|
|||||||
&lower
|
&lower
|
||||||
};
|
};
|
||||||
|
|
||||||
const ResolutionCap *resolutions[] = {
|
const ResolutionCap* resolutions[] = {
|
||||||
&dpi1200,
|
&dpi1200,
|
||||||
&dpi600,
|
&dpi600,
|
||||||
&dpi300
|
&dpi300
|
||||||
};
|
};
|
||||||
|
|
||||||
const PrintStyleCap *printstyles[] = {
|
const PrintStyleCap* printstyles[] = {
|
||||||
&simplex,
|
&simplex,
|
||||||
&duplex,
|
&duplex,
|
||||||
&booklet
|
&booklet
|
||||||
@@ -154,64 +159,69 @@ const BindingLocationCap *bindinglocations[] = {
|
|||||||
const ColorCap color("Color", false, JobData::kColor);
|
const ColorCap color("Color", false, JobData::kColor);
|
||||||
const ColorCap monochrome("Shades of Gray", true, JobData::kMonochrome);
|
const ColorCap monochrome("Shades of Gray", true, JobData::kMonochrome);
|
||||||
|
|
||||||
const ColorCap *colors[] = {
|
const ColorCap* colors[] = {
|
||||||
&color,
|
&color,
|
||||||
&monochrome
|
&monochrome
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int Lips4Cap::countCap(CapID capid) const
|
int
|
||||||
|
Lips4Cap::countCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
return sizeof(papers) / sizeof(papers[0]);
|
return sizeof(papers) / sizeof(papers[0]);
|
||||||
case kPaperSource:
|
case kPaperSource:
|
||||||
return sizeof(papersources) / sizeof(papersources[0]);
|
return sizeof(papersources) / sizeof(papersources[0]);
|
||||||
case kResolution:
|
case kResolution:
|
||||||
return sizeof(resolutions) / sizeof(resolutions[0]);
|
return sizeof(resolutions) / sizeof(resolutions[0]);
|
||||||
case kPrintStyle:
|
case kPrintStyle:
|
||||||
return sizeof(printstyles) / sizeof(printstyles[0]);
|
return sizeof(printstyles) / sizeof(printstyles[0]);
|
||||||
case kBindingLocation:
|
case kBindingLocation:
|
||||||
return sizeof(bindinglocations) / sizeof(bindinglocations[0]);
|
return sizeof(bindinglocations) / sizeof(bindinglocations[0]);
|
||||||
case kColor:
|
case kColor:
|
||||||
return sizeof(colors) / sizeof(colors[0]);
|
return sizeof(colors) / sizeof(colors[0]);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const BaseCap**
|
||||||
|
Lips4Cap::enumCap(CapID capid) const
|
||||||
|
{
|
||||||
|
switch (capid) {
|
||||||
|
case kPaper:
|
||||||
|
return (const BaseCap **)papers;
|
||||||
|
case kPaperSource:
|
||||||
|
return (const BaseCap **)papersources;
|
||||||
|
case kResolution:
|
||||||
|
return (const BaseCap **)resolutions;
|
||||||
|
case kPrintStyle:
|
||||||
|
return (const BaseCap **)printstyles;
|
||||||
|
case kBindingLocation:
|
||||||
|
return (const BaseCap **)bindinglocations;
|
||||||
|
case kColor:
|
||||||
|
return (const BaseCap **)colors;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const BaseCap **Lips4Cap::enumCap(CapID capid) const
|
|
||||||
{
|
|
||||||
switch (capid) {
|
|
||||||
case kPaper:
|
|
||||||
return (const BaseCap **)papers;
|
|
||||||
case kPaperSource:
|
|
||||||
return (const BaseCap **)papersources;
|
|
||||||
case kResolution:
|
|
||||||
return (const BaseCap **)resolutions;
|
|
||||||
case kPrintStyle:
|
|
||||||
return (const BaseCap **)printstyles;
|
|
||||||
case kBindingLocation:
|
|
||||||
return (const BaseCap **)bindinglocations;
|
|
||||||
case kColor:
|
|
||||||
return (const BaseCap **)colors;
|
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Lips4Cap::isSupport(CapID capid) const
|
bool
|
||||||
|
Lips4Cap::isSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
case kPaperSource:
|
case kPaperSource:
|
||||||
case kResolution:
|
case kResolution:
|
||||||
case kPrintStyle:
|
case kPrintStyle:
|
||||||
case kBindingLocation:
|
case kBindingLocation:
|
||||||
case kColor:
|
case kColor:
|
||||||
case kCopyCommand:
|
case kCopyCommand:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,20 @@
|
|||||||
* Lips4Cap.h
|
* Lips4Cap.h
|
||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LIPS4CAP_H
|
#ifndef __LIPS4CAP_H
|
||||||
#define __LIPS4CAP_H
|
#define __LIPS4CAP_H
|
||||||
|
|
||||||
|
|
||||||
#include "PrinterCap.h"
|
#include "PrinterCap.h"
|
||||||
|
|
||||||
|
|
||||||
class Lips4Cap : public PrinterCap {
|
class Lips4Cap : public PrinterCap {
|
||||||
public:
|
public:
|
||||||
Lips4Cap(const PrinterData *printer_data) : PrinterCap(printer_data) {}
|
Lips4Cap(const PrinterData* printer_data)
|
||||||
virtual int countCap(CapID) const;
|
: PrinterCap(printer_data) {}
|
||||||
virtual bool isSupport(CapID) const;
|
virtual int countCap(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CapID) const;
|
virtual bool isSupport(CapID) const;
|
||||||
|
virtual const BaseCap** enumCap(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __LIPS4CAP_H */
|
#endif // __LIPS4CAP_H
|
||||||
|
|||||||
@@ -3,10 +3,12 @@
|
|||||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Lips4.h"
|
#include "Lips4.h"
|
||||||
#include "Lips4Cap.h"
|
#include "Lips4Cap.h"
|
||||||
#include "PrinterDriver.h"
|
#include "PrinterDriver.h"
|
||||||
|
|
||||||
|
|
||||||
class Lips4PrinterDriver : public PrinterDriver
|
class Lips4PrinterDriver : public PrinterDriver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -37,13 +39,16 @@ public:
|
|||||||
return new Lips4Cap(printerData);
|
return new Lips4Cap(printerData);
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, PrinterData* printerData, PrinterCap* printerCap)
|
GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings,
|
||||||
|
PrinterData* printerData, PrinterCap* printerCap)
|
||||||
{
|
{
|
||||||
return new LIPS4Driver(settings, printerData, printerCap);
|
return new LIPS4Driver(settings, printerData, printerCap);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PrinterDriver* instantiate_printer_driver(BNode* printerFolder)
|
|
||||||
|
PrinterDriver*
|
||||||
|
instantiate_printer_driver(BNode* printerFolder)
|
||||||
{
|
{
|
||||||
return new Lips4PrinterDriver(printerFolder);
|
return new Lips4PrinterDriver(printerFolder);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user