aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaDoc.html23
-rw-r--r--doc/ScintillaHistory.html3
-rw-r--r--include/Scintilla.h2
-rw-r--r--include/Scintilla.iface6
-rw-r--r--src/Editor.cxx13
-rw-r--r--src/Indicator.cxx1
-rw-r--r--src/Indicator.h1
7 files changed, 47 insertions, 2 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index e869d069e..ea1484501 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -119,7 +119,7 @@
<h1>Scintilla Documentation</h1>
- <p>Last edited 22 March 2021 NH</p>
+ <p>Last edited 27 March 2021 NH</p>
<p style="background:#90F0C0">Scintilla 5 has moved the lexers from Scintilla into a new
<a href="Lexilla.html">Lexilla</a> project.<br />
@@ -4657,6 +4657,8 @@ struct Sci_TextToFind {
<a class="message" href="#SCI_INDICSETFORE">SCI_INDICSETFORE(int indicator, colour
fore)</a><br />
<a class="message" href="#SCI_INDICGETFORE">SCI_INDICGETFORE(int indicator) &rarr; colour</a><br />
+ <a class="message" href="#SCI_INDICSETSTROKEWIDTH">SCI_INDICSETSTROKEWIDTH(int indicator, int hundredths)</a><br />
+ <a class="message" href="#SCI_INDICGETSTROKEWIDTH">SCI_INDICGETSTROKEWIDTH(int indicator) &rarr; int</a><br />
<a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicator, alpha alpha)</a><br />
<a class="message" href="#SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicator) &rarr; int</a><br />
<a class="message" href="#SCI_INDICSETOUTLINEALPHA">SCI_INDICSETOUTLINEALPHA(int indicator, alpha alpha)</a><br />
@@ -4926,6 +4928,25 @@ struct Sci_TextToFind {
<code>SCI_INDICSETFORE(1, 0xff0000);</code> (light blue)<br />
<code>SCI_INDICSETFORE(2, 0x0000ff);</code> (light red)</p>
+ <a class="message" href="#SCI_INDICSETSTROKEWIDTH">SCI_INDICSETSTROKEWIDTH(int indicator, int hundredths)</a><br />
+ <a class="message" href="#SCI_INDICGETSTROKEWIDTH">SCI_INDICGETSTROKEWIDTH(int indicator) &rarr; int</a><br />
+ <p><b id="SCI_INDICSETSTROKEWIDTH">SCI_INDICSETSTROKEWIDTH(int indicator, int hundredths)</b><br />
+ <b id="SCI_INDICGETSTROKEWIDTH">SCI_INDICGETSTROKEWIDTH(int indicator) &rarr; int</b><br />
+ These two messages set and get the stroke width used to draw an indicator in hundredths of a pixel.
+ The default value is 100 indicating a width of one pixel.
+ Some indicator styles do not support setting stroke width, generally where it makes no sense (<code>INDIC_POINT</code>) or
+ wasn't simple (<code>INDIC_SQUIGGLEPIXMAP</code>).
+ The indicators supporting stroke width are:
+ <code>INDIC_PLAIN</code>, <code>INDIC_SQUIGGLE</code>, <code>INDIC_TT</code>, <code>INDIC_DIAGONAL</code>,
+ <code>INDIC_STRIKE</code>, <code>INDIC_BOX</code>, <code>INDIC_ROUNDBOX</code>, <code>INDIC_STRAIGHTBOX</code>,
+ <code>INDIC_FULLBOX</code>, <code>INDIC_DASH</code>, <code>INDIC_DOTS</code>, <code>INDIC_SQUIGGLELOW</code>.
+ </p>
+ <p>Fractional pixel widths are possible such as 50 for half a pixel wide.
+ On many systems a half pixel value will appear as a fainter line but it allows drawing very thin lines on systems with multiple physical pixels
+ per logical pixel.
+ Half (logical) pixel lines are available on macOS with 'retina' displays,
+ see <a class="seealso" href="#SCI_SUPPORTSFEATURE">SC_SUPPORTS_PIXEL_DIVISIONS</a>.</p>
+
<p><b id="SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicator, <a class="jump" href="#alpha">alpha</a> alpha)</b><br />
<b id="SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicator) &rarr; int</b><br />
These two messages set and get the alpha transparency used for drawing the
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index b63a6c69a..47f16e0ce 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -597,6 +597,9 @@
Add colouralpha type to Scintilla.iface for APIs that set both colour and transparency together as an RGBA value.
</li>
<li>
+ Add SCI_INDICSETSTROKEWIDTH to set stroke width of indicators.
+ </li>
+ <li>
Change graphics coordinates from float (32-bit) to double (64-bit).
Fixes uneven line heights in large documents on Cocoa.
Increases memory use.
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 81869efec..69dc2d057 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -328,6 +328,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_INDICFLAG_VALUEFORE 1
#define SCI_INDICSETFLAGS 2684
#define SCI_INDICGETFLAGS 2685
+#define SCI_INDICSETSTROKEWIDTH 2751
+#define SCI_INDICGETSTROKEWIDTH 2752
#define SCI_SETWHITESPACEFORE 2084
#define SCI_SETWHITESPACEBACK 2085
#define SCI_SETWHITESPACESIZE 2086
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index d11bbc79a..23938bfd9 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -813,6 +813,12 @@ set void IndicSetFlags=2684(int indicator, IndicFlag flags)
# Retrieve the attributes of an indicator.
get IndicFlag IndicGetFlags=2685(int indicator,)
+# Set the stroke width of an indicator in hundredths of a pixel.
+set void IndicSetStrokeWidth=2751(int indicator, int hundredths)
+
+# Retrieve the stroke width of an indicator.
+get int IndicGetStrokeWidth=2752(int indicator,)
+
# Set the foreground colour of all whitespace and whether to use this setting.
fun void SetWhitespaceFore=2084(bool useSetting, colour fore)
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 44c80451b..7ad889c23 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -7518,6 +7518,19 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_INDICGETOUTLINEALPHA:
return (wParam <= INDICATOR_MAX) ? vs.indicators[wParam].outlineAlpha : 0;
+ case SCI_INDICSETSTROKEWIDTH:
+ if (wParam <= INDICATOR_MAX && lParam >= 0 && lParam <= 1000) {
+ vs.indicators[wParam].strokeWidth = lParam / 100.0f;
+ InvalidateStyleRedraw();
+ }
+ break;
+
+ case SCI_INDICGETSTROKEWIDTH:
+ if (wParam <= INDICATOR_MAX) {
+ return std::lround(vs.indicators[wParam].strokeWidth * 100);
+ }
+ break;
+
case SCI_SETINDICATORCURRENT:
pdoc->DecorationSetCurrentIndicator(static_cast<int>(wParam));
break;
diff --git a/src/Indicator.cxx b/src/Indicator.cxx
index 93bf68ed0..1ebc18b7f 100644
--- a/src/Indicator.cxx
+++ b/src/Indicator.cxx
@@ -36,7 +36,6 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
const int pixelDivisions = surface->PixelDivisions();
- const XYPOSITION strokeWidth = 1.0f;
const XYPOSITION halfWidth = strokeWidth / 2.0f;
const PRectangle rcAligned(PixelAlignOutside(rc, pixelDivisions));
diff --git a/src/Indicator.h b/src/Indicator.h
index 669d9a2d8..89cf1cdc5 100644
--- a/src/Indicator.h
+++ b/src/Indicator.h
@@ -33,6 +33,7 @@ public:
int fillAlpha;
int outlineAlpha;
int attributes;
+ XYPOSITION strokeWidth = 1.0f;
Indicator() noexcept : under(false), fillAlpha(30), outlineAlpha(50), attributes(0) {
}
Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept :