From fa4bd51d2caec16b782f136fa4ffa53a89b9b804 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 14 Feb 2009 10:59:38 +0000 Subject: Feature #2586290 INDIC_ROUNDBOX alpha transparency setting from Todd Whiteman of ActiveState. --- doc/ScintillaDoc.html | 15 ++++++++++++++- include/Scintilla.h | 2 ++ include/Scintilla.iface | 6 ++++++ src/Editor.cxx | 10 ++++++++++ src/Indicator.cxx | 2 +- src/Indicator.h | 3 ++- 6 files changed, 35 insertions(+), 3 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index ffa409f71..c56669ba3 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -3022,6 +3022,10 @@ struct TextToFind { SCI_INDICSETFORE(int indicatorNumber, int colour)
SCI_INDICGETFORE(int indicatorNumber)
+ SCI_INDICSETALPHA(int indicatorNumber, int alpha)
+ SCI_INDICGETALPHA(int indicatorNumber)
+ SCI_INDICSETUNDER(int indicatorNumber, bool under)
+ SCI_INDICGETUNDER(int indicatorNumber)

SCI_INDICSETSTYLE(int indicatorNumber, int @@ -3104,7 +3108,9 @@ struct TextToFind { 7 A rectangle with rounded corners around the text using translucent drawing with the - interior more transparent than the border. + interior more transparent than the border. You can use + SCI_INDICSETALPHA + to control the alpha transparency value. The default alpha value is 30. @@ -3123,6 +3129,13 @@ struct TextToFind { SCI_INDICSETFORE(1, 0xff0000); (light blue)
SCI_INDICSETFORE(2, 0x0000ff); (light red)

+

SCI_INDICSETALPHA(int indicatorNumber, int alpha)
+ SCI_INDICGETALPHA(int indicatorNumber)
+ These two messages set and get the alpha transparency used for drawing the + fill color of the INDIC_ROUNDBOX rectangle. The alpha value can range from + 0 (completely transparent) to 100 (no transparency). +

+

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). diff --git a/include/Scintilla.h b/include/Scintilla.h index c4188337e..fa28c1dbc 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -671,6 +671,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETCHARACTERPOINTER 2520 #define SCI_SETKEYSUNICODE 2521 #define SCI_GETKEYSUNICODE 2522 +#define SCI_INDICSETALPHA 2523 +#define SCI_INDICGETALPHA 2524 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 73783f6ba..21e3d719e 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1810,6 +1810,12 @@ set void SetKeysUnicode=2521(bool keysUnicode,) # Are keys always interpreted as Unicode? get bool GetKeysUnicode=2522(,) +# Set the alpha fill colour of the given indicator. +set void IndicSetAlpha=2523(int indicator, int alpha) + +# Get the alpha fill colour of the given indicator. +get int IndicGetAlpha=2524(int indicator,) + # Start notifying the container of all key presses and commands. fun void StartRecord=3001(,) diff --git a/src/Editor.cxx b/src/Editor.cxx index 8910a5b53..c4c3a8179 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7229,6 +7229,16 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_INDICGETUNDER: return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0; + case SCI_INDICSETALPHA: + if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 100) { + vs.indicators[wParam].fillAlpha = lParam; + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETALPHA: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fillAlpha : 0; + case SCI_SETINDICATORCURRENT: pdoc->decorations.SetCurrentIndicator(wParam); break; diff --git a/src/Indicator.cxx b/src/Indicator.cxx index 139e2b0ea..da9531224 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -72,7 +72,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r rcBox.top = rcLine.top + 1; rcBox.left = rc.left; rcBox.right = rc.right; - surface->AlphaRectangle(rcBox, 1, fore.allocated, 30, fore.allocated, 50, 0); + surface->AlphaRectangle(rcBox, 1, fore.allocated, fillAlpha, fore.allocated, 50, 0); } else { // Either INDIC_PLAIN or unknown surface->MoveTo(rc.left, ymid); surface->LineTo(rc.right, ymid); diff --git a/src/Indicator.h b/src/Indicator.h index 2081db544..42b56f07e 100644 --- a/src/Indicator.h +++ b/src/Indicator.h @@ -19,7 +19,8 @@ public: int style; bool under; ColourPair fore; - Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)) { + int fillAlpha; + Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30) { } void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine); }; -- cgit v1.2.3