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
This commit is contained in:
Vadim Zeitlin
2010-11-16 22:38:32 +00:00
parent 80e13ad372
commit c929ad9141
5 changed files with 26 additions and 11 deletions

View File

@@ -57,6 +57,8 @@ class WXDLLIMPEXP_FWD_CORE wxWindowDC;
class WXDLLIMPEXP_FWD_CORE wxMemoryDC; class WXDLLIMPEXP_FWD_CORE wxMemoryDC;
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
class WXDLLIMPEXP_FWD_CORE wxPrinterDC; class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
#endif
#if wxUSE_ENH_METAFILE
class WXDLLIMPEXP_FWD_CORE wxEnhMetaFileDC; class WXDLLIMPEXP_FWD_CORE wxEnhMetaFileDC;
#endif #endif
class WXDLLIMPEXP_FWD_CORE wxGraphicsContext; class WXDLLIMPEXP_FWD_CORE wxGraphicsContext;
@@ -393,10 +395,10 @@ public:
static wxGraphicsContext * Create( const wxMemoryDC& dc); static wxGraphicsContext * Create( const wxMemoryDC& dc);
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
static wxGraphicsContext * Create( const wxPrinterDC& dc); static wxGraphicsContext * Create( const wxPrinterDC& dc);
#ifdef __WXMSW__ #endif
#if wxUSE_ENH_METAFILE
static wxGraphicsContext * Create( const wxEnhMetaFileDC& dc); static wxGraphicsContext * Create( const wxEnhMetaFileDC& dc);
#endif #endif
#endif // wxUSE_PRINTING_ARCHITECTURE
static wxGraphicsContext* CreateFromNative( void * context ); static wxGraphicsContext* CreateFromNative( void * context );
@@ -714,10 +716,10 @@ public:
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0; virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0;
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0; virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0;
#ifdef __WXMSW__ #endif
#if wxUSE_ENH_METAFILE
virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc) = 0; virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc) = 0;
#endif #endif
#endif // wxUSE_PRINTING_ARCHITECTURE
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0; virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0;

View File

@@ -56,7 +56,9 @@ public:
virtual void DetermineScaling(); virtual void DetermineScaling();
protected: protected:
#if wxUSE_ENH_METAFILE
virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum); virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum);
#endif
DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview) DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview)
}; };

View File

@@ -870,16 +870,15 @@ wxGraphicsBitmap wxGraphicsContext::CreateSubBitmap( const wxGraphicsBitmap &bmp
{ {
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc); return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
} }
#endif
#ifdef __WXMSW__ #if wxUSE_ENH_METAFILE
/* static */ wxGraphicsContext* wxGraphicsContext::Create( const wxEnhMetaFileDC& dc) /* static */ wxGraphicsContext* wxGraphicsContext::Create( const wxEnhMetaFileDC& dc)
{ {
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc); return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
} }
#endif #endif
#endif // wxUSE_PRINTING_ARCHITECTURE
wxGraphicsContext* wxGraphicsContext::CreateFromNative( void * context ) wxGraphicsContext* wxGraphicsContext::CreateFromNative( void * context )
{ {
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromNativeContext(context); return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromNativeContext(context);

View File

@@ -40,7 +40,9 @@
#include "wx/private/graphics.h" #include "wx/private/graphics.h"
#include "wx/msw/wrapgdip.h" #include "wx/msw/wrapgdip.h"
#include "wx/msw/dc.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/dcgraph.h"
#include "wx/msw/private.h" // needs to be before #include <commdlg.h> #include "wx/msw/private.h" // needs to be before #include <commdlg.h>
@@ -1630,9 +1632,13 @@ public :
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc); virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc);
#if wxUSE_PRINTING_ARCHITECTURE
virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc); virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc);
#endif
#if wxUSE_ENH_METAFILE
virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc); virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc);
#endif
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ); 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); return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y);
} }
#if wxUSE_PRINTING_ARCHITECTURE
wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxPrinterDC& dc) wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxPrinterDC& dc)
{ {
ENSURE_LOADED_OR_RETURN(NULL); ENSURE_LOADED_OR_RETURN(NULL);
@@ -1765,7 +1772,9 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxPrinterDC& dc)
wxSize sz = dc.GetSize(); wxSize sz = dc.GetSize();
return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y); return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y);
} }
#endif
#if wxUSE_ENH_METAFILE
wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxEnhMetaFileDC& dc) wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxEnhMetaFileDC& dc)
{ {
ENSURE_LOADED_OR_RETURN(NULL); ENSURE_LOADED_OR_RETURN(NULL);
@@ -1773,6 +1782,7 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxEnhMetaFileDC& dc)
wxSize sz = dc.GetSize(); wxSize sz = dc.GetSize();
return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y); return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y);
} }
#endif
wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxMemoryDC& dc) wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxMemoryDC& dc)
{ {

View File

@@ -49,8 +49,9 @@
#include "wx/msw/printdlg.h" #include "wx/msw/printdlg.h"
#include "wx/msw/private.h" #include "wx/msw/private.h"
#include "wx/msw/dcprint.h" #include "wx/msw/dcprint.h"
#include "wx/msw/enhmeta.h" #if wxUSE_ENH_METAFILE
#include "wx/msw/enhmeta.h"
#endif
#include <stdlib.h> #include <stdlib.h>
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -390,6 +391,7 @@ void wxWindowsPrintPreview::DetermineScaling()
m_previewScaleY = float(logPPIScreenY) / logPPIPrinterY; m_previewScaleY = float(logPPIScreenY) / logPPIPrinterY;
} }
#if wxUSE_ENH_METAFILE
bool wxWindowsPrintPreview::RenderPageIntoBitmap(wxBitmap& bmp, int pageNum) bool wxWindowsPrintPreview::RenderPageIntoBitmap(wxBitmap& bmp, int pageNum)
{ {
// The preview, as implemented in wxPrintPreviewBase (and as used prior to // The preview, as implemented in wxPrintPreviewBase (and as used prior to
@@ -435,7 +437,7 @@ bool wxWindowsPrintPreview::RenderPageIntoBitmap(wxBitmap& bmp, int pageNum)
return true; return true;
} }
#endif // wxUSE_ENH_METAFILE
BOOL CALLBACK wxAbortProc(HDC WXUNUSED(hdc), int WXUNUSED(error)) BOOL CALLBACK wxAbortProc(HDC WXUNUSED(hdc), int WXUNUSED(error))
{ {