diff options
author | nyamatongwe <devnull@localhost> | 2006-12-28 23:00:32 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2006-12-28 23:00:32 +0000 |
commit | 14521a683cbdd6574c9bd38309166d96fc295168 (patch) | |
tree | 2c314e2385e119e07f52371502742b8213dcf16b | |
parent | 703e1f60c8183a7d1a747792e64f649c95a41f7c (diff) | |
download | scintilla-mirror-14521a683cbdd6574c9bd38309166d96fc295168.tar.gz |
Patch from Jason Haslam to optionally extend selection colour to left side when
end of line selected.
-rw-r--r-- | doc/ScintillaDoc.html | 6 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 1 | ||||
-rw-r--r-- | include/Scintilla.h | 2 | ||||
-rw-r--r-- | include/Scintilla.iface | 6 | ||||
-rw-r--r-- | src/Editor.cxx | 23 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 2 | ||||
-rw-r--r-- | src/ViewStyle.h | 1 |
7 files changed, 41 insertions, 0 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 3758bd05a..a89ed7951 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -2117,6 +2117,8 @@ struct TextToFind { colour)</a><br /> <a class="message" href="#SCI_SETSELALPHA">SCI_SETSELALPHA(int alpha)</a><br /> <a class="message" href="#SCI_GETSELALPHA">SCI_GETSELALPHA</a><br /> + <a class="message" href="#SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</a><br /> + <a class="message" href="#SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</a><br /> <a class="message" href="#SCI_SETCARETFORE">SCI_SETCARETFORE(int colour)</a><br /> <a class="message" href="#SCI_GETCARETFORE">SCI_GETCARETFORE</a><br /> <a class="message" href="#SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool @@ -2155,6 +2157,10 @@ struct TextToFind { The selection can be drawn translucently in the selection background colour by setting an alpha value.</p> + <p><b id="SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</b><br /> + <b id="SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</b><br /> + The selection can be drawn up to the right hand border by setting this property.</p> + <p><b id="SCI_SETCARETFORE">SCI_SETCARETFORE(int <a class="jump" href="#colour">colour</a>)</b><br /> <b id="SCI_GETCARETFORE">SCI_GETCARETFORE</b><br /> diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 365472d4f..2bca8bdd2 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -225,6 +225,7 @@ <li>Mitchell Foral</li> <li>Pieter Holtzhausen</li> <li>Waldemar Augustyn</li> + <li>Jason Haslam</li> </ul> <p> Images used in GTK+ version diff --git a/include/Scintilla.h b/include/Scintilla.h index 21bcbf490..adb85695b 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -201,6 +201,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETSELBACK 2068 #define SCI_GETSELALPHA 2477 #define SCI_SETSELALPHA 2478 +#define SCI_GETSELEOLFILLED 2479 +#define SCI_SETSELEOLFILLED 2480 #define SCI_SETCARETFORE 2069 #define SCI_ASSIGNCMDKEY 2070 #define SCI_CLEARCMDKEY 2071 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 085470e04..779378047 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -442,6 +442,12 @@ get int GetSelAlpha=2477(,) # Set the alpha of the selection. set void SetSelAlpha=2478(int alpha,) +# Is the selection end of line filled? +get bool GetSelEOLFilled=2479(,) + +# Set the selection to have its end of line filled or not. +set void SetSelEOLFilled=2480(bool filled,) + # Set the foreground colour of the caret. set void SetCaretFore=2069(colour fore,) diff --git a/src/Editor.cxx b/src/Editor.cxx index bcaa8f839..b2d29da13 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2273,6 +2273,21 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); } + if (vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { + surface->FillRectangle(rcSegment, SelectionBackground(vsDraw)); + } else { + if (overrideBackground) { + surface->FillRectangle(rcSegment, background); + } else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); + } else { + surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); + } + if (vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha != SC_ALPHA_NOALPHA)) { + SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha); + } + } + if (drawWrapMarkEnd) { PRectangle rcPlace = rcSegment; @@ -6898,6 +6913,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETSELALPHA: return vs.selAlpha; + case SCI_GETSELEOLFILLED: + return vs.selEOLFilled; + + case SCI_SETSELEOLFILLED: + vs.selEOLFilled = wParam != 0; + InvalidateStyleRedraw(); + break; + case SCI_SETWHITESPACEFORE: vs.whitespaceForegroundSet = wParam != 0; vs.whitespaceForeground.desired = ColourDesired(lParam); diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index b4da30ace..b6b14da9b 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -74,6 +74,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) { selbackground.desired = source.selbackground.desired; selbackground2.desired = source.selbackground2.desired; selAlpha = source.selAlpha; + selEOLFilled = source.selEOLFilled; foldmarginColourSet = source.foldmarginColourSet; foldmarginColour.desired = source.foldmarginColour.desired; @@ -143,6 +144,7 @@ void ViewStyle::Init() { selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0); selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0); selAlpha = SC_ALPHA_NOALPHA; + selEOLFilled = false; foldmarginColourSet = false; foldmarginColour.desired = ColourDesired(0xff, 0, 0); diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 75f899d97..86eae63c0 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -54,6 +54,7 @@ public: ColourPair selbackground; ColourPair selbackground2; int selAlpha; + bool selEOLFilled; bool whitespaceForegroundSet; ColourPair whitespaceForeground; bool whitespaceBackgroundSet; |