make GetPaperRect() and GetResolution() const functions

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56783 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-11-15 11:10:34 +00:00
parent e9cc4973ff
commit 6d52ca536a
18 changed files with 48 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: wx/dc.h // Name: wx/dc.h
// Purpose: wxDC class // Purpose: wxDC class
// Author: Vadim Zeitlin // Author: Vadim Zeitlin
// Modified by: // Modified by:
// Created: 05/25/99 // Created: 05/25/99
// RCS-ID: $Id$ // RCS-ID: $Id$
@@ -497,10 +497,10 @@ public:
// --------------------------------------------------------- // ---------------------------------------------------------
// wxPrinterDC Impl API // 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); } { int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); }
virtual int GetResolution() virtual int GetResolution() const
{ return -1; } { return -1; }
private: private:
@@ -667,7 +667,7 @@ public:
wxSize GetPPI() const wxSize GetPPI() const
{ return m_pimpl->GetPPI(); } { return m_pimpl->GetPPI(); }
virtual int GetResolution() virtual int GetResolution() const
{ return m_pimpl->GetResolution(); } { return m_pimpl->GetResolution(); }
// Right-To-Left (RTL) modes // Right-To-Left (RTL) modes

View File

@@ -28,8 +28,8 @@ public:
wxPrinterDC(); wxPrinterDC();
wxPrinterDC(const wxPrintData& data); wxPrinterDC(const wxPrintData& data);
wxRect GetPaperRect(); wxRect GetPaperRect() const;
int GetResolution(); int GetResolution() const;
protected: protected:
wxPrinterDC(wxDCImpl *impl) : wxDC(impl) { } wxPrinterDC(wxDCImpl *impl) : wxDC(impl) { }

View File

@@ -91,8 +91,8 @@ public:
// Overrridden for wxPrinterDC Impl // Overrridden for wxPrinterDC Impl
virtual int GetResolution(); virtual int GetResolution() const;
virtual wxRect GetPaperRect(); virtual wxRect GetPaperRect() const;
protected: protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE); bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE);

View File

@@ -265,7 +265,7 @@ protected:
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES #if wxUSE_SPLINES
void DoDrawSpline(const wxPointList *points); void DoDrawSpline(const wxPointList *points);
#endif #endif
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
@@ -289,8 +289,8 @@ protected:
wxPrintData& GetPrintData() { return m_printData; } wxPrintData& GetPrintData() { return m_printData; }
// overriden for wxPrinterDC Impl // overriden for wxPrinterDC Impl
virtual wxRect GetPaperRect(); virtual wxRect GetPaperRect() const;
virtual int GetResolution(); virtual int GetResolution() const;
private: private:
wxPrintData m_printData; wxPrintData m_printData;
@@ -301,7 +301,7 @@ private:
unsigned char m_currentRed; unsigned char m_currentRed;
unsigned char m_currentGreen; unsigned char m_currentGreen;
unsigned char m_currentBlue; unsigned char m_currentBlue;
double m_pageHeight; double m_pageHeight;
GnomePrintContext *m_gpc; GnomePrintContext *m_gpc;

View File

@@ -249,10 +249,10 @@ public:
void SetBackgroundMode(int mode); void SetBackgroundMode(int mode);
void SetPalette(const wxPalette& WXUNUSED(palette)) { } void SetPalette(const wxPalette& WXUNUSED(palette)) { }
void SetResolution(int ppi); void SetResolution(int ppi);
// overriden for wxPrinterDC Impl // overriden for wxPrinterDC Impl
virtual int GetResolution(); virtual int GetResolution() const;
virtual wxRect GetPaperRect(); virtual wxRect GetPaperRect() const;
protected: protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE ); bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );

View File

@@ -24,7 +24,7 @@ public:
int orientation = wxPORTRAIT); int orientation = wxPORTRAIT);
virtual ~wxPrinterDC(); virtual ~wxPrinterDC();
wxRect GetPaperRect(); wxRect GetPaperRect() const;
DECLARE_CLASS(wxPrinterDCImpl) DECLARE_CLASS(wxPrinterDCImpl)
}; };

View File

@@ -35,7 +35,7 @@ public:
virtual void StartPage(); virtual void StartPage();
virtual void EndPage(); virtual void EndPage();
virtual wxRect GetPaperRect(); virtual wxRect GetPaperRect() const;
protected: protected:
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,

View File

@@ -33,7 +33,7 @@ class WXDLLIMPEXP_CORE wxPrinterDCImpl: public wxPMDCImpl
virtual void StartPage(void); virtual void StartPage(void);
virtual void EndPage(void); virtual void EndPage(void);
virtual wxRect GetPaperRect(); virtual wxRect GetPaperRect() const;
protected: protected:
virtual void DoDrawBitmap( const wxBitmap& rBmp virtual void DoDrawBitmap( const wxBitmap& rBmp

View File

@@ -31,17 +31,17 @@ public:
virtual void StartPage(void) ; virtual void StartPage(void) ;
virtual void EndPage(void) ; virtual void EndPage(void) ;
wxRect GetPaperRect(); wxRect GetPaperRect() const;
wxPrintData& GetPrintData() { return m_printData; } wxPrintData& GetPrintData() { return m_printData; }
virtual wxSize GetPPI() const; virtual wxSize GetPPI() const;
protected: protected:
virtual void DoGetSize( int *width, int *height ) const; virtual void DoGetSize( int *width, int *height ) const;
wxPrintData m_printData ; wxPrintData m_printData ;
wxNativePrinterDC* m_nativePrinterDC ; wxNativePrinterDC* m_nativePrinterDC ;
private: private:
DECLARE_CLASS(wxPrinterDC) DECLARE_CLASS(wxPrinterDC)
#endif // wxUSE_PRINTING_ARCHITECTURE #endif // wxUSE_PRINTING_ARCHITECTURE

View File

@@ -34,7 +34,7 @@ public:
virtual void StartPage(); virtual void StartPage();
virtual void EndPage(); virtual void EndPage();
wxRect GetPaperRect(); wxRect GetPaperRect() const;
protected: protected:
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,

View File

@@ -300,12 +300,12 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& data)
{ {
} }
wxRect wxPrinterDC::GetPaperRect() wxRect wxPrinterDC::GetPaperRect() const
{ {
return GetImpl()->GetPaperRect(); return GetImpl()->GetPaperRect();
} }
int wxPrinterDC::GetResolution() int wxPrinterDC::GetResolution() const
{ {
return GetImpl()->GetResolution(); return GetImpl()->GetResolution();
} }

View File

@@ -342,7 +342,7 @@ bool wxPostScriptDCImpl::IsOk() const
return m_ok; return m_ok;
} }
wxRect wxPostScriptDCImpl::GetPaperRect() wxRect wxPostScriptDCImpl::GetPaperRect() const
{ {
int w = 0; int w = 0;
int h = 0; int h = 0;
@@ -350,7 +350,7 @@ wxRect wxPostScriptDCImpl::GetPaperRect()
return wxRect(0,0,w,h); return wxRect(0,0,w,h);
} }
int wxPostScriptDCImpl::GetResolution() int wxPostScriptDCImpl::GetResolution() const
{ {
return DPI; return DPI;
} }

View File

@@ -2015,12 +2015,12 @@ void wxGnomePrinterDCImpl::SetPrintData(const wxPrintData& data)
// overridden for wxPrinterDC Impl // overridden for wxPrinterDC Impl
int wxGnomePrinterDCImpl::GetResolution() int wxGnomePrinterDCImpl::GetResolution() const
{ {
return DPI; return DPI;
} }
wxRect wxGnomePrinterDCImpl::GetPaperRect() wxRect wxGnomePrinterDCImpl::GetPaperRect() const
{ {
// GNOME print doesn't support printer margins // GNOME print doesn't support printer margins
int w = 0; int w = 0;

View File

@@ -1074,7 +1074,7 @@ wxDC* wxGtkPrinter::PrintDialog( wxWindow *parent )
} }
m_printDialogData = dialog.GetPrintDialogData(); m_printDialogData = dialog.GetPrintDialogData();
return new wxPrinterDC( m_printDialogData.GetPrintData() ); return new wxPrinterDC( m_printDialogData.GetPrintData() );
} }
@@ -1132,7 +1132,7 @@ wxGtkPrinterDCImpl::wxGtkPrinterDCImpl(wxPrinterDC *owner, const wxPrintData& da
#if wxCAIRO_SCALE #if wxCAIRO_SCALE
m_PS2DEV = 1.0; m_PS2DEV = 1.0;
m_DEV2PS = 1.0; m_DEV2PS = 1.0;
cairo_scale( m_cairo, 72.0 / (double)m_resolution, 72.0 / (double)m_resolution ); cairo_scale( m_cairo, 72.0 / (double)m_resolution, 72.0 / (double)m_resolution );
#else #else
m_PS2DEV = (double)m_resolution / 72.0; m_PS2DEV = (double)m_resolution / 72.0;
@@ -1866,7 +1866,7 @@ void wxGtkPrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCo
void wxGtkPrinterDCImpl::Clear() void wxGtkPrinterDCImpl::Clear()
{ {
// Clear does nothing for printing, but keep the code // Clear does nothing for printing, but keep the code
// for later reuse // for later reuse
/* /*
cairo_save(m_cairo); cairo_save(m_cairo);
cairo_set_operator (m_cairo, CAIRO_OPERATOR_SOURCE); cairo_set_operator (m_cairo, CAIRO_OPERATOR_SOURCE);
@@ -1902,7 +1902,7 @@ void wxGtkPrinterDCImpl::SetPen( const wxPen& pen )
m_pen = pen; m_pen = pen;
double width; double width;
if (m_pen.GetWidth() <= 0) if (m_pen.GetWidth() <= 0)
width = 0.1; width = 0.1;
else else
@@ -2251,7 +2251,7 @@ void wxGtkPrinterDCImpl::SetPrintData(const wxPrintData& data)
// overriden for wxPrinterDC Impl // overriden for wxPrinterDC Impl
wxRect wxGtkPrinterDCImpl::GetPaperRect() wxRect wxGtkPrinterDCImpl::GetPaperRect() const
{ {
// Does GtkPrint support printer margins? // Does GtkPrint support printer margins?
int w = 0; int w = 0;
@@ -2260,7 +2260,7 @@ wxRect wxGtkPrinterDCImpl::GetPaperRect()
return wxRect( 0,0,w,h ); return wxRect( 0,0,w,h );
} }
int wxGtkPrinterDCImpl::GetResolution() int wxGtkPrinterDCImpl::GetResolution() const
{ {
return m_resolution; return m_resolution;
} }
@@ -2357,7 +2357,7 @@ void wxGtkPrintPreview::DetermineScaling()
wxSize sizeDevUnits(paper->GetSizeDeviceUnits()); wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
sizeDevUnits.x = wxRound((double)sizeDevUnits.x * (double)m_resolution / 72.0); sizeDevUnits.x = wxRound((double)sizeDevUnits.x * (double)m_resolution / 72.0);
sizeDevUnits.y = wxRound((double)sizeDevUnits.y * (double)m_resolution / 72.0); sizeDevUnits.y = wxRound((double)sizeDevUnits.y * (double)m_resolution / 72.0);
wxSize sizeTenthsMM(paper->GetSize()); wxSize sizeTenthsMM(paper->GetSize());
wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10); wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);

View File

@@ -228,7 +228,7 @@ void wxPrinterDCImpl::EndPage()
} }
wxRect wxPrinterDCImpl::GetPaperRect() wxRect wxPrinterDCImpl::GetPaperRect() const
{ {
if (!IsOk()) return wxRect(0, 0, 0, 0); if (!IsOk()) return wxRect(0, 0, 0, 0);

View File

@@ -138,7 +138,7 @@ void wxPrinterDCImpl::EndPage()
// ::EndPage((HDC) m_hDC); // ::EndPage((HDC) m_hDC);
} // end of wxPrinterDC::EndPage } // end of wxPrinterDC::EndPage
wxRect wxPrinterDCImpl::GetPaperRect() wxRect wxPrinterDCImpl::GetPaperRect() const
{ {
// Use page rect if we can't get paper rect. // Use page rect if we can't get paper rect.
wxCoord w, h; wxCoord w, h;

View File

@@ -85,7 +85,7 @@ wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data )
PMResolution res; 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 ) if ( PMPrinterGetOutputResolution != NULL )
{ {
PMPrinter printer; PMPrinter printer;
@@ -103,11 +103,11 @@ wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data )
else else
#endif #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); m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res);
#endif #endif
} }
m_ppi = wxSize(int(res.hRes), int(res.vRes)); 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, m_err = PMSessionBeginCGDocumentNoDialog(native->m_macPrintSession,
native->m_macPrintSettings, native->m_macPrintSettings,
native->m_macPageFormat); native->m_macPageFormat);
if ( m_err != noErr ) if ( m_err != noErr )
return false; return false;
@@ -148,7 +148,7 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message
m_maxY = wxCoord(rPage.bottom - rPage.top); m_maxY = wxCoord(rPage.bottom - rPage.top);
PMResolution res; 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 ) if ( PMPrinterGetOutputResolution != NULL )
{ {
PMPrinter printer; PMPrinter printer;
@@ -166,7 +166,7 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message
else else
#endif #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); m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res);
#endif #endif
} }
@@ -256,7 +256,7 @@ void wxMacCarbonPrinterDC::GetSize( int *w , int *h) const
*h = m_maxY ; *h = m_maxY ;
} }
wxSize wxMacCarbonPrinterDC::GetPPI() const wxSize wxMacCarbonPrinterDC::GetPPI() const
{ {
return m_ppi ; return m_ppi ;
}; };
@@ -286,7 +286,7 @@ wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printda
{ {
wxSize sz = GetPPI(); wxSize sz = GetPPI();
m_mm_to_pix_x = mm2inches * sz.x; 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 // we need at least a measuring context because people start measuring before a page
// gets printed at all // gets printed at all
@@ -344,7 +344,7 @@ void wxPrinterDCImpl::EndDoc(void)
} }
} }
wxRect wxPrinterDCImpl::GetPaperRect() wxRect wxPrinterDCImpl::GetPaperRect() const
{ {
wxCoord w, h; wxCoord w, h;
GetOwner()->GetSize(&w, &h); GetOwner()->GetSize(&w, &h);

View File

@@ -100,7 +100,7 @@ void wxPrinterDC::EndPage()
{ {
} }
wxRect wxPrinterDC::GetPaperRect() wxRect wxPrinterDC::GetPaperRect() const
{ {
// Use page rect if we can't get paper rect. // Use page rect if we can't get paper rect.
wxCoord w, h; wxCoord w, h;