1
// Scintilla source code edit control
2
/** @file Indicator.cxx
3
** Defines the style of indicators which are text decorations such as underlining.
5
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
6
// The License.txt file describes the conditions under which this software may be distributed.
10
#include "Scintilla.h"
11
#include "Indicator.h"
13
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) {
14
surface->PenColour(fore.allocated);
15
int ymid = (rc.bottom + rc.top) / 2;
16
if (style == INDIC_SQUIGGLE) {
17
surface->MoveTo(rc.left, rc.top);
20
while (x < rc.right) {
21
surface->LineTo(x, rc.top + y);
25
surface->LineTo(rc.right, rc.top + y); // Finish the line
26
} else if (style == INDIC_TT) {
27
surface->MoveTo(rc.left, ymid);
29
while (x < rc.right) {
30
surface->LineTo(x, ymid);
31
surface->MoveTo(x-3, ymid);
32
surface->LineTo(x-3, ymid+2);
34
surface->MoveTo(x, ymid);
37
surface->LineTo(rc.right, ymid); // Finish the line
38
if (x - 3 <= rc.right) {
39
surface->MoveTo(x-3, ymid);
40
surface->LineTo(x-3, ymid+2);
42
} else if (style == INDIC_DIAGONAL) {
44
while (x < rc.right) {
45
surface->MoveTo(x, rc.top+2);
47
int endY = rc.top - 1;
48
if (endX > rc.right) {
49
endY += endX - rc.right;
52
surface->LineTo(endX, endY);
55
} else if (style == INDIC_STRIKE) {
56
surface->MoveTo(rc.left, rc.top - 4);
57
surface->LineTo(rc.right, rc.top - 4);
58
} else if (style == INDIC_HIDDEN) {
60
} else if (style == INDIC_BOX) {
61
surface->MoveTo(rc.left, ymid+1);
62
surface->LineTo(rc.right, ymid+1);
63
surface->LineTo(rc.right, rcLine.top+1);
64
surface->LineTo(rc.left, rcLine.top+1);
65
surface->LineTo(rc.left, ymid+1);
66
} else if (style == INDIC_ROUNDBOX) {
67
PRectangle rcBox = rcLine;
68
rcBox.top = rcLine.top + 1;
70
rcBox.right = rc.right;
71
surface->AlphaRectangle(rcBox, 1, fore.allocated, 30, fore.allocated, 50, 0);
72
} else { // Either INDIC_PLAIN or unknown
73
surface->MoveTo(rc.left, ymid);
74
surface->LineTo(rc.right, ymid);