diff options
-rw-r--r-- | include/Scintilla.h | 3 | ||||
-rw-r--r-- | include/Scintilla.iface | 5 | ||||
-rw-r--r-- | src/Editor.cxx | 11 | ||||
-rw-r--r-- | src/Indicator.cxx | 16 | ||||
-rw-r--r-- | src/Style.cxx | 11 | ||||
-rw-r--r-- | src/Style.h | 3 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 5 |
7 files changed, 47 insertions, 7 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h index 6a58e9324..2a7f51613 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -169,6 +169,7 @@ extern "C" { #define SCI_STYLESETFONT SCI_START + 56 #define SCI_STYLESETEOLFILLED SCI_START + 57 #define SCI_STYLERESETDEFAULT SCI_START + 58 +#define SCI_STYLESETUNDERLINE SCI_START + 59 #define SCI_SETSELFORE SCI_START + 67 #define SCI_SETSELBACK SCI_START + 68 @@ -192,6 +193,8 @@ extern "C" { #define INDIC_PLAIN 0 #define INDIC_SQUIGGLE 1 #define INDIC_TT 2 +#define INDIC_DIAGONAL 3 +#define INDIC_STRIKE 4 #define INDIC0_MASK 32 #define INDIC1_MASK 64 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 0233a24ca..af4a9583b 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -277,6 +277,9 @@ set void StyleSetEOLFilled=2057(int style, bool filled) # Reset the default style to its state at startup fun void StyleResetDefault=2058(,) +# Set a style to be underlined or not. +set void StyleSetUnderline=2059(int style, bool underline) + # Set the foreground colour of the selection and whether to use this setting. fun void SetSelFore=2067(bool useSetting, colour fore) @@ -319,6 +322,8 @@ val INDIC_MAX=7 val INDIC_PLAIN=0 val INDIC_SQUIGGLE=1 val INDIC_TT=2 +val INDIC_DIAGONAL=3 +val INDIC_STRIKE=4 val INDIC0_MASK=32 val INDIC1_MASK=64 val INDIC2_MASK=128 diff --git a/src/Editor.cxx b/src/Editor.cxx index 7827c84a4..37400f9ba 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -889,6 +889,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int xStart, } } } + if (vsDraw.styles[styleMain].underline) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + surface->FillRectangle(rcUL, textFore); + } } startseg = i + 1; } @@ -3580,6 +3586,11 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { InvalidateStyleRedraw(); } break; + case SCI_STYLESETUNDERLINE: + if (wParam <= STYLE_MAX) { + vs.styles[wParam].underline = lParam; + InvalidateStyleRedraw(); + } case SCI_STYLERESETDEFAULT: vs.ResetDefaultStyle(); diff --git a/src/Indicator.cxx b/src/Indicator.cxx index fb6ad0915..05bdf66b5 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -37,6 +37,22 @@ void Indicator::Draw(Surface *surface, PRectangle &rc) { surface->MoveTo(x-3, ymid); surface->LineTo(x-3, ymid+2); } + } else if (style == INDIC_DIAGONAL) { + int x = rc.left; + while (x < rc.right) { + surface->MoveTo(x, rc.top+2); + int endX = x+3; + int endY = rc.top - 1; + if (endX > rc.right) { + endY += endX - rc.right; + endX = rc.right; + } + surface->LineTo(endX, endY); + x += 4; + } + } else if (style == INDIC_STRIKE) { + surface->MoveTo(rc.left, rc.top - 4); + surface->LineTo(rc.right, rc.top - 4); } else { // Either INDIC_PLAIN or unknown surface->MoveTo(rc.left, ymid); surface->LineTo(rc.right, ymid); diff --git a/src/Style.cxx b/src/Style.cxx index 36d4b9850..2fea6898d 100644 --- a/src/Style.cxx +++ b/src/Style.cxx @@ -13,19 +13,20 @@ Style::Style() { aliasOfDefaultFont = true; Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), Platform::DefaultFontSize(), 0, - false, false, false); + false, false, false, false); } Style::Style(const Style &source) { Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), 0, 0, - false, false, false); + false, false, false, false); fore.desired = source.fore.desired; back.desired = source.back.desired; bold = source.bold; italic = source.italic; size = source.size; eolFilled = source.eolFilled; + underline = source.underline; } Style::~Style() { @@ -41,18 +42,19 @@ Style &Style::operator=(const Style &source) { return *this; Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), 0, 0, - false, false, false); + false, false, false, false); fore.desired = source.fore.desired; back.desired = source.back.desired; bold = source.bold; italic = source.italic; size = source.size; eolFilled = source.eolFilled; + underline = source.underline; return *this; } void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_, - bool bold_, bool italic_, bool eolFilled_) { + bool bold_, bool italic_, bool eolFilled_, bool underline_) { fore.desired = fore_; back.desired = back_; bold = bold_; @@ -60,6 +62,7 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_, size = size_; fontName = fontName_; eolFilled = eolFilled_; + underline = underline_; if (aliasOfDefaultFont) font.SetID(0); else diff --git a/src/Style.h b/src/Style.h index 95e006135..a8a0a859a 100644 --- a/src/Style.h +++ b/src/Style.h @@ -16,6 +16,7 @@ public: int size; const char *fontName; bool eolFilled; + bool underline; Font font; unsigned int lineHeight; @@ -32,7 +33,7 @@ public: void Clear(Colour fore_, Colour back_, int size_, const char *fontName_, - bool bold_, bool italic_, bool eolFilled_); + bool bold_, bool italic_, bool eolFilled_, bool underline_); bool EquivalentFontTo(const Style *other) const; void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0); }; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 2188fd03f..5fac88cea 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -202,7 +202,7 @@ void ViewStyle::Refresh(Surface &surface) { void ViewStyle::ResetDefaultStyle() { styles[STYLE_DEFAULT].Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), - false, false, false); + false, false, false, false); } void ViewStyle::ClearStyles() { @@ -216,7 +216,8 @@ void ViewStyle::ClearStyles() { styles[STYLE_DEFAULT].fontName, styles[STYLE_DEFAULT].bold, styles[STYLE_DEFAULT].italic, - styles[STYLE_DEFAULT].eolFilled); + styles[STYLE_DEFAULT].eolFilled, + styles[STYLE_DEFAULT].underline); } } styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); |