diff options
author | nyamatongwe <unknown> | 2000-05-10 11:53:11 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2000-05-10 11:53:11 +0000 |
commit | 9548dec5e36fb3b4c2e844da6d0c7b119940ad70 (patch) | |
tree | 722bc4ebdab9d5e760b31d87854695c25fecc294 /src | |
parent | 756bcf30b6ce43e604a91d946bf9baafd6c4e564 (diff) | |
download | scintilla-mirror-9548dec5e36fb3b4c2e844da6d0c7b119940ad70.tar.gz |
Added underline attribute to styles.
Added diagonal and strike-through indicators.
Diffstat (limited to 'src')
-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 |
5 files changed, 39 insertions, 7 deletions
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(); |