* Code style changes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39770 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -44,9 +44,9 @@ LIPS3Driver::StartDocument()
|
|||||||
_PaperFeedMode();
|
_PaperFeedMode();
|
||||||
_DisableAutoFF();
|
_DisableAutoFF();
|
||||||
_SetNumberOfCopies();
|
_SetNumberOfCopies();
|
||||||
fHalftone = new Halftone(GetJobData()->getSurfaceType(),
|
fHalftone = new Halftone(GetJobData()->GetSurfaceType(),
|
||||||
GetJobData()->getGamma(), GetJobData()->getInkDensity(),
|
GetJobData()->GetGamma(), GetJobData()->GetInkDensity(),
|
||||||
GetJobData()->getDitherType());
|
GetJobData()->GetDitherType());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException& err) {
|
catch (TransportException& err) {
|
||||||
@@ -151,12 +151,12 @@ LIPS3Driver::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(("renderobj->get_pixel_depth() = %d\n",
|
DBGMSG(("renderobj->Get_pixel_depth() = %d\n",
|
||||||
fHalftone->getPixelDepth()));
|
fHalftone->GetPixelDepth()));
|
||||||
|
|
||||||
uchar* ptr = static_cast<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 compressionMethod;
|
int compressionMethod;
|
||||||
int compressedSize;
|
int compressedSize;
|
||||||
@@ -175,7 +175,7 @@ LIPS3Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
_Move(x, y);
|
_Move(x, y);
|
||||||
|
|
||||||
for (int i = rc.top; i <= rc.bottom; i++) {
|
for (int i = rc.top; i <= rc.bottom; i++) {
|
||||||
fHalftone->dither(ptr2, ptr, x, y, width);
|
fHalftone->Dither(ptr2, ptr, x, y, width);
|
||||||
ptr += delta;
|
ptr += delta;
|
||||||
ptr2 += widthByte;
|
ptr2 += widthByte;
|
||||||
y++;
|
y++;
|
||||||
@@ -223,7 +223,7 @@ LIPS3Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -272,7 +272,7 @@ LIPS3Driver::_SelectPageFormat()
|
|||||||
int width = 0;
|
int width = 0;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
|
|
||||||
switch (GetJobData()->getPaper()) {
|
switch (GetJobData()->GetPaper()) {
|
||||||
case JobData::kA3:
|
case JobData::kA3:
|
||||||
i = 12;
|
i = 12;
|
||||||
break;
|
break;
|
||||||
@@ -319,12 +319,12 @@ LIPS3Driver::_SelectPageFormat()
|
|||||||
//
|
//
|
||||||
default:
|
default:
|
||||||
i = 80;
|
i = 80;
|
||||||
width = GetJobData()->getPaperRect().IntegerWidth();
|
width = GetJobData()->GetPaperRect().IntegerWidth();
|
||||||
height = GetJobData()->getPaperRect().IntegerHeight();
|
height = GetJobData()->GetPaperRect().IntegerHeight();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JobData::kLandscape == GetJobData()->getOrientation())
|
if (JobData::kLandscape == GetJobData()->GetOrientation())
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (i < 80)
|
if (i < 80)
|
||||||
@@ -354,7 +354,7 @@ LIPS3Driver::_PaperFeedMode()
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (GetJobData()->getPaperSource()) {
|
switch (GetJobData()->GetPaperSource()) {
|
||||||
case JobData::kManual:
|
case JobData::kManual:
|
||||||
i = 1;
|
i = 1;
|
||||||
break;
|
break;
|
||||||
@@ -384,7 +384,7 @@ LIPS3Driver::_DisableAutoFF()
|
|||||||
void
|
void
|
||||||
LIPS3Driver::_SetNumberOfCopies()
|
LIPS3Driver::_SetNumberOfCopies()
|
||||||
{
|
{
|
||||||
WriteSpoolString("\033[%ldv", GetJobData()->getCopies());
|
WriteSpoolString("\033[%ldv", GetJobData()->GetCopies());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ LIPS3Driver::_RasterGraphics( int compressionSize, int widthbyte, int height,
|
|||||||
// 0 RAW
|
// 0 RAW
|
||||||
// 9 compress-3
|
// 9 compress-3
|
||||||
WriteSpoolString("\033[%d;%d;%d;%d;%d.r", compressionSize, widthbyte,
|
WriteSpoolString("\033[%d;%d;%d;%d;%d.r", compressionSize, widthbyte,
|
||||||
GetJobData()->getXres(), compressionMethod, height);
|
GetJobData()->GetXres(), compressionMethod, height);
|
||||||
|
|
||||||
WriteSpoolData(buffer, compressionSize);
|
WriteSpoolData(buffer, compressionSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ Lips3Cap::Lips3Cap(const PrinterData* printer_data)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
Lips3Cap::countCap(CapID capid) const
|
Lips3Cap::CountCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -129,7 +129,7 @@ Lips3Cap::countCap(CapID capid) const
|
|||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
BaseCap **Lips3Cap::enumCap(CapID capid) const
|
BaseCap **Lips3Cap::GetCaps(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -147,7 +147,7 @@ BaseCap **Lips3Cap::enumCap(CapID capid) const
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Lips3Cap::isSupport(CapID capid) const
|
Lips3Cap::IsSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
class Lips3Cap : public PrinterCap {
|
class Lips3Cap : public PrinterCap {
|
||||||
public:
|
public:
|
||||||
Lips3Cap(const PrinterData* printer_data);
|
Lips3Cap(const PrinterData* printer_data);
|
||||||
virtual int countCap(CapID) const;
|
virtual int CountCap(CapID) const;
|
||||||
virtual bool isSupport(CapID) const;
|
virtual bool IsSupport(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CapID) const;
|
virtual const BaseCap **GetCaps(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __LIPS3CAP_H
|
#endif // __LIPS3CAP_H
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ LIPS4Driver::StartDocument()
|
|||||||
_SetNumberOfCopies();
|
_SetNumberOfCopies();
|
||||||
_SidePrintingControl();
|
_SidePrintingControl();
|
||||||
_SetBindingMargin();
|
_SetBindingMargin();
|
||||||
fHalftone = new Halftone(GetJobData()->getSurfaceType(),
|
fHalftone = new Halftone(GetJobData()->GetSurfaceType(),
|
||||||
GetJobData()->getGamma(), GetJobData()->getInkDensity(),
|
GetJobData()->GetGamma(), GetJobData()->GetInkDensity(),
|
||||||
GetJobData()->getDitherType());
|
GetJobData()->GetDitherType());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException& err) {
|
catch (TransportException& err) {
|
||||||
@@ -161,12 +161,12 @@ 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",
|
DBGMSG(("fHalftone_engine->Get_pixel_depth() = %d\n",
|
||||||
fHalftone->getPixelDepth()));
|
fHalftone->GetPixelDepth()));
|
||||||
|
|
||||||
uchar* ptr = static_cast<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;
|
||||||
@@ -185,7 +185,7 @@ LIPS4Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
_Move(x, y);
|
_Move(x, y);
|
||||||
|
|
||||||
for (int i = rc.top; i <= rc.bottom; i++) {
|
for (int i = rc.top; i <= rc.bottom; i++) {
|
||||||
fHalftone->dither(ptr2, ptr, x, y, width);
|
fHalftone->Dither(ptr2, ptr, x, y, width);
|
||||||
ptr += delta;
|
ptr += delta;
|
||||||
ptr2 += widthByte;
|
ptr2 += widthByte;
|
||||||
y++;
|
y++;
|
||||||
@@ -233,7 +233,7 @@ LIPS4Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -250,7 +250,7 @@ LIPS4Driver::_BeginTextMode()
|
|||||||
void
|
void
|
||||||
LIPS4Driver::_JobStart()
|
LIPS4Driver::_JobStart()
|
||||||
{
|
{
|
||||||
WriteSpoolString("\033P41;%d;1J\033\\", GetJobData()->getXres());
|
WriteSpoolString("\033P41;%d;1J\033\\", GetJobData()->GetXres());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ LIPS4Driver::_SizeUnitMode()
|
|||||||
void
|
void
|
||||||
LIPS4Driver::_SelectSizeUnit()
|
LIPS4Driver::_SelectSizeUnit()
|
||||||
{
|
{
|
||||||
WriteSpoolString("\033[?7;%d I", GetJobData()->getXres());
|
WriteSpoolString("\033[?7;%d I", GetJobData()->GetXres());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -305,7 +305,7 @@ LIPS4Driver::_PaperFeedMode()
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (GetJobData()->getPaperSource()) {
|
switch (GetJobData()->GetPaperSource()) {
|
||||||
case JobData::kManual:
|
case JobData::kManual:
|
||||||
i = 10;
|
i = 10;
|
||||||
break;
|
break;
|
||||||
@@ -333,7 +333,7 @@ LIPS4Driver::_SelectPageFormat()
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (GetJobData()->getPaper()) {
|
switch (GetJobData()->GetPaper()) {
|
||||||
case JobData::kA3:
|
case JobData::kA3:
|
||||||
i = 12;
|
i = 12;
|
||||||
break;
|
break;
|
||||||
@@ -383,7 +383,7 @@ LIPS4Driver::_SelectPageFormat()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JobData::kLandscape == GetJobData()->getOrientation())
|
if (JobData::kLandscape == GetJobData()->GetOrientation())
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
WriteSpoolString("\033[%d;;p", i);
|
WriteSpoolString("\033[%d;;p", i);
|
||||||
@@ -400,14 +400,14 @@ LIPS4Driver::_DisableAutoFF()
|
|||||||
void
|
void
|
||||||
LIPS4Driver::_SetNumberOfCopies()
|
LIPS4Driver::_SetNumberOfCopies()
|
||||||
{
|
{
|
||||||
WriteSpoolString("\033[%ldv", GetJobData()->getCopies());
|
WriteSpoolString("\033[%ldv", GetJobData()->GetCopies());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LIPS4Driver::_SidePrintingControl()
|
LIPS4Driver::_SidePrintingControl()
|
||||||
{
|
{
|
||||||
if (GetJobData()->getPrintStyle() == JobData::kSimplex)
|
if (GetJobData()->GetPrintStyle() == JobData::kSimplex)
|
||||||
WriteSpoolString("\033[0#x");
|
WriteSpoolString("\033[0#x");
|
||||||
else
|
else
|
||||||
WriteSpoolString("\033[2;0#x");
|
WriteSpoolString("\033[2;0#x");
|
||||||
@@ -417,7 +417,7 @@ LIPS4Driver::_SidePrintingControl()
|
|||||||
void
|
void
|
||||||
LIPS4Driver::_SetBindingMargin()
|
LIPS4Driver::_SetBindingMargin()
|
||||||
{
|
{
|
||||||
if (GetJobData()->getPrintStyle() == JobData::kDuplex) {
|
if (GetJobData()->GetPrintStyle() == JobData::kDuplex) {
|
||||||
int i;
|
int i;
|
||||||
// switch (job_data()->binding_location()) {
|
// switch (job_data()->binding_location()) {
|
||||||
// case kLongEdgeLeft:
|
// case kLongEdgeLeft:
|
||||||
@@ -478,7 +478,7 @@ LIPS4Driver::_RasterGraphics(int compression_size, int widthbyte, int height,
|
|||||||
"\033[%ld;%ld;%d;%ld;%ld.r",
|
"\033[%ld;%ld;%d;%ld;%ld.r",
|
||||||
compression_size,
|
compression_size,
|
||||||
widthbyte,
|
widthbyte,
|
||||||
GetJobData()->getXres(),
|
GetJobData()->GetXres(),
|
||||||
compression_method,
|
compression_method,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ const ColorCap* colors[] = {
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
Lips4Cap::countCap(CapID capid) const
|
Lips4Cap::CountCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -188,7 +188,7 @@ Lips4Cap::countCap(CapID capid) const
|
|||||||
|
|
||||||
|
|
||||||
const BaseCap**
|
const BaseCap**
|
||||||
Lips4Cap::enumCap(CapID capid) const
|
Lips4Cap::GetCaps(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -210,7 +210,7 @@ Lips4Cap::enumCap(CapID capid) const
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Lips4Cap::isSupport(CapID capid) const
|
Lips4Cap::IsSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ class Lips4Cap : public PrinterCap {
|
|||||||
public:
|
public:
|
||||||
Lips4Cap(const PrinterData* printer_data)
|
Lips4Cap(const PrinterData* printer_data)
|
||||||
: PrinterCap(printer_data) {}
|
: PrinterCap(printer_data) {}
|
||||||
virtual int countCap(CapID) const;
|
virtual int CountCap(CapID) const;
|
||||||
virtual bool isSupport(CapID) const;
|
virtual bool IsSupport(CapID) const;
|
||||||
virtual const BaseCap** enumCap(CapID) const;
|
virtual const BaseCap** GetCaps(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __LIPS4CAP_H
|
#endif // __LIPS4CAP_H
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ GPCapabilities::~GPCapabilities()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
GPCapabilities::countCap(CapID category) const
|
GPCapabilities::CountCap(CapID category) const
|
||||||
{
|
{
|
||||||
const GPArray<struct BaseCap>* capabilities;
|
const GPArray<struct BaseCap>* capabilities;
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ GPCapabilities::countCap(CapID category) const
|
|||||||
|
|
||||||
|
|
||||||
const BaseCap**
|
const BaseCap**
|
||||||
GPCapabilities::enumCap(CapID category) const
|
GPCapabilities::GetCaps(CapID category) const
|
||||||
{
|
{
|
||||||
typedef const BaseCap** ArrayType;
|
typedef const BaseCap** ArrayType;
|
||||||
const GPArray<struct BaseCap>* capabilities;
|
const GPArray<struct BaseCap>* capabilities;
|
||||||
@@ -82,7 +82,7 @@ GPCapabilities::enumCap(CapID category) const
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GPCapabilities::isSupport(CapID category) const
|
GPCapabilities::IsSupport(CapID category) const
|
||||||
{
|
{
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -92,14 +92,14 @@ GPCapabilities::isSupport(CapID category) const
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return countCap(category) > 0;
|
return CountCap(category) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GPCapabilities::InitCapabilitiesFromGutenprint()
|
GPCapabilities::InitCapabilitiesFromGutenprint()
|
||||||
{
|
{
|
||||||
const GPData* data = dynamic_cast<const GPData*>(getPrinterData());
|
const GPData* data = dynamic_cast<const GPData*>(GetPrinterData());
|
||||||
ASSERT(data != NULL);
|
ASSERT(data != NULL);
|
||||||
// capabilities are available only after printer model
|
// capabilities are available only after printer model
|
||||||
// has been selected
|
// has been selected
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ public:
|
|||||||
GPCapabilities(const PrinterData* printer_data);
|
GPCapabilities(const PrinterData* printer_data);
|
||||||
~GPCapabilities();
|
~GPCapabilities();
|
||||||
|
|
||||||
virtual int countCap(CapID) const;
|
virtual int CountCap(CapID) const;
|
||||||
virtual bool isSupport(CapID) const;
|
virtual bool IsSupport(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CapID) const;
|
virtual const BaseCap **GetCaps(CapID) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitCapabilitiesFromGutenprint();
|
void InitCapabilitiesFromGutenprint();
|
||||||
|
|||||||
@@ -15,18 +15,18 @@
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GPData::load()
|
GPData::Load()
|
||||||
{
|
{
|
||||||
PrinterData::load();
|
PrinterData::Load();
|
||||||
fNode->ReadAttrString(PD_PRINTER_DRIVER_ATTRIBUTE,
|
fNode->ReadAttrString(PD_PRINTER_DRIVER_ATTRIBUTE,
|
||||||
&fGutenprintDriverName);
|
&fGutenprintDriverName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GPData::save()
|
GPData::Save()
|
||||||
{
|
{
|
||||||
PrinterData::save();
|
PrinterData::Save();
|
||||||
fNode->WriteAttrString(PD_PRINTER_DRIVER_ATTRIBUTE,
|
fNode->WriteAttrString(PD_PRINTER_DRIVER_ATTRIBUTE,
|
||||||
&fGutenprintDriverName);
|
&fGutenprintDriverName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PrinterData overrides
|
// PrinterData overrides
|
||||||
virtual void load();
|
virtual void Load();
|
||||||
virtual void save();
|
virtual void Save();
|
||||||
|
|
||||||
BString fGutenprintDriverName;
|
BString fGutenprintDriverName;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -51,21 +51,21 @@ GPDriver::StartDocument()
|
|||||||
fConfiguration.fDriver = data->fGutenprintDriverName;
|
fConfiguration.fDriver = data->fGutenprintDriverName;
|
||||||
|
|
||||||
SetParameter(fConfiguration.fPageSize, PrinterCap::kPaper,
|
SetParameter(fConfiguration.fPageSize, PrinterCap::kPaper,
|
||||||
GetJobData()->getPaper());
|
GetJobData()->GetPaper());
|
||||||
|
|
||||||
SetParameter(fConfiguration.fResolution, PrinterCap::kResolution,
|
SetParameter(fConfiguration.fResolution, PrinterCap::kResolution,
|
||||||
GetJobData()->getResolutionID());
|
GetJobData()->GetResolutionID());
|
||||||
|
|
||||||
fConfiguration.fXDPI = GetJobData()->getXres();
|
fConfiguration.fXDPI = GetJobData()->GetXres();
|
||||||
fConfiguration.fYDPI = GetJobData()->getYres();
|
fConfiguration.fYDPI = GetJobData()->GetYres();
|
||||||
|
|
||||||
SetParameter(fConfiguration.fInputSlot, PrinterCap::kPaperSource,
|
SetParameter(fConfiguration.fInputSlot, PrinterCap::kPaperSource,
|
||||||
GetJobData()->getPaperSource());
|
GetJobData()->GetPaperSource());
|
||||||
|
|
||||||
SetParameter(fConfiguration.fPrintingMode, PrinterCap::kColor,
|
SetParameter(fConfiguration.fPrintingMode, PrinterCap::kColor,
|
||||||
GetJobData()->getColor());
|
GetJobData()->GetColor());
|
||||||
|
|
||||||
if (GetPrinterCap()->isSupport(PrinterCap::kDriverSpecificCapabilities))
|
if (GetPrinterCap()->IsSupport(PrinterCap::kDriverSpecificCapabilities))
|
||||||
SetDriverSpecificSettings();
|
SetDriverSpecificSettings();
|
||||||
|
|
||||||
fprintf(stderr, "Driver: %s\n", fConfiguration.fDriver.String());
|
fprintf(stderr, "Driver: %s\n", fConfiguration.fDriver.String());
|
||||||
@@ -87,7 +87,7 @@ GPDriver::SetParameter(BString& parameter, PrinterCap::CapID category,
|
|||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
const EnumCap* capability;
|
const EnumCap* capability;
|
||||||
capability = GetPrinterCap()->findCap(category, value);
|
capability = GetPrinterCap()->FindCap(category, value);
|
||||||
if (capability != NULL && capability->fKey != "")
|
if (capability != NULL && capability->fKey != "")
|
||||||
parameter = capability->Key();
|
parameter = capability->Key();
|
||||||
}
|
}
|
||||||
@@ -97,8 +97,8 @@ void
|
|||||||
GPDriver::SetDriverSpecificSettings()
|
GPDriver::SetDriverSpecificSettings()
|
||||||
{
|
{
|
||||||
PrinterCap::CapID category = PrinterCap::kDriverSpecificCapabilities;
|
PrinterCap::CapID category = PrinterCap::kDriverSpecificCapabilities;
|
||||||
int count = GetPrinterCap()->countCap(category);
|
int count = GetPrinterCap()->CountCap(category);
|
||||||
const BaseCap** capabilities = GetPrinterCap()->enumCap(category);
|
const BaseCap** capabilities = GetPrinterCap()->GetCaps(category);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
const DriverSpecificCap* capability =
|
const DriverSpecificCap* capability =
|
||||||
dynamic_cast<const DriverSpecificCap*>(capabilities[i]);
|
dynamic_cast<const DriverSpecificCap*>(capabilities[i]);
|
||||||
@@ -137,13 +137,13 @@ GPDriver::AddDriverSpecificSetting(PrinterCap::CapID category, const char* key)
|
|||||||
if (GetJobData()->Settings().HasString(key))
|
if (GetJobData()->Settings().HasString(key))
|
||||||
{
|
{
|
||||||
const string& value = GetJobData()->Settings().GetString(key);
|
const string& value = GetJobData()->Settings().GetString(key);
|
||||||
capability = GetPrinterCap()->findCapWithKey(category, value.c_str());
|
capability = GetPrinterCap()->FindCapWithKey(category, value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (capability == NULL) {
|
if (capability == NULL) {
|
||||||
// job data should contain a value;
|
// job data should contain a value;
|
||||||
// try to use the default value anyway
|
// try to use the default value anyway
|
||||||
capability = GetPrinterCap()->getDefaultCap(category);
|
capability = GetPrinterCap()->GetDefaultCap(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (capability == NULL) {
|
if (capability == NULL) {
|
||||||
@@ -207,7 +207,7 @@ GPDriver::EndPage(int)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException& err) {
|
catch (TransportException& err) {
|
||||||
ShowError(err.what());
|
ShowError(err.What());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ GPDriver::EndDocument(bool)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException& err) {
|
catch (TransportException& err) {
|
||||||
ShowError(err.what());
|
ShowError(err.What());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -294,7 +294,7 @@ GPDriver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException& err) {
|
catch (TransportException& err) {
|
||||||
ShowError(err.what());
|
ShowError(err.What());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ SelectPrinterDialog::Save()
|
|||||||
{
|
{
|
||||||
BString driverName = GetSelectedItemValue(fPrintersListView);
|
BString driverName = GetSelectedItemValue(fPrintersListView);
|
||||||
fData->fGutenprintDriverName = driverName;
|
fData->fGutenprintDriverName = driverName;
|
||||||
fData->save();
|
fData->Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ PCL5Driver::StartDocument()
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
_JobStart();
|
_JobStart();
|
||||||
fHalftone = new Halftone(GetJobData()->getSurfaceType(),
|
fHalftone = new Halftone(GetJobData()->GetSurfaceType(),
|
||||||
GetJobData()->getGamma(), GetJobData()->getInkDensity(),
|
GetJobData()->GetGamma(), GetJobData()->GetInkDensity(),
|
||||||
GetJobData()->getDitherType());
|
GetJobData()->GetDitherType());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException& err) {
|
catch (TransportException& err) {
|
||||||
@@ -138,11 +138,11 @@ PCL5Driver::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(("renderobj->get_pixel_depth() = %d\n", fHalftone->getPixelDepth()));
|
DBGMSG(("renderobj->Get_pixel_depth() = %d\n", fHalftone->GetPixelDepth()));
|
||||||
|
|
||||||
uchar* ptr = static_cast<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 compressionMethod;
|
int compressionMethod;
|
||||||
int compressedSize;
|
int compressedSize;
|
||||||
@@ -159,19 +159,19 @@ PCL5Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
_Move(x, y);
|
_Move(x, y);
|
||||||
_StartRasterGraphics(width, height);
|
_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 num_planes = color ? 3 : 1;
|
||||||
|
|
||||||
if (color) {
|
if (color) {
|
||||||
fHalftone->setPlanes(Halftone::kPlaneRGB1);
|
fHalftone->SetPlanes(Halftone::kPlaneRGB1);
|
||||||
fHalftone->setBlackValue(Halftone::kLowValueMeansBlack);
|
fHalftone->SetBlackValue(Halftone::kLowValueMeansBlack);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = rc.top; i <= rc.bottom; i++) {
|
for (int i = rc.top; i <= rc.bottom; i++) {
|
||||||
|
|
||||||
for (int plane = 0; plane < num_planes; plane ++) {
|
for (int plane = 0; plane < num_planes; plane ++) {
|
||||||
|
|
||||||
fHalftone->dither(in_buffer, ptr, x, y, width);
|
fHalftone->Dither(in_buffer, ptr, x, y, width);
|
||||||
|
|
||||||
compressedSize = pack_bits(out_buffer, in_buffer, in_size);
|
compressedSize = pack_bits(out_buffer, in_buffer, in_size);
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ PCL5Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -222,15 +222,15 @@ PCL5Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
void
|
void
|
||||||
PCL5Driver::_JobStart()
|
PCL5Driver::_JobStart()
|
||||||
{
|
{
|
||||||
const bool color = GetJobData()->getColor() == JobData::kColor;
|
const bool color = GetJobData()->GetColor() == JobData::kColor;
|
||||||
// enter PCL5
|
// enter PCL5
|
||||||
WriteSpoolString("\033%%-12345X@PJL ENTER LANGUAGE=PCL\n");
|
WriteSpoolString("\033%%-12345X@PJL ENTER LANGUAGE=PCL\n");
|
||||||
// reset
|
// reset
|
||||||
WriteSpoolString("\033E");
|
WriteSpoolString("\033E");
|
||||||
// dpi
|
// dpi
|
||||||
WriteSpoolString("\033*t%dR", GetJobData()->getXres());
|
WriteSpoolString("\033*t%dR", GetJobData()->GetXres());
|
||||||
// unit of measure
|
// unit of measure
|
||||||
WriteSpoolString("\033&u%dD", GetJobData()->getXres());
|
WriteSpoolString("\033&u%dD", GetJobData()->GetXres());
|
||||||
// page size
|
// page size
|
||||||
WriteSpoolString("\033&l0A");
|
WriteSpoolString("\033&l0A");
|
||||||
// page orientation
|
// page orientation
|
||||||
@@ -246,7 +246,7 @@ PCL5Driver::_JobStart()
|
|||||||
// clear horizontal margins
|
// clear horizontal margins
|
||||||
WriteSpoolString("\0339");
|
WriteSpoolString("\0339");
|
||||||
// number of copies
|
// number of copies
|
||||||
// WriteSpoolString("\033&l%ldL", GetJobData()->getCopies());
|
// WriteSpoolString("\033&l%ldL", GetJobData()->GetCopies());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ PCL5Cap::PCL5Cap(const PrinterData* printer_data)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PCL5Cap::countCap(CapID capid) const
|
PCL5Cap::CountCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -127,7 +127,7 @@ PCL5Cap::countCap(CapID capid) const
|
|||||||
|
|
||||||
|
|
||||||
const BaseCap**
|
const BaseCap**
|
||||||
PCL5Cap::enumCap(CapID capid) const
|
PCL5Cap::GetCaps(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -145,7 +145,7 @@ PCL5Cap::enumCap(CapID capid) const
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PCL5Cap::isSupport(CapID capid) const
|
PCL5Cap::IsSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
class PCL5Cap : public PrinterCap {
|
class PCL5Cap : public PrinterCap {
|
||||||
public:
|
public:
|
||||||
PCL5Cap(const PrinterData* printer_data);
|
PCL5Cap(const PrinterData* printer_data);
|
||||||
virtual int countCap(CapID) const;
|
virtual int CountCap(CapID) const;
|
||||||
virtual bool isSupport(CapID) const;
|
virtual bool IsSupport(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CapID) const;
|
virtual const BaseCap **GetCaps(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __PCL5CAP_H
|
#endif // __PCL5CAP_H
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ PCL6Driver::StartDocument()
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
_JobStart();
|
_JobStart();
|
||||||
fHalftone = new Halftone(GetJobData()->getSurfaceType(),
|
fHalftone = new Halftone(GetJobData()->GetSurfaceType(),
|
||||||
GetJobData()->getGamma(), GetJobData()->getInkDensity(),
|
GetJobData()->GetGamma(), GetJobData()->GetInkDensity(),
|
||||||
GetJobData()->getDitherType());
|
GetJobData()->GetDitherType());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException& err) {
|
catch (TransportException& err) {
|
||||||
@@ -175,7 +175,7 @@ PCL6Driver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -240,9 +240,9 @@ PCL6Driver::_JobStart()
|
|||||||
fWriter = new PCL6Writer(this);
|
fWriter = new PCL6Writer(this);
|
||||||
PCL6Writer::ProtocolClass pc =
|
PCL6Writer::ProtocolClass pc =
|
||||||
(PCL6Writer::ProtocolClass)GetProtocolClass();
|
(PCL6Writer::ProtocolClass)GetProtocolClass();
|
||||||
fWriter->PJLHeader(pc, GetJobData()->getXres(),
|
fWriter->PJLHeader(pc, GetJobData()->GetXres(),
|
||||||
"Copyright (c) 2003 - 2010 Haiku");
|
"Copyright (c) 2003 - 2010 Haiku");
|
||||||
fWriter->BeginSession(GetJobData()->getXres(), GetJobData()->getYres(),
|
fWriter->BeginSession(GetJobData()->GetXres(), GetJobData()->GetYres(),
|
||||||
PCL6Writer::kInch, PCL6Writer::kBackChAndErrPage);
|
PCL6Writer::kInch, PCL6Writer::kBackChAndErrPage);
|
||||||
fWriter->OpenDataSource();
|
fWriter->OpenDataSource();
|
||||||
fMediaSide = PCL6Writer::kFrontMediaSide;
|
fMediaSide = PCL6Writer::kFrontMediaSide;
|
||||||
@@ -253,17 +253,17 @@ bool
|
|||||||
PCL6Driver::StartPage(int)
|
PCL6Driver::StartPage(int)
|
||||||
{
|
{
|
||||||
PCL6Writer::Orientation orientation = PCL6Writer::kPortrait;
|
PCL6Writer::Orientation orientation = PCL6Writer::kPortrait;
|
||||||
if (GetJobData()->getOrientation() == JobData::kLandscape) {
|
if (GetJobData()->GetOrientation() == JobData::kLandscape) {
|
||||||
orientation = PCL6Writer::kLandscape;
|
orientation = PCL6Writer::kLandscape;
|
||||||
}
|
}
|
||||||
|
|
||||||
PCL6Writer::MediaSize mediaSize =
|
PCL6Writer::MediaSize mediaSize =
|
||||||
_MediaSize(GetJobData()->getPaper());
|
_MediaSize(GetJobData()->GetPaper());
|
||||||
PCL6Writer::MediaSource mediaSource =
|
PCL6Writer::MediaSource mediaSource =
|
||||||
_MediaSource(GetJobData()->getPaperSource());
|
_MediaSource(GetJobData()->GetPaperSource());
|
||||||
if (GetJobData()->getPrintStyle() == JobData::kSimplex) {
|
if (GetJobData()->GetPrintStyle() == JobData::kSimplex) {
|
||||||
fWriter->BeginPage(orientation, mediaSize, mediaSource);
|
fWriter->BeginPage(orientation, mediaSize, mediaSource);
|
||||||
} else if (GetJobData()->getPrintStyle() == JobData::kDuplex) {
|
} else if (GetJobData()->GetPrintStyle() == JobData::kDuplex) {
|
||||||
// TODO move duplex binding option to UI
|
// TODO move duplex binding option to UI
|
||||||
fWriter->BeginPage(orientation, mediaSize, mediaSource,
|
fWriter->BeginPage(orientation, mediaSize, mediaSource,
|
||||||
PCL6Writer::kDuplexVerticalBinding, fMediaSide);
|
PCL6Writer::kDuplexVerticalBinding, fMediaSide);
|
||||||
@@ -276,8 +276,8 @@ PCL6Driver::StartPage(int)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// PageOrigin from Windows NT printer driver
|
// PageOrigin from Windows NT printer driver
|
||||||
int x = 142 * GetJobData()->getXres() / 600;
|
int x = 142 * GetJobData()->GetXres() / 600;
|
||||||
int y = 100 * GetJobData()->getYres() / 600;
|
int y = 100 * GetJobData()->GetYres() / 600;
|
||||||
fWriter->SetPageOrigin(x, y);
|
fWriter->SetPageOrigin(x, y);
|
||||||
fWriter->SetColorSpace(_UseColorMode() ? PCL6Writer::kRGB
|
fWriter->SetColorSpace(_UseColorMode() ? PCL6Writer::kRGB
|
||||||
: PCL6Writer::kGray);
|
: PCL6Writer::kGray);
|
||||||
@@ -363,7 +363,7 @@ bool
|
|||||||
PCL6Driver::EndPage(int)
|
PCL6Driver::EndPage(int)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
fWriter->EndPage(GetJobData()->getCopies());
|
fWriter->EndPage(GetJobData()->GetCopies());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException& err) {
|
catch (TransportException& err) {
|
||||||
@@ -394,7 +394,7 @@ PCL6Driver::_Move(int x, int y)
|
|||||||
bool
|
bool
|
||||||
PCL6Driver::_SupportsRLECompression()
|
PCL6Driver::_SupportsRLECompression()
|
||||||
{
|
{
|
||||||
return GetJobData()->getColor() != JobData::kColorCompressionDisabled;
|
return GetJobData()->GetColor() != JobData::kColorCompressionDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -402,14 +402,14 @@ bool
|
|||||||
PCL6Driver::_SupportsDeltaRowCompression()
|
PCL6Driver::_SupportsDeltaRowCompression()
|
||||||
{
|
{
|
||||||
return GetProtocolClass() >= PCL6Writer::kProtocolClass2_1
|
return GetProtocolClass() >= PCL6Writer::kProtocolClass2_1
|
||||||
&& GetJobData()->getColor() != JobData::kColorCompressionDisabled;
|
&& GetJobData()->GetColor() != JobData::kColorCompressionDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PCL6Driver::_UseColorMode()
|
PCL6Driver::_UseColorMode()
|
||||||
{
|
{
|
||||||
return GetJobData()->getColor() != JobData::kMonochrome;
|
return GetJobData()->GetColor() != JobData::kMonochrome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -273,15 +273,15 @@ PCL6Cap::PCL6Cap(const PrinterData* printer_data)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PCL6Cap::countCap(CapID capid) const
|
PCL6Cap::CountCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
if (getProtocolClass() >= PCL6Writer::kProtocolClass2_1)
|
if (GetProtocolClass() >= PCL6Writer::kProtocolClass2_1)
|
||||||
return sizeof(papers2_1) / sizeof(papers2_1[0]);
|
return sizeof(papers2_1) / sizeof(papers2_1[0]);
|
||||||
return sizeof(papers1_1) / sizeof(papers1_1[0]);
|
return sizeof(papers1_1) / sizeof(papers1_1[0]);
|
||||||
case kPaperSource:
|
case kPaperSource:
|
||||||
if (getProtocolClass() >= PCL6Writer::kProtocolClass2_0)
|
if (GetProtocolClass() >= PCL6Writer::kProtocolClass2_0)
|
||||||
return sizeof(paperSources2_0) / sizeof(paperSources2_0[0]);
|
return sizeof(paperSources2_0) / sizeof(paperSources2_0[0]);
|
||||||
return sizeof(paperSources1_1) / sizeof(paperSources1_1[0]);
|
return sizeof(paperSources1_1) / sizeof(paperSources1_1[0]);
|
||||||
case kResolution:
|
case kResolution:
|
||||||
@@ -299,15 +299,15 @@ PCL6Cap::countCap(CapID capid) const
|
|||||||
|
|
||||||
|
|
||||||
const BaseCap**
|
const BaseCap**
|
||||||
PCL6Cap::enumCap(CapID capid) const
|
PCL6Cap::GetCaps(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
if (getProtocolClass() >= PCL6Writer::kProtocolClass2_1)
|
if (GetProtocolClass() >= PCL6Writer::kProtocolClass2_1)
|
||||||
return (const BaseCap **)papers2_1;
|
return (const BaseCap **)papers2_1;
|
||||||
return (const BaseCap**)papers1_1;
|
return (const BaseCap**)papers1_1;
|
||||||
case kPaperSource:
|
case kPaperSource:
|
||||||
if (getProtocolClass() >= PCL6Writer::kProtocolClass2_0)
|
if (GetProtocolClass() >= PCL6Writer::kProtocolClass2_0)
|
||||||
return (const BaseCap **)paperSources2_0;
|
return (const BaseCap **)paperSources2_0;
|
||||||
return (const BaseCap**)paperSources1_1;
|
return (const BaseCap**)paperSources1_1;
|
||||||
case kResolution:
|
case kResolution:
|
||||||
@@ -325,7 +325,7 @@ PCL6Cap::enumCap(CapID capid) const
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PCL6Cap::isSupport(CapID capid) const
|
PCL6Cap::IsSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
class PCL6Cap : public PrinterCap {
|
class PCL6Cap : public PrinterCap {
|
||||||
public:
|
public:
|
||||||
PCL6Cap(const PrinterData* printer_data);
|
PCL6Cap(const PrinterData* printer_data);
|
||||||
virtual int countCap(CapID) const;
|
virtual int CountCap(CapID) const;
|
||||||
virtual bool isSupport(CapID) const;
|
virtual bool IsSupport(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CapID) const;
|
virtual const BaseCap **GetCaps(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __PCL6CAP_H
|
#endif // __PCL6CAP_H
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const void*
|
|||||||
MonochromeRasterizer::RasterizeLine(int x, int y,
|
MonochromeRasterizer::RasterizeLine(int x, int y,
|
||||||
const ColorRGB32Little* source)
|
const ColorRGB32Little* source)
|
||||||
{
|
{
|
||||||
GetHalftone()->dither(fCurrentLine, (const uchar*)source, x, y, GetWidth());
|
GetHalftone()->Dither(fCurrentLine, (const uchar*)source, x, y, GetWidth());
|
||||||
|
|
||||||
uchar* out = fCurrentLine;
|
uchar* out = fCurrentLine;
|
||||||
|
|
||||||
@@ -127,8 +127,8 @@ ColorRasterizer::ColorRasterizer::ColorRasterizer(Halftone* halftone)
|
|||||||
for (int plane = 0; plane < 3; plane ++)
|
for (int plane = 0; plane < 3; plane ++)
|
||||||
fPlaneBuffers[plane] = NULL;
|
fPlaneBuffers[plane] = NULL;
|
||||||
|
|
||||||
halftone->setPlanes(Halftone::kPlaneRGB1);
|
halftone->SetPlanes(Halftone::kPlaneRGB1);
|
||||||
halftone->setBlackValue(Halftone::kLowValueMeansBlack);
|
halftone->SetBlackValue(Halftone::kLowValueMeansBlack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ ColorRasterizer::RasterizeLine(int x, int y, const ColorRGB32Little* source)
|
|||||||
|
|
||||||
// dither each color component
|
// dither each color component
|
||||||
for (int plane = 0; plane < 3; plane ++)
|
for (int plane = 0; plane < 3; plane ++)
|
||||||
GetHalftone()->dither(fPlaneBuffers[plane], (const uchar*)source, x, y,
|
GetHalftone()->Dither(fPlaneBuffers[plane], (const uchar*)source, x, y,
|
||||||
GetWidth());
|
GetWidth());
|
||||||
|
|
||||||
DUMP_BITS((stderr, "red "), fPlaneBuffers[0], fPlaneBufferSize);
|
DUMP_BITS((stderr, "red "), fPlaneBuffers[0], fPlaneBufferSize);
|
||||||
|
|||||||
@@ -113,9 +113,9 @@ PSDriver::StartDocument()
|
|||||||
_StartFilterIfNeeded();
|
_StartFilterIfNeeded();
|
||||||
|
|
||||||
_JobStart();
|
_JobStart();
|
||||||
fHalftone = new Halftone(GetJobData()->getSurfaceType(),
|
fHalftone = new Halftone(GetJobData()->GetSurfaceType(),
|
||||||
GetJobData()->getGamma(), GetJobData()->getInkDensity(),
|
GetJobData()->GetGamma(), GetJobData()->GetInkDensity(),
|
||||||
GetJobData()->getDitherType());
|
GetJobData()->GetDitherType());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (TransportException& err) {
|
catch (TransportException& err) {
|
||||||
@@ -156,13 +156,13 @@ PSDriver::EndPage(int)
|
|||||||
void
|
void
|
||||||
PSDriver::_SetupCTM()
|
PSDriver::_SetupCTM()
|
||||||
{
|
{
|
||||||
const float leftMargin = GetJobData()->getPrintableRect().left;
|
const float leftMargin = GetJobData()->GetPrintableRect().left;
|
||||||
const float topMargin = GetJobData()->getPrintableRect().top;
|
const float topMargin = GetJobData()->GetPrintableRect().top;
|
||||||
if (GetJobData()->getOrientation() == JobData::kPortrait) {
|
if (GetJobData()->GetOrientation() == JobData::kPortrait) {
|
||||||
// move origin from bottom left to top left
|
// move origin from bottom left to top left
|
||||||
// and set margin
|
// and set margin
|
||||||
_WritePSString("%f %f translate\n", leftMargin,
|
_WritePSString("%f %f translate\n", leftMargin,
|
||||||
GetJobData()->getPaperRect().Height()-topMargin);
|
GetJobData()->GetPaperRect().Height()-topMargin);
|
||||||
} else {
|
} else {
|
||||||
// landscape:
|
// landscape:
|
||||||
// move origin from bottom left to margin top and left
|
// move origin from bottom left to margin top and left
|
||||||
@@ -172,8 +172,8 @@ PSDriver::_SetupCTM()
|
|||||||
}
|
}
|
||||||
// y values increase from top to bottom
|
// y values increase from top to bottom
|
||||||
// units of measure is dpi
|
// units of measure is dpi
|
||||||
_WritePSString("72 %d div 72 -%d div scale\n", GetJobData()->getXres(),
|
_WritePSString("72 %d div 72 -%d div scale\n", GetJobData()->GetXres(),
|
||||||
GetJobData()->getYres());
|
GetJobData()->GetYres());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ PSDriver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
x = rc.left;
|
x = rc.left;
|
||||||
y += rc.top;
|
y += rc.top;
|
||||||
|
|
||||||
bool color = GetJobData()->getColor() == JobData::kColor;
|
bool color = GetJobData()->GetColor() == JobData::kColor;
|
||||||
int width = rc.right - rc.left + 1;
|
int width = rc.right - rc.left + 1;
|
||||||
int widthByte = (width + 7) / 8;
|
int widthByte = (width + 7) / 8;
|
||||||
// byte boundary
|
// byte boundary
|
||||||
@@ -255,12 +255,12 @@ PSDriver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
DBGMSG(("height = %d\n", height));
|
DBGMSG(("height = %d\n", height));
|
||||||
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(("renderobj->get_pixel_depth() = %d\n",
|
DBGMSG(("renderobj->Get_pixel_depth() = %d\n",
|
||||||
fHalftone->getPixelDepth()));
|
fHalftone->GetPixelDepth()));
|
||||||
|
|
||||||
uchar* ptr = static_cast<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;
|
||||||
@@ -293,7 +293,7 @@ PSDriver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
in += 4;
|
in += 4;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fHalftone->dither(in_buffer, ptr, x, y, width);
|
fHalftone->Dither(in_buffer, ptr, x, y, width);
|
||||||
|
|
||||||
uchar* in = in_buffer;
|
uchar* in = in_buffer;
|
||||||
uchar* out = out_buffer;
|
uchar* out = out_buffer;
|
||||||
@@ -335,7 +335,7 @@ PSDriver::NextBand(BBitmap* bitmap, BPoint* offset)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -349,14 +349,14 @@ PSDriver::_JobStart()
|
|||||||
_WritePSString("%%!PS-Adobe-3.0\n");
|
_WritePSString("%%!PS-Adobe-3.0\n");
|
||||||
_WritePSString("%%%%LanguageLevel: 1\n");
|
_WritePSString("%%%%LanguageLevel: 1\n");
|
||||||
_WritePSString("%%%%Title: %s\n",
|
_WritePSString("%%%%Title: %s\n",
|
||||||
GetSpoolMetaData()->getDescription().c_str());
|
GetSpoolMetaData()->GetDescription().c_str());
|
||||||
_WritePSString("%%%%Creator: %s\n",
|
_WritePSString("%%%%Creator: %s\n",
|
||||||
GetSpoolMetaData()->getMimeType().c_str());
|
GetSpoolMetaData()->GetMimeType().c_str());
|
||||||
_WritePSString("%%%%CreationDate: %s",
|
_WritePSString("%%%%CreationDate: %s",
|
||||||
GetSpoolMetaData()->getCreationTime().c_str());
|
GetSpoolMetaData()->GetCreationTime().c_str());
|
||||||
_WritePSString("%%%%DocumentMedia: Plain %d %d white 0 ( )\n",
|
_WritePSString("%%%%DocumentMedia: Plain %d %d white 0 ( )\n",
|
||||||
GetJobData()->getPaperRect().IntegerWidth(),
|
GetJobData()->GetPaperRect().IntegerWidth(),
|
||||||
GetJobData()->getPaperRect().IntegerHeight());
|
GetJobData()->GetPaperRect().IntegerHeight());
|
||||||
_WritePSString("%%%%Pages: (atend)\n");
|
_WritePSString("%%%%Pages: (atend)\n");
|
||||||
_WritePSString("%%%%EndComments\n");
|
_WritePSString("%%%%EndComments\n");
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ void
|
|||||||
PSDriver::_StartRasterGraphics(int x, int y, int width, int height,
|
PSDriver::_StartRasterGraphics(int x, int y, int width, int height,
|
||||||
int widthByte)
|
int widthByte)
|
||||||
{
|
{
|
||||||
bool color = GetJobData()->getColor() == JobData::kColor;
|
bool color = GetJobData()->GetColor() == JobData::kColor;
|
||||||
fCompressionMethod = -1;
|
fCompressionMethod = -1;
|
||||||
_WritePSString("gsave\n");
|
_WritePSString("gsave\n");
|
||||||
_WritePSString("/s %d string def\n", widthByte);
|
_WritePSString("/s %d string def\n", widthByte);
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ PSCap::PSCap(const PrinterData* printer_data)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PSCap::countCap(CapID capid) const
|
PSCap::CountCap(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -126,7 +126,7 @@ PSCap::countCap(CapID capid) const
|
|||||||
|
|
||||||
|
|
||||||
const BaseCap**
|
const BaseCap**
|
||||||
PSCap::enumCap(CapID capid) const
|
PSCap::GetCaps(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
@@ -144,7 +144,7 @@ PSCap::enumCap(CapID capid) const
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PSCap::isSupport(CapID capid) const
|
PSCap::IsSupport(CapID capid) const
|
||||||
{
|
{
|
||||||
switch (capid) {
|
switch (capid) {
|
||||||
case kPaper:
|
case kPaper:
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
class PSCap : public PrinterCap {
|
class PSCap : public PrinterCap {
|
||||||
public:
|
public:
|
||||||
PSCap(const PrinterData* printer_data);
|
PSCap(const PrinterData* printer_data);
|
||||||
virtual int countCap(CapID) const;
|
virtual int CountCap(CapID) const;
|
||||||
virtual bool isSupport(CapID) const;
|
virtual bool IsSupport(CapID) const;
|
||||||
virtual const BaseCap **enumCap(CapID) const;
|
virtual const BaseCap **GetCaps(CapID) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __PSCAP_H
|
#endif // __PSCAP_H
|
||||||
|
|||||||
@@ -15,16 +15,16 @@
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PSData::load()
|
PSData::Load()
|
||||||
{
|
{
|
||||||
PrinterData::load();
|
PrinterData::Load();
|
||||||
fNode->ReadAttrString(PD_PPD_PATH, &fPPD);
|
fNode->ReadAttrString(PD_PPD_PATH, &fPPD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PSData::save()
|
PSData::Save()
|
||||||
{
|
{
|
||||||
PrinterData::save();
|
PrinterData::Save();
|
||||||
fNode->WriteAttrString(PD_PPD_PATH, &fPPD);
|
fNode->WriteAttrString(PD_PPD_PATH, &fPPD);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PrinterData overrides
|
// PrinterData overrides
|
||||||
virtual void load();
|
virtual void Load();
|
||||||
virtual void save();
|
virtual void Save();
|
||||||
|
|
||||||
BString fPPD;
|
BString fPPD;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ SelectPPDDlg::Save()
|
|||||||
(fPrintersListView->ItemAt(idx))->fPPDPath;
|
(fPrintersListView->ItemAt(idx))->fPPDPath;
|
||||||
|
|
||||||
fPSData->fPPD = ppdPath;
|
fPSData->fPPD = ppdPath;
|
||||||
fPSData->save();
|
fPSData->Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ ProtocolClassItem::ProtocolClassItem(const ProtocolClassCap* cap)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ProtocolClassItem::getProtocolClass()
|
ProtocolClassItem::GetProtocolClass() const
|
||||||
{
|
{
|
||||||
return fProtocolClassCap->fProtocolClass;
|
return fProtocolClassCap->fProtocolClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
ProtocolClassItem::getDescription()
|
ProtocolClassItem::GetDescription() const
|
||||||
{
|
{
|
||||||
return fProtocolClassCap->fDescription.c_str();
|
return fProtocolClassCap->fDescription.c_str();
|
||||||
}
|
}
|
||||||
@@ -71,9 +71,9 @@ AddPrinterView::AttachedToWindow()
|
|||||||
|
|
||||||
protocolClassBox->AddChild(protocolClassScroller);
|
protocolClassBox->AddChild(protocolClassScroller);
|
||||||
|
|
||||||
int count = fPrinterCap->countCap(PrinterCap::kProtocolClass);
|
int count = fPrinterCap->CountCap(PrinterCap::kProtocolClass);
|
||||||
ProtocolClassCap **protocolClasses =
|
ProtocolClassCap **protocolClasses =
|
||||||
(ProtocolClassCap **)fPrinterCap->enumCap(PrinterCap::kProtocolClass);
|
(ProtocolClassCap **)fPrinterCap->GetCaps(PrinterCap::kProtocolClass);
|
||||||
while (count--) {
|
while (count--) {
|
||||||
const ProtocolClassCap *protocolClass = *protocolClasses;
|
const ProtocolClassCap *protocolClass = *protocolClasses;
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ AddPrinterView::MessageReceived(BMessage* msg)
|
|||||||
if (msg->what == kMsgProtocolClassChanged) {
|
if (msg->what == kMsgProtocolClassChanged) {
|
||||||
ProtocolClassItem *item = CurrentSelection();
|
ProtocolClassItem *item = CurrentSelection();
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
fDescription->SetText(item->getDescription());
|
fDescription->SetText(item->GetDescription());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BView::MessageReceived(msg);
|
BView::MessageReceived(msg);
|
||||||
@@ -165,8 +165,8 @@ AddPrinterView::Save()
|
|||||||
{
|
{
|
||||||
ProtocolClassItem* item = CurrentSelection();
|
ProtocolClassItem* item = CurrentSelection();
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
fPrinterData->setProtocolClass(item->getProtocolClass());
|
fPrinterData->SetProtocolClass(item->GetProtocolClass());
|
||||||
fPrinterData->save();
|
fPrinterData->Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,30 +115,30 @@ GraphicsDriver::_SetupData(BFile* spoolFile)
|
|||||||
|
|
||||||
fRealJobData = new JobData(*fOrgJobData);
|
fRealJobData = new JobData(*fOrgJobData);
|
||||||
|
|
||||||
switch (fOrgJobData->getNup()) {
|
switch (fOrgJobData->GetNup()) {
|
||||||
case 2:
|
case 2:
|
||||||
case 8:
|
case 8:
|
||||||
case 32:
|
case 32:
|
||||||
case 128:
|
case 128:
|
||||||
fRealJobData->setPrintableRect(
|
fRealJobData->SetPrintableRect(
|
||||||
RotateRect(fOrgJobData->getPrintableRect()));
|
RotateRect(fOrgJobData->GetPrintableRect()));
|
||||||
fRealJobData->setScaledPrintableRect(
|
fRealJobData->SetScaledPrintableRect(
|
||||||
RotateRect(fOrgJobData->getScaledPrintableRect()));
|
RotateRect(fOrgJobData->GetScaledPrintableRect()));
|
||||||
fRealJobData->setPhysicalRect(
|
fRealJobData->SetPhysicalRect(
|
||||||
RotateRect(fOrgJobData->getPhysicalRect()));
|
RotateRect(fOrgJobData->GetPhysicalRect()));
|
||||||
fRealJobData->setScaledPhysicalRect(
|
fRealJobData->SetScaledPhysicalRect(
|
||||||
RotateRect(fOrgJobData->getScaledPhysicalRect()));
|
RotateRect(fOrgJobData->GetScaledPhysicalRect()));
|
||||||
|
|
||||||
if (JobData::kPortrait == fOrgJobData->getOrientation())
|
if (JobData::kPortrait == fOrgJobData->GetOrientation())
|
||||||
fRealJobData->setOrientation(JobData::kLandscape);
|
fRealJobData->SetOrientation(JobData::kLandscape);
|
||||||
else
|
else
|
||||||
fRealJobData->setOrientation(JobData::kPortrait);
|
fRealJobData->SetOrientation(JobData::kPortrait);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fOrgJobData->getCollate() && fPageCount > 1) {
|
if (fOrgJobData->GetCollate() && fPageCount > 1) {
|
||||||
fRealJobData->setCopies(1);
|
fRealJobData->SetCopies(1);
|
||||||
fInternalCopies = fOrgJobData->getCopies();
|
fInternalCopies = fOrgJobData->GetCopies();
|
||||||
} else {
|
} else {
|
||||||
fInternalCopies = 1;
|
fInternalCopies = 1;
|
||||||
}
|
}
|
||||||
@@ -163,12 +163,12 @@ GraphicsDriver::_CleanupData()
|
|||||||
void
|
void
|
||||||
GraphicsDriver::_SetupBitmap()
|
GraphicsDriver::_SetupBitmap()
|
||||||
{
|
{
|
||||||
fPixelDepth = color_space2pixel_depth(fOrgJobData->getSurfaceType());
|
fPixelDepth = color_space2pixel_depth(fOrgJobData->GetSurfaceType());
|
||||||
|
|
||||||
fPageWidth = (fRealJobData->getPhysicalRect().IntegerWidth()
|
fPageWidth = (fRealJobData->GetPhysicalRect().IntegerWidth()
|
||||||
* fOrgJobData->getXres() + 71) / 72;
|
* fOrgJobData->GetXres() + 71) / 72;
|
||||||
fPageHeight = (fRealJobData->getPhysicalRect().IntegerHeight()
|
fPageHeight = (fRealJobData->GetPhysicalRect().IntegerHeight()
|
||||||
* fOrgJobData->getYres() + 71) / 72;
|
* fOrgJobData->GetYres() + 71) / 72;
|
||||||
|
|
||||||
int widthByte = (fPageWidth * fPixelDepth + 7) / 8;
|
int widthByte = (fPageWidth * fPixelDepth + 7) / 8;
|
||||||
int size = widthByte * fPageHeight;
|
int size = widthByte * fPageHeight;
|
||||||
@@ -182,7 +182,7 @@ GraphicsDriver::_SetupBitmap()
|
|||||||
fBandHeight = fPageHeight;
|
fBandHeight = fPageHeight;
|
||||||
} else {
|
} else {
|
||||||
fBandCount = (size + kMaxMemorySize - 1) / kMaxMemorySize;
|
fBandCount = (size + kMaxMemorySize - 1) / kMaxMemorySize;
|
||||||
if ((JobData::kLandscape == fRealJobData->getOrientation())
|
if ((JobData::kLandscape == fRealJobData->GetOrientation())
|
||||||
&& (fFlags & kGDFRotateBandBitmap)) {
|
&& (fFlags & kGDFRotateBandBitmap)) {
|
||||||
fBandWidth = (fPageWidth + fBandCount - 1) / fBandCount;
|
fBandWidth = (fPageWidth + fBandCount - 1) / fBandCount;
|
||||||
fBandHeight = fPageHeight;
|
fBandHeight = fPageHeight;
|
||||||
@@ -201,7 +201,7 @@ GraphicsDriver::_SetupBitmap()
|
|||||||
|
|
||||||
BRect rect;
|
BRect rect;
|
||||||
rect.Set(0, 0, fBandWidth - 1, fBandHeight - 1);
|
rect.Set(0, 0, fBandWidth - 1, fBandHeight - 1);
|
||||||
fBitmap = new BBitmap(rect, fOrgJobData->getSurfaceType(), true);
|
fBitmap = new BBitmap(rect, fOrgJobData->GetSurfaceType(), true);
|
||||||
fView = new BView(rect, "", B_FOLLOW_ALL, B_WILL_DRAW);
|
fView = new BView(rect, "", B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
fBitmap->AddChild(fView);
|
fBitmap->AddChild(fView);
|
||||||
}
|
}
|
||||||
@@ -419,9 +419,9 @@ GraphicsDriver::_PrintPage(PageDataList* pages)
|
|||||||
fView->ConstrainClippingRegion(NULL);
|
fView->ConstrainClippingRegion(NULL);
|
||||||
fView->FillRect(fView->Bounds());
|
fView->FillRect(fView->Bounds());
|
||||||
|
|
||||||
BPoint scale = GetScale(fOrgJobData->getNup(),
|
BPoint scale = GetScale(fOrgJobData->GetNup(),
|
||||||
fOrgJobData->getPhysicalRect(), fOrgJobData->getScaling());
|
fOrgJobData->GetPhysicalRect(), fOrgJobData->GetScaling());
|
||||||
float real_scale = min(scale.x, scale.y) * fOrgJobData->getXres()
|
float real_scale = min(scale.x, scale.y) * fOrgJobData->GetXres()
|
||||||
/ 72.0f;
|
/ 72.0f;
|
||||||
fView->SetScale(real_scale);
|
fView->SetScale(real_scale);
|
||||||
float x = offset.x / real_scale;
|
float x = offset.x / real_scale;
|
||||||
@@ -430,16 +430,16 @@ GraphicsDriver::_PrintPage(PageDataList* pages)
|
|||||||
|
|
||||||
for (PageDataList::iterator it = pages->begin(); it != pages->end();
|
for (PageDataList::iterator it = pages->begin(); it != pages->end();
|
||||||
it++) {
|
it++) {
|
||||||
BPoint left_top(GetOffset(fOrgJobData->getNup(), page_index++,
|
BPoint left_top(GetOffset(fOrgJobData->GetNup(), page_index++,
|
||||||
fOrgJobData->getOrientation(), &scale,
|
fOrgJobData->GetOrientation(), &scale,
|
||||||
fOrgJobData->getScaledPhysicalRect(),
|
fOrgJobData->GetScaledPhysicalRect(),
|
||||||
fOrgJobData->getScaledPrintableRect(),
|
fOrgJobData->GetScaledPrintableRect(),
|
||||||
fOrgJobData->getPhysicalRect()));
|
fOrgJobData->GetPhysicalRect()));
|
||||||
|
|
||||||
left_top.x -= x;
|
left_top.x -= x;
|
||||||
left_top.y -= y;
|
left_top.y -= y;
|
||||||
|
|
||||||
BRect clip(fOrgJobData->getScaledPrintableRect());
|
BRect clip(fOrgJobData->GetScaledPrintableRect());
|
||||||
clip.OffsetTo(left_top);
|
clip.OffsetTo(left_top);
|
||||||
|
|
||||||
BRegion *region = new BRegion();
|
BRegion *region = new BRegion();
|
||||||
@@ -474,7 +474,7 @@ GraphicsDriver::_CollectPages(SpoolData* spoolData, PageDataList* pages)
|
|||||||
{
|
{
|
||||||
// collect the pages to be printed on the physical page
|
// collect the pages to be printed on the physical page
|
||||||
PageData *page_data;
|
PageData *page_data;
|
||||||
int nup = fOrgJobData->getNup();
|
int nup = fOrgJobData->GetNup();
|
||||||
bool more;
|
bool more;
|
||||||
do {
|
do {
|
||||||
more = spoolData->enumObject(&page_data);
|
more = spoolData->enumObject(&page_data);
|
||||||
@@ -506,25 +506,25 @@ GraphicsDriver::_PrintDocument(SpoolData* spoolData)
|
|||||||
success = true;
|
success = true;
|
||||||
page_index = 0;
|
page_index = 0;
|
||||||
|
|
||||||
if (fPrinterCap->isSupport(PrinterCap::kCopyCommand))
|
if (fPrinterCap->IsSupport(PrinterCap::kCopyCommand))
|
||||||
// let the printer perform the copy operation
|
// let the printer perform the copy operation
|
||||||
copies = 1;
|
copies = 1;
|
||||||
else
|
else
|
||||||
// send the page multiple times to the printer
|
// send the page multiple times to the printer
|
||||||
copies = fRealJobData->getCopies();
|
copies = fRealJobData->GetCopies();
|
||||||
|
|
||||||
fStatusWindow -> SetPageCopies(copies);
|
fStatusWindow -> SetPageCopies(copies);
|
||||||
// inform fStatusWindow about number of copies
|
// inform fStatusWindow about number of copies
|
||||||
|
|
||||||
// printing of even/odd numbered pages only is valid in simplex mode
|
// printing of even/odd numbered pages only is valid in simplex mode
|
||||||
bool simplex = fRealJobData->getPrintStyle() == JobData::kSimplex;
|
bool simplex = fRealJobData->GetPrintStyle() == JobData::kSimplex;
|
||||||
|
|
||||||
if (spoolData->startEnum()) {
|
if (spoolData->startEnum()) {
|
||||||
do {
|
do {
|
||||||
DBGMSG(("page index = %d\n", page_index));
|
DBGMSG(("page index = %d\n", page_index));
|
||||||
|
|
||||||
if (simplex
|
if (simplex
|
||||||
&& fRealJobData->getPageSelection()
|
&& fRealJobData->GetPageSelection()
|
||||||
== JobData::kEvenNumberedPages)
|
== JobData::kEvenNumberedPages)
|
||||||
// skip odd numbered page
|
// skip odd numbered page
|
||||||
more = _SkipPages(spoolData);
|
more = _SkipPages(spoolData);
|
||||||
@@ -537,7 +537,7 @@ GraphicsDriver::_PrintDocument(SpoolData* spoolData)
|
|||||||
more = _CollectPages(spoolData, &pages);
|
more = _CollectPages(spoolData, &pages);
|
||||||
|
|
||||||
if (more && simplex
|
if (more && simplex
|
||||||
&& fRealJobData->getPageSelection()
|
&& fRealJobData->GetPageSelection()
|
||||||
== JobData::kOddNumberedPages)
|
== JobData::kOddNumberedPages)
|
||||||
// skip even numbered page
|
// skip even numbered page
|
||||||
more = _SkipPages(spoolData);
|
more = _SkipPages(spoolData);
|
||||||
@@ -569,9 +569,9 @@ GraphicsDriver::_PrintDocument(SpoolData* spoolData)
|
|||||||
|
|
||||||
#ifndef USE_PREVIEW_FOR_DEBUG
|
#ifndef USE_PREVIEW_FOR_DEBUG
|
||||||
if (success
|
if (success
|
||||||
&& fPrinterCap->isSupport(PrinterCap::kPrintStyle)
|
&& fPrinterCap->IsSupport(PrinterCap::kPrintStyle)
|
||||||
&& (fOrgJobData->getPrintStyle() != JobData::kSimplex)
|
&& (fOrgJobData->GetPrintStyle() != JobData::kSimplex)
|
||||||
&& (((page_index + fOrgJobData->getNup() - 1) / fOrgJobData->getNup())
|
&& (((page_index + fOrgJobData->GetNup() - 1) / fOrgJobData->GetNup())
|
||||||
% 2)) {
|
% 2)) {
|
||||||
// append an empty page on the back side of the page in duplex or
|
// append an empty page on the back side of the page in duplex or
|
||||||
// booklet mode
|
// booklet mode
|
||||||
@@ -605,21 +605,21 @@ GraphicsDriver::PrintJob(BFile* spoolFile)
|
|||||||
|
|
||||||
fTransport = new Transport(fPrinterData);
|
fTransport = new Transport(fPrinterData);
|
||||||
|
|
||||||
if (fTransport->check_abort()) {
|
if (fTransport->CheckAbort()) {
|
||||||
success = false;
|
success = false;
|
||||||
} else if (!fTransport->is_print_to_file_canceled()) {
|
} else if (!fTransport->IsPrintToFileCanceled()) {
|
||||||
BStopWatch stopWatch("printJob", !MEASURE_PRINT_JOB_TIME);
|
BStopWatch stopWatch("printJob", !MEASURE_PRINT_JOB_TIME);
|
||||||
_SetupBitmap();
|
_SetupBitmap();
|
||||||
SpoolData spoolData(spoolFile, fPageCount, fOrgJobData->getNup(),
|
SpoolData spoolData(spoolFile, fPageCount, fOrgJobData->GetNup(),
|
||||||
fOrgJobData->getReverse());
|
fOrgJobData->GetReverse());
|
||||||
success = StartDocument();
|
success = StartDocument();
|
||||||
if (success) {
|
if (success) {
|
||||||
fStatusWindow = new StatusWindow(
|
fStatusWindow = new StatusWindow(
|
||||||
fRealJobData->getPageSelection() == JobData::kOddNumberedPages,
|
fRealJobData->GetPageSelection() == JobData::kOddNumberedPages,
|
||||||
fRealJobData->getPageSelection() == JobData::kEvenNumberedPages,
|
fRealJobData->GetPageSelection() == JobData::kEvenNumberedPages,
|
||||||
fRealJobData->getFirstPage(),
|
fRealJobData->GetFirstPage(),
|
||||||
fPageCount,
|
fPageCount,
|
||||||
fInternalCopies,fRealJobData->getNup());
|
fInternalCopies,fRealJobData->GetNup());
|
||||||
|
|
||||||
while (fInternalCopies--) {
|
while (fInternalCopies--) {
|
||||||
success = _PrintDocument(&spoolData);
|
success = _PrintDocument(&spoolData);
|
||||||
@@ -638,8 +638,8 @@ GraphicsDriver::PrintJob(BFile* spoolFile)
|
|||||||
|
|
||||||
if (success == false) {
|
if (success == false) {
|
||||||
BAlert *alert;
|
BAlert *alert;
|
||||||
if (fTransport->check_abort())
|
if (fTransport->CheckAbort())
|
||||||
alert = new BAlert("", fTransport->last_error().c_str(), "OK");
|
alert = new BAlert("", fTransport->LastError().c_str(), "OK");
|
||||||
else
|
else
|
||||||
alert = new BAlert("", "Printer not responding.", "OK");
|
alert = new BAlert("", "Printer not responding.", "OK");
|
||||||
alert->Go();
|
alert->Go();
|
||||||
@@ -707,7 +707,7 @@ GraphicsDriver::WriteSpoolData(const void* buffer, size_t size)
|
|||||||
if (fTransport == NULL)
|
if (fTransport == NULL)
|
||||||
return
|
return
|
||||||
|
|
||||||
fTransport->write(buffer, size);
|
fTransport->Write(buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -722,7 +722,7 @@ GraphicsDriver::WriteSpoolString(const char* format, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
vsprintf(buffer, format, ap);
|
vsprintf(buffer, format, ap);
|
||||||
fTransport->write(buffer, strlen(buffer));
|
fTransport->Write(buffer, strlen(buffer));
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,7 +734,7 @@ GraphicsDriver::WriteSpoolChar(char c)
|
|||||||
if (fTransport == NULL)
|
if (fTransport == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fTransport->write(&c, 1);
|
fTransport->Write(&c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,47 +18,55 @@ using namespace std;
|
|||||||
|
|
||||||
#include "Pattern.h"
|
#include "Pattern.h"
|
||||||
|
|
||||||
static uint gray(ColorRGB32 c)
|
|
||||||
|
static uint
|
||||||
|
ToGray(ColorRGB32 c)
|
||||||
{
|
{
|
||||||
if (c.little.red == c.little.green && c.little.red == c.little.blue) {
|
if (c.little.red == c.little.green && c.little.red == c.little.blue)
|
||||||
return c.little.red;
|
return c.little.red;
|
||||||
} else {
|
|
||||||
return (c.little.red * 3 + c.little.green * 6 + c.little.blue) / 10;
|
return (c.little.red * 3 + c.little.green * 6 + c.little.blue) / 10;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint channel_red(ColorRGB32 c)
|
|
||||||
|
static uint
|
||||||
|
GetRedValue(ColorRGB32 c)
|
||||||
{
|
{
|
||||||
return c.little.red;
|
return c.little.red;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint channel_green(ColorRGB32 c)
|
|
||||||
|
static uint
|
||||||
|
GetGreenValue(ColorRGB32 c)
|
||||||
{
|
{
|
||||||
return c.little.green;
|
return c.little.green;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint channel_blue(ColorRGB32 c)
|
|
||||||
|
static uint
|
||||||
|
GetBlueValue(ColorRGB32 c)
|
||||||
{
|
{
|
||||||
return c.little.blue;
|
return c.little.blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Halftone::Halftone(color_space cs, double gamma, double min, DitherType dither_type)
|
|
||||||
|
Halftone::Halftone(color_space colorSpace, double gamma, double min,
|
||||||
|
DitherType ditherType)
|
||||||
{
|
{
|
||||||
fPixelDepth = color_space2pixel_depth(cs);
|
fPixelDepth = color_space2pixel_depth(colorSpace);
|
||||||
fGray = gray;
|
fGray = ToGray;
|
||||||
setPlanes(kPlaneMonochrome1);
|
SetPlanes(kPlaneMonochrome1);
|
||||||
setBlackValue(kHighValueMeansBlack);
|
SetBlackValue(kHighValueMeansBlack);
|
||||||
|
|
||||||
initFloydSteinberg();
|
InitFloydSteinberg();
|
||||||
|
|
||||||
createGammaTable(gamma, min);
|
CreateGammaTable(gamma, min);
|
||||||
|
|
||||||
if (dither_type == kTypeFloydSteinberg) {
|
if (ditherType == kTypeFloydSteinberg) {
|
||||||
fDither = &Halftone::ditherFloydSteinberg;
|
fDither = &Halftone::DitherFloydSteinberg;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dither_type) {
|
switch (ditherType) {
|
||||||
case kType2:
|
case kType2:
|
||||||
fPattern = pattern16x16_type2;
|
fPattern = pattern16x16_type2;
|
||||||
break;
|
break;
|
||||||
@@ -70,10 +78,10 @@ Halftone::Halftone(color_space cs, double gamma, double min, DitherType dither_t
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (cs) {
|
switch (colorSpace) {
|
||||||
case B_RGB32:
|
case B_RGB32:
|
||||||
case B_RGB32_BIG:
|
case B_RGB32_BIG:
|
||||||
fDither = &Halftone::ditherRGB32;
|
fDither = &Halftone::DitherRGB32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fDither = NULL;
|
fDither = NULL;
|
||||||
@@ -81,17 +89,20 @@ Halftone::Halftone(color_space cs, double gamma, double min, DitherType dither_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Halftone::~Halftone()
|
Halftone::~Halftone()
|
||||||
{
|
{
|
||||||
uninitFloydSteinberg();
|
UninitFloydSteinberg();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::setPlanes(Planes planes)
|
|
||||||
|
void
|
||||||
|
Halftone::SetPlanes(Planes planes)
|
||||||
{
|
{
|
||||||
fPlanes = planes;
|
fPlanes = planes;
|
||||||
if (planes == kPlaneMonochrome1) {
|
if (planes == kPlaneMonochrome1) {
|
||||||
fNumberOfPlanes = 1;
|
fNumberOfPlanes = 1;
|
||||||
fGray = gray;
|
fGray = ToGray;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(planes == kPlaneRGB1);
|
ASSERT(planes == kPlaneRGB1);
|
||||||
fNumberOfPlanes = 3;
|
fNumberOfPlanes = 3;
|
||||||
@@ -99,23 +110,28 @@ void Halftone::setPlanes(Planes planes)
|
|||||||
fCurrentPlane = 0;
|
fCurrentPlane = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::setBlackValue(BlackValue blackValue)
|
|
||||||
|
void
|
||||||
|
Halftone::SetBlackValue(BlackValue blackValue)
|
||||||
{
|
{
|
||||||
fBlackValue = blackValue;
|
fBlackValue = blackValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::createGammaTable(double gamma, double min)
|
|
||||||
|
void
|
||||||
|
Halftone::CreateGammaTable(double gamma, double min)
|
||||||
{
|
{
|
||||||
uint *g = fGammaTable;
|
|
||||||
const double kScalingFactor = 255.0 - min;
|
const double kScalingFactor = 255.0 - min;
|
||||||
for (int i = 0; i < kGammaTableSize; i++) {
|
for (int i = 0; i < kGammaTableSize; i++) {
|
||||||
const double kGammaCorrectedValue = pow((double)i / 255.0, gamma);
|
const double kGammaCorrectedValue = pow((double)i / 255.0, gamma);
|
||||||
const double kTranslatedValue = min + kGammaCorrectedValue * kScalingFactor;
|
const double kTranslatedValue = min + kGammaCorrectedValue * kScalingFactor;
|
||||||
*g++ = (uint)(kTranslatedValue);
|
fGammaTable[i] = (uint)(kTranslatedValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::initElements(int x, int y, uchar *elements)
|
|
||||||
|
void
|
||||||
|
Halftone::InitElements(int x, int y, uchar* elements)
|
||||||
{
|
{
|
||||||
x &= 0x0F;
|
x &= 0x0F;
|
||||||
y &= 0x0F;
|
y &= 0x0F;
|
||||||
@@ -125,74 +141,70 @@ void Halftone::initElements(int x, int y, uchar *elements)
|
|||||||
const uchar *right = left + 0x0F;
|
const uchar *right = left + 0x0F;
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
*elements++ = *pos;
|
elements[i] = *pos;
|
||||||
if (pos >= right) {
|
if (pos >= right)
|
||||||
pos = left;
|
pos = left;
|
||||||
} else {
|
else
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::dither(
|
|
||||||
uchar *dst,
|
void
|
||||||
const uchar *src,
|
Halftone::Dither(uchar* destination, const uchar* source, int x, int y,
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
int width)
|
int width)
|
||||||
{
|
{
|
||||||
if (fPlanes == kPlaneRGB1) {
|
if (fPlanes == kPlaneRGB1) {
|
||||||
switch (fCurrentPlane) {
|
switch (fCurrentPlane) {
|
||||||
case 0:
|
case 0:
|
||||||
setGrayFunction(kRedChannel);
|
SetGrayFunction(kRedChannel);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
setGrayFunction(kGreenChannel);
|
SetGrayFunction(kGreenChannel);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
setGrayFunction(kBlueChannel);
|
SetGrayFunction(kBlueChannel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ASSERT(fGray == &gray);
|
ASSERT(fGray == &gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
(this->*fDither)(dst, src, x, y, width);
|
(this->*fDither)(destination, source, x, y, width);
|
||||||
|
|
||||||
// next plane
|
// next plane
|
||||||
fCurrentPlane ++;
|
fCurrentPlane ++;
|
||||||
if (fCurrentPlane >= fNumberOfPlanes) {
|
if (fCurrentPlane >= fNumberOfPlanes)
|
||||||
fCurrentPlane = 0;
|
fCurrentPlane = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::setGrayFunction(GrayFunction grayFunction)
|
|
||||||
|
void
|
||||||
|
Halftone::SetGrayFunction(GrayFunction grayFunction)
|
||||||
{
|
{
|
||||||
PFN_gray function = NULL;
|
PFN_gray function = NULL;
|
||||||
switch (grayFunction) {
|
switch (grayFunction) {
|
||||||
case kMixToGray: function = gray;
|
case kMixToGray: function = ToGray;
|
||||||
break;
|
break;
|
||||||
case kRedChannel: function = channel_red;
|
case kRedChannel: function = GetRedValue;
|
||||||
break;
|
break;
|
||||||
case kGreenChannel: function = channel_green;
|
case kGreenChannel: function = GetGreenValue;
|
||||||
break;
|
break;
|
||||||
case kBlueChannel: function = channel_blue;
|
case kBlueChannel: function = GetBlueValue;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
setGrayFunction(function);
|
SetGrayFunction(function);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::ditherRGB32(
|
|
||||||
uchar *dst,
|
void
|
||||||
const uchar *a_src,
|
Halftone::DitherRGB32(uchar *destination, const uchar *source0, int x, int y,
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
int width)
|
int width)
|
||||||
{
|
{
|
||||||
uchar elements[16];
|
uchar elements[16];
|
||||||
initElements(x, y, elements);
|
InitElements(x, y, elements);
|
||||||
|
|
||||||
const ColorRGB32 *src = (const ColorRGB32 *)a_src;
|
const ColorRGB32* source = reinterpret_cast<const ColorRGB32*>(source0);
|
||||||
|
|
||||||
int widthByte = (width + 7) / 8;
|
int widthByte = (width + 7) / 8;
|
||||||
int remainder = width % 8;
|
int remainder = width % 8;
|
||||||
@@ -206,8 +218,8 @@ void Halftone::ditherRGB32(
|
|||||||
uchar *e = elements;
|
uchar *e = elements;
|
||||||
uchar *last_e = elements + 16;
|
uchar *last_e = elements + 16;
|
||||||
|
|
||||||
c = *src;
|
c = *source;
|
||||||
density = getDensity(c);
|
density = GetDensity(c);
|
||||||
|
|
||||||
if (width >= 8) {
|
if (width >= 8) {
|
||||||
for (i = 0; i < widthByte - 1; i++) {
|
for (i = 0; i < widthByte - 1; i++) {
|
||||||
@@ -216,46 +228,54 @@ void Halftone::ditherRGB32(
|
|||||||
e = elements;
|
e = elements;
|
||||||
}
|
}
|
||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
if (c.little.red != src->little.red || c.little.green != src->little.green || c.little.blue != src->little.blue) {
|
if (c.little.red != source->little.red
|
||||||
c = *src;
|
|| c.little.green != source->little.green
|
||||||
density = getDensity(c);
|
|| c.little.blue != source->little.blue) {
|
||||||
|
c = *source;
|
||||||
|
density = GetDensity(c);
|
||||||
}
|
}
|
||||||
src++;
|
source++;
|
||||||
if (density <= *e++) {
|
if (density <= *e++) {
|
||||||
cur |= (0x80 >> j);
|
cur |= (0x80 >> j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*dst++ = convertUsingBlackValue(cur);
|
*destination++ = ConvertUsingBlackValue(cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remainder > 0) {
|
if (remainder > 0) {
|
||||||
cur = 0;
|
cur = 0;
|
||||||
if (e == last_e) {
|
if (e == last_e) {
|
||||||
e = elements;
|
e = elements;
|
||||||
}
|
}
|
||||||
for (j = 0; j < remainder; j++) {
|
for (j = 0; j < remainder; j++) {
|
||||||
if (c.little.red != src->little.red || c.little.green != src->little.green || c.little.blue != src->little.blue) {
|
if (c.little.red != source->little.red
|
||||||
c = *src;
|
|| c.little.green != source->little.green
|
||||||
density = getDensity(c);
|
|| c.little.blue != source->little.blue) {
|
||||||
|
c = *source;
|
||||||
|
density = GetDensity(c);
|
||||||
}
|
}
|
||||||
src++;
|
source++;
|
||||||
if (density <= *e++) {
|
if (density <= *e++) {
|
||||||
cur |= (0x80 >> j);
|
cur |= (0x80 >> j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*dst++ = convertUsingBlackValue(cur);
|
*destination++ = ConvertUsingBlackValue(cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Floyd-Steinberg dithering
|
// Floyd-Steinberg dithering
|
||||||
void Halftone::initFloydSteinberg()
|
void
|
||||||
|
Halftone::InitFloydSteinberg()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < kMaxNumberOfPlanes; i ++) {
|
for (int i = 0; i < kMaxNumberOfPlanes; i ++)
|
||||||
fErrorTables[i] = NULL;
|
fErrorTables[i] = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::deleteErrorTables()
|
|
||||||
|
void
|
||||||
|
Halftone::DeleteErrorTables()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < kMaxNumberOfPlanes; i ++) {
|
for (int i = 0; i < kMaxNumberOfPlanes; i ++) {
|
||||||
delete fErrorTables[i];
|
delete fErrorTables[i];
|
||||||
@@ -263,14 +283,18 @@ void Halftone::deleteErrorTables()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::uninitFloydSteinberg()
|
|
||||||
|
void
|
||||||
|
Halftone::UninitFloydSteinberg()
|
||||||
{
|
{
|
||||||
deleteErrorTables();
|
DeleteErrorTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::setupErrorBuffer(int x, int y, int width)
|
|
||||||
|
void
|
||||||
|
Halftone::SetupErrorBuffer(int x, int y, int width)
|
||||||
{
|
{
|
||||||
deleteErrorTables();
|
DeleteErrorTables();
|
||||||
fX = x;
|
fX = x;
|
||||||
fY = y;
|
fY = y;
|
||||||
fWidth = width;
|
fWidth = width;
|
||||||
@@ -282,22 +306,29 @@ void Halftone::setupErrorBuffer(int x, int y, int width)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Halftone::ditherFloydSteinberg(uchar *dst, const uchar* a_src, int x, int y, int width)
|
|
||||||
{
|
|
||||||
if (fErrorTables[fCurrentPlane] == NULL || fX != x || fCurrentPlane == 0 && fY != y - 1 || fCurrentPlane > 0 && fY != y || fWidth != width) {
|
|
||||||
setupErrorBuffer(x, y, width);
|
|
||||||
} else {
|
|
||||||
fY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
int* error_table = &fErrorTables[fCurrentPlane][1];
|
void
|
||||||
int current_error = error_table[0], error;
|
Halftone::DitherFloydSteinberg(uchar *destination, const uchar* source0,
|
||||||
error_table[0] = 0;
|
int x, int y, int width)
|
||||||
const ColorRGB32 *src = (const ColorRGB32 *)a_src;
|
{
|
||||||
|
if (fErrorTables[fCurrentPlane] == NULL || fX != x
|
||||||
|
|| (fCurrentPlane == 0 && fY != y - 1)
|
||||||
|
|| (fCurrentPlane > 0 && fY != y)
|
||||||
|
|| fWidth != width)
|
||||||
|
SetupErrorBuffer(x, y, width);
|
||||||
|
else
|
||||||
|
fY = y;
|
||||||
|
|
||||||
|
int* errorTable = &fErrorTables[fCurrentPlane][1];
|
||||||
|
int current_error = errorTable[0];
|
||||||
|
int error;
|
||||||
|
errorTable[0] = 0;
|
||||||
|
|
||||||
|
const ColorRGB32 *source = reinterpret_cast<const ColorRGB32 *>(source0);
|
||||||
uchar cur = 0; // cleared bit means white, set bit means black
|
uchar cur = 0; // cleared bit means white, set bit means black
|
||||||
for (int x = 0; x < width; x ++, src ++) {
|
for (int x = 0; x < width; x ++, source ++) {
|
||||||
const int bit = 7 - x % 8;
|
const int bit = 7 - x % 8;
|
||||||
const int density = getDensity(*src) + current_error / 16;
|
const int density = GetDensity(*source) + current_error / 16;
|
||||||
|
|
||||||
if (density < 128) {
|
if (density < 128) {
|
||||||
error = density;
|
error = density;
|
||||||
@@ -310,7 +341,7 @@ void Halftone::ditherFloydSteinberg(uchar *dst, const uchar* a_src, int x, int y
|
|||||||
// 0 X 7 (current_error)
|
// 0 X 7 (current_error)
|
||||||
// (left) 3 5 1 (right)
|
// (left) 3 5 1 (right)
|
||||||
// (middle)
|
// (middle)
|
||||||
int* right = &error_table[x+1];
|
int* right = &errorTable[x+1];
|
||||||
current_error = (*right) + 7 * error;
|
current_error = (*right) + 7 * error;
|
||||||
*right = 1 * error;
|
*right = 1 * error;
|
||||||
|
|
||||||
@@ -321,16 +352,16 @@ void Halftone::ditherFloydSteinberg(uchar *dst, const uchar* a_src, int x, int y
|
|||||||
*left += 3 * error;
|
*left += 3 * error;
|
||||||
|
|
||||||
if (bit == 0) {
|
if (bit == 0) {
|
||||||
*dst = convertUsingBlackValue(cur);
|
*destination = ConvertUsingBlackValue(cur);
|
||||||
// advance to next byte
|
// advance to next byte
|
||||||
dst ++;
|
destination ++;
|
||||||
cur = 0;
|
cur = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool hasRest = (width % 8) != 0;
|
const bool hasRest = (width % 8) != 0;
|
||||||
if (hasRest) {
|
if (hasRest) {
|
||||||
*dst = convertUsingBlackValue(cur);
|
*destination = ConvertUsingBlackValue(cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,16 +3,18 @@
|
|||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
|
||||||
HalftonePreviewView::HalftonePreviewView(
|
|
||||||
BRect frame,
|
HalftonePreviewView::HalftonePreviewView(BRect frame, const char* name,
|
||||||
const char* name,
|
uint32 resizeMask, uint32 flags)
|
||||||
uint32 resizeMask,
|
:
|
||||||
uint32 flags)
|
BView(frame, name, resizeMask, flags)
|
||||||
: BView(frame, name, resizeMask, flags)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void HalftonePreviewView::preview(float gamma, float min, Halftone::DitherType ditherType, bool color)
|
|
||||||
|
void
|
||||||
|
HalftonePreviewView::Preview(float gamma, float min,
|
||||||
|
Halftone::DitherType ditherType, bool color)
|
||||||
{
|
{
|
||||||
const color_space kColorSpace = B_RGB32;
|
const color_space kColorSpace = B_RGB32;
|
||||||
const float right = Bounds().Width();
|
const float right = Bounds().Width();
|
||||||
@@ -67,7 +69,7 @@ void HalftonePreviewView::preview(float gamma, float min, Halftone::DitherType d
|
|||||||
|
|
||||||
// create preview image
|
// create preview image
|
||||||
Halftone halftone(kColorSpace, gamma, min, ditherType);
|
Halftone halftone(kColorSpace, gamma, min, ditherType);
|
||||||
halftone.setBlackValue(Halftone::kLowValueMeansBlack);
|
halftone.SetBlackValue(Halftone::kLowValueMeansBlack);
|
||||||
|
|
||||||
const int widthBytes = (width + 7) / 8; // byte boundary
|
const int widthBytes = (width + 7) / 8; // byte boundary
|
||||||
uchar* buffer = new uchar[widthBytes];
|
uchar* buffer = new uchar[widthBytes];
|
||||||
@@ -77,13 +79,13 @@ void HalftonePreviewView::preview(float gamma, float min, Halftone::DitherType d
|
|||||||
|
|
||||||
const int numPlanes = color ? 3 : 1;
|
const int numPlanes = color ? 3 : 1;
|
||||||
if (color) {
|
if (color) {
|
||||||
halftone.setPlanes(Halftone::kPlaneRGB1);
|
halftone.SetPlanes(Halftone::kPlaneRGB1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < height; y ++) {
|
for (int y = 0; y < height; y ++) {
|
||||||
for (int plane = 0; plane < numPlanes; plane ++) {
|
for (int plane = 0; plane < numPlanes; plane ++) {
|
||||||
// halftone the preview image
|
// halftone the preview image
|
||||||
halftone.dither(buffer, src, 0, y, width);
|
halftone.Dither(buffer, src, 0, y, width);
|
||||||
|
|
||||||
// convert the plane(s) to RGB32
|
// convert the plane(s) to RGB32
|
||||||
ColorRGB32Little* dst = (ColorRGB32Little*)dstRow;
|
ColorRGB32Little* dst = (ColorRGB32Little*)dstRow;
|
||||||
@@ -123,12 +125,11 @@ void HalftonePreviewView::preview(float gamma, float min, Halftone::DitherType d
|
|||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
HalftoneView::HalftoneView(
|
|
||||||
BRect frame,
|
HalftoneView::HalftoneView(BRect frame, const char* name, uint32 resizeMask,
|
||||||
const char* name,
|
|
||||||
uint32 resizeMask,
|
|
||||||
uint32 flags)
|
uint32 flags)
|
||||||
: BView(frame, name, resizeMask, flags)
|
:
|
||||||
|
BView(frame, name, resizeMask, flags)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
@@ -187,7 +188,10 @@ HalftoneView::HalftoneView(
|
|||||||
AddChild(fPreview);
|
AddChild(fPreview);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HalftoneView::preview(float gamma, float min, Halftone::DitherType ditherType, bool color)
|
|
||||||
|
void
|
||||||
|
HalftoneView::Preview(float gamma, float min,
|
||||||
|
Halftone::DitherType ditherType, bool color)
|
||||||
{
|
{
|
||||||
fPreview->preview(gamma, min, ditherType, color);
|
fPreview->Preview(gamma, min, ditherType, color);
|
||||||
}
|
}
|
||||||
|
|||||||
+184
-180
@@ -194,9 +194,9 @@ DriverSpecificSettings::Message()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JobData::JobData(BMessage *msg, const PrinterCap *cap, SettingType type)
|
JobData::JobData(BMessage *message, const PrinterCap *printerCap, SettingType settingType)
|
||||||
{
|
{
|
||||||
load(msg, cap, type);
|
Load(message, printerCap, settingType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -205,370 +205,374 @@ JobData::~JobData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JobData::JobData(const JobData &job_data)
|
JobData::JobData(const JobData &jobData)
|
||||||
{
|
{
|
||||||
*this = job_data;
|
*this = jobData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JobData&
|
JobData&
|
||||||
JobData::operator=(const JobData &job_data)
|
JobData::operator=(const JobData &jobData)
|
||||||
{
|
{
|
||||||
fShowPreview = job_data.fShowPreview;
|
fShowPreview = jobData.fShowPreview;
|
||||||
fPaper = job_data.fPaper;
|
fPaper = jobData.fPaper;
|
||||||
fResolutionID = job_data.fResolutionID;
|
fResolutionID = jobData.fResolutionID;
|
||||||
fXRes = job_data.fXRes;
|
fXRes = jobData.fXRes;
|
||||||
fYRes = job_data.fYRes;
|
fYRes = jobData.fYRes;
|
||||||
fOrientation = job_data.fOrientation;
|
fOrientation = jobData.fOrientation;
|
||||||
fScaling = job_data.fScaling;
|
fScaling = jobData.fScaling;
|
||||||
fPaperRect = job_data.fPaperRect;
|
fPaperRect = jobData.fPaperRect;
|
||||||
fScaledPaperRect = job_data.fScaledPaperRect;
|
fScaledPaperRect = jobData.fScaledPaperRect;
|
||||||
fPrintableRect = job_data.fPrintableRect;
|
fPrintableRect = jobData.fPrintableRect;
|
||||||
fScaledPrintableRect = job_data.fScaledPrintableRect;
|
fScaledPrintableRect = jobData.fScaledPrintableRect;
|
||||||
fNup = job_data.fNup;
|
fNup = jobData.fNup;
|
||||||
fFirstPage = job_data.fFirstPage;
|
fFirstPage = jobData.fFirstPage;
|
||||||
fLastPage = job_data.fLastPage;
|
fLastPage = jobData.fLastPage;
|
||||||
fGamma = job_data.fGamma;
|
fGamma = jobData.fGamma;
|
||||||
fInkDensity = job_data.fInkDensity;
|
fInkDensity = jobData.fInkDensity;
|
||||||
fPaperSource = job_data.fPaperSource;
|
fPaperSource = jobData.fPaperSource;
|
||||||
fCopies = job_data.fCopies;
|
fCopies = jobData.fCopies;
|
||||||
fCollate = job_data.fCollate;
|
fCollate = jobData.fCollate;
|
||||||
fReverse = job_data.fReverse;
|
fReverse = jobData.fReverse;
|
||||||
fPrintStyle = job_data.fPrintStyle;
|
fPrintStyle = jobData.fPrintStyle;
|
||||||
fBindingLocation = job_data.fBindingLocation;
|
fBindingLocation = jobData.fBindingLocation;
|
||||||
fPageOrder = job_data.fPageOrder;
|
fPageOrder = jobData.fPageOrder;
|
||||||
fSettingType = job_data.fSettingType;
|
fSettingType = jobData.fSettingType;
|
||||||
fMsg = job_data.fMsg;
|
fMsg = jobData.fMsg;
|
||||||
fColor = job_data.fColor;
|
fColor = jobData.fColor;
|
||||||
fDitherType = job_data.fDitherType;
|
fDitherType = jobData.fDitherType;
|
||||||
fPageSelection = job_data.fPageSelection;
|
fPageSelection = jobData.fPageSelection;
|
||||||
fMarginUnit = job_data.fMarginUnit;
|
fMarginUnit = jobData.fMarginUnit;
|
||||||
fPhysicalRect = job_data.fPhysicalRect;
|
fPhysicalRect = jobData.fPhysicalRect;
|
||||||
fScaledPhysicalRect = job_data.fScaledPhysicalRect;
|
fScaledPhysicalRect = jobData.fScaledPhysicalRect;
|
||||||
fDriverSpecificSettings = job_data.fDriverSpecificSettings;
|
fDriverSpecificSettings = jobData.fDriverSpecificSettings;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobData::load(BMessage *msg, const PrinterCap *cap, SettingType type)
|
JobData::Load(BMessage* message, const PrinterCap* printerCap,
|
||||||
|
SettingType settingType)
|
||||||
{
|
{
|
||||||
fMsg = msg;
|
fMsg = message;
|
||||||
fSettingType = type;
|
fSettingType = settingType;
|
||||||
|
|
||||||
const PaperCap *paperCap = NULL;
|
const PaperCap *paperCap = NULL;
|
||||||
|
|
||||||
if (msg->HasBool(kJDShowPreview))
|
if (message->HasBool(kJDShowPreview))
|
||||||
fShowPreview = msg->FindBool(kJDShowPreview);
|
fShowPreview = message->FindBool(kJDShowPreview);
|
||||||
else
|
else
|
||||||
fShowPreview = false;
|
fShowPreview = false;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDPaper))
|
if (message->HasInt32(kJDPaper))
|
||||||
fPaper = (Paper)msg->FindInt32(kJDPaper);
|
fPaper = (Paper)message->FindInt32(kJDPaper);
|
||||||
else if (cap->isSupport(PrinterCap::kPaper)) {
|
else if (printerCap->IsSupport(PrinterCap::kPaper)) {
|
||||||
paperCap = (const PaperCap *)cap->getDefaultCap(PrinterCap::kPaper);
|
paperCap = (const PaperCap *)printerCap->GetDefaultCap(
|
||||||
|
PrinterCap::kPaper);
|
||||||
fPaper = paperCap->fPaper;
|
fPaper = paperCap->fPaper;
|
||||||
} else
|
} else
|
||||||
fPaper = kA4;
|
fPaper = kA4;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDResolution)) {
|
if (message->HasInt32(kJDResolution)) {
|
||||||
msg->FindInt32(kJDResolution, &fResolutionID);
|
message->FindInt32(kJDResolution, &fResolutionID);
|
||||||
} else if (cap->isSupport(PrinterCap::kResolution)) {
|
} else if (printerCap->IsSupport(PrinterCap::kResolution)) {
|
||||||
fResolutionID = cap->getDefaultCap(PrinterCap::kResolution)->ID();
|
fResolutionID = printerCap->GetDefaultCap(PrinterCap::kResolution)
|
||||||
|
->ID();
|
||||||
} else {
|
} else {
|
||||||
// should not reach here!
|
// should not reach here!
|
||||||
fResolutionID = 0;
|
fResolutionID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasInt64(kJDXRes)) {
|
if (message->HasInt64(kJDXRes)) {
|
||||||
int64 xres64;
|
int64 xres64;
|
||||||
msg->FindInt64(kJDXRes, &xres64);
|
message->FindInt64(kJDXRes, &xres64);
|
||||||
fXRes = xres64;
|
fXRes = xres64;
|
||||||
} else if (cap->isSupport(PrinterCap::kResolution)) {
|
} else if (printerCap->IsSupport(PrinterCap::kResolution)) {
|
||||||
fXRes = ((const ResolutionCap *)cap->getDefaultCap(
|
fXRes = ((const ResolutionCap *)printerCap->GetDefaultCap(
|
||||||
PrinterCap::kResolution))->fXResolution;
|
PrinterCap::kResolution))->fXResolution;
|
||||||
} else {
|
} else {
|
||||||
fXRes = 300;
|
fXRes = 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasInt64(kJDYRes)) {
|
if (message->HasInt64(kJDYRes)) {
|
||||||
int64 yres64;
|
int64 yres64;
|
||||||
msg->FindInt64(kJDYRes, &yres64);
|
message->FindInt64(kJDYRes, &yres64);
|
||||||
fYRes = yres64;
|
fYRes = yres64;
|
||||||
} else if (cap->isSupport(PrinterCap::kResolution)) {
|
} else if (printerCap->IsSupport(PrinterCap::kResolution)) {
|
||||||
fYRes = ((const ResolutionCap *)cap->getDefaultCap(
|
fYRes = ((const ResolutionCap *)printerCap->GetDefaultCap(
|
||||||
PrinterCap::kResolution))->fYResolution;
|
PrinterCap::kResolution))->fYResolution;
|
||||||
} else {
|
} else {
|
||||||
fYRes = 300;
|
fYRes = 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasInt32(kJDOrientation))
|
if (message->HasInt32(kJDOrientation))
|
||||||
fOrientation = (Orientation)msg->FindInt32(kJDOrientation);
|
fOrientation = (Orientation)message->FindInt32(kJDOrientation);
|
||||||
else if (cap->isSupport(PrinterCap::kOrientation))
|
else if (printerCap->IsSupport(PrinterCap::kOrientation))
|
||||||
fOrientation = ((const OrientationCap *)cap->getDefaultCap(
|
fOrientation = ((const OrientationCap *)printerCap->GetDefaultCap(
|
||||||
PrinterCap::kOrientation))->fOrientation;
|
PrinterCap::kOrientation))->fOrientation;
|
||||||
else
|
else
|
||||||
fOrientation = kPortrait;
|
fOrientation = kPortrait;
|
||||||
|
|
||||||
if (msg->HasFloat(kJDScaling))
|
if (message->HasFloat(kJDScaling))
|
||||||
fScaling = msg->FindFloat(kJDScaling);
|
fScaling = message->FindFloat(kJDScaling);
|
||||||
else
|
else
|
||||||
fScaling = 100.0f;
|
fScaling = 100.0f;
|
||||||
|
|
||||||
if (msg->HasRect(kJDPaperRect)) {
|
if (message->HasRect(kJDPaperRect)) {
|
||||||
fPaperRect = msg->FindRect(kJDPaperRect);
|
fPaperRect = message->FindRect(kJDPaperRect);
|
||||||
} else if (paperCap != NULL) {
|
} else if (paperCap != NULL) {
|
||||||
fPaperRect = paperCap->fPaperRect;
|
fPaperRect = paperCap->fPaperRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasRect(kJDScaledPaperRect)) {
|
if (message->HasRect(kJDScaledPaperRect)) {
|
||||||
fScaledPaperRect = msg->FindRect(kJDScaledPaperRect);
|
fScaledPaperRect = message->FindRect(kJDScaledPaperRect);
|
||||||
} else {
|
} else {
|
||||||
fScaledPaperRect = fPaperRect;
|
fScaledPaperRect = fPaperRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasRect(kJDPrintableRect)) {
|
if (message->HasRect(kJDPrintableRect)) {
|
||||||
fPrintableRect = msg->FindRect(kJDPrintableRect);
|
fPrintableRect = message->FindRect(kJDPrintableRect);
|
||||||
} else if (paperCap != NULL) {
|
} else if (paperCap != NULL) {
|
||||||
fPrintableRect = paperCap->fPhysicalRect;
|
fPrintableRect = paperCap->fPhysicalRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasRect(kJDScaledPrintableRect)) {
|
if (message->HasRect(kJDScaledPrintableRect)) {
|
||||||
fScaledPrintableRect = msg->FindRect(kJDScaledPrintableRect);
|
fScaledPrintableRect = message->FindRect(kJDScaledPrintableRect);
|
||||||
} else {
|
} else {
|
||||||
fScaledPrintableRect = fPrintableRect;
|
fScaledPrintableRect = fPrintableRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasRect(kJDPhysicalRect)) {
|
if (message->HasRect(kJDPhysicalRect)) {
|
||||||
fPhysicalRect = msg->FindRect(kJDPhysicalRect);
|
fPhysicalRect = message->FindRect(kJDPhysicalRect);
|
||||||
} else if (paperCap != NULL) {
|
} else if (paperCap != NULL) {
|
||||||
fPhysicalRect = paperCap->fPhysicalRect;
|
fPhysicalRect = paperCap->fPhysicalRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasRect(kJDScaledPhysicalRect)) {
|
if (message->HasRect(kJDScaledPhysicalRect)) {
|
||||||
fScaledPhysicalRect = msg->FindRect(kJDScaledPhysicalRect);
|
fScaledPhysicalRect = message->FindRect(kJDScaledPhysicalRect);
|
||||||
} else {
|
} else {
|
||||||
fScaledPhysicalRect = fPhysicalRect;
|
fScaledPhysicalRect = fPhysicalRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasInt32(kJDFirstPage))
|
if (message->HasInt32(kJDFirstPage))
|
||||||
fFirstPage = msg->FindInt32(kJDFirstPage);
|
fFirstPage = message->FindInt32(kJDFirstPage);
|
||||||
else
|
else
|
||||||
fFirstPage = 1;
|
fFirstPage = 1;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDLastPage))
|
if (message->HasInt32(kJDLastPage))
|
||||||
fLastPage = msg->FindInt32(kJDLastPage);
|
fLastPage = message->FindInt32(kJDLastPage);
|
||||||
else
|
else
|
||||||
fLastPage = -1;
|
fLastPage = -1;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDNup))
|
if (message->HasInt32(kJDNup))
|
||||||
fNup = msg->FindInt32(kJDNup);
|
fNup = message->FindInt32(kJDNup);
|
||||||
else
|
else
|
||||||
fNup = 1;
|
fNup = 1;
|
||||||
|
|
||||||
if (msg->HasFloat(kJDGamma))
|
if (message->HasFloat(kJDGamma))
|
||||||
fGamma = fMsg->FindFloat(kJDGamma);
|
fGamma = fMsg->FindFloat(kJDGamma);
|
||||||
else
|
else
|
||||||
fGamma = 0.25f;
|
fGamma = 0.25f;
|
||||||
|
|
||||||
if (msg->HasFloat(kJDInkDensity))
|
if (message->HasFloat(kJDInkDensity))
|
||||||
fInkDensity = fMsg->FindFloat(kJDInkDensity);
|
fInkDensity = fMsg->FindFloat(kJDInkDensity);
|
||||||
else
|
else
|
||||||
fInkDensity = 0.0f;
|
fInkDensity = 0.0f;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDPaperSource))
|
if (message->HasInt32(kJDPaperSource))
|
||||||
fPaperSource = (PaperSource)fMsg->FindInt32(kJDPaperSource);
|
fPaperSource = (PaperSource)fMsg->FindInt32(kJDPaperSource);
|
||||||
else if (cap->isSupport(PrinterCap::kPaperSource))
|
else if (printerCap->IsSupport(PrinterCap::kPaperSource))
|
||||||
fPaperSource = ((const PaperSourceCap *)cap->getDefaultCap(
|
fPaperSource = ((const PaperSourceCap *)printerCap->GetDefaultCap(
|
||||||
PrinterCap::kPaperSource))->fPaperSource;
|
PrinterCap::kPaperSource))->fPaperSource;
|
||||||
else
|
else
|
||||||
fPaperSource = kAuto;
|
fPaperSource = kAuto;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDCopies))
|
if (message->HasInt32(kJDCopies))
|
||||||
fCopies = msg->FindInt32(kJDCopies);
|
fCopies = message->FindInt32(kJDCopies);
|
||||||
else
|
else
|
||||||
fCopies = 1;
|
fCopies = 1;
|
||||||
|
|
||||||
if (msg->HasBool(kJDCollate))
|
if (message->HasBool(kJDCollate))
|
||||||
fCollate = msg->FindBool(kJDCollate);
|
fCollate = message->FindBool(kJDCollate);
|
||||||
else
|
else
|
||||||
fCollate = false;
|
fCollate = false;
|
||||||
|
|
||||||
if (msg->HasBool(kJDReverse))
|
if (message->HasBool(kJDReverse))
|
||||||
fReverse = msg->FindBool(kJDReverse);
|
fReverse = message->FindBool(kJDReverse);
|
||||||
else
|
else
|
||||||
fReverse = false;
|
fReverse = false;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDPrintStyle))
|
if (message->HasInt32(kJDPrintStyle))
|
||||||
fPrintStyle = (PrintStyle)msg->FindInt32(kJDPrintStyle);
|
fPrintStyle = (PrintStyle)message->FindInt32(kJDPrintStyle);
|
||||||
else if (cap->isSupport(PrinterCap::kPrintStyle))
|
else if (printerCap->IsSupport(PrinterCap::kPrintStyle))
|
||||||
fPrintStyle = ((const PrintStyleCap *)cap->getDefaultCap(
|
fPrintStyle = ((const PrintStyleCap *)printerCap->GetDefaultCap(
|
||||||
PrinterCap::kPrintStyle))->fPrintStyle;
|
PrinterCap::kPrintStyle))->fPrintStyle;
|
||||||
else
|
else
|
||||||
fPrintStyle = kSimplex;
|
fPrintStyle = kSimplex;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDBindingLocation))
|
if (message->HasInt32(kJDBindingLocation))
|
||||||
fBindingLocation = (BindingLocation)msg->FindInt32(kJDBindingLocation);
|
fBindingLocation = (BindingLocation)message->FindInt32(
|
||||||
else if (cap->isSupport(PrinterCap::kBindingLocation))
|
kJDBindingLocation);
|
||||||
fBindingLocation = ((const BindingLocationCap *)cap->getDefaultCap(
|
else if (printerCap->IsSupport(PrinterCap::kBindingLocation))
|
||||||
PrinterCap::kBindingLocation))->fBindingLocation;
|
fBindingLocation = ((const BindingLocationCap *)printerCap->
|
||||||
|
GetDefaultCap(PrinterCap::kBindingLocation))->fBindingLocation;
|
||||||
else
|
else
|
||||||
fBindingLocation = kLongEdgeLeft;
|
fBindingLocation = kLongEdgeLeft;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDPageOrder))
|
if (message->HasInt32(kJDPageOrder))
|
||||||
fPageOrder = (PageOrder)msg->FindInt32(kJDPageOrder);
|
fPageOrder = (PageOrder)message->FindInt32(kJDPageOrder);
|
||||||
else
|
else
|
||||||
fPageOrder = kAcrossFromLeft;
|
fPageOrder = kAcrossFromLeft;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDColor))
|
if (message->HasInt32(kJDColor))
|
||||||
fColor = (Color)msg->FindInt32(kJDColor);
|
fColor = (Color)message->FindInt32(kJDColor);
|
||||||
else if (cap->isSupport(PrinterCap::kColor))
|
else if (printerCap->IsSupport(PrinterCap::kColor))
|
||||||
fColor = ((const ColorCap *)cap->getDefaultCap(PrinterCap::kColor))
|
fColor = ((const ColorCap *)printerCap->GetDefaultCap(
|
||||||
->fColor;
|
PrinterCap::kColor))->fColor;
|
||||||
else
|
else
|
||||||
fColor = kMonochrome;
|
fColor = kMonochrome;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDDitherType))
|
if (message->HasInt32(kJDDitherType))
|
||||||
fDitherType = (Halftone::DitherType)msg->FindInt32(kJDDitherType);
|
fDitherType = (Halftone::DitherType)message->FindInt32(kJDDitherType);
|
||||||
else
|
else
|
||||||
fDitherType = Halftone::kTypeFloydSteinberg;
|
fDitherType = Halftone::kTypeFloydSteinberg;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDPageSelection))
|
if (message->HasInt32(kJDPageSelection))
|
||||||
fPageSelection = (PageSelection)msg->FindInt32(kJDPageSelection);
|
fPageSelection = (PageSelection)message->FindInt32(kJDPageSelection);
|
||||||
else
|
else
|
||||||
fPageSelection = kAllPages;
|
fPageSelection = kAllPages;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDMarginUnit))
|
if (message->HasInt32(kJDMarginUnit))
|
||||||
fMarginUnit = (MarginUnit)msg->FindInt32(kJDMarginUnit);
|
fMarginUnit = (MarginUnit)message->FindInt32(kJDMarginUnit);
|
||||||
else
|
else
|
||||||
fMarginUnit = kUnitInch;
|
fMarginUnit = kUnitInch;
|
||||||
|
|
||||||
if (msg->HasMessage(kJDDriverSpecificSettings))
|
if (message->HasMessage(kJDDriverSpecificSettings))
|
||||||
msg->FindMessage(kJDDriverSpecificSettings,
|
message->FindMessage(kJDDriverSpecificSettings,
|
||||||
&fDriverSpecificSettings.Message());
|
&fDriverSpecificSettings.Message());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobData::save(BMessage *msg)
|
JobData::Save(BMessage* message)
|
||||||
{
|
{
|
||||||
if (msg == NULL) {
|
if (message == NULL) {
|
||||||
msg = fMsg;
|
message = fMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// page settings
|
// page settings
|
||||||
msg->RemoveName(kJDPaper);
|
message->RemoveName(kJDPaper);
|
||||||
msg->AddInt32(kJDPaper, fPaper);
|
message->AddInt32(kJDPaper, fPaper);
|
||||||
|
|
||||||
msg->RemoveName(kJDResolution);
|
message->RemoveName(kJDResolution);
|
||||||
msg->AddInt32(kJDResolution, fResolutionID);
|
message->AddInt32(kJDResolution, fResolutionID);
|
||||||
|
|
||||||
msg->RemoveName(kJDXRes);
|
message->RemoveName(kJDXRes);
|
||||||
msg->AddInt64(kJDXRes, fXRes);
|
message->AddInt64(kJDXRes, fXRes);
|
||||||
|
|
||||||
msg->RemoveName(kJDYRes);
|
message->RemoveName(kJDYRes);
|
||||||
msg->AddInt64(kJDYRes, fYRes);
|
message->AddInt64(kJDYRes, fYRes);
|
||||||
|
|
||||||
msg->RemoveName(kJDOrientation);
|
message->RemoveName(kJDOrientation);
|
||||||
msg->AddInt32(kJDOrientation, fOrientation);
|
message->AddInt32(kJDOrientation, fOrientation);
|
||||||
|
|
||||||
msg->RemoveName(kJDScaling);
|
message->RemoveName(kJDScaling);
|
||||||
msg->AddFloat(kJDScaling, fScaling);
|
message->AddFloat(kJDScaling, fScaling);
|
||||||
|
|
||||||
msg->RemoveName(kJDPaperRect);
|
message->RemoveName(kJDPaperRect);
|
||||||
msg->AddRect(kJDPaperRect, fPaperRect);
|
message->AddRect(kJDPaperRect, fPaperRect);
|
||||||
|
|
||||||
msg->RemoveName(kJDScaledPaperRect);
|
message->RemoveName(kJDScaledPaperRect);
|
||||||
msg->AddRect(kJDScaledPaperRect, fScaledPaperRect);
|
message->AddRect(kJDScaledPaperRect, fScaledPaperRect);
|
||||||
|
|
||||||
msg->RemoveName(kJDPrintableRect);
|
message->RemoveName(kJDPrintableRect);
|
||||||
msg->AddRect(kJDPrintableRect, fPrintableRect);
|
message->AddRect(kJDPrintableRect, fPrintableRect);
|
||||||
|
|
||||||
msg->RemoveName(kJDScaledPrintableRect);
|
message->RemoveName(kJDScaledPrintableRect);
|
||||||
msg->AddRect(kJDScaledPrintableRect, fScaledPrintableRect);
|
message->AddRect(kJDScaledPrintableRect, fScaledPrintableRect);
|
||||||
|
|
||||||
msg->RemoveName(kJDPhysicalRect);
|
message->RemoveName(kJDPhysicalRect);
|
||||||
msg->AddRect(kJDPhysicalRect, fPhysicalRect);
|
message->AddRect(kJDPhysicalRect, fPhysicalRect);
|
||||||
|
|
||||||
msg->RemoveName(kJDScaledPhysicalRect);
|
message->RemoveName(kJDScaledPhysicalRect);
|
||||||
msg->AddRect(kJDScaledPhysicalRect, fScaledPhysicalRect);
|
message->AddRect(kJDScaledPhysicalRect, fScaledPhysicalRect);
|
||||||
|
|
||||||
msg->RemoveName(kJDMarginUnit);
|
message->RemoveName(kJDMarginUnit);
|
||||||
msg->AddInt32(kJDMarginUnit, fMarginUnit);
|
message->AddInt32(kJDMarginUnit, fMarginUnit);
|
||||||
|
|
||||||
// page settings end here
|
// page settings end here
|
||||||
|
|
||||||
// job settings
|
// job settings
|
||||||
|
|
||||||
// make sure job settings are not present in page settings
|
// make sure job settings are not present in page settings
|
||||||
msg->RemoveName(kJDShowPreview);
|
message->RemoveName(kJDShowPreview);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddBool(kJDShowPreview, fShowPreview);
|
message->AddBool(kJDShowPreview, fShowPreview);
|
||||||
|
|
||||||
msg->RemoveName(kJDNup);
|
message->RemoveName(kJDNup);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDNup, fNup);
|
message->AddInt32(kJDNup, fNup);
|
||||||
|
|
||||||
msg->RemoveName(kJDFirstPage);
|
message->RemoveName(kJDFirstPage);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDFirstPage, fFirstPage);
|
message->AddInt32(kJDFirstPage, fFirstPage);
|
||||||
|
|
||||||
msg->RemoveName(kJDLastPage);
|
message->RemoveName(kJDLastPage);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDLastPage, fLastPage);
|
message->AddInt32(kJDLastPage, fLastPage);
|
||||||
|
|
||||||
msg->RemoveName(kJDGamma);
|
message->RemoveName(kJDGamma);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddFloat(kJDGamma, fGamma);
|
message->AddFloat(kJDGamma, fGamma);
|
||||||
|
|
||||||
msg->RemoveName(kJDInkDensity);
|
message->RemoveName(kJDInkDensity);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddFloat(kJDInkDensity, fInkDensity);
|
message->AddFloat(kJDInkDensity, fInkDensity);
|
||||||
|
|
||||||
msg->RemoveName(kJDPaperSource);
|
message->RemoveName(kJDPaperSource);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDPaperSource, fPaperSource);
|
message->AddInt32(kJDPaperSource, fPaperSource);
|
||||||
|
|
||||||
msg->RemoveName(kJDCopies);
|
message->RemoveName(kJDCopies);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDCopies, fCopies);
|
message->AddInt32(kJDCopies, fCopies);
|
||||||
|
|
||||||
msg->RemoveName(kJDCollate);
|
message->RemoveName(kJDCollate);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddBool(kJDCollate, fCollate);
|
message->AddBool(kJDCollate, fCollate);
|
||||||
|
|
||||||
msg->RemoveName(kJDReverse);
|
message->RemoveName(kJDReverse);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddBool(kJDReverse, fReverse);
|
message->AddBool(kJDReverse, fReverse);
|
||||||
|
|
||||||
msg->RemoveName(kJDPrintStyle);
|
message->RemoveName(kJDPrintStyle);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDPrintStyle, fPrintStyle);
|
message->AddInt32(kJDPrintStyle, fPrintStyle);
|
||||||
|
|
||||||
msg->RemoveName(kJDBindingLocation);
|
message->RemoveName(kJDBindingLocation);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDBindingLocation, fBindingLocation);
|
message->AddInt32(kJDBindingLocation, fBindingLocation);
|
||||||
|
|
||||||
msg->RemoveName(kJDPageOrder);
|
message->RemoveName(kJDPageOrder);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDPageOrder, fPageOrder);
|
message->AddInt32(kJDPageOrder, fPageOrder);
|
||||||
|
|
||||||
msg->RemoveName(kJDColor);
|
message->RemoveName(kJDColor);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDColor, fColor);
|
message->AddInt32(kJDColor, fColor);
|
||||||
|
|
||||||
msg->RemoveName(kJDDitherType);
|
message->RemoveName(kJDDitherType);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDDitherType, fDitherType);
|
message->AddInt32(kJDDitherType, fDitherType);
|
||||||
|
|
||||||
msg->RemoveName(kJDPageSelection);
|
message->RemoveName(kJDPageSelection);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
msg->AddInt32(kJDPageSelection, fPageSelection);
|
message->AddInt32(kJDPageSelection, fPageSelection);
|
||||||
|
|
||||||
msg->RemoveName(kJDDriverSpecificSettings);
|
message->RemoveName(kJDDriverSpecificSettings);
|
||||||
if (fSettingType == kJobSettings)
|
if (fSettingType == kJobSettings)
|
||||||
{
|
{
|
||||||
msg->AddMessage(kJDDriverSpecificSettings,
|
message->AddMessage(kJDDriverSpecificSettings,
|
||||||
&fDriverSpecificSettings.Message());
|
&fDriverSpecificSettings.Message());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ JobSetupView::CreatePageSelectionItem(const char* name, const char* label,
|
|||||||
JobData::PageSelection pageSelection)
|
JobData::PageSelection pageSelection)
|
||||||
{
|
{
|
||||||
BRadioButton* button = new BRadioButton(name, label, NULL);
|
BRadioButton* button = new BRadioButton(name, label, NULL);
|
||||||
if (fJobData->getPageSelection() == pageSelection) {
|
if (fJobData->GetPageSelection() == pageSelection) {
|
||||||
button->SetValue(B_CONTROL_ON);
|
button->SetValue(B_CONTROL_ON);
|
||||||
}
|
}
|
||||||
return button;
|
return button;
|
||||||
@@ -207,7 +207,7 @@ JobSetupView::AttachedToWindow()
|
|||||||
fColorType = new BPopUpMenu("color");
|
fColorType = new BPopUpMenu("color");
|
||||||
fColorType->SetRadioMode(true);
|
fColorType->SetRadioMode(true);
|
||||||
FillCapabilityMenu(fColorType, kMsgQuality, PrinterCap::kColor,
|
FillCapabilityMenu(fColorType, kMsgQuality, PrinterCap::kColor,
|
||||||
fJobData->getColor());
|
fJobData->GetColor());
|
||||||
BMenuField* colorMenuField = new BMenuField("color", "Color:", fColorType);
|
BMenuField* colorMenuField = new BMenuField("color", "Color:", fColorType);
|
||||||
fColorType->SetTargetForItems(this);
|
fColorType->SetTargetForItems(this);
|
||||||
|
|
||||||
@@ -232,8 +232,8 @@ JobSetupView::AttachedToWindow()
|
|||||||
fToPage->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
|
fToPage->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
|
||||||
AllowOnlyDigits(fToPage->TextView(), 6);
|
AllowOnlyDigits(fToPage->TextView(), 6);
|
||||||
|
|
||||||
int first_page = fJobData->getFirstPage();
|
int first_page = fJobData->GetFirstPage();
|
||||||
int last_page = fJobData->getLastPage();
|
int last_page = fJobData->GetLastPage();
|
||||||
|
|
||||||
if (first_page <= 1 && last_page <= 0) {
|
if (first_page <= 1 && last_page <= 0) {
|
||||||
fAll->SetValue(B_CONTROL_ON);
|
fAll->SetValue(B_CONTROL_ON);
|
||||||
@@ -260,7 +260,7 @@ JobSetupView::AttachedToWindow()
|
|||||||
fPaperFeed = new BPopUpMenu("");
|
fPaperFeed = new BPopUpMenu("");
|
||||||
fPaperFeed->SetRadioMode(true);
|
fPaperFeed->SetRadioMode(true);
|
||||||
FillCapabilityMenu(fPaperFeed, kMsgNone, PrinterCap::kPaperSource,
|
FillCapabilityMenu(fPaperFeed, kMsgNone, PrinterCap::kPaperSource,
|
||||||
fJobData->getPaperSource());
|
fJobData->GetPaperSource());
|
||||||
BMenuField* paperSourceMenufield = new BMenuField("paperSource",
|
BMenuField* paperSourceMenufield = new BMenuField("paperSource",
|
||||||
"Paper Source:", fPaperFeed);
|
"Paper Source:", fPaperFeed);
|
||||||
|
|
||||||
@@ -268,15 +268,15 @@ JobSetupView::AttachedToWindow()
|
|||||||
fNup = new BPopUpMenu("");
|
fNup = new BPopUpMenu("");
|
||||||
fNup->SetRadioMode(true);
|
fNup->SetRadioMode(true);
|
||||||
FillCapabilityMenu(fNup, kMsgNone, gNups,
|
FillCapabilityMenu(fNup, kMsgNone, gNups,
|
||||||
sizeof(gNups) / sizeof(gNups[0]), (int)fJobData->getNup());
|
sizeof(gNups) / sizeof(gNups[0]), (int)fJobData->GetNup());
|
||||||
BMenuField* pagesPerSheet = new BMenuField("pagesPerSheet",
|
BMenuField* pagesPerSheet = new BMenuField("pagesPerSheet",
|
||||||
"Pages Per Sheet:", fNup);
|
"Pages Per Sheet:", fNup);
|
||||||
|
|
||||||
// duplex
|
// duplex
|
||||||
if (fPrinterCap->isSupport(PrinterCap::kPrintStyle)) {
|
if (fPrinterCap->IsSupport(PrinterCap::kPrintStyle)) {
|
||||||
fDuplex = new BCheckBox("duplex", "Duplex",
|
fDuplex = new BCheckBox("duplex", "Duplex",
|
||||||
new BMessage(kMsgDuplexChanged));
|
new BMessage(kMsgDuplexChanged));
|
||||||
if (fJobData->getPrintStyle() != JobData::kSimplex) {
|
if (fJobData->GetPrintStyle() != JobData::kSimplex) {
|
||||||
fDuplex->SetValue(B_CONTROL_ON);
|
fDuplex->SetValue(B_CONTROL_ON);
|
||||||
}
|
}
|
||||||
fDuplex->SetTarget(this);
|
fDuplex->SetTarget(this);
|
||||||
@@ -289,13 +289,13 @@ JobSetupView::AttachedToWindow()
|
|||||||
AllowOnlyDigits(fCopies->TextView(), 3);
|
AllowOnlyDigits(fCopies->TextView(), 3);
|
||||||
|
|
||||||
BString copies;
|
BString copies;
|
||||||
copies << fJobData->getCopies();
|
copies << fJobData->GetCopies();
|
||||||
fCopies->SetText(copies.String());
|
fCopies->SetText(copies.String());
|
||||||
|
|
||||||
// collate
|
// collate
|
||||||
fCollate = new BCheckBox("collate", "Collate",
|
fCollate = new BCheckBox("collate", "Collate",
|
||||||
new BMessage(kMsgCollateChanged));
|
new BMessage(kMsgCollateChanged));
|
||||||
if (fJobData->getCollate()) {
|
if (fJobData->GetCollate()) {
|
||||||
fCollate->SetValue(B_CONTROL_ON);
|
fCollate->SetValue(B_CONTROL_ON);
|
||||||
}
|
}
|
||||||
fCollate->SetTarget(this);
|
fCollate->SetTarget(this);
|
||||||
@@ -303,7 +303,7 @@ JobSetupView::AttachedToWindow()
|
|||||||
// reverse
|
// reverse
|
||||||
fReverse = new BCheckBox("reverse", "Reverse Order",
|
fReverse = new BCheckBox("reverse", "Reverse Order",
|
||||||
new BMessage(kMsgReverseChanged));
|
new BMessage(kMsgReverseChanged));
|
||||||
if (fJobData->getReverse()) {
|
if (fJobData->GetReverse()) {
|
||||||
fReverse->SetValue(B_CONTROL_ON);
|
fReverse->SetValue(B_CONTROL_ON);
|
||||||
}
|
}
|
||||||
fReverse->SetTarget(this);
|
fReverse->SetTarget(this);
|
||||||
@@ -312,8 +312,8 @@ JobSetupView::AttachedToWindow()
|
|||||||
// TODO make layout API compatible
|
// TODO make layout API compatible
|
||||||
fPages = new PagesView(BRect(0, 0, 150, 40), "pages", B_FOLLOW_ALL,
|
fPages = new PagesView(BRect(0, 0, 150, 40), "pages", B_FOLLOW_ALL,
|
||||||
B_WILL_DRAW);
|
B_WILL_DRAW);
|
||||||
fPages->setCollate(fJobData->getCollate());
|
fPages->SetCollate(fJobData->GetCollate());
|
||||||
fPages->setReverse(fJobData->getReverse());
|
fPages->SetReverse(fJobData->GetReverse());
|
||||||
fPages->SetExplicitMinSize(BSize(150, 40));
|
fPages->SetExplicitMinSize(BSize(150, 40));
|
||||||
fPages->SetExplicitMaxSize(BSize(150, 40));
|
fPages->SetExplicitMaxSize(BSize(150, 40));
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ JobSetupView::AttachedToWindow()
|
|||||||
"Even-Numbered Pages", JobData::kEvenNumberedPages);
|
"Even-Numbered Pages", JobData::kEvenNumberedPages);
|
||||||
|
|
||||||
fPreview = new BCheckBox("preview", "Show preview before printing", NULL);
|
fPreview = new BCheckBox("preview", "Show preview before printing", NULL);
|
||||||
if (fJobData->getShowPreview())
|
if (fJobData->GetShowPreview())
|
||||||
fPreview->SetValue(B_CONTROL_ON);
|
fPreview->SetValue(B_CONTROL_ON);
|
||||||
|
|
||||||
// separator line
|
// separator line
|
||||||
@@ -458,7 +458,7 @@ JobSetupView::AttachedToWindow()
|
|||||||
bool
|
bool
|
||||||
JobSetupView::IsHalftoneConfigurationNeeded()
|
JobSetupView::IsHalftoneConfigurationNeeded()
|
||||||
{
|
{
|
||||||
return fPrinterCap->isSupport(PrinterCap::kHalftone);
|
return fPrinterCap->IsSupport(PrinterCap::kHalftone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -470,7 +470,7 @@ JobSetupView::CreateHalftoneConfigurationUI()
|
|||||||
fDitherType->SetRadioMode(true);
|
fDitherType->SetRadioMode(true);
|
||||||
FillCapabilityMenu(fDitherType, kMsgQuality, gDitherTypes,
|
FillCapabilityMenu(fDitherType, kMsgQuality, gDitherTypes,
|
||||||
sizeof(gDitherTypes) / sizeof(gDitherTypes[0]),
|
sizeof(gDitherTypes) / sizeof(gDitherTypes[0]),
|
||||||
(int)fJobData->getDitherType());
|
(int)fJobData->GetDitherType());
|
||||||
fDitherMenuField = new BMenuField("dithering", "Dot Pattern:",
|
fDitherMenuField = new BMenuField("dithering", "Dot Pattern:",
|
||||||
fDitherType);
|
fDitherType);
|
||||||
fDitherType->SetTargetForItems(this);
|
fDitherType->SetTargetForItems(this);
|
||||||
@@ -492,7 +492,7 @@ JobSetupView::CreateHalftoneConfigurationUI()
|
|||||||
-300, 300);
|
-300, 300);
|
||||||
|
|
||||||
fGamma->SetLimitLabels("Lighter", "Darker");
|
fGamma->SetLimitLabels("Lighter", "Darker");
|
||||||
fGamma->SetValue((int32)(100 * log(fJobData->getGamma()) / log(2.0)));
|
fGamma->SetValue((int32)(100 * log(fJobData->GetGamma()) / log(2.0)));
|
||||||
fGamma->SetHashMarks(B_HASH_MARKS_BOTH);
|
fGamma->SetHashMarks(B_HASH_MARKS_BOTH);
|
||||||
fGamma->SetHashMarkCount(7);
|
fGamma->SetHashMarkCount(7);
|
||||||
fGamma->SetModificationMessage(new BMessage(kMsgQuality));
|
fGamma->SetModificationMessage(new BMessage(kMsgQuality));
|
||||||
@@ -503,7 +503,7 @@ JobSetupView::CreateHalftoneConfigurationUI()
|
|||||||
new BMessage(kMsgQuality), 0, 127);
|
new BMessage(kMsgQuality), 0, 127);
|
||||||
|
|
||||||
fInkDensity->SetLimitLabels("Min", "Max");
|
fInkDensity->SetLimitLabels("Min", "Max");
|
||||||
fInkDensity->SetValue((int32)fJobData->getInkDensity());
|
fInkDensity->SetValue((int32)fJobData->GetInkDensity());
|
||||||
fInkDensity->SetHashMarks(B_HASH_MARKS_BOTH);
|
fInkDensity->SetHashMarks(B_HASH_MARKS_BOTH);
|
||||||
fInkDensity->SetHashMarkCount(10);
|
fInkDensity->SetHashMarkCount(10);
|
||||||
fInkDensity->SetModificationMessage(new BMessage(kMsgQuality));
|
fInkDensity->SetModificationMessage(new BMessage(kMsgQuality));
|
||||||
@@ -514,11 +514,11 @@ JobSetupView::CreateHalftoneConfigurationUI()
|
|||||||
void
|
void
|
||||||
JobSetupView::AddDriverSpecificSettings(BGridLayout* gridLayout, int row)
|
JobSetupView::AddDriverSpecificSettings(BGridLayout* gridLayout, int row)
|
||||||
{
|
{
|
||||||
if (!fPrinterCap->isSupport(PrinterCap::kDriverSpecificCapabilities))
|
if (!fPrinterCap->IsSupport(PrinterCap::kDriverSpecificCapabilities))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int count = fPrinterCap->countCap(PrinterCap::kDriverSpecificCapabilities);
|
int count = fPrinterCap->CountCap(PrinterCap::kDriverSpecificCapabilities);
|
||||||
const BaseCap** capabilities = fPrinterCap->enumCap(
|
const BaseCap** capabilities = fPrinterCap->GetCaps(
|
||||||
PrinterCap::kDriverSpecificCapabilities);
|
PrinterCap::kDriverSpecificCapabilities);
|
||||||
|
|
||||||
for (int i = 0; i < count; i ++) {
|
for (int i = 0; i < count; i ++) {
|
||||||
@@ -556,9 +556,9 @@ JobSetupView::AddPopUpMenu(const DriverSpecificCap* capability,
|
|||||||
PrinterCap::CapID category = static_cast<PrinterCap::CapID>(
|
PrinterCap::CapID category = static_cast<PrinterCap::CapID>(
|
||||||
capability->ID());
|
capability->ID());
|
||||||
|
|
||||||
const BaseCap** categoryCapabilities = fPrinterCap->enumCap(category);
|
const BaseCap** categoryCapabilities = fPrinterCap->GetCaps(category);
|
||||||
|
|
||||||
int categoryCount = fPrinterCap->countCap(category);
|
int categoryCount = fPrinterCap->CountCap(category);
|
||||||
|
|
||||||
string value = GetDriverSpecificValue(category, capability->Key());
|
string value = GetDriverSpecificValue(category, capability->Key());
|
||||||
PrinterCap::KeyPredicate predicate(value.c_str());
|
PrinterCap::KeyPredicate predicate(value.c_str());
|
||||||
@@ -588,7 +588,7 @@ JobSetupView::AddCheckBox(const DriverSpecificCap* capability,
|
|||||||
{
|
{
|
||||||
PrinterCap::CapID category = static_cast<PrinterCap::CapID>(
|
PrinterCap::CapID category = static_cast<PrinterCap::CapID>(
|
||||||
capability->ID());
|
capability->ID());
|
||||||
const BooleanCap* booleanCap = fPrinterCap->findBooleanCap(category);
|
const BooleanCap* booleanCap = fPrinterCap->FindBooleanCap(category);
|
||||||
if (booleanCap == NULL) {
|
if (booleanCap == NULL) {
|
||||||
fprintf(stderr, "Internal error: BooleanCap for '%s' not found!\n",
|
fprintf(stderr, "Internal error: BooleanCap for '%s' not found!\n",
|
||||||
capability->Label());
|
capability->Label());
|
||||||
@@ -620,7 +620,7 @@ JobSetupView::AddIntSlider(const DriverSpecificCap* capability,
|
|||||||
{
|
{
|
||||||
PrinterCap::CapID category = static_cast<PrinterCap::CapID>(
|
PrinterCap::CapID category = static_cast<PrinterCap::CapID>(
|
||||||
capability->ID());
|
capability->ID());
|
||||||
const IntRangeCap* range = fPrinterCap->findIntRangeCap(category);
|
const IntRangeCap* range = fPrinterCap->FindIntRangeCap(category);
|
||||||
if (range == NULL) {
|
if (range == NULL) {
|
||||||
fprintf(stderr, "Internal error: IntRangeCap for '%s' not found!\n",
|
fprintf(stderr, "Internal error: IntRangeCap for '%s' not found!\n",
|
||||||
capability->Label());
|
capability->Label());
|
||||||
@@ -660,7 +660,7 @@ JobSetupView::AddDoubleSlider(const DriverSpecificCap* capability,
|
|||||||
{
|
{
|
||||||
PrinterCap::CapID category = static_cast<PrinterCap::CapID>(
|
PrinterCap::CapID category = static_cast<PrinterCap::CapID>(
|
||||||
capability->ID());
|
capability->ID());
|
||||||
const DoubleRangeCap* range = fPrinterCap->findDoubleRangeCap(category);
|
const DoubleRangeCap* range = fPrinterCap->FindDoubleRangeCap(category);
|
||||||
if (range == NULL) {
|
if (range == NULL) {
|
||||||
fprintf(stderr, "Internal error: DoubleRangeCap for '%s' not found!\n",
|
fprintf(stderr, "Internal error: DoubleRangeCap for '%s' not found!\n",
|
||||||
capability->Label());
|
capability->Label());
|
||||||
@@ -701,7 +701,7 @@ JobSetupView::GetDriverSpecificValue(PrinterCap::CapID category,
|
|||||||
if (fJobData->Settings().HasString(key))
|
if (fJobData->Settings().HasString(key))
|
||||||
return fJobData->Settings().GetString(key);
|
return fJobData->Settings().GetString(key);
|
||||||
|
|
||||||
const EnumCap* defaultCapability = fPrinterCap->getDefaultCap(category);
|
const EnumCap* defaultCapability = fPrinterCap->GetDefaultCap(category);
|
||||||
return defaultCapability->fKey;
|
return defaultCapability->fKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -756,8 +756,8 @@ JobSetupView::FillCapabilityMenu(BPopUpMenu* menu, uint32 message,
|
|||||||
PrinterCap::CapID category, int id)
|
PrinterCap::CapID category, int id)
|
||||||
{
|
{
|
||||||
PrinterCap::IDPredicate predicate(id);
|
PrinterCap::IDPredicate predicate(id);
|
||||||
int count = fPrinterCap->countCap(category);
|
int count = fPrinterCap->CountCap(category);
|
||||||
const BaseCap **capabilities = fPrinterCap->enumCap(category);
|
const BaseCap **capabilities = fPrinterCap->GetCaps(category);
|
||||||
FillCapabilityMenu(menu, message, capabilities, count, predicate);
|
FillCapabilityMenu(menu, message, capabilities, count, predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,11 +818,11 @@ JobSetupView::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgCollateChanged:
|
case kMsgCollateChanged:
|
||||||
fPages->setCollate(fCollate->Value() == B_CONTROL_ON);
|
fPages->SetCollate(fCollate->Value() == B_CONTROL_ON);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgReverseChanged:
|
case kMsgReverseChanged:
|
||||||
fPages->setReverse(fReverse->Value() == B_CONTROL_ON);
|
fPages->SetReverse(fReverse->Value() == B_CONTROL_ON);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgIntSliderChanged:
|
case kMsgIntSliderChanged:
|
||||||
@@ -842,7 +842,7 @@ JobSetupView::UpdateHalftonePreview()
|
|||||||
if (!IsHalftoneConfigurationNeeded())
|
if (!IsHalftoneConfigurationNeeded())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fHalftone->preview(Gamma(), InkDensity(), DitherType(),
|
fHalftone->Preview(Gamma(), InkDensity(), DitherType(),
|
||||||
Color() != JobData::kMonochrome);
|
Color() != JobData::kMonochrome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -873,7 +873,7 @@ JobData::Color
|
|||||||
JobSetupView::Color()
|
JobSetupView::Color()
|
||||||
{
|
{
|
||||||
const char *label = fColorType->FindMarked()->Label();
|
const char *label = fColorType->FindMarked()->Label();
|
||||||
const BaseCap* capability = fPrinterCap->findCap(PrinterCap::kColor, label);
|
const BaseCap* capability = fPrinterCap->FindCap(PrinterCap::kColor, label);
|
||||||
if (capability == NULL)
|
if (capability == NULL)
|
||||||
return JobData::kMonochrome;
|
return JobData::kMonochrome;
|
||||||
|
|
||||||
@@ -911,11 +911,11 @@ JobData::PaperSource
|
|||||||
JobSetupView::PaperSource()
|
JobSetupView::PaperSource()
|
||||||
{
|
{
|
||||||
const char *label = fPaperFeed->FindMarked()->Label();
|
const char *label = fPaperFeed->FindMarked()->Label();
|
||||||
const BaseCap* capability = fPrinterCap->findCap(PrinterCap::kPaperSource,
|
const BaseCap* capability = fPrinterCap->FindCap(PrinterCap::kPaperSource,
|
||||||
label);
|
label);
|
||||||
|
|
||||||
if (capability == NULL)
|
if (capability == NULL)
|
||||||
capability = fPrinterCap->getDefaultCap(PrinterCap::kPaperSource);
|
capability = fPrinterCap->GetDefaultCap(PrinterCap::kPaperSource);
|
||||||
return static_cast<const PaperSourceCap*>(capability)->fPaperSource;
|
return static_cast<const PaperSourceCap*>(capability)->fPaperSource;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -923,12 +923,12 @@ JobSetupView::PaperSource()
|
|||||||
bool
|
bool
|
||||||
JobSetupView::UpdateJobData()
|
JobSetupView::UpdateJobData()
|
||||||
{
|
{
|
||||||
fJobData->setShowPreview(fPreview->Value() == B_CONTROL_ON);
|
fJobData->SetShowPreview(fPreview->Value() == B_CONTROL_ON);
|
||||||
fJobData->setColor(Color());
|
fJobData->SetColor(Color());
|
||||||
if (IsHalftoneConfigurationNeeded()) {
|
if (IsHalftoneConfigurationNeeded()) {
|
||||||
fJobData->setGamma(Gamma());
|
fJobData->SetGamma(Gamma());
|
||||||
fJobData->setInkDensity(InkDensity());
|
fJobData->SetInkDensity(InkDensity());
|
||||||
fJobData->setDitherType(DitherType());
|
fJobData->SetDitherType(DitherType());
|
||||||
}
|
}
|
||||||
|
|
||||||
int first_page;
|
int first_page;
|
||||||
@@ -942,30 +942,30 @@ JobSetupView::UpdateJobData()
|
|||||||
last_page = atoi(fToPage->Text());
|
last_page = atoi(fToPage->Text());
|
||||||
}
|
}
|
||||||
|
|
||||||
fJobData->setFirstPage(first_page);
|
fJobData->SetFirstPage(first_page);
|
||||||
fJobData->setLastPage(last_page);
|
fJobData->SetLastPage(last_page);
|
||||||
|
|
||||||
fJobData->setPaperSource(PaperSource());
|
fJobData->SetPaperSource(PaperSource());
|
||||||
|
|
||||||
fJobData->setNup(GetID(gNups, sizeof(gNups) / sizeof(gNups[0]),
|
fJobData->SetNup(GetID(gNups, sizeof(gNups) / sizeof(gNups[0]),
|
||||||
fNup->FindMarked()->Label(), 1));
|
fNup->FindMarked()->Label(), 1));
|
||||||
|
|
||||||
if (fPrinterCap->isSupport(PrinterCap::kPrintStyle)) {
|
if (fPrinterCap->IsSupport(PrinterCap::kPrintStyle)) {
|
||||||
fJobData->setPrintStyle((B_CONTROL_ON == fDuplex->Value())
|
fJobData->SetPrintStyle((B_CONTROL_ON == fDuplex->Value())
|
||||||
? JobData::kDuplex : JobData::kSimplex);
|
? JobData::kDuplex : JobData::kSimplex);
|
||||||
}
|
}
|
||||||
|
|
||||||
fJobData->setCopies(atoi(fCopies->Text()));
|
fJobData->SetCopies(atoi(fCopies->Text()));
|
||||||
|
|
||||||
fJobData->setCollate(B_CONTROL_ON == fCollate->Value());
|
fJobData->SetCollate(B_CONTROL_ON == fCollate->Value());
|
||||||
fJobData->setReverse(B_CONTROL_ON == fReverse->Value());
|
fJobData->SetReverse(B_CONTROL_ON == fReverse->Value());
|
||||||
|
|
||||||
JobData::PageSelection pageSelection = JobData::kAllPages;
|
JobData::PageSelection pageSelection = JobData::kAllPages;
|
||||||
if (fOddNumberedPages->Value() == B_CONTROL_ON)
|
if (fOddNumberedPages->Value() == B_CONTROL_ON)
|
||||||
pageSelection = JobData::kOddNumberedPages;
|
pageSelection = JobData::kOddNumberedPages;
|
||||||
if (fEvenNumberedPages->Value() == B_CONTROL_ON)
|
if (fEvenNumberedPages->Value() == B_CONTROL_ON)
|
||||||
pageSelection = JobData::kEvenNumberedPages;
|
pageSelection = JobData::kEvenNumberedPages;
|
||||||
fJobData->setPageSelection(pageSelection);
|
fJobData->SetPageSelection(pageSelection);
|
||||||
|
|
||||||
{
|
{
|
||||||
std::map<PrinterCap::CapID, BPopUpMenu*>::iterator it =
|
std::map<PrinterCap::CapID, BPopUpMenu*>::iterator it =
|
||||||
@@ -973,11 +973,11 @@ JobSetupView::UpdateJobData()
|
|||||||
for(; it != fDriverSpecificPopUpMenus.end(); it++) {
|
for(; it != fDriverSpecificPopUpMenus.end(); it++) {
|
||||||
PrinterCap::CapID category = it->first;
|
PrinterCap::CapID category = it->first;
|
||||||
BPopUpMenu* popUpMenu = it->second;
|
BPopUpMenu* popUpMenu = it->second;
|
||||||
const char* key = fPrinterCap->findCap(
|
const char* key = fPrinterCap->FindCap(
|
||||||
PrinterCap::kDriverSpecificCapabilities, (int)category)->Key();
|
PrinterCap::kDriverSpecificCapabilities, (int)category)->Key();
|
||||||
const char* label = popUpMenu->FindMarked()->Label();
|
const char* label = popUpMenu->FindMarked()->Label();
|
||||||
const char* value = static_cast<const EnumCap*>(fPrinterCap->
|
const char* value = static_cast<const EnumCap*>(fPrinterCap->
|
||||||
findCap(category, label))->Key();
|
FindCap(category, label))->Key();
|
||||||
fJobData->Settings().SetString(key, value);
|
fJobData->Settings().SetString(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1011,7 +1011,7 @@ JobSetupView::UpdateJobData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fJobData->save();
|
fJobData->Save();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,28 +28,39 @@ enum STATUS {
|
|||||||
MATCHED
|
MATCHED
|
||||||
};
|
};
|
||||||
|
|
||||||
#define WRITE_TO_RUN_BUF(byte) { if (write) *runbuf ++ = byte; else runbuf ++; }
|
#define WRITE_TO_RUN_BUF(byte) \
|
||||||
#define WRITE_CONTROL(byte) { if (write) *control = byte; }
|
{ \
|
||||||
|
if (write) \
|
||||||
|
*runbuf ++ = byte; \
|
||||||
|
else \
|
||||||
|
runbuf ++; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define WRITE_CONTROL(byte) \
|
||||||
|
{ \
|
||||||
|
if (write) \
|
||||||
|
*control = byte; \
|
||||||
|
}
|
||||||
|
|
||||||
template <bool write>
|
template <bool write>
|
||||||
class PackBits {
|
class PackBits {
|
||||||
public:
|
public:
|
||||||
static int doIt(unsigned char *pOut, const unsigned char *pIn, int n)
|
static int Run(unsigned char* destination, const unsigned char* source, int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char *control;
|
unsigned char* control;
|
||||||
unsigned char *runbuf;
|
unsigned char* runbuf;
|
||||||
unsigned char thisbyte;
|
unsigned char thisbyte;
|
||||||
unsigned char runbyte;
|
unsigned char runbyte;
|
||||||
STATUS status;
|
STATUS status;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
status = INITIAL;
|
status = INITIAL;
|
||||||
control = runbuf = pOut;
|
control = runbuf = destination;
|
||||||
runbyte = *pIn++;
|
runbyte = *source++;
|
||||||
|
|
||||||
while (--n) {
|
while (--n) {
|
||||||
thisbyte = *pIn++;
|
thisbyte = *source++;
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case INITIAL:
|
case INITIAL:
|
||||||
control = runbuf++;
|
control = runbuf++;
|
||||||
@@ -127,21 +138,21 @@ public:
|
|||||||
}
|
}
|
||||||
WRITE_TO_RUN_BUF(runbyte);
|
WRITE_TO_RUN_BUF(runbyte);
|
||||||
|
|
||||||
return runbuf - pOut;
|
return runbuf - destination;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int pack_bits_size(const unsigned char *pIn, int n)
|
int pack_bits_size(const unsigned char* source, int size)
|
||||||
{
|
{
|
||||||
PackBits<false> calculateSize;
|
PackBits<false> compressedSizeCalculator;
|
||||||
return calculateSize.doIt(NULL, pIn, n);
|
return compressedSizeCalculator.Run(NULL, source, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pack_bits(unsigned char *pOut, const unsigned char *pIn, int n)
|
int pack_bits(unsigned char* destination, const unsigned char* source, int size)
|
||||||
{
|
{
|
||||||
PackBits<true> compress;
|
PackBits<true> compressor;
|
||||||
return compress.doIt(pOut, pIn, n);
|
return compressor.Run(destination, source, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DBG_CON_STREAM
|
#ifdef DBG_CON_STREAM
|
||||||
@@ -166,23 +177,23 @@ int main(int argc, char **argv)
|
|||||||
long size = ftell(input);
|
long size = ftell(input);
|
||||||
fseek(input, 0, SEEK_SET);
|
fseek(input, 0, SEEK_SET);
|
||||||
|
|
||||||
unsigned char *pIn = new unsigned char[size];
|
unsigned char* source = new unsigned char[size];
|
||||||
fread(pIn, size, 1, input);
|
fread(source, size, 1, input);
|
||||||
|
|
||||||
long outSize = pack_bits_size(pIn, size);
|
long outSize = pack_bits_size(source, size);
|
||||||
printf("input size: %d\noutput size: %d\n", (int)size, (int)outSize);
|
printf("input size: %d\noutput size: %d\n", (int)size, (int)outSize);
|
||||||
|
|
||||||
unsigned char *pOut = new unsigned char[outSize];
|
unsigned char* destination = new unsigned char[outSize];
|
||||||
|
|
||||||
int cnt = pack_bits(pOut, pIn, size);
|
int cnt = pack_bits(destination, source, size);
|
||||||
|
|
||||||
fwrite(pOut, cnt, 1, output);
|
fwrite(destination, cnt, 1, output);
|
||||||
|
|
||||||
fclose(input);
|
fclose(input);
|
||||||
fclose(output);
|
fclose(output);
|
||||||
|
|
||||||
delete [] pIn;
|
delete [] source;
|
||||||
delete [] pOut;
|
delete [] destination;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ PageSetupView::AddOrientationItem(const char* name, JobData::Orientation orienta
|
|||||||
|
|
||||||
fOrientation->AddItem(item);
|
fOrientation->AddItem(item);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
if (fJobData->getOrientation() == orientation) {
|
if (fJobData->GetOrientation() == orientation) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
} else if (fOrientation->CountItems() == 1) {
|
} else if (fOrientation->CountItems() == 1) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
@@ -92,9 +92,9 @@ PageSetupView::AttachedToWindow()
|
|||||||
int count;
|
int count;
|
||||||
|
|
||||||
// margin
|
// margin
|
||||||
MarginUnit units = fJobData->getMarginUnit();
|
MarginUnit units = fJobData->GetMarginUnit();
|
||||||
BRect paper = fJobData->getPaperRect();
|
BRect paper = fJobData->GetPaperRect();
|
||||||
BRect margin = fJobData->getPrintableRect();
|
BRect margin = fJobData->GetPrintableRect();
|
||||||
|
|
||||||
// re-calculate the margin from the printable rect in points
|
// re-calculate the margin from the printable rect in points
|
||||||
margin.top -= paper.top;
|
margin.top -= paper.top;
|
||||||
@@ -111,15 +111,15 @@ PageSetupView::AttachedToWindow()
|
|||||||
marked = false;
|
marked = false;
|
||||||
fPaper = new BPopUpMenu("paperSize");
|
fPaper = new BPopUpMenu("paperSize");
|
||||||
fPaper->SetRadioMode(true);
|
fPaper->SetRadioMode(true);
|
||||||
count = fPrinterCap->countCap(PrinterCap::kPaper);
|
count = fPrinterCap->CountCap(PrinterCap::kPaper);
|
||||||
PaperCap **paper_cap = (PaperCap **)fPrinterCap->enumCap(PrinterCap::kPaper);
|
PaperCap **paper_cap = (PaperCap **)fPrinterCap->GetCaps(PrinterCap::kPaper);
|
||||||
while (count--) {
|
while (count--) {
|
||||||
BMessage *msg = new BMessage(kMsgPaperChanged);
|
BMessage *msg = new BMessage(kMsgPaperChanged);
|
||||||
msg->AddPointer("paperCap", *paper_cap);
|
msg->AddPointer("paperCap", *paper_cap);
|
||||||
item = new BMenuItem((*paper_cap)->fLabel.c_str(), msg);
|
item = new BMenuItem((*paper_cap)->fLabel.c_str(), msg);
|
||||||
fPaper->AddItem(item);
|
fPaper->AddItem(item);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
if ((*paper_cap)->fPaper == fJobData->getPaper()) {
|
if ((*paper_cap)->fPaper == fJobData->GetPaper()) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
marked = true;
|
marked = true;
|
||||||
}
|
}
|
||||||
@@ -135,12 +135,12 @@ PageSetupView::AttachedToWindow()
|
|||||||
|
|
||||||
BMenuField* orientation = new BMenuField("orientation", "Orientation:", fOrientation);
|
BMenuField* orientation = new BMenuField("orientation", "Orientation:", fOrientation);
|
||||||
|
|
||||||
count = fPrinterCap->countCap(PrinterCap::kOrientation);
|
count = fPrinterCap->CountCap(PrinterCap::kOrientation);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
AddOrientationItem("Portrait", JobData::kPortrait);
|
AddOrientationItem("Portrait", JobData::kPortrait);
|
||||||
AddOrientationItem("Landscape", JobData::kLandscape);
|
AddOrientationItem("Landscape", JobData::kLandscape);
|
||||||
} else {
|
} else {
|
||||||
OrientationCap **orientation_cap = (OrientationCap **)fPrinterCap->enumCap(PrinterCap::kOrientation);
|
OrientationCap **orientation_cap = (OrientationCap **)fPrinterCap->GetCaps(PrinterCap::kOrientation);
|
||||||
while (count--) {
|
while (count--) {
|
||||||
AddOrientationItem((*orientation_cap)->fLabel.c_str(),
|
AddOrientationItem((*orientation_cap)->fLabel.c_str(),
|
||||||
(*orientation_cap)->fOrientation);
|
(*orientation_cap)->fOrientation);
|
||||||
@@ -152,14 +152,14 @@ PageSetupView::AttachedToWindow()
|
|||||||
marked = false;
|
marked = false;
|
||||||
fResolution = new BPopUpMenu("resolution");
|
fResolution = new BPopUpMenu("resolution");
|
||||||
fResolution->SetRadioMode(true);
|
fResolution->SetRadioMode(true);
|
||||||
count = fPrinterCap->countCap(PrinterCap::kResolution);
|
count = fPrinterCap->CountCap(PrinterCap::kResolution);
|
||||||
ResolutionCap **resolution_cap = (ResolutionCap **)fPrinterCap->enumCap(PrinterCap::kResolution);
|
ResolutionCap **resolution_cap = (ResolutionCap **)fPrinterCap->GetCaps(PrinterCap::kResolution);
|
||||||
while (count--) {
|
while (count--) {
|
||||||
item = new BMenuItem((*resolution_cap)->fLabel.c_str(), NULL);
|
item = new BMenuItem((*resolution_cap)->fLabel.c_str(), NULL);
|
||||||
fResolution->AddItem(item);
|
fResolution->AddItem(item);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
if (((*resolution_cap)->fXResolution == fJobData->getXres()) &&
|
if (((*resolution_cap)->fXResolution == fJobData->GetXres()) &&
|
||||||
((*resolution_cap)->fYResolution == fJobData->getYres())) {
|
((*resolution_cap)->fYResolution == fJobData->GetYres())) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
marked = true;
|
marked = true;
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ PageSetupView::AttachedToWindow()
|
|||||||
|
|
||||||
// scale
|
// scale
|
||||||
BString scale;
|
BString scale;
|
||||||
scale << (int)fJobData->getScaling();
|
scale << (int)fJobData->GetScaling();
|
||||||
fScaling = new BTextControl("scale", "Scale [%]:",
|
fScaling = new BTextControl("scale", "Scale [%]:",
|
||||||
scale.String(),
|
scale.String(),
|
||||||
NULL);
|
NULL);
|
||||||
@@ -253,32 +253,32 @@ PageSetupView::GetPaperCap()
|
|||||||
item->Message()->FindPointer("paperCap", &pointer) == B_OK) {
|
item->Message()->FindPointer("paperCap", &pointer) == B_OK) {
|
||||||
return (PaperCap*)pointer;
|
return (PaperCap*)pointer;
|
||||||
} else {
|
} else {
|
||||||
return (PaperCap*)fPrinterCap->getDefaultCap(PrinterCap::kPaper);
|
return (PaperCap*)fPrinterCap->GetDefaultCap(PrinterCap::kPaper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PageSetupView::UpdateJobData()
|
PageSetupView::UpdateJobData()
|
||||||
{
|
{
|
||||||
fJobData->setOrientation(GetOrientation());
|
fJobData->SetOrientation(GetOrientation());
|
||||||
|
|
||||||
PaperCap *paperCap = GetPaperCap();
|
PaperCap *paperCap = GetPaperCap();
|
||||||
BRect paper_rect = paperCap->fPaperRect;
|
BRect paper_rect = paperCap->fPaperRect;
|
||||||
BRect physical_rect = paperCap->fPhysicalRect;
|
BRect physical_rect = paperCap->fPhysicalRect;
|
||||||
fJobData->setPaper(paperCap->fPaper);
|
fJobData->SetPaper(paperCap->fPaper);
|
||||||
|
|
||||||
const char *resolutionLabel = fResolution->FindMarked()->Label();
|
const char *resolutionLabel = fResolution->FindMarked()->Label();
|
||||||
const ResolutionCap* resolution = static_cast<const ResolutionCap*>(
|
const ResolutionCap* resolution = static_cast<const ResolutionCap*>(
|
||||||
fPrinterCap->findCap(PrinterCap::kResolution, resolutionLabel));
|
fPrinterCap->FindCap(PrinterCap::kResolution, resolutionLabel));
|
||||||
ASSERT(resolution != NULL);
|
ASSERT(resolution != NULL);
|
||||||
if (resolution != NULL) {
|
if (resolution != NULL) {
|
||||||
fJobData->setXres(resolution->fXResolution);
|
fJobData->SetXres(resolution->fXResolution);
|
||||||
fJobData->setYres(resolution->fYResolution);
|
fJobData->SetYres(resolution->fYResolution);
|
||||||
fJobData->setResolutionID(resolution->ID());
|
fJobData->SetResolutionID(resolution->ID());
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotate paper and physical rectangle if landscape orientation
|
// rotate paper and physical rectangle if landscape orientation
|
||||||
if (JobData::kLandscape == fJobData->getOrientation()) {
|
if (JobData::kLandscape == fJobData->GetOrientation()) {
|
||||||
swap(&paper_rect.left, &paper_rect.top);
|
swap(&paper_rect.left, &paper_rect.top);
|
||||||
swap(&paper_rect.right, &paper_rect.bottom);
|
swap(&paper_rect.right, &paper_rect.bottom);
|
||||||
swap(&physical_rect.left, &physical_rect.top);
|
swap(&physical_rect.left, &physical_rect.top);
|
||||||
@@ -286,7 +286,7 @@ PageSetupView::UpdateJobData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// adjust printable rect by margin
|
// adjust printable rect by margin
|
||||||
fJobData->setMarginUnit(fMarginView->Unit());
|
fJobData->SetMarginUnit(fMarginView->Unit());
|
||||||
BRect margin = fMarginView->Margin();
|
BRect margin = fMarginView->Margin();
|
||||||
BRect printable_rect;
|
BRect printable_rect;
|
||||||
printable_rect.left = paper_rect.left + margin.left;
|
printable_rect.left = paper_rect.left + margin.left;
|
||||||
@@ -309,15 +309,15 @@ PageSetupView::UpdateJobData()
|
|||||||
|
|
||||||
float scalingR = 100.0 / scaling;
|
float scalingR = 100.0 / scaling;
|
||||||
|
|
||||||
fJobData->setScaling(scaling);
|
fJobData->SetScaling(scaling);
|
||||||
fJobData->setPaperRect(paper_rect);
|
fJobData->SetPaperRect(paper_rect);
|
||||||
fJobData->setScaledPaperRect(ScaleRect(paper_rect, scalingR));
|
fJobData->SetScaledPaperRect(ScaleRect(paper_rect, scalingR));
|
||||||
fJobData->setPrintableRect(printable_rect);
|
fJobData->SetPrintableRect(printable_rect);
|
||||||
fJobData->setScaledPrintableRect(ScaleRect(printable_rect, scalingR));
|
fJobData->SetScaledPrintableRect(ScaleRect(printable_rect, scalingR));
|
||||||
fJobData->setPhysicalRect(physical_rect);
|
fJobData->SetPhysicalRect(physical_rect);
|
||||||
fJobData->setScaledPhysicalRect(ScaleRect(physical_rect, scalingR));
|
fJobData->SetScaledPhysicalRect(ScaleRect(physical_rect, scalingR));
|
||||||
|
|
||||||
fJobData->save();
|
fJobData->Save();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,20 +40,20 @@ void PagesView::Draw(BRect rect)
|
|||||||
BPoint position(3, 3);
|
BPoint position(3, 3);
|
||||||
if (fCollate) {
|
if (fCollate) {
|
||||||
BPoint next(kPageWidth + kPageHorizontalIndent * 2 + 10, 0);
|
BPoint next(kPageWidth + kPageHorizontalIndent * 2 + 10, 0);
|
||||||
DrawPages(position, 1, 3);
|
_DrawPages(position, 1, 3);
|
||||||
position += next;
|
position += next;
|
||||||
DrawPages(position, 1, 3);
|
_DrawPages(position, 1, 3);
|
||||||
} else {
|
} else {
|
||||||
BPoint next(kPageWidth + kPageHorizontalIndent * 1 + 10, 0);
|
BPoint next(kPageWidth + kPageHorizontalIndent * 1 + 10, 0);
|
||||||
for (int i = 1; i <= 3; i ++) {
|
for (int i = 1; i <= 3; i ++) {
|
||||||
int page = fReverse ? 4 - i : i;
|
int page = fReverse ? 4 - i : i;
|
||||||
DrawPages(position, page, 2);
|
_DrawPages(position, page, 2);
|
||||||
position += next;
|
position += next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PagesView::DrawPages(BPoint position, int number, int count)
|
void PagesView::_DrawPages(BPoint position, int number, int count)
|
||||||
{
|
{
|
||||||
position.x += kPageHorizontalIndent * (count - 1);
|
position.x += kPageHorizontalIndent * (count - 1);
|
||||||
BPoint next(-kPageHorizontalIndent, kPageVerticalIndent);
|
BPoint next(-kPageHorizontalIndent, kPageVerticalIndent);
|
||||||
@@ -65,18 +65,18 @@ void PagesView::DrawPages(BPoint position, int number, int count)
|
|||||||
} else {
|
} else {
|
||||||
page = count - i;
|
page = count - i;
|
||||||
}
|
}
|
||||||
DrawPage(position, page);
|
_DrawPage(position, page);
|
||||||
position += next;
|
position += next;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < count; i ++) {
|
for (int i = 0; i < count; i ++) {
|
||||||
DrawPage(position, number);
|
_DrawPage(position, number);
|
||||||
position += next;
|
position += next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PagesView::DrawPage(BPoint position, int number)
|
void PagesView::_DrawPage(BPoint position, int number)
|
||||||
{
|
{
|
||||||
const rgb_color pageBackgroundColor = {255, 255, 255};
|
const rgb_color pageBackgroundColor = {255, 255, 255};
|
||||||
const rgb_color pageBorderColor = {0, 0, 0};
|
const rgb_color pageBorderColor = {0, 0, 0};
|
||||||
@@ -109,13 +109,13 @@ void PagesView::DrawPage(BPoint position, int number)
|
|||||||
BPoint(kPageWidth - kPageHorizontalIndent + 1, kPageHeight - 2));
|
BPoint(kPageWidth - kPageHorizontalIndent + 1, kPageHeight - 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PagesView::setCollate(bool collate)
|
void PagesView::SetCollate(bool collate)
|
||||||
{
|
{
|
||||||
fCollate = collate;
|
fCollate = collate;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PagesView::setReverse(bool reverse)
|
void PagesView::SetReverse(bool reverse)
|
||||||
{
|
{
|
||||||
fReverse = reverse;
|
fReverse = reverse;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ PrintJobReader::PrintJobReader(BFile* jobFile)
|
|||||||
fNumberOfPages = header.page_count;
|
fNumberOfPages = header.page_count;
|
||||||
fPageIndex = new off_t[fNumberOfPages];
|
fPageIndex = new off_t[fNumberOfPages];
|
||||||
|
|
||||||
BuildPageIndex();
|
_BuildPageIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ status_t PrintJobReader::InitCheck() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintJobReader::BuildPageIndex()
|
void PrintJobReader::_BuildPageIndex()
|
||||||
{
|
{
|
||||||
off_t next_page;
|
off_t next_page;
|
||||||
int32 number_of_pictures;
|
int32 number_of_pictures;
|
||||||
|
|||||||
@@ -296,13 +296,13 @@ PrinterCap::~PrinterCap()
|
|||||||
|
|
||||||
|
|
||||||
const EnumCap*
|
const EnumCap*
|
||||||
PrinterCap::getDefaultCap(CapID category) const
|
PrinterCap::GetDefaultCap(CapID category) const
|
||||||
{
|
{
|
||||||
int count = countCap(category);
|
int count = CountCap(category);
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const BaseCap **base_cap = enumCap(category);
|
const BaseCap **base_cap = GetCaps(category);
|
||||||
while (count--) {
|
while (count--) {
|
||||||
const EnumCap* enumCap = dynamic_cast<const EnumCap*>(*base_cap);
|
const EnumCap* enumCap = dynamic_cast<const EnumCap*>(*base_cap);
|
||||||
if (enumCap == NULL)
|
if (enumCap == NULL)
|
||||||
@@ -315,19 +315,19 @@ PrinterCap::getDefaultCap(CapID category) const
|
|||||||
base_cap++;
|
base_cap++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<const EnumCap*>(enumCap(category)[0]);
|
return static_cast<const EnumCap*>(GetCaps(category)[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Predicate>
|
template<typename Predicate>
|
||||||
const BaseCap*
|
const BaseCap*
|
||||||
PrinterCap::findCap(CapID category, Predicate& predicate) const
|
PrinterCap::FindCap(CapID category, Predicate& predicate) const
|
||||||
{
|
{
|
||||||
int count = countCap(category);
|
int count = CountCap(category);
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const BaseCap **base_cap = enumCap(category);
|
const BaseCap **base_cap = GetCaps(category);
|
||||||
while (count--) {
|
while (count--) {
|
||||||
if (predicate(*base_cap)) {
|
if (predicate(*base_cap)) {
|
||||||
return *base_cap;
|
return *base_cap;
|
||||||
@@ -339,64 +339,64 @@ PrinterCap::findCap(CapID category, Predicate& predicate) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EnumCap*
|
const EnumCap*
|
||||||
PrinterCap::findCap(CapID category, int id) const
|
PrinterCap::FindCap(CapID category, int id) const
|
||||||
{
|
{
|
||||||
IDPredicate predicate(id);
|
IDPredicate predicate(id);
|
||||||
return static_cast<const EnumCap*>(findCap(category, predicate));
|
return static_cast<const EnumCap*>(FindCap(category, predicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BaseCap*
|
const BaseCap*
|
||||||
PrinterCap::findCap(CapID category, const char* label) const
|
PrinterCap::FindCap(CapID category, const char* label) const
|
||||||
{
|
{
|
||||||
LabelPredicate predicate(label);
|
LabelPredicate predicate(label);
|
||||||
return findCap(category, predicate);
|
return FindCap(category, predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const EnumCap*
|
const EnumCap*
|
||||||
PrinterCap::findCapWithKey(CapID category, const char* key) const
|
PrinterCap::FindCapWithKey(CapID category, const char* key) const
|
||||||
{
|
{
|
||||||
KeyPredicate predicate(key);
|
KeyPredicate predicate(key);
|
||||||
return static_cast<const EnumCap*>(findCap(category, predicate));
|
return static_cast<const EnumCap*>(FindCap(category, predicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BooleanCap*
|
const BooleanCap*
|
||||||
PrinterCap::findBooleanCap(CapID category) const
|
PrinterCap::FindBooleanCap(CapID category) const
|
||||||
{
|
{
|
||||||
if (countCap(category) != 1)
|
if (CountCap(category) != 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
return dynamic_cast<const BooleanCap*>(enumCap(category)[0]);
|
return dynamic_cast<const BooleanCap*>(GetCaps(category)[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const IntRangeCap*
|
const IntRangeCap*
|
||||||
PrinterCap::findIntRangeCap(CapID category) const
|
PrinterCap::FindIntRangeCap(CapID category) const
|
||||||
{
|
{
|
||||||
if (countCap(category) != 1)
|
if (CountCap(category) != 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
return dynamic_cast<const IntRangeCap*>(enumCap(category)[0]);
|
return dynamic_cast<const IntRangeCap*>(GetCaps(category)[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const DoubleRangeCap*
|
const DoubleRangeCap*
|
||||||
PrinterCap::findDoubleRangeCap(CapID category) const
|
PrinterCap::FindDoubleRangeCap(CapID category) const
|
||||||
{
|
{
|
||||||
if (countCap(category) != 1)
|
if (CountCap(category) != 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
return dynamic_cast<const DoubleRangeCap*>(enumCap(category)[0]);
|
return dynamic_cast<const DoubleRangeCap*>(GetCaps(category)[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PrinterCap::getProtocolClass() const {
|
PrinterCap::GetProtocolClass() const {
|
||||||
return fPrinterData->getProtocolClass();
|
return fPrinterData->GetProtocolClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const
|
const PrinterData*
|
||||||
PrinterData *PrinterCap::getPrinterData() const
|
PrinterCap::GetPrinterData() const
|
||||||
{
|
{
|
||||||
return fPrinterData;
|
return fPrinterData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,17 +16,22 @@ const char *PD_COMMENTS = "Comments";
|
|||||||
const char *PD_TRANSPORT = "transport";
|
const char *PD_TRANSPORT = "transport";
|
||||||
const char *PD_PROTOCOL_CLASS = "libprint:protocolClass";
|
const char *PD_PROTOCOL_CLASS = "libprint:protocolClass";
|
||||||
|
|
||||||
|
|
||||||
PrinterData::PrinterData(BNode *node)
|
PrinterData::PrinterData(BNode *node)
|
||||||
: fNode(node),
|
:
|
||||||
|
fNode(node),
|
||||||
fProtocolClass(0)
|
fProtocolClass(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PrinterData::~PrinterData()
|
PrinterData::~PrinterData()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrinterData::load()
|
|
||||||
|
void
|
||||||
|
PrinterData::Load()
|
||||||
{
|
{
|
||||||
if (fNode == NULL) return;
|
if (fNode == NULL) return;
|
||||||
|
|
||||||
@@ -47,26 +52,36 @@ void PrinterData::load()
|
|||||||
fProtocolClass = (int)valueI32;
|
fProtocolClass = (int)valueI32;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrinterData::save()
|
|
||||||
|
void
|
||||||
|
PrinterData::Save()
|
||||||
{
|
{
|
||||||
if (fNode == NULL) return;
|
if (fNode == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
int32 valueI32 = (int32)fProtocolClass;
|
int32 valueI32 = (int32)fProtocolClass;
|
||||||
fNode->WriteAttr(PD_PROTOCOL_CLASS, B_INT32_TYPE, 0, &valueI32, sizeof(valueI32));
|
fNode->WriteAttr(PD_PROTOCOL_CLASS, B_INT32_TYPE, 0, &valueI32,
|
||||||
|
sizeof(valueI32));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrinterData::getPath(string &path) const
|
|
||||||
|
bool
|
||||||
|
PrinterData::GetPath(string &path) const
|
||||||
{
|
{
|
||||||
if (fNode == NULL) return false;
|
if (fNode == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
node_ref nref;
|
node_ref nref;
|
||||||
if (fNode->GetNodeRef(&nref) != B_OK) return false;
|
if (fNode->GetNodeRef(&nref) != B_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
BDirectory dir(&nref);
|
BDirectory dir(&nref);
|
||||||
if (dir.InitCheck() != B_OK) return false;
|
if (dir.InitCheck() != B_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
BPath path0(&dir, ".");
|
BPath path0(&dir, ".");
|
||||||
if (path0.InitCheck() != B_OK) return false;
|
if (path0.InitCheck() != B_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
path = path0.Path();
|
path = path0.Path();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ PrinterDriver::InstantiatePrinterData(BNode* node)
|
|||||||
void
|
void
|
||||||
PrinterDriver::InitPrinterDataAndCap() {
|
PrinterDriver::InitPrinterDataAndCap() {
|
||||||
fPrinterData = InstantiatePrinterData(fSpoolFolder);
|
fPrinterData = InstantiatePrinterData(fSpoolFolder);
|
||||||
fPrinterData->load();
|
fPrinterData->Load();
|
||||||
// NOTE: moved the load above from the constructor of PrinterData as
|
// NOTE: moved the load above from the constructor of PrinterData as
|
||||||
// we're inheriting from PrinterData and want our overridden versions
|
// we're inheriting from PrinterData and want our overridden versions
|
||||||
// of load to be called
|
// of load to be called
|
||||||
@@ -89,8 +89,8 @@ PrinterDriver::AddPrinter(char* printerName)
|
|||||||
DBGMSG(("\tprinter_name: %s\n", printerName));
|
DBGMSG(("\tprinter_name: %s\n", printerName));
|
||||||
DBGMSG(("<%s: add_printer\n", GetDriverName()));
|
DBGMSG(("<%s: add_printer\n", GetDriverName()));
|
||||||
|
|
||||||
if (fPrinterCap->isSupport(PrinterCap::kProtocolClass)) {
|
if (fPrinterCap->IsSupport(PrinterCap::kProtocolClass)) {
|
||||||
if (fPrinterCap->countCap(PrinterCap::kProtocolClass) > 1) {
|
if (fPrinterCap->CountCap(PrinterCap::kProtocolClass) > 1) {
|
||||||
AddPrinterDlg *dialog;
|
AddPrinterDlg *dialog;
|
||||||
dialog = new AddPrinterDlg(fPrinterData, fPrinterCap);
|
dialog = new AddPrinterDlg(fPrinterData, fPrinterCap);
|
||||||
if (dialog->Go() != B_OK) {
|
if (dialog->Go() != B_OK) {
|
||||||
@@ -99,10 +99,11 @@ PrinterDriver::AddPrinter(char* printerName)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const ProtocolClassCap* pcCap;
|
const ProtocolClassCap* pcCap;
|
||||||
pcCap = (const ProtocolClassCap*)fPrinterCap->getDefaultCap(PrinterCap::kProtocolClass);
|
pcCap = (const ProtocolClassCap*)fPrinterCap->GetDefaultCap(
|
||||||
|
PrinterCap::kProtocolClass);
|
||||||
if (pcCap != NULL) {
|
if (pcCap != NULL) {
|
||||||
fPrinterData->setProtocolClass(pcCap->fProtocolClass);
|
fPrinterData->SetProtocolClass(pcCap->fProtocolClass);
|
||||||
fPrinterData->save();
|
fPrinterData->Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,10 +118,10 @@ PrinterDriver::ConfigPage(BMessage* settings)
|
|||||||
DUMP_BNODE(fSpoolFolder);
|
DUMP_BNODE(fSpoolFolder);
|
||||||
|
|
||||||
BMessage pageSettings(*settings);
|
BMessage pageSettings(*settings);
|
||||||
MergeWithPreviousSettings(kAttrPageSettings, &pageSettings);
|
_MergeWithPreviousSettings(kAttrPageSettings, &pageSettings);
|
||||||
UIDriver drv(&pageSettings, fPrinterData, fPrinterCap);
|
UIDriver uiDriver(&pageSettings, fPrinterData, fPrinterCap);
|
||||||
BMessage *result = drv.configPage();
|
BMessage *result = uiDriver.ConfigPage();
|
||||||
WriteSettings(kAttrPageSettings, result);
|
_WriteSettings(kAttrPageSettings, result);
|
||||||
|
|
||||||
DUMP_BMESSAGE(result);
|
DUMP_BMESSAGE(result);
|
||||||
DBGMSG(("<%s: config_page\n", GetDriverName()));
|
DBGMSG(("<%s: config_page\n", GetDriverName()));
|
||||||
@@ -135,10 +136,10 @@ PrinterDriver::ConfigJob(BMessage* settings)
|
|||||||
DUMP_BNODE(fSpoolFolder);
|
DUMP_BNODE(fSpoolFolder);
|
||||||
|
|
||||||
BMessage jobSettings(*settings);
|
BMessage jobSettings(*settings);
|
||||||
MergeWithPreviousSettings(kAttrJobSettings, &jobSettings);
|
_MergeWithPreviousSettings(kAttrJobSettings, &jobSettings);
|
||||||
UIDriver drv(&jobSettings, fPrinterData, fPrinterCap);
|
UIDriver uiDriver(&jobSettings, fPrinterData, fPrinterCap);
|
||||||
BMessage *result = drv.configJob();
|
BMessage *result = uiDriver.ConfigJob();
|
||||||
WriteSettings(kAttrJobSettings, result);
|
_WriteSettings(kAttrJobSettings, result);
|
||||||
|
|
||||||
DUMP_BMESSAGE(result);
|
DUMP_BMESSAGE(result);
|
||||||
DBGMSG(("<%s: config_job\n", GetDriverName()));
|
DBGMSG(("<%s: config_job\n", GetDriverName()));
|
||||||
@@ -154,7 +155,7 @@ PrinterDriver::TakeJob(BFile* printJob, BMessage* settings)
|
|||||||
|
|
||||||
fGraphicsDriver = InstantiateGraphicsDriver(settings, fPrinterData, fPrinterCap);
|
fGraphicsDriver = InstantiateGraphicsDriver(settings, fPrinterData, fPrinterCap);
|
||||||
const JobData* jobData = fGraphicsDriver->GetJobData(printJob);
|
const JobData* jobData = fGraphicsDriver->GetJobData(printJob);
|
||||||
if (jobData != NULL && jobData->getShowPreview()) {
|
if (jobData != NULL && jobData->GetShowPreview()) {
|
||||||
off_t offset = printJob->Position();
|
off_t offset = printJob->Position();
|
||||||
PreviewWindow *preview = new PreviewWindow(printJob, true);
|
PreviewWindow *preview = new PreviewWindow(printJob, true);
|
||||||
if (preview->Go() != B_OK) {
|
if (preview->Go() != B_OK) {
|
||||||
@@ -171,7 +172,7 @@ PrinterDriver::TakeJob(BFile* printJob, BMessage* settings)
|
|||||||
|
|
||||||
// read settings from spool folder attribute
|
// read settings from spool folder attribute
|
||||||
bool
|
bool
|
||||||
PrinterDriver::ReadSettings(const char* attrName, BMessage* settings)
|
PrinterDriver::_ReadSettings(const char* attrName, BMessage* settings)
|
||||||
{
|
{
|
||||||
attr_info info;
|
attr_info info;
|
||||||
char* data;
|
char* data;
|
||||||
@@ -192,7 +193,7 @@ PrinterDriver::ReadSettings(const char* attrName, BMessage* settings)
|
|||||||
|
|
||||||
// write settings to spool folder attribute
|
// write settings to spool folder attribute
|
||||||
void
|
void
|
||||||
PrinterDriver::WriteSettings(const char* attrName, BMessage* settings)
|
PrinterDriver::_WriteSettings(const char* attrName, BMessage* settings)
|
||||||
{
|
{
|
||||||
if (settings == NULL || settings->what != 'okok') return;
|
if (settings == NULL || settings->what != 'okok') return;
|
||||||
|
|
||||||
@@ -210,12 +211,12 @@ PrinterDriver::WriteSettings(const char* attrName, BMessage* settings)
|
|||||||
|
|
||||||
// read settings from spool folder attribute and merge them to current settings
|
// read settings from spool folder attribute and merge them to current settings
|
||||||
void
|
void
|
||||||
PrinterDriver::MergeWithPreviousSettings(const char* attrName, BMessage* settings)
|
PrinterDriver::_MergeWithPreviousSettings(const char* attrName, BMessage* settings)
|
||||||
{
|
{
|
||||||
if (settings == NULL) return;
|
if (settings == NULL) return;
|
||||||
|
|
||||||
BMessage stored;
|
BMessage stored;
|
||||||
if (ReadSettings(attrName, &stored)) {
|
if (_ReadSettings(attrName, &stored)) {
|
||||||
AddFields(&stored, settings);
|
AddFields(&stored, settings);
|
||||||
*settings = stored;
|
*settings = stored;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,15 +14,14 @@ SpoolMetaData::SpoolMetaData(BFile* spool_file)
|
|||||||
{
|
{
|
||||||
BString string;
|
BString string;
|
||||||
time_t time;
|
time_t time;
|
||||||
if (spool_file->ReadAttrString(kSDDescription, &string) == B_OK) {
|
if (spool_file->ReadAttrString(kSDDescription, &string) == B_OK)
|
||||||
fDescription = string.String();
|
fDescription = string.String();
|
||||||
}
|
|
||||||
if (spool_file->ReadAttrString(kSDMimeType, &string) == B_OK) {
|
if (spool_file->ReadAttrString(kSDMimeType, &string) == B_OK)
|
||||||
fMimeType = string.String();
|
fMimeType = string.String();
|
||||||
}
|
|
||||||
if (spool_file->GetCreationTime(&time) == B_OK) {
|
if (spool_file->GetCreationTime(&time) == B_OK)
|
||||||
fCreationTime = ctime(&time);
|
fCreationTime = ctime(&time);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -30,3 +29,23 @@ SpoolMetaData::~SpoolMetaData()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const string&
|
||||||
|
SpoolMetaData::GetDescription() const
|
||||||
|
{
|
||||||
|
return fDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const string&
|
||||||
|
SpoolMetaData::GetMimeType() const
|
||||||
|
{
|
||||||
|
return fMimeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const string&
|
||||||
|
SpoolMetaData::GetCreationTime() const
|
||||||
|
{
|
||||||
|
return fCreationTime;
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,28 +19,48 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
Transport::Transport(const PrinterData *printer_data)
|
TransportException::TransportException(const string& what)
|
||||||
: fImage(-1), fInitTransport(0), fExitTransport(0), fDataStream(0), fAbort(false)
|
:
|
||||||
|
fWhat(what)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
TransportException::What() const
|
||||||
|
{
|
||||||
|
return fWhat.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Transport::Transport(const PrinterData *printerData)
|
||||||
|
:
|
||||||
|
fImage(-1),
|
||||||
|
fInitTransport(0),
|
||||||
|
fExitTransport(0),
|
||||||
|
fDataStream(0),
|
||||||
|
fAbort(false)
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
|
|
||||||
if (B_OK == find_directory(B_USER_ADDONS_DIRECTORY, &path)) {
|
if (B_OK == find_directory(B_USER_ADDONS_DIRECTORY, &path)) {
|
||||||
path.Append("Print/transport");
|
path.Append("Print/transport");
|
||||||
path.Append(printer_data->getTransport().c_str());
|
path.Append(printerData->GetTransport().c_str());
|
||||||
DBGMSG(("load_add_on: %s\n", path.Path()));
|
DBGMSG(("load_add_on: %s\n", path.Path()));
|
||||||
fImage = load_add_on(path.Path());
|
fImage = load_add_on(path.Path());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fImage < 0) {
|
if (fImage < 0) {
|
||||||
if (B_OK == find_directory(B_BEOS_ADDONS_DIRECTORY, &path)) {
|
if (B_OK == find_directory(B_BEOS_ADDONS_DIRECTORY, &path)) {
|
||||||
path.Append("Print/transport");
|
path.Append("Print/transport");
|
||||||
path.Append(printer_data->getTransport().c_str());
|
path.Append(printerData->GetTransport().c_str());
|
||||||
DBGMSG(("load_add_on: %s\n", path.Path()));
|
DBGMSG(("load_add_on: %s\n", path.Path()));
|
||||||
fImage = load_add_on(path.Path());
|
fImage = load_add_on(path.Path());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fImage < 0) {
|
if (fImage < 0) {
|
||||||
set_last_error("cannot load a transport add-on");
|
SetLastError("cannot load a transport add-on");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,24 +70,24 @@ Transport::Transport(const PrinterData *printer_data)
|
|||||||
get_image_symbol(fImage, "exit_transport", B_SYMBOL_TYPE_TEXT, (void **)&fExitTransport);
|
get_image_symbol(fImage, "exit_transport", B_SYMBOL_TYPE_TEXT, (void **)&fExitTransport);
|
||||||
|
|
||||||
if (fInitTransport == NULL) {
|
if (fInitTransport == NULL) {
|
||||||
set_last_error("get_image_symbol failed.");
|
SetLastError("get_image_symbol failed.");
|
||||||
DBGMSG(("init_transport is NULL\n"));
|
DBGMSG(("init_transport is NULL\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fExitTransport == NULL) {
|
if (fExitTransport == NULL) {
|
||||||
set_last_error("get_image_symbol failed.");
|
SetLastError("get_image_symbol failed.");
|
||||||
DBGMSG(("exit_transport is NULL\n"));
|
DBGMSG(("exit_transport is NULL\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fInitTransport) {
|
if (fInitTransport) {
|
||||||
string spool_path;
|
string spool_path;
|
||||||
printer_data->getPath(spool_path);
|
printerData->GetPath(spool_path);
|
||||||
BMessage *msg = new BMessage('TRIN');
|
BMessage *msg = new BMessage('TRIN');
|
||||||
msg->AddString("printer_file", spool_path.c_str());
|
msg->AddString("printer_file", spool_path.c_str());
|
||||||
fDataStream = (*fInitTransport)(msg);
|
fDataStream = (*fInitTransport)(msg);
|
||||||
delete msg;
|
delete msg;
|
||||||
if (fDataStream == 0) {
|
if (fDataStream == 0) {
|
||||||
set_last_error("init_transport failed.");
|
SetLastError("init_transport failed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,21 +105,21 @@ Transport::~Transport()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Transport::check_abort() const
|
Transport::CheckAbort() const
|
||||||
{
|
{
|
||||||
return fDataStream == 0;
|
return fDataStream == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
string &Transport::last_error() const
|
string &Transport::LastError() const
|
||||||
{
|
{
|
||||||
return fLastErrorString;
|
return fLastErrorString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Transport::is_print_to_file_canceled() const
|
Transport::IsPrintToFileCanceled() const
|
||||||
{
|
{
|
||||||
// The BeOS "Print To File" transport add-on returns a non-NULL BDataIO *
|
// The BeOS "Print To File" transport add-on returns a non-NULL BDataIO *
|
||||||
// even after user filepanel cancellation!
|
// even after user filepanel cancellation!
|
||||||
@@ -109,7 +129,7 @@ Transport::is_print_to_file_canceled() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Transport::set_last_error(const char *e)
|
Transport::SetLastError(const char *e)
|
||||||
{
|
{
|
||||||
fLastErrorString = e;
|
fLastErrorString = e;
|
||||||
fAbort = true;
|
fAbort = true;
|
||||||
@@ -117,13 +137,13 @@ Transport::set_last_error(const char *e)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Transport::write(const void *buffer, size_t size) throw(TransportException)
|
Transport::Write(const void* buffer, size_t size) throw(TransportException)
|
||||||
{
|
{
|
||||||
if (fDataStream) {
|
if (fDataStream) {
|
||||||
if (size == (size_t)fDataStream->Write(buffer, size)) {
|
if (size == (size_t)fDataStream->Write(buffer, size)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
set_last_error("BDataIO::Write failed.");
|
SetLastError("BDataIO::Write failed.");
|
||||||
}
|
}
|
||||||
throw TransportException(last_error());
|
throw TransportException(LastError());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,12 @@
|
|||||||
#include "DbgMsg.h"
|
#include "DbgMsg.h"
|
||||||
|
|
||||||
|
|
||||||
UIDriver::UIDriver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap)
|
UIDriver::UIDriver(BMessage* message, PrinterData *printerData,
|
||||||
: fMsg(msg), fPrinterData(printer_data), fPrinterCap(printer_cap)
|
const PrinterCap *printerCap)
|
||||||
|
:
|
||||||
|
fMsg(message),
|
||||||
|
fPrinterData(printerData),
|
||||||
|
fPrinterCap(printerCap)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,52 +29,56 @@ UIDriver::~UIDriver()
|
|||||||
|
|
||||||
|
|
||||||
BMessage*
|
BMessage*
|
||||||
UIDriver::configPage()
|
UIDriver::ConfigPage()
|
||||||
{
|
{
|
||||||
BMessage *clone_msg = new BMessage(*fMsg);
|
BMessage *clonedMessage = new BMessage(*fMsg);
|
||||||
JobData *job_data = new JobData(clone_msg, fPrinterCap, JobData::kPageSettings);
|
JobData *jobData = new JobData(clonedMessage, fPrinterCap,
|
||||||
|
JobData::kPageSettings);
|
||||||
|
|
||||||
if (doPageSetup(job_data,fPrinterData, fPrinterCap) < 0) {
|
if (PageSetup(jobData, fPrinterData, fPrinterCap) < 0) {
|
||||||
delete clone_msg;
|
delete clonedMessage;
|
||||||
clone_msg = NULL;
|
clonedMessage = NULL;
|
||||||
} else {
|
} else {
|
||||||
clone_msg->what = 'okok';
|
clonedMessage->what = 'okok';
|
||||||
}
|
}
|
||||||
|
|
||||||
delete job_data;
|
delete jobData;
|
||||||
return clone_msg;
|
return clonedMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BMessage*
|
BMessage*
|
||||||
UIDriver::configJob()
|
UIDriver::ConfigJob()
|
||||||
{
|
{
|
||||||
BMessage *clone_msg = new BMessage(*fMsg);
|
BMessage *clonedMessage = new BMessage(*fMsg);
|
||||||
JobData *job_data = new JobData(clone_msg, fPrinterCap, JobData::kJobSettings);
|
JobData *jobData = new JobData(clonedMessage, fPrinterCap,
|
||||||
|
JobData::kJobSettings);
|
||||||
|
|
||||||
if (doJobSetup(job_data, fPrinterData, fPrinterCap) < 0) {
|
if (JobSetup(jobData, fPrinterData, fPrinterCap) < 0) {
|
||||||
delete clone_msg;
|
delete clonedMessage;
|
||||||
clone_msg = NULL;
|
clonedMessage = NULL;
|
||||||
} else {
|
} else {
|
||||||
clone_msg->what = 'okok';
|
clonedMessage->what = 'okok';
|
||||||
}
|
}
|
||||||
|
|
||||||
delete job_data;
|
delete jobData;
|
||||||
return clone_msg;
|
return clonedMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long
|
long
|
||||||
UIDriver::doPageSetup(JobData *job_data, PrinterData *printer_data, const PrinterCap *printer_cap)
|
UIDriver::PageSetup(JobData* jobData, PrinterData* printerData,
|
||||||
|
const PrinterCap* printerCap)
|
||||||
{
|
{
|
||||||
PageSetupDlg *dlg = new PageSetupDlg(job_data, printer_data, printer_cap);
|
PageSetupDlg *dialog = new PageSetupDlg(jobData, printerData, printerCap);
|
||||||
return dlg->Go();
|
return dialog->Go();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long
|
long
|
||||||
UIDriver::doJobSetup(JobData *job_data, PrinterData *printer_data, const PrinterCap *printer_cap)
|
UIDriver::JobSetup(JobData *jobData, PrinterData *printerData,
|
||||||
|
const PrinterCap *printerCap)
|
||||||
{
|
{
|
||||||
JobSetupDlg *dlg = new JobSetupDlg(job_data, printer_data, printer_cap);
|
JobSetupDlg *dialog = new JobSetupDlg(jobData, printerData, printerCap);
|
||||||
return dlg->Go();
|
return dialog->Go();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user