From 0f95f4cd81c0c0d226ad64193b18d8d956474cf0 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 22 Apr 2011 11:07:17 +1000 Subject: INDIC_ROUNDBOX can set alpha of outline. Feature #3290434. From Marko Njezic. --- doc/ScintillaDoc.html | 20 +++++++++++++++----- include/Scintilla.h | 2 ++ include/Scintilla.iface | 6 ++++++ src/Editor.cxx | 10 ++++++++++ src/Indicator.cxx | 2 +- src/Indicator.h | 3 ++- 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 7fa92a273..5a241e6d6 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -79,7 +79,7 @@

Scintilla Documentation

-

Last edited 4/April/2011 NH

+

Last edited 20/April/2011 NH

There is an overview of the internal design of Scintilla.
@@ -3557,6 +3557,8 @@ struct Sci_TextToFind { SCI_INDICGETFORE(int indicatorNumber)
SCI_INDICSETALPHA(int indicatorNumber, int alpha)
SCI_INDICGETALPHA(int indicatorNumber)
+ SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)
+ SCI_INDICGETOUTLINEALPHA(int indicatorNumber)
SCI_INDICSETUNDER(int indicatorNumber, bool under)
SCI_INDICGETUNDER(int indicatorNumber)
@@ -3641,9 +3643,10 @@ struct Sci_TextToFind { 7 A rectangle with rounded corners around the text using translucent drawing with the - interior more transparent than the border. You can use - SCI_INDICSETALPHA - to control the alpha transparency value. The default alpha value is 30. + interior usually more transparent than the border. You can use + SCI_INDICSETALPHA and + SCI_INDICSETOUTLINEALPHA + to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour. @@ -3665,7 +3668,14 @@ struct Sci_TextToFind {

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 + fill colour of the INDIC_ROUNDBOX rectangle. The alpha value can range from + 0 (completely transparent) to 255 (no transparency). +

+ +

SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)
+ SCI_INDICGETOUTLINEALPHA(int indicatorNumber)
+ These two messages set and get the alpha transparency used for drawing the + outline colour of the INDIC_ROUNDBOX rectangle. The alpha value can range from 0 (completely transparent) to 255 (no transparency).

diff --git a/include/Scintilla.h b/include/Scintilla.h index 6cb9b4b81..0405fe844 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -709,6 +709,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETKEYSUNICODE 2522 #define SCI_INDICSETALPHA 2523 #define SCI_INDICGETALPHA 2524 +#define SCI_INDICSETOUTLINEALPHA 2558 +#define SCI_INDICGETOUTLINEALPHA 2559 #define SCI_SETEXTRAASCENT 2525 #define SCI_GETEXTRAASCENT 2526 #define SCI_SETEXTRADESCENT 2527 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 9ff8e3feb..ef2bac944 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1890,6 +1890,12 @@ set void IndicSetAlpha=2523(int indicator, int alpha) # Get the alpha fill colour of the given indicator. get int IndicGetAlpha=2524(int indicator,) +# Set the alpha outline colour of the given indicator. +set void IndicSetOutlineAlpha=2558(int indicator, int alpha) + +# Get the alpha outline colour of the given indicator. +get int IndicGetOutlineAlpha=2559(int indicator,) + # Set extra ascent for each line set void SetExtraAscent=2525(int extraAscent,) diff --git a/src/Editor.cxx b/src/Editor.cxx index b0560e758..2e8654ca4 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -8212,6 +8212,16 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_INDICGETALPHA: return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fillAlpha : 0; + case SCI_INDICSETOUTLINEALPHA: + if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 255) { + vs.indicators[wParam].outlineAlpha = lParam; + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETOUTLINEALPHA: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].outlineAlpha : 0; + case SCI_SETINDICATORCURRENT: pdoc->decorations.SetCurrentIndicator(wParam); break; diff --git a/src/Indicator.cxx b/src/Indicator.cxx index da9531224..f4e137286 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, fillAlpha, fore.allocated, 50, 0); + surface->AlphaRectangle(rcBox, 1, fore.allocated, fillAlpha, fore.allocated, outlineAlpha, 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 42b56f07e..e787b592d 100644 --- a/src/Indicator.h +++ b/src/Indicator.h @@ -20,7 +20,8 @@ public: bool under; ColourPair fore; int fillAlpha; - Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30) { + int outlineAlpha; + Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30), outlineAlpha(50) { } void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine); }; -- cgit v1.2.3