From: Robert Roebling Date: Tue, 13 Nov 2007 13:20:15 +0000 (+0000) Subject: More DC changes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c8ddadff843cef0534220bf5561f095a59a57ea4 More DC changes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49901 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/dc.h b/include/wx/dc.h index 403fbd5157..94390e9fbf 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -41,6 +41,8 @@ class WXDLLIMPEXP_FWD_CORE wxPaintDC; class WXDLLIMPEXP_FWD_CORE wxWindowDC; class WXDLLIMPEXP_FWD_CORE wxScreenDC; class WXDLLIMPEXP_FWD_CORE wxMemoryDC; +class WXDLLIMPEXP_FWD_CORE wxPrinterDC; +#include "wx/cmndata.h" #else class WXDLLIMPEXP_FWD_CORE wxDCBase; #endif @@ -131,6 +133,7 @@ public: virtual wxImplDC* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) = 0; virtual wxImplDC* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) = 0; virtual wxImplDC* CreateScreenDC( wxScreenDC *owner ) = 0; + virtual wxImplDC* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) = 0; static void SetDCFactory( wxDCFactory *factory ); static wxDCFactory *GetFactory(); @@ -157,6 +160,7 @@ public: virtual wxImplDC* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ); virtual wxImplDC* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ); virtual wxImplDC* CreateScreenDC( wxScreenDC *owner ); + virtual wxImplDC* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ); }; //----------------------------------------------------------------------------- diff --git a/include/wx/dcprint.h b/include/wx/dcprint.h index 10936c4781..1ee323a6ff 100644 --- a/include/wx/dcprint.h +++ b/include/wx/dcprint.h @@ -16,6 +16,34 @@ #if wxUSE_PRINTING_ARCHITECTURE +#if wxUSE_NEW_DC + +#include "wx/dc.h" + +//----------------------------------------------------------------------------- +// wxPrinterDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrinterImplDCBase +{ +public: + wxPrinterImplDCBase() { } + + virtual wxRect DoGetPaperRect() = 0; +}; + + +class WXDLLIMPEXP_CORE wxPrinterDC: public wxDC +{ +public: + wxPrinterDC( const wxPrintData& data ); + + wxRect GetPaperRect(); +}; + +#else + + #if defined(__WXPALMOS__) #include "wx/palmos/dcprint.h" #elif defined(__WXMSW__) @@ -28,6 +56,7 @@ #include "wx/mac/dcprint.h" #endif +#endif // wxUSE_NEW_DC #endif // wxUSE_PRINTING_ARCHITECTURE #endif // _WX_DCPRINT_H_BASE_ diff --git a/include/wx/dcscreen.h b/include/wx/dcscreen.h index f320205b8e..31f7c36f51 100644 --- a/include/wx/dcscreen.h +++ b/include/wx/dcscreen.h @@ -52,5 +52,6 @@ private: #include "wx/os2/dcscreen.h" #endif + #endif // _WX_DCSCREEN_H_BASE_ diff --git a/include/wx/gtk/gnome/gprint.h b/include/wx/gtk/gnome/gprint.h index d4a4117ea0..4386f99305 100644 --- a/include/wx/gtk/gnome/gprint.h +++ b/include/wx/gtk/gnome/gprint.h @@ -204,14 +204,14 @@ private: }; //----------------------------------------------------------------------------- -// wxGnomePrintDC +// wxGnomePrinterDC //----------------------------------------------------------------------------- -class wxGnomePrintDC: public wxDC +class wxGnomePrinterDC: public wxDC { public: - wxGnomePrintDC( const wxPrintData& data ); - virtual ~wxGnomePrintDC(); + wxGnomePrinterDC( const wxPrintData& data ); + virtual ~wxGnomePrinterDC(); bool Ok() const { return IsOk(); } bool IsOk() const; @@ -254,7 +254,7 @@ protected: 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); @@ -292,8 +292,8 @@ private: void makeEllipticalPath(wxCoord x, wxCoord y, wxCoord width, wxCoord height); private: - DECLARE_DYNAMIC_CLASS(wxGnomePrintDC) - DECLARE_NO_COPY_CLASS(wxGnomePrintDC) + DECLARE_DYNAMIC_CLASS(wxGnomePrinterDC) + DECLARE_NO_COPY_CLASS(wxGnomePrinterDC) }; // ---------------------------------------------------------------------------- diff --git a/include/wx/gtk/print.h b/include/wx/gtk/print.h index eb4f3f7b0b..9eca6496a9 100644 --- a/include/wx/gtk/print.h +++ b/include/wx/gtk/print.h @@ -215,14 +215,14 @@ private: }; //----------------------------------------------------------------------------- -// wxGtkPrintDC +// wxGtkPrinterDC //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGtkPrintDC: public wxDC +class WXDLLIMPEXP_CORE wxGtkPrinterDC: public wxDC { public: - wxGtkPrintDC( const wxPrintData& data ); - virtual ~wxGtkPrintDC(); + wxGtkPrinterDC( const wxPrintData& data ); + virtual ~wxGtkPrinterDC(); bool Ok() const { return IsOk(); } bool IsOk() const; @@ -267,7 +267,7 @@ protected: 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); @@ -304,8 +304,8 @@ private: double m_PS2DEV; double m_DEV2PS; - DECLARE_DYNAMIC_CLASS(wxGtkPrintDC) - DECLARE_NO_COPY_CLASS(wxGtkPrintDC) + DECLARE_DYNAMIC_CLASS(wxGtkPrinterDC) + DECLARE_NO_COPY_CLASS(wxGtkPrinterDC) }; // ---------------------------------------------------------------------------- diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 6a2bc1ff6c..b04f5b7c40 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -334,6 +334,33 @@ wxImplDC* wxNativeDCFactory::CreateScreenDC( wxScreenDC *owner ) #endif } +wxImpleDC *wxNativeDCFactory::CreatePrinterDC( wxPrinterDC *ownder, 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 +} + //----------------------------------------------------------------------------- // wxWindowDC //----------------------------------------------------------------------------- diff --git a/src/gtk/gnome/gprint.cpp b/src/gtk/gnome/gprint.cpp index 51ff5f64bd..54d2c08708 100644 --- a/src/gtk/gnome/gprint.cpp +++ b/src/gtk/gnome/gprint.cpp @@ -478,7 +478,7 @@ wxGnomePrintFactory::CreatePrintSetupDialog(wxWindow * WXUNUSED(parent), wxDC* wxGnomePrintFactory::CreatePrinterDC( const wxPrintData& data ) { - return new wxGnomePrintDC(data); + return new wxGnomePrinterDC(data); } bool wxGnomePrintFactory::HasOwnPrintToFile() @@ -841,7 +841,7 @@ bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) if (prompt) dc = PrintDialog( parent ); else - dc = new wxGnomePrintDC( printdata ); + dc = new wxGnomePrinterDC( printdata ); if (m_native_preview) printout->SetIsPreview(true); @@ -860,8 +860,8 @@ bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) printout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()), (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) ); - printout->SetPPIPrinter( wxGnomePrintDC::GetResolution(), - wxGnomePrintDC::GetResolution() ); + printout->SetPPIPrinter( wxGnomePrinterDC::GetResolution(), + wxGnomePrinterDC::GetResolution() ); printout->SetDC(dc); @@ -959,7 +959,7 @@ wxDC* wxGnomePrinter::PrintDialog( wxWindow *parent ) m_native_preview = ret == wxID_PREVIEW; m_printDialogData = dialog.GetPrintDialogData(); - return new wxGnomePrintDC( m_printDialogData.GetPrintData() ); + return new wxGnomePrinterDC( m_printDialogData.GetPrintData() ); } bool wxGnomePrinter::Setup(wxWindow * WXUNUSED(parent)) @@ -968,7 +968,7 @@ bool wxGnomePrinter::Setup(wxWindow * WXUNUSED(parent)) } //----------------------------------------------------------------------------- -// wxGnomePrintDC +// wxGnomePrinterDC //----------------------------------------------------------------------------- // conversion @@ -984,9 +984,9 @@ static const double DEV2PS = 72.0 / 600.0; #define YLOG2DEV(x) ((m_pageHeight - (double)LogicalToDeviceY(x)) * DEV2PS) #define YLOG2DEVREL(x) ((double)(LogicalToDeviceYRel(x)) * DEV2PS) -IMPLEMENT_CLASS(wxGnomePrintDC, wxDC) +IMPLEMENT_CLASS(wxGnomePrinterDC, wxDC) -wxGnomePrintDC::wxGnomePrintDC( const wxPrintData& data ) +wxGnomePrinterDC::wxGnomePrinterDC( const wxPrintData& data ) { m_printData = data; @@ -1011,17 +1011,17 @@ wxGnomePrintDC::wxGnomePrintDC( const wxPrintData& data ) m_pageHeight = ph * PS2DEV; } -wxGnomePrintDC::~wxGnomePrintDC() +wxGnomePrinterDC::~wxGnomePrinterDC() { } -bool wxGnomePrintDC::IsOk() const +bool wxGnomePrinterDC::IsOk() const { return true; } bool -wxGnomePrintDC::DoFloodFill(wxCoord WXUNUSED(x1), +wxGnomePrinterDC::DoFloodFill(wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), const wxColour& WXUNUSED(col), int WXUNUSED(style)) @@ -1030,14 +1030,14 @@ wxGnomePrintDC::DoFloodFill(wxCoord WXUNUSED(x1), } bool -wxGnomePrintDC::DoGetPixel(wxCoord WXUNUSED(x1), +wxGnomePrinterDC::DoGetPixel(wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), wxColour * WXUNUSED(col)) const { return false; } -void wxGnomePrintDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) +void wxGnomePrinterDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) { if (m_pen.GetStyle() == wxTRANSPARENT) return; @@ -1051,11 +1051,11 @@ void wxGnomePrintDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) CalcBoundingBox( x2, y2 ); } -void wxGnomePrintDC::DoCrossHair(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) +void wxGnomePrinterDC::DoCrossHair(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { } -void wxGnomePrintDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) +void wxGnomePrinterDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) { double dx = x1 - xc; double dy = y1 - yc; @@ -1111,7 +1111,7 @@ void wxGnomePrintDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoo CalcBoundingBox (xc, yc); } -void wxGnomePrintDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) +void wxGnomePrinterDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) { x += w/2; y += h/2; @@ -1156,11 +1156,11 @@ void wxGnomePrintDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,d CalcBoundingBox( x+w, y+h ); } -void wxGnomePrintDC::DoDrawPoint(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) +void wxGnomePrinterDC::DoDrawPoint(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { } -void wxGnomePrintDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) +void wxGnomePrinterDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) { if (m_pen.GetStyle() == wxTRANSPARENT) return; @@ -1180,7 +1180,7 @@ void wxGnomePrintDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoo gs_libGnomePrint->gnome_print_stroke ( m_gpc); } -void wxGnomePrintDC::DoDrawPolygon(int n, wxPoint points[], +void wxGnomePrinterDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int WXUNUSED(fillStyle)) { @@ -1228,12 +1228,12 @@ void wxGnomePrintDC::DoDrawPolygon(int n, wxPoint points[], } } -void wxGnomePrintDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) +void wxGnomePrinterDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) { wxDC::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle ); } -void wxGnomePrintDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) +void wxGnomePrinterDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { width--; height--; @@ -1271,7 +1271,7 @@ void wxGnomePrintDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoor } } -void wxGnomePrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) +void wxGnomePrinterDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) { width--; height--; @@ -1343,7 +1343,7 @@ void wxGnomePrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, } } -void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y, +void wxGnomePrinterDC::makeEllipticalPath(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { double r = 4 * (sqrt(2.) - 1) / 3; @@ -1389,7 +1389,7 @@ void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y, gs_libGnomePrint->gnome_print_closepath(m_gpc); } -void wxGnomePrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) +void wxGnomePrinterDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { width--; height--; @@ -1414,7 +1414,7 @@ void wxGnomePrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord } #if wxUSE_SPLINES -void wxGnomePrintDC::DoDrawSpline(const wxPointList *points) +void wxGnomePrinterDC::DoDrawSpline(const wxPointList *points) { SetPen (m_pen); @@ -1474,7 +1474,7 @@ void wxGnomePrintDC::DoDrawSpline(const wxPointList *points) #endif // wxUSE_SPLINES bool -wxGnomePrintDC::DoBlit(wxCoord xdest, wxCoord ydest, +wxGnomePrinterDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, @@ -1497,13 +1497,13 @@ wxGnomePrintDC::DoBlit(wxCoord xdest, wxCoord ydest, return true; } -void wxGnomePrintDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ) +void wxGnomePrinterDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ) { DoDrawBitmap( icon, x, y, true ); } void -wxGnomePrintDC::DoDrawBitmap(const wxBitmap& bitmap, +wxGnomePrinterDC::DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool WXUNUSED(useMask)) { @@ -1555,12 +1555,12 @@ wxGnomePrintDC::DoDrawBitmap(const wxBitmap& bitmap, } } -void wxGnomePrintDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y ) +void wxGnomePrinterDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y ) { DoDrawRotatedText( text, x, y, 0.0 ); } -void wxGnomePrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) +void wxGnomePrinterDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) { double xx = XLOG2DEV(x); double yy = YLOG2DEV(y); @@ -1642,11 +1642,11 @@ void wxGnomePrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord CalcBoundingBox (x + w, y + h); } -void wxGnomePrintDC::Clear() +void wxGnomePrinterDC::Clear() { } -void wxGnomePrintDC::SetFont( const wxFont& font ) +void wxGnomePrinterDC::SetFont( const wxFont& font ) { m_font = font; @@ -1661,7 +1661,7 @@ void wxGnomePrintDC::SetFont( const wxFont& font ) } } -void wxGnomePrintDC::SetPen( const wxPen& pen ) +void wxGnomePrinterDC::SetPen( const wxPen& pen ) { if (!pen.Ok()) return; @@ -1727,7 +1727,7 @@ void wxGnomePrintDC::SetPen( const wxPen& pen ) } } -void wxGnomePrintDC::SetBrush( const wxBrush& brush ) +void wxGnomePrinterDC::SetBrush( const wxBrush& brush ) { if (!brush.Ok()) return; @@ -1766,15 +1766,15 @@ void wxGnomePrintDC::SetBrush( const wxBrush& brush ) } } -void wxGnomePrintDC::SetLogicalFunction(int WXUNUSED(function)) +void wxGnomePrinterDC::SetLogicalFunction(int WXUNUSED(function)) { } -void wxGnomePrintDC::SetBackground(const wxBrush& WXUNUSED(brush)) +void wxGnomePrinterDC::SetBackground(const wxBrush& WXUNUSED(brush)) { } -void wxGnomePrintDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) +void wxGnomePrinterDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { wxDC::DoSetClippingRegion( x, y, width, height ); @@ -1789,7 +1789,7 @@ void wxGnomePrintDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wx gs_libGnomePrint->gnome_print_clip( m_gpc ); } -void wxGnomePrintDC::DestroyClippingRegion() +void wxGnomePrinterDC::DestroyClippingRegion() { wxDC::DestroyClippingRegion(); @@ -1804,27 +1804,27 @@ void wxGnomePrintDC::DestroyClippingRegion() #endif } -bool wxGnomePrintDC::StartDoc(const wxString& WXUNUSED(message)) +bool wxGnomePrinterDC::StartDoc(const wxString& WXUNUSED(message)) { return true; } -void wxGnomePrintDC::EndDoc() +void wxGnomePrinterDC::EndDoc() { gs_libGnomePrint->gnome_print_end_doc( m_gpc ); } -void wxGnomePrintDC::StartPage() +void wxGnomePrinterDC::StartPage() { gs_libGnomePrint->gnome_print_beginpage( m_gpc, (const guchar*) "page" ); } -void wxGnomePrintDC::EndPage() +void wxGnomePrinterDC::EndPage() { gs_libGnomePrint->gnome_print_showpage( m_gpc ); } -wxCoord wxGnomePrintDC::GetCharHeight() const +wxCoord wxGnomePrinterDC::GetCharHeight() const { pango_layout_set_text( m_layout, "H", 1 ); @@ -1834,7 +1834,7 @@ wxCoord wxGnomePrintDC::GetCharHeight() const return h; } -wxCoord wxGnomePrintDC::GetCharWidth() const +wxCoord wxGnomePrinterDC::GetCharWidth() const { pango_layout_set_text( m_layout, "H", 1 ); @@ -1844,7 +1844,7 @@ wxCoord wxGnomePrintDC::GetCharWidth() const return w; } -void wxGnomePrintDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, +void wxGnomePrinterDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, wxCoord *descent, wxCoord *externalLeading, const wxFont *theFont ) const @@ -1908,7 +1908,7 @@ void wxGnomePrintDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxC pango_layout_set_font_description( m_layout, m_fontdesc ); } -void wxGnomePrintDC::DoGetSize(int* width, int* height) const +void wxGnomePrinterDC::DoGetSize(int* width, int* height) const { wxGnomePrintNativeData *native = (wxGnomePrintNativeData*) m_printData.GetNativeData(); @@ -1924,7 +1924,7 @@ void wxGnomePrintDC::DoGetSize(int* width, int* height) const *height = wxRound( ph * PS2DEV ); } -void wxGnomePrintDC::DoGetSizeMM(int *width, int *height) const +void wxGnomePrinterDC::DoGetSizeMM(int *width, int *height) const { wxGnomePrintNativeData *native = (wxGnomePrintNativeData*) m_printData.GetNativeData(); @@ -1947,12 +1947,12 @@ void wxGnomePrintDC::DoGetSizeMM(int *width, int *height) const *height = (int) (ph + 0.5); } -wxSize wxGnomePrintDC::GetPPI() const +wxSize wxGnomePrinterDC::GetPPI() const { return wxSize(DPI,DPI); } -void wxGnomePrintDC::SetPrintData(const wxPrintData& data) +void wxGnomePrinterDC::SetPrintData(const wxPrintData& data) { m_printData = data; @@ -1964,11 +1964,11 @@ void wxGnomePrintDC::SetPrintData(const wxPrintData& data) m_deviceLocalOriginY = height; } -void wxGnomePrintDC::SetResolution(int WXUNUSED(ppi)) +void wxGnomePrinterDC::SetResolution(int WXUNUSED(ppi)) { } -int wxGnomePrintDC::GetResolution() +int wxGnomePrinterDC::GetResolution() { return DPI; } @@ -2051,14 +2051,14 @@ void wxGnomePrintPreview::DetermineScaling() m_previewPrintout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()), (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) ); - m_previewPrintout->SetPPIPrinter(wxGnomePrintDC::GetResolution(), wxGnomePrintDC::GetResolution()); + m_previewPrintout->SetPPIPrinter(wxGnomePrinterDC::GetResolution(), wxGnomePrinterDC::GetResolution()); wxSize sizeDevUnits(paper->GetSizeDeviceUnits()); - // TODO: get better resolution information from wxGnomePrintDC, if possible. + // TODO: get better resolution information from wxGnomePrinterDC, if possible. - sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * wxGnomePrintDC::GetResolution() / 72.0); - sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * wxGnomePrintDC::GetResolution() / 72.0); + sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * wxGnomePrinterDC::GetResolution() / 72.0); + sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * wxGnomePrinterDC::GetResolution() / 72.0); wxSize sizeTenthsMM(paper->GetSize()); wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10); @@ -2079,7 +2079,7 @@ void wxGnomePrintPreview::DetermineScaling() 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)wxGnomePrintDC::GetResolution(); + m_previewScaleX = (float)0.8 * 72.0 / (float)wxGnomePrinterDC::GetResolution(); m_previewScaleY = m_previewScaleX; } } diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index e9b17367a8..50e0257eec 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -145,7 +145,7 @@ wxGtkPrintFactory::CreatePrintSetupDialog(wxWindow * WXUNUSED(parent), wxDC* wxGtkPrintFactory::CreatePrinterDC( const wxPrintData& data ) { - return new wxGtkPrintDC(data); + return new wxGtkPrinterDC(data); } bool wxGtkPrintFactory::HasOwnPrintToFile() @@ -894,7 +894,7 @@ void wxGtkPrinter::BeginPrint(wxPrintout *printout, GtkPrintOperation *operation SetPrintContext(context); native->SetPrintContext( context ); - wxGtkPrintDC *printDC = new wxGtkPrintDC( printdata ); + wxGtkPrinterDC *printDC = new wxGtkPrinterDC( printdata ); m_dc = printDC; if (!m_dc->IsOk()) @@ -902,7 +902,7 @@ void wxGtkPrinter::BeginPrint(wxPrintout *printout, GtkPrintOperation *operation if (sm_lastError != wxPRINTER_CANCELLED) { sm_lastError = wxPRINTER_ERROR; - wxFAIL_MSG(_("The wxGtkPrintDC cannot be used.")); + wxFAIL_MSG(_("The wxGtkPrinterDC cannot be used.")); } return; } @@ -1065,7 +1065,7 @@ wxDC* wxGtkPrinter::PrintDialog( wxWindow *parent ) } m_printDialogData = dialog.GetPrintDialogData(); - return new wxGtkPrintDC( m_printDialogData.GetPrintData() ); + return new wxGtkPrinterDC( m_printDialogData.GetPrintData() ); } bool wxGtkPrinter::Setup( wxWindow * WXUNUSED(parent) ) @@ -1075,7 +1075,7 @@ bool wxGtkPrinter::Setup( wxWindow * WXUNUSED(parent) ) } //----------------------------------------------------------------------------- -// wxGtkPrintDC +// wxGtkPrinterDC //----------------------------------------------------------------------------- #define XLOG2DEV(x) ((double)(LogicalToDeviceX(x)) * m_DEV2PS) @@ -1083,9 +1083,9 @@ bool wxGtkPrinter::Setup( wxWindow * WXUNUSED(parent) ) #define YLOG2DEV(x) ((double)(LogicalToDeviceY(x)) * m_DEV2PS) #define YLOG2DEVREL(x) ((double)(LogicalToDeviceYRel(x)) * m_DEV2PS) -IMPLEMENT_CLASS(wxGtkPrintDC, wxDC) +IMPLEMENT_CLASS(wxGtkPrinterDC, wxDC) -wxGtkPrintDC::wxGtkPrintDC( const wxPrintData& data ) +wxGtkPrinterDC::wxGtkPrinterDC( const wxPrintData& data ) { m_printData = data; @@ -1125,18 +1125,18 @@ wxGtkPrintDC::wxGtkPrintDC( const wxPrintData& data ) gs_cairo->cairo_translate(m_cairo, -ml, -mt); } -wxGtkPrintDC::~wxGtkPrintDC() +wxGtkPrinterDC::~wxGtkPrinterDC() { g_object_unref(m_context); g_object_unref(m_layout); } -bool wxGtkPrintDC::IsOk() const +bool wxGtkPrinterDC::IsOk() const { return m_gpc != NULL; } -bool wxGtkPrintDC::DoFloodFill(wxCoord WXUNUSED(x1), +bool wxGtkPrinterDC::DoFloodFill(wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), const wxColour& WXUNUSED(col), int WXUNUSED(style)) @@ -1147,7 +1147,7 @@ bool wxGtkPrintDC::DoFloodFill(wxCoord WXUNUSED(x1), return false; } -void wxGtkPrintDC::DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter) +void wxGtkPrinterDC::DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter) { wxCoord xC = circleCenter.x; wxCoord yC = circleCenter.y; @@ -1193,7 +1193,7 @@ void wxGtkPrintDC::DoGradientFillConcentric(const wxRect& rect, const wxColour& CalcBoundingBox(xR+w, yR+h); } -void wxGtkPrintDC::DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection) +void wxGtkPrinterDC::DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection) { wxCoord x = rect.x; wxCoord y = rect.y; @@ -1243,7 +1243,7 @@ void wxGtkPrintDC::DoGradientFillLinear(const wxRect& rect, const wxColour& init CalcBoundingBox(x+w, y+h); } -bool wxGtkPrintDC::DoGetPixel(wxCoord WXUNUSED(x1), +bool wxGtkPrinterDC::DoGetPixel(wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), wxColour * WXUNUSED(col)) const { @@ -1251,7 +1251,7 @@ bool wxGtkPrintDC::DoGetPixel(wxCoord WXUNUSED(x1), return false; } -void wxGtkPrintDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) +void wxGtkPrinterDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) { if (m_pen.GetStyle() == wxTRANSPARENT) return; @@ -1264,7 +1264,7 @@ void wxGtkPrintDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) CalcBoundingBox( x2, y2 ); } -void wxGtkPrintDC::DoCrossHair(wxCoord x, wxCoord y) +void wxGtkPrinterDC::DoCrossHair(wxCoord x, wxCoord y) { int w, h; DoGetSize(&w, &h); @@ -1281,7 +1281,7 @@ void wxGtkPrintDC::DoCrossHair(wxCoord x, wxCoord y) CalcBoundingBox( w, h ); } -void wxGtkPrintDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) +void wxGtkPrinterDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) { double dx = x1 - xc; double dy = y1 - yc; @@ -1333,7 +1333,7 @@ void wxGtkPrintDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord CalcBoundingBox (x2, y2); } -void wxGtkPrintDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) +void wxGtkPrinterDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) { gs_cairo->cairo_save( m_cairo ); @@ -1359,7 +1359,7 @@ void wxGtkPrintDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,dou CalcBoundingBox( x+w, y+h ); } -void wxGtkPrintDC::DoDrawPoint(wxCoord x, wxCoord y) +void wxGtkPrinterDC::DoDrawPoint(wxCoord x, wxCoord y) { if (m_pen.GetStyle() == wxTRANSPARENT) return; @@ -1372,7 +1372,7 @@ void wxGtkPrintDC::DoDrawPoint(wxCoord x, wxCoord y) CalcBoundingBox( x, y ); } -void wxGtkPrintDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) +void wxGtkPrinterDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) { if (m_pen.GetStyle() == wxTRANSPARENT) return; @@ -1392,7 +1392,7 @@ void wxGtkPrintDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord gs_cairo->cairo_stroke ( m_cairo); } -void wxGtkPrintDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) +void wxGtkPrinterDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) { if (n==0) return; @@ -1426,12 +1426,12 @@ void wxGtkPrintDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoo gs_cairo->cairo_restore(m_cairo); } -void wxGtkPrintDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) +void wxGtkPrinterDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) { wxDC::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle ); } -void wxGtkPrintDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) +void wxGtkPrinterDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { width--; height--; @@ -1449,7 +1449,7 @@ void wxGtkPrintDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord CalcBoundingBox( x + width, y + height ); } -void wxGtkPrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) +void wxGtkPrinterDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) { width--; height--; @@ -1497,7 +1497,7 @@ void wxGtkPrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, w CalcBoundingBox(x+width,y+height); } -void wxGtkPrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) +void wxGtkPrinterDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { width--; height--; @@ -1523,7 +1523,7 @@ void wxGtkPrintDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord he } #if wxUSE_SPLINES -void wxGtkPrintDC::DoDrawSpline(const wxPointList *points) +void wxGtkPrinterDC::DoDrawSpline(const wxPointList *points) { SetPen (m_pen); @@ -1582,7 +1582,7 @@ void wxGtkPrintDC::DoDrawSpline(const wxPointList *points) } #endif // wxUSE_SPLINES -bool wxGtkPrintDC::DoBlit(wxCoord xdest, wxCoord ydest, +bool wxGtkPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask, @@ -1607,14 +1607,14 @@ bool wxGtkPrintDC::DoBlit(wxCoord xdest, wxCoord ydest, return true; } -void wxGtkPrintDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ) +void wxGtkPrinterDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ) { DoDrawBitmap( icon, x, y, true ); } -void wxGtkPrintDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask ) +void wxGtkPrinterDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask ) { - wxCHECK_RET( bitmap.IsOk(), wxT("Invalid bitmap in wxGtkPrintDC::DoDrawBitmap")); + wxCHECK_RET( bitmap.IsOk(), wxT("Invalid bitmap in wxGtkPrinterDC::DoDrawBitmap")); cairo_surface_t* surface; x = wxCoord(XLOG2DEV(x)); @@ -1725,12 +1725,12 @@ void wxGtkPrintDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, b gs_cairo->cairo_restore(m_cairo); } -void wxGtkPrintDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y ) +void wxGtkPrinterDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y ) { DoDrawRotatedText( text, x, y, 0.0 ); } -void wxGtkPrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) +void wxGtkPrinterDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) { double xx = XLOG2DEV(x); double yy = YLOG2DEV(y); @@ -1842,7 +1842,7 @@ void wxGtkPrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, CalcBoundingBox (x + w, y + h); } -void wxGtkPrintDC::Clear() +void wxGtkPrinterDC::Clear() { // Clear does nothing for printing, but keep the code // for later reuse @@ -1855,7 +1855,7 @@ void wxGtkPrintDC::Clear() */ } -void wxGtkPrintDC::SetFont( const wxFont& font ) +void wxGtkPrinterDC::SetFont( const wxFont& font ) { m_font = font; @@ -1876,7 +1876,7 @@ void wxGtkPrintDC::SetFont( const wxFont& font ) } } -void wxGtkPrintDC::SetPen( const wxPen& pen ) +void wxGtkPrinterDC::SetPen( const wxPen& pen ) { if (!pen.Ok()) return; @@ -1955,7 +1955,7 @@ void wxGtkPrintDC::SetPen( const wxPen& pen ) } } -void wxGtkPrintDC::SetBrush( const wxBrush& brush ) +void wxGtkPrinterDC::SetBrush( const wxBrush& brush ) { if (!brush.Ok()) return; @@ -2048,7 +2048,7 @@ void wxGtkPrintDC::SetBrush( const wxBrush& brush ) } } -void wxGtkPrintDC::SetLogicalFunction( int function ) +void wxGtkPrinterDC::SetLogicalFunction( int function ) { if (function == wxCLEAR) gs_cairo->cairo_set_operator (m_cairo, CAIRO_OPERATOR_CLEAR); @@ -2066,7 +2066,7 @@ void wxGtkPrintDC::SetLogicalFunction( int function ) gs_cairo->cairo_set_operator (m_cairo, CAIRO_OPERATOR_SOURCE); } -void wxGtkPrintDC::SetBackground( const wxBrush& brush ) +void wxGtkPrinterDC::SetBackground( const wxBrush& brush ) { m_backgroundBrush = brush; gs_cairo->cairo_save(m_cairo); @@ -2077,7 +2077,7 @@ void wxGtkPrintDC::SetBackground( const wxBrush& brush ) gs_cairo->cairo_restore(m_cairo); } -void wxGtkPrintDC::SetBackgroundMode(int mode) +void wxGtkPrinterDC::SetBackgroundMode(int mode) { if (mode == wxSOLID) m_backgroundMode = wxSOLID; @@ -2085,38 +2085,38 @@ void wxGtkPrintDC::SetBackgroundMode(int mode) m_backgroundMode = wxTRANSPARENT; } -void wxGtkPrintDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) +void wxGtkPrinterDC::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 wxGtkPrintDC::DestroyClippingRegion() +void wxGtkPrinterDC::DestroyClippingRegion() { gs_cairo->cairo_reset_clip(m_cairo); } -bool wxGtkPrintDC::StartDoc(const wxString& WXUNUSED(message)) +bool wxGtkPrinterDC::StartDoc(const wxString& WXUNUSED(message)) { return true; } -void wxGtkPrintDC::EndDoc() +void wxGtkPrinterDC::EndDoc() { return; } -void wxGtkPrintDC::StartPage() +void wxGtkPrinterDC::StartPage() { return; } -void wxGtkPrintDC::EndPage() +void wxGtkPrinterDC::EndPage() { return; } -wxCoord wxGtkPrintDC::GetCharHeight() const +wxCoord wxGtkPrinterDC::GetCharHeight() const { pango_layout_set_text( m_layout, "H", 1 ); @@ -2126,7 +2126,7 @@ wxCoord wxGtkPrintDC::GetCharHeight() const return wxRound( h * m_PS2DEV ); } -wxCoord wxGtkPrintDC::GetCharWidth() const +wxCoord wxGtkPrinterDC::GetCharWidth() const { pango_layout_set_text( m_layout, "H", 1 ); @@ -2136,7 +2136,7 @@ wxCoord wxGtkPrintDC::GetCharWidth() const return wxRound( w * m_PS2DEV ); } -void wxGtkPrintDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, +void wxGtkPrinterDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, wxCoord *descent, wxCoord *externalLeading, const wxFont *theFont ) const @@ -2194,7 +2194,7 @@ void wxGtkPrintDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoo pango_layout_set_font_description( m_layout, m_fontdesc ); } -void wxGtkPrintDC::DoGetSize(int* width, int* height) const +void wxGtkPrinterDC::DoGetSize(int* width, int* height) const { GtkPageSetup *setup = gtk_print_context_get_page_setup( m_gpc ); @@ -2204,7 +2204,7 @@ void wxGtkPrintDC::DoGetSize(int* width, int* height) const *height = wxRound( gtk_page_setup_get_paper_height( setup, GTK_UNIT_POINTS ) * m_PS2DEV ); } -void wxGtkPrintDC::DoGetSizeMM(int *width, int *height) const +void wxGtkPrinterDC::DoGetSizeMM(int *width, int *height) const { GtkPageSetup *setup = gtk_print_context_get_page_setup( m_gpc ); @@ -2214,23 +2214,23 @@ void wxGtkPrintDC::DoGetSizeMM(int *width, int *height) const *height = wxRound( gtk_page_setup_get_paper_height( setup, GTK_UNIT_MM ) ); } -wxSize wxGtkPrintDC::GetPPI() const +wxSize wxGtkPrinterDC::GetPPI() const { return wxSize( (int)m_resolution, (int)m_resolution ); } -void wxGtkPrintDC::SetPrintData(const wxPrintData& data) +void wxGtkPrinterDC::SetPrintData(const wxPrintData& data) { m_printData = data; } -void wxGtkPrintDC::SetResolution(int WXUNUSED(ppi)) +void wxGtkPrinterDC::SetResolution(int WXUNUSED(ppi)) { // We can't change ppi of the GtkPrintContext. // TODO: should we really support this? } -int wxGtkPrintDC::GetResolution() +int wxGtkPrinterDC::GetResolution() { return m_resolution; }