aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-05-22 11:52:51 +1000
committerNeil <nyamatongwe@gmail.com>2018-05-22 11:52:51 +1000
commitd08e0385d664dd33aeee88794fd065e3696cb435 (patch)
tree72c9b3156578b0ef6b9db7089169a6f0a2b29b26
parentfba451a1d76be9b6945c9d5d7e219f7d7d1a4260 (diff)
downloadscintilla-mirror-d08e0385d664dd33aeee88794fd065e3696cb435.tar.gz
Backport: Add INDIC_GRADIENT and INDIC_GRADIENTCENTRE indicator types.
Backport of changeset 6966:872900d3ceb0.
-rw-r--r--doc/Indicators.pngbin11206 -> 13819 bytes
-rw-r--r--doc/ScintillaDoc.html17
-rw-r--r--doc/ScintillaHistory.html7
-rw-r--r--include/Scintilla.h2
-rw-r--r--include/Scintilla.iface2
-rw-r--r--src/Indicator.cxx21
6 files changed, 49 insertions, 0 deletions
diff --git a/doc/Indicators.png b/doc/Indicators.png
index a1f68679a..541e3de62 100644
--- a/doc/Indicators.png
+++ b/doc/Indicators.png
Binary files differ
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index d019a5688..01d2ae108 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -4447,6 +4447,23 @@ struct Sci_TextToFind {
</tr>
<tr>
+ <td align="left"><code>INDIC_GRADIENT</code></td>
+
+ <td align="center">20</td>
+
+ <td>A vertical gradient between a colour and alpha at top to fully transparent at bottom.</td>
+ </tr>
+
+ <tr>
+ <td align="left"><code>INDIC_GRADIENTCENTRE</code></td>
+
+ <td align="center">21</td>
+
+ <td>A vertical gradient with the specified colour and alpha in the middle
+ fading to fully transparent at top and bottom.</td>
+ </tr>
+
+ <tr>
<td align="left"><code>INDIC_SQUIGGLEPIXMAP</code></td>
<td align="center">13</td>
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.
</li>
<li>
+ 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.
+ </li>
+ <li>
Indicators are drawn for line end characters when displayed.
</li>
<li>
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<ColourStop> 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;