From 53bdcb15b3fd50dbc917e652953f1df4a5a5e493 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 22 Mar 2021 13:30:27 +1100 Subject: Implement more support values. --- cocoa/PlatCocoa.mm | 2 ++ doc/ScintillaDoc.html | 39 ++++++++++++++++++++++++++++++++++++++- doc/ScintillaHistory.html | 4 ++++ gtk/PlatGTK.cxx | 2 ++ include/Scintilla.h | 2 ++ include/Scintilla.iface | 2 ++ qt/ScintillaEditBase/PlatQt.cpp | 2 ++ win32/PlatWin.cxx | 2 ++ 8 files changed, 54 insertions(+), 1 deletion(-) diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index acfda1e86..c9cca0ded 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -343,6 +343,8 @@ void GetPositions(CTLineRef line, std::vector &positions) { const int SupportsCocoa[] = { SC_SUPPORTS_LINE_DRAWS_FINAL, SC_SUPPORTS_PIXEL_DIVISIONS, + SC_SUPPORTS_FRACTIONAL_STROKE_WIDTH, + SC_SUPPORTS_TRANSLUCENT_STROKE, }; } diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 529859a5c..f5b20d087 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -119,7 +119,7 @@

Scintilla Documentation

-

Last edited 16 March 2021 NH

+

Last edited 22 March 2021 NH

Scintilla 5 has moved the lexers from Scintilla into a new Lexilla project.
@@ -3886,6 +3886,7 @@ struct Sci_TextToFind { SCI_GRABFOCUS
SCI_SETFOCUS(bool focus)
SCI_GETFOCUS → bool
+ SCI_SUPPORTSFEATURE(int feature) → bool

To forward a message (WM_XXXX, WPARAM, LPARAM) to Scintilla, you can use @@ -4044,6 +4045,42 @@ struct Sci_TextToFind { that have complex focus requirements such as having their own window that gets the real focus but with the need to indicate that Scintilla has the logical focus.

+

SCI_SUPPORTSFEATURE(int feature) → bool
+ Different platforms support different features and SCI_SUPPORTSFEATURE + can be used to check which are currently available. + For example, on Win32, Direct2D supports drawing translucent lines but GDI does not so + SCI_SUPPORTSFEATURE(SC_SUPPORTS_TRANSLUCENT_STROKE) + will return 1 for Direct2D and 0 for GDI. Its possible that translucent line drawing will be implemented in a future + revision to the GDI platform layer or will be implmented on particular Windows versions. + This call allows applications to tailor their settings: perhaps displaying a box with translucent coloured fill on Direct2D but + a hollow box on GDI.

+

The features that can be queried are:

+ + + + + + + + + + + + + + + + + + + + + + + +
SC_SUPPORTS_LINE_DRAWS_FINALWhether drawing a line draws its final position. Only false on Win32 GDI.
SC_SUPPORTS_PIXEL_DIVISIONSAre logical pixels larger than physical pixels? Currently only true for macOS Cocoa with 'retina' displays. + When true, creating pixmaps at twice the resolution can produce clearer output with less blur.
SC_SUPPORTS_FRACTIONAL_STROKE_WIDTHCan lines be drawn with fractional widths like 1.5 or 0.5 pixels?
SC_SUPPORTS_TRANSLUCENT_STROKECan translucent lines, polygons, and ellipses, be drawn?
+

Brace highlighting

SCI_BRACEHIGHLIGHT(position posA, position posB)
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 2159127a8..b643dce10 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -589,6 +589,10 @@ Add methods for encoding conversion. Use these changes to improve appearance. +
  • + Add SCI_SUPPORTSFEATURE method to allow applications to determine which features are available + and to then choose workarounds for missing features like translucent drawing. +
  • Release 5.0.0 diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 66a1666f5..f9c0a09f7 100755 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -225,6 +225,8 @@ public: const int SupportsGTK[] = { SC_SUPPORTS_LINE_DRAWS_FINAL, + SC_SUPPORTS_FRACTIONAL_STROKE_WIDTH, + SC_SUPPORTS_TRANSLUCENT_STROKE, }; } diff --git a/include/Scintilla.h b/include/Scintilla.h index da104a552..edf41c5cf 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -1020,6 +1020,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_EOLANNOTATIONGETSTYLEOFFSET 2748 #define SC_SUPPORTS_LINE_DRAWS_FINAL 0 #define SC_SUPPORTS_PIXEL_DIVISIONS 1 +#define SC_SUPPORTS_FRACTIONAL_STROKE_WIDTH 2 +#define SC_SUPPORTS_TRANSLUCENT_STROKE 3 #define SCI_SUPPORTSFEATURE 2750 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 6868dec0b..d386003e2 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2878,6 +2878,8 @@ get int EOLAnnotationGetStyleOffset=2748(,) enu Supports=SC_SUPPORTS_ val SC_SUPPORTS_LINE_DRAWS_FINAL=0 val SC_SUPPORTS_PIXEL_DIVISIONS=1 +val SC_SUPPORTS_FRACTIONAL_STROKE_WIDTH=2 +val SC_SUPPORTS_TRANSLUCENT_STROKE=3 # 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 248fcf194..d8925c247 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -135,6 +135,8 @@ namespace { const int SupportsQt[] = { SC_SUPPORTS_LINE_DRAWS_FINAL, + SC_SUPPORTS_FRACTIONAL_STROKE_WIDTH, + SC_SUPPORTS_TRANSLUCENT_STROKE, }; const FontAndCharacterSet *AsFontAndCharacterSet(const Font *f) { diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 1e6dd06b4..d60b35325 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1393,6 +1393,8 @@ constexpr D2D1_RECT_F RectangleFromPRectangle(PRectangle rc) noexcept { const int SupportsD2D[] = { SC_SUPPORTS_LINE_DRAWS_FINAL, + SC_SUPPORTS_FRACTIONAL_STROKE_WIDTH, + SC_SUPPORTS_TRANSLUCENT_STROKE, }; constexpr D2D_COLOR_F ColorFromColourAlpha(ColourAlpha colour) noexcept { -- cgit v1.2.3