From d08e0385d664dd33aeee88794fd065e3696cb435 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 22 May 2018 11:52:51 +1000 Subject: Backport: Add INDIC_GRADIENT and INDIC_GRADIENTCENTRE indicator types. Backport of changeset 6966:872900d3ceb0. --- doc/Indicators.png | Bin 11206 -> 13819 bytes doc/ScintillaDoc.html | 17 +++++++++++++++++ doc/ScintillaHistory.html | 7 +++++++ include/Scintilla.h | 2 ++ include/Scintilla.iface | 2 ++ src/Indicator.cxx | 21 +++++++++++++++++++++ 6 files changed, 49 insertions(+) diff --git a/doc/Indicators.png b/doc/Indicators.png index a1f68679a..541e3de62 100644 Binary files a/doc/Indicators.png and b/doc/Indicators.png differ diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index d019a5688..01d2ae108 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -4446,6 +4446,23 @@ struct Sci_TextToFind { To avoid excessive memory allocation the maximum width of a dotted box is 4000 pixels. + + INDIC_GRADIENT + + 20 + + A vertical gradient between a colour and alpha at top to fully transparent at bottom. + + + + INDIC_GRADIENTCENTRE + + 21 + + A vertical gradient with the specified colour and alpha in the middle + fading to fully transparent at top and bottom. + + INDIC_SQUIGGLEPIXMAP diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 621cb2c8a..014136c1f 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -552,6 +552,13 @@ including line numbers.
  • + INDIC_GRADIENT and INDIC_GRADIENTCENTRE indicator types added. + INDIC_GRADIENT starts with a specified colour and alpha at top of line and fades + to fully transparent at bottom. + INDIC_GRADIENTCENTRE starts with a specified colour and alpha at centre of line and fades + to fully transparent at top and bottom. +
  • +
  • Indicators are drawn for line end characters when displayed.
  • diff --git a/include/Scintilla.h b/include/Scintilla.h index 833ac9aab..4b93e4507 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -288,6 +288,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define INDIC_TEXTFORE 17 #define INDIC_POINT 18 #define INDIC_POINTCHARACTER 19 +#define INDIC_GRADIENT 20 +#define INDIC_GRADIENTCENTRE 21 #define INDIC_IME 32 #define INDIC_IME_MAX 35 #define INDIC_MAX 35 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index b51d0db96..7e52a5777 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -639,6 +639,8 @@ val INDIC_FULLBOX=16 val INDIC_TEXTFORE=17 val INDIC_POINT=18 val INDIC_POINTCHARACTER=19 +val INDIC_GRADIENT=20 +val INDIC_GRADIENTCENTRE=21 val INDIC_IME=32 val INDIC_IME_MAX=35 val INDIC_MAX=35 diff --git a/src/Indicator.cxx b/src/Indicator.cxx index 35b2c3e5b..224083c31 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -138,6 +138,27 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r rcBox.right = rc.right; surface->AlphaRectangle(rcBox, (sacDraw.style == INDIC_ROUNDBOX) ? 1 : 0, sacDraw.fore, fillAlpha, sacDraw.fore, outlineAlpha, 0); + } else if (sacDraw.style == INDIC_GRADIENT || + sacDraw.style == INDIC_GRADIENTCENTRE) { + PRectangle rcBox = rc; + rcBox.top = rcLine.top + 1; + rcBox.bottom = rcLine.bottom; + const Surface::GradientOptions options = Surface::GradientOptions::topToBottom; + const ColourAlpha start(sacNormal.fore, fillAlpha); + const ColourAlpha end(sacNormal.fore, 0); + std::vector stops; + switch (sacDraw.style) { + case INDIC_GRADIENT: + stops.push_back(ColourStop(0.0, start)); + stops.push_back(ColourStop(1.0, end)); + break; + case INDIC_GRADIENTCENTRE: + stops.push_back(ColourStop(0.0, end)); + stops.push_back(ColourStop(0.5, start)); + stops.push_back(ColourStop(1.0, end)); + break; + } + surface->GradientRectangle(rcBox, stops, options); } else if (sacDraw.style == INDIC_DOTBOX) { PRectangle rcBox = PixelGridAlign(rc); rcBox.top = rcLine.top + 1; -- cgit v1.2.3