diff options
author | Neil <nyamatongwe@gmail.com> | 2021-07-29 12:43:47 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-07-29 12:43:47 +1000 |
commit | 57f5c36ccf0ddc9be4b348bbe39cf3347ea8381c (patch) | |
tree | 4819bc0d298973db57f6c16a5832baba7033ba93 | |
parent | 01b1affdce7ee869c62a88ab23486b55b7707764 (diff) | |
download | scintilla-mirror-57f5c36ccf0ddc9be4b348bbe39cf3347ea8381c.tar.gz |
Add SC_ELEMENT_FOLD_LINE to set the colour of fold lines.
-rw-r--r-- | doc/ScintillaDoc.html | 24 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 3 | ||||
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 1 | ||||
-rw-r--r-- | include/ScintillaTypes.h | 1 | ||||
-rw-r--r-- | src/EditView.cxx | 6 |
6 files changed, 29 insertions, 7 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 531fca5aa..511632937 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -128,7 +128,7 @@ <h1>Scintilla Documentation</h1> - <p>Last edited 17 July 2021 NH</p> + <p>Last edited 29 July 2021 NH</p> <p style="background:#90F0C0">Scintilla 5 has moved the lexers from Scintilla into a new <a href="Lexilla.html">Lexilla</a> project.<br /> @@ -2395,8 +2395,8 @@ struct Sci_TextToFind { <b id="SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool useSetting, <a class="jump" href="#colour">colour</a> back)</b><br /> By default, the colour of visible white space is determined by the lexer in use. The foreground and/or background colour of all visible white space can be set globally, overriding - the lexer's colours with <a href="#SCI_SETELEMENTCOLOUR"><code>SC_ELEMENT_WHITE_SPACE</code></a> - and <a href="#SCI_SETELEMENTCOLOUR"><code>SC_ELEMENT_WHITE_SPACE_BACK</code></a>. + the lexer's colours with <a class="element" href="#SCI_SETELEMENTCOLOUR"><code>SC_ELEMENT_WHITE_SPACE</code></a> + and <a class="element" href="#SCI_SETELEMENTCOLOUR"><code>SC_ELEMENT_WHITE_SPACE_BACK</code></a>. .<br /> <code>SCI_SETWHITESPACEFORE</code> and <code>SCI_SETWHITESPACEBACK</code> also change the white space colours but the element APIs are preferred with <code>SC_ELEMENT_WHITE_SPACE</code> @@ -3496,6 +3496,14 @@ struct Sci_TextToFind { <td></td> <td>Background colour of active hot spot</td> </tr> + <tr class="section"> + <th align="left"><code>SC_ELEMENT_FOLD_LINE</code></th> + <td>80</td> + <td>Translucent</td> + <td>All</td> + <td></td> + <td>Colour of fold lines</td> + </tr> </tbody> </table> @@ -7007,6 +7015,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ <a class="message" href="#SCI_SETAUTOMATICFOLD">SCI_SETAUTOMATICFOLD(int automaticFold)</a><br /> <a class="message" href="#SCI_GETAUTOMATICFOLD">SCI_GETAUTOMATICFOLD → int</a><br /> <a class="message" href="#SCI_SETFOLDFLAGS">SCI_SETFOLDFLAGS(int flags)</a><br /> + <a class="element" href="#SC_ELEMENT_FOLD_LINE">SC_ELEMENT_FOLD_LINE : colouralpha</a><br /> <a class="message" href="#SCI_GETLASTCHILD">SCI_GETLASTCHILD(line line, int level) → line</a><br /> <a class="message" href="#SCI_GETFOLDPARENT">SCI_GETFOLDPARENT(line line) → line</a><br /> <a class="message" href="#SCI_SETFOLDEXPANDED">SCI_SETFOLDEXPANDED(line line, bool @@ -7086,9 +7095,14 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ update to match your changes. <p><b id="SCI_SETFOLDFLAGS">SCI_SETFOLDFLAGS(int flags)</b><br /> + <b id="SC_ELEMENT_FOLD_LINE">SC_ELEMENT_FOLD_LINE : colouralpha</b><br /> In addition to showing markers in the folding margin, you can indicate folds to the user by - drawing lines in the text area. The lines are drawn in the foreground colour set for <a - class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>. Bits set in + drawing lines in the text area. + The lines are drawn in the <a class="element" href="#SCI_SETELEMENTCOLOUR"><code>SC_ELEMENT_FOLD_LINE</code></a> + colour if set. + If it is not set then the foreground colour set for <a + class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a> is used. + Bits set in <code class="parameter">flags</code> determine where folding lines are drawn:<br /> </p> diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 1b88ebab1..f0c6ded0b 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -575,6 +575,9 @@ Released 26 July 2021. </li> <li> + Add SC_ELEMENT_FOLD_LINE to set the colour of fold lines. + </li> + <li> Fix display of fold lines when wrapped so they are only drawn once per line, not on each subline. </li> <li> diff --git a/include/Scintilla.h b/include/Scintilla.h index 97fbd3be0..3af22dfc5 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -291,6 +291,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SC_ELEMENT_WHITE_SPACE_BACK 61 #define SC_ELEMENT_HOT_SPOT_ACTIVE 70 #define SC_ELEMENT_HOT_SPOT_ACTIVE_BACK 71 +#define SC_ELEMENT_FOLD_LINE 80 #define SCI_SETELEMENTCOLOUR 2753 #define SCI_GETELEMENTCOLOUR 2754 #define SCI_RESETELEMENTCOLOUR 2755 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index cc7dedf36..d8a1bdec1 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -697,6 +697,7 @@ val SC_ELEMENT_WHITE_SPACE=60 val SC_ELEMENT_WHITE_SPACE_BACK=61 val SC_ELEMENT_HOT_SPOT_ACTIVE=70 val SC_ELEMENT_HOT_SPOT_ACTIVE_BACK=71 +val SC_ELEMENT_FOLD_LINE=80 # Set the colour of an element. Translucency (alpha) may or may not be significant # and this may depend on the platform. The alpha byte should commonly be 0xff for opaque. diff --git a/include/ScintillaTypes.h b/include/ScintillaTypes.h index 830ccadba..ab4a55131 100644 --- a/include/ScintillaTypes.h +++ b/include/ScintillaTypes.h @@ -180,6 +180,7 @@ enum class Element { WhiteSpaceBack = 61, HotSpotActive = 70, HotSpotActiveBack = 71, + FoldLine = 80, }; enum class Layer { diff --git a/src/EditView.cxx b/src/EditView.cxx index f4d37e221..7eea729fd 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -2289,19 +2289,21 @@ static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewSt const FoldLevel levelNext = model.pdoc->GetFoldLevel(line + 1); if (LevelIsHeader(level) && (LevelNumber(level) < LevelNumber(levelNext))) { + const ColourRGBA foldLineColour = vsDraw.ElementColour(Element::FoldLine).value_or( + vsDraw.styles[StyleDefault].fore); // Paint the line above the fold if ((subLine == 0) && ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeExpanded))) || (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeContracted))))) { - surface->FillRectangleAligned(Side(rcLine, Edge::top, 1.0), Fill(vsDraw.styles[StyleDefault].fore)); + surface->FillRectangleAligned(Side(rcLine, Edge::top, 1.0), foldLineColour); } // Paint the line below the fold if (lastSubLine && ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterExpanded))) || (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterContracted))))) { - surface->FillRectangleAligned(Side(rcLine, Edge::bottom, 1.0), Fill(vsDraw.styles[StyleDefault].fore)); + surface->FillRectangleAligned(Side(rcLine, Edge::bottom, 1.0), foldLineColour); } } } |