Author: laplace Date: 2010-12-08 21:07:22 +0100 (Wed, 08 Dec 2010) New Revision: 39771 Changeset: http://dev.haiku-os.org/changeset/39771 Modified: haiku/trunk/headers/libs/print/libprint/AddPrinterDlg.h haiku/trunk/headers/libs/print/libprint/GraphicsDriver.h haiku/trunk/headers/libs/print/libprint/Halftone.h haiku/trunk/headers/libs/print/libprint/HalftoneView.h haiku/trunk/headers/libs/print/libprint/JobData.h haiku/trunk/headers/libs/print/libprint/PackBits.h haiku/trunk/headers/libs/print/libprint/PagesView.h haiku/trunk/headers/libs/print/libprint/PrintJobReader.h haiku/trunk/headers/libs/print/libprint/PrinterCap.h haiku/trunk/headers/libs/print/libprint/PrinterData.h haiku/trunk/headers/libs/print/libprint/PrinterDriver.h haiku/trunk/headers/libs/print/libprint/SpoolMetaData.h haiku/trunk/headers/libs/print/libprint/Transport.h haiku/trunk/headers/libs/print/libprint/UIDriver.h Log: * Code style changes (missing header files from r39770) Modified: haiku/trunk/headers/libs/print/libprint/AddPrinterDlg.h =================================================================== --- haiku/trunk/headers/libs/print/libprint/AddPrinterDlg.h 2010-12-08 19:09:44 UTC (rev 39770) +++ haiku/trunk/headers/libs/print/libprint/AddPrinterDlg.h 2010-12-08 20:07:22 UTC (rev 39771) @@ -19,8 +19,8 @@ public: ProtocolClassItem(const ProtocolClassCap* cap); - int getProtocolClass(); - const char* getDescription(); + int GetProtocolClass() const; + const char* GetDescription() const; private: const ProtocolClassCap *fProtocolClassCap; Modified: haiku/trunk/headers/libs/print/libprint/GraphicsDriver.h =================================================================== --- haiku/trunk/headers/libs/print/libprint/GraphicsDriver.h 2010-12-08 19:09:44 UTC (rev 39770) +++ haiku/trunk/headers/libs/print/libprint/GraphicsDriver.h 2010-12-08 20:07:22 UTC (rev 39771) @@ -148,7 +148,7 @@ inline int GraphicsDriver::GetProtocolClass() const { - return fPrinterData->getProtocolClass(); + return fPrinterData->GetProtocolClass(); } Modified: haiku/trunk/headers/libs/print/libprint/Halftone.h =================================================================== --- haiku/trunk/headers/libs/print/libprint/Halftone.h 2010-12-08 19:09:44 UTC (rev 39770) +++ haiku/trunk/headers/libs/print/libprint/Halftone.h 2010-12-08 20:07:22 UTC (rev 39771) @@ -30,7 +30,10 @@ } ColorRGB32; 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); class Halftone { @@ -41,108 +44,139 @@ kType3, kTypeFloydSteinberg, }; + enum GrayFunction { kMixToGray, kRedChannel, kGreenChannel, kBlueChannel }; + enum Planes { kPlaneMonochrome1, // 1 bit depth (0 white, 1 black) kPlaneRGB1, // 3 planes, 1 bit depth (0 black, 7 white) }; + enum BlackValue { kHighValueMeansBlack, kLowValueMeansBlack, }; - Halftone(color_space cs, double gamma = 1.4, double min = 0.0, DitherType dither_type = kTypeFloydSteinberg); - ~Halftone(); - void setPlanes(Planes planes); - void setBlackValue(BlackValue blackValue); - void dither(uchar *dst, const uchar *src, int x, int y, int width); - int getPixelDepth() const; - const uchar *getPattern() const; - void setPattern(const uchar *pattern); + Halftone(color_space colorSpace, double gamma = 1.4, + double min = 0.0, + DitherType dither_type = kTypeFloydSteinberg); + ~Halftone(); + + void SetPlanes(Planes planes); + 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: - // PFN_gray: return value of 0 means low density (or black) and value of 255 means high density (or white) - PFN_gray getGrayFunction() const; - void setGrayFunction(PFN_gray gray); - void setGrayFunction(GrayFunction grayFunction); + Halftone(const Halftone &); - void createGammaTable(double gamma, double min); - 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); + Halftone& operator=(const Halftone &); - void initFloydSteinberg(); - void deleteErrorTables(); - void uninitFloydSteinberg(); - void setupErrorBuffer(int x, int y, int width); - void ditherFloydSteinberg(uchar *dst, const uchar* src, int x, int y, int width); + // PFN_gray: return value of 0 means low density (or black) and + // value of 255 means high density (or white) + PFN_gray GetGrayFunction() const; + void SetGrayFunction(PFN_gray gray); + void SetGrayFunction(GrayFunction grayFunction); - Halftone(const Halftone &); - Halftone &operator = (const Halftone &); + void CreateGammaTable(double gamma, double min); + 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: enum { kGammaTableSize = 256, kMaxNumberOfPlanes = 3 }; + PFN_dither fDither; - PFN_gray fGray; - int fPixelDepth; - Planes fPlanes; - BlackValue fBlackValue; - const uchar *fPattern; - uint fGammaTable[kGammaTableSize]; - int fNumberOfPlanes; - int fCurrentPlane; + PFN_gray fGray; + int fPixelDepth; + Planes fPlanes; + BlackValue fBlackValue; + const uchar* fPattern; + uint fGammaTable[kGammaTableSize]; + int fNumberOfPlanes; + int fCurrentPlane; // fields used for floyd-steinberg dithering - int fX; - int fY; - int fWidth; - int *fErrorTables[kMaxNumberOfPlanes]; + int fX; + int fY; + int fWidth; + int* fErrorTables[kMaxNumberOfPlanes]; }; -inline int Halftone::getPixelDepth() const + +inline int +Halftone::GetPixelDepth() const { return fPixelDepth; } -inline const uchar * Halftone::getPattern() const + +inline const uchar* +Halftone::GetPattern() const { return fPattern; } -inline void Halftone::setPattern(const uchar *pattern) + +inline void +Halftone::SetPattern(const uchar* pattern) { fPattern = pattern; } -inline PFN_gray Halftone::getGrayFunction() const + +inline PFN_gray +Halftone::GetGrayFunction() const { return fGray; } -inline void Halftone::setGrayFunction(PFN_gray gray) + + +inline void +Halftone::SetGrayFunction(PFN_gray gray) { fGray = gray; } -inline uint Halftone::getDensity(ColorRGB32 c) const + +inline uint +Halftone::GetDensity(ColorRGB32 c) const { 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 - if (fBlackValue == kHighValueMeansBlack) { + if (fBlackValue == kHighValueMeansBlack) return byte; - } else { - return ~byte; - } + + return ~byte; } + #endif /* __HALFTONE_H */ Modified: haiku/trunk/headers/libs/print/libprint/HalftoneView.h =================================================================== --- haiku/trunk/headers/libs/print/libprint/HalftoneView.h 2010-12-08 19:09:44 UTC (rev 39770) +++ haiku/trunk/headers/libs/print/libprint/HalftoneView.h 2010-12-08 20:07:22 UTC (rev 39771) @@ -12,17 +12,21 @@ class HalftonePreviewView : public BView { 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 { 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: HalftonePreviewView* fPreview; Modified: haiku/trunk/headers/libs/print/libprint/JobData.h =================================================================== --- haiku/trunk/headers/libs/print/libprint/JobData.h 2010-12-08 19:09:44 UTC (rev 39770) +++ haiku/trunk/headers/libs/print/libprint/JobData.h 2010-12-08 20:07:22 UTC (rev 39771) @@ -26,9 +26,9 @@ { public: DriverSpecificSettings(); - DriverSpecificSettings(const DriverSpecificSettings& settings); + DriverSpecificSettings(const DriverSpecificSettings& Settings); - DriverSpecificSettings &operator=(const DriverSpecificSettings &settings); + DriverSpecificSettings &operator=(const DriverSpecificSettings &Settings); void MakeEmpty(); @@ -262,6 +262,110 @@ 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: bool fShowPreview; Paper fPaper; @@ -295,110 +399,416 @@ PageSelection fPageSelection; MarginUnit fMarginUnit; DriverSpecificSettings fDriverSpecificSettings; +}; -public: - JobData(BMessage *msg, const PrinterCap *cap, SettingType type); - ~JobData(); - JobData(const JobData &job_data); - JobData &operator = (const JobData &job_data); +inline bool +JobData::GetShowPreview() const +{ + return fShowPreview; +} - void load(BMessage *msg, const PrinterCap *cap, SettingType type); - void save(BMessage *msg = NULL); +inline void +JobData::SetShowPreview(bool showPreview) +{ + fShowPreview = showPreview; +} - bool getShowPreview() const { return fShowPreview; } - void setShowPreview(bool showPreview) { fShowPreview = showPreview; } - Paper getPaper() const { return fPaper; } - void setPaper(Paper paper) { fPaper = paper; } +inline JobData::Paper +JobData::GetPaper() const +{ + return fPaper; +} - int32 getResolutionID() const { return fResolutionID; } - void setResolutionID(int32 resolution) { fResolutionID = resolution; } - int32 getXres() const { return fXRes; } - void setXres(int32 xres) { fXRes = xres; } +inline void +JobData::SetPaper(Paper paper) +{ + fPaper = paper; +} - int32 getYres() const { return fYRes; } - void setYres(int32 yres) { fYRes = yres; }; - Orientation getOrientation() const { return fOrientation; } - void setOrientation(Orientation orientation) { fOrientation = orientation; } +inline int32 +JobData::GetResolutionID() const +{ + return fResolutionID; +} - 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; } +inline void +JobData::SetResolutionID(int32 resolution) +{ + fResolutionID = resolution; +} - 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; } +inline int32 +JobData::GetXres() const +{ + return fXRes; +} - 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; } +inline void +JobData::SetXres(int32 xres) +{ + fXRes = xres; +} - 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; } +inline int32 +JobData::GetYres() const +{ + return fYRes; +} - bool getReverse() const { return fReverse; } - void setReverse(bool reverse) { fReverse = reverse; } - int32 getFirstPage() const { return fFirstPage; } - void setFirstPage(int32 first_page) { fFirstPage = first_page; } +inline void +JobData::SetYres(int32 yres) +{ + fYRes = yres; +}; - 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; } +inline JobData::Orientation +JobData::GetOrientation() const +{ + return fOrientation; +} - float getGamma() const { return fGamma; } - void setGamma(float gamma) { fGamma = gamma; } - float getInkDensity() const { return fInkDensity; } - void setInkDensity(float inkDensity) { fInkDensity = inkDensity; } +inline void +JobData::SetOrientation(Orientation orientation) +{ + fOrientation = orientation; +} - PaperSource getPaperSource() const { return fPaperSource; } - void setPaperSource(PaperSource paper_source) { fPaperSource = paper_source; }; - int32 getCopies() const { return fCopies; } - void setCopies(int32 copies) { fCopies = copies; } +inline float +JobData::GetScaling() const +{ + return fScaling; +} - bool getCollate() const { return fCollate; } - void setCollate(bool collate) { fCollate = collate; } - PrintStyle getPrintStyle() const { return fPrintStyle; } - void setPrintStyle(PrintStyle print_style) { fPrintStyle = print_style; } +inline void +JobData::SetScaling(float scaling) +{ + fScaling = scaling; +} - 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; } +inline const BRect& +JobData::GetPaperRect() const +{ + return fPaperRect; +} - DriverSpecificSettings& Settings(); - const DriverSpecificSettings& Settings() const; +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 */ Modified: haiku/trunk/headers/libs/print/libprint/PackBits.h =================================================================== --- haiku/trunk/headers/libs/print/libprint/PackBits.h 2010-12-08 19:09:44 UTC (rev 39770) +++ haiku/trunk/headers/libs/print/libprint/PackBits.h 2010-12-08 20:07:22 UTC (rev 39771) @@ -6,7 +6,8 @@ #ifndef __PACKBITS_H #define __PACKBITS_H -int pack_bits_size(const unsigned char *in, int bytes); -int pack_bits(unsigned char *out, const unsigned char *in, int bytes); +int pack_bits_size(const unsigned char* source, int size); +int pack_bits(unsigned char* destination, const unsigned char* source, + int size); #endif /* __PACKBITS_H */ Modified: haiku/trunk/headers/libs/print/libprint/PagesView.h =================================================================== --- haiku/trunk/headers/libs/print/libprint/PagesView.h 2010-12-08 19:09:44 UTC (rev 39770) +++ haiku/trunk/headers/libs/print/libprint/PagesView.h 2010-12-08 20:07:22 UTC (rev 39771) @@ -16,12 +16,12 @@ void GetPreferredSize(float *width, float *height); void Draw(BRect rect); - void setCollate(bool collate); - void setReverse(bool reverse); + void SetCollate(bool collate); + void SetReverse(bool reverse); private: - void DrawPages(BPoint position, int number, int count); - void DrawPage(BPoint position, int number); + void _DrawPages(BPoint position, int number, int count); + void _DrawPage(BPoint position, int number); bool fCollate; bool fReverse; Modified: haiku/trunk/headers/libs/print/libprint/PrintJobReader.h =================================================================== --- haiku/trunk/headers/libs/print/libprint/PrintJobReader.h 2010-12-08 19:09:44 UTC (rev 39770) +++ haiku/trunk/headers/libs/print/libprint/PrintJobReader.h 2010-12-08 20:07:22 UTC (rev 39771) @@ -35,52 +35,57 @@ #include <Picture.h> 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: - PrintJobPage(); - PrintJobPage(const PrintJobPage& copy); - PrintJobPage(BFile* jobFile, off_t start); - status_t InitCheck() const; + PrintJobPage(); + PrintJobPage(const PrintJobPage& copy); + PrintJobPage(BFile* jobFile, off_t start); - 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); + +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 { - 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 +public: + PrintJobReader(BFile* jobFile); + virtual ~PrintJobReader(); - void BuildPageIndex(); + // test after construction if this is a valid job file + status_t InitCheck() const; -public: - PrintJobReader(BFile* jobFile); - virtual ~PrintJobReader(); + // accessors to informations from job file + int32 NumberOfPages() const { return fNumberOfPages; } + int32 FirstPage() const; + int32 LastPage() const; + const BMessage* JobSettings() const { return &fJobSettings; } + BRect PaperRect() const; + BRect PrintableRect() const; + void GetResolution(int32* xdpi, int32* ydpi) const; + float GetScale() const; - // test after construction if this is a valid job file - status_t InitCheck() const; + // retrieve page + status_t GetPage(int32 no, PrintJobPage& pjp); - // accessors to informations from job file - int32 NumberOfPages() const { return fNumberOfPages; } - int32 FirstPage() const; - int32 LastPage() const; - const BMessage* JobSettings() const { return &fJobSettings; } - BRect PaperRect() const; [... truncated: 403 lines follow ...]