* Code style changes (missing header files from r39770)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39771 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -19,8 +19,8 @@ class ProtocolClassItem : public BStringItem {
|
|||||||
public:
|
public:
|
||||||
ProtocolClassItem(const ProtocolClassCap* cap);
|
ProtocolClassItem(const ProtocolClassCap* cap);
|
||||||
|
|
||||||
int getProtocolClass();
|
int GetProtocolClass() const;
|
||||||
const char* getDescription();
|
const char* GetDescription() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ProtocolClassCap *fProtocolClassCap;
|
const ProtocolClassCap *fProtocolClassCap;
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ GraphicsDriver::GetSpoolMetaData() const
|
|||||||
inline int
|
inline int
|
||||||
GraphicsDriver::GetProtocolClass() const
|
GraphicsDriver::GetProtocolClass() const
|
||||||
{
|
{
|
||||||
return fPrinterData->getProtocolClass();
|
return fPrinterData->GetProtocolClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,10 @@ typedef union {
|
|||||||
} ColorRGB32;
|
} ColorRGB32;
|
||||||
|
|
||||||
class Halftone;
|
class Halftone;
|
||||||
typedef void (Halftone::*PFN_dither)(uchar *dst, const uchar *src, int x, int y, int width);
|
|
||||||
|
typedef void (Halftone::*PFN_dither)(uchar* destination, const uchar* source,
|
||||||
|
int x, int y, int width);
|
||||||
|
|
||||||
typedef uint (*PFN_gray)(ColorRGB32 c);
|
typedef uint (*PFN_gray)(ColorRGB32 c);
|
||||||
|
|
||||||
class Halftone {
|
class Halftone {
|
||||||
@@ -41,108 +44,139 @@ public:
|
|||||||
kType3,
|
kType3,
|
||||||
kTypeFloydSteinberg,
|
kTypeFloydSteinberg,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GrayFunction {
|
enum GrayFunction {
|
||||||
kMixToGray,
|
kMixToGray,
|
||||||
kRedChannel,
|
kRedChannel,
|
||||||
kGreenChannel,
|
kGreenChannel,
|
||||||
kBlueChannel
|
kBlueChannel
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Planes {
|
enum Planes {
|
||||||
kPlaneMonochrome1, // 1 bit depth (0 white, 1 black)
|
kPlaneMonochrome1, // 1 bit depth (0 white, 1 black)
|
||||||
kPlaneRGB1, // 3 planes, 1 bit depth (0 black, 7 white)
|
kPlaneRGB1, // 3 planes, 1 bit depth (0 black, 7 white)
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BlackValue {
|
enum BlackValue {
|
||||||
kHighValueMeansBlack,
|
kHighValueMeansBlack,
|
||||||
kLowValueMeansBlack,
|
kLowValueMeansBlack,
|
||||||
};
|
};
|
||||||
Halftone(color_space cs, double gamma = 1.4, double min = 0.0, DitherType dither_type = kTypeFloydSteinberg);
|
|
||||||
~Halftone();
|
Halftone(color_space colorSpace, double gamma = 1.4,
|
||||||
void setPlanes(Planes planes);
|
double min = 0.0,
|
||||||
void setBlackValue(BlackValue blackValue);
|
DitherType dither_type = kTypeFloydSteinberg);
|
||||||
void dither(uchar *dst, const uchar *src, int x, int y, int width);
|
~Halftone();
|
||||||
int getPixelDepth() const;
|
|
||||||
const uchar *getPattern() const;
|
void SetPlanes(Planes planes);
|
||||||
void setPattern(const uchar *pattern);
|
void SetBlackValue(BlackValue blackValue);
|
||||||
|
|
||||||
|
void Dither(uchar *destination, const uchar *source, int x,
|
||||||
|
int y, int width);
|
||||||
|
|
||||||
|
int GetPixelDepth() const;
|
||||||
|
|
||||||
|
const uchar* GetPattern() const;
|
||||||
|
void SetPattern(const uchar *pattern);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// PFN_gray: return value of 0 means low density (or black) and value of 255 means high density (or white)
|
Halftone(const Halftone &);
|
||||||
PFN_gray getGrayFunction() const;
|
|
||||||
void setGrayFunction(PFN_gray gray);
|
|
||||||
void setGrayFunction(GrayFunction grayFunction);
|
|
||||||
|
|
||||||
void createGammaTable(double gamma, double min);
|
Halftone& operator=(const Halftone &);
|
||||||
void initElements(int x, int y, uchar *elements);
|
|
||||||
uint getDensity(ColorRGB32 c) const;
|
|
||||||
uchar convertUsingBlackValue(uchar byte) const;
|
|
||||||
void ditherRGB32(uchar *dst, const uchar *src, int x, int y, int width);
|
|
||||||
|
|
||||||
void initFloydSteinberg();
|
// PFN_gray: return value of 0 means low density (or black) and
|
||||||
void deleteErrorTables();
|
// value of 255 means high density (or white)
|
||||||
void uninitFloydSteinberg();
|
PFN_gray GetGrayFunction() const;
|
||||||
void setupErrorBuffer(int x, int y, int width);
|
void SetGrayFunction(PFN_gray gray);
|
||||||
void ditherFloydSteinberg(uchar *dst, const uchar* src, int x, int y, int width);
|
void SetGrayFunction(GrayFunction grayFunction);
|
||||||
|
|
||||||
Halftone(const Halftone &);
|
void CreateGammaTable(double gamma, double min);
|
||||||
Halftone &operator = (const Halftone &);
|
void InitElements(int x, int y, uchar* elements);
|
||||||
|
uint GetDensity(ColorRGB32 c) const;
|
||||||
|
uchar ConvertUsingBlackValue(uchar byte) const;
|
||||||
|
void DitherRGB32(uchar* destination, const uchar* source,
|
||||||
|
int x, int y, int width);
|
||||||
|
|
||||||
|
void InitFloydSteinberg();
|
||||||
|
void DeleteErrorTables();
|
||||||
|
void UninitFloydSteinberg();
|
||||||
|
void SetupErrorBuffer(int x, int y, int width);
|
||||||
|
void DitherFloydSteinberg(uchar* destination,
|
||||||
|
const uchar* source, int x, int y, int width);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
kGammaTableSize = 256,
|
kGammaTableSize = 256,
|
||||||
kMaxNumberOfPlanes = 3
|
kMaxNumberOfPlanes = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
PFN_dither fDither;
|
PFN_dither fDither;
|
||||||
PFN_gray fGray;
|
PFN_gray fGray;
|
||||||
int fPixelDepth;
|
int fPixelDepth;
|
||||||
Planes fPlanes;
|
Planes fPlanes;
|
||||||
BlackValue fBlackValue;
|
BlackValue fBlackValue;
|
||||||
const uchar *fPattern;
|
const uchar* fPattern;
|
||||||
uint fGammaTable[kGammaTableSize];
|
uint fGammaTable[kGammaTableSize];
|
||||||
int fNumberOfPlanes;
|
int fNumberOfPlanes;
|
||||||
int fCurrentPlane;
|
int fCurrentPlane;
|
||||||
// fields used for floyd-steinberg dithering
|
// fields used for floyd-steinberg dithering
|
||||||
int fX;
|
int fX;
|
||||||
int fY;
|
int fY;
|
||||||
int fWidth;
|
int fWidth;
|
||||||
int *fErrorTables[kMaxNumberOfPlanes];
|
int* fErrorTables[kMaxNumberOfPlanes];
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int Halftone::getPixelDepth() const
|
|
||||||
|
inline int
|
||||||
|
Halftone::GetPixelDepth() const
|
||||||
{
|
{
|
||||||
return fPixelDepth;
|
return fPixelDepth;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const uchar * Halftone::getPattern() const
|
|
||||||
|
inline const uchar*
|
||||||
|
Halftone::GetPattern() const
|
||||||
{
|
{
|
||||||
return fPattern;
|
return fPattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Halftone::setPattern(const uchar *pattern)
|
|
||||||
|
inline void
|
||||||
|
Halftone::SetPattern(const uchar* pattern)
|
||||||
{
|
{
|
||||||
fPattern = pattern;
|
fPattern = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PFN_gray Halftone::getGrayFunction() const
|
|
||||||
|
inline PFN_gray
|
||||||
|
Halftone::GetGrayFunction() const
|
||||||
{
|
{
|
||||||
return fGray;
|
return fGray;
|
||||||
}
|
}
|
||||||
inline void Halftone::setGrayFunction(PFN_gray gray)
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
Halftone::SetGrayFunction(PFN_gray gray)
|
||||||
{
|
{
|
||||||
fGray = gray;
|
fGray = gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint Halftone::getDensity(ColorRGB32 c) const
|
|
||||||
|
inline uint
|
||||||
|
Halftone::GetDensity(ColorRGB32 c) const
|
||||||
{
|
{
|
||||||
return fGammaTable[fGray(c)];
|
return fGammaTable[fGray(c)];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uchar Halftone::convertUsingBlackValue(uchar byte) const
|
|
||||||
|
inline uchar
|
||||||
|
Halftone::ConvertUsingBlackValue(uchar byte) const
|
||||||
{
|
{
|
||||||
// bits with value = '1' in byte mean black
|
// bits with value = '1' in byte mean black
|
||||||
if (fBlackValue == kHighValueMeansBlack) {
|
if (fBlackValue == kHighValueMeansBlack)
|
||||||
return byte;
|
return byte;
|
||||||
} else {
|
|
||||||
return ~byte;
|
return ~byte;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* __HALFTONE_H */
|
#endif /* __HALFTONE_H */
|
||||||
|
|||||||
@@ -12,17 +12,21 @@
|
|||||||
class HalftonePreviewView : public BView
|
class HalftonePreviewView : public BView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HalftonePreviewView(BRect frame, const char* name, uint32 resizeMask, uint32 flags);
|
HalftonePreviewView(BRect frame, const char* name,
|
||||||
|
uint32 resizeMask, uint32 flags);
|
||||||
|
|
||||||
void preview(float gamma, float min, Halftone::DitherType ditherType, bool color);
|
void Preview(float gamma, float min, Halftone::DitherType ditherType,
|
||||||
|
bool color);
|
||||||
};
|
};
|
||||||
|
|
||||||
class HalftoneView : public BView
|
class HalftoneView : public BView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HalftoneView(BRect frame, const char* name, uint32 resizeMask, uint32 flags);
|
HalftoneView(BRect frame, const char* name, uint32 resizeMask,
|
||||||
|
uint32 flags);
|
||||||
|
|
||||||
void preview(float gamma, float min, Halftone::DitherType ditherType, bool color);
|
void Preview(float gamma, float min, Halftone::DitherType ditherType,
|
||||||
|
bool color);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HalftonePreviewView* fPreview;
|
HalftonePreviewView* fPreview;
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ class DriverSpecificSettings
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DriverSpecificSettings();
|
DriverSpecificSettings();
|
||||||
DriverSpecificSettings(const DriverSpecificSettings& settings);
|
DriverSpecificSettings(const DriverSpecificSettings& Settings);
|
||||||
|
|
||||||
DriverSpecificSettings &operator=(const DriverSpecificSettings &settings);
|
DriverSpecificSettings &operator=(const DriverSpecificSettings &Settings);
|
||||||
|
|
||||||
void MakeEmpty();
|
void MakeEmpty();
|
||||||
|
|
||||||
@@ -262,6 +262,110 @@ public:
|
|||||||
kEvenNumberedPages
|
kEvenNumberedPages
|
||||||
};
|
};
|
||||||
|
|
||||||
|
JobData(BMessage* message, const PrinterCap* printerCap,
|
||||||
|
SettingType type);
|
||||||
|
~JobData();
|
||||||
|
|
||||||
|
JobData(const JobData& jobData);
|
||||||
|
JobData& operator=(const JobData& jobData);
|
||||||
|
|
||||||
|
void Load(BMessage* message, const PrinterCap* printerCap,
|
||||||
|
SettingType type);
|
||||||
|
void Save(BMessage* message = NULL);
|
||||||
|
|
||||||
|
bool GetShowPreview() const;
|
||||||
|
void SetShowPreview(bool showPreview);
|
||||||
|
|
||||||
|
Paper GetPaper() const;
|
||||||
|
void SetPaper(Paper paper);
|
||||||
|
|
||||||
|
int32 GetResolutionID() const;
|
||||||
|
void SetResolutionID(int32 resolution);
|
||||||
|
|
||||||
|
int32 GetXres() const;
|
||||||
|
void SetXres(int32 xres);
|
||||||
|
|
||||||
|
int32 GetYres() const;
|
||||||
|
void SetYres(int32 yres);
|
||||||
|
|
||||||
|
Orientation GetOrientation() const;
|
||||||
|
void SetOrientation(Orientation orientation);
|
||||||
|
|
||||||
|
float GetScaling() const;
|
||||||
|
void SetScaling(float scaling);
|
||||||
|
|
||||||
|
const BRect& GetPaperRect() const;
|
||||||
|
void SetPaperRect(const BRect& paperRect);
|
||||||
|
|
||||||
|
const BRect& GetScaledPaperRect() const;
|
||||||
|
void SetScaledPaperRect(const BRect& paperRect);
|
||||||
|
|
||||||
|
const BRect& GetPrintableRect() const;
|
||||||
|
void SetPrintableRect(const BRect& printableRect);
|
||||||
|
|
||||||
|
const BRect& GetScaledPrintableRect() const;
|
||||||
|
void SetScaledPrintableRect(const BRect& printableRect);
|
||||||
|
|
||||||
|
const BRect& GetPhysicalRect() const;
|
||||||
|
void SetPhysicalRect(const BRect& PhysicalRect);
|
||||||
|
|
||||||
|
const BRect& GetScaledPhysicalRect() const;
|
||||||
|
void SetScaledPhysicalRect(const BRect& PhysicalRect);
|
||||||
|
|
||||||
|
int32 GetNup() const;
|
||||||
|
void SetNup(int32 nup);
|
||||||
|
|
||||||
|
bool GetReverse() const;
|
||||||
|
void SetReverse(bool reverse);
|
||||||
|
|
||||||
|
int32 GetFirstPage() const;
|
||||||
|
void SetFirstPage(int32 firstPage);
|
||||||
|
|
||||||
|
int32 GetLastPage() const;
|
||||||
|
void SetLastPage(int32 lastPage);
|
||||||
|
|
||||||
|
// libprint supports only B_RGB32
|
||||||
|
color_space GetSurfaceType() const;
|
||||||
|
|
||||||
|
float GetGamma() const;
|
||||||
|
void SetGamma(float gamma);
|
||||||
|
|
||||||
|
float GetInkDensity() const;
|
||||||
|
void SetInkDensity(float inkDensity);
|
||||||
|
|
||||||
|
PaperSource GetPaperSource() const;
|
||||||
|
void SetPaperSource(PaperSource paperSource);
|
||||||
|
|
||||||
|
int32 GetCopies() const;
|
||||||
|
void SetCopies(int32 copies);
|
||||||
|
|
||||||
|
bool GetCollate() const;
|
||||||
|
void SetCollate(bool collate);
|
||||||
|
|
||||||
|
PrintStyle GetPrintStyle() const;
|
||||||
|
void SetPrintStyle(PrintStyle printStyle);
|
||||||
|
|
||||||
|
BindingLocation GetBindingLocation() const;
|
||||||
|
void SetBindingLocation(BindingLocation bindingLocation);
|
||||||
|
|
||||||
|
PageOrder GetPageOrder() const;
|
||||||
|
void SetPageOrder(PageOrder pageOrder);
|
||||||
|
|
||||||
|
Color GetColor() const;
|
||||||
|
void SetColor(Color color);
|
||||||
|
|
||||||
|
Halftone::DitherType GetDitherType() const;
|
||||||
|
void SetDitherType(Halftone::DitherType ditherType);
|
||||||
|
|
||||||
|
PageSelection GetPageSelection() const;
|
||||||
|
void SetPageSelection(PageSelection pageSelection);
|
||||||
|
|
||||||
|
MarginUnit GetMarginUnit() const;
|
||||||
|
void SetMarginUnit(MarginUnit marginUnit);
|
||||||
|
|
||||||
|
DriverSpecificSettings& Settings();
|
||||||
|
const DriverSpecificSettings& Settings() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fShowPreview;
|
bool fShowPreview;
|
||||||
Paper fPaper;
|
Paper fPaper;
|
||||||
@@ -295,110 +399,416 @@ private:
|
|||||||
PageSelection fPageSelection;
|
PageSelection fPageSelection;
|
||||||
MarginUnit fMarginUnit;
|
MarginUnit fMarginUnit;
|
||||||
DriverSpecificSettings fDriverSpecificSettings;
|
DriverSpecificSettings fDriverSpecificSettings;
|
||||||
|
|
||||||
public:
|
|
||||||
JobData(BMessage *msg, const PrinterCap *cap, SettingType type);
|
|
||||||
~JobData();
|
|
||||||
|
|
||||||
JobData(const JobData &job_data);
|
|
||||||
JobData &operator = (const JobData &job_data);
|
|
||||||
|
|
||||||
void load(BMessage *msg, const PrinterCap *cap, SettingType type);
|
|
||||||
void save(BMessage *msg = NULL);
|
|
||||||
|
|
||||||
bool getShowPreview() const { return fShowPreview; }
|
|
||||||
void setShowPreview(bool showPreview) { fShowPreview = showPreview; }
|
|
||||||
|
|
||||||
Paper getPaper() const { return fPaper; }
|
|
||||||
void setPaper(Paper paper) { fPaper = paper; }
|
|
||||||
|
|
||||||
int32 getResolutionID() const { return fResolutionID; }
|
|
||||||
void setResolutionID(int32 resolution) { fResolutionID = resolution; }
|
|
||||||
|
|
||||||
int32 getXres() const { return fXRes; }
|
|
||||||
void setXres(int32 xres) { fXRes = xres; }
|
|
||||||
|
|
||||||
int32 getYres() const { return fYRes; }
|
|
||||||
void setYres(int32 yres) { fYRes = yres; };
|
|
||||||
|
|
||||||
Orientation getOrientation() const { return fOrientation; }
|
|
||||||
void setOrientation(Orientation orientation) { fOrientation = orientation; }
|
|
||||||
|
|
||||||
float getScaling() const { return fScaling; }
|
|
||||||
void setScaling(float scaling) { fScaling = scaling; }
|
|
||||||
|
|
||||||
const BRect &getPaperRect() const { return fPaperRect; }
|
|
||||||
void setPaperRect(const BRect &paper_rect) { fPaperRect = paper_rect; }
|
|
||||||
|
|
||||||
const BRect &getScaledPaperRect() const { return fScaledPaperRect; }
|
|
||||||
void setScaledPaperRect(const BRect &paper_rect) { fScaledPaperRect = paper_rect; }
|
|
||||||
|
|
||||||
const BRect &getPrintableRect() const { return fPrintableRect; }
|
|
||||||
void setPrintableRect(const BRect &printable_rect) { fPrintableRect = printable_rect; }
|
|
||||||
|
|
||||||
const BRect &getScaledPrintableRect() const { return fScaledPrintableRect; }
|
|
||||||
void setScaledPrintableRect(const BRect &printable_rect) { fScaledPrintableRect = printable_rect; }
|
|
||||||
|
|
||||||
const BRect &getPhysicalRect() const { return fPhysicalRect; }
|
|
||||||
void setPhysicalRect(const BRect &Physical_rect) { fPhysicalRect = Physical_rect; }
|
|
||||||
|
|
||||||
const BRect &getScaledPhysicalRect() const { return fScaledPhysicalRect; }
|
|
||||||
void setScaledPhysicalRect(const BRect &Physical_rect) { fScaledPhysicalRect = Physical_rect; }
|
|
||||||
|
|
||||||
int32 getNup() const { return fNup; }
|
|
||||||
void setNup(int32 nup) { fNup = nup; }
|
|
||||||
|
|
||||||
bool getReverse() const { return fReverse; }
|
|
||||||
void setReverse(bool reverse) { fReverse = reverse; }
|
|
||||||
|
|
||||||
int32 getFirstPage() const { return fFirstPage; }
|
|
||||||
void setFirstPage(int32 first_page) { fFirstPage = first_page; }
|
|
||||||
|
|
||||||
int32 getLastPage() const { return fLastPage; }
|
|
||||||
void setLastPage(int32 last_page) { fLastPage = last_page; }
|
|
||||||
|
|
||||||
// libprint supports only B_RGB32
|
|
||||||
color_space getSurfaceType() const { return B_RGB32; }
|
|
||||||
|
|
||||||
float getGamma() const { return fGamma; }
|
|
||||||
void setGamma(float gamma) { fGamma = gamma; }
|
|
||||||
|
|
||||||
float getInkDensity() const { return fInkDensity; }
|
|
||||||
void setInkDensity(float inkDensity) { fInkDensity = inkDensity; }
|
|
||||||
|
|
||||||
PaperSource getPaperSource() const { return fPaperSource; }
|
|
||||||
void setPaperSource(PaperSource paper_source) { fPaperSource = paper_source; };
|
|
||||||
|
|
||||||
int32 getCopies() const { return fCopies; }
|
|
||||||
void setCopies(int32 copies) { fCopies = copies; }
|
|
||||||
|
|
||||||
bool getCollate() const { return fCollate; }
|
|
||||||
void setCollate(bool collate) { fCollate = collate; }
|
|
||||||
|
|
||||||
PrintStyle getPrintStyle() const { return fPrintStyle; }
|
|
||||||
void setPrintStyle(PrintStyle print_style) { fPrintStyle = print_style; }
|
|
||||||
|
|
||||||
BindingLocation getBindingLocation() const { return fBindingLocation; }
|
|
||||||
void setBindingLocation(BindingLocation binding_location) { fBindingLocation = binding_location; }
|
|
||||||
|
|
||||||
PageOrder getPageOrder() const { return fPageOrder; }
|
|
||||||
void setPageOrder(PageOrder page_order) { fPageOrder = page_order; }
|
|
||||||
|
|
||||||
Color getColor() const { return fColor; }
|
|
||||||
void setColor(Color color) { fColor = color; }
|
|
||||||
|
|
||||||
Halftone::DitherType getDitherType() const { return fDitherType; }
|
|
||||||
void setDitherType(Halftone::DitherType dither_type) { fDitherType = dither_type; }
|
|
||||||
|
|
||||||
PageSelection getPageSelection() const { return fPageSelection; }
|
|
||||||
void setPageSelection(PageSelection pageSelection) { fPageSelection = pageSelection; }
|
|
||||||
|
|
||||||
MarginUnit getMarginUnit() const { return fMarginUnit; }
|
|
||||||
void setMarginUnit(MarginUnit marginUnit) { fMarginUnit = marginUnit; }
|
|
||||||
|
|
||||||
DriverSpecificSettings& Settings();
|
|
||||||
const DriverSpecificSettings& Settings() const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
JobData::GetShowPreview() const
|
||||||
|
{
|
||||||
|
return fShowPreview;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetShowPreview(bool showPreview)
|
||||||
|
{
|
||||||
|
fShowPreview = showPreview;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline JobData::Paper
|
||||||
|
JobData::GetPaper() const
|
||||||
|
{
|
||||||
|
return fPaper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetPaper(Paper paper)
|
||||||
|
{
|
||||||
|
fPaper = paper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int32
|
||||||
|
JobData::GetResolutionID() const
|
||||||
|
{
|
||||||
|
return fResolutionID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetResolutionID(int32 resolution)
|
||||||
|
{
|
||||||
|
fResolutionID = resolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int32
|
||||||
|
JobData::GetXres() const
|
||||||
|
{
|
||||||
|
return fXRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetXres(int32 xres)
|
||||||
|
{
|
||||||
|
fXRes = xres;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int32
|
||||||
|
JobData::GetYres() const
|
||||||
|
{
|
||||||
|
return fYRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetYres(int32 yres)
|
||||||
|
{
|
||||||
|
fYRes = yres;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline JobData::Orientation
|
||||||
|
JobData::GetOrientation() const
|
||||||
|
{
|
||||||
|
return fOrientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetOrientation(Orientation orientation)
|
||||||
|
{
|
||||||
|
fOrientation = orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline float
|
||||||
|
JobData::GetScaling() const
|
||||||
|
{
|
||||||
|
return fScaling;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetScaling(float scaling)
|
||||||
|
{
|
||||||
|
fScaling = scaling;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const BRect&
|
||||||
|
JobData::GetPaperRect() const
|
||||||
|
{
|
||||||
|
return fPaperRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetPaperRect(const BRect &rect)
|
||||||
|
{
|
||||||
|
fPaperRect = rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const BRect&
|
||||||
|
JobData::GetScaledPaperRect() const
|
||||||
|
{
|
||||||
|
return fScaledPaperRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetScaledPaperRect(const BRect &rect)
|
||||||
|
{
|
||||||
|
fScaledPaperRect = rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const BRect &
|
||||||
|
JobData::GetPrintableRect() const
|
||||||
|
{
|
||||||
|
return fPrintableRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetPrintableRect(const BRect &rect)
|
||||||
|
{
|
||||||
|
fPrintableRect = rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const BRect&
|
||||||
|
JobData::GetScaledPrintableRect() const
|
||||||
|
{
|
||||||
|
return fScaledPrintableRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetScaledPrintableRect(const BRect &rect)
|
||||||
|
{
|
||||||
|
fScaledPrintableRect = rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const BRect&
|
||||||
|
JobData::GetPhysicalRect() const
|
||||||
|
{
|
||||||
|
return fPhysicalRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetPhysicalRect(const BRect &rect)
|
||||||
|
{
|
||||||
|
fPhysicalRect = rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const BRect&
|
||||||
|
JobData::GetScaledPhysicalRect() const
|
||||||
|
{
|
||||||
|
return fScaledPhysicalRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetScaledPhysicalRect(const BRect &rect)
|
||||||
|
{
|
||||||
|
fScaledPhysicalRect = rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int32
|
||||||
|
JobData::GetNup() const
|
||||||
|
{
|
||||||
|
return fNup;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetNup(int32 nup)
|
||||||
|
{
|
||||||
|
fNup = nup;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
JobData::GetReverse() const
|
||||||
|
{
|
||||||
|
return fReverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetReverse(bool reverse)
|
||||||
|
{
|
||||||
|
fReverse = reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int32
|
||||||
|
JobData::GetFirstPage() const
|
||||||
|
{
|
||||||
|
return fFirstPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetFirstPage(int32 firstPage)
|
||||||
|
{
|
||||||
|
fFirstPage = firstPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int32
|
||||||
|
JobData::GetLastPage() const
|
||||||
|
{
|
||||||
|
return fLastPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetLastPage(int32 lastPage)
|
||||||
|
{
|
||||||
|
fLastPage = lastPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
color_space
|
||||||
|
inline JobData::GetSurfaceType() const
|
||||||
|
{
|
||||||
|
return B_RGB32;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline float
|
||||||
|
JobData::GetGamma() const
|
||||||
|
{
|
||||||
|
return fGamma;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetGamma(float gamma)
|
||||||
|
{
|
||||||
|
fGamma = gamma;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline float
|
||||||
|
JobData::GetInkDensity() const
|
||||||
|
{
|
||||||
|
return fInkDensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetInkDensity(float inkDensity)
|
||||||
|
{
|
||||||
|
fInkDensity = inkDensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline JobData::PaperSource
|
||||||
|
JobData::GetPaperSource() const
|
||||||
|
{
|
||||||
|
return fPaperSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetPaperSource(PaperSource paperSource)
|
||||||
|
{
|
||||||
|
fPaperSource = paperSource;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline int32
|
||||||
|
JobData::GetCopies() const
|
||||||
|
{
|
||||||
|
return fCopies;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetCopies(int32 copies)
|
||||||
|
{
|
||||||
|
fCopies = copies;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
JobData::GetCollate() const
|
||||||
|
{
|
||||||
|
return fCollate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetCollate(bool collate)
|
||||||
|
{
|
||||||
|
fCollate = collate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline JobData::PrintStyle
|
||||||
|
JobData::GetPrintStyle() const
|
||||||
|
{
|
||||||
|
return fPrintStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetPrintStyle(PrintStyle print_style)
|
||||||
|
{
|
||||||
|
fPrintStyle = print_style;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline JobData::BindingLocation
|
||||||
|
JobData::GetBindingLocation() const
|
||||||
|
{
|
||||||
|
return fBindingLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetBindingLocation(BindingLocation binding_location)
|
||||||
|
{
|
||||||
|
fBindingLocation = binding_location;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline JobData::PageOrder
|
||||||
|
JobData::GetPageOrder() const { return fPageOrder; }
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetPageOrder(PageOrder page_order)
|
||||||
|
{
|
||||||
|
fPageOrder = page_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline JobData::Color
|
||||||
|
JobData::GetColor() const
|
||||||
|
{
|
||||||
|
return fColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetColor(Color color)
|
||||||
|
{
|
||||||
|
fColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Halftone::DitherType
|
||||||
|
JobData::GetDitherType() const
|
||||||
|
{
|
||||||
|
return fDitherType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetDitherType(Halftone::DitherType dither_type)
|
||||||
|
{
|
||||||
|
fDitherType = dither_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline JobData::PageSelection
|
||||||
|
JobData::GetPageSelection() const
|
||||||
|
{
|
||||||
|
return fPageSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetPageSelection(PageSelection pageSelection)
|
||||||
|
{
|
||||||
|
fPageSelection = pageSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline MarginUnit
|
||||||
|
JobData::GetMarginUnit() const
|
||||||
|
{
|
||||||
|
return fMarginUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void
|
||||||
|
JobData::SetMarginUnit(MarginUnit marginUnit)
|
||||||
|
{
|
||||||
|
fMarginUnit = marginUnit;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __JOBDATA_H */
|
#endif /* __JOBDATA_H */
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
#ifndef __PACKBITS_H
|
#ifndef __PACKBITS_H
|
||||||
#define __PACKBITS_H
|
#define __PACKBITS_H
|
||||||
|
|
||||||
int pack_bits_size(const unsigned char *in, int bytes);
|
int pack_bits_size(const unsigned char* source, int size);
|
||||||
int pack_bits(unsigned char *out, const unsigned char *in, int bytes);
|
int pack_bits(unsigned char* destination, const unsigned char* source,
|
||||||
|
int size);
|
||||||
|
|
||||||
#endif /* __PACKBITS_H */
|
#endif /* __PACKBITS_H */
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ public:
|
|||||||
void GetPreferredSize(float *width, float *height);
|
void GetPreferredSize(float *width, float *height);
|
||||||
void Draw(BRect rect);
|
void Draw(BRect rect);
|
||||||
|
|
||||||
void setCollate(bool collate);
|
void SetCollate(bool collate);
|
||||||
void setReverse(bool reverse);
|
void SetReverse(bool reverse);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawPages(BPoint position, int number, int count);
|
void _DrawPages(BPoint position, int number, int count);
|
||||||
void DrawPage(BPoint position, int number);
|
void _DrawPage(BPoint position, int number);
|
||||||
|
|
||||||
bool fCollate;
|
bool fCollate;
|
||||||
bool fReverse;
|
bool fReverse;
|
||||||
|
|||||||
@@ -35,52 +35,57 @@ THE SOFTWARE.
|
|||||||
#include <Picture.h>
|
#include <Picture.h>
|
||||||
|
|
||||||
class PrintJobPage {
|
class PrintJobPage {
|
||||||
BFile fJobFile; // the job file
|
|
||||||
off_t fNextPicture; // offset to first picture
|
|
||||||
int32 fNumberOfPictures; // of this page
|
|
||||||
int32 fPicture; // the picture returned by NextPicture()
|
|
||||||
status_t fStatus;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PrintJobPage();
|
PrintJobPage();
|
||||||
PrintJobPage(const PrintJobPage& copy);
|
PrintJobPage(const PrintJobPage& copy);
|
||||||
PrintJobPage(BFile* jobFile, off_t start);
|
PrintJobPage(BFile* jobFile, off_t start);
|
||||||
status_t InitCheck() const;
|
|
||||||
|
|
||||||
int32 NumberOfPictures() const { return fNumberOfPictures; }
|
status_t InitCheck() const;
|
||||||
|
|
||||||
status_t NextPicture(BPicture& picture, BPoint& p, BRect& r);
|
int32 NumberOfPictures() const { return fNumberOfPictures; }
|
||||||
|
|
||||||
|
status_t NextPicture(BPicture& picture, BPoint& p, BRect& r);
|
||||||
|
|
||||||
PrintJobPage& operator=(const PrintJobPage& copy);
|
PrintJobPage& operator=(const PrintJobPage& copy);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BFile fJobFile; // the job file
|
||||||
|
off_t fNextPicture; // offset to first picture
|
||||||
|
int32 fNumberOfPictures; // of this page
|
||||||
|
int32 fPicture; // the picture returned by NextPicture()
|
||||||
|
status_t fStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PrintJobReader {
|
class PrintJobReader {
|
||||||
BFile fJobFile; // the job file
|
|
||||||
int32 fNumberOfPages; // the number of pages in the job file
|
|
||||||
BMessage fJobSettings; // the settings extracted from the job file
|
|
||||||
off_t* fPageIndex; // start positions of pages in the job file
|
|
||||||
|
|
||||||
void BuildPageIndex();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PrintJobReader(BFile* jobFile);
|
PrintJobReader(BFile* jobFile);
|
||||||
virtual ~PrintJobReader();
|
virtual ~PrintJobReader();
|
||||||
|
|
||||||
// test after construction if this is a valid job file
|
// test after construction if this is a valid job file
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
|
|
||||||
// accessors to informations from job file
|
// accessors to informations from job file
|
||||||
int32 NumberOfPages() const { return fNumberOfPages; }
|
int32 NumberOfPages() const { return fNumberOfPages; }
|
||||||
int32 FirstPage() const;
|
int32 FirstPage() const;
|
||||||
int32 LastPage() const;
|
int32 LastPage() const;
|
||||||
const BMessage* JobSettings() const { return &fJobSettings; }
|
const BMessage* JobSettings() const { return &fJobSettings; }
|
||||||
BRect PaperRect() const;
|
BRect PaperRect() const;
|
||||||
BRect PrintableRect() const;
|
BRect PrintableRect() const;
|
||||||
void GetResolution(int32 *xdpi, int32 *ydpi) const;
|
void GetResolution(int32* xdpi, int32* ydpi) const;
|
||||||
float GetScale() const;
|
float GetScale() const;
|
||||||
|
|
||||||
|
// retrieve page
|
||||||
|
status_t GetPage(int32 no, PrintJobPage& pjp);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _BuildPageIndex();
|
||||||
|
|
||||||
|
BFile fJobFile; // the job file
|
||||||
|
int32 fNumberOfPages; // the number of pages in the job file
|
||||||
|
BMessage fJobSettings; // the settings extracted from the job file
|
||||||
|
off_t* fPageIndex; // start positions of pages in the job file
|
||||||
|
|
||||||
// retrieve page
|
|
||||||
status_t GetPage(int32 no, PrintJobPage& pjp);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -262,28 +262,28 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual int countCap(CapID category) const = 0;
|
virtual int CountCap(CapID category) const = 0;
|
||||||
virtual bool isSupport(CapID category) const = 0;
|
virtual bool IsSupport(CapID category) const = 0;
|
||||||
virtual const BaseCap** enumCap(CapID category) const = 0;
|
virtual const BaseCap** GetCaps(CapID category) const = 0;
|
||||||
const EnumCap* getDefaultCap(CapID category) const;
|
const EnumCap* GetDefaultCap(CapID category) const;
|
||||||
const EnumCap* findCap(CapID category, int id) const;
|
const EnumCap* FindCap(CapID category, int id) const;
|
||||||
const BaseCap* findCap(CapID category, const char* label) const;
|
const BaseCap* FindCap(CapID category, const char* label) const;
|
||||||
const EnumCap* findCapWithKey(CapID category, const char* key)
|
const EnumCap* FindCapWithKey(CapID category, const char* key)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
const BooleanCap* findBooleanCap(CapID category) const;
|
const BooleanCap* FindBooleanCap(CapID category) const;
|
||||||
const IntRangeCap* findIntRangeCap(CapID category) const;
|
const IntRangeCap* FindIntRangeCap(CapID category) const;
|
||||||
const DoubleRangeCap* findDoubleRangeCap(CapID category) const;
|
const DoubleRangeCap* FindDoubleRangeCap(CapID category) const;
|
||||||
|
|
||||||
int getProtocolClass() const;
|
int GetProtocolClass() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PrinterCap(const PrinterCap& printerCap);
|
PrinterCap(const PrinterCap& printerCap);
|
||||||
PrinterCap& operator=(const PrinterCap& printerCap);
|
PrinterCap& operator=(const PrinterCap& printerCap);
|
||||||
template<typename Predicate>
|
template<typename Predicate>
|
||||||
const BaseCap* findCap(CapID category, Predicate& predicate) const;
|
const BaseCap* FindCap(CapID category, Predicate& predicate) const;
|
||||||
|
|
||||||
const PrinterData* getPrinterData() const;
|
const PrinterData* GetPrinterData() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const PrinterData* fPrinterData;
|
const PrinterData* fPrinterData;
|
||||||
|
|||||||
@@ -15,72 +15,91 @@ class BNode;
|
|||||||
|
|
||||||
class PrinterData {
|
class PrinterData {
|
||||||
public:
|
public:
|
||||||
PrinterData(BNode *node = NULL);
|
PrinterData(BNode* node = NULL);
|
||||||
virtual ~PrinterData();
|
virtual ~PrinterData();
|
||||||
virtual void load();
|
|
||||||
virtual void save();
|
|
||||||
|
|
||||||
const string &getDriverName() const;
|
virtual void Load();
|
||||||
const string &getPrinterName() const;
|
virtual void Save();
|
||||||
const string &getComments() const;
|
|
||||||
const string &getTransport() const;
|
|
||||||
int getProtocolClass() const;
|
|
||||||
|
|
||||||
void setPrinterName(const char *printer_name);
|
const string& GetDriverName() const;
|
||||||
void setComments(const char *comments);
|
const string& GetPrinterName() const;
|
||||||
void setProtocolClass(int protocolClass);
|
const string& GetComments() const;
|
||||||
|
const string& GetTransport() const;
|
||||||
|
int GetProtocolClass() const;
|
||||||
|
|
||||||
bool getPath(string &path) const;
|
void SetPrinterName(const char* printerName);
|
||||||
|
void SetComments(const char* comments);
|
||||||
|
void SetProtocolClass(int protocolClass);
|
||||||
|
|
||||||
|
bool GetPath(string& path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PrinterData(const PrinterData &printer_data);
|
PrinterData(const PrinterData &printer_data);
|
||||||
PrinterData &operator = (const PrinterData &printer_data);
|
|
||||||
|
PrinterData& operator=(const PrinterData &printer_data);
|
||||||
|
|
||||||
|
BNode* fNode;
|
||||||
|
|
||||||
BNode *fNode;
|
|
||||||
private:
|
private:
|
||||||
string fDriverName;
|
string fDriverName;
|
||||||
string fPrinterName;
|
string fPrinterName;
|
||||||
string fComments;
|
string fComments;
|
||||||
string fTransport;
|
string fTransport;
|
||||||
int fProtocolClass;
|
int fProtocolClass;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline const string &PrinterData::getDriverName() const
|
|
||||||
|
inline const string&
|
||||||
|
PrinterData::GetDriverName() const
|
||||||
{
|
{
|
||||||
return fDriverName;
|
return fDriverName;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const string &PrinterData::getPrinterName() const
|
|
||||||
|
inline const string&
|
||||||
|
PrinterData::GetPrinterName() const
|
||||||
{
|
{
|
||||||
return fPrinterName;
|
return fPrinterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const string &PrinterData::getComments() const
|
|
||||||
|
inline const string&
|
||||||
|
PrinterData::GetComments() const
|
||||||
{
|
{
|
||||||
return fComments;
|
return fComments;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const string &PrinterData::getTransport() const
|
|
||||||
|
inline const string&
|
||||||
|
PrinterData::GetTransport() const
|
||||||
{
|
{
|
||||||
return fTransport;
|
return fTransport;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int PrinterData::getProtocolClass() const
|
|
||||||
|
inline int
|
||||||
|
PrinterData::GetProtocolClass() const
|
||||||
{
|
{
|
||||||
return fProtocolClass;
|
return fProtocolClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void PrinterData::setPrinterName(const char *printer_name)
|
|
||||||
|
inline void
|
||||||
|
PrinterData::SetPrinterName(const char* printerName)
|
||||||
{
|
{
|
||||||
fPrinterName = printer_name;
|
fPrinterName = printerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void PrinterData::setComments(const char *comments)
|
|
||||||
|
inline void
|
||||||
|
PrinterData::SetComments(const char* comments)
|
||||||
{
|
{
|
||||||
fComments = comments;
|
fComments = comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void PrinterData::setProtocolClass(int protocolClass)
|
|
||||||
|
inline void
|
||||||
|
PrinterData::SetProtocolClass(int protocolClass)
|
||||||
{
|
{
|
||||||
fProtocolClass = protocolClass;
|
fProtocolClass = protocolClass;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,35 +17,39 @@ class GraphicsDriver;
|
|||||||
|
|
||||||
class PrinterDriver {
|
class PrinterDriver {
|
||||||
public:
|
public:
|
||||||
PrinterDriver(BNode* spoolFolder);
|
PrinterDriver(BNode* spoolFolder);
|
||||||
virtual ~PrinterDriver();
|
virtual ~PrinterDriver();
|
||||||
|
|
||||||
virtual const char* GetSignature() const = 0;
|
virtual const char* GetSignature() const = 0;
|
||||||
virtual const char* GetDriverName() const = 0;
|
virtual const char* GetDriverName() const = 0;
|
||||||
virtual const char* GetVersion() const = 0;
|
virtual const char* GetVersion() const = 0;
|
||||||
virtual const char* GetCopyright() const = 0;
|
virtual const char* GetCopyright() const = 0;
|
||||||
|
|
||||||
virtual PrinterCap* InstantiatePrinterCap(PrinterData* printerData) = 0;
|
virtual PrinterCap* InstantiatePrinterCap(PrinterData* printerData) = 0;
|
||||||
virtual PrinterData* InstantiatePrinterData(BNode* node);
|
virtual PrinterData* InstantiatePrinterData(BNode* node);
|
||||||
virtual GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, PrinterData* printerData, PrinterCap* printerCap) = 0;
|
virtual GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings,
|
||||||
|
PrinterData* printerData,
|
||||||
|
PrinterCap* printerCap) = 0;
|
||||||
|
|
||||||
void InitPrinterDataAndCap();
|
void InitPrinterDataAndCap();
|
||||||
|
|
||||||
virtual void About();
|
virtual void About();
|
||||||
virtual char* AddPrinter(char* printerName);
|
virtual char* AddPrinter(char* printerName);
|
||||||
BMessage* ConfigPage(BMessage* settings);
|
BMessage* ConfigPage(BMessage* settings);
|
||||||
BMessage* ConfigJob(BMessage* settings);
|
BMessage* ConfigJob(BMessage* settings);
|
||||||
BMessage* TakeJob(BFile* printJob, BMessage* settings);
|
BMessage* TakeJob(BFile* printJob, BMessage* settings);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
PrinterData* GetPrinterData() { return fPrinterData; }
|
||||||
PrinterData* GetPrinterData() { return fPrinterData; }
|
PrinterCap* GetPrinterCap() { return fPrinterCap; }
|
||||||
PrinterCap* GetPrinterCap() { return fPrinterCap; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool ReadSettings(const char* attrName, BMessage* settings);
|
bool _ReadSettings(const char* attrName,
|
||||||
void WriteSettings(const char* attrName, BMessage* settings);
|
BMessage* settings);
|
||||||
void MergeWithPreviousSettings(const char* attrName, BMessage* settings);
|
void _WriteSettings(const char* attrName,
|
||||||
|
BMessage* settings);
|
||||||
|
void _MergeWithPreviousSettings(const char* attrName,
|
||||||
|
BMessage* settings);
|
||||||
|
|
||||||
BNode* fSpoolFolder;
|
BNode* fSpoolFolder;
|
||||||
PrinterData* fPrinterData;
|
PrinterData* fPrinterData;
|
||||||
|
|||||||
@@ -9,22 +9,23 @@
|
|||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class SpoolMetaData {
|
class SpoolMetaData {
|
||||||
typedef std::string string;
|
public:
|
||||||
|
SpoolMetaData(BFile* spool_file);
|
||||||
|
~SpoolMetaData();
|
||||||
|
|
||||||
|
const string& GetDescription() const;
|
||||||
|
const string& GetMimeType() const;
|
||||||
|
const string& GetCreationTime() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string fDescription;
|
string fDescription;
|
||||||
string fMimeType;
|
string fMimeType;
|
||||||
string fCreationTime;
|
string fCreationTime;
|
||||||
|
|
||||||
public:
|
|
||||||
SpoolMetaData(BFile* spool_file);
|
|
||||||
~SpoolMetaData();
|
|
||||||
|
|
||||||
const string& getDescription() const { return fDescription; }
|
|
||||||
const string& getMimeType() const { return fMimeType; }
|
|
||||||
const string& getCreationTime() const { return fCreationTime; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* __SpoolMetaData_H */
|
#endif /* __SpoolMetaData_H */
|
||||||
|
|||||||
@@ -21,35 +21,41 @@ extern "C" {
|
|||||||
typedef void (*PFN_exit_transport)(void);
|
typedef void (*PFN_exit_transport)(void);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TransportException {
|
class TransportException {
|
||||||
|
public:
|
||||||
|
TransportException(const string &what_arg);
|
||||||
|
const char* What() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string fWhat;
|
string fWhat;
|
||||||
public:
|
|
||||||
TransportException(const string &what_arg) : fWhat(what_arg) {}
|
|
||||||
const char *what() const { return fWhat.c_str(); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Transport {
|
class Transport {
|
||||||
public:
|
public:
|
||||||
Transport(const PrinterData *printer_data);
|
Transport(const PrinterData* printerData);
|
||||||
~Transport();
|
~Transport();
|
||||||
void write(const void *buffer, size_t size) throw(TransportException);
|
|
||||||
bool check_abort() const;
|
void Write(const void *buffer, size_t size)
|
||||||
bool is_print_to_file_canceled() const;
|
throw (TransportException);
|
||||||
const string &last_error() const;
|
bool CheckAbort() const;
|
||||||
|
bool IsPrintToFileCanceled() const;
|
||||||
|
const string& LastError() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void set_last_error(const char *e);
|
Transport(const Transport& transport);
|
||||||
Transport(const Transport &);
|
Transport &operator=(const Transport& transport);
|
||||||
Transport &operator = (const Transport &);
|
|
||||||
|
void SetLastError(const char* message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
image_id fImage;
|
image_id fImage;
|
||||||
PFN_init_transport fInitTransport;
|
PFN_init_transport fInitTransport;
|
||||||
PFN_exit_transport fExitTransport;
|
PFN_exit_transport fExitTransport;
|
||||||
BDataIO *fDataStream;
|
BDataIO* fDataStream;
|
||||||
bool fAbort;
|
bool fAbort;
|
||||||
string fLastErrorString;
|
string fLastErrorString;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __TRANSPORT_H
|
#endif // __TRANSPORT_H
|
||||||
|
|||||||
@@ -15,22 +15,26 @@ class JobData;
|
|||||||
|
|
||||||
class UIDriver {
|
class UIDriver {
|
||||||
public:
|
public:
|
||||||
UIDriver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap);
|
UIDriver(BMessage* message, PrinterData* printerData,
|
||||||
virtual ~UIDriver();
|
const PrinterCap* printerCap);
|
||||||
BMessage *configPage();
|
virtual ~UIDriver();
|
||||||
BMessage *configJob();
|
BMessage* ConfigPage();
|
||||||
|
BMessage* ConfigJob();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual long doPageSetup(JobData *job_data, PrinterData *printer_data, const PrinterCap *printer_cap);
|
UIDriver(const UIDriver &);
|
||||||
virtual long doJobSetup(JobData *job_data, PrinterData *printer_data, const PrinterCap *printer_cap);
|
|
||||||
|
|
||||||
UIDriver(const UIDriver &);
|
UIDriver& operator=(const UIDriver &);
|
||||||
UIDriver &operator = (const UIDriver &);
|
|
||||||
|
virtual long PageSetup(JobData* jobData, PrinterData* printerData,
|
||||||
|
const PrinterCap* printerCap);
|
||||||
|
virtual long JobSetup(JobData* jobData, PrinterData* printerData,
|
||||||
|
const PrinterCap* printerCap);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMessage *fMsg;
|
BMessage* fMsg;
|
||||||
PrinterData *fPrinterData;
|
PrinterData* fPrinterData;
|
||||||
const PrinterCap *fPrinterCap;
|
const PrinterCap* fPrinterCap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __UIDRIVER_H */
|
#endif /* __UIDRIVER_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user