aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-19 14:12:20 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-19 14:12:20 +1100
commit6b444111ecfe47a3f94293c3959cf197e3415735 (patch)
treebf90b6915dcb2f45f22d3e2377a4252ec80c9259
parent9659ea34246320bd9872740d1ee6a5c9ae9066c6 (diff)
downloadscintilla-mirror-6b444111ecfe47a3f94293c3959cf197e3415735.tar.gz
Add Platform::Supports for SupportsFeature API.
-rw-r--r--cocoa/PlatCocoa.h1
-rw-r--r--cocoa/PlatCocoa.mm14
-rwxr-xr-xgtk/PlatGTK.cxx14
-rw-r--r--include/Scintilla.h1
-rw-r--r--include/Scintilla.iface1
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp13
-rw-r--r--qt/ScintillaEditBase/PlatQt.h1
-rw-r--r--src/Editor.cxx5
-rw-r--r--src/Platform.h1
-rw-r--r--win32/PlatWin.cxx19
-rw-r--r--win32/deps.mak2
-rw-r--r--win32/nmdeps.mak2
12 files changed, 72 insertions, 2 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h
index 0117fcc15..18d339536 100644
--- a/cocoa/PlatCocoa.h
+++ b/cocoa/PlatCocoa.h
@@ -79,6 +79,7 @@ public:
CGContextRef GetContext() { return gc; }
void Release() noexcept override;
+ int Supports(int feature) noexcept override;
bool Initialised() override;
void PenColour(ColourDesired fore) override;
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 2f8778d11..33c24397f 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -319,6 +319,10 @@ void GetPositions(CTLineRef line, std::vector<CGFloat> &positions) {
positions.begin(), std::plus<CGFloat>());
}
+const int SupportsCocoa[] = {
+ SC_SUPPORTS_LINE_DRAWS_FINAL,
+};
+
}
//----------------- SurfaceImpl --------------------------------------------------------------------
@@ -452,6 +456,16 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID
//--------------------------------------------------------------------------------------------------
+int SurfaceImpl::Supports(int feature) noexcept {
+ for (const int f : SupportsCocoa) {
+ if (f == feature)
+ return 1;
+ }
+ return 0;
+}
+
+//--------------------------------------------------------------------------------------------------
+
void SurfaceImpl::PenColour(ColourDesired fore) {
if (gc) {
ColourDesired colour(fore.AsInteger());
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index 6aed67ba5..19b25294b 100755
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -151,6 +151,7 @@ public:
void Clear() noexcept;
void Release() noexcept override;
+ int Supports(int feature) noexcept override;
bool Initialised() override;
void PenColour(ColourDesired fore) override;
int LogPixelsY() override;
@@ -190,6 +191,11 @@ public:
void SetDBCSMode(int codePage) override;
void SetBidiR2L(bool bidiR2L_) override;
};
+
+const int SupportsGTK[] = {
+ SC_SUPPORTS_LINE_DRAWS_FINAL,
+};
+
}
const char *CharacterSetID(int characterSet) noexcept {
@@ -367,6 +373,14 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID
et = surfImpl->et;
}
+int SurfaceImpl::Supports(int feature) noexcept {
+ for (const int f : SupportsGTK) {
+ if (f == feature)
+ return 1;
+ }
+ return 0;
+}
+
void SurfaceImpl::PenColour(ColourDesired fore) {
if (context) {
const ColourDesired cdFore(fore.AsInteger());
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 0e61d0bbc..d586e8fe8 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -1018,6 +1018,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_EOLANNOTATIONGETVISIBLE 2746
#define SCI_EOLANNOTATIONSETSTYLEOFFSET 2747
#define SCI_EOLANNOTATIONGETSTYLEOFFSET 2748
+#define SC_SUPPORTS_LINE_DRAWS_FINAL 0
#define SCI_SUPPORTSFEATURE 2750
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 1fca9bf32..44d00500b 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -2876,6 +2876,7 @@ set void EOLAnnotationSetStyleOffset=2747(int style,)
get int EOLAnnotationGetStyleOffset=2748(,)
enu Supports=SC_SUPPORTS_
+val SC_SUPPORTS_LINE_DRAWS_FINAL=0
# Get whether a feature is supported
get int SupportsFeature=2750(Supports feature,)
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index 52cb54bf7..b7d0e3a53 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -133,6 +133,10 @@ public:
namespace {
+const int SupportsQt[] = {
+ SC_SUPPORTS_LINE_DRAWS_FINAL,
+};
+
const FontAndCharacterSet *AsFontAndCharacterSet(const Font *f) {
return dynamic_cast<const FontAndCharacterSet *>(f);
}
@@ -205,6 +209,15 @@ void SurfaceImpl::Release() noexcept
Clear();
}
+int SurfaceImpl::Supports(int feature) noexcept
+{
+ for (const int f : SupportsQt) {
+ if (f == feature)
+ return 1;
+ }
+ return 0;
+}
+
bool SurfaceImpl::Initialised()
{
return device != nullptr;
diff --git a/qt/ScintillaEditBase/PlatQt.h b/qt/ScintillaEditBase/PlatQt.h
index 844418343..ae0994b32 100644
--- a/qt/ScintillaEditBase/PlatQt.h
+++ b/qt/ScintillaEditBase/PlatQt.h
@@ -90,6 +90,7 @@ public:
Surface *surface, WindowID wid) override;
void Release() noexcept override;
+ int Supports(int feature) noexcept override;
bool Initialised() override;
void PenColour(ColourDesired fore) override;
int LogPixelsY() override;
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 2001eafaf..5877239f0 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -5190,8 +5190,9 @@ void Editor::QueueIdleWork(WorkItems items, Sci::Position upTo) {
workNeeded.Need(items, upTo);
}
-int Editor::SupportsFeature(int /* feature */) {
- return 0;
+int Editor::SupportsFeature(int feature) {
+ AutoSurface surface(this);
+ return surface->Supports(feature);
}
bool Editor::PaintContains(PRectangle rc) {
diff --git a/src/Platform.h b/src/Platform.h
index f65a4e1db..8075f0ec6 100644
--- a/src/Platform.h
+++ b/src/Platform.h
@@ -180,6 +180,7 @@ public:
virtual void InitPixMap(int width, int height, Surface *surface_, WindowID wid)=0;
virtual void Release() noexcept=0;
+ virtual int Supports(int feature) noexcept=0;
virtual bool Initialised()=0;
virtual void PenColour(ColourDesired fore)=0;
virtual int LogPixelsY()=0;
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index f7520ad9a..452bb49bc 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -48,6 +48,7 @@
#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
+#include "Scintilla.h"
#include "XPM.h"
#include "UniConversion.h"
#include "DBCS.h"
@@ -477,6 +478,7 @@ public:
void InitPixMap(int width, int height, Surface *surface_, WindowID wid) override;
void Release() noexcept override;
+ int Supports(int feature) noexcept override;
bool Initialised() override;
void PenColour(ColourDesired fore) override;
int LogPixelsY() override;
@@ -559,6 +561,10 @@ void SurfaceGDI::Release() noexcept {
Clear();
}
+int SurfaceGDI::Supports(int /* feature */) noexcept {
+ return 0;
+}
+
bool SurfaceGDI::Initialised() {
return hdc != 0;
}
@@ -1108,6 +1114,10 @@ constexpr D2D1_RECT_F RectangleFromPRectangle(PRectangle rc) noexcept {
return { rc.left, rc.top, rc.right, rc.bottom };
}
+const int SupportsD2D[] = {
+ SC_SUPPORTS_LINE_DRAWS_FINAL,
+};
+
}
class BlobInline;
@@ -1152,6 +1162,7 @@ public:
void InitPixMap(int width, int height, Surface *surface_, WindowID wid) override;
void Release() noexcept override;
+ int Supports(int feature) noexcept override;
bool Initialised() override;
HRESULT FlushDrawing();
@@ -1248,6 +1259,14 @@ void SurfaceD2D::SetScale(WindowID wid) noexcept {
logPixelsY = DpiForWindow(wid);
}
+int SurfaceD2D::Supports(int feature) noexcept {
+ for (const int f : SupportsD2D) {
+ if (f == feature)
+ return 1;
+ }
+ return 0;
+}
+
bool SurfaceD2D::Initialised() {
return pRenderTarget != nullptr;
}
diff --git a/win32/deps.mak b/win32/deps.mak
index af07609e1..3939a81fd 100644
--- a/win32/deps.mak
+++ b/win32/deps.mak
@@ -8,6 +8,8 @@ PlatWin.o: \
../src/Debugging.h \
../src/Geometry.h \
../src/Platform.h \
+ ../include/Scintilla.h \
+ ../include/Sci_Position.h \
../src/XPM.h \
../src/UniConversion.h \
../src/DBCS.h \
diff --git a/win32/nmdeps.mak b/win32/nmdeps.mak
index d9ba665f5..1e72661fc 100644
--- a/win32/nmdeps.mak
+++ b/win32/nmdeps.mak
@@ -8,6 +8,8 @@ $(DIR_O)/PlatWin.obj: \
../src/Debugging.h \
../src/Geometry.h \
../src/Platform.h \
+ ../include/Scintilla.h \
+ ../include/Sci_Position.h \
../src/XPM.h \
../src/UniConversion.h \
../src/DBCS.h \