virtual void DoDrawLines(int n, wxPoint points[],
- wxCoord xoffset, wxCoord yoffset) = 0;
+ wxCoord xoffset, wxCoord yoffset ) = 0;
+ virtual void DrawLines(const wxPointList *list,
+ wxCoord xoffset, wxCoord yoffset );
+
virtual void DoDrawPolygon(int n, wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
int fillStyle = wxODDEVEN_RULE) = 0;
virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
int fillStyle);
-
+ void DrawPolygon(const wxPointList *list,
+ wxCoord xoffset, wxCoord yoffset,
+ int fillStyle );
#if wxUSE_SPLINES
virtual void DoDrawSpline(const wxPointList *points);
#endif
+ // ---------------------------------------------------------
+ // wxMemoryDC Impl API
+
+ virtual void DoSelect(const wxBitmap& WXUNUSED(bmp))
+ { }
+
+ virtual const wxBitmap& GetSelectedBitmap() const
+ { return wxNullBitmap; }
+ virtual wxBitmap& GetSelectedBitmap()
+ { return wxNullBitmap; }
+
+ // ---------------------------------------------------------
+ // wxPrinterDC Impl API
+
+ virtual wxRect GetPaperRect()
+ { int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); }
+
+ virtual int GetResolution()
+ { return -1; }
+
private:
wxDC *m_owner;
wxSize GetPPI() const
{ return m_pimpl->GetPPI(); }
+ virtual int GetResolution()
+ { return m_pimpl->GetResolution(); }
+
// Right-To-Left (RTL) modes
void SetLayoutDirection(wxLayoutDirection dir)
void DrawLines(int n, wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0)
{ m_pimpl->DoDrawLines(n, points, xoffset, yoffset); }
-
-#if 0
- // needs to be removed
void DrawLines(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0)
-#endif
+ { m_pimpl->DrawLines( list, xoffset, yoffset ); }
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( void DrawLines(const wxList *list,
+ wxCoord xoffset = 0, wxCoord yoffset = 0) );
+#endif // WXWIN_COMPATIBILITY_2_8
void DrawPolygon(int n, wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
-
-#if 0
- // needs to be removed
void DrawPolygon(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); }
-#endif
-
void DrawPolyPolygon(int n, int count[], wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); }
+#if WXWIN_COMPATIBILITY_2_8
+ wxDEPRECATED( void DrawPolygon(const wxList *list,
+ wxCoord xoffset = 0, wxCoord yoffset = 0,
+ int fillStyle = wxODDEVEN_RULE) );
+#endif // WXWIN_COMPATIBILITY_2_8
void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{ m_pimpl->DoDrawRectangle(x, y, width, height); }
// Resolution in Pixels per inch
virtual wxSize GetPPI() const = 0;
+ virtual int GetResolution()
+ { return -1; }
+
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const { return m_ok; }
// wxMemoryDC
//-----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxMemoryImplDCBase
-{
-public:
- wxMemoryImplDCBase() { }
-
- virtual void DoSelect(const wxBitmap& bmp) = 0;
-
- virtual const wxBitmap& DoGetSelectedBitmap() const = 0;
- virtual wxBitmap& DoGetSelectedBitmap() = 0;
-};
-
-
class WXDLLIMPEXP_CORE wxMemoryDC: public wxDC
{
public:
// wxPrinterDC
//-----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxPrinterImplDCBase
-{
-public:
- wxPrinterImplDCBase() { }
-
- virtual wxRect DoGetPaperRect() = 0;
-};
-
-
class WXDLLIMPEXP_CORE wxPrinterDC: public wxDC
{
public:
+ wxPrinterDC();
wxPrinterDC( const wxPrintData& data );
wxRect GetPaperRect();
+ int GetResolution();
+
+private:
+ DECLARE_DYNAMIC_CLASS()
};
#else
public:
wxScreenDC();
+ static bool StartDrawingOnTop(wxWindow * WXUNUSED(window))
+ { return true; }
+ static bool StartDrawingOnTop(wxRect * WXUNUSED(rect) = NULL)
+ { return true; }
+ static bool EndDrawingOnTop()
+ { return true; }
+
private:
DECLARE_DYNAMIC_CLASS(wxScreenDC)
};
#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
#include "wx/dc.h"
+#include "wx/dcprint.h"
#include "wx/dialog.h"
#include "wx/module.h"
#include "wx/cmndata.h"
// wxPostScriptDC
//-----------------------------------------------------------------------------
-class WXDLLEXPORT wxPostScriptDC: public wxDC
+
+#if wxUSE_NEW_DC
+
+class WXDLLEXPORT wxPostScriptDC : public wxDC
+{
+public:
+ wxPostScriptDC();
+
+ // Recommended constructor
+ wxPostScriptDC(const wxPrintData& printData);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
+};
+
+#endif
+
+#if wxUSE_NEW_DC
+class WXDLLEXPORT wxPostScriptImplDC : public wxImplDC
+#else
+#define wxPostScriptImplDC wxPostScriptDC
+class WXDLLEXPORT wxPostScriptDC : public wxDC
+#endif
{
public:
+#if wxUSE_NEW_DC
+ wxPostScriptImplDC( wxPrinterDC *owner );
+ wxPostScriptImplDC( wxPrinterDC *owner, const wxPrintData& data );
+ wxPostScriptImplDC( wxPostScriptDC *owner );
+ wxPostScriptImplDC( wxPostScriptDC *owner, const wxPrintData& data );
+#else
wxPostScriptDC();
// Recommended constructor
wxPostScriptDC(const wxPrintData& printData);
+#endif
- virtual ~wxPostScriptDC();
+ void Init();
+
+ virtual ~wxPostScriptImplDC();
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const;
virtual int GetDepth() const { return 24; }
- static void SetResolution(int ppi);
- static int GetResolution();
-
void PsPrint( const wxString& psdata );
-
-private:
+
+ // Overrridden for wxPrinterDC Impl
+
+ virtual int GetResolution();
+ virtual wxRect GetPaperRect();
protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES
void DoDrawSpline(const wxPointList *points);
-#endif // wxUSE_SPLINES
+#endif
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
double m_pageHeight;
private:
- DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
+ DECLARE_DYNAMIC_CLASS(wxPostScriptImplDC)
};
#endif
#if wxUSE_NEW_DC
-class WXDLLIMPEXP_CORE wxGTKMemoryImplDC : public wxGTKWindowImplDC, public wxMemoryImplDCBase
+class WXDLLIMPEXP_CORE wxGTKMemoryImplDC : public wxGTKWindowImplDC
#else
#define wxGTKMemoryImplDC wxMemoryDC
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase
virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col );
- // implementation
- wxBitmap GetSelectedBitmap() const { return m_selected; }
-
protected:
// overridden from wxImplDC
virtual void DoGetSize( int *width, int *height ) const;
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const;
- // overridden from wxMemoryImplDCBase
+ // overridden for wxMemoryDC Impl
virtual void DoSelect(const wxBitmap& bitmap);
- virtual const wxBitmap& DoGetSelectedBitmap() const;
- virtual wxBitmap& DoGetSelectedBitmap();
+public:
+ virtual const wxBitmap& GetSelectedBitmap() const;
+ virtual wxBitmap& GetSelectedBitmap();
+
+private:
wxBitmap m_selected;
private:
virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
wxPageSetupDialogData * data = NULL );
+#if wxUSE_NEW_DC
+ virtual wxImplDC* CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
+#else
virtual wxDC* CreatePrinterDC( const wxPrintData& data );
+#endif
virtual bool HasPrintSetupDialog();
virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
// wxGnomePrinterDC
//-----------------------------------------------------------------------------
-class wxGnomePrinterDC: public wxDC
+#if wxUSE_NEW_DC
+class wxGnomePrinterImplDC : public wxImplDC
+#else
+#define wxGnomePrinterImplDC wxGnomePrinterDC
+class wxGnomePrinterDC : public wxDC
+#endif
{
public:
+#if wxUSE_NEW_DC
+ wxGnomePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
+#else
wxGnomePrinterDC( const wxPrintData& data );
- virtual ~wxGnomePrinterDC();
+#endif
+ virtual ~wxGnomePrinterImplDC();
bool Ok() const { return IsOk(); }
bool IsOk() const;
virtual int GetDepth() const { return 24; }
void SetBackgroundMode(int WXUNUSED(mode)) { }
void SetPalette(const wxPalette& WXUNUSED(palette)) { }
- static void SetResolution(int ppi);
- static int GetResolution();
protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
void SetPrintData(const wxPrintData& data);
wxPrintData& GetPrintData() { return m_printData; }
+ // overriden for wxPrinterDC Impl
+ virtual wxRect GetPaperRect();
+ virtual int GetResolution();
+
private:
wxPrintData m_printData;
PangoContext *m_context;
void makeEllipticalPath(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
private:
- DECLARE_DYNAMIC_CLASS(wxGnomePrinterDC)
- DECLARE_NO_COPY_CLASS(wxGnomePrinterDC)
+ DECLARE_DYNAMIC_CLASS(wxGnomePrinterImplDC)
+ DECLARE_NO_COPY_CLASS(wxGnomePrinterImplDC)
};
// ----------------------------------------------------------------------------
virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
wxPageSetupDialogData * data = NULL );
+#if wxUSE_NEW_DC
+ virtual wxImplDC* CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
+#else
virtual wxDC* CreatePrinterDC( const wxPrintData& data );
+#endif
virtual bool HasPrintSetupDialog();
virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
// wxGtkPrinterDC
//-----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxGtkPrinterDC: public wxDC
+#if wxUSE_NEW_DC
+class WXDLLIMPEXP_CORE wxGtkPrinterImplDC : public wxImplDC
+#else
+#define wxGtkPrinterImplDC wxGtkPrinterDC
+class WXDLLIMPEXP_CORE wxGtkPrinterDC : public wxDC
+#endif
{
public:
+#if wxUSE_NEW_DC
+ wxGtkPrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
+#else
wxGtkPrinterDC( const wxPrintData& data );
- virtual ~wxGtkPrinterDC();
+#endif
+ virtual ~wxGtkPrinterImplDC();
bool Ok() const { return IsOk(); }
bool IsOk() const;
void SetBackgroundMode(int mode);
void SetPalette(const wxPalette& WXUNUSED(palette)) { }
void SetResolution(int ppi);
- int GetResolution();
+
+ // overriden for wxPrinterDC Impl
+ virtual int GetResolution();
+ virtual wxRect GetPaperRect();
protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
double m_PS2DEV;
double m_DEV2PS;
- DECLARE_DYNAMIC_CLASS(wxGtkPrinterDC)
- DECLARE_NO_COPY_CLASS(wxGtkPrinterDC)
+ DECLARE_DYNAMIC_CLASS(wxGtkPrinterImplDC)
+ DECLARE_NO_COPY_CLASS(wxGtkPrinterImplDC)
};
// ----------------------------------------------------------------------------
#include "wx/dcclient.h"
#include "wx/dcmemory.h"
#include "wx/dcscreen.h"
+#include "wx/dcprint.h"
#include "wx/dcbuffer.h" // for IMPLEMENT_DYNAMIC_CLASS
+#include "wx/prntbase.h"
#ifndef WX_PRECOMP
#include "wx/math.h"
#endif
}
-wxImpleDC *wxNativeDCFactory::CreatePrinterDC( wxPrinterDC *ownder, const wxPrintData &data )
+wxImplDC *wxNativeDCFactory::CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data )
{
-#if defined(__WXMSW__)
- return new wxWindowsPrinterImplDC( owner );
-#elif defined(__WXGTK20__)
- return new wxGTKPrinterImplDC( owner );
-#elif defined(__WXGTK__)
- return new wxGTKPrinterImplDC( owner );
-#elif defined(__WXMAC__)
- return new wxMacPrinterImplDC( owner );
-#elif defined(__WXCOCOA__)
- return new wxCocoaPrinterImplDC( owner );
-#elif defined(__WXMOTIF__)
- return new wxMotifPrinterImplDC( owner );
-#elif defined(__WXX11__)
- return new wxX11PrinterImplDC( owner );
-#elif defined(__WXMGL__)
- return new wxMGLPrinterImplDC( owner );
-#elif defined(__WXDFB__)
- return new wxDFBPrinterImplDC( owner );
-#elif defined(__WXPM__)
- return new wxPMPrinterImplDC( owner );
-#elif defined(__PALMOS__)
- return new wxPalmPrinterImplDC( owner );
-#endif
+ wxPrintFactory *factory = wxPrintFactory::GetFactory();
+ return factory->CreatePrinterImplDC( owner, data );
}
//-----------------------------------------------------------------------------
if (bmp.IsOk())
bmp.UnShare();
-#ifdef __WXGTK__
- wxGTKMemoryImplDC *mem_pimpl = wxDynamicCast( m_pimpl, wxGTKMemoryImplDC );
-#else
- // TODO
-#endif
- if (mem_pimpl)
- mem_pimpl->DoSelect(bmp);
+ GetImpl()->DoSelect(bmp);
}
void wxMemoryDC::SelectObjectAsSource(const wxBitmap& bmp)
{
-#ifdef __WXGTK__
- wxGTKMemoryImplDC *mem_pimpl = wxDynamicCast( m_pimpl, wxGTKMemoryImplDC );
-#else
- // TODO
-#endif
- mem_pimpl->DoSelect(bmp);
+ GetImpl()->DoSelect(bmp);
}
const wxBitmap& wxMemoryDC::GetSelectedBitmap() const
{
-#ifdef __WXGTK__
- wxGTKMemoryImplDC *mem_pimpl = wxDynamicCast( m_pimpl, wxGTKMemoryImplDC );
-#else
- // TODO
-#endif
- if (mem_pimpl)
- return mem_pimpl->DoGetSelectedBitmap();
-
- return wxNullBitmap;
+ return GetImpl()->GetSelectedBitmap();
}
wxBitmap& wxMemoryDC::GetSelectedBitmap()
{
-#ifdef __WXGTK__
- wxGTKMemoryImplDC *mem_pimpl = wxDynamicCast( m_pimpl, wxGTKMemoryImplDC );
-#else
- // TODO
-#endif
-
- if (mem_pimpl)
- return mem_pimpl->DoGetSelectedBitmap();
-
- return wxNullBitmap;
+ return GetImpl()->GetSelectedBitmap();
}
m_pimpl = factory->CreateScreenDC( this );
}
+//-----------------------------------------------------------------------------
+// wxPrinterDC
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxPrinterDC, wxDC)
+
+wxPrinterDC::wxPrinterDC()
+{
+ wxDCFactory *factory = wxDCFactory::GetFactory();
+ // m_pimpl = factory->CreatePrinterDC( this, data );
+}
+
+wxPrinterDC::wxPrinterDC( const wxPrintData &data )
+{
+ wxDCFactory *factory = wxDCFactory::GetFactory();
+ m_pimpl = factory->CreatePrinterDC( this, data );
+}
+
//-----------------------------------------------------------------------------
// wxImplDC
//-----------------------------------------------------------------------------
heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
wxString curLine;
- for ( const wxChar *pc = text; ; pc++ )
+ for ( wxString::const_iterator pc = text.begin(); ; ++pc )
{
- if ( *pc == _T('\n') || *pc == _T('\0') )
+ if ( pc == text.end() || *pc == _T('\n') )
{
if ( curLine.empty() )
{
heightTextTotal += heightLine;
}
- if ( *pc == _T('\n') )
+ if ( pc == text.end() )
{
- curLine.clear();
+ break;
}
- else
+ else // '\n'
{
- // the end of string
- break;
+ curLine.clear();
}
}
else
static void wx_spline_draw_point_array(wxDC *dc)
{
+ dc->DrawLines(&wx_spline_point_list, 0, 0 );
wxPointList::compatibility_iterator node = wx_spline_point_list.GetFirst();
while (node)
{
#endif
}
+#if wxUSE_NEW_DC
+
+wxImplDC* wxNativePrintFactory::CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data )
+{
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ return new wxWindowsPrinterDCImpl( owner, data );
+#elif defined(__WXMAC__)
+ return new wxMacPrinterDCImpl( owner, data );
+#else
+ return new wxPostScriptImplDC( owner, data );
+#endif
+}
+
+#else
+
wxDC* wxNativePrintFactory::CreatePrinterDC( const wxPrintData& data )
{
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#endif
}
+#endif
+
bool wxNativePrintFactory::HasOwnPrintToFile()
{
// Only relevant for PostScript and here the
// wxPostScriptDC
//-------------------------------------------------------------------------------
+
+#if wxUSE_NEW_DC
+
+IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
+
+wxPostScriptDC::wxPostScriptDC()
+{
+ m_pimpl = new wxPostScriptImplDC( this );
+}
+
+wxPostScriptDC::wxPostScriptDC(const wxPrintData& printData)
+{
+ m_pimpl = new wxPostScriptImplDC( this, printData );
+}
+
+#endif
+
+
// conversion
static const double RAD2DEG = 180.0 / M_PI;
#define YLOG2DEV(x) ((m_pageHeight - (double)LogicalToDeviceY(x)) * DEV2PS)
#define YLOG2DEVREL(x) ((double)(LogicalToDeviceYRel(x)) * DEV2PS)
-IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
+
+#if wxUSE_NEW_DC
+IMPLEMENT_ABSTRACT_CLASS(wxPostScriptImplDC, wxImplDC)
+#else
+IMPLEMENT_ABSTRACT_CLASS(wxPostScriptDC, wxDC)
+#endif
//-------------------------------------------------------------------------------
-void wxPostScriptDC::SetResolution(int WXUNUSED(ppi))
+#if wxUSE_NEW_DC
+wxPostScriptImplDC::wxPostScriptImplDC( wxPostScriptDC *owner ) :
+ wxImplDC( owner )
{
-}
+ Init();
-int wxPostScriptDC::GetResolution()
-{
- return DPI;
+ m_pageHeight = 842 * PS2DEV;
+
+ m_ok = true;
}
-wxPostScriptDC::wxPostScriptDC ()
+wxPostScriptImplDC::wxPostScriptImplDC( wxPostScriptDC *owner, const wxPrintData& data ) :
+ wxImplDC( owner )
{
- m_pstream = (FILE*) NULL;
-
- m_currentRed = 0;
- m_currentGreen = 0;
- m_currentBlue = 0;
+ Init();
+
+ // this calculates m_pageHeight required for
+ // taking the inverted Y axis into account
+ SetPrintData( data );
- m_pageNumber = 0;
+ m_ok = true;
+}
+#endif
- m_clipping = false;
- m_underlinePosition = 0.0;
- m_underlineThickness = 0.0;
+#if wxUSE_NEW_DC
+wxPostScriptImplDC::wxPostScriptImplDC( wxPrinterDC *owner ) :
+ wxImplDC( owner )
+#else
+wxPostScriptDC::wxPostScriptDC()
+#endif
+{
+ Init();
m_pageHeight = 842 * PS2DEV;
+
+ m_ok = true;
+}
+
+#if wxUSE_NEW_DC
+wxPostScriptImplDC::wxPostScriptImplDC( wxPrinterDC *owner, const wxPrintData& data ) :
+ wxImplDC( owner )
+#else
+wxPostScriptDC::wxPostScriptDC( const wxPrintData& data )
+#endif
+{
+ Init();
+
+ // this calculates m_pageHeight required for
+ // taking the inverted Y axis into account
+ SetPrintData( data );
+
+ m_ok = true;
}
-wxPostScriptDC::wxPostScriptDC (const wxPrintData& printData)
+void wxPostScriptImplDC::Init()
{
m_pstream = (FILE*) NULL;
m_underlinePosition = 0.0;
m_underlineThickness = 0.0;
- // this calculates m_pageHeight required for
- // taking the inverted Y axis into account
- SetPrintData( printData );
-
- m_ok = true;
}
-wxPostScriptDC::~wxPostScriptDC ()
+wxPostScriptImplDC::~wxPostScriptImplDC ()
{
if (m_pstream)
{
}
}
-bool wxPostScriptDC::IsOk() const
+bool wxPostScriptImplDC::IsOk() const
{
return m_ok;
}
-void wxPostScriptDC::DoSetClippingRegion (wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+wxRect wxPostScriptImplDC::GetPaperRect()
+{
+ int w = 0;
+ int h = 0;
+ DoGetSize( &w, &h );
+ return wxRect(0,0,w,h);
+}
+
+int wxPostScriptImplDC::GetResolution()
+{
+ return DPI;
+}
+
+void wxPostScriptImplDC::DoSetClippingRegion (wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
wxCHECK_RET( m_ok , wxT("invalid postscript dc") );
- if (m_clipping) DestroyClippingRegion();
+ if (m_clipping)
+ DestroyClippingRegion();
+#if wxUSE_NEW_DC
+ m_clipX1 = x;
+ m_clipY1 = y;
+ m_clipX2 = x + w;
+ m_clipY2 = y + h;
+#else
wxDC::DoSetClippingRegion(x, y, w, h);
+#endif
m_clipping = true;
}
-void wxPostScriptDC::DestroyClippingRegion()
+void wxPostScriptImplDC::DestroyClippingRegion()
{
wxCHECK_RET( m_ok , wxT("invalid postscript dc") );
PsPrint( "grestore\n" );
}
+#if wxUSE_NEW_DC
+ wxImplDC::DestroyClippingRegion();
+#else
wxDC::DestroyClippingRegion();
+#endif
}
-void wxPostScriptDC::Clear()
+void wxPostScriptImplDC::Clear()
{
// This should fail silently to avoid unnecessary
// asserts
- // wxFAIL_MSG( wxT("wxPostScriptDC::Clear not implemented.") );
+ // wxFAIL_MSG( wxT("wxPostScriptImplDC::Clear not implemented.") );
}
-bool wxPostScriptDC::DoFloodFill (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style))
+bool wxPostScriptImplDC::DoFloodFill (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style))
{
- wxFAIL_MSG( wxT("wxPostScriptDC::FloodFill not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptImplDC::FloodFill not implemented.") );
return false;
}
-bool wxPostScriptDC::DoGetPixel (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour * WXUNUSED(col)) const
+bool wxPostScriptImplDC::DoGetPixel (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour * WXUNUSED(col)) const
{
- wxFAIL_MSG( wxT("wxPostScriptDC::GetPixel not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptImplDC::GetPixel not implemented.") );
return false;
}
-void wxPostScriptDC::DoCrossHair (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
+void wxPostScriptImplDC::DoCrossHair (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
{
- wxFAIL_MSG( wxT("wxPostScriptDC::CrossHair not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptImplDC::CrossHair not implemented.") );
}
-void wxPostScriptDC::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+void wxPostScriptImplDC::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
CalcBoundingBox( x2, y2 );
}
-void wxPostScriptDC::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
+void wxPostScriptImplDC::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
+void wxPostScriptImplDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
if ( wxIsSameDouble(sa, ea) )
{
- DrawEllipse(x,y,w,h);
+ DoDrawEllipse(x,y,w,h);
return;
}
}
}
-void wxPostScriptDC::DoDrawPoint (wxCoord x, wxCoord y)
+void wxPostScriptImplDC::DoDrawPoint (wxCoord x, wxCoord y)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
CalcBoundingBox( x, y );
}
-void wxPostScriptDC::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
+void wxPostScriptImplDC::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptDC::DoDrawPolyPolygon (int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
+void wxPostScriptImplDC::DoDrawPolyPolygon (int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptDC::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
+void wxPostScriptImplDC::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
PsPrint( "stroke\n" );
}
-void wxPostScriptDC::DoDrawRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxPostScriptImplDC::DoDrawRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptDC::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
+void wxPostScriptImplDC::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptDC::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxPostScriptImplDC::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
+void wxPostScriptImplDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
{
- DrawBitmap( icon, x, y, true );
+ DoDrawBitmap( icon, x, y, true );
}
/* this has to be char, not wxChar */
static char hexArray[] = "0123456789ABCDEF";
-void wxPostScriptDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool WXUNUSED(useMask) )
+void wxPostScriptImplDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool WXUNUSED(useMask) )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
PsPrint( "origstate restore\n" );
}
-void wxPostScriptDC::SetFont( const wxFont& font )
+void wxPostScriptImplDC::SetFont( const wxFont& font )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
PsPrint( buffer );
}
-void wxPostScriptDC::SetPen( const wxPen& pen )
+void wxPostScriptImplDC::SetPen( const wxPen& pen )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptDC::SetBrush( const wxBrush& brush )
+void wxPostScriptImplDC::SetBrush( const wxBrush& brush )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
+void wxPostScriptImplDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
wxCoord text_w, text_h, text_descent;
- GetTextExtent(text, &text_w, &text_h, &text_descent);
+ GetOwner()->GetTextExtent(text, &text_w, &text_h, &text_descent);
int size = m_font.GetPointSize();
CalcBoundingBox( x + size * text.length() * 2/3 , y );
}
-void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord y, double angle )
+void wxPostScriptImplDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord y, double angle )
{
if ( wxIsNullDouble(angle) )
{
{
wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
wxCoord w, h;
- GetTextExtent(text, &w, &h);
+ GetOwner()->GetTextExtent(text, &w, &h);
buffer.Printf(
"gsave\n"
CalcBoundingBox( x + size * text.length() * 2/3 , y );
}
-void wxPostScriptDC::SetBackground (const wxBrush& brush)
+void wxPostScriptImplDC::SetBackground (const wxBrush& brush)
{
m_backgroundBrush = brush;
}
-void wxPostScriptDC::SetLogicalFunction (int WXUNUSED(function))
+void wxPostScriptImplDC::SetLogicalFunction (int WXUNUSED(function))
{
- wxFAIL_MSG( wxT("wxPostScriptDC::SetLogicalFunction not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptImplDC::SetLogicalFunction not implemented.") );
}
#if wxUSE_SPLINES
-void wxPostScriptDC::DoDrawSpline( const wxPointList *points )
+void wxPostScriptImplDC::DoDrawSpline( const wxPointList *points )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
#endif // wxUSE_SPLINES
-wxCoord wxPostScriptDC::GetCharWidth() const
+wxCoord wxPostScriptImplDC::GetCharWidth() const
{
// Chris Breeze: reasonable approximation using wxMODERN/Courier
return (wxCoord) (GetCharHeight() * 72.0 / 120.0);
}
-void wxPostScriptDC::SetPrintData(const wxPrintData& data)
+void wxPostScriptImplDC::SetPrintData(const wxPrintData& data)
{
m_printData = data;
#if wxUSE_NEW_DC
#else
-void wxPostScriptDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
+void wxPostScriptImplDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
wxDCBase::SetAxisOrientation(xLeftRight,yBottomUp);
}
-void wxPostScriptDC::SetMapMode(int mode)
+void wxPostScriptImplDC::SetMapMode(int mode)
{
wxDCBase::SetMapMode(mode);
}
-void wxPostScriptDC::SetUserScale(double x, double y)
+void wxPostScriptImplDC::SetUserScale(double x, double y)
{
wxDCBase::SetUserScale(x,y);
}
-void wxPostScriptDC::SetLogicalScale(double x, double y)
+void wxPostScriptImplDC::SetLogicalScale(double x, double y)
{
wxDCBase::SetLogicalScale(x,y);
}
-void wxPostScriptDC::SetLogicalOrigin(wxCoord x, wxCoord y)
+void wxPostScriptImplDC::SetLogicalOrigin(wxCoord x, wxCoord y)
{
wxDCBase::SetLogicalOrigin(x,y);
}
-void wxPostScriptDC::SetDeviceOrigin(wxCoord x, wxCoord y)
+void wxPostScriptImplDC::SetDeviceOrigin(wxCoord x, wxCoord y)
{
wxDCBase::SetDeviceOrigin(x,y);
}
#endif
-void wxPostScriptDC::ComputeScaleAndOrigin()
+void wxPostScriptImplDC::ComputeScaleAndOrigin()
{
const wxRealPoint origScale(m_scaleX, m_scaleY);
}
}
-void wxPostScriptDC::DoGetSize(int* width, int* height) const
+void wxPostScriptImplDC::DoGetSize(int* width, int* height) const
{
wxPaperSize id = m_printData.GetPaperId();
*height = wxRound( h * PS2DEV );
}
-void wxPostScriptDC::DoGetSizeMM(int *width, int *height) const
+void wxPostScriptImplDC::DoGetSizeMM(int *width, int *height) const
{
wxPaperSize id = m_printData.GetPaperId();
}
// Resolution in pixels per logical inch
-wxSize wxPostScriptDC::GetPPI(void) const
+wxSize wxPostScriptImplDC::GetPPI(void) const
{
return wxSize( DPI, DPI );
}
-bool wxPostScriptDC::StartDoc( const wxString& message )
+bool wxPostScriptImplDC::StartDoc( const wxString& message )
{
wxCHECK_MSG( m_ok, false, wxT("invalid postscript dc") );
return true;
}
-void wxPostScriptDC::EndDoc ()
+void wxPostScriptImplDC::EndDoc ()
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
#endif
}
-void wxPostScriptDC::StartPage()
+void wxPostScriptImplDC::StartPage()
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
PsPrint( "90 rotate\n" );
}
-void wxPostScriptDC::EndPage ()
+void wxPostScriptImplDC::EndPage ()
{
wxCHECK_RET( m_ok , wxT("invalid postscript dc") );
PsPrint( "showpage\n" );
}
-bool wxPostScriptDC::DoBlit( wxCoord xdest, wxCoord ydest,
+bool wxPostScriptImplDC::DoBlit( wxCoord xdest, wxCoord ydest,
wxCoord fwidth, wxCoord fheight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxCHECK_MSG( source, false, wxT("invalid source dc") );
- /* blit into a bitmap */
+ // blit into a bitmap
wxBitmap bitmap( (int)fwidth, (int)fheight );
wxMemoryDC memDC;
memDC.SelectObject(bitmap);
memDC.Blit(0, 0, fwidth, fheight, source, xsrc, ysrc, rop); /* TODO: Blit transparently? */
memDC.SelectObject(wxNullBitmap);
- /* draw bitmap. scaling and positioning is done there */
- DrawBitmap( bitmap, xdest, ydest );
+ //draw bitmap. scaling and positioning is done there
+ GetOwner()->DrawBitmap( bitmap, xdest, ydest );
return true;
}
-wxCoord wxPostScriptDC::GetCharHeight() const
+wxCoord wxPostScriptImplDC::GetCharHeight() const
{
if (m_font.Ok())
return m_font.GetPointSize();
return 12;
}
-void wxPostScriptDC::PsPrint( const wxString& str )
+void wxPostScriptImplDC::PsPrint( const wxString& str )
{
const wxCharBuffer psdata(str.utf8_str());
}
}
-void wxPostScriptDC::DoGetTextExtent(const wxString& string,
+void wxPostScriptImplDC::DoGetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent, wxCoord *externalLeading,
const wxFont *theFont ) const
}
// May have pressed cancel.
- if (!dc || !dc->Ok())
+ if (!dc || !dc->IsOk())
{
if (dc) delete dc;
sm_lastError = wxPRINTER_ERROR;
printout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()),
(int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) );
- printout->SetPPIPrinter( wxPostScriptDC::GetResolution(),
- wxPostScriptDC::GetResolution() );
+ printout->SetPPIPrinter( dc->GetResolution(),
+ dc->GetResolution() );
// Set printout parameters
printout->SetDC(dc);
wxSize ScreenPixels = wxGetDisplaySize();
wxSize ScreenMM = wxGetDisplaySizeMM();
+ int resolution = 600; // TODO, this is correct, but get this from wxPSDC somehow
+
m_previewPrintout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()),
(int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) );
- m_previewPrintout->SetPPIPrinter(wxPostScriptDC::GetResolution(), wxPostScriptDC::GetResolution());
+ m_previewPrintout->SetPPIPrinter( resolution, resolution );
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
- sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * wxPostScriptDC::GetResolution() / 72.0);
- sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * wxPostScriptDC::GetResolution() / 72.0);
+ sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * resolution / 72.0);
+ sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * resolution / 72.0);
wxSize sizeTenthsMM(paper->GetSize());
wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
m_previewPrintout->SetPaperRectPixels(wxRect(0, 0, m_pageWidth, m_pageHeight));
// At 100%, the page should look about page-size on the screen.
- m_previewScaleX = (float)0.8 * 72.0 / (float)wxPostScriptDC::GetResolution();
+ m_previewScaleX = (float)0.8 * 72.0 / (float)resolution;
m_previewScaleY = m_previewScaleX;
}
}
{
wxRect renderrect( rect.x, rect.y, rect.width, rect.height );
wxWindowDC* dc = (wxWindowDC*) cell->GetDC();
+#if wxUSE_NEW_DC
+ wxGTKWindowImplDC *impldc = (wxGTKWindowImplDC *) dc->GetImpl();
+ if (impldc->m_window == NULL)
+ {
+ impldc->m_window = window;
+ impldc->SetUpDC();
+ }
+#else
if (dc->m_window == NULL)
{
dc->m_window = window;
dc->SetUpDC();
}
+#endif
int state = 0;
if (flags & GTK_CELL_RENDERER_SELECTED)
public:
wxDataViewCtrlDC( wxDataViewCtrl *window )
{
+#if wxUSE_NEW_DC
+ wxGTKWindowImplDC *impl = (wxGTKWindowImplDC*) GetImpl();
+
+ GtkWidget *widget = window->m_treeview;
+ // Set later
+ impl->m_window = NULL;
+
+ impl->m_context = window->GtkGetPangoDefaultContext();
+ impl->m_layout = pango_layout_new( impl->m_context );
+ impl->m_fontdesc = pango_font_description_copy( widget->style->font_desc );
+
+ impl->m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
+
+#else
GtkWidget *widget = window->m_treeview;
// Set later
m_window = NULL;
m_fontdesc = pango_font_description_copy( widget->style->font_desc );
m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
-
+#endif
// Set m_window later
// SetUpDC();
// m_owner = window;
wxCoord xx, yy, ww, hh;
m_currentClippingRegion.GetBox( xx, yy, ww, hh );
#if wxUSE_NEW_DC
- wxImplDC::DoSetClippingRegion( xx, yy, ww, hh );
+ wxGTKImplDC::DoSetClippingRegion( xx, yy, ww, hh );
#else
wxDC::DoSetClippingRegion( xx, yy, ww, hh );
#endif
wxCoord xx, yy, ww, hh;
m_currentClippingRegion.GetBox( xx, yy, ww, hh );
#if wxUSE_NEW_DC
- wxImplDC::DoSetClippingRegion( xx, yy, ww, hh );
+ wxGTKImplDC::DoSetClippingRegion( xx, yy, ww, hh );
#else
wxDC::DoSetClippingRegion( xx, yy, ww, hh );
#endif
return subrect ? bmp.GetSubBitmap(*subrect) : bmp;
}
-const wxBitmap& wxGTKMemoryImplDC::DoGetSelectedBitmap() const
+const wxBitmap& wxGTKMemoryImplDC::GetSelectedBitmap() const
{
return m_selected;
}
-wxBitmap& wxGTKMemoryImplDC::DoGetSelectedBitmap()
+wxBitmap& wxGTKMemoryImplDC::GetSelectedBitmap()
{
return m_selected;
}
return NULL;
}
+#if wxUSE_NEW_DC
+
+wxImplDC* wxGtkPrintFactory::CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data )
+{
+ return new wxGtkPrinterImplDC( owner, data );
+}
+
+#else
+
wxDC* wxGtkPrintFactory::CreatePrinterDC( const wxPrintData& data )
{
return new wxGtkPrinterDC(data);
}
+#endif
+
bool wxGtkPrintFactory::HasOwnPrintToFile()
{
return true;
SetPrintContext(context);
native->SetPrintContext( context );
+#if wxUSE_NEW_DC
+ wxPrinterDC *printDC = new wxPrinterDC( printdata );
+#else
wxGtkPrinterDC *printDC = new wxGtkPrinterDC( printdata );
+#endif
m_dc = printDC;
if (!m_dc->IsOk())
}
m_printDialogData = dialog.GetPrintDialogData();
+
+#if wxUSE_NEW_DC
+ return new wxPrinterDC( m_printDialogData.GetPrintData() );
+#else
return new wxGtkPrinterDC( m_printDialogData.GetPrintData() );
+#endif
}
bool wxGtkPrinter::Setup( wxWindow * WXUNUSED(parent) )
#define YLOG2DEV(x) ((double)(LogicalToDeviceY(x)) * m_DEV2PS)
#define YLOG2DEVREL(x) ((double)(LogicalToDeviceYRel(x)) * m_DEV2PS)
-IMPLEMENT_CLASS(wxGtkPrinterDC, wxDC)
+#if wxUSE_NEW_DC
+IMPLEMENT_ABSTRACT_CLASS(wxGtkPrinterImplDC, wxImplDC)
+#else
+IMPLEMENT_ABSTRACT_CLASS(wxGtkPrinterDC, wxDC)
+#endif
+
+#if wxUSE_NEW_DC
+wxGtkPrinterImplDC::wxGtkPrinterImplDC( wxPrinterDC *owner, const wxPrintData& data ) :
+ wxImplDC( owner )
+#else
wxGtkPrinterDC::wxGtkPrinterDC( const wxPrintData& data )
+#endif
{
m_printData = data;
gs_cairo->cairo_translate(m_cairo, -ml, -mt);
}
-wxGtkPrinterDC::~wxGtkPrinterDC()
+wxGtkPrinterImplDC::~wxGtkPrinterImplDC()
{
g_object_unref(m_context);
g_object_unref(m_layout);
}
-bool wxGtkPrinterDC::IsOk() const
+bool wxGtkPrinterImplDC::IsOk() const
{
return m_gpc != NULL;
}
-bool wxGtkPrinterDC::DoFloodFill(wxCoord WXUNUSED(x1),
+bool wxGtkPrinterImplDC::DoFloodFill(wxCoord WXUNUSED(x1),
wxCoord WXUNUSED(y1),
const wxColour& WXUNUSED(col),
int WXUNUSED(style))
return false;
}
-void wxGtkPrinterDC::DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter)
+void wxGtkPrinterImplDC::DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter)
{
wxCoord xC = circleCenter.x;
wxCoord yC = circleCenter.y;
CalcBoundingBox(xR+w, yR+h);
}
-void wxGtkPrinterDC::DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection)
+void wxGtkPrinterImplDC::DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection)
{
wxCoord x = rect.x;
wxCoord y = rect.y;
CalcBoundingBox(x+w, y+h);
}
-bool wxGtkPrinterDC::DoGetPixel(wxCoord WXUNUSED(x1),
+bool wxGtkPrinterImplDC::DoGetPixel(wxCoord WXUNUSED(x1),
wxCoord WXUNUSED(y1),
wxColour * WXUNUSED(col)) const
{
return false;
}
-void wxGtkPrinterDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+void wxGtkPrinterImplDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
if (m_pen.GetStyle() == wxTRANSPARENT) return;
CalcBoundingBox( x2, y2 );
}
-void wxGtkPrinterDC::DoCrossHair(wxCoord x, wxCoord y)
+void wxGtkPrinterImplDC::DoCrossHair(wxCoord x, wxCoord y)
{
int w, h;
DoGetSize(&w, &h);
CalcBoundingBox( w, h );
}
-void wxGtkPrinterDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc)
+void wxGtkPrinterImplDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc)
{
double dx = x1 - xc;
double dy = y1 - yc;
CalcBoundingBox (x2, y2);
}
-void wxGtkPrinterDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
+void wxGtkPrinterImplDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
{
gs_cairo->cairo_save( m_cairo );
CalcBoundingBox( x+w, y+h );
}
-void wxGtkPrinterDC::DoDrawPoint(wxCoord x, wxCoord y)
+void wxGtkPrinterImplDC::DoDrawPoint(wxCoord x, wxCoord y)
{
if (m_pen.GetStyle() == wxTRANSPARENT) return;
CalcBoundingBox( x, y );
}
-void wxGtkPrinterDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
+void wxGtkPrinterImplDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
{
if (m_pen.GetStyle() == wxTRANSPARENT) return;
gs_cairo->cairo_stroke ( m_cairo);
}
-void wxGtkPrinterDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
+void wxGtkPrinterImplDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
{
if (n==0) return;
gs_cairo->cairo_restore(m_cairo);
}
-void wxGtkPrinterDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
+void wxGtkPrinterImplDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
{
+#if wxUSE_NEW_DC
+ wxImplDC::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );
+#else
wxDC::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );
+#endif
}
-void wxGtkPrinterDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxGtkPrinterImplDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
width--;
height--;
CalcBoundingBox( x + width, y + height );
}
-void wxGtkPrinterDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
+void wxGtkPrinterImplDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
{
width--;
height--;
CalcBoundingBox(x+width,y+height);
}
-void wxGtkPrinterDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxGtkPrinterImplDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
width--;
height--;
}
#if wxUSE_SPLINES
-void wxGtkPrinterDC::DoDrawSpline(const wxPointList *points)
+void wxGtkPrinterImplDC::DoDrawSpline(const wxPointList *points)
{
SetPen (m_pen);
}
#endif // wxUSE_SPLINES
-bool wxGtkPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest,
+bool wxGtkPrinterImplDC::DoBlit(wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop, bool useMask,
memDC.SelectObject(wxNullBitmap);
// Draw bitmap. scaling and positioning is done there.
- DrawBitmap( bitmap, xdest, ydest, useMask );
+ GetOwner()->DrawBitmap( bitmap, xdest, ydest, useMask );
return true;
}
-void wxGtkPrinterDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
+void wxGtkPrinterImplDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
{
DoDrawBitmap( icon, x, y, true );
}
-void wxGtkPrinterDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask )
+void wxGtkPrinterImplDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask )
{
- wxCHECK_RET( bitmap.IsOk(), wxT("Invalid bitmap in wxGtkPrinterDC::DoDrawBitmap"));
+ wxCHECK_RET( bitmap.IsOk(), wxT("Invalid bitmap in wxGtkPrinterImplDC::DoDrawBitmap"));
cairo_surface_t* surface;
x = wxCoord(XLOG2DEV(x));
gs_cairo->cairo_restore(m_cairo);
}
-void wxGtkPrinterDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y )
+void wxGtkPrinterImplDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y )
{
DoDrawRotatedText( text, x, y, 0.0 );
}
-void wxGtkPrinterDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
+void wxGtkPrinterImplDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
{
double xx = XLOG2DEV(x);
double yy = YLOG2DEV(y);
CalcBoundingBox (x + w, y + h);
}
-void wxGtkPrinterDC::Clear()
+void wxGtkPrinterImplDC::Clear()
{
// Clear does nothing for printing, but keep the code
// for later reuse
*/
}
-void wxGtkPrinterDC::SetFont( const wxFont& font )
+void wxGtkPrinterImplDC::SetFont( const wxFont& font )
{
m_font = font;
}
}
-void wxGtkPrinterDC::SetPen( const wxPen& pen )
+void wxGtkPrinterImplDC::SetPen( const wxPen& pen )
{
if (!pen.Ok()) return;
}
}
-void wxGtkPrinterDC::SetBrush( const wxBrush& brush )
+void wxGtkPrinterImplDC::SetBrush( const wxBrush& brush )
{
if (!brush.Ok()) return;
}
}
-void wxGtkPrinterDC::SetLogicalFunction( int function )
+void wxGtkPrinterImplDC::SetLogicalFunction( int function )
{
if (function == wxCLEAR)
gs_cairo->cairo_set_operator (m_cairo, CAIRO_OPERATOR_CLEAR);
gs_cairo->cairo_set_operator (m_cairo, CAIRO_OPERATOR_SOURCE);
}
-void wxGtkPrinterDC::SetBackground( const wxBrush& brush )
+void wxGtkPrinterImplDC::SetBackground( const wxBrush& brush )
{
m_backgroundBrush = brush;
gs_cairo->cairo_save(m_cairo);
gs_cairo->cairo_restore(m_cairo);
}
-void wxGtkPrinterDC::SetBackgroundMode(int mode)
+void wxGtkPrinterImplDC::SetBackgroundMode(int mode)
{
if (mode == wxSOLID)
m_backgroundMode = wxSOLID;
m_backgroundMode = wxTRANSPARENT;
}
-void wxGtkPrinterDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxGtkPrinterImplDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
gs_cairo->cairo_rectangle ( m_cairo, XLOG2DEV(x), YLOG2DEV(y), XLOG2DEVREL(width), YLOG2DEVREL(height));
gs_cairo->cairo_clip(m_cairo);
}
-void wxGtkPrinterDC::DestroyClippingRegion()
+void wxGtkPrinterImplDC::DestroyClippingRegion()
{
gs_cairo->cairo_reset_clip(m_cairo);
}
-bool wxGtkPrinterDC::StartDoc(const wxString& WXUNUSED(message))
+bool wxGtkPrinterImplDC::StartDoc(const wxString& WXUNUSED(message))
{
return true;
}
-void wxGtkPrinterDC::EndDoc()
+void wxGtkPrinterImplDC::EndDoc()
{
return;
}
-void wxGtkPrinterDC::StartPage()
+void wxGtkPrinterImplDC::StartPage()
{
return;
}
-void wxGtkPrinterDC::EndPage()
+void wxGtkPrinterImplDC::EndPage()
{
return;
}
-wxCoord wxGtkPrinterDC::GetCharHeight() const
+wxCoord wxGtkPrinterImplDC::GetCharHeight() const
{
pango_layout_set_text( m_layout, "H", 1 );
return wxRound( h * m_PS2DEV );
}
-wxCoord wxGtkPrinterDC::GetCharWidth() const
+wxCoord wxGtkPrinterImplDC::GetCharWidth() const
{
pango_layout_set_text( m_layout, "H", 1 );
return wxRound( w * m_PS2DEV );
}
-void wxGtkPrinterDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height,
+void wxGtkPrinterImplDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height,
wxCoord *descent,
wxCoord *externalLeading,
const wxFont *theFont ) const
pango_layout_set_font_description( m_layout, m_fontdesc );
}
-void wxGtkPrinterDC::DoGetSize(int* width, int* height) const
+void wxGtkPrinterImplDC::DoGetSize(int* width, int* height) const
{
GtkPageSetup *setup = gtk_print_context_get_page_setup( m_gpc );
*height = wxRound( gtk_page_setup_get_paper_height( setup, GTK_UNIT_POINTS ) * m_PS2DEV );
}
-void wxGtkPrinterDC::DoGetSizeMM(int *width, int *height) const
+void wxGtkPrinterImplDC::DoGetSizeMM(int *width, int *height) const
{
GtkPageSetup *setup = gtk_print_context_get_page_setup( m_gpc );
*height = wxRound( gtk_page_setup_get_paper_height( setup, GTK_UNIT_MM ) );
}
-wxSize wxGtkPrinterDC::GetPPI() const
+wxSize wxGtkPrinterImplDC::GetPPI() const
{
return wxSize( (int)m_resolution, (int)m_resolution );
}
-void wxGtkPrinterDC::SetPrintData(const wxPrintData& data)
+void wxGtkPrinterImplDC::SetPrintData(const wxPrintData& data)
{
m_printData = data;
}
-void wxGtkPrinterDC::SetResolution(int WXUNUSED(ppi))
+// overriden for wxPrinterDC Impl
+
+wxRect wxGtkPrinterImplDC::GetPaperRect()
{
- // We can't change ppi of the GtkPrintContext.
- // TODO: should we really support this?
+ // Does GtkPrint support printer margins?
+ int w = 0;
+ int h = 0;
+ DoGetSize( &w, &h );
+ return wxRect( 0,0,w,h );
}
-int wxGtkPrinterDC::GetResolution()
+int wxGtkPrinterImplDC::GetResolution()
{
return m_resolution;
}