Fix building stc library with WXQT

When using MSVC compiler, wxUSE_GRAPHICS_DIRECT2D is automatically enabled in setup.h.
But it is only available with WXMSW toolkit, not WXGTK or WXQT.
This commit is contained in:
Maarten Bent
2018-09-25 23:23:57 +02:00
parent 8f017509f6
commit 487a3854a3
2 changed files with 12 additions and 8 deletions

View File

@@ -44,7 +44,11 @@
#include "wx/stc/stc.h"
#include "wx/stc/private.h"
#if wxUSE_GRAPHICS_DIRECT2D
#if defined(__WXMSW__) && wxUSE_GRAPHICS_DIRECT2D
#define HAVE_DIRECTWRITE_TECHNOLOGY
#endif
#ifdef HAVE_DIRECTWRITE_TECHNOLOGY
#include "ScintillaWX.h"
#include <float.h>
#include "wx/dcscreen.h"
@@ -165,11 +169,11 @@ void Font::Create(const FontParameters &fp) {
wxFontWithAscent* newFont = new wxFontWithAscent(font);
fid = newFont;
#if wxUSE_GRAPHICS_DIRECT2D
#ifdef HAVE_DIRECTWRITE_TECHNOLOGY
if ( fp.technology == wxSTC_TECHNOLOGY_DIRECTWRITE ) {
newFont->SetSurfaceFontData(new SurfaceFontDataD2D(fp));
}
#endif // wxUSE_GRAPHICS_DIRECT2D
#endif // HAVE_DIRECTWRITE_TECHNOLOGY
}
@@ -694,7 +698,7 @@ void SurfaceImpl::SetDBCSMode(int WXUNUSED(codePage)) {
// dbcsMode = codePage == SC_CP_DBCS;
}
#if wxUSE_GRAPHICS_DIRECT2D
#ifdef HAVE_DIRECTWRITE_TECHNOLOGY
//----------------------------------------------------------------------
// SurfaceFontDataD2D
@@ -1805,16 +1809,16 @@ void SurfaceD2D::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase,
}
}
#endif // wxUSE_GRAPHICS_DIRECT2D
#endif // HAVE_DIRECTWRITE_TECHNOLOGY
Surface *Surface::Allocate(int technology) {
wxUnusedVar(technology);
#if wxUSE_GRAPHICS_DIRECT2D
#ifdef HAVE_DIRECTWRITE_TECHNOLOGY
if ( technology == wxSTC_TECHNOLOGY_DIRECTWRITE ) {
return new SurfaceD2D;
}
#endif // wxUSE_GRAPHICS_DIRECT2D
#endif // HAVE_DIRECTWRITE_TECHNOLOGY
return new SurfaceImpl;
}