From c929ad91417a4ee797652d79300c0c23219a46fd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 16 Nov 2010 22:38:32 +0000 Subject: [PATCH] Correct checks for wxUSE_PRINTING_ARCHITECTURE and wxUSE_ENH_METAFILE. Compilation fixes for building without one or both of these symbols. See #12664. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66172 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/graphics.h | 10 ++++++---- include/wx/msw/printwin.h | 2 ++ src/common/graphcmn.cpp | 5 ++--- src/msw/graphics.cpp | 12 +++++++++++- src/msw/printwin.cpp | 8 +++++--- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/include/wx/graphics.h b/include/wx/graphics.h index b42c0ad1de..af13285028 100644 --- a/include/wx/graphics.h +++ b/include/wx/graphics.h @@ -57,6 +57,8 @@ class WXDLLIMPEXP_FWD_CORE wxWindowDC; class WXDLLIMPEXP_FWD_CORE wxMemoryDC; #if wxUSE_PRINTING_ARCHITECTURE class WXDLLIMPEXP_FWD_CORE wxPrinterDC; +#endif +#if wxUSE_ENH_METAFILE class WXDLLIMPEXP_FWD_CORE wxEnhMetaFileDC; #endif class WXDLLIMPEXP_FWD_CORE wxGraphicsContext; @@ -393,10 +395,10 @@ public: static wxGraphicsContext * Create( const wxMemoryDC& dc); #if wxUSE_PRINTING_ARCHITECTURE static wxGraphicsContext * Create( const wxPrinterDC& dc); -#ifdef __WXMSW__ +#endif +#if wxUSE_ENH_METAFILE static wxGraphicsContext * Create( const wxEnhMetaFileDC& dc); #endif -#endif // wxUSE_PRINTING_ARCHITECTURE static wxGraphicsContext* CreateFromNative( void * context ); @@ -714,10 +716,10 @@ public: virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0; #if wxUSE_PRINTING_ARCHITECTURE virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0; -#ifdef __WXMSW__ +#endif +#if wxUSE_ENH_METAFILE virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc) = 0; #endif -#endif // wxUSE_PRINTING_ARCHITECTURE virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0; diff --git a/include/wx/msw/printwin.h b/include/wx/msw/printwin.h index d515ef25a3..d902c42c46 100644 --- a/include/wx/msw/printwin.h +++ b/include/wx/msw/printwin.h @@ -56,7 +56,9 @@ public: virtual void DetermineScaling(); protected: +#if wxUSE_ENH_METAFILE virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum); +#endif DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview) }; diff --git a/src/common/graphcmn.cpp b/src/common/graphcmn.cpp index 0c24351e7e..99a42c8a95 100644 --- a/src/common/graphcmn.cpp +++ b/src/common/graphcmn.cpp @@ -870,16 +870,15 @@ wxGraphicsBitmap wxGraphicsContext::CreateSubBitmap( const wxGraphicsBitmap &bmp { return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc); } +#endif -#ifdef __WXMSW__ +#if wxUSE_ENH_METAFILE /* static */ wxGraphicsContext* wxGraphicsContext::Create( const wxEnhMetaFileDC& dc) { return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc); } #endif -#endif // wxUSE_PRINTING_ARCHITECTURE - wxGraphicsContext* wxGraphicsContext::CreateFromNative( void * context ) { return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromNativeContext(context); diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index d0c3c643ba..52c809b805 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -40,7 +40,9 @@ #include "wx/private/graphics.h" #include "wx/msw/wrapgdip.h" #include "wx/msw/dc.h" -#include "wx/msw/enhmeta.h" +#if wxUSE_ENH_METAFILE + #include "wx/msw/enhmeta.h" +#endif #include "wx/dcgraph.h" #include "wx/msw/private.h" // needs to be before #include @@ -1630,9 +1632,13 @@ public : virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc); +#if wxUSE_PRINTING_ARCHITECTURE virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc); +#endif +#if wxUSE_ENH_METAFILE virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc); +#endif virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ); @@ -1758,6 +1764,7 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxWindowDC& dc) return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y); } +#if wxUSE_PRINTING_ARCHITECTURE wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxPrinterDC& dc) { ENSURE_LOADED_OR_RETURN(NULL); @@ -1765,7 +1772,9 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxPrinterDC& dc) wxSize sz = dc.GetSize(); return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y); } +#endif +#if wxUSE_ENH_METAFILE wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxEnhMetaFileDC& dc) { ENSURE_LOADED_OR_RETURN(NULL); @@ -1773,6 +1782,7 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxEnhMetaFileDC& dc) wxSize sz = dc.GetSize(); return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y); } +#endif wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxMemoryDC& dc) { diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp index 5dba0607ba..9018f7de70 100644 --- a/src/msw/printwin.cpp +++ b/src/msw/printwin.cpp @@ -49,8 +49,9 @@ #include "wx/msw/printdlg.h" #include "wx/msw/private.h" #include "wx/msw/dcprint.h" -#include "wx/msw/enhmeta.h" - +#if wxUSE_ENH_METAFILE + #include "wx/msw/enhmeta.h" +#endif #include // --------------------------------------------------------------------------- @@ -390,6 +391,7 @@ void wxWindowsPrintPreview::DetermineScaling() m_previewScaleY = float(logPPIScreenY) / logPPIPrinterY; } +#if wxUSE_ENH_METAFILE bool wxWindowsPrintPreview::RenderPageIntoBitmap(wxBitmap& bmp, int pageNum) { // The preview, as implemented in wxPrintPreviewBase (and as used prior to @@ -435,7 +437,7 @@ bool wxWindowsPrintPreview::RenderPageIntoBitmap(wxBitmap& bmp, int pageNum) return true; } - +#endif // wxUSE_ENH_METAFILE BOOL CALLBACK wxAbortProc(HDC WXUNUSED(hdc), int WXUNUSED(error)) {