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"
14 using namespace Scintilla
;
17 void Indicator::Draw(Surface
*surface
, const PRectangle
&rc
, const PRectangle
&rcLine
) {
18 surface
->PenColour(fore
.allocated
);
19 int ymid
= (rc
.bottom
+ rc
.top
) / 2;
20 if (style
== INDIC_SQUIGGLE
) {
21 surface
->MoveTo(rc
.left
, rc
.top
);
24 while (x
< rc
.right
) {
25 surface
->LineTo(x
, rc
.top
+ y
);
29 surface
->LineTo(rc
.right
, rc
.top
+ y
); // Finish the line
30 } else if (style
== INDIC_TT
) {
31 surface
->MoveTo(rc
.left
, ymid
);
33 while (x
< rc
.right
) {
34 surface
->LineTo(x
, ymid
);
35 surface
->MoveTo(x
-3, ymid
);
36 surface
->LineTo(x
-3, ymid
+2);
38 surface
->MoveTo(x
, ymid
);
41 surface
->LineTo(rc
.right
, ymid
); // Finish the line
42 if (x
- 3 <= rc
.right
) {
43 surface
->MoveTo(x
-3, ymid
);
44 surface
->LineTo(x
-3, ymid
+2);
46 } else if (style
== INDIC_DIAGONAL
) {
48 while (x
< rc
.right
) {
49 surface
->MoveTo(x
, rc
.top
+2);
51 int endY
= rc
.top
- 1;
52 if (endX
> rc
.right
) {
53 endY
+= endX
- rc
.right
;
56 surface
->LineTo(endX
, endY
);
59 } else if (style
== INDIC_STRIKE
) {
60 surface
->MoveTo(rc
.left
, rc
.top
- 4);
61 surface
->LineTo(rc
.right
, rc
.top
- 4);
62 } else if (style
== INDIC_HIDDEN
) {
64 } else if (style
== INDIC_BOX
) {
65 surface
->MoveTo(rc
.left
, ymid
+1);
66 surface
->LineTo(rc
.right
, ymid
+1);
67 surface
->LineTo(rc
.right
, rcLine
.top
+1);
68 surface
->LineTo(rc
.left
, rcLine
.top
+1);
69 surface
->LineTo(rc
.left
, ymid
+1);
70 } else if (style
== INDIC_ROUNDBOX
) {
71 PRectangle rcBox
= rcLine
;
72 rcBox
.top
= rcLine
.top
+ 1;
74 rcBox
.right
= rc
.right
;
75 surface
->AlphaRectangle(rcBox
, 1, fore
.allocated
, fillAlpha
, fore
.allocated
, 50, 0);
76 } else { // Either INDIC_PLAIN or unknown
77 surface
->MoveTo(rc
.left
, ymid
);
78 surface
->LineTo(rc
.right
, ymid
);