* move libprint sources into libs, as it is a 3rdparty lib
* move libprint headers into libs headers folder accordingly * merge all shared folders sources into kits print, we might build later on a real print kit, propably also to access cups from an nicely API, atm static * move all shared headers into private print, also pr_server.h from interface * adjust build to work with the changed folder layout git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26570 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* AboutBox.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __ABOUTBOX_H
|
||||
#define __ABOUTBOX_H
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
class AboutBox : public BApplication {
|
||||
public:
|
||||
AboutBox(const char *signature, const char *driver_name, const char *version, const char *copyright);
|
||||
};
|
||||
|
||||
#endif /* __ABOUTBOX_H */
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* AddPrinterDlg.cpp
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "DialogWindow.h"
|
||||
|
||||
#include <ListItem.h>
|
||||
#include <View.h>
|
||||
|
||||
class BListView;
|
||||
class BTextView;
|
||||
|
||||
class PrinterData;
|
||||
class PrinterCap;
|
||||
class ProtocolClassCap;
|
||||
|
||||
class ProtocolClassItem : public BStringItem {
|
||||
public:
|
||||
ProtocolClassItem(const ProtocolClassCap* cap);
|
||||
|
||||
int getProtocolClass();
|
||||
const char *getDescription();
|
||||
|
||||
private:
|
||||
const ProtocolClassCap *fProtocolClassCap;
|
||||
};
|
||||
|
||||
class AddPrinterView : public BView {
|
||||
public:
|
||||
AddPrinterView(BRect frame, PrinterData *printer_data, const PrinterCap *printer_cap);
|
||||
~AddPrinterView();
|
||||
virtual void AttachedToWindow();
|
||||
void FrameResized(float w, float h);
|
||||
void MessageReceived(BMessage *msg);
|
||||
|
||||
void Save();
|
||||
private:
|
||||
ProtocolClassItem *CurrentSelection();
|
||||
|
||||
PrinterData *fPrinterData;
|
||||
const PrinterCap *fPrinterCap;
|
||||
|
||||
BListView *fProtocolClassList;
|
||||
BTextView *fDescription;
|
||||
};
|
||||
|
||||
|
||||
class AddPrinterDlg : public DialogWindow {
|
||||
public:
|
||||
AddPrinterDlg(PrinterData *printerData, const PrinterCap *printerCap);
|
||||
void MessageReceived(BMessage *msg);
|
||||
|
||||
private:
|
||||
AddPrinterView *fAddPrinterView;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* DbgMsg.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __DBGMSG_H
|
||||
#define __DBGMSG_H
|
||||
|
||||
//#define DBG
|
||||
|
||||
#ifdef DBG
|
||||
void write_debug_stream(const char *, ...);
|
||||
void DUMP_BFILE(BFile *file, const char *name);
|
||||
void DUMP_BMESSAGE(BMessage *msg);
|
||||
void DUMP_BDIRECTORY(BDirectory *dir);
|
||||
void DUMP_BNODE(BNode *node);
|
||||
#define DBGMSG(args) write_debug_stream args
|
||||
#else
|
||||
#define DUMP_BFILE(file, name) (void)0
|
||||
#define DUMP_BMESSAGE(msg) (void)0
|
||||
#define DUMP_BDIRECTORY(dir) (void)0
|
||||
#define DUMP_BNODE(node) (void)0
|
||||
#define DBGMSG(args) (void)0
|
||||
#endif
|
||||
|
||||
#endif /* __DBGMSG_H */
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* DialogWindow.h
|
||||
* Copyright 2004 Michael Pfeiffer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __DIALOG_WINDOW_H
|
||||
#define __DIALOG_WINDOW_H
|
||||
|
||||
#include <OS.h>
|
||||
#include <Window.h>
|
||||
|
||||
class DialogWindow : public BWindow {
|
||||
public:
|
||||
DialogWindow(BRect frame,
|
||||
const char *title,
|
||||
window_type type,
|
||||
uint32 flags,
|
||||
uint32 workspace = B_CURRENT_WORKSPACE);
|
||||
|
||||
DialogWindow(BRect frame,
|
||||
const char *title,
|
||||
window_look look,
|
||||
window_feel feel,
|
||||
uint32 flags,
|
||||
uint32 workspace = B_CURRENT_WORKSPACE);
|
||||
|
||||
status_t Go();
|
||||
|
||||
void SetResult(status_t result);
|
||||
|
||||
void MessageReceived(BMessage* msg);
|
||||
|
||||
enum {
|
||||
kGetThreadId = 'dwti' // request thread id from window
|
||||
};
|
||||
|
||||
private:
|
||||
status_t fPreviousResult; // holds the result as long as fResult == NULL
|
||||
volatile status_t *fResult;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Exports.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __EXPORTS_H
|
||||
#define __EXPORTS_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
|
||||
class BNode;
|
||||
class BMessage;
|
||||
class BFile;
|
||||
|
||||
extern "C" {
|
||||
_EXPORT char *add_printer(char *printer_name);
|
||||
_EXPORT BMessage *config_page(BNode *node, BMessage *msg);
|
||||
_EXPORT BMessage *config_job(BNode *node, BMessage *msg);
|
||||
_EXPORT BMessage *take_job(BFile *spool_file, BNode *node, BMessage *msg);
|
||||
}
|
||||
|
||||
#endif // __EXPORTS_H
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* GraphicsDriver.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __GRAPHICSDRIVER_H
|
||||
#define __GRAPHICSDRIVER_H
|
||||
|
||||
#include "JobData.h"
|
||||
#include "PrinterData.h"
|
||||
#include "PrintProcess.h"
|
||||
#include "SpoolMetaData.h"
|
||||
#include "Transport.h"
|
||||
#include "StatusWindow.h"
|
||||
|
||||
class BView;
|
||||
class BBitmap;
|
||||
class BMessage;
|
||||
class PrinterData;
|
||||
class PrinterCap;
|
||||
|
||||
enum {
|
||||
kGDFRotateBandBitmap = 1
|
||||
};
|
||||
|
||||
class GraphicsDriver {
|
||||
public:
|
||||
GraphicsDriver(BMessage *, PrinterData *, const PrinterCap *);
|
||||
virtual ~GraphicsDriver();
|
||||
const JobData *getJobData(BFile *spoolFile);
|
||||
BMessage *takeJob(BFile *spool, uint32 flags = 0);
|
||||
static BPoint getScale(int32 nup, BRect physicalRect, float scaling);
|
||||
static BPoint getOffset(int32 nup, int index, JobData::Orientation orientation, const BPoint *scale,
|
||||
BRect scaledPhysicalRect, BRect scaledPrintableRect, BRect physicalRect);
|
||||
|
||||
protected:
|
||||
virtual bool startDoc();
|
||||
virtual bool startPage(int page_number);
|
||||
virtual bool nextBand(BBitmap *bitmap, BPoint *offset);
|
||||
virtual bool endPage(int page_number);
|
||||
virtual bool endDoc(bool success);
|
||||
|
||||
void writeSpoolData(const void *buffer, size_t size) throw(TransportException);
|
||||
void writeSpoolString(const char *buffer, ...) throw(TransportException);
|
||||
void writeSpoolChar(char c) throw(TransportException);
|
||||
|
||||
static void convert_to_rgb24(void* src, void* dst, int width, color_space cs);
|
||||
static void convert_to_gray(void* src, void* dst, int width, color_space cs);
|
||||
|
||||
const JobData *getJobData() const;
|
||||
const PrinterData *getPrinterData() const;
|
||||
const PrinterCap *getPrinterCap() const;
|
||||
const SpoolMetaData *getSpoolMetaData() const;
|
||||
int getProtocolClass() const;
|
||||
|
||||
int getPageWidth() const;
|
||||
int getPageHeight() const;
|
||||
int getBandWidth() const;
|
||||
int getBandHeight() const;
|
||||
int getPixelDepth() const;
|
||||
|
||||
GraphicsDriver(const GraphicsDriver &);
|
||||
GraphicsDriver &operator = (const GraphicsDriver &);
|
||||
|
||||
private:
|
||||
bool setupData(BFile *file);
|
||||
void setupBitmap();
|
||||
void cleanupData();
|
||||
void cleanupBitmap();
|
||||
bool printPage(PageDataList *pages);
|
||||
bool collectPages(SpoolData *spool_data, PageDataList *pages);
|
||||
bool skipPages(SpoolData *spool_data);
|
||||
bool printDocument(SpoolData *spool_data);
|
||||
bool printJob(BFile *file);
|
||||
static void rgb32_to_rgb24(void* src, void* dst, int width);
|
||||
static void cmap8_to_rgb24(void* src, void* dst, int width);
|
||||
static uint8 gray(uint8 r, uint8 g, uint8 b);
|
||||
static void rgb32_to_gray(void* src, void* dst, int width);
|
||||
static void cmap8_to_gray(void* src, void* dst, int width);
|
||||
|
||||
uint32 fFlags;
|
||||
BMessage *fMsg;
|
||||
BView *fView;
|
||||
BBitmap *fBitmap;
|
||||
Transport *fTransport;
|
||||
JobData *fOrgJobData;
|
||||
JobData *fRealJobData;
|
||||
PrinterData *fPrinterData;
|
||||
const PrinterCap *fPrinterCap;
|
||||
SpoolMetaData *fSpoolMetaData;
|
||||
|
||||
int fPageWidth;
|
||||
int fPageHeight;
|
||||
int fBandWidth;
|
||||
int fBandHeight;
|
||||
int fPixelDepth;
|
||||
int fBandCount;
|
||||
int fInternalCopies;
|
||||
|
||||
uint32 fPageCount;
|
||||
StatusWindow *fStatusWindow;
|
||||
};
|
||||
|
||||
inline const JobData *GraphicsDriver::getJobData() const
|
||||
{
|
||||
return fRealJobData;
|
||||
}
|
||||
|
||||
inline const PrinterData *GraphicsDriver::getPrinterData() const
|
||||
{
|
||||
return fPrinterData;
|
||||
}
|
||||
|
||||
inline const PrinterCap *GraphicsDriver::getPrinterCap() const
|
||||
{
|
||||
return fPrinterCap;
|
||||
}
|
||||
|
||||
inline const SpoolMetaData *GraphicsDriver::getSpoolMetaData() const
|
||||
{
|
||||
return fSpoolMetaData;
|
||||
}
|
||||
|
||||
inline int GraphicsDriver::getProtocolClass() const
|
||||
{
|
||||
return fPrinterData->getProtocolClass();
|
||||
}
|
||||
|
||||
inline int GraphicsDriver::getPageWidth() const
|
||||
{
|
||||
return fPageWidth;
|
||||
}
|
||||
|
||||
inline int GraphicsDriver::getPageHeight() const
|
||||
{
|
||||
return fPageHeight;
|
||||
}
|
||||
|
||||
inline int GraphicsDriver::getBandWidth() const
|
||||
{
|
||||
return fBandWidth;
|
||||
}
|
||||
|
||||
inline int GraphicsDriver::getBandHeight() const
|
||||
{
|
||||
return fBandHeight;
|
||||
}
|
||||
|
||||
#endif /* __GRAPHICSDRIVER_H */
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Halftone.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __HALFTONE_H
|
||||
#define __HALFTONE_H
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
|
||||
// definition for B_RGB32 (=B_RGB32_LITTLE) and B_RGBA32
|
||||
typedef struct {
|
||||
uchar blue;
|
||||
uchar green;
|
||||
uchar red;
|
||||
uchar alpha; // unused in B_RGB32
|
||||
} ColorRGB32Little;
|
||||
|
||||
// definition for B_RGB32_BIG and B_RGBA32_BIG
|
||||
typedef struct {
|
||||
uchar alpha; // unused in B_RGB32_BIG
|
||||
uchar red;
|
||||
uchar green;
|
||||
uchar blue;
|
||||
} ColorRGB32Big;
|
||||
|
||||
typedef union {
|
||||
ColorRGB32Little little;
|
||||
ColorRGB32Big big;
|
||||
} ColorRGB32;
|
||||
|
||||
class Halftone;
|
||||
typedef void (Halftone::*PFN_dither)(uchar *dst, const uchar *src, int x, int y, int width);
|
||||
typedef uint (*PFN_gray)(ColorRGB32 c);
|
||||
|
||||
class Halftone {
|
||||
public:
|
||||
enum DitherType {
|
||||
kType1,
|
||||
kType2,
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
Halftone(const Halftone &);
|
||||
Halftone &operator = (const Halftone &);
|
||||
|
||||
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;
|
||||
// fields used for floyd-steinberg dithering
|
||||
int fX;
|
||||
int fY;
|
||||
int fWidth;
|
||||
int *fErrorTables[kMaxNumberOfPlanes];
|
||||
};
|
||||
|
||||
inline int Halftone::getPixelDepth() const
|
||||
{
|
||||
return fPixelDepth;
|
||||
}
|
||||
|
||||
inline const uchar * Halftone::getPattern() const
|
||||
{
|
||||
return fPattern;
|
||||
}
|
||||
|
||||
inline void Halftone::setPattern(const uchar *pattern)
|
||||
{
|
||||
fPattern = pattern;
|
||||
}
|
||||
|
||||
inline PFN_gray Halftone::getGrayFunction() const
|
||||
{
|
||||
return fGray;
|
||||
}
|
||||
inline void Halftone::setGrayFunction(PFN_gray gray)
|
||||
{
|
||||
fGray = gray;
|
||||
}
|
||||
|
||||
inline uint Halftone::getDensity(ColorRGB32 c) const
|
||||
{
|
||||
return fGammaTable[fGray(c)];
|
||||
}
|
||||
|
||||
inline uchar Halftone::convertUsingBlackValue(uchar byte) const
|
||||
{
|
||||
// bits with value = '1' in byte mean black
|
||||
if (fBlackValue == kHighValueMeansBlack) {
|
||||
return byte;
|
||||
} else {
|
||||
return ~byte;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __HALFTONE_H */
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* HalftoneView.h
|
||||
* Copyright 2004 Michael Pfeiffer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _HALFTONE_VIEW_H
|
||||
#define _HALFTONE_VIEW_H
|
||||
|
||||
#include <View.h>
|
||||
#include "Halftone.h"
|
||||
|
||||
class HalftonePreviewView : public BView
|
||||
{
|
||||
public:
|
||||
HalftonePreviewView(BRect frame, const char* name, uint32 resizeMask, uint32 flags);
|
||||
|
||||
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);
|
||||
|
||||
void preview(float gamma, float min, Halftone::DitherType ditherType, bool color);
|
||||
|
||||
private:
|
||||
HalftonePreviewView* fPreview;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
JSDSlider.h
|
||||
Dr.H.Reh
|
||||
27.11.2004
|
||||
|
||||
Based on source code from Be Inc. RIP
|
||||
Copyright 1995 Be Incorporated, All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __JSD_SLIDER_H
|
||||
#define __JSD_SLIDER_H
|
||||
|
||||
#include <Slider.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
class JSDSlider : public BSlider
|
||||
{
|
||||
public:
|
||||
JSDSlider(BRect frame, const char* name, const char *label, BMessage *msg,
|
||||
int32 min, int32 max, thumb_style t);
|
||||
|
||||
~JSDSlider();
|
||||
|
||||
char* UpdateText() const;
|
||||
|
||||
private:
|
||||
BString* fResult;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,356 @@
|
||||
/*
|
||||
* JobData.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __JOBDATA_H
|
||||
#define __JOBDATA_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <Rect.h>
|
||||
|
||||
#include "Halftone.h"
|
||||
#include "MarginView.h" // for MarginUnit
|
||||
|
||||
class BMessage;
|
||||
class PrinterCap;
|
||||
|
||||
class JobData {
|
||||
public:
|
||||
enum Orientation {
|
||||
kPortrait,
|
||||
kLandscape
|
||||
};
|
||||
|
||||
enum Paper {
|
||||
kLetter = 1, // 1 Letter 8 1/2 x 11 in
|
||||
kLetterSmall, // 2 Letter Small 8 1/2 x 11 in
|
||||
kTabloid, // 3 Tabloid 11 x 17 in
|
||||
kLedger, // 4 Ledger 17 x 11 in
|
||||
kLegal, // 5 Legal 8 1/2 x 14 in
|
||||
kStatement, // 6 Statement 5 1/2 x 8 1/2 in
|
||||
kExecutive, // 7 Executive 7 1/4 x 10 1/2 in
|
||||
kA3, // 8 A3 297 x 420 mm
|
||||
kA4, // 9 A4 210 x 297 mm
|
||||
kA4Small, // 10 A4 Small 210 x 297 mm
|
||||
kA5, // 11 A5 148 x 210 mm
|
||||
kB4, // 12 B4 (JIS) 250 x 354
|
||||
kB5, // 13 B5 (JIS) 182 x 257 mm
|
||||
kFolio, // 14 Folio 8 1/2 x 13 in
|
||||
kQuarto, // 15 Quarto 215 x 275 mm
|
||||
k10X14, // 16 10x14 in
|
||||
k11X17, // 17 11x17 in
|
||||
kNote, // 18 Note 8 1/2 x 11 in
|
||||
kEnv9, // 19 Envelope #9 3 7/8 x 8 7/8
|
||||
kEnv10, // 20 Envelope #10 4 1/8 x 9 1/2
|
||||
kEnv11, // 21 Envelope #11 4 1/2 x 10 3/8
|
||||
kEnv12, // 22 Envelope #12 4 \276 x 11
|
||||
kEnv14, // 23 Envelope #14 5 x 11 1/2
|
||||
kCSheet, // 24 C size sheet
|
||||
kDSheet, // 25 D size sheet
|
||||
kESheet, // 26 E size sheet
|
||||
kEnvDL, // 27 Envelope DL 110 x 220mm
|
||||
kEnvC5, // 28 Envelope C5 162 x 229 mm
|
||||
kEnvC3, // 29 Envelope C3 324 x 458 mm
|
||||
kEnvC4, // 30 Envelope C4 229 x 324 mm
|
||||
kEnvC6, // 31 Envelope C6 114 x 162 mm
|
||||
kEnvC65, // 32 Envelope C65 114 x 229 mm
|
||||
kEnvB4, // 33 Envelope B4 250 x 353 mm
|
||||
kEnvB5, // 34 Envelope B5 176 x 250 mm
|
||||
kEnvB6, // 35 Envelope B6 176 x 125 mm
|
||||
kEnvItaly, // 36 Envelope 110 x 230 mm
|
||||
kEnvMonarch, // 37 Envelope Monarch 3.875 x 7.5 in
|
||||
kEnvPersonal, // 38 6 3/4 Envelope 3 5/8 x 6 1/2 in
|
||||
kFanFoldUS, // 39 US Std Fanfold 14 7/8 x 11 in
|
||||
kFanFoldStdGerman, // 40 German Std Fanfold 8 1/2 x 12 in
|
||||
kFanFoldLglGerman, // 41 German Legal Fanfold 8 1/2 x 13 in
|
||||
kIsoB4, // 42 B4 (ISO) 250 x 353 mm
|
||||
kJapanesePostcard, // 43 Japanese Postcard 100 x 148 mm
|
||||
k9X11, // 44 9 x 11 in
|
||||
k10X11, // 45 10 x 11 in
|
||||
k15X11, // 46 15 x 11 in
|
||||
kEnvInvite, // 47 Envelope Invite 220 x 220 mm
|
||||
kReserved48, // 48 RESERVED--DO NOT USE
|
||||
kReserved49, // 49 RESERVED--DO NOT USE
|
||||
kLetterExtra, // 50 Letter Extra 9 \275 x 12 in
|
||||
kLegalExtra, // 51 Legal Extra 9 \275 x 15 in
|
||||
kTabloidExtra, // 52 Tabloid Extra 11.69 x 18 in
|
||||
kA4Extra, // 53 A4 Extra 9.27 x 12.69 in
|
||||
kLetterTransverse, // 54 Letter Transverse 8 \275 x 11 in
|
||||
kA4Transverse, // 55 A4 Transverse 210 x 297 mm
|
||||
kLetterExtraTransverse, // 56 Letter Extra Transverse 9\275 x 12 in
|
||||
kAPlus, // 57 SuperA/SuperA/A4 227 x 356 mm
|
||||
kBPlus, // 58 SuperB/SuperB/A3 305 x 487 mm
|
||||
kLetterPlus, // 59 Letter Plus 8.5 x 12.69 in
|
||||
kA4Plus, // 60 A4 Plus 210 x 330 mm
|
||||
kA5Transverse, // 61 A5 Transverse 148 x 210 mm
|
||||
kB5Transverse, // 62 B5 (JIS) Transverse 182 x 257 mm
|
||||
kA3Extra, // 63 A3 Extra 322 x 445 mm
|
||||
kA5Extra, // 64 A5 Extra 174 x 235 mm
|
||||
kB5Extra, // 65 B5 (ISO) Extra 201 x 276 mm
|
||||
kA2, // 66 A2 420 x 594 mm
|
||||
kA3Transverse, // 67 A3 Transverse 297 x 420 mm
|
||||
kA3ExtraTransverse, // 68 A3 Extra Transverse 322 x 445 mm
|
||||
kDBLJapanesePostcard, // 69 Japanese Double Postcard 200 x 148 mm
|
||||
kA6, // 70 A6 105 x 148 mm
|
||||
kJEnvKaku2, // 71 Japanese Envelope Kaku #2
|
||||
kJEnvKaku3, // 72 Japanese Envelope Kaku #3
|
||||
kJEnvChou3, // 73 Japanese Envelope Chou #3
|
||||
kJEnvChou4, // 74 Japanese Envelope Chou #4
|
||||
kLetterRotated, // 75 Letter Rotated 11 x 8 1/2 11 in
|
||||
kA3Rotated, // 76 A3 Rotated 420 x 297 mm
|
||||
kA4Rotated, // 77 A4 Rotated 297 x 210 mm
|
||||
kA5Rotated, // 78 A5 Rotated 210 x 148 mm
|
||||
kB4JISRotated, // 79 B4 (JIS) Rotated 364 x 257 mm
|
||||
kB5JISRotated, // 80 B5 (JIS) Rotated 257 x 182 mm
|
||||
kJapanesePostcardRotated, // 81 Japanese Postcard Rotated 148 x 100 mm
|
||||
kDBLJapanesePostcardRotated, // 82 Double Japanese Postcard Rotated 148 x 200 mm
|
||||
kA6Rotated, // 83 A6 Rotated 148 x 105 mm
|
||||
kJEnvKaku2Rotated, // 84 Japanese Envelope Kaku #2 Rotated
|
||||
kJEnvKaku3Rotated, // 85 Japanese Envelope Kaku #3 Rotated
|
||||
kJEnvChou3Rotated, // 86 Japanese Envelope Chou #3 Rotated
|
||||
kJEnvChou4Rotated, // 87 Japanese Envelope Chou #4 Rotated
|
||||
kB6JIS, // 88 B6 (JIS) 128 x 182 mm
|
||||
kB6JISRotated, // 89 B6 (JIS) Rotated 182 x 128 mm
|
||||
k12X11, // 90 12 x 11 in
|
||||
kJEnvYou4, // 91 Japanese Envelope You #4
|
||||
kJEnvYou4Rotated, // 92 Japanese Envelope You #4 Rotated
|
||||
kP16K, // 93 PRC 16K 146 x 215 mm
|
||||
kP32K, // 94 PRC 32K 97 x 151 mm
|
||||
kP32KBig, // 95 PRC 32K(Big) 97 x 151 mm
|
||||
kPEnv1, // 96 PRC Envelope #1 102 x 165 mm
|
||||
kPEnv2, // 97 PRC Envelope #2 102 x 176 mm
|
||||
kPEnv3, // 98 PRC Envelope #3 125 x 176 mm
|
||||
kPEnv4, // 99 PRC Envelope #4 110 x 208 mm
|
||||
kPEnv5, // 100 PRC Envelope #5 110 x 220 mm
|
||||
kPEnv6, // 101 PRC Envelope #6 120 x 230 mm
|
||||
kPEnv7, // 102 PRC Envelope #7 160 x 230 mm
|
||||
kPEnv8, // 103 PRC Envelope #8 120 x 309 mm
|
||||
kPEnv9, // 104 PRC Envelope #9 229 x 324 mm
|
||||
kPEnv10, // 105 PRC Envelope #10 324 x 458 mm
|
||||
kP16KRotated, // 106 PRC 16K Rotated
|
||||
kP32KRotated, // 107 PRC 32K Rotated
|
||||
kP32KBIGRotated, // 108 PRC 32K(Big) Rotated
|
||||
kPEnv1Rotated, // 109 PRC Envelope #1 Rotated 165 x 102 mm
|
||||
kPEnv2Rotated, // 110 PRC Envelope #2 Rotated 176 x 102 mm
|
||||
kPEnv3Rotated, // 111 PRC Envelope #3 Rotated 176 x 125 mm
|
||||
kPEnv4Rotated, // 112 PRC Envelope #4 Rotated 208 x 110 mm
|
||||
kPEnv5Rotated, // 113 PRC Envelope #5 Rotated 220 x 110 mm
|
||||
kPEnv6Rotated, // 114 PRC Envelope #6 Rotated 230 x 120 mm
|
||||
kPEnv7Rotated, // 115 PRC Envelope #7 Rotated 230 x 160 mm
|
||||
kPEnv8Rotated, // 116 PRC Envelope #8 Rotated 309 x 120 mm
|
||||
kPEnv9Rotated, // 117 PRC Envelope #9 Rotated 324 x 229 mm
|
||||
kPEnv10Rotated, // 118 PRC Envelope #10 Rotated 458 x 324 mm
|
||||
kUserDefined = 256
|
||||
};
|
||||
|
||||
enum PaperSource {
|
||||
kAuto, // 7 o
|
||||
kManual, // 4 o
|
||||
kUpper, // 1 o
|
||||
kMiddle, // 3 o
|
||||
kLower, // 2 o
|
||||
// kOnlyOne, // 1 x
|
||||
// kEnvelope, // 5 o
|
||||
// kEnvManual, // 6 x
|
||||
// kTractor, // 8 x
|
||||
// kSmallFmt, // 9 x
|
||||
// kLargeFmt, // 10 x
|
||||
// kLargeCapacity, // 11 x
|
||||
// kCassette, // 14 x
|
||||
// kFormSource, // 15 x
|
||||
kCassette1 = 21,
|
||||
kCassette2,
|
||||
kCassette3,
|
||||
kCassette4,
|
||||
kCassette5,
|
||||
kCassette6,
|
||||
kCassette7,
|
||||
kCassette8,
|
||||
kCassette9,
|
||||
kUser = 256 // device specific bins start here
|
||||
};
|
||||
|
||||
enum PrintStyle {
|
||||
kSimplex,
|
||||
kDuplex,
|
||||
kBooklet
|
||||
};
|
||||
|
||||
enum BindingLocation {
|
||||
kLongEdgeLeft,
|
||||
kLongEdgeRight,
|
||||
kShortEdgeTop,
|
||||
kShortEdgeBottom,
|
||||
kLongEdge = kLongEdgeLeft,
|
||||
kShortEdge = kShortEdgeTop
|
||||
};
|
||||
|
||||
enum PageOrder {
|
||||
kAcrossFromLeft,
|
||||
kDownFromLeft,
|
||||
kAcrossFromRight,
|
||||
kDownFromRight,
|
||||
kLeftToRight = kAcrossFromLeft,
|
||||
kRightToLeft = kAcrossFromRight
|
||||
};
|
||||
|
||||
/*
|
||||
enum Quality {
|
||||
kDraft = -1,
|
||||
kLow = -2,
|
||||
kMedium = -3,
|
||||
kHigh = -4
|
||||
};
|
||||
*/
|
||||
enum Color {
|
||||
kMonochrome = 1,
|
||||
kColor,
|
||||
// Some PCL6 printers do not support compressed data
|
||||
// in color mode.
|
||||
kColorCompressionDisabled
|
||||
};
|
||||
|
||||
enum Settings {
|
||||
kPageSettings,
|
||||
kJobSettings
|
||||
};
|
||||
|
||||
enum PageSelection {
|
||||
kAllPages,
|
||||
kOddNumberedPages,
|
||||
kEvenNumberedPages
|
||||
};
|
||||
|
||||
private:
|
||||
bool fShowPreview;
|
||||
Paper fPaper;
|
||||
int32 fXRes;
|
||||
int32 fYRes;
|
||||
Orientation fOrientation;
|
||||
float fScaling;
|
||||
BRect fPaperRect;
|
||||
BRect fScaledPaperRect;
|
||||
BRect fPrintableRect;
|
||||
BRect fScaledPrintableRect;
|
||||
BRect fPhysicalRect;
|
||||
BRect fScaledPhysicalRect;
|
||||
int32 fNup;
|
||||
int32 fFirstPage;
|
||||
int32 fLastPage;
|
||||
float fGamma; // 1 identiy, < 1 brigther, > 1 darker
|
||||
float fInkDensity; // [0, 255] lower means higher density
|
||||
PaperSource fPaperSource;
|
||||
int32 fCopies;
|
||||
bool fCollate;
|
||||
bool fReverse;
|
||||
PrintStyle fPrintStyle;
|
||||
BindingLocation fBindingLocation;
|
||||
PageOrder fPageOrder;
|
||||
Settings fSettings;
|
||||
BMessage *fMsg;
|
||||
Color fColor;
|
||||
Halftone::DitherType fDitherType;
|
||||
PageSelection fPageSelection;
|
||||
MarginUnit fMarginUnit;
|
||||
|
||||
public:
|
||||
JobData(BMessage *msg, const PrinterCap *cap, Settings settings);
|
||||
~JobData();
|
||||
|
||||
JobData(const JobData &job_data);
|
||||
JobData &operator = (const JobData &job_data);
|
||||
|
||||
void load(BMessage *msg, const PrinterCap *cap, Settings settings);
|
||||
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 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; }
|
||||
};
|
||||
|
||||
#endif /* __JOBDATA_H */
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* JobSetupDlg.cpp
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __JOBSETUPDLG_H
|
||||
#define __JOBSETUPDLG_H
|
||||
|
||||
#include <View.h>
|
||||
#include "DialogWindow.h"
|
||||
|
||||
#include "JobData.h"
|
||||
#include "Halftone.h"
|
||||
#include "JSDSlider.h"
|
||||
|
||||
class BTextControl;
|
||||
class BTextView;
|
||||
class BRadioButton;
|
||||
class BCheckBox;
|
||||
class BPopUpMenu;
|
||||
class JobData;
|
||||
class PrinterData;
|
||||
class PrinterCap;
|
||||
class HalftoneView;
|
||||
class PagesView;
|
||||
|
||||
class JobSetupView : public BView {
|
||||
public:
|
||||
JobSetupView(BRect frame, JobData *job_data, PrinterData *printer_data, const PrinterCap *printer_cap);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
bool UpdateJobData(bool showPreview);
|
||||
|
||||
private:
|
||||
void UpdateButtonEnabledState();
|
||||
BRadioButton* AddPageSelectionItem(BView* parent, BRect rect, const char* name, const char* label,
|
||||
JobData::PageSelection pageSelection);
|
||||
void AllowOnlyDigits(BTextView* textView, int maxDigits);
|
||||
JobData::Color getColor();
|
||||
Halftone::DitherType getDitherType();
|
||||
float getGamma();
|
||||
float getInkDensity();
|
||||
|
||||
BTextControl *fCopies;
|
||||
BTextControl *fFromPage;
|
||||
BTextControl *fToPage;
|
||||
JobData *fJobData;
|
||||
PrinterData *fPrinterData;
|
||||
const PrinterCap *fPrinterCap;
|
||||
BPopUpMenu *fColorType;
|
||||
BPopUpMenu *fDitherType;
|
||||
JSDSlider *fGamma;
|
||||
JSDSlider *fInkDensity;
|
||||
HalftoneView *fHalftone;
|
||||
BRadioButton *fAll;
|
||||
BCheckBox *fCollate;
|
||||
BCheckBox *fReverse;
|
||||
PagesView *fPages;
|
||||
BPopUpMenu *fPaperFeed;
|
||||
BCheckBox *fDuplex;
|
||||
BPopUpMenu *fNup;
|
||||
BRadioButton *fAllPages;
|
||||
BRadioButton *fOddNumberedPages;
|
||||
BRadioButton *fEvenNumberedPages;
|
||||
};
|
||||
|
||||
class JobSetupDlg : public DialogWindow {
|
||||
public:
|
||||
JobSetupDlg(JobData *job_data, PrinterData *printer_data, const PrinterCap *printer_cap);
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
|
||||
private:
|
||||
JobSetupView *fJobSetup;
|
||||
};
|
||||
|
||||
#endif /* __JOBSETUPDLG_H */
|
||||
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
|
||||
MarginView.h
|
||||
|
||||
Copyright (c) 2002 OpenBeOS.
|
||||
|
||||
Authors:
|
||||
Philippe Houdoin
|
||||
Simon Gauvin
|
||||
Michael Pfeiffer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Documentation:
|
||||
|
||||
The MarginView is designed to be a self contained component that manages
|
||||
the display of a BBox control that shows a graphic of a page and its'
|
||||
margings. The component also includes text fields that are used to mofify
|
||||
the margin values and a popup to change the units used for the margins.
|
||||
|
||||
There are two interfaces for the MarginView component:
|
||||
|
||||
1) Set methods:
|
||||
- page size
|
||||
- orientation
|
||||
|
||||
Get methods to retrieve:
|
||||
- margins
|
||||
- page size
|
||||
|
||||
The method interface is available for the parent Component to call on
|
||||
the MarginView in response to the Window receiveing messages from
|
||||
other BControls that it contains, such as a Page Size popup. The
|
||||
Get methods are used to extract the page size and margins so that
|
||||
the printer driver may put these values into a BMessage for printing.
|
||||
|
||||
2) 'Optional' Message interface:
|
||||
- Set Page Size
|
||||
- Flip Orientation
|
||||
|
||||
The message interface is available for GUI Controls, BPopupMenu to send
|
||||
messages to the MarginView if the parent Window is not used to handle
|
||||
the messages.
|
||||
|
||||
General Use of MarginView component:
|
||||
|
||||
1) Simply construct a new MarginView object with the margins
|
||||
you want as defaults and add this view to the parent view
|
||||
of the dialog.
|
||||
|
||||
MarginView *mv;
|
||||
mv = new MarginView(viewSizeRect, pageWidth, pageHeight);
|
||||
parentView->AddChild(mv);
|
||||
|
||||
* you can also set the margins in the constructor, and the units:
|
||||
|
||||
mv = new MarginView(viewSizeRect, pageWidth, pageHeight
|
||||
marginRect, kUnitPointS);
|
||||
|
||||
! but remeber to have the marginRect values match the UNITS :-)
|
||||
|
||||
2) Set Page Size with methods:
|
||||
|
||||
mv-SetPageSize( pageWidth, pageHeight );
|
||||
mv->UpdateView();
|
||||
|
||||
3) Set Page Size with BMessage:
|
||||
|
||||
BMessage* msg = new BMessage(CHANGE_PAGE_SIZE);
|
||||
msg->AddFloat("width", pageWidth);
|
||||
msg->AddFloat("height", pageHeight);
|
||||
mv->PostMessage(msg);
|
||||
|
||||
4) Flip Page with methods:
|
||||
|
||||
mv-SetPageSize( pageHeight, pageWidth );
|
||||
mv->UpdateView();
|
||||
|
||||
5) Flip Page with BMessage:
|
||||
|
||||
BMessage* msg = new BMessage(FLIP_PAGE);
|
||||
mv->Looper()->PostMessage(msg);
|
||||
|
||||
Note: the MarginView DOES NOT keep track of the orientation. This
|
||||
should be done by the code for the Page setup dialog.
|
||||
|
||||
6) Get Page Size
|
||||
|
||||
BPoint pageSize = mv->GetPageSize();
|
||||
|
||||
7) Get Margins
|
||||
|
||||
BRect margins = mv->GetMargins();
|
||||
|
||||
8) Get Units
|
||||
|
||||
uint32 units = mv->GetUnits();
|
||||
|
||||
where units is one of:
|
||||
kUnitInch, 72 points/in
|
||||
kUnitCM, 28.346 points/cm
|
||||
kUnitPoint, 1 point/point
|
||||
*/
|
||||
|
||||
#ifndef _MARGIN_VIEW_H
|
||||
#define _MARGIN_VIEW_H
|
||||
|
||||
#include <InterfaceKit.h>
|
||||
#include <Looper.h>
|
||||
|
||||
class BTextControl;
|
||||
class MarginManager;
|
||||
|
||||
// Messages that the MarginManager accepts
|
||||
const uint32 TOP_MARGIN_CHANGED = 'tchg';
|
||||
const uint32 RIGHT_MARGIN_CHANGED = 'rchg';
|
||||
const uint32 LEFT_MARGIN_CHANGED = 'lchg';
|
||||
const uint32 BOTTOM_MARGIN_CHANGED = 'bchg';
|
||||
const uint32 MARGIN_CHANGED = 'mchg';
|
||||
const uint32 CHANGE_PAGE_SIZE = 'chps';
|
||||
const uint32 FLIP_PAGE = 'flip';
|
||||
const uint32 MARGIN_UNIT_CHANGED = 'mucg';
|
||||
|
||||
enum MarginUnit {
|
||||
kUnitInch = 0,
|
||||
kUnitCM,
|
||||
kUnitPoint
|
||||
};
|
||||
|
||||
/**
|
||||
* Class MarginView
|
||||
*/
|
||||
class MarginView : public BBox
|
||||
{
|
||||
friend class MarginManager;
|
||||
|
||||
public:
|
||||
MarginView(BRect rect, int32 pageWidth = 0,
|
||||
int32 pageHeight = 0,
|
||||
BRect margins = BRect(1, 1, 1, 1), // 1 inch
|
||||
MarginUnit unit = kUnitInch);
|
||||
|
||||
virtual ~MarginView();
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void Draw(BRect rect);
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
|
||||
// point.x = width, point.y = height
|
||||
BPoint PageSize() const;
|
||||
void SetPageSize(float pageWidth, float pageHeight);
|
||||
|
||||
// margin
|
||||
BRect Margin() const;
|
||||
|
||||
// units
|
||||
MarginUnit Unit() const;
|
||||
|
||||
// will cause a recalc and redraw
|
||||
void UpdateView(uint32 msg);
|
||||
|
||||
private:
|
||||
// all the GUI construction code
|
||||
void _ConstructGUI();
|
||||
|
||||
// utility method
|
||||
void _AllowOnlyNumbers(BTextControl *textControl,
|
||||
int32 maxNum);
|
||||
|
||||
// performed internally using text fields
|
||||
void _SetMargin(BRect margin);
|
||||
|
||||
// performed internally using the supplied popup
|
||||
void _SetMarginUnit(MarginUnit unit);
|
||||
|
||||
// Calculate the view size for the margins
|
||||
void _CalculateViewSize(uint32 msg);
|
||||
|
||||
private:
|
||||
BTextControl* fTop;
|
||||
BTextControl* fBottom;
|
||||
BTextControl* fLeft;
|
||||
BTextControl* fRight;
|
||||
|
||||
// rect that holds the margins for the page as a set of point offsets
|
||||
BRect fMargins;
|
||||
|
||||
// the maximum size of the page view calculated from the view size
|
||||
float fMaxPageWidth;
|
||||
float fMaxPageHeight;
|
||||
|
||||
// the actual size of the page in points
|
||||
float fPageHeight;
|
||||
float fPageWidth;
|
||||
|
||||
// the units used to calculate the page size
|
||||
MarginUnit fMarginUnit;
|
||||
float fUnitValue;
|
||||
|
||||
// the size of the drawing area we have to draw the view in pixels
|
||||
float fViewHeight;
|
||||
float fViewWidth;
|
||||
};
|
||||
|
||||
#endif // _MARGIN_VIEW_H
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* PackBits.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
||||
#endif /* __PACKBITS_H */
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* PageSetupDlg.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __PAGESETUPDLG_H
|
||||
#define __PAGESETUPDLG_H
|
||||
|
||||
#include <View.h>
|
||||
#include "DialogWindow.h"
|
||||
#include "JobData.h"
|
||||
|
||||
class BRadioButton;
|
||||
class BPopUpMenu;
|
||||
class JobData;
|
||||
class PaperCap;
|
||||
class PrinterData;
|
||||
class PrinterCap;
|
||||
class MarginView;
|
||||
|
||||
class PageSetupView : public BView {
|
||||
public:
|
||||
PageSetupView(BRect frame, JobData *job_data, PrinterData *printer_data, const PrinterCap *printer_cap);
|
||||
~PageSetupView();
|
||||
virtual void AttachedToWindow();
|
||||
bool UpdateJobData();
|
||||
void MessageReceived(BMessage *msg);
|
||||
|
||||
private:
|
||||
void AddOrientationItem(const char *name, JobData::Orientation orientation);
|
||||
JobData::Orientation GetOrientation();
|
||||
PaperCap *GetPaperCap();
|
||||
|
||||
JobData *fJobData;
|
||||
PrinterData *fPrinterData;
|
||||
const PrinterCap *fPrinterCap;
|
||||
BPopUpMenu *fPaper;
|
||||
BPopUpMenu *fOrientation;
|
||||
BPopUpMenu *fResolution;
|
||||
BTextControl *fScaling;
|
||||
MarginView *fMarginView;
|
||||
};
|
||||
|
||||
class PageSetupDlg : public DialogWindow {
|
||||
public:
|
||||
PageSetupDlg(JobData *job_data, PrinterData *printer_data, const PrinterCap *printer_cap);
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
|
||||
private:
|
||||
BMessageFilter *fFilter;
|
||||
};
|
||||
|
||||
#endif /* __PAGESETUPDLG_H */
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* PagesView.h
|
||||
* Copyright 2005 Michael Pfeiffer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _PAGES_VIEW_H
|
||||
#define _PAGES_VIEW_H
|
||||
|
||||
#include <View.h>
|
||||
|
||||
class PagesView : public BView
|
||||
{
|
||||
public:
|
||||
PagesView(BRect frame, const char* name, uint32 resizeMask, uint32 flags);
|
||||
|
||||
void GetPreferredSize(float *width, float *height);
|
||||
void Draw(BRect rect);
|
||||
|
||||
void setCollate(bool collate);
|
||||
void setReverse(bool reverse);
|
||||
|
||||
private:
|
||||
void DrawPages(BPoint position, int number, int count);
|
||||
void DrawPage(BPoint position, int number);
|
||||
|
||||
bool fCollate;
|
||||
bool fReverse;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
const unsigned char pattern16x16_type1[] = {
|
||||
0,128, 32,160, 8,136, 40,168, 2,130, 34,162, 10,138, 42,170,
|
||||
192, 64,224, 96,200, 72,232,104,194, 66,226, 98,202, 74,234,106,
|
||||
48,176, 16,144, 56,184, 24,152, 50,178, 18,146, 58,186, 26,154,
|
||||
240,112,208, 80,248,120,216, 88,242,114,210, 82,250,122,218, 90,
|
||||
12,140, 44,172, 4,132, 36,164, 14,142, 46,174, 6,134, 38,166,
|
||||
204, 76,236,108,196, 68,228,100,206, 78,238,110,198, 70,230,102,
|
||||
60,188, 28,156, 52,180, 20,148, 62,190, 30,158, 54,182, 22,150,
|
||||
252,124,220, 92,244,116,212, 84,254,126,222, 94,246,118,214, 86,
|
||||
3,131, 35,163, 11,139, 43,171, 1,129, 33,161, 9,137, 41,169,
|
||||
195, 67,227, 99,203, 75,235,107,193, 65,225, 97,201, 73,233,105,
|
||||
51,179, 19,147, 59,187, 27,155, 49,177, 17,145, 57,185, 25,153,
|
||||
243,115,211, 83,251,123,219, 91,241,113,209, 81,249,121,217, 89,
|
||||
15,143, 47,175, 7,135, 39,167, 13,141, 45,173, 5,133, 37,165,
|
||||
207, 79,239,111,199, 71,231,103,205, 77,237,109,197, 69,229,101,
|
||||
63,191, 31,159, 55,183, 23,151, 61,189, 29,157, 53,181, 21,149,
|
||||
255,127,223, 95,247,119,215, 87,253,125,221, 93,245,117,213, 85
|
||||
};
|
||||
|
||||
const unsigned char pattern16x16_type2[] = {
|
||||
153,137,121,105,152,136,120,104,151,135,119,103,150,134,118,102,
|
||||
169, 25, 9, 89,168, 24, 8, 88,167, 23, 7, 87,166, 22, 6, 86,
|
||||
185, 41, 57, 73,184, 40, 56, 72,183, 39, 55, 71,182, 38, 54, 70,
|
||||
201,217,233,249,200,216,232,248,199,215,231,247,198,214,230,246,
|
||||
154,138,122,106,145,129,113, 97,144,128,112, 96,149,133,117,101,
|
||||
170, 26, 10, 90,161, 17, 1, 81,160, 16, 0, 80,165, 21, 5, 85,
|
||||
186, 42, 58, 74,177, 33, 49, 65,176, 32, 48, 64,181, 37, 53, 69,
|
||||
202,218,234,250,193,209,225,241,192,208,224,240,197,213,229,245,
|
||||
155,139,123,107,146,130,114, 98,147,131,115, 99,148,132,116,100,
|
||||
171, 27, 11, 91,162, 18, 2, 82,163, 19, 3, 83,164, 20, 4, 84,
|
||||
187, 43, 59, 75,178, 34, 50, 66,179, 35, 51, 67,180, 36, 52, 68,
|
||||
203,219,235,251,194,210,226,242,195,211,227,243,196,212,228,244,
|
||||
156,140,124,108,157,141,125,109,158,142,126,110,159,143,127,111,
|
||||
172, 28, 12, 92,173, 29, 13, 93,174, 30, 14, 94,175, 31, 15, 95,
|
||||
188, 44, 60, 76,189, 45, 61, 77,190, 46, 62, 78,191, 47, 63, 79,
|
||||
204,220,236,252,205,221,237,253,206,222,238,254,207,223,239,255
|
||||
};
|
||||
|
||||
const unsigned char pattern16x16_type3[] = {
|
||||
0, 32,224,192, 2, 34,226,194, 14, 46,238,206, 12, 44,236,204,
|
||||
128,160, 80,112,130,162, 82,114,142,174, 94,126,140,172, 92,124,
|
||||
240,208, 16, 48,242,210, 18, 50,254,222, 30, 62,252,220, 28, 60,
|
||||
64, 96,144,176, 66, 98,146,178, 78,110,158,190, 76,108,156,188,
|
||||
8, 40,232,200, 10, 42,234,202, 5, 37,229,197, 7, 39,231,199,
|
||||
136,168, 88,120,138,170, 90,122,133,165, 85,117,135,167, 87,119,
|
||||
248,216, 24, 56,250,218, 26, 58,245,213, 21, 53,247,215, 23, 55,
|
||||
72,104,152,184, 74,106,154,186, 69,101,149,181, 71,103,151,183,
|
||||
15, 47,239,207, 13, 45,237,205, 1, 33,225,193, 3, 35,227,195,
|
||||
143,175, 95,127,141,173, 93,125,129,161, 81,113,131,163, 83,115,
|
||||
255,223, 31, 63,253,221, 29, 61,241,209, 17, 49,243,211, 19, 51,
|
||||
79,111,159,191, 77,109,157,189, 65, 97,145,177, 67, 99,147,179,
|
||||
4, 36,228,196, 6, 38,230,198, 9, 41,233,201, 11, 43,235,203,
|
||||
132,164, 84,116,134,166, 86,118,137,169, 89,121,139,171, 91,123,
|
||||
244,212, 20, 52,246,214, 22, 54,249,217, 25, 57,251,219, 27, 59,
|
||||
68,100,148,180, 70,102,150,182, 73,105,153,185, 75,107,155,187
|
||||
};
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
|
||||
Preview
|
||||
|
||||
Copyright (c) 2002, 2003 OpenBeOS.
|
||||
Copyright (c) 2005 Haiku.
|
||||
|
||||
Author:
|
||||
Michael Pfeiffer
|
||||
Hartmut Reh
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <InterfaceKit.h>
|
||||
#include "PrintJobReader.h"
|
||||
#include "InterfaceUtils.h"
|
||||
|
||||
class PreviewPage {
|
||||
int32 fPage;
|
||||
int32 fNumberOfPictures;
|
||||
BPicture* fPictures;
|
||||
BPoint* fPoints;
|
||||
BRect* fRects;
|
||||
status_t fStatus;
|
||||
|
||||
public:
|
||||
PreviewPage(int32 page, PrintJobPage* pjp);
|
||||
~PreviewPage();
|
||||
status_t InitCheck() const;
|
||||
|
||||
int32 Page() const { return fPage; }
|
||||
void Draw(BView* view);
|
||||
};
|
||||
|
||||
class PreviewView : public BView {
|
||||
int32 fPage;
|
||||
int32 fZoom;
|
||||
PrintJobReader fReader;
|
||||
int32 fNumberOfPagesPerPage;
|
||||
int32 fNumberOfPages; // physical pages
|
||||
bool fReverse;
|
||||
BRect fPageRect;
|
||||
JobData::Orientation fOrientation;
|
||||
JobData::PageSelection fPageSelection;
|
||||
PreviewPage* fCachedPage;
|
||||
|
||||
float ZoomFactor() const;
|
||||
BRect PageRect() const;
|
||||
BRect PrintableRect() const;
|
||||
int32 GetPageNumber(int32 index) const;
|
||||
|
||||
public:
|
||||
PreviewView(BFile* jobFile, BRect rect);
|
||||
~PreviewView();
|
||||
status_t InitCheck() const;
|
||||
|
||||
BRect ViewRect() const;
|
||||
|
||||
bool IsPageLoaded(int32 page) const;
|
||||
bool IsPageValid() const;
|
||||
void LoadPage(int32 page);
|
||||
void DrawPageFrame(BRect r);
|
||||
void DrawPage(BRect r);
|
||||
void Draw(BRect r);
|
||||
void FrameResized(float width, float height);
|
||||
|
||||
void FixScrollbars();
|
||||
|
||||
bool ShowsFirstPage() const;
|
||||
bool ShowsLastPage() const;
|
||||
int CurrentPage() const { return fPage + 1; }
|
||||
int NumberOfPages() const;
|
||||
void ShowNextPage();
|
||||
void ShowPrevPage();
|
||||
void ShowFirstPage();
|
||||
void ShowLastPage();
|
||||
void ShowFindPage(int page);
|
||||
|
||||
bool CanZoomIn() const;
|
||||
bool CanZoomOut() const;
|
||||
void ZoomIn();
|
||||
void ZoomOut();
|
||||
};
|
||||
|
||||
class PreviewWindow : public BlockingWindow {
|
||||
BButton *fFirst;
|
||||
BButton *fNext;
|
||||
BButton *fPrev;
|
||||
BButton *fLast;
|
||||
BButton *fZoomIn;
|
||||
BButton *fZoomOut;
|
||||
BTextControl *fPageNumber;
|
||||
BStringView *fPageText;
|
||||
PreviewView *fPreview;
|
||||
BScrollView *fPreviewScroller;
|
||||
float fButtonBarHeight;
|
||||
|
||||
enum {
|
||||
MSG_FIRST_PAGE = 'pwfp',
|
||||
MSG_NEXT_PAGE = 'pwnp',
|
||||
MSG_PREV_PAGE = 'pwpp',
|
||||
MSG_LAST_PAGE = 'pwlp',
|
||||
MSG_FIND_PAGE = 'pwsp',
|
||||
MSG_ZOOM_IN = 'pwzi',
|
||||
MSG_ZOOM_OUT = 'pwzo',
|
||||
MSG_PRINT_JOB = 'pwpj',
|
||||
MSG_CANCEL_JOB = 'pwcj',
|
||||
};
|
||||
|
||||
void ResizeToPage(bool allowShrinking = false);
|
||||
void UpdateControls();
|
||||
|
||||
typedef BlockingWindow inherited;
|
||||
|
||||
public:
|
||||
PreviewWindow(BFile* jobFile, bool showOkAndCancelButtons = false);
|
||||
status_t InitCheck() const { return fPreview->InitCheck(); }
|
||||
void MessageReceived(BMessage* m);
|
||||
status_t Go();
|
||||
};
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* PrintProcess.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __PRINTPROCESS_H
|
||||
#define __PRINTPROCESS_H
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include <Rect.h>
|
||||
#include <Point.h>
|
||||
|
||||
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
|
||||
using namespace std;
|
||||
#else
|
||||
#define std
|
||||
#endif
|
||||
|
||||
class BFile;
|
||||
class BPicture;
|
||||
|
||||
class PictureData {
|
||||
public:
|
||||
PictureData(BFile *file);
|
||||
~PictureData();
|
||||
BPoint point;
|
||||
BRect rect;
|
||||
BPicture *picture;
|
||||
};
|
||||
|
||||
class PageData {
|
||||
public:
|
||||
PageData();
|
||||
PageData(BFile *file, bool reverse);
|
||||
bool startEnum();
|
||||
bool enumObject(PictureData **);
|
||||
|
||||
private:
|
||||
BFile *fFile;
|
||||
bool fReverse;
|
||||
int fPictureCount;
|
||||
int fRest;
|
||||
off_t fOffset;
|
||||
bool fHollow;
|
||||
};
|
||||
|
||||
typedef list<PageData *> PageDataList;
|
||||
|
||||
class SpoolData {
|
||||
public:
|
||||
SpoolData(BFile *file, int page_count, int nup, bool reverse);
|
||||
~SpoolData();
|
||||
bool startEnum();
|
||||
bool enumObject(PageData **);
|
||||
|
||||
private:
|
||||
PageDataList fPages;
|
||||
PageDataList::iterator fIt;
|
||||
};
|
||||
|
||||
#endif /* __PRINTPROCESS_H */
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* PrinterCap.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __PRINTERCAP_H
|
||||
#define __PRINTERCAP_H
|
||||
|
||||
#include <string>
|
||||
#include <Rect.h>
|
||||
#include "JobData.h"
|
||||
|
||||
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
|
||||
using namespace std;
|
||||
#else
|
||||
#define std
|
||||
#endif
|
||||
|
||||
enum {
|
||||
kUnknownPrinter = 0
|
||||
};
|
||||
|
||||
struct BaseCap {
|
||||
string label;
|
||||
bool is_default;
|
||||
BaseCap(const string &n, bool d) : label(n), is_default(d) {}
|
||||
};
|
||||
|
||||
struct PaperCap : public BaseCap {
|
||||
JobData::Paper paper;
|
||||
BRect paper_rect;
|
||||
BRect physical_rect;
|
||||
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) {}
|
||||
};
|
||||
|
||||
struct PaperSourceCap : public BaseCap {
|
||||
JobData::PaperSource paper_source;
|
||||
PaperSourceCap(const string &n, bool d, JobData::PaperSource f)
|
||||
: BaseCap(n, d), paper_source(f) {}
|
||||
};
|
||||
|
||||
struct ResolutionCap : public BaseCap {
|
||||
int xres;
|
||||
int yres;
|
||||
ResolutionCap(const string &n, bool d, int x, int y)
|
||||
: BaseCap(n, d), xres(x), yres(y) {}
|
||||
};
|
||||
|
||||
struct OrientationCap : public BaseCap {
|
||||
JobData::Orientation orientation;
|
||||
OrientationCap(const string &n, bool d, JobData::Orientation o)
|
||||
: BaseCap(n, d), orientation(o) {}
|
||||
};
|
||||
|
||||
struct PrintStyleCap : public BaseCap {
|
||||
JobData::PrintStyle print_style;
|
||||
PrintStyleCap(const string &n, bool d, JobData::PrintStyle x)
|
||||
: BaseCap(n, d), print_style(x) {}
|
||||
};
|
||||
|
||||
struct BindingLocationCap : public BaseCap {
|
||||
JobData::BindingLocation binding_location;
|
||||
BindingLocationCap(const string &n, bool d, JobData::BindingLocation b)
|
||||
: BaseCap(n, d), binding_location(b) {}
|
||||
};
|
||||
|
||||
struct ColorCap : public BaseCap {
|
||||
JobData::Color color;
|
||||
ColorCap(const string &n, bool d, JobData::Color c)
|
||||
: BaseCap(n, d), color(c) {}
|
||||
};
|
||||
|
||||
struct ProtocolClassCap : public BaseCap {
|
||||
int protocolClass;
|
||||
string description;
|
||||
ProtocolClassCap(const string &n, bool d, int p, const string &desc)
|
||||
: BaseCap(n, d)
|
||||
, protocolClass(p)
|
||||
, description(desc) {}
|
||||
};
|
||||
|
||||
|
||||
class PrinterData;
|
||||
|
||||
class PrinterCap {
|
||||
public:
|
||||
PrinterCap(const PrinterData *printer_data);
|
||||
virtual ~PrinterCap();
|
||||
|
||||
enum CapID {
|
||||
kPaper,
|
||||
kPaperSource,
|
||||
kResolution,
|
||||
kOrientation,
|
||||
kPrintStyle,
|
||||
kBindingLocation,
|
||||
kColor,
|
||||
kProtocolClass,
|
||||
// Static boolean settings follow.
|
||||
// For them isSupport() has to be implemented only.
|
||||
kCopyCommand, // supports printer page copy command?
|
||||
};
|
||||
|
||||
virtual int countCap(CapID) const = 0;
|
||||
virtual bool isSupport(CapID) const = 0;
|
||||
virtual const BaseCap **enumCap(CapID) const = 0;
|
||||
const BaseCap *getDefaultCap(CapID) const;
|
||||
int getPrinterId() const;
|
||||
int getProtocolClass() const;
|
||||
|
||||
protected:
|
||||
PrinterCap(const PrinterCap &);
|
||||
PrinterCap &operator = (const PrinterCap &);
|
||||
const PrinterData *getPrinterData() const;
|
||||
void setPrinterId(int id);
|
||||
|
||||
private:
|
||||
const PrinterData *fPrinterData;
|
||||
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 */
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* PrinterData.h
|
||||
* Copyright 1999-2000 Y.Takagi All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __PRINTERDATA_H
|
||||
#define __PRINTERDATA_H
|
||||
|
||||
#include <string>
|
||||
#include <SerialPort.h>
|
||||
|
||||
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
|
||||
using namespace std;
|
||||
#else
|
||||
#define std
|
||||
#endif
|
||||
|
||||
class BNode;
|
||||
|
||||
class PrinterData {
|
||||
public:
|
||||
PrinterData(BNode *node = NULL);
|
||||
~PrinterData();
|
||||
void load();
|
||||
void save();
|
||||
|
||||
const string &getDriverName() const;
|
||||
const string &getPrinterName() const;
|
||||
const string &getComments() const;
|
||||
const string &getTransport() const;
|
||||
int getProtocolClass() const;
|
||||
|
||||
void setPrinterName(const char *printer_name);
|
||||
void setComments(const char *comments);
|
||||
void setProtocolClass(int protocolClass);
|
||||
|
||||
bool getPath(string &path) const;
|
||||
|
||||
protected:
|
||||
PrinterData(const PrinterData &printer_data);
|
||||
PrinterData &operator = (const PrinterData &printer_data);
|
||||
|
||||
private:
|
||||
string fDriverName;
|
||||
string fPrinterName;
|
||||
string fComments;
|
||||
string fTransport;
|
||||
int fProtocolClass;
|
||||
|
||||
BNode *fNode;
|
||||
};
|
||||
|
||||
inline const string &PrinterData::getDriverName() const
|
||||
{
|
||||
return fDriverName;
|
||||
}
|
||||
|
||||
inline const string &PrinterData::getPrinterName() const
|
||||
{
|
||||
return fPrinterName;
|
||||
}
|
||||
|
||||
inline const string &PrinterData::getComments() const
|
||||
{
|
||||
return fComments;
|
||||
}
|
||||
|
||||
inline const string &PrinterData::getTransport() const
|
||||
{
|
||||
return fTransport;
|
||||
}
|
||||
|
||||
inline int PrinterData::getProtocolClass() const
|
||||
{
|
||||
return fProtocolClass;
|
||||
}
|
||||
|
||||
inline void PrinterData::setPrinterName(const char *printer_name)
|
||||
{
|
||||
fPrinterName = printer_name;
|
||||
}
|
||||
|
||||
inline void PrinterData::setComments(const char *comments)
|
||||
{
|
||||
fComments = comments;
|
||||
}
|
||||
|
||||
inline void PrinterData::setProtocolClass(int protocolClass)
|
||||
{
|
||||
fProtocolClass = protocolClass;
|
||||
}
|
||||
|
||||
#endif // __PRINTERDATA_H
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef _PRINTER_DRIVER_H
|
||||
#define _PRINTER_DRIVER_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
class BFile;
|
||||
class BMessage;
|
||||
class BNode;
|
||||
class PrinterCap;
|
||||
class PrinterData;
|
||||
class GraphicsDriver;
|
||||
|
||||
#define kAttrPageSettings "libprint/page_settings"
|
||||
#define kAttrJobSettings "libprint/job_settings"
|
||||
|
||||
class PrinterDriver {
|
||||
public:
|
||||
PrinterDriver(BNode* spoolFolder);
|
||||
virtual ~PrinterDriver();
|
||||
|
||||
virtual const char* GetSignature() const = 0;
|
||||
virtual const char* GetDriverName() const = 0;
|
||||
virtual const char* GetVersion() const = 0;
|
||||
virtual const char* GetCopyright() const = 0;
|
||||
|
||||
virtual PrinterCap* InstantiatePrinterCap(PrinterData* printerData) = 0;
|
||||
virtual GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, PrinterData* printerData, PrinterCap* printerCap) = 0;
|
||||
|
||||
void InitPrinterDataAndCap();
|
||||
|
||||
virtual void About();
|
||||
virtual char* AddPrinter(char* printerName);
|
||||
BMessage* ConfigPage(BMessage* settings);
|
||||
BMessage* ConfigJob(BMessage* settings);
|
||||
BMessage* TakeJob(BFile* printJob, BMessage* settings);
|
||||
|
||||
protected:
|
||||
|
||||
PrinterData* GetPrinterData() { return fPrinterData; }
|
||||
PrinterCap* GetPrinterCap() { return fPrinterCap; }
|
||||
|
||||
private:
|
||||
bool ReadSettings(const char* attrName, BMessage* settings);
|
||||
void WriteSettings(const char* attrName, BMessage* settings);
|
||||
void MergeWithPreviousSettings(const char* attrName, BMessage* settings);
|
||||
|
||||
BNode* fSpoolFolder;
|
||||
PrinterData* fPrinterData;
|
||||
PrinterCap* fPrinterCap;
|
||||
GraphicsDriver* fGraphicsDriver;
|
||||
};
|
||||
|
||||
PrinterDriver* instantiate_printer_driver(BNode* printerFolder = NULL);
|
||||
|
||||
#endif // _PRINTER_DRIVER_H
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* SpoolMetaData.h
|
||||
* Copyright 2003 Michael Pfeiffer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __SPOOLMETADATA_H
|
||||
#define __SPOOLMETADATA_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <File.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
class SpoolMetaData {
|
||||
typedef std::string string;
|
||||
private:
|
||||
string fDescription;
|
||||
string fMimeType;
|
||||
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 */
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
StatusWindow.h
|
||||
Copyright 2005 Dr.H.Reh. All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef STATUS_WINDOW_H
|
||||
#define STATUS_WINDOW_H
|
||||
|
||||
#include <Window.h>
|
||||
#include <StatusBar.h>
|
||||
#include <String.h>
|
||||
|
||||
class StatusWindow : public BWindow
|
||||
{
|
||||
public:
|
||||
StatusWindow(bool oddPages, bool evenPages,
|
||||
uint32 firstPage, uint32 numPages,
|
||||
uint32 docCopies, uint32 nup);
|
||||
~StatusWindow(void);
|
||||
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
|
||||
void ResetStatusBar(void);
|
||||
bool UpdateStatusBar(uint32 page, uint32 copy);
|
||||
void SetPageCopies(uint32 copies);
|
||||
|
||||
private:
|
||||
BView *fStatusView;
|
||||
BStatusBar *fStatusBar;
|
||||
BButton *fCancelButton;
|
||||
BButton *fHideButton;
|
||||
bool fCancelBar;
|
||||
bool fDocumentCopy;
|
||||
uint32 fNops;
|
||||
uint32 fFirstPage;
|
||||
uint32 fCopies;
|
||||
uint32 fDocCopies;
|
||||
float fStatusDelta;
|
||||
float fDelta;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Transport.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __TRANSPORT_H
|
||||
#define __TRANSPORT_H
|
||||
|
||||
#include <image.h>
|
||||
#include <string>
|
||||
|
||||
class BDataIO;
|
||||
class PrinterData;
|
||||
|
||||
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
|
||||
using namespace std;
|
||||
#else
|
||||
#define std
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
typedef BDataIO *(*PFN_init_transport)(BMessage *);
|
||||
typedef void (*PFN_exit_transport)(void);
|
||||
}
|
||||
|
||||
class TransportException {
|
||||
private:
|
||||
string fWhat;
|
||||
public:
|
||||
TransportException(const string &what_arg) : fWhat(what_arg) {}
|
||||
const char *what() const { return fWhat.c_str(); }
|
||||
};
|
||||
|
||||
class Transport {
|
||||
public:
|
||||
Transport(const PrinterData *printer_data);
|
||||
~Transport();
|
||||
void write(const void *buffer, size_t size) throw(TransportException);
|
||||
bool check_abort() const;
|
||||
bool is_print_to_file_canceled() const;
|
||||
const string &last_error() const;
|
||||
|
||||
protected:
|
||||
void set_last_error(const char *e);
|
||||
Transport(const Transport &);
|
||||
Transport &operator = (const Transport &);
|
||||
|
||||
private:
|
||||
image_id fImage;
|
||||
PFN_init_transport fInitTransport;
|
||||
PFN_exit_transport fExitTransport;
|
||||
BDataIO *fDataStream;
|
||||
bool fAbort;
|
||||
string fLastErrorString;
|
||||
};
|
||||
|
||||
#endif // __TRANSPORT_H
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* UIDriver.h
|
||||
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __UIDRIVER_H
|
||||
#define __UIDRIVER_H
|
||||
|
||||
class BMessage;
|
||||
class PrinterData;
|
||||
class PrinterCap;
|
||||
class JobData;
|
||||
|
||||
class UIDriver {
|
||||
public:
|
||||
UIDriver(BMessage *msg, PrinterData *printer_data, const PrinterCap *printer_cap);
|
||||
virtual ~UIDriver();
|
||||
BMessage *configPage();
|
||||
BMessage *configJob();
|
||||
|
||||
protected:
|
||||
virtual long doPageSetup(JobData *job_data, PrinterData *printer_data, const PrinterCap *printer_cap);
|
||||
virtual long doJobSetup(JobData *job_data, PrinterData *printer_data, const PrinterCap *printer_cap);
|
||||
|
||||
UIDriver(const UIDriver &);
|
||||
UIDriver &operator = (const UIDriver &);
|
||||
|
||||
private:
|
||||
BMessage *fMsg;
|
||||
PrinterData *fPrinterData;
|
||||
const PrinterCap *fPrinterCap;
|
||||
};
|
||||
|
||||
#endif /* __UIDRIVER_H */
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* ValidRect.h
|
||||
* Copyright 1999-2000 Y.Takagi All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __VALIDRECT_H
|
||||
#define __VALIDRECT_H
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
|
||||
class BBitmap;
|
||||
|
||||
struct RECT {
|
||||
int left;
|
||||
int top;
|
||||
int right;
|
||||
int bottom;
|
||||
};
|
||||
|
||||
bool get_valid_rect(BBitmap *bitmap, RECT *rc);
|
||||
|
||||
int color_space2pixel_depth(color_space cs);
|
||||
|
||||
#endif // __VALIDRECT_H
|
||||
Reference in New Issue
Block a user