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/stc.h"
#include "wx/stc/private.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 "ScintillaWX.h"
#include <float.h> #include <float.h>
#include "wx/dcscreen.h" #include "wx/dcscreen.h"
@@ -165,11 +169,11 @@ void Font::Create(const FontParameters &fp) {
wxFontWithAscent* newFont = new wxFontWithAscent(font); wxFontWithAscent* newFont = new wxFontWithAscent(font);
fid = newFont; fid = newFont;
#if wxUSE_GRAPHICS_DIRECT2D #ifdef HAVE_DIRECTWRITE_TECHNOLOGY
if ( fp.technology == wxSTC_TECHNOLOGY_DIRECTWRITE ) { if ( fp.technology == wxSTC_TECHNOLOGY_DIRECTWRITE ) {
newFont->SetSurfaceFontData(new SurfaceFontDataD2D(fp)); 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; // dbcsMode = codePage == SC_CP_DBCS;
} }
#if wxUSE_GRAPHICS_DIRECT2D #ifdef HAVE_DIRECTWRITE_TECHNOLOGY
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// SurfaceFontDataD2D // 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) { Surface *Surface::Allocate(int technology) {
wxUnusedVar(technology); wxUnusedVar(technology);
#if wxUSE_GRAPHICS_DIRECT2D #ifdef HAVE_DIRECTWRITE_TECHNOLOGY
if ( technology == wxSTC_TECHNOLOGY_DIRECTWRITE ) { if ( technology == wxSTC_TECHNOLOGY_DIRECTWRITE ) {
return new SurfaceD2D; return new SurfaceD2D;
} }
#endif // wxUSE_GRAPHICS_DIRECT2D #endif // HAVE_DIRECTWRITE_TECHNOLOGY
return new SurfaceImpl; return new SurfaceImpl;
} }

View File

@@ -825,7 +825,7 @@ sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam)
} }
#endif #endif
#if wxUSE_GRAPHICS_DIRECT2D #if defined(__WXMSW__) && wxUSE_GRAPHICS_DIRECT2D
case SCI_SETTECHNOLOGY: case SCI_SETTECHNOLOGY:
if ((wParam == SC_TECHNOLOGY_DEFAULT) || (wParam == SC_TECHNOLOGY_DIRECTWRITE)) { if ((wParam == SC_TECHNOLOGY_DEFAULT) || (wParam == SC_TECHNOLOGY_DIRECTWRITE)) {
if (technology != static_cast<int>(wParam)) { if (technology != static_cast<int>(wParam)) {