diff --git a/include/wx/msw/dc.h b/include/wx/msw/dc.h index 8851693235..067cda1bbb 100644 --- a/include/wx/msw/dc.h +++ b/include/wx/msw/dc.h @@ -16,6 +16,58 @@ #pragma interface "dc.h" #endif +// --------------------------------------------------------------------------- +// macros +// --------------------------------------------------------------------------- + +// Logical to device +// Absolute +#define XLOG2DEV(x) (x) +#define YLOG2DEV(y) (y) + +// Relative +#define XLOG2DEVREL(x) (x) +#define YLOG2DEVREL(y) (y) + +// Device to logical +// Absolute +#define XDEV2LOG(x) (x) + +#define YDEV2LOG(y) (y) + +// Relative +#define XDEV2LOGREL(x) (x) +#define YDEV2LOGREL(y) (y) + +/* + * Have the same macros as for XView but not for every operation: + * just for calculating window/viewport extent (a better way of scaling). + */ + +// Logical to device +// Absolute +#define MS_XLOG2DEV(x) LogicalToDevice(x) + +#define MS_YLOG2DEV(y) LogicalToDevice(y) + +// Relative +#define MS_XLOG2DEVREL(x) LogicalToDeviceXRel(x) +#define MS_YLOG2DEVREL(y) LogicalToDeviceYRel(y) + +// Device to logical +// Absolute +#define MS_XDEV2LOG(x) DeviceToLogicalX(x) + +#define MS_YDEV2LOG(y) DeviceToLogicalY(y) + +// Relative +#define MS_XDEV2LOGREL(x) DeviceToLogicalXRel(x) +#define MS_YDEV2LOGREL(y) DeviceToLogicalYRel(y) + +#define YSCALE(y) (yorigin - (y)) + +#define wx_round(a) (int)((a)+.5) + class WXDLLEXPORT wxDC : public wxDCBase { DECLARE_DYNAMIC_CLASS(wxDC) diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 769fe92497..3a0608b9e9 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -29,6 +29,7 @@ #if wxUSE_POSTSCRIPT +#include "wx/window.h" #include "wx/dcmemory.h" #include "wx/utils.h" #include "wx/intl.h" @@ -250,7 +251,10 @@ wxPostScriptDC::wxPostScriptDC () m_signY = -1; // default y-axis bottom up -> top down // Compatibility only + // HH: Doesn't seem to work for wxMSW... + #ifndef __WXMSW__ m_printData = * wxThePrintSetupData; + #endif } wxPostScriptDC::wxPostScriptDC (const wxString& file, bool interactive, wxWindow *parent) @@ -1003,7 +1007,11 @@ void wxPostScriptDC::SetFont( const wxFont& font ) fprintf( m_pstream, " reencodeISO def\n" ); fprintf( m_pstream, buffer ); fprintf( m_pstream, " findfont\n" ); + #ifdef __WXMSW__ + fprintf( m_pstream, "%d scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize()) ); + #else fprintf( m_pstream, "%ld scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize()) ); + #endif } void wxPostScriptDC::SetPen( const wxPen& pen ) @@ -1016,8 +1024,11 @@ void wxPostScriptDC::SetPen( const wxPen& pen ) m_pen = pen; + #ifdef __WXMSW__ + fprintf( m_pstream, "%d setlinewidth\n", XLOG2DEVREL(m_pen.GetWidth()) ); + #else fprintf( m_pstream, "%ld setlinewidth\n", XLOG2DEVREL(m_pen.GetWidth()) ); - + #endif /* Line style - WRONG: 2nd arg is OFFSET @@ -1997,7 +2008,7 @@ void wxPostScriptDC::GetTextExtent( const wxString& string, long *x, long *y, # define PS_VIEWER_PROG "ghostview" #else // Windows ghostscript/ghostview -# define PS_VIEWER_PROG NULL +# define PS_VIEWER_PROG "gsview" #endif wxPrintSetupData *wxThePrintSetupData = (wxPrintSetupData *) NULL; @@ -2369,4 +2380,4 @@ void wxPostScriptModule::OnExit() // wxUSE_POSTSCRIPT #endif - // wxUSE_PRINTING_ARCHITECTURE \ No newline at end of file + // wxUSE_PRINTING_ARCHITECTURE diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index c5c2a08b64..fa53cd8b6e 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -68,58 +68,6 @@ static const int VIEWPORT_EXTENT = 1000; static const int MM_POINTS = 9; static const int MM_METRIC = 10; -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -// Logical to device -// Absolute -#define XLOG2DEV(x) (x) -#define YLOG2DEV(y) (y) - -// Relative -#define XLOG2DEVREL(x) (x) -#define YLOG2DEVREL(y) (y) - -// Device to logical -// Absolute -#define XDEV2LOG(x) (x) - -#define YDEV2LOG(y) (y) - -// Relative -#define XDEV2LOGREL(x) (x) -#define YDEV2LOGREL(y) (y) - -/* - * Have the same macros as for XView but not for every operation: - * just for calculating window/viewport extent (a better way of scaling). - */ - -// Logical to device -// Absolute -#define MS_XLOG2DEV(x) LogicalToDevice(x) - -#define MS_YLOG2DEV(y) LogicalToDevice(y) - -// Relative -#define MS_XLOG2DEVREL(x) LogicalToDeviceXRel(x) -#define MS_YLOG2DEVREL(y) LogicalToDeviceYRel(y) - -// Device to logical -// Absolute -#define MS_XDEV2LOG(x) DeviceToLogicalX(x) - -#define MS_YDEV2LOG(y) DeviceToLogicalY(y) - -// Relative -#define MS_XDEV2LOGREL(x) DeviceToLogicalXRel(x) -#define MS_YDEV2LOGREL(y) DeviceToLogicalYRel(y) - -#define YSCALE(y) (yorigin - (y)) - -#define wx_round(a) (int)((a)+.5) - // =========================================================================== // implementation // ===========================================================================