diff options
author | nyamatongwe <unknown> | 2011-07-21 16:33:42 +1000 |
---|---|---|
committer | nyamatongwe <unknown> | 2011-07-21 16:33:42 +1000 |
commit | 09fd0473a17f58b3f744d99a3f57cca60bf2aaf1 (patch) | |
tree | 92e2dd7179464259e1425559213b0549b1e83cab /src/Indicator.cxx | |
parent | c20349a2e74c6b2e3e134052ca4a5b917c47e0ce (diff) | |
download | scintilla-mirror-09fd0473a17f58b3f744d99a3f57cca60bf2aaf1.tar.gz |
Added dotted box indicator.
Diffstat (limited to 'src/Indicator.cxx')
-rw-r--r-- | src/Indicator.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Indicator.cxx b/src/Indicator.cxx index 5efee75e6..7059a55bd 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -5,9 +5,17 @@ // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. +#include <vector> +#include <map> + +#ifdef _MSC_VER +#pragma warning(disable: 4786) +#endif + #include "Platform.h" #include "Scintilla.h" +#include "XPM.h" #include "Indicator.h" #ifdef SCI_NAMESPACE @@ -84,6 +92,27 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r rcBox.left = rc.left; rcBox.right = rc.right; surface->AlphaRectangle(rcBox, (style == INDIC_ROUNDBOX) ? 1 : 0, fore.allocated, fillAlpha, fore.allocated, outlineAlpha, 0); + } else if (style == INDIC_DOTBOX) { + PRectangle rcBox = rcLine; + rcBox.top = rcLine.top + 1; + rcBox.left = rc.left; + rcBox.right = rc.right; + // Cap width at 4000 to avoid large allocations when mistakes made + int width = Platform::Minimum(rcBox.Width(), 4000); + RGBAImage image(width, rcBox.Height(), 0); + // Draw horizontal lines top and bottom + for (int x=0; x<width; x++) { + for (int y=0; y<rcBox.Height(); y += rcBox.Height()-1) { + image.SetPixel(x, y, fore.desired, ((x + y) % 2) ? outlineAlpha : fillAlpha); + } + } + // Draw vertical lines left and right + for (int y=1; y<rcBox.Height(); y++) { + for (int x=0; x<width; x += width-1) { + image.SetPixel(x, y, fore.desired, ((x + y) % 2) ? outlineAlpha : fillAlpha); + } + } + surface->DrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels()); } else if (style == INDIC_DASH) { int x = rc.left; while (x < rc.right) { |