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