* Style changes.
* Unused code removed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39139 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -10,74 +10,80 @@
|
|||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include "JobData.h"
|
#include "JobData.h"
|
||||||
|
|
||||||
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#else
|
|
||||||
#define std
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kUnknownPrinter = 0
|
kUnknownPrinter = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BaseCap {
|
struct BaseCap {
|
||||||
string label;
|
BaseCap(const string &label, bool isDefault);
|
||||||
bool is_default;
|
|
||||||
BaseCap(const string &n, bool d) : label(n), is_default(d) {}
|
string fLabel;
|
||||||
|
bool fIsDefault;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PaperCap : public BaseCap {
|
struct PaperCap : public BaseCap {
|
||||||
JobData::Paper paper;
|
PaperCap(const string &label, bool isDefault,
|
||||||
BRect paper_rect;
|
JobData::Paper paper, const BRect &paperRect,
|
||||||
BRect physical_rect;
|
const BRect &physicalRect);
|
||||||
PaperCap(const string &n, bool d, JobData::Paper p, const BRect &r1, const BRect &r2)
|
|
||||||
: BaseCap(n, d), paper(p), paper_rect(r1), physical_rect(r2) {}
|
JobData::Paper fPaper;
|
||||||
|
BRect fPaperRect;
|
||||||
|
BRect fPhysicalRect;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PaperSourceCap : public BaseCap {
|
struct PaperSourceCap : public BaseCap {
|
||||||
JobData::PaperSource paper_source;
|
PaperSourceCap(const string &label, bool isDefault,
|
||||||
PaperSourceCap(const string &n, bool d, JobData::PaperSource f)
|
JobData::PaperSource paperSource);
|
||||||
: BaseCap(n, d), paper_source(f) {}
|
|
||||||
|
JobData::PaperSource fPaperSource;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ResolutionCap : public BaseCap {
|
struct ResolutionCap : public BaseCap {
|
||||||
int xres;
|
ResolutionCap(const string &label, bool isDefault,
|
||||||
int yres;
|
int xResolution, int yResolution);
|
||||||
ResolutionCap(const string &n, bool d, int x, int y)
|
|
||||||
: BaseCap(n, d), xres(x), yres(y) {}
|
int fXResolution;
|
||||||
|
int fYResolution;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OrientationCap : public BaseCap {
|
struct OrientationCap : public BaseCap {
|
||||||
JobData::Orientation orientation;
|
OrientationCap(const string &label, bool isDefault,
|
||||||
OrientationCap(const string &n, bool d, JobData::Orientation o)
|
JobData::Orientation orientation);
|
||||||
: BaseCap(n, d), orientation(o) {}
|
|
||||||
|
JobData::Orientation fOrientation;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PrintStyleCap : public BaseCap {
|
struct PrintStyleCap : public BaseCap {
|
||||||
JobData::PrintStyle print_style;
|
PrintStyleCap(const string &label, bool isDefault,
|
||||||
PrintStyleCap(const string &n, bool d, JobData::PrintStyle x)
|
JobData::PrintStyle printStyle);
|
||||||
: BaseCap(n, d), print_style(x) {}
|
|
||||||
|
JobData::PrintStyle fPrintStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BindingLocationCap : public BaseCap {
|
struct BindingLocationCap : public BaseCap {
|
||||||
JobData::BindingLocation binding_location;
|
BindingLocationCap(const string &label,
|
||||||
BindingLocationCap(const string &n, bool d, JobData::BindingLocation b)
|
bool isDefault,
|
||||||
: BaseCap(n, d), binding_location(b) {}
|
JobData::BindingLocation bindingLocation);
|
||||||
|
|
||||||
|
JobData::BindingLocation fBindingLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ColorCap : public BaseCap {
|
struct ColorCap : public BaseCap {
|
||||||
JobData::Color color;
|
ColorCap(const string &label, bool isDefault,
|
||||||
ColorCap(const string &n, bool d, JobData::Color c)
|
JobData::Color color);
|
||||||
: BaseCap(n, d), color(c) {}
|
|
||||||
|
JobData::Color fColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ProtocolClassCap : public BaseCap {
|
struct ProtocolClassCap : public BaseCap {
|
||||||
int protocolClass;
|
ProtocolClassCap(const string &label,
|
||||||
string description;
|
bool isDefault, int protocolClass,
|
||||||
ProtocolClassCap(const string &n, bool d, int p, const string &desc)
|
const string &description);
|
||||||
: BaseCap(n, d)
|
|
||||||
, protocolClass(p)
|
int fProtocolClass;
|
||||||
, description(desc) {}
|
string fDescription;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -112,6 +118,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
PrinterCap(const PrinterCap &);
|
PrinterCap(const PrinterCap &);
|
||||||
PrinterCap& operator=(const PrinterCap &);
|
PrinterCap& operator=(const PrinterCap &);
|
||||||
|
|
||||||
const PrinterData* getPrinterData() const;
|
const PrinterData* getPrinterData() const;
|
||||||
void setPrinterId(int id);
|
void setPrinterId(int id);
|
||||||
|
|
||||||
@@ -120,19 +127,5 @@ private:
|
|||||||
int fPrinterID;
|
int fPrinterID;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline const PrinterData *PrinterCap::getPrinterData() const
|
|
||||||
{
|
|
||||||
return fPrinterData;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int PrinterCap::getPrinterId() const
|
|
||||||
{
|
|
||||||
return fPrinterID;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void PrinterCap::setPrinterId(int id)
|
|
||||||
{
|
|
||||||
fPrinterID = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __PRINTERCAP_H */
|
#endif /* __PRINTERCAP_H */
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ enum MSGS {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ProtocolClassItem::ProtocolClassItem(const ProtocolClassCap* cap)
|
ProtocolClassItem::ProtocolClassItem(const ProtocolClassCap* cap)
|
||||||
: BStringItem(cap->label.c_str())
|
: BStringItem(cap->fLabel.c_str())
|
||||||
, fProtocolClassCap(cap)
|
, fProtocolClassCap(cap)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -95,13 +95,13 @@ ProtocolClassItem::ProtocolClassItem(const ProtocolClassCap* cap)
|
|||||||
int
|
int
|
||||||
ProtocolClassItem::getProtocolClass()
|
ProtocolClassItem::getProtocolClass()
|
||||||
{
|
{
|
||||||
return fProtocolClassCap->protocolClass;
|
return fProtocolClassCap->fProtocolClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
ProtocolClassItem::getDescription()
|
ProtocolClassItem::getDescription()
|
||||||
{
|
{
|
||||||
return fProtocolClassCap->description.c_str();
|
return fProtocolClassCap->fDescription.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ AddPrinterView::AttachedToWindow()
|
|||||||
|
|
||||||
BStringItem* item = new ProtocolClassItem(protocolClass);
|
BStringItem* item = new ProtocolClassItem(protocolClass);
|
||||||
fProtocolClassList->AddItem(item);
|
fProtocolClassList->AddItem(item);
|
||||||
if (protocolClass->is_default) {
|
if (protocolClass->fIsDefault) {
|
||||||
int index = fProtocolClassList->IndexOf(item);
|
int index = fProtocolClassList->IndexOf(item);
|
||||||
fProtocolClassList->Select(index);
|
fProtocolClassList->Select(index);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
fPaper = (Paper)msg->FindInt32(kJDPaper);
|
fPaper = (Paper)msg->FindInt32(kJDPaper);
|
||||||
else if (cap->isSupport(PrinterCap::kPaper)) {
|
else if (cap->isSupport(PrinterCap::kPaper)) {
|
||||||
paperCap = (const PaperCap *)cap->getDefaultCap(PrinterCap::kPaper);
|
paperCap = (const PaperCap *)cap->getDefaultCap(PrinterCap::kPaper);
|
||||||
fPaper = paperCap->paper;
|
fPaper = paperCap->fPaper;
|
||||||
} else
|
} else
|
||||||
fPaper = kA4;
|
fPaper = kA4;
|
||||||
|
|
||||||
@@ -142,7 +142,8 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
msg->FindInt64(kJDXRes, &xres64);
|
msg->FindInt64(kJDXRes, &xres64);
|
||||||
fXRes = xres64;
|
fXRes = xres64;
|
||||||
} else if (cap->isSupport(PrinterCap::kResolution)) {
|
} else if (cap->isSupport(PrinterCap::kResolution)) {
|
||||||
fXRes = ((const ResolutionCap *)cap->getDefaultCap(PrinterCap::kResolution))->xres;
|
fXRes = ((const ResolutionCap *)cap->getDefaultCap(
|
||||||
|
PrinterCap::kResolution))->fXResolution;
|
||||||
} else {
|
} else {
|
||||||
fXRes = 300;
|
fXRes = 300;
|
||||||
}
|
}
|
||||||
@@ -152,7 +153,8 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
msg->FindInt64(kJDYRes, &yres64);
|
msg->FindInt64(kJDYRes, &yres64);
|
||||||
fYRes = yres64;
|
fYRes = yres64;
|
||||||
} else if (cap->isSupport(PrinterCap::kResolution)) {
|
} else if (cap->isSupport(PrinterCap::kResolution)) {
|
||||||
fYRes = ((const ResolutionCap *)cap->getDefaultCap(PrinterCap::kResolution))->yres;
|
fYRes = ((const ResolutionCap *)cap->getDefaultCap(
|
||||||
|
PrinterCap::kResolution))->fYResolution;
|
||||||
} else {
|
} else {
|
||||||
fYRes = 300;
|
fYRes = 300;
|
||||||
}
|
}
|
||||||
@@ -160,7 +162,8 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
if (msg->HasInt32(kJDOrientation))
|
if (msg->HasInt32(kJDOrientation))
|
||||||
fOrientation = (Orientation)msg->FindInt32(kJDOrientation);
|
fOrientation = (Orientation)msg->FindInt32(kJDOrientation);
|
||||||
else if (cap->isSupport(PrinterCap::kOrientation))
|
else if (cap->isSupport(PrinterCap::kOrientation))
|
||||||
fOrientation = ((const OrientationCap *)cap->getDefaultCap(PrinterCap::kOrientation))->orientation;
|
fOrientation = ((const OrientationCap *)cap->getDefaultCap(
|
||||||
|
PrinterCap::kOrientation))->fOrientation;
|
||||||
else
|
else
|
||||||
fOrientation = kPortrait;
|
fOrientation = kPortrait;
|
||||||
|
|
||||||
@@ -172,7 +175,7 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
if (msg->HasRect(kJDPaperRect)) {
|
if (msg->HasRect(kJDPaperRect)) {
|
||||||
fPaperRect = msg->FindRect(kJDPaperRect);
|
fPaperRect = msg->FindRect(kJDPaperRect);
|
||||||
} else if (paperCap != NULL) {
|
} else if (paperCap != NULL) {
|
||||||
fPaperRect = paperCap->paper_rect;
|
fPaperRect = paperCap->fPaperRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasRect(kJDScaledPaperRect)) {
|
if (msg->HasRect(kJDScaledPaperRect)) {
|
||||||
@@ -184,7 +187,7 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
if (msg->HasRect(kJDPrintableRect)) {
|
if (msg->HasRect(kJDPrintableRect)) {
|
||||||
fPrintableRect = msg->FindRect(kJDPrintableRect);
|
fPrintableRect = msg->FindRect(kJDPrintableRect);
|
||||||
} else if (paperCap != NULL) {
|
} else if (paperCap != NULL) {
|
||||||
fPrintableRect = paperCap->physical_rect;
|
fPrintableRect = paperCap->fPhysicalRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasRect(kJDScaledPrintableRect)) {
|
if (msg->HasRect(kJDScaledPrintableRect)) {
|
||||||
@@ -196,7 +199,7 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
if (msg->HasRect(kJDPhysicalRect)) {
|
if (msg->HasRect(kJDPhysicalRect)) {
|
||||||
fPhysicalRect = msg->FindRect(kJDPhysicalRect);
|
fPhysicalRect = msg->FindRect(kJDPhysicalRect);
|
||||||
} else if (paperCap != NULL) {
|
} else if (paperCap != NULL) {
|
||||||
fPhysicalRect = paperCap->physical_rect;
|
fPhysicalRect = paperCap->fPhysicalRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->HasRect(kJDScaledPhysicalRect)) {
|
if (msg->HasRect(kJDScaledPhysicalRect)) {
|
||||||
@@ -233,7 +236,8 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
if (msg->HasInt32(kJDPaperSource))
|
if (msg->HasInt32(kJDPaperSource))
|
||||||
fPaperSource = (PaperSource)fMsg->FindInt32(kJDPaperSource);
|
fPaperSource = (PaperSource)fMsg->FindInt32(kJDPaperSource);
|
||||||
else if (cap->isSupport(PrinterCap::kPaperSource))
|
else if (cap->isSupport(PrinterCap::kPaperSource))
|
||||||
fPaperSource = ((const PaperSourceCap *)cap->getDefaultCap(PrinterCap::kPaperSource))->paper_source;
|
fPaperSource = ((const PaperSourceCap *)cap->getDefaultCap(
|
||||||
|
PrinterCap::kPaperSource))->fPaperSource;
|
||||||
else
|
else
|
||||||
fPaperSource = kAuto;
|
fPaperSource = kAuto;
|
||||||
|
|
||||||
@@ -255,14 +259,16 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
if (msg->HasInt32(kJDPrintStyle))
|
if (msg->HasInt32(kJDPrintStyle))
|
||||||
fPrintStyle = (PrintStyle)msg->FindInt32(kJDPrintStyle);
|
fPrintStyle = (PrintStyle)msg->FindInt32(kJDPrintStyle);
|
||||||
else if (cap->isSupport(PrinterCap::kPrintStyle))
|
else if (cap->isSupport(PrinterCap::kPrintStyle))
|
||||||
fPrintStyle = ((const PrintStyleCap *)cap->getDefaultCap(PrinterCap::kPrintStyle))->print_style;
|
fPrintStyle = ((const PrintStyleCap *)cap->getDefaultCap(
|
||||||
|
PrinterCap::kPrintStyle))->fPrintStyle;
|
||||||
else
|
else
|
||||||
fPrintStyle = kSimplex;
|
fPrintStyle = kSimplex;
|
||||||
|
|
||||||
if (msg->HasInt32(kJDBindingLocation))
|
if (msg->HasInt32(kJDBindingLocation))
|
||||||
fBindingLocation = (BindingLocation)msg->FindInt32(kJDBindingLocation);
|
fBindingLocation = (BindingLocation)msg->FindInt32(kJDBindingLocation);
|
||||||
else if (cap->isSupport(PrinterCap::kBindingLocation))
|
else if (cap->isSupport(PrinterCap::kBindingLocation))
|
||||||
fBindingLocation = ((const BindingLocationCap *)cap->getDefaultCap(PrinterCap::kBindingLocation))->binding_location;
|
fBindingLocation = ((const BindingLocationCap *)cap->getDefaultCap(
|
||||||
|
PrinterCap::kBindingLocation))->fBindingLocation;
|
||||||
else
|
else
|
||||||
fBindingLocation = kLongEdgeLeft;
|
fBindingLocation = kLongEdgeLeft;
|
||||||
|
|
||||||
@@ -274,7 +280,8 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
if (msg->HasInt32(kJDColor))
|
if (msg->HasInt32(kJDColor))
|
||||||
fColor = (Color)msg->FindInt32(kJDColor);
|
fColor = (Color)msg->FindInt32(kJDColor);
|
||||||
else if (cap->isSupport(PrinterCap::kColor))
|
else if (cap->isSupport(PrinterCap::kColor))
|
||||||
fColor = ((const ColorCap *)cap->getDefaultCap(PrinterCap::kColor))->color;
|
fColor = ((const ColorCap *)cap->getDefaultCap(PrinterCap::kColor))
|
||||||
|
->fColor;
|
||||||
else
|
else
|
||||||
fColor = kMonochrome;
|
fColor = kMonochrome;
|
||||||
|
|
||||||
|
|||||||
@@ -45,32 +45,32 @@
|
|||||||
#include "PrinterCap.h"
|
#include "PrinterCap.h"
|
||||||
#include "DbgMsg.h"
|
#include "DbgMsg.h"
|
||||||
|
|
||||||
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#else
|
|
||||||
#define std
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
struct SurfaceCap : public BaseCap {
|
|
||||||
color_space surface_type;
|
|
||||||
SurfaceCap(const string &s, bool d, color_space cs) : BaseCap(s, d), surface_type(cs) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct NupCap : public BaseCap {
|
struct NupCap : public BaseCap {
|
||||||
int nup;
|
NupCap(const string &label, bool isDefault, int nup)
|
||||||
NupCap(const string &s, bool d, int n) : BaseCap(s, d), nup(n) {}
|
:
|
||||||
|
BaseCap(label, isDefault),
|
||||||
|
fNup(nup)
|
||||||
|
{}
|
||||||
|
|
||||||
|
int fNup;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct DitherCap : public BaseCap {
|
struct DitherCap : public BaseCap {
|
||||||
Halftone::DitherType dither_type;
|
DitherCap(const string &label, bool isDefault,
|
||||||
DitherCap(const string &s, bool d, Halftone::DitherType type) : BaseCap(s, d), dither_type(type) {}
|
Halftone::DitherType ditherType)
|
||||||
|
:
|
||||||
|
BaseCap(label, isDefault),
|
||||||
|
fDitherType(ditherType)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Halftone::DitherType fDitherType;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SurfaceCap gRGB32("RGB32", false, B_RGB32);
|
|
||||||
static const SurfaceCap gCMAP8("CMAP8", true, B_CMAP8);
|
|
||||||
static const SurfaceCap gGray8("GRAY8", false, B_GRAY8);
|
|
||||||
static const SurfaceCap gGray1("GRAY1", false, B_GRAY1);
|
|
||||||
|
|
||||||
static const NupCap gNup1("1", true, 1);
|
static const NupCap gNup1("1", true, 1);
|
||||||
static const NupCap gNup2("2", false, 2);
|
static const NupCap gNup2("2", false, 2);
|
||||||
@@ -82,17 +82,13 @@ static const NupCap gNup25("25", false, 25);
|
|||||||
static const NupCap gNup32("32", false, 32);
|
static const NupCap gNup32("32", false, 32);
|
||||||
static const NupCap gNup36("36", false, 36);
|
static const NupCap gNup36("36", false, 36);
|
||||||
|
|
||||||
|
|
||||||
static const DitherCap gDitherType1("Crosshatch", false, Halftone::kType1);
|
static const DitherCap gDitherType1("Crosshatch", false, Halftone::kType1);
|
||||||
static const DitherCap gDitherType2("Grid", false, Halftone::kType2);
|
static const DitherCap gDitherType2("Grid", false, Halftone::kType2);
|
||||||
static const DitherCap gDitherType3("Stipple", false, Halftone::kType3);
|
static const DitherCap gDitherType3("Stipple", false, Halftone::kType3);
|
||||||
static const DitherCap gDitherFloydSteinberg("Floyd-Steinberg", false, Halftone::kTypeFloydSteinberg);
|
static const DitherCap gDitherFloydSteinberg("Floyd-Steinberg", false,
|
||||||
|
Halftone::kTypeFloydSteinberg);
|
||||||
|
|
||||||
const SurfaceCap *gSurfaces[] = {
|
|
||||||
&gRGB32,
|
|
||||||
&gCMAP8,
|
|
||||||
&gGray8,
|
|
||||||
&gGray1
|
|
||||||
};
|
|
||||||
|
|
||||||
const NupCap *gNups[] = {
|
const NupCap *gNups[] = {
|
||||||
&gNup1,
|
&gNup1,
|
||||||
@@ -106,6 +102,7 @@ const NupCap *gNups[] = {
|
|||||||
&gNup36
|
&gNup36
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const DitherCap *gDitherTypes[] = {
|
const DitherCap *gDitherTypes[] = {
|
||||||
&gDitherType1,
|
&gDitherType1,
|
||||||
&gDitherType2,
|
&gDitherType2,
|
||||||
@@ -113,6 +110,7 @@ const DitherCap *gDitherTypes[] = {
|
|||||||
&gDitherFloydSteinberg
|
&gDitherFloydSteinberg
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kMsgRangeAll = 'JSdl',
|
kMsgRangeAll = 'JSdl',
|
||||||
kMsgRangeSelection,
|
kMsgRangeSelection,
|
||||||
@@ -125,16 +123,19 @@ enum {
|
|||||||
kMsgDuplexChanged,
|
kMsgDuplexChanged,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
JobSetupView::JobSetupView(JobData *job_data, PrinterData *printer_data,
|
JobSetupView::JobSetupView(JobData *job_data, PrinterData *printer_data,
|
||||||
const PrinterCap *printer_cap)
|
const PrinterCap *printer_cap)
|
||||||
: BView("jobSetup", B_WILL_DRAW)
|
:
|
||||||
, fJobData(job_data)
|
BView("jobSetup", B_WILL_DRAW),
|
||||||
, fPrinterData(printer_data)
|
fJobData(job_data),
|
||||||
, fPrinterCap(printer_cap)
|
fPrinterData(printer_data),
|
||||||
|
fPrinterCap(printer_cap)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BRadioButton*
|
BRadioButton*
|
||||||
JobSetupView::CreatePageSelectionItem(const char* name, const char* label,
|
JobSetupView::CreatePageSelectionItem(const char* name, const char* label,
|
||||||
JobData::PageSelection pageSelection)
|
JobData::PageSelection pageSelection)
|
||||||
@@ -146,6 +147,7 @@ JobSetupView::CreatePageSelectionItem(const char* name, const char* label,
|
|||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobSetupView::AllowOnlyDigits(BTextView* textView, int maxDigits)
|
JobSetupView::AllowOnlyDigits(BTextView* textView, int maxDigits)
|
||||||
{
|
{
|
||||||
@@ -159,6 +161,7 @@ JobSetupView::AllowOnlyDigits(BTextView* textView, int maxDigits)
|
|||||||
textView->SetMaxBytes(maxDigits);
|
textView->SetMaxBytes(maxDigits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobSetupView::AttachedToWindow()
|
JobSetupView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
@@ -176,10 +179,10 @@ JobSetupView::AttachedToWindow()
|
|||||||
bool marked = false;
|
bool marked = false;
|
||||||
BMenuItem* item = NULL;
|
BMenuItem* item = NULL;
|
||||||
while (count--) {
|
while (count--) {
|
||||||
item = new BMenuItem((*color_cap)->label.c_str(),
|
item = new BMenuItem((*color_cap)->fLabel.c_str(),
|
||||||
new BMessage(kMsgQuality));
|
new BMessage(kMsgQuality));
|
||||||
fColorType->AddItem(item);
|
fColorType->AddItem(item);
|
||||||
if ((*color_cap)->color == fJobData->getColor()) {
|
if ((*color_cap)->fColor == fJobData->getColor()) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
marked = true;
|
marked = true;
|
||||||
}
|
}
|
||||||
@@ -200,10 +203,10 @@ JobSetupView::AttachedToWindow()
|
|||||||
marked = false;
|
marked = false;
|
||||||
item = NULL;
|
item = NULL;
|
||||||
while (count--) {
|
while (count--) {
|
||||||
item = new BMenuItem((*dither_cap)->label.c_str(),
|
item = new BMenuItem((*dither_cap)->fLabel.c_str(),
|
||||||
new BMessage(kMsgQuality));
|
new BMessage(kMsgQuality));
|
||||||
fDitherType->AddItem(item);
|
fDitherType->AddItem(item);
|
||||||
if ((*dither_cap)->dither_type == fJobData->getDitherType()) {
|
if ((*dither_cap)->fDitherType == fJobData->getDitherType()) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
marked = true;
|
marked = true;
|
||||||
}
|
}
|
||||||
@@ -300,9 +303,9 @@ JobSetupView::AttachedToWindow()
|
|||||||
marked = false;
|
marked = false;
|
||||||
item = NULL;
|
item = NULL;
|
||||||
while (count--) {
|
while (count--) {
|
||||||
item = new BMenuItem((*paper_source_cap)->label.c_str(), NULL);
|
item = new BMenuItem((*paper_source_cap)->fLabel.c_str(), NULL);
|
||||||
fPaperFeed->AddItem(item);
|
fPaperFeed->AddItem(item);
|
||||||
if ((*paper_source_cap)->paper_source == fJobData->getPaperSource()) {
|
if ((*paper_source_cap)->fPaperSource == fJobData->getPaperSource()) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
marked = true;
|
marked = true;
|
||||||
}
|
}
|
||||||
@@ -321,9 +324,9 @@ JobSetupView::AttachedToWindow()
|
|||||||
marked = false;
|
marked = false;
|
||||||
item = NULL;
|
item = NULL;
|
||||||
while (count--) {
|
while (count--) {
|
||||||
item = new BMenuItem((*nup_cap)->label.c_str(), NULL);
|
item = new BMenuItem((*nup_cap)->fLabel.c_str(), NULL);
|
||||||
fNup->AddItem(item);
|
fNup->AddItem(item);
|
||||||
if ((*nup_cap)->nup == fJobData->getNup()) {
|
if ((*nup_cap)->fNup == fJobData->getNup()) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
marked = true;
|
marked = true;
|
||||||
}
|
}
|
||||||
@@ -500,6 +503,7 @@ JobSetupView::AttachedToWindow()
|
|||||||
UpdateButtonEnabledState();
|
UpdateButtonEnabledState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobSetupView::UpdateButtonEnabledState()
|
JobSetupView::UpdateButtonEnabledState()
|
||||||
{
|
{
|
||||||
@@ -514,6 +518,7 @@ JobSetupView::UpdateButtonEnabledState()
|
|||||||
fEvenNumberedPages->SetEnabled(pageSelectionEnabled);
|
fEvenNumberedPages->SetEnabled(pageSelectionEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobSetupView::MessageReceived(BMessage *msg)
|
JobSetupView::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
@@ -538,6 +543,7 @@ JobSetupView::MessageReceived(BMessage *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JobData::Color
|
JobData::Color
|
||||||
JobSetupView::getColor()
|
JobSetupView::getColor()
|
||||||
{
|
{
|
||||||
@@ -545,14 +551,15 @@ JobSetupView::getColor()
|
|||||||
const ColorCap **color_cap = (const ColorCap**)fPrinterCap->enumCap(PrinterCap::kColor);
|
const ColorCap **color_cap = (const ColorCap**)fPrinterCap->enumCap(PrinterCap::kColor);
|
||||||
const char *color_label = fColorType->FindMarked()->Label();
|
const char *color_label = fColorType->FindMarked()->Label();
|
||||||
while (count--) {
|
while (count--) {
|
||||||
if (!strcmp((*color_cap)->label.c_str(), color_label)) {
|
if (!strcmp((*color_cap)->fLabel.c_str(), color_label)) {
|
||||||
return (*color_cap)->color;
|
return (*color_cap)->fColor;
|
||||||
}
|
}
|
||||||
color_cap++;
|
color_cap++;
|
||||||
}
|
}
|
||||||
return JobData::kMonochrome;
|
return JobData::kMonochrome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Halftone::DitherType
|
Halftone::DitherType
|
||||||
JobSetupView::getDitherType()
|
JobSetupView::getDitherType()
|
||||||
{
|
{
|
||||||
@@ -560,8 +567,8 @@ JobSetupView::getDitherType()
|
|||||||
const DitherCap **dither_cap = gDitherTypes;
|
const DitherCap **dither_cap = gDitherTypes;
|
||||||
const char *dithering_label = fDitherType->FindMarked()->Label();
|
const char *dithering_label = fDitherType->FindMarked()->Label();
|
||||||
while (count --) {
|
while (count --) {
|
||||||
if (strcmp((*dither_cap)->label.c_str(), dithering_label) == 0) {
|
if (strcmp((*dither_cap)->fLabel.c_str(), dithering_label) == 0) {
|
||||||
return (*dither_cap)->dither_type;
|
return (*dither_cap)->fDitherType;
|
||||||
}
|
}
|
||||||
dither_cap ++;
|
dither_cap ++;
|
||||||
}
|
}
|
||||||
@@ -575,6 +582,7 @@ JobSetupView::getGamma()
|
|||||||
return pow(2.0, value / 100.0);
|
return pow(2.0, value / 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float
|
float
|
||||||
JobSetupView::getInkDensity()
|
JobSetupView::getInkDensity()
|
||||||
{
|
{
|
||||||
@@ -582,23 +590,12 @@ JobSetupView::getInkDensity()
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
JobSetupView::UpdateJobData(bool showPreview)
|
JobSetupView::UpdateJobData(bool showPreview)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
/*
|
|
||||||
count = sizeof(gSurfaces) / sizeof(gSurfaces[0]);
|
|
||||||
const SurfaceCap **surface_cap = gSurfaces;
|
|
||||||
const char *surface_label = fSurfaceType->FindMarked()->Label();
|
|
||||||
while (count--) {
|
|
||||||
if (!strcmp((*surface_cap)->label.c_str(), surface_label)) {
|
|
||||||
fJobData->setSurfaceType((*surface_cap)->surface_type);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
surface_cap++;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
fJobData->setShowPreview(showPreview);
|
fJobData->setShowPreview(showPreview);
|
||||||
fJobData->setColor(getColor());
|
fJobData->setColor(getColor());
|
||||||
fJobData->setGamma(getGamma());
|
fJobData->setGamma(getGamma());
|
||||||
@@ -623,8 +620,8 @@ JobSetupView::UpdateJobData(bool showPreview)
|
|||||||
const PaperSourceCap **paper_source_cap = (const PaperSourceCap **)fPrinterCap->enumCap(PrinterCap::kPaperSource);
|
const PaperSourceCap **paper_source_cap = (const PaperSourceCap **)fPrinterCap->enumCap(PrinterCap::kPaperSource);
|
||||||
const char *paper_source_label = fPaperFeed->FindMarked()->Label();
|
const char *paper_source_label = fPaperFeed->FindMarked()->Label();
|
||||||
while (count--) {
|
while (count--) {
|
||||||
if (!strcmp((*paper_source_cap)->label.c_str(), paper_source_label)) {
|
if (!strcmp((*paper_source_cap)->fLabel.c_str(), paper_source_label)) {
|
||||||
fJobData->setPaperSource((*paper_source_cap)->paper_source);
|
fJobData->setPaperSource((*paper_source_cap)->fPaperSource);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
paper_source_cap++;
|
paper_source_cap++;
|
||||||
@@ -634,8 +631,8 @@ JobSetupView::UpdateJobData(bool showPreview)
|
|||||||
const NupCap **nup_cap = gNups;
|
const NupCap **nup_cap = gNups;
|
||||||
const char *nup_label = fNup->FindMarked()->Label();
|
const char *nup_label = fNup->FindMarked()->Label();
|
||||||
while (count--) {
|
while (count--) {
|
||||||
if (!strcmp((*nup_cap)->label.c_str(), nup_label)) {
|
if (!strcmp((*nup_cap)->fLabel.c_str(), nup_label)) {
|
||||||
fJobData->setNup((*nup_cap)->nup);
|
fJobData->setNup((*nup_cap)->fNup);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nup_cap++;
|
nup_cap++;
|
||||||
@@ -661,12 +658,12 @@ JobSetupView::UpdateJobData(bool showPreview)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//====================================================================
|
|
||||||
|
|
||||||
JobSetupDlg::JobSetupDlg(JobData *job_data, PrinterData *printer_data,
|
JobSetupDlg::JobSetupDlg(JobData *job_data, PrinterData *printer_data,
|
||||||
const PrinterCap *printer_cap)
|
const PrinterCap *printer_cap)
|
||||||
: DialogWindow(BRect(100, 100, 200, 200),
|
:
|
||||||
"PrintJob Setup", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
|
DialogWindow(BRect(100, 100, 200, 200), "PrintJob Setup",
|
||||||
|
B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
|
||||||
B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE
|
B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE
|
||||||
| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
|
| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
|
||||||
{
|
{
|
||||||
@@ -681,6 +678,7 @@ JobSetupDlg::JobSetupDlg(JobData *job_data, PrinterData *printer_data,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobSetupDlg::MessageReceived(BMessage *msg)
|
JobSetupDlg::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -119,10 +119,10 @@ PageSetupView::AttachedToWindow()
|
|||||||
while (count--) {
|
while (count--) {
|
||||||
BMessage *msg = new BMessage(kMsgPaperChanged);
|
BMessage *msg = new BMessage(kMsgPaperChanged);
|
||||||
msg->AddPointer("paperCap", *paper_cap);
|
msg->AddPointer("paperCap", *paper_cap);
|
||||||
item = new BMenuItem((*paper_cap)->label.c_str(), msg);
|
item = new BMenuItem((*paper_cap)->fLabel.c_str(), msg);
|
||||||
fPaper->AddItem(item);
|
fPaper->AddItem(item);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
if ((*paper_cap)->paper == fJobData->getPaper()) {
|
if ((*paper_cap)->fPaper == fJobData->getPaper()) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
marked = true;
|
marked = true;
|
||||||
}
|
}
|
||||||
@@ -145,8 +145,8 @@ PageSetupView::AttachedToWindow()
|
|||||||
} else {
|
} else {
|
||||||
OrientationCap **orientation_cap = (OrientationCap **)fPrinterCap->enumCap(PrinterCap::kOrientation);
|
OrientationCap **orientation_cap = (OrientationCap **)fPrinterCap->enumCap(PrinterCap::kOrientation);
|
||||||
while (count--) {
|
while (count--) {
|
||||||
AddOrientationItem((*orientation_cap)->label.c_str(),
|
AddOrientationItem((*orientation_cap)->fLabel.c_str(),
|
||||||
(*orientation_cap)->orientation);
|
(*orientation_cap)->fOrientation);
|
||||||
orientation_cap++;
|
orientation_cap++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -158,10 +158,11 @@ PageSetupView::AttachedToWindow()
|
|||||||
count = fPrinterCap->countCap(PrinterCap::kResolution);
|
count = fPrinterCap->countCap(PrinterCap::kResolution);
|
||||||
ResolutionCap **resolution_cap = (ResolutionCap **)fPrinterCap->enumCap(PrinterCap::kResolution);
|
ResolutionCap **resolution_cap = (ResolutionCap **)fPrinterCap->enumCap(PrinterCap::kResolution);
|
||||||
while (count--) {
|
while (count--) {
|
||||||
item = new BMenuItem((*resolution_cap)->label.c_str(), NULL);
|
item = new BMenuItem((*resolution_cap)->fLabel.c_str(), NULL);
|
||||||
fResolution->AddItem(item);
|
fResolution->AddItem(item);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
if (((*resolution_cap)->xres == fJobData->getXres()) && ((*resolution_cap)->yres == fJobData->getYres())) {
|
if (((*resolution_cap)->fXResolution == fJobData->getXres()) &&
|
||||||
|
((*resolution_cap)->fYResolution == fJobData->getYres())) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
marked = true;
|
marked = true;
|
||||||
}
|
}
|
||||||
@@ -265,9 +266,9 @@ PageSetupView::UpdateJobData()
|
|||||||
fJobData->setOrientation(GetOrientation());
|
fJobData->setOrientation(GetOrientation());
|
||||||
|
|
||||||
PaperCap *paperCap = GetPaperCap();
|
PaperCap *paperCap = GetPaperCap();
|
||||||
BRect paper_rect = paperCap->paper_rect;
|
BRect paper_rect = paperCap->fPaperRect;
|
||||||
BRect physical_rect = paperCap->physical_rect;
|
BRect physical_rect = paperCap->fPhysicalRect;
|
||||||
fJobData->setPaper(paperCap->paper);
|
fJobData->setPaper(paperCap->fPaper);
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
@@ -275,9 +276,9 @@ PageSetupView::UpdateJobData()
|
|||||||
ResolutionCap **resolution_cap = (ResolutionCap **)fPrinterCap->enumCap(PrinterCap::kResolution);
|
ResolutionCap **resolution_cap = (ResolutionCap **)fPrinterCap->enumCap(PrinterCap::kResolution);
|
||||||
const char *resolution_label = fResolution->FindMarked()->Label();
|
const char *resolution_label = fResolution->FindMarked()->Label();
|
||||||
while (count--) {
|
while (count--) {
|
||||||
if (!strcmp((*resolution_cap)->label.c_str(), resolution_label)) {
|
if (!strcmp((*resolution_cap)->fLabel.c_str(), resolution_label)) {
|
||||||
fJobData->setXres((*resolution_cap)->xres);
|
fJobData->setXres((*resolution_cap)->fXResolution);
|
||||||
fJobData->setYres((*resolution_cap)->yres);
|
fJobData->setYres((*resolution_cap)->fYResolution);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
resolution_cap++;
|
resolution_cap++;
|
||||||
@@ -336,8 +337,8 @@ PageSetupView::MessageReceived(BMessage *msg)
|
|||||||
{
|
{
|
||||||
JobData::Orientation orientation = GetOrientation();
|
JobData::Orientation orientation = GetOrientation();
|
||||||
PaperCap *paperCap = GetPaperCap();
|
PaperCap *paperCap = GetPaperCap();
|
||||||
float width = paperCap->paper_rect.Width();
|
float width = paperCap->fPaperRect.Width();
|
||||||
float height = paperCap->paper_rect.Height();
|
float height = paperCap->fPaperRect.Height();
|
||||||
if (orientation != JobData::kPortrait) {
|
if (orientation != JobData::kPortrait) {
|
||||||
swap(&width, &height);
|
swap(&width, &height);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,23 +6,108 @@
|
|||||||
#include "PrinterCap.h"
|
#include "PrinterCap.h"
|
||||||
#include "PrinterData.h"
|
#include "PrinterData.h"
|
||||||
|
|
||||||
|
BaseCap::BaseCap(const string &label, bool isDefault)
|
||||||
|
:
|
||||||
|
fLabel(label),
|
||||||
|
fIsDefault(isDefault)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PaperCap::PaperCap(const string &label, bool isDefault, JobData::Paper paper,
|
||||||
|
const BRect &paperRect, const BRect &physicalRect)
|
||||||
|
:
|
||||||
|
BaseCap(label, isDefault),
|
||||||
|
fPaper(paper),
|
||||||
|
fPaperRect(paperRect),
|
||||||
|
fPhysicalRect(physicalRect)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PaperSourceCap::PaperSourceCap(const string &label, bool isDefault,
|
||||||
|
JobData::PaperSource paperSource)
|
||||||
|
:
|
||||||
|
BaseCap(label, isDefault),
|
||||||
|
fPaperSource(paperSource)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ResolutionCap::ResolutionCap(const string &label, bool isDefault,
|
||||||
|
int xResolution, int yResolution)
|
||||||
|
:
|
||||||
|
BaseCap(label, isDefault),
|
||||||
|
fXResolution(xResolution),
|
||||||
|
fYResolution(yResolution)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OrientationCap::OrientationCap(const string &label, bool isDefault,
|
||||||
|
JobData::Orientation orientation)
|
||||||
|
:
|
||||||
|
BaseCap(label, isDefault),
|
||||||
|
fOrientation(orientation)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PrintStyleCap::PrintStyleCap(const string &label, bool isDefault,
|
||||||
|
JobData::PrintStyle printStyle)
|
||||||
|
:
|
||||||
|
BaseCap(label, isDefault),
|
||||||
|
fPrintStyle(printStyle)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BindingLocationCap::BindingLocationCap(const string &label, bool isDefault,
|
||||||
|
JobData::BindingLocation bindingLocation)
|
||||||
|
:
|
||||||
|
BaseCap(label, isDefault),
|
||||||
|
fBindingLocation(bindingLocation)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ColorCap::ColorCap(const string &label, bool isDefault, JobData::Color color)
|
||||||
|
:
|
||||||
|
BaseCap(label, isDefault),
|
||||||
|
fColor(color)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ProtocolClassCap::ProtocolClassCap(const string &label, bool isDefault,
|
||||||
|
int protocolClass, const string &description)
|
||||||
|
:
|
||||||
|
BaseCap(label, isDefault),
|
||||||
|
fProtocolClass(protocolClass),
|
||||||
|
fDescription(description)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PrinterCap::PrinterCap(const PrinterData *printer_data)
|
PrinterCap::PrinterCap(const PrinterData *printer_data)
|
||||||
: fPrinterData(printer_data),
|
: fPrinterData(printer_data),
|
||||||
fPrinterID(kUnknownPrinter)
|
fPrinterID(kUnknownPrinter)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PrinterCap::~PrinterCap()
|
PrinterCap::~PrinterCap()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BaseCap *PrinterCap::getDefaultCap(CapID id) const
|
const BaseCap *PrinterCap::getDefaultCap(CapID id) const
|
||||||
{
|
{
|
||||||
int count = countCap(id);
|
int count = countCap(id);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
const BaseCap **base_cap = enumCap(id);
|
const BaseCap **base_cap = enumCap(id);
|
||||||
while (count--) {
|
while (count--) {
|
||||||
if ((*base_cap)->is_default) {
|
if ((*base_cap)->fIsDefault) {
|
||||||
return *base_cap;
|
return *base_cap;
|
||||||
}
|
}
|
||||||
base_cap++;
|
base_cap++;
|
||||||
@@ -31,6 +116,30 @@ const BaseCap *PrinterCap::getDefaultCap(CapID id) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PrinterCap::getProtocolClass() const {
|
|
||||||
|
int
|
||||||
|
PrinterCap::getProtocolClass() const {
|
||||||
return fPrinterData->getProtocolClass();
|
return fPrinterData->getProtocolClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const
|
||||||
|
PrinterData *PrinterCap::getPrinterData() const
|
||||||
|
{
|
||||||
|
return fPrinterData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
PrinterCap::getPrinterId() const
|
||||||
|
{
|
||||||
|
return fPrinterID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PrinterCap::setPrinterId(int id)
|
||||||
|
{
|
||||||
|
fPrinterID = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ PrinterDriver::AddPrinter(char* printerName)
|
|||||||
const ProtocolClassCap* pcCap;
|
const ProtocolClassCap* pcCap;
|
||||||
pcCap = (const ProtocolClassCap*)fPrinterCap->getDefaultCap(PrinterCap::kProtocolClass);
|
pcCap = (const ProtocolClassCap*)fPrinterCap->getDefaultCap(PrinterCap::kProtocolClass);
|
||||||
if (pcCap != NULL) {
|
if (pcCap != NULL) {
|
||||||
fPrinterData->setProtocolClass(pcCap->protocolClass);
|
fPrinterData->setProtocolClass(pcCap->fProtocolClass);
|
||||||
fPrinterData->save();
|
fPrinterData->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user