~registry/codeblocks/trunk

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmithSTC/stc/scintilla/src/Indicator.cxx

  • Committer: mortenmacfly
  • Date: 2012-02-22 14:40:26 UTC
  • Revision ID: svn-v4:98b59c6a-2706-0410-b7d6-d2fa1a1880c9:trunk:7835
* merged wxSmith branch into trunk
* this brings tons of new wxSmith items, including KWIC, wxImagePanel, wxGridBagSizer and more
* based on work of the community, mainly cryogen
* for more information, see changelog of wxSmith branch
* also, re-factoring of contributed wxWidgets items for wxSmith
* PLEASE DO A CLEAN CHECKOUT AND RE-BUILD EVERYTHING FROM SCRATCH!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Scintilla source code edit control
 
2
/** @file Indicator.cxx
 
3
 ** Defines the style of indicators which are text decorations such as underlining.
 
4
 **/
 
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.
 
7
 
 
8
#include "Platform.h"
 
9
 
 
10
#include "Scintilla.h"
 
11
#include "Indicator.h"
 
12
 
 
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);
 
18
                int x = rc.left + 2;
 
19
                int y = 2;
 
20
                while (x < rc.right) {
 
21
                        surface->LineTo(x, rc.top + y);
 
22
                        x += 2;
 
23
                        y = 2 - y;
 
24
                }
 
25
                surface->LineTo(rc.right, rc.top + y);  // Finish the line
 
26
        } else if (style == INDIC_TT) {
 
27
                surface->MoveTo(rc.left, ymid);
 
28
                int x = rc.left + 5;
 
29
                while (x < rc.right) {
 
30
                        surface->LineTo(x, ymid);
 
31
                        surface->MoveTo(x-3, ymid);
 
32
                        surface->LineTo(x-3, ymid+2);
 
33
                        x++;
 
34
                        surface->MoveTo(x, ymid);
 
35
                        x += 5;
 
36
                }
 
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);
 
41
                }
 
42
        } else if (style == INDIC_DIAGONAL) {
 
43
                int x = rc.left;
 
44
                while (x < rc.right) {
 
45
                        surface->MoveTo(x, rc.top+2);
 
46
                        int endX = x+3;
 
47
                        int endY = rc.top - 1;
 
48
                        if (endX > rc.right) {
 
49
                                endY += endX - rc.right;
 
50
                                endX = rc.right;
 
51
                        }
 
52
                        surface->LineTo(endX, endY);
 
53
                        x += 4;
 
54
                }
 
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) {
 
59
                // Draw nothing
 
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;
 
69
                rcBox.left = rc.left;
 
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);
 
75
        }
 
76
}
 
77