1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-01-22 06:06:20 -05:00
|
|
|
// Name: dcps.h
|
1998-05-20 10:01:55 -04:00
|
|
|
// Purpose: wxPostScriptDC class
|
|
|
|
// Author: Julian Smart and others
|
|
|
|
// Modified by:
|
|
|
|
// RCS-ID: $Id$
|
1999-01-22 06:06:20 -05:00
|
|
|
// Copyright: (c) Julian Smart, Robert Roebling and Markus Holzem
|
1998-11-29 17:21:32 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
#ifndef _WX_DCPSG_H_
|
|
|
|
#define _WX_DCPSG_H_
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-01-22 06:06:20 -05:00
|
|
|
#pragma interface
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/dc.h"
|
|
|
|
|
1999-06-15 16:21:59 -04:00
|
|
|
#if wxUSE_PRINTING_ARCHITECTURE
|
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#if wxUSE_POSTSCRIPT
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
#include "wx/dialog.h"
|
|
|
|
#include "wx/module.h"
|
1999-03-25 18:06:01 -05:00
|
|
|
#include "wx/cmndata.h"
|
1998-10-12 03:46:15 -04:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
1998-12-05 16:53:51 -05:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
class wxPostScriptDC;
|
1998-12-05 16:53:51 -05:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxPostScriptDC
|
|
|
|
//-----------------------------------------------------------------------------
|
1998-12-05 16:53:51 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
class WXDLLEXPORT wxPostScriptDC: public wxDC
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
|
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
public:
|
|
|
|
|
1998-11-29 17:21:32 -05:00
|
|
|
wxPostScriptDC();
|
1999-03-25 18:06:01 -05:00
|
|
|
|
|
|
|
// Deprecated constructor
|
1998-08-22 23:22:56 -04:00
|
|
|
wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-25 18:06:01 -05:00
|
|
|
// Recommended constructor
|
|
|
|
wxPostScriptDC(const wxPrintData& printData);
|
|
|
|
|
1998-11-29 17:21:32 -05:00
|
|
|
~wxPostScriptDC();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-25 18:06:01 -05:00
|
|
|
// Deprecated
|
1998-08-22 23:22:56 -04:00
|
|
|
bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
virtual bool Ok() const;
|
|
|
|
|
1999-03-25 18:06:01 -05:00
|
|
|
// Deprecated: use wxGenericPrintDialog instead
|
1998-08-22 23:22:56 -04:00
|
|
|
virtual bool PrinterDialog(wxWindow *parent = (wxWindow *) NULL);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
virtual void BeginDrawing() {}
|
|
|
|
virtual void EndDrawing() {}
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
|
|
|
|
bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
|
|
|
|
|
|
|
|
void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
|
|
|
|
void DoCrossHair(wxCoord x, wxCoord y) ;
|
|
|
|
void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
|
|
|
|
void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
|
|
|
|
void DoDrawPoint(wxCoord x, wxCoord y);
|
|
|
|
void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
|
|
|
|
void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
|
|
|
|
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
|
|
|
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
|
|
|
|
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
1999-05-14 16:27:41 -04:00
|
|
|
|
|
|
|
void DoDrawSpline(wxList *points);
|
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|
|
|
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = FALSE);
|
|
|
|
bool CanDrawBitmap() const { return TRUE; }
|
1999-01-22 06:06:20 -05:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
|
|
|
|
void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask=FALSE );
|
1999-01-22 06:06:20 -05:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
|
1999-12-06 04:35:27 -05:00
|
|
|
void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1998-11-29 17:21:32 -05:00
|
|
|
void Clear();
|
1999-01-22 06:06:20 -05:00
|
|
|
void SetFont( const wxFont& font );
|
|
|
|
void SetPen( const wxPen& pen );
|
|
|
|
void SetBrush( const wxBrush& brush );
|
|
|
|
void SetLogicalFunction( int function );
|
|
|
|
void SetBackground( const wxBrush& brush );
|
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
1998-11-29 17:21:32 -05:00
|
|
|
void DestroyClippingRegion();
|
1999-06-08 15:10:37 -04:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) { }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
bool StartDoc(const wxString& message);
|
1998-11-29 17:21:32 -05:00
|
|
|
void EndDoc();
|
|
|
|
void StartPage();
|
|
|
|
void EndPage();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord GetCharHeight() const;
|
|
|
|
wxCoord GetCharWidth() const;
|
1999-11-03 10:32:10 -05:00
|
|
|
bool CanGetTextExtent() const { return TRUE; }
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
|
|
|
|
wxCoord *descent = (wxCoord *) NULL,
|
|
|
|
wxCoord *externalLeading = (wxCoord *) NULL,
|
1999-05-14 16:27:41 -04:00
|
|
|
wxFont *theFont = (wxFont *) NULL ) const;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-05-15 19:40:42 -04:00
|
|
|
void DoGetSize(int* width, int* height) const;
|
|
|
|
void DoGetSizeMM(int *width, int *height) const;
|
1999-03-25 18:06:01 -05:00
|
|
|
|
|
|
|
// Resolution in pixels per logical inch
|
1999-10-18 11:14:52 -04:00
|
|
|
wxSize GetPPI() const;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
|
1999-10-18 11:14:52 -04:00
|
|
|
void SetDeviceOrigin( wxCoord x, wxCoord y );
|
1999-01-22 06:06:20 -05:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void SetBackgroundMode(int WXUNUSED(mode)) { }
|
|
|
|
void SetPalette(const wxPalette& WXUNUSED(palette)) { }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
wxPrintData& GetPrintData() { return m_printData; }
|
|
|
|
void SetPrintData(const wxPrintData& data) { m_printData = data; }
|
|
|
|
|
|
|
|
virtual int GetDepth() const { return 24; }
|
2000-08-03 17:43:30 -04:00
|
|
|
|
|
|
|
static void SetResolution(int ppi);
|
|
|
|
static int GetResolution();
|
|
|
|
|
|
|
|
private:
|
|
|
|
static float ms_PSScaleFactor;
|
1999-03-25 18:06:01 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
protected:
|
1999-01-22 06:06:20 -05:00
|
|
|
|
1999-06-21 07:27:53 -04:00
|
|
|
FILE* m_pstream; // PostScript output stream
|
1998-05-20 10:01:55 -04:00
|
|
|
wxString m_title;
|
|
|
|
unsigned char m_currentRed;
|
|
|
|
unsigned char m_currentGreen;
|
|
|
|
unsigned char m_currentBlue;
|
1999-01-22 06:06:20 -05:00
|
|
|
int m_pageNumber;
|
|
|
|
bool m_clipping;
|
|
|
|
double m_underlinePosition;
|
|
|
|
double m_underlineThickness;
|
1999-03-25 18:06:01 -05:00
|
|
|
wxPrintData m_printData;
|
1999-01-22 06:06:20 -05:00
|
|
|
};
|
|
|
|
|
1999-03-25 18:06:01 -05:00
|
|
|
// Deprecated: should use wxGenericPrintDialog instead.
|
1999-01-22 06:06:20 -05:00
|
|
|
#if 1
|
1999-10-18 11:14:52 -04:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
wxID_PRINTER_COMMAND = 1,
|
|
|
|
wxID_PRINTER_OPTIONS,
|
|
|
|
wxID_PRINTER_ORIENTATION,
|
|
|
|
wxID_PRINTER_MODES,
|
|
|
|
wxID_PRINTER_X_SCALE,
|
|
|
|
wxID_PRINTER_Y_SCALE,
|
|
|
|
wxID_PRINTER_X_TRANS,
|
|
|
|
wxID_PRINTER_Y_TRANS
|
|
|
|
};
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxPostScriptPrintDialog: public wxDialog
|
|
|
|
{
|
|
|
|
DECLARE_CLASS(wxPostScriptPrintDialog)
|
|
|
|
public:
|
|
|
|
wxPostScriptPrintDialog (wxWindow *parent, const wxString& title,
|
1998-11-29 17:21:32 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord style = wxDEFAULT_DIALOG_STYLE);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
virtual int ShowModal();
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
1999-10-18 11:14:52 -04:00
|
|
|
#endif // 1
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
// Print Orientation (Should also add Left, Right)
|
1999-06-08 15:10:37 -04:00
|
|
|
enum
|
|
|
|
{
|
1998-05-20 10:01:55 -04:00
|
|
|
PS_PORTRAIT = 1,
|
|
|
|
PS_LANDSCAPE = 2
|
|
|
|
};// ps_orientation = PS_PORTRAIT;
|
|
|
|
|
|
|
|
// Print Actions
|
1999-06-08 15:10:37 -04:00
|
|
|
enum
|
|
|
|
{
|
1999-03-25 18:06:01 -05:00
|
|
|
PS_NONE,
|
|
|
|
PS_PREVIEW,
|
1998-05-20 10:01:55 -04:00
|
|
|
PS_FILE,
|
1999-03-25 18:06:01 -05:00
|
|
|
PS_PRINTER
|
1998-05-20 10:01:55 -04:00
|
|
|
};// ps_action = PS_PREVIEW;
|
|
|
|
|
|
|
|
// PostScript printer settings
|
1999-03-25 18:06:01 -05:00
|
|
|
WXDLLEXPORT void wxSetPrinterCommand(const wxString& cmd);
|
|
|
|
WXDLLEXPORT void wxSetPrintPreviewCommand(const wxString& cmd);
|
|
|
|
WXDLLEXPORT void wxSetPrinterOptions(const wxString& flags);
|
1998-11-22 17:32:53 -05:00
|
|
|
WXDLLEXPORT void wxSetPrinterOrientation(int orientation);
|
|
|
|
WXDLLEXPORT void wxSetPrinterScaling(double x, double y);
|
1999-10-18 11:14:52 -04:00
|
|
|
WXDLLEXPORT void wxSetPrinterTranslation(wxCoord x, wxCoord y);
|
1998-11-22 17:32:53 -05:00
|
|
|
WXDLLEXPORT void wxSetPrinterMode(int mode);
|
1999-03-25 18:06:01 -05:00
|
|
|
WXDLLEXPORT void wxSetPrinterFile(const wxString& f);
|
|
|
|
WXDLLEXPORT void wxSetAFMPath(const wxString& f);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
// Get current values
|
1999-03-25 18:06:01 -05:00
|
|
|
WXDLLEXPORT wxString wxGetPrinterCommand();
|
|
|
|
WXDLLEXPORT wxString wxGetPrintPreviewCommand();
|
|
|
|
WXDLLEXPORT wxString wxGetPrinterOptions();
|
1998-11-29 17:21:32 -05:00
|
|
|
WXDLLEXPORT int wxGetPrinterOrientation();
|
1998-11-22 17:32:53 -05:00
|
|
|
WXDLLEXPORT void wxGetPrinterScaling(double* x, double* y);
|
1999-10-18 11:14:52 -04:00
|
|
|
WXDLLEXPORT void wxGetPrinterTranslation(wxCoord *x, wxCoord *y);
|
1998-11-29 17:21:32 -05:00
|
|
|
WXDLLEXPORT int wxGetPrinterMode();
|
1999-03-25 18:06:01 -05:00
|
|
|
WXDLLEXPORT wxString wxGetPrinterFile();
|
|
|
|
WXDLLEXPORT wxString wxGetAFMPath();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
/*
|
1999-03-25 18:06:01 -05:00
|
|
|
* PostScript print setup information.
|
|
|
|
* This is now obsolete, but retained for a while for compatibility
|
1998-05-20 10:01:55 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxPrintSetupData: public wxObject
|
|
|
|
{
|
1998-11-29 17:21:32 -05:00
|
|
|
public:
|
|
|
|
wxPrintSetupData();
|
|
|
|
~wxPrintSetupData();
|
|
|
|
|
1999-03-25 18:06:01 -05:00
|
|
|
void SetPrinterCommand(const wxString& cmd) { m_printerCommand = cmd; };
|
|
|
|
void SetPaperName(const wxString& paper) { m_paperName = paper; };
|
|
|
|
void SetPrintPreviewCommand(const wxString& cmd) { m_previewCommand = cmd; };
|
|
|
|
void SetPrinterOptions(const wxString& flags) { m_printerFlags = flags; };
|
|
|
|
void SetPrinterFile(const wxString& f) { m_printerFile = f; };
|
|
|
|
void SetPrinterOrientation(int orient) { m_printerOrient = orient; };
|
|
|
|
void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; };
|
1999-10-18 11:14:52 -04:00
|
|
|
void SetPrinterTranslation(wxCoord x, wxCoord y) { m_printerTranslateX = x; m_printerTranslateY = y; };
|
1998-11-29 17:21:32 -05:00
|
|
|
// 1 = Preview, 2 = print to file, 3 = send to printer
|
1999-03-25 18:06:01 -05:00
|
|
|
void SetPrinterMode(int mode) { m_printerMode = mode; };
|
|
|
|
void SetAFMPath(const wxString& f) { m_afmPath = f; };
|
|
|
|
void SetColour(bool col) { m_printColour = col; };
|
1998-11-29 17:21:32 -05:00
|
|
|
|
|
|
|
// Get current values
|
1999-03-25 18:06:01 -05:00
|
|
|
wxString GetPrinterCommand() const { return m_printerCommand; } ;
|
|
|
|
wxString GetPrintPreviewCommand() const { return m_previewCommand; } ;
|
|
|
|
wxString GetPrinterOptions() const { return m_printerFlags; };
|
|
|
|
wxString GetPrinterFile() const { return m_printerFile; };
|
|
|
|
wxString GetPaperName() const { return m_paperName; }
|
|
|
|
int GetPrinterOrientation() const { return m_printerOrient; };
|
|
|
|
void GetPrinterScaling(double* x, double* y) const { *x = m_printerScaleX; *y = m_printerScaleY; };
|
1999-10-18 11:14:52 -04:00
|
|
|
void GetPrinterTranslation(wxCoord *x, wxCoord *y) const { *x = m_printerTranslateX; *y = m_printerTranslateY; };
|
1999-03-25 18:06:01 -05:00
|
|
|
int GetPrinterMode() const { return m_printerMode; };
|
|
|
|
wxString GetAFMPath() const { return m_afmPath; };
|
|
|
|
bool GetColour() const { return m_printColour; };
|
1998-11-29 17:21:32 -05:00
|
|
|
|
|
|
|
void operator=(wxPrintSetupData& data);
|
|
|
|
|
1999-03-25 18:06:01 -05:00
|
|
|
// Initialize from a wxPrintData object (wxPrintData should now be used instead of wxPrintSetupData).
|
|
|
|
// There is also an operator for initializing a wxPrintData from a wxPrintSetupData.
|
|
|
|
void operator=(const wxPrintData& data);
|
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
#ifndef __WIN16__
|
|
|
|
void GetPrinterTranslation(long *x, long *y) const
|
|
|
|
{ *x = m_printerTranslateX; *y = m_printerTranslateY; }
|
|
|
|
#endif // !Win16
|
|
|
|
|
1999-03-25 18:06:01 -05:00
|
|
|
public:
|
|
|
|
wxString m_printerCommand;
|
|
|
|
wxString m_previewCommand;
|
|
|
|
wxString m_printerFlags;
|
|
|
|
wxString m_printerFile;
|
|
|
|
int m_printerOrient;
|
|
|
|
double m_printerScaleX;
|
|
|
|
double m_printerScaleY;
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord m_printerTranslateX;
|
|
|
|
wxCoord m_printerTranslateY;
|
1999-03-25 18:06:01 -05:00
|
|
|
// 1 = Preview, 2 = print to file, 3 = send to printer
|
|
|
|
int m_printerMode;
|
|
|
|
wxString m_afmPath;
|
|
|
|
// A name in the paper database (see paper.h)
|
|
|
|
wxString m_paperName;
|
|
|
|
bool m_printColour;
|
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPrintSetupData)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
1998-11-22 17:32:53 -05:00
|
|
|
WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData;
|
|
|
|
WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = TRUE);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
#endif
|
|
|
|
// wxUSE_POSTSCRIPT
|
1999-10-18 11:14:52 -04:00
|
|
|
|
1999-06-15 16:21:59 -04:00
|
|
|
#endif
|
|
|
|
// wxUSE_PRINTING_ARCHITECTURE
|
1998-12-05 16:02:04 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
1999-01-22 06:06:20 -05:00
|
|
|
// _WX_DCPSG_H_
|