From c02f75227ef151af1b283e4436d06149e69679a7 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 27 Mar 2021 08:48:56 +1100 Subject: Add API for setting stroke width of indicators. --- src/Editor.cxx | 13 +++++++++++++ src/Indicator.cxx | 1 - src/Indicator.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src') 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(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 : -- cgit v1.2.3