~ubuntu-branches/ubuntu/raring/geany/raring-proposed

« back to all changes in this revision

Viewing changes to scintilla/src/Indicator.cxx

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2011-12-10 07:43:26 UTC
  • mfrom: (3.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20111210074326-s8yqbew5i20h33tf
Tags: 0.21-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  - debian/patches/20_use_evince_viewer.patch:
     + use evince as viewer for pdf and dvi files
  - debian/patches/20_use_x_terminal_emulator.patch:
     + use x-terminal-emulator as terminal
  - debian/control
     + Add breaks on geany-plugins-common << 0.20
* Also fixes bugs:
  - Filter for MATLAB/Octave files filters everythign (LP: 885505)

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
#ifdef SCI_NAMESPACE
 
14
using namespace Scintilla;
 
15
#endif
 
16
 
 
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);
 
22
                int x = rc.left + 2;
 
23
                int y = 2;
 
24
                while (x < rc.right) {
 
25
                        surface->LineTo(x, rc.top + y);
 
26
                        x += 2;
 
27
                        y = 2 - y;
 
28
                }
 
29
                surface->LineTo(rc.right, rc.top + y);  // Finish the line
 
30
        } else if (style == INDIC_TT) {
 
31
                surface->MoveTo(rc.left, ymid);
 
32
                int x = rc.left + 5;
 
33
                while (x < rc.right) {
 
34
                        surface->LineTo(x, ymid);
 
35
                        surface->MoveTo(x-3, ymid);
 
36
                        surface->LineTo(x-3, ymid+2);
 
37
                        x++;
 
38
                        surface->MoveTo(x, ymid);
 
39
                        x += 5;
 
40
                }
 
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);
 
45
                }
 
46
        } else if (style == INDIC_DIAGONAL) {
 
47
                int x = rc.left;
 
48
                while (x < rc.right) {
 
49
                        surface->MoveTo(x, rc.top+2);
 
50
                        int endX = x+3;
 
51
                        int endY = rc.top - 1;
 
52
                        if (endX > rc.right) {
 
53
                                endY += endX - rc.right;
 
54
                                endX = rc.right;
 
55
                        }
 
56
                        surface->LineTo(endX, endY);
 
57
                        x += 4;
 
58
                }
 
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) {
 
63
                // Draw nothing
 
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;
 
73
                rcBox.left = rc.left;
 
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);
 
79
        }
 
80
}
 
81