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:
parent
e9cc4973ff
commit
6d52ca536a
@ -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
|
||||
|
@ -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) { }
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
int orientation = wxPORTRAIT);
|
||||
virtual ~wxPrinterDC();
|
||||
|
||||
wxRect GetPaperRect();
|
||||
wxRect GetPaperRect() const;
|
||||
|
||||
DECLARE_CLASS(wxPrinterDCImpl)
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -228,7 +228,7 @@ void wxPrinterDCImpl::EndPage()
|
||||
}
|
||||
|
||||
|
||||
wxRect wxPrinterDCImpl::GetPaperRect()
|
||||
wxRect wxPrinterDCImpl::GetPaperRect() const
|
||||
|
||||
{
|
||||
if (!IsOk()) return wxRect(0, 0, 0, 0);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user