From bde8aef4ff5e6bd93c3b2bbd8fd7de80bccbbdb8 Mon Sep 17 00:00:00 2001
From: nyamatongwe SCI_INDICSETFORE(1, 0xff0000); (light blue)
SCI_INDICSETFORE(2, 0x0000ff); (light red)
SCI_INDICSETUNDER(int indicatorNumber, bool under)
+ SCI_INDICGETUNDER(int indicatorNumber)
+ These two messages set and get whether an indicator is drawn under text or over(default).
+ Drawing under text works only for modern indicators when
+ is enabled.
Modern indicators are stored in a format similar to run length encoding which is efficient in both diff --git a/include/Scintilla.h b/include/Scintilla.h index 74cc6c98e..e7730b68c 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -245,6 +245,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_INDICGETSTYLE 2081 #define SCI_INDICSETFORE 2082 #define SCI_INDICGETFORE 2083 +#define SCI_INDICSETUNDER 2510 +#define SCI_INDICGETUNDER 2511 #define SCI_SETWHITESPACEFORE 2084 #define SCI_SETWHITESPACEBACK 2085 #define SCI_SETSTYLEBITS 2090 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 0ccd578ea..85d45780e 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -554,6 +554,12 @@ set void IndicSetFore=2082(int indic, colour fore) # Retrieve the foreground colour of an indicator. get colour IndicGetFore=2083(int indic,) +# Set an indicator to draw under text or over(default). +set void IndicSetUnder=2510(int indic, bool under) + +# Retrieve whether indicator drawn under or over text. +get bool IndicGetUnder=2511(int indic,) + # 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 2a1018252..addfedf6e 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2356,7 +2356,7 @@ void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int x } for (Decoration *deco=pdoc->decorations.root; deco; deco = deco->next) { - if (under == (deco->indicator >= 16)) { + if (under == vsDraw.indicators[deco->indicator].under) { int startPos = posLineStart + subLineStart; if (!deco->rs.ValueAt(startPos)) { startPos = deco->rs.EndRun(startPos); @@ -7138,6 +7138,16 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_INDICGETFORE: return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fore.desired.AsLong() : 0; + case SCI_INDICSETUNDER: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].under = lParam != 0; + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETUNDER: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0; + case SCI_SETINDICATORCURRENT: pdoc->decorations.SetCurrentIndicator(wParam); break; diff --git a/src/Indicator.h b/src/Indicator.h index 716db1051..cebc22d80 100644 --- a/src/Indicator.h +++ b/src/Indicator.h @@ -13,8 +13,9 @@ class Indicator { public: int style; + bool under; ColourPair fore; - Indicator() : style(INDIC_PLAIN), fore(ColourDesired(0,0,0)) { + Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)) { } void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine); }; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 403d17a3a..6611439f5 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -129,10 +129,13 @@ void ViewStyle::Init() { ResetDefaultStyle(); indicators[0].style = INDIC_SQUIGGLE; + indicators[0].under = false; indicators[0].fore = ColourDesired(0, 0x7f, 0); indicators[1].style = INDIC_TT; + indicators[1].under = false; indicators[1].fore = ColourDesired(0, 0, 0xff); indicators[2].style = INDIC_PLAIN; + indicators[2].under = false; indicators[2].fore = ColourDesired(0xff, 0, 0); lineHeight = 1; -- cgit v1.2.3