From 6d52ca536a0ecb6e69474d30461f6128497505a0 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Sat, 15 Nov 2008 11:10:34 +0000 Subject: [PATCH] make GetPaperRect() and GetResolution() const functions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56783 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dc.h | 8 ++++---- include/wx/dcprint.h | 4 ++-- include/wx/generic/dcpsg.h | 4 ++-- include/wx/gtk/gnome/gprint.h | 8 ++++---- include/wx/gtk/print.h | 6 +++--- include/wx/motif/dcprint.h | 2 +- include/wx/msw/dcprint.h | 2 +- include/wx/os2/dcprint.h | 2 +- include/wx/osx/carbon/dcprint.h | 8 ++++---- include/wx/palmos/dcprint.h | 2 +- src/common/dcbase.cpp | 4 ++-- src/generic/dcpsg.cpp | 4 ++-- src/gtk/gnome/gprint.cpp | 4 ++-- src/gtk/print.cpp | 14 +++++++------- src/msw/dcprint.cpp | 2 +- src/os2/dcprint.cpp | 2 +- src/osx/carbon/dcprint.cpp | 18 +++++++++--------- src/palmos/dcprint.cpp | 2 +- 18 files changed, 48 insertions(+), 48 deletions(-) diff --git a/include/wx/dc.h b/include/wx/dc.h index ce9356e653..f780315d50 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/dc.h // Purpose: wxDC class -// Author: Vadim Zeitlin +// Author: Vadim Zeitlin // Modified by: // Created: 05/25/99 // RCS-ID: $Id$ @@ -497,10 +497,10 @@ public: // --------------------------------------------------------- // wxPrinterDC Impl API - virtual wxRect GetPaperRect() + virtual wxRect GetPaperRect() const { int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); } - virtual int GetResolution() + virtual int GetResolution() const { return -1; } private: @@ -667,7 +667,7 @@ public: wxSize GetPPI() const { return m_pimpl->GetPPI(); } - virtual int GetResolution() + virtual int GetResolution() const { return m_pimpl->GetResolution(); } // Right-To-Left (RTL) modes diff --git a/include/wx/dcprint.h b/include/wx/dcprint.h index 65e725482f..95dbff8f7a 100644 --- a/include/wx/dcprint.h +++ b/include/wx/dcprint.h @@ -28,8 +28,8 @@ public: wxPrinterDC(); wxPrinterDC(const wxPrintData& data); - wxRect GetPaperRect(); - int GetResolution(); + wxRect GetPaperRect() const; + int GetResolution() const; protected: wxPrinterDC(wxDCImpl *impl) : wxDC(impl) { } diff --git a/include/wx/generic/dcpsg.h b/include/wx/generic/dcpsg.h index bb66e50ce1..5c0a7ef214 100644 --- a/include/wx/generic/dcpsg.h +++ b/include/wx/generic/dcpsg.h @@ -91,8 +91,8 @@ public: // Overrridden for wxPrinterDC Impl - virtual int GetResolution(); - virtual wxRect GetPaperRect(); + virtual int GetResolution() const; + virtual wxRect GetPaperRect() const; protected: bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE); diff --git a/include/wx/gtk/gnome/gprint.h b/include/wx/gtk/gnome/gprint.h index a801f01ccd..0901dae2e7 100644 --- a/include/wx/gtk/gnome/gprint.h +++ b/include/wx/gtk/gnome/gprint.h @@ -265,7 +265,7 @@ protected: void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); #if wxUSE_SPLINES void DoDrawSpline(const wxPointList *points); -#endif +#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); @@ -289,8 +289,8 @@ protected: wxPrintData& GetPrintData() { return m_printData; } // overriden for wxPrinterDC Impl - virtual wxRect GetPaperRect(); - virtual int GetResolution(); + virtual wxRect GetPaperRect() const; + virtual int GetResolution() const; private: wxPrintData m_printData; @@ -301,7 +301,7 @@ private: unsigned char m_currentRed; unsigned char m_currentGreen; unsigned char m_currentBlue; - + double m_pageHeight; GnomePrintContext *m_gpc; diff --git a/include/wx/gtk/print.h b/include/wx/gtk/print.h index 66f34f0702..62a3514645 100644 --- a/include/wx/gtk/print.h +++ b/include/wx/gtk/print.h @@ -249,10 +249,10 @@ public: void SetBackgroundMode(int mode); void SetPalette(const wxPalette& WXUNUSED(palette)) { } void SetResolution(int ppi); - + // overriden for wxPrinterDC Impl - virtual int GetResolution(); - virtual wxRect GetPaperRect(); + virtual int GetResolution() const; + virtual wxRect GetPaperRect() const; protected: bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE ); diff --git a/include/wx/motif/dcprint.h b/include/wx/motif/dcprint.h index ba338f3dcd..1292a44ea1 100644 --- a/include/wx/motif/dcprint.h +++ b/include/wx/motif/dcprint.h @@ -24,7 +24,7 @@ public: int orientation = wxPORTRAIT); virtual ~wxPrinterDC(); - wxRect GetPaperRect(); + wxRect GetPaperRect() const; DECLARE_CLASS(wxPrinterDCImpl) }; diff --git a/include/wx/msw/dcprint.h b/include/wx/msw/dcprint.h index 2c7f7d42d5..64ed3c7d53 100644 --- a/include/wx/msw/dcprint.h +++ b/include/wx/msw/dcprint.h @@ -35,7 +35,7 @@ public: virtual void StartPage(); virtual void EndPage(); - virtual wxRect GetPaperRect(); + virtual wxRect GetPaperRect() const; protected: virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, diff --git a/include/wx/os2/dcprint.h b/include/wx/os2/dcprint.h index 558f6454c9..47689ebc80 100644 --- a/include/wx/os2/dcprint.h +++ b/include/wx/os2/dcprint.h @@ -33,7 +33,7 @@ class WXDLLIMPEXP_CORE wxPrinterDCImpl: public wxPMDCImpl virtual void StartPage(void); virtual void EndPage(void); - virtual wxRect GetPaperRect(); + virtual wxRect GetPaperRect() const; protected: virtual void DoDrawBitmap( const wxBitmap& rBmp diff --git a/include/wx/osx/carbon/dcprint.h b/include/wx/osx/carbon/dcprint.h index 1e64559a2d..4380f4f4f2 100644 --- a/include/wx/osx/carbon/dcprint.h +++ b/include/wx/osx/carbon/dcprint.h @@ -31,17 +31,17 @@ public: virtual void StartPage(void) ; virtual void EndPage(void) ; - wxRect GetPaperRect(); + wxRect GetPaperRect() const; wxPrintData& GetPrintData() { return m_printData; } virtual wxSize GetPPI() const; - + protected: virtual void DoGetSize( int *width, int *height ) const; - + wxPrintData m_printData ; wxNativePrinterDC* m_nativePrinterDC ; - + private: DECLARE_CLASS(wxPrinterDC) #endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/include/wx/palmos/dcprint.h b/include/wx/palmos/dcprint.h index 6051b0a23c..a67bb3123a 100644 --- a/include/wx/palmos/dcprint.h +++ b/include/wx/palmos/dcprint.h @@ -34,7 +34,7 @@ public: virtual void StartPage(); virtual void EndPage(); - wxRect GetPaperRect(); + wxRect GetPaperRect() const; protected: virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 206c1662dd..a60da2e657 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -300,12 +300,12 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& data) { } -wxRect wxPrinterDC::GetPaperRect() +wxRect wxPrinterDC::GetPaperRect() const { return GetImpl()->GetPaperRect(); } -int wxPrinterDC::GetResolution() +int wxPrinterDC::GetResolution() const { return GetImpl()->GetResolution(); } diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index e041e64cb6..06880bc1c7 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -342,7 +342,7 @@ bool wxPostScriptDCImpl::IsOk() const return m_ok; } -wxRect wxPostScriptDCImpl::GetPaperRect() +wxRect wxPostScriptDCImpl::GetPaperRect() const { int w = 0; int h = 0; @@ -350,7 +350,7 @@ wxRect wxPostScriptDCImpl::GetPaperRect() return wxRect(0,0,w,h); } -int wxPostScriptDCImpl::GetResolution() +int wxPostScriptDCImpl::GetResolution() const { return DPI; } diff --git a/src/gtk/gnome/gprint.cpp b/src/gtk/gnome/gprint.cpp index 6c9ef2c793..2e389c56e6 100644 --- a/src/gtk/gnome/gprint.cpp +++ b/src/gtk/gnome/gprint.cpp @@ -2015,12 +2015,12 @@ void wxGnomePrinterDCImpl::SetPrintData(const wxPrintData& data) // overridden for wxPrinterDC Impl -int wxGnomePrinterDCImpl::GetResolution() +int wxGnomePrinterDCImpl::GetResolution() const { return DPI; } -wxRect wxGnomePrinterDCImpl::GetPaperRect() +wxRect wxGnomePrinterDCImpl::GetPaperRect() const { // GNOME print doesn't support printer margins int w = 0; diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index 8f8a48239b..a7c6f95081 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -1074,7 +1074,7 @@ wxDC* wxGtkPrinter::PrintDialog( wxWindow *parent ) } m_printDialogData = dialog.GetPrintDialogData(); - + return new wxPrinterDC( m_printDialogData.GetPrintData() ); } @@ -1132,7 +1132,7 @@ wxGtkPrinterDCImpl::wxGtkPrinterDCImpl(wxPrinterDC *owner, const wxPrintData& da #if wxCAIRO_SCALE m_PS2DEV = 1.0; m_DEV2PS = 1.0; - + cairo_scale( m_cairo, 72.0 / (double)m_resolution, 72.0 / (double)m_resolution ); #else m_PS2DEV = (double)m_resolution / 72.0; @@ -1866,7 +1866,7 @@ void wxGtkPrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCo void wxGtkPrinterDCImpl::Clear() { // Clear does nothing for printing, but keep the code -// for later reuse +// for later reuse /* cairo_save(m_cairo); cairo_set_operator (m_cairo, CAIRO_OPERATOR_SOURCE); @@ -1902,7 +1902,7 @@ void wxGtkPrinterDCImpl::SetPen( const wxPen& pen ) m_pen = pen; double width; - + if (m_pen.GetWidth() <= 0) width = 0.1; else @@ -2251,7 +2251,7 @@ void wxGtkPrinterDCImpl::SetPrintData(const wxPrintData& data) // overriden for wxPrinterDC Impl -wxRect wxGtkPrinterDCImpl::GetPaperRect() +wxRect wxGtkPrinterDCImpl::GetPaperRect() const { // Does GtkPrint support printer margins? int w = 0; @@ -2260,7 +2260,7 @@ wxRect wxGtkPrinterDCImpl::GetPaperRect() return wxRect( 0,0,w,h ); } -int wxGtkPrinterDCImpl::GetResolution() +int wxGtkPrinterDCImpl::GetResolution() const { return m_resolution; } @@ -2357,7 +2357,7 @@ void wxGtkPrintPreview::DetermineScaling() wxSize sizeDevUnits(paper->GetSizeDeviceUnits()); sizeDevUnits.x = wxRound((double)sizeDevUnits.x * (double)m_resolution / 72.0); sizeDevUnits.y = wxRound((double)sizeDevUnits.y * (double)m_resolution / 72.0); - + wxSize sizeTenthsMM(paper->GetSize()); wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10); diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index 4b5b72c7a1..8a0b13d38f 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -228,7 +228,7 @@ void wxPrinterDCImpl::EndPage() } -wxRect wxPrinterDCImpl::GetPaperRect() +wxRect wxPrinterDCImpl::GetPaperRect() const { if (!IsOk()) return wxRect(0, 0, 0, 0); diff --git a/src/os2/dcprint.cpp b/src/os2/dcprint.cpp index a861f3363d..9c0f88cc2b 100644 --- a/src/os2/dcprint.cpp +++ b/src/os2/dcprint.cpp @@ -138,7 +138,7 @@ void wxPrinterDCImpl::EndPage() // ::EndPage((HDC) m_hDC); } // end of wxPrinterDC::EndPage -wxRect wxPrinterDCImpl::GetPaperRect() +wxRect wxPrinterDCImpl::GetPaperRect() const { // Use page rect if we can't get paper rect. wxCoord w, h; diff --git a/src/osx/carbon/dcprint.cpp b/src/osx/carbon/dcprint.cpp index 9da9504af7..f9353bc42c 100644 --- a/src/osx/carbon/dcprint.cpp +++ b/src/osx/carbon/dcprint.cpp @@ -85,7 +85,7 @@ wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data ) PMResolution res; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 if ( PMPrinterGetOutputResolution != NULL ) { PMPrinter printer; @@ -103,11 +103,11 @@ wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data ) else #endif { -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res); #endif } - + m_ppi = wxSize(int(res.hRes), int(res.vRes)); } @@ -135,7 +135,7 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message m_err = PMSessionBeginCGDocumentNoDialog(native->m_macPrintSession, native->m_macPrintSettings, - native->m_macPageFormat); + native->m_macPageFormat); if ( m_err != noErr ) return false; @@ -148,7 +148,7 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message m_maxY = wxCoord(rPage.bottom - rPage.top); PMResolution res; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 if ( PMPrinterGetOutputResolution != NULL ) { PMPrinter printer; @@ -166,7 +166,7 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message else #endif { -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res); #endif } @@ -256,7 +256,7 @@ void wxMacCarbonPrinterDC::GetSize( int *w , int *h) const *h = m_maxY ; } -wxSize wxMacCarbonPrinterDC::GetPPI() const +wxSize wxMacCarbonPrinterDC::GetPPI() const { return m_ppi ; }; @@ -286,7 +286,7 @@ wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printda { wxSize sz = GetPPI(); m_mm_to_pix_x = mm2inches * sz.x; - m_mm_to_pix_y = mm2inches * sz.y; + m_mm_to_pix_y = mm2inches * sz.y; } // we need at least a measuring context because people start measuring before a page // gets printed at all @@ -344,7 +344,7 @@ void wxPrinterDCImpl::EndDoc(void) } } -wxRect wxPrinterDCImpl::GetPaperRect() +wxRect wxPrinterDCImpl::GetPaperRect() const { wxCoord w, h; GetOwner()->GetSize(&w, &h); diff --git a/src/palmos/dcprint.cpp b/src/palmos/dcprint.cpp index dc154f7b2f..81fabe9cb2 100644 --- a/src/palmos/dcprint.cpp +++ b/src/palmos/dcprint.cpp @@ -100,7 +100,7 @@ void wxPrinterDC::EndPage() { } -wxRect wxPrinterDC::GetPaperRect() +wxRect wxPrinterDC::GetPaperRect() const { // Use page rect if we can't get paper rect. wxCoord w, h;