* 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:
Karsten Heimrich
2008-07-22 20:30:14 +00:00
parent 467acc16f5
commit 12fd6cc2e7
93 changed files with 724 additions and 571 deletions
@@ -1,16 +1,16 @@
/* /*
* AboutBox.h * AboutBox.h
* Copyright 1999-2000 Y.Takagi. All Rights Reserved. * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
*/ */
#ifndef __ABOUTBOX_H #ifndef __ABOUTBOX_H
#define __ABOUTBOX_H #define __ABOUTBOX_H
#include <Application.h> #include <Application.h>
class AboutBox : public BApplication { class AboutBox : public BApplication {
public: public:
AboutBox(const char *signature, const char *driver_name, const char *version, const char *copyright); AboutBox(const char *signature, const char *driver_name, const char *version, const char *copyright);
}; };
#endif /* __ABOUTBOX_H */ #endif /* __ABOUTBOX_H */
@@ -1,22 +1,22 @@
/* /*
* Exports.h * Exports.h
* Copyright 1999-2000 Y.Takagi. All Rights Reserved. * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
*/ */
#ifndef __EXPORTS_H #ifndef __EXPORTS_H
#define __EXPORTS_H #define __EXPORTS_H
#include <BeBuild.h> #include <BeBuild.h>
class BNode; class BNode;
class BMessage; class BMessage;
class BFile; class BFile;
extern "C" { extern "C" {
_EXPORT char *add_printer(char *printer_name); _EXPORT char *add_printer(char *printer_name);
_EXPORT BMessage *config_page(BNode *node, BMessage *msg); _EXPORT BMessage *config_page(BNode *node, BMessage *msg);
_EXPORT BMessage *config_job(BNode *node, BMessage *msg); _EXPORT BMessage *config_job(BNode *node, BMessage *msg);
_EXPORT BMessage *take_job(BFile *spool_file, BNode *node, BMessage *msg); _EXPORT BMessage *take_job(BFile *spool_file, BNode *node, BMessage *msg);
} }
#endif // __EXPORTS_H #endif // __EXPORTS_H
@@ -1,57 +1,57 @@
/* /*
* Transport.h * Transport.h
* Copyright 1999-2000 Y.Takagi. All Rights Reserved. * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
*/ */
#ifndef __TRANSPORT_H #ifndef __TRANSPORT_H
#define __TRANSPORT_H #define __TRANSPORT_H
#include <image.h> #include <image.h>
#include <string> #include <string>
class BDataIO; class BDataIO;
class PrinterData; class PrinterData;
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE)) #if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
using namespace std; using namespace std;
#else #else
#define std #define std
#endif #endif
extern "C" { extern "C" {
typedef BDataIO *(*PFN_init_transport)(BMessage *); typedef BDataIO *(*PFN_init_transport)(BMessage *);
typedef void (*PFN_exit_transport)(void); typedef void (*PFN_exit_transport)(void);
} }
class TransportException { class TransportException {
private: private:
string fWhat; string fWhat;
public: public:
TransportException(const string &what_arg) : fWhat(what_arg) {} TransportException(const string &what_arg) : fWhat(what_arg) {}
const char *what() const { return fWhat.c_str(); } const char *what() const { return fWhat.c_str(); }
}; };
class Transport { class Transport {
public: public:
Transport(const PrinterData *printer_data); Transport(const PrinterData *printer_data);
~Transport(); ~Transport();
void write(const void *buffer, size_t size) throw(TransportException); void write(const void *buffer, size_t size) throw(TransportException);
bool check_abort() const; bool check_abort() const;
bool is_print_to_file_canceled() const; bool is_print_to_file_canceled() const;
const string &last_error() const; const string &last_error() const;
protected: protected:
void set_last_error(const char *e); void set_last_error(const char *e);
Transport(const Transport &); Transport(const Transport &);
Transport &operator = (const Transport &); Transport &operator = (const Transport &);
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
+222
View File
@@ -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
-1
View File
@@ -1,5 +1,4 @@
SubDir HAIKU_TOP src add-ons print ; SubDir HAIKU_TOP src add-ons print ;
SubInclude HAIKU_TOP src add-ons print shared ;
SubInclude HAIKU_TOP src add-ons print drivers ; SubInclude HAIKU_TOP src add-ons print drivers ;
SubInclude HAIKU_TOP src add-ons print transports ; SubInclude HAIKU_TOP src add-ons print transports ;
-1
View File
@@ -1,6 +1,5 @@
SubDir HAIKU_TOP src add-ons print drivers ; SubDir HAIKU_TOP src add-ons print drivers ;
SubInclude HAIKU_TOP src add-ons print drivers shared ;
SubInclude HAIKU_TOP src add-ons print drivers canon_lips ; SubInclude HAIKU_TOP src add-ons print drivers canon_lips ;
SubInclude HAIKU_TOP src add-ons print drivers pcl5 ; SubInclude HAIKU_TOP src add-ons print drivers pcl5 ;
SubInclude HAIKU_TOP src add-ons print drivers pcl6 ; SubInclude HAIKU_TOP src add-ons print drivers pcl6 ;
@@ -2,8 +2,7 @@ SubDir HAIKU_TOP src add-ons print drivers canon_lips lips3 ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print libprint ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers libs print libprint ] ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print utils ] ;
AddResources Canon\ LIPS3\ Compatible : Lips3.rdef ; AddResources Canon\ LIPS3\ Compatible : Lips3.rdef ;
@@ -13,8 +12,8 @@ Addon Canon\ LIPS3\ Compatible :
Lips3Cap.cpp Lips3Cap.cpp
Compress3.cpp Compress3.cpp
: :
be be
libprint.a libprint.a
libprintutils.a libprintutils.a
$(TARGET_LIBSTDC++) $(TARGET_LIBSTDC++)
; ;
@@ -2,8 +2,7 @@ SubDir HAIKU_TOP src add-ons print drivers canon_lips lips4 ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print libprint ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers libs print libprint ] ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print utils ] ;
AddResources Canon\ LIPS4\ Compatible : Lips4.rdef ; AddResources Canon\ LIPS4\ Compatible : Lips4.rdef ;
@@ -12,8 +11,8 @@ Addon Canon\ LIPS4\ Compatible :
Lips4.cpp Lips4.cpp
Lips4Cap.cpp Lips4Cap.cpp
: :
be be
libprint.a libprint.a
libprintutils.a libprintutils.a
$(TARGET_LIBSTDC++) $(TARGET_LIBSTDC++)
; ;
+3 -4
View File
@@ -2,8 +2,7 @@ SubDir HAIKU_TOP src add-ons print drivers pcl5 ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print libprint ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers libs print libprint ] ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print utils ] ;
AddResources PCL5\ Compatible : PCL5.rsrc ; AddResources PCL5\ Compatible : PCL5.rsrc ;
@@ -12,8 +11,8 @@ Addon PCL5\ Compatible :
PCL5.cpp PCL5.cpp
PCL5Cap.cpp PCL5Cap.cpp
: :
be be
libprint.a libprint.a
libprintutils.a libprintutils.a
$(TARGET_LIBSTDC++) $(TARGET_LIBSTDC++)
; ;
+3 -4
View File
@@ -2,8 +2,7 @@ SubDir HAIKU_TOP src add-ons print drivers pcl6 ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print libprint ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers libs print libprint ] ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print utils ] ;
AddResources PCL6\ Compatible : PCL6.rsrc ; AddResources PCL6\ Compatible : PCL6.rsrc ;
@@ -16,8 +15,8 @@ Addon PCL6\ Compatible :
PCL6Writer.cpp PCL6Writer.cpp
Rasterizer.cpp Rasterizer.cpp
: :
be be
libprint.a libprint.a
libprintutils.a libprintutils.a
$(TARGET_LIBSTDC++) $(TARGET_LIBSTDC++)
; ;
+1 -2
View File
@@ -2,8 +2,7 @@ SubDir HAIKU_TOP src add-ons print drivers pdf source ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print ] ; UsePrivateHeaders print ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print utils ] ;
SubDirHdrs [ FDirName $(HAIKU_TOP) src libs pdflib libs pdflib ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) src libs pdflib libs pdflib ] ;
AddResources PDF\ Writer : AddResources PDF\ Writer :
+3 -4
View File
@@ -2,8 +2,7 @@ SubDir HAIKU_TOP src add-ons print drivers postscript ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print libprint ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) headers libs print libprint ] ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print utils ] ;
AddResources PS\ Compatible : PS.rsrc ; AddResources PS\ Compatible : PS.rsrc ;
@@ -12,8 +11,8 @@ Addon PS\ Compatible :
PS.cpp PS.cpp
PSCap.cpp PSCap.cpp
: :
be be
libprint.a libprint.a
libprintutils.a libprintutils.a
$(TARGET_LIBSTDC++) $(TARGET_LIBSTDC++)
; ;
+1 -4
View File
@@ -2,10 +2,7 @@ SubDir HAIKU_TOP src add-ons print drivers preview ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print ] ; UsePrivateHeaders print ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print utils ] ;
UsePrivateHeaders interface ;
AddResources Preview : Preview.rsrc ; AddResources Preview : Preview.rsrc ;
-4
View File
@@ -1,4 +0,0 @@
SubDir HAIKU_TOP src add-ons print drivers shared ;
SubInclude HAIKU_TOP src add-ons print drivers shared utils ;
SubInclude HAIKU_TOP src add-ons print drivers shared libprint ;
@@ -1,12 +0,0 @@
SubDir HAIKU_TOP src add-ons print drivers shared utils ;
SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print utils ] ;
StaticLibrary libprintutils.a :
InterfaceUtils.cpp
MarginView.cpp
Utils.cpp
;
-32
View File
@@ -1,32 +0,0 @@
SubDir HAIKU_TOP src add-ons print shared ;
SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders interface print ;
StaticLibrary
libprintutils.a
:
PicturePrinter.cpp
PrintJobReader.cpp
PictureIterator.cpp
PrintTransport.cpp
;
# StaticLibrary
# libprinttransportaddon.a
# :
# PrintTransportAddOn.cpp
# ;
Objects
PrintTransportAddOn.cpp
;
#StaticLibrary
# libprinterdriveraddon.a
# :
# PrinterDriverAddOn.cpp
# ;
@@ -2,17 +2,15 @@ SubDir HAIKU_TOP src add-ons print transports parallel_port ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders print ;
SubDirHdrs [ FDirName $(HAIKU_TOP) src add-ons print transports shared ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) src add-ons print transports shared ] ;
UsePrivateHeaders interface print ;
Addon Parallel\ Port : Addon Parallel\ Port :
ParallelTransport.cpp ParallelTransport.cpp
PrintTransportAddOn.o : be libprintutils.a
: be
; ;
ObjectReferences <src!add-ons!print!shared>PrintTransportAddOn.o ;
Package haiku-printingkit-cvs : Package haiku-printingkit-cvs :
Parallel\ Port : Parallel\ Port :
boot home config add-ons Print transport ; boot home config add-ons Print transport ;
@@ -2,17 +2,15 @@ SubDir HAIKU_TOP src add-ons print transports serial_port ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders print ;
SubDirHdrs [ FDirName $(HAIKU_TOP) src add-ons print transports shared ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) src add-ons print transports shared ] ;
UsePrivateHeaders interface print ;
Addon Serial\ Port : Addon Serial\ Port :
SerialTransport.cpp SerialTransport.cpp
PrintTransportAddOn.o : be libprintutils.a
: be
; ;
ObjectReferences <src!add-ons!print!shared>PrintTransportAddOn.o ;
Package haiku-printingkit-cvs : Package haiku-printingkit-cvs :
Serial\ Port : Serial\ Port :
boot home config add-ons Print transport ; boot home config add-ons Print transport ;
@@ -2,17 +2,15 @@ SubDir HAIKU_TOP src add-ons print transports usb_port ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders print ;
SubDirHdrs [ FDirName $(HAIKU_TOP) src add-ons print transports shared ] ; SubDirHdrs [ FDirName $(HAIKU_TOP) src add-ons print transports shared ] ;
UsePrivateHeaders interface print ;
Addon USB\ Port : Addon USB\ Port :
USBTransport.cpp USBTransport.cpp
PrintTransportAddOn.o : be libprintutils.a
: be
; ;
ObjectReferences <src!add-ons!print!shared>PrintTransportAddOn.o ;
Package haiku-printingkit-cvs : Package haiku-printingkit-cvs :
USB\ Port : USB\ Port :
boot home config add-ons Print transport ; boot home config add-ons Print transport ;
+1
View File
@@ -94,6 +94,7 @@ SubInclude HAIKU_TOP src kits midi ;
SubInclude HAIKU_TOP src kits midi2 ; SubInclude HAIKU_TOP src kits midi2 ;
SubInclude HAIKU_TOP src kits network ; SubInclude HAIKU_TOP src kits network ;
SubInclude HAIKU_TOP src kits opengl ; SubInclude HAIKU_TOP src kits opengl ;
SubInclude HAIKU_TOP src kits print ;
SubInclude HAIKU_TOP src kits screensaver ; SubInclude HAIKU_TOP src kits screensaver ;
SubInclude HAIKU_TOP src kits shared ; SubInclude HAIKU_TOP src kits shared ;
SubInclude HAIKU_TOP src kits storage ; SubInclude HAIKU_TOP src kits storage ;
+1 -1
View File
@@ -25,7 +25,7 @@ if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
SetSubDirSupportedPlatforms haiku libbe_test ; SetSubDirSupportedPlatforms haiku libbe_test ;
UsePrivateHeaders app input interface shared tracker ; UsePrivateHeaders app input print interface shared tracker ;
UseLibraryHeaders icon png zlib ; UseLibraryHeaders icon png zlib ;
+20
View File
@@ -0,0 +1,20 @@
SubDir HAIKU_TOP src kits print ;
SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders shared print ;
StaticLibrary libprintutils.a :
BeUtils.cpp
BeUtilsTranslation.cpp
FolderWatcher.cpp
InterfaceUtils.cpp
Jobs.cpp
MarginView.cpp
PrintJobReader.cpp
PicturePrinter.cpp
PrintTransport.cpp
PictureIterator.cpp
PrintTransportAddOn.cpp
Utils.cpp
;
+1
View File
@@ -16,6 +16,7 @@ SubInclude HAIKU_TOP src libs lp_solve ;
SubInclude HAIKU_TOP src libs ncurses ; SubInclude HAIKU_TOP src libs ncurses ;
SubInclude HAIKU_TOP src libs pdflib ; SubInclude HAIKU_TOP src libs pdflib ;
SubInclude HAIKU_TOP src libs png ; SubInclude HAIKU_TOP src libs png ;
SubInclude HAIKU_TOP src libs print ;
SubInclude HAIKU_TOP src libs stdc++ ; SubInclude HAIKU_TOP src libs stdc++ ;
SubInclude HAIKU_TOP src libs termcap ; SubInclude HAIKU_TOP src libs termcap ;
SubInclude HAIKU_TOP src libs util ; SubInclude HAIKU_TOP src libs util ;
+3
View File
@@ -0,0 +1,3 @@
SubDir HAIKU_TOP src libs print ;
SubInclude HAIKU_TOP src libs print libprint ;
@@ -1,110 +1,110 @@
/* /*
* AboutBox.cpp * AboutBox.cpp
* Copyright 1999-2000 Y.Takagi. All Rights Reserved. * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
*/ */
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include <Window.h> #include <Window.h>
#include <View.h> #include <View.h>
#include <Button.h> #include <Button.h>
#include "AboutBox.h" #include "AboutBox.h"
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE)) #if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
using namespace std; using namespace std;
#else #else
#define std #define std
#endif #endif
enum { enum {
kMsgOK = 'AbOK' kMsgOK = 'AbOK'
}; };
class AboutBoxView : public BView { class AboutBoxView : public BView {
public: public:
AboutBoxView(BRect frame, const char *driver_name, const char *version, const char *copyright); AboutBoxView(BRect frame, const char *driver_name, const char *version, const char *copyright);
virtual void Draw(BRect); virtual void Draw(BRect);
virtual void AttachedToWindow(); virtual void AttachedToWindow();
private: private:
string fDriverName; string fDriverName;
string fVersion; string fVersion;
string fCopyright; string fCopyright;
}; };
AboutBoxView::AboutBoxView(BRect rect, const char *driver_name, const char *version, const char *copyright) AboutBoxView::AboutBoxView(BRect rect, const char *driver_name, const char *version, const char *copyright)
: BView(rect, "", B_FOLLOW_ALL, B_WILL_DRAW) : BView(rect, "", B_FOLLOW_ALL, B_WILL_DRAW)
{ {
fDriverName = driver_name; fDriverName = driver_name;
fVersion = version; fVersion = version;
fCopyright = copyright; fCopyright = copyright;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetDrawingMode(B_OP_SELECT); SetDrawingMode(B_OP_SELECT);
} }
void AboutBoxView::Draw(BRect) void AboutBoxView::Draw(BRect)
{ {
SetHighColor(0, 0, 0); SetHighColor(0, 0, 0);
DrawString(fDriverName.c_str(), BPoint(10.0f, 16.0f)); DrawString(fDriverName.c_str(), BPoint(10.0f, 16.0f));
DrawString(" Driver for "); DrawString(" Driver for ");
SetHighColor(0, 0, 0xff); SetHighColor(0, 0, 0xff);
DrawString("B"); DrawString("B");
SetHighColor(0xff, 0, 0); SetHighColor(0xff, 0, 0);
DrawString("e"); DrawString("e");
SetHighColor(0, 0, 0); SetHighColor(0, 0, 0);
DrawString("OS Version "); DrawString("OS Version ");
DrawString(fVersion.c_str()); DrawString(fVersion.c_str());
DrawString(fCopyright.c_str(), BPoint(10.0f, 30.0f)); DrawString(fCopyright.c_str(), BPoint(10.0f, 30.0f));
} }
void AboutBoxView::AttachedToWindow() void AboutBoxView::AttachedToWindow()
{ {
BRect rect; BRect rect;
rect.Set(110, 50, 175, 55); rect.Set(110, 50, 175, 55);
BButton *button = new BButton(rect, "", "OK", new BMessage(kMsgOK)); BButton *button = new BButton(rect, "", "OK", new BMessage(kMsgOK));
AddChild(button); AddChild(button);
button->MakeDefault(true); button->MakeDefault(true);
} }
class AboutBoxWindow : public BWindow { class AboutBoxWindow : public BWindow {
public: public:
AboutBoxWindow(BRect frame, const char *driver_name, const char *version, const char *copyright); AboutBoxWindow(BRect frame, const char *driver_name, const char *version, const char *copyright);
virtual void MessageReceived(BMessage *msg); virtual void MessageReceived(BMessage *msg);
virtual bool QuitRequested(); virtual bool QuitRequested();
}; };
AboutBoxWindow::AboutBoxWindow(BRect frame, const char *driver_name, const char *version, const char *copyright) AboutBoxWindow::AboutBoxWindow(BRect frame, const char *driver_name, const char *version, const char *copyright)
: BWindow(frame, "", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE ) : BWindow(frame, "", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE )
{ {
char title[256]; char title[256];
sprintf(title, "About %s Driver", driver_name); sprintf(title, "About %s Driver", driver_name);
SetTitle(title); SetTitle(title);
AddChild(new AboutBoxView(Bounds(), driver_name, version, copyright)); AddChild(new AboutBoxView(Bounds(), driver_name, version, copyright));
} }
void AboutBoxWindow::MessageReceived(BMessage *msg) void AboutBoxWindow::MessageReceived(BMessage *msg)
{ {
switch (msg->what) { switch (msg->what) {
case kMsgOK: case kMsgOK:
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
break; break;
} }
} }
bool AboutBoxWindow::QuitRequested() bool AboutBoxWindow::QuitRequested()
{ {
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
return true; return true;
} }
AboutBox::AboutBox(const char *signature, const char *driver_name, const char *version, const char *copyright) AboutBox::AboutBox(const char *signature, const char *driver_name, const char *version, const char *copyright)
: BApplication(signature) : BApplication(signature)
{ {
BRect rect; BRect rect;
rect.Set(100, 80, 400, 170); rect.Set(100, 80, 400, 170);
AboutBoxWindow *window = new AboutBoxWindow(rect, driver_name, version, copyright); AboutBoxWindow *window = new AboutBoxWindow(rect, driver_name, version, copyright);
window->Show(); window->Show();
} }
@@ -1,13 +1,9 @@
SubDir HAIKU_TOP src add-ons print drivers shared libprint ; SubDir HAIKU_TOP src libs print libprint ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print libprint ] ; UsePrivateHeaders print ;
SubDirHdrs [ FDirName $(HAIKU_TOP) headers libs print libprint ] ;
# for BeUtils.h
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print ] ;
# for Utils.h, InterfaceUtils.h
SubDirHdrs [ FDirName $(HAIKU_TOP) headers private print utils ] ;
StaticLibrary libprint.a : StaticLibrary libprint.a :
AboutBox.cpp AboutBox.cpp
@@ -1,120 +1,120 @@
/* /*
* Transport.cpp * Transport.cpp
* Copyright 1999-2000 Y.Takagi. All Rights Reserved. * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
*/ */
#include <FindDirectory.h> #include <FindDirectory.h>
#include <Message.h> #include <Message.h>
#include <Directory.h> #include <Directory.h>
#include <DataIO.h> #include <DataIO.h>
#include <File.h> #include <File.h>
#include <Path.h> #include <Path.h>
#include <image.h> #include <image.h>
#include "Transport.h" #include "Transport.h"
#include "PrinterData.h" #include "PrinterData.h"
#include "DbgMsg.h" #include "DbgMsg.h"
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE)) #if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
using namespace std; using namespace std;
#else #else
#define std #define std
#endif #endif
Transport::Transport(const PrinterData *printer_data) Transport::Transport(const PrinterData *printer_data)
: fImage(-1), fInitTransport(0), fExitTransport(0), fDataStream(0), fAbort(false) : fImage(-1), fInitTransport(0), fExitTransport(0), fDataStream(0), fAbort(false)
{ {
BPath path; BPath path;
if (B_OK == find_directory(B_USER_ADDONS_DIRECTORY, &path)) { if (B_OK == find_directory(B_USER_ADDONS_DIRECTORY, &path)) {
path.Append("Print/transport"); path.Append("Print/transport");
path.Append(printer_data->getTransport().c_str()); path.Append(printer_data->getTransport().c_str());
DBGMSG(("load_add_on: %s\n", path.Path())); DBGMSG(("load_add_on: %s\n", path.Path()));
fImage = load_add_on(path.Path()); fImage = load_add_on(path.Path());
} }
if (fImage < 0) { if (fImage < 0) {
if (B_OK == find_directory(B_BEOS_ADDONS_DIRECTORY, &path)) { if (B_OK == find_directory(B_BEOS_ADDONS_DIRECTORY, &path)) {
path.Append("Print/transport"); path.Append("Print/transport");
path.Append(printer_data->getTransport().c_str()); path.Append(printer_data->getTransport().c_str());
DBGMSG(("load_add_on: %s\n", path.Path())); DBGMSG(("load_add_on: %s\n", path.Path()));
fImage = load_add_on(path.Path()); fImage = load_add_on(path.Path());
} }
} }
if (fImage < 0) { if (fImage < 0) {
set_last_error("cannot load a transport add-on"); set_last_error("cannot load a transport add-on");
return; return;
} }
DBGMSG(("image id = %d\n", (int)fImage)); DBGMSG(("image id = %d\n", (int)fImage));
get_image_symbol(fImage, "init_transport", B_SYMBOL_TYPE_TEXT, (void **)&fInitTransport); get_image_symbol(fImage, "init_transport", B_SYMBOL_TYPE_TEXT, (void **)&fInitTransport);
get_image_symbol(fImage, "exit_transport", B_SYMBOL_TYPE_TEXT, (void **)&fExitTransport); get_image_symbol(fImage, "exit_transport", B_SYMBOL_TYPE_TEXT, (void **)&fExitTransport);
if (fInitTransport == NULL) { if (fInitTransport == NULL) {
set_last_error("get_image_symbol failed."); set_last_error("get_image_symbol failed.");
DBGMSG(("init_transport is NULL\n")); DBGMSG(("init_transport is NULL\n"));
} }
if (fExitTransport == NULL) { if (fExitTransport == NULL) {
set_last_error("get_image_symbol failed."); set_last_error("get_image_symbol failed.");
DBGMSG(("exit_transport is NULL\n")); DBGMSG(("exit_transport is NULL\n"));
} }
if (fInitTransport) { if (fInitTransport) {
string spool_path; string spool_path;
printer_data->getPath(spool_path); printer_data->getPath(spool_path);
BMessage *msg = new BMessage('TRIN'); BMessage *msg = new BMessage('TRIN');
msg->AddString("printer_file", spool_path.c_str()); msg->AddString("printer_file", spool_path.c_str());
fDataStream = (*fInitTransport)(msg); fDataStream = (*fInitTransport)(msg);
delete msg; delete msg;
if (fDataStream == 0) { if (fDataStream == 0) {
set_last_error("init_transport failed."); set_last_error("init_transport failed.");
} }
} }
} }
Transport::~Transport() Transport::~Transport()
{ {
if (fExitTransport) { if (fExitTransport) {
(*fExitTransport)(); (*fExitTransport)();
} }
if (fImage >= 0) { if (fImage >= 0) {
unload_add_on(fImage); unload_add_on(fImage);
} }
} }
bool Transport::check_abort() const bool Transport::check_abort() const
{ {
return fDataStream == 0; return fDataStream == 0;
} }
const string &Transport::last_error() const const string &Transport::last_error() const
{ {
return fLastErrorString; return fLastErrorString;
} }
bool Transport::is_print_to_file_canceled() const bool Transport::is_print_to_file_canceled() const
{ {
// The BeOS "Print To File" transport add-on returns a non-NULL BDataIO * // The BeOS "Print To File" transport add-on returns a non-NULL BDataIO *
// even after user filepanel cancellation! // even after user filepanel cancellation!
BFile* file = dynamic_cast<BFile*>(fDataStream); BFile* file = dynamic_cast<BFile*>(fDataStream);
return file != NULL && file->InitCheck() != B_OK; return file != NULL && file->InitCheck() != B_OK;
} }
void Transport::set_last_error(const char *e) void Transport::set_last_error(const char *e)
{ {
fLastErrorString = e; fLastErrorString = e;
fAbort = true; fAbort = true;
} }
void Transport::write(const void *buffer, size_t size) throw(TransportException) void Transport::write(const void *buffer, size_t size) throw(TransportException)
{ {
if (fDataStream) { if (fDataStream) {
if (size == (size_t)fDataStream->Write(buffer, size)) { if (size == (size_t)fDataStream->Write(buffer, size)) {
return; return;
} }
set_last_error("BDataIO::Write failed."); set_last_error("BDataIO::Write failed.");
} }
throw TransportException(last_error()); throw TransportException(last_error());
} }
@@ -1,90 +1,90 @@
/* /*
* make_pattern.cpp * make_pattern.cpp
* Copyright 2000 Y.Takagi All Rights Reserved. * Copyright 2000 Y.Takagi All Rights Reserved.
*/ */
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
using namespace std; using namespace std;
#define MAX_HORTZ 4 #define MAX_HORTZ 4
#define MAX_VERT 4 #define MAX_VERT 4
#define MAX_ELEMENT (MAX_HORTZ * MAX_VERT) #define MAX_ELEMENT (MAX_HORTZ * MAX_VERT)
#include "original_dither_pattern.h" #include "original_dither_pattern.h"
void create_index_table(const unsigned char *p1, unsigned char *p2) void create_index_table(const unsigned char *p1, unsigned char *p2)
{ {
for (int i = 0 ; i < MAX_ELEMENT ; i++) { for (int i = 0 ; i < MAX_ELEMENT ; i++) {
p2[*p1] = i; p2[*p1] = i;
p1++; p1++;
} }
} }
inline int index2horz(int index) inline int index2horz(int index)
{ {
return index % MAX_HORTZ; return index % MAX_HORTZ;
} }
inline int index2vert(int index) inline int index2vert(int index)
{ {
return index / MAX_HORTZ; return index / MAX_HORTZ;
} }
void create_pattern16x16(const unsigned char *pattern4x4, unsigned char *pattern16x16) void create_pattern16x16(const unsigned char *pattern4x4, unsigned char *pattern16x16)
{ {
unsigned char value2index[MAX_ELEMENT]; unsigned char value2index[MAX_ELEMENT];
create_index_table(pattern4x4, value2index); create_index_table(pattern4x4, value2index);
for (int i = 0 ; i < MAX_ELEMENT ; i++) { for (int i = 0 ; i < MAX_ELEMENT ; i++) {
int index = value2index[i]; int index = value2index[i];
int h = index2horz(index); int h = index2horz(index);
int v = index2vert(index); int v = index2vert(index);
for (int j = 0 ; j < MAX_ELEMENT ; j++) { for (int j = 0 ; j < MAX_ELEMENT ; j++) {
int index2 = value2index[j]; int index2 = value2index[j];
int h2 = index2horz(index2) * 4 + h; int h2 = index2horz(index2) * 4 + h;
int v2 = index2vert(index2) * 4 + v; int v2 = index2vert(index2) * 4 + v;
pattern16x16[h2 + v2 * MAX_ELEMENT] = j + i * MAX_ELEMENT; pattern16x16[h2 + v2 * MAX_ELEMENT] = j + i * MAX_ELEMENT;
} }
} }
} }
void print_pattern(ostream &os, const char *name, const unsigned char *pattern) void print_pattern(ostream &os, const char *name, const unsigned char *pattern)
{ {
os << "const unsigned char " << name << "[] = {" << '\n' << '\t'; os << "const unsigned char " << name << "[] = {" << '\n' << '\t';
for (int i = 0 ; i < 256 ; i++) { for (int i = 0 ; i < 256 ; i++) {
os << setw(3) << (int)pattern[i]; os << setw(3) << (int)pattern[i];
if (i == MAX_ELEMENT * MAX_ELEMENT - 1) { if (i == MAX_ELEMENT * MAX_ELEMENT - 1) {
os << '\n'; os << '\n';
} else { } else {
os << ','; os << ',';
if (i % MAX_ELEMENT == MAX_ELEMENT - 1) { if (i % MAX_ELEMENT == MAX_ELEMENT - 1) {
os << '\n' << '\t'; os << '\n' << '\t';
} }
} }
} }
os << "};" << '\n'; os << "};" << '\n';
} }
int main() int main()
{ {
unsigned char pattern16x16_type1[MAX_ELEMENT * MAX_ELEMENT]; unsigned char pattern16x16_type1[MAX_ELEMENT * MAX_ELEMENT];
create_pattern16x16(pattern4x4_type1, pattern16x16_type1); create_pattern16x16(pattern4x4_type1, pattern16x16_type1);
print_pattern(cout, "pattern16x16_type1", pattern16x16_type1); print_pattern(cout, "pattern16x16_type1", pattern16x16_type1);
cout << endl; cout << endl;
unsigned char pattern16x16_type2[MAX_ELEMENT * MAX_ELEMENT]; unsigned char pattern16x16_type2[MAX_ELEMENT * MAX_ELEMENT];
create_pattern16x16(pattern4x4_type2, pattern16x16_type2); create_pattern16x16(pattern4x4_type2, pattern16x16_type2);
print_pattern(cout, "pattern16x16_type2", pattern16x16_type2); print_pattern(cout, "pattern16x16_type2", pattern16x16_type2);
cout << endl; cout << endl;
unsigned char pattern16x16_type3[MAX_ELEMENT * MAX_ELEMENT]; unsigned char pattern16x16_type3[MAX_ELEMENT * MAX_ELEMENT];
create_pattern16x16(pattern4x4_type3, pattern16x16_type3); create_pattern16x16(pattern4x4_type3, pattern16x16_type3);
print_pattern(cout, "pattern16x16_type3", pattern16x16_type3); print_pattern(cout, "pattern16x16_type3", pattern16x16_type3);
cout << endl; cout << endl;
return 0; return 0;
} }
@@ -1,24 +1,24 @@
/* /*
* These patterns are defined referring to Japanese Monthly C Magazine (May 2000 Vol.12 No.5). * These patterns are defined referring to Japanese Monthly C Magazine (May 2000 Vol.12 No.5).
*/ */
const unsigned char pattern4x4_type1[MAX_ELEMENT] = { const unsigned char pattern4x4_type1[MAX_ELEMENT] = {
0, 8, 2, 10, 0, 8, 2, 10,
12, 4, 14, 6, 12, 4, 14, 6,
3, 11, 1, 9, 3, 11, 1, 9,
15, 7, 13, 5 15, 7, 13, 5
}; };
const unsigned char pattern4x4_type2[MAX_ELEMENT] = { const unsigned char pattern4x4_type2[MAX_ELEMENT] = {
9, 8, 7, 6, 9, 8, 7, 6,
10, 1, 0, 5, 10, 1, 0, 5,
11, 2, 3, 4, 11, 2, 3, 4,
12, 13, 14, 15 12, 13, 14, 15
}; };
const unsigned char pattern4x4_type3[MAX_ELEMENT] = { const unsigned char pattern4x4_type3[MAX_ELEMENT] = {
0, 2, 14, 12, 0, 2, 14, 12,
8, 10, 5, 7, 8, 10, 5, 7,
15, 13, 1, 3, 15, 13, 1, 3,
4, 6, 9, 11 4, 6, 9, 11
}; };
+1 -1
View File
@@ -2,7 +2,7 @@ SubDir HAIKU_TOP src preferences print ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders interface shared print ; UsePrivateHeaders shared print ;
Preference Printers : Preference Printers :
AddPrinterDialog.cpp AddPrinterDialog.cpp
+7 -18
View File
@@ -2,22 +2,13 @@ SubDir HAIKU_TOP src servers print ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
SubInclude HAIKU_TOP src servers print shared ; UsePrivateHeaders shared print ;
SubDir HAIKU_TOP src servers print ; AddResources print_server :
UsePrivateHeaders shared interface print ;
UsePrivateHeaders print ;
AddResources
print_server
:
print_server.rdef print_server.rdef
; ;
Server Server print_server :
print_server
:
PrintServerApp.cpp PrintServerApp.cpp
PrintServerApp.R5.cpp PrintServerApp.R5.cpp
PrintServerApp.Scripting.cpp PrintServerApp.Scripting.cpp
@@ -28,16 +19,14 @@ Server
ResourceManager.cpp ResourceManager.cpp
Settings.cpp Settings.cpp
ConfigWindow.cpp ConfigWindow.cpp
; ;
LinkAgainst LinkAgainst print_server :
print_server
:
be be
root root
translation translation
libprintutils.a libprintutils.a
; ;
Package haiku-printingkit-cvs : Package haiku-printingkit-cvs :
print_server : print_server :
-14
View File
@@ -1,14 +0,0 @@
SubDir HAIKU_TOP src servers print shared ;
SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders shared interface print ;
StaticLibrary
libprintutils.a
:
BeUtils.cpp
BeUtilsTranslation.cpp
FolderWatcher.cpp
Jobs.cpp
;