diff options
| -rw-r--r-- | doc/ScintillaDoc.html | 22 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
| -rw-r--r-- | include/Scintilla.h | 3 | ||||
| -rw-r--r-- | include/Scintilla.iface | 9 | ||||
| -rw-r--r-- | src/EditView.cxx | 33 | ||||
| -rw-r--r-- | src/Editor.cxx | 18 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 9 | ||||
| -rw-r--r-- | src/ViewStyle.h | 17 | 
8 files changed, 96 insertions, 19 deletions
| diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 9175d6b80..681970d93 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -6177,6 +6177,9 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){       <a class="message" href="#SCI_GETEDGECOLUMN">SCI_GETEDGECOLUMN</a><br />       <a class="message" href="#SCI_SETEDGECOLOUR">SCI_SETEDGECOLOUR(int colour)</a><br />       <a class="message" href="#SCI_GETEDGECOLOUR">SCI_GETEDGECOLOUR</a><br /> +     <br /> +     <a class="message" href="#SCI_MULTIEDGEADDLINE">SCI_MULTIEDGEADDLINE(int column, int colour)</a><br /> +     <a class="message" href="#SCI_MULTIEDGECLEARALL">SCI_MULTIEDGECLEARALL</a><br />      </code>      <p><b id="SCI_SETEDGEMODE">SCI_SETEDGEMODE(int edgeMode)</b><br /> @@ -6225,6 +6228,17 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){            <td>The background colour of characters after the column limit is changed to the colour            set by <code>SCI_SETEDGECOLOUR</code>. This is recommended for proportional fonts.</td>          </tr> + +        <tr> +          <td align="left"><code>EDGE_MULTILINE</code></td> + +          <td align="center">3</td> + +          <td>This is similar to <code>EDGE_LINE</code> but in contrary to showing only one single +          line a configurable set of vertical lines can be shown simultaneously. This <code>edgeMode +          </code> uses a completely independent dataset that can only be configured by using the +          <code>SCI_MULTIEDGE*</code> messages.</td> +        </tr>        </tbody>      </table> @@ -6241,6 +6255,14 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){       These messages set and get the colour of the marker used to show that a line has exceeded the      length set by <code>SCI_SETEDGECOLUMN</code>.</p> +    <p><b id="SCI_MULTIEDGEADDLINE">SCI_MULTIEDGEADDLINE(int column, int <a class="jump" +    href="#colour">colour</a>)</b><br /> +     <b id="SCI_MULTIEDGECLEARALL">SCI_MULTIEDGECLEARALL</b><br /> +     <code>SCI_MULTIEDGEADDLINE</code> adds a new vertical edge to the view. The edge will be +    displayed at the given column number. The resulting edge position depends on the metric +    of a space character in <code>STYLE_DEFAULT</code>. All the edges can be cleared with +    <code>SCI_MULTIEDGECLEARALL</code>.</p> +      <h2 id="Lexer">Lexer</h2>      <p>If you define the symbol <code>SCI_LEXER</code> when building Scintilla, (this is sometimes diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 072de2c70..404ffa16d 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -500,6 +500,7 @@  	<td>Alexey Denisov</td>  	<td>jedailey</td>  	<td>oirfeodent</td> +	<td>A-R-C-A</td>      </tr>      </table>      <p> @@ -526,6 +527,9 @@  	These changes do not affect the standard C/C++ binding.  	</li>  	<li> +	EDGE_MULTILINE and SCI_MULTIEDGEADDLINE added to allow displaying multiple +	vertical edges simultaneously. +	<li>  	The WordList class in lexlib used by lexers adds an InListAbridged method for  	matching keywords that have particular prefixes and/or suffixes.  	</li> diff --git a/include/Scintilla.h b/include/Scintilla.h index 8f0cd44b1..0b5483043 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -650,12 +650,15 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,  #define EDGE_NONE 0  #define EDGE_LINE 1  #define EDGE_BACKGROUND 2 +#define EDGE_MULTILINE 3  #define SCI_GETEDGECOLUMN 2360  #define SCI_SETEDGECOLUMN 2361  #define SCI_GETEDGEMODE 2362  #define SCI_SETEDGEMODE 2363  #define SCI_GETEDGECOLOUR 2364  #define SCI_SETEDGECOLOUR 2365 +#define SCI_MULTIEDGEADDLINE 2694 +#define SCI_MULTIEDGECLEARALL 2695  #define SCI_SEARCHANCHOR 2366  #define SCI_SEARCHNEXT 2367  #define SCI_SEARCHPREV 2368 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 27d1d7513..d52c229bf 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1667,6 +1667,7 @@ enu EdgeVisualStyle=EDGE_  val EDGE_NONE=0  val EDGE_LINE=1  val EDGE_BACKGROUND=2 +val EDGE_MULTILINE=3  # Retrieve the column number which text should be kept within.  get int GetEdgeColumn=2360(,) @@ -1678,7 +1679,7 @@ set void SetEdgeColumn=2361(int column,)  # Retrieve the edge highlight mode.  get int GetEdgeMode=2362(,) -# The edge may be displayed by a line (EDGE_LINE) or by highlighting text that +# The edge may be displayed by a line (EDGE_LINE/EDGE_MULTILINE) or by highlighting text that  # goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).  set void SetEdgeMode=2363(int mode,) @@ -1688,6 +1689,12 @@ get colour GetEdgeColour=2364(,)  # Change the colour used in edge indication.  set void SetEdgeColour=2365(colour edgeColour,) +# Add a new vertical edge to the view. +fun void MultiEdgeAddLine=2694(int column, colour edgeColour) + +# Clear all vertical edges. +fun void MultiEdgeClearAll=2695(,) +  # Sets the current caret position to be the search anchor.  fun void SearchAnchor=2366(,) diff --git a/src/EditView.cxx b/src/EditView.cxx index 9ca6e95ad..074c23fc9 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -417,7 +417,7 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co  		ll->widthLine = LineLayout::wrapWidthInfinite;  		ll->lines = 1;  		if (vstyle.edgeState == EDGE_BACKGROUND) { -			ll->edgeColumn = model.pdoc->FindColumn(line, vstyle.theEdge); +			ll->edgeColumn = model.pdoc->FindColumn(line, vstyle.theEdge.column);  			if (ll->edgeColumn >= posLineStart) {  				ll->edgeColumn -= posLineStart;  			} @@ -749,7 +749,7 @@ static ColourDesired TextBackground(const EditModel &model, const ViewStyle &vsD  		if ((vsDraw.edgeState == EDGE_BACKGROUND) &&  			(i >= ll->edgeColumn) &&  			(i < ll->numCharsBeforeEOL)) -			return vsDraw.edgecolour; +			return vsDraw.theEdge.colour;  		if (inHotspot && vsDraw.hotspotColours.back.isSet)  			return vsDraw.hotspotColours.back;  	} @@ -1339,12 +1339,24 @@ static void DrawEdgeLine(Surface *surface, const ViewStyle &vsDraw, const LineLa  	Range lineRange, int xStart) {  	if (vsDraw.edgeState == EDGE_LINE) {  		PRectangle rcSegment = rcLine; -		int edgeX = static_cast<int>(vsDraw.theEdge * vsDraw.spaceWidth); +		int edgeX = static_cast<int>(vsDraw.theEdge.column * vsDraw.spaceWidth);  		rcSegment.left = static_cast<XYPOSITION>(edgeX + xStart);  		if ((ll->wrapIndent != 0) && (lineRange.start != 0))  			rcSegment.left -= ll->wrapIndent;  		rcSegment.right = rcSegment.left + 1; -		surface->FillRectangle(rcSegment, vsDraw.edgecolour); +		surface->FillRectangle(rcSegment, vsDraw.theEdge.colour); +	} else if (vsDraw.edgeState == EDGE_MULTILINE) { +		for (size_t edge = 0; edge < vsDraw.theMultiEdge.size(); edge++) { +			if (vsDraw.theMultiEdge[edge].column >= 0) { +				PRectangle rcSegment = rcLine; +				int edgeX = static_cast<int>(vsDraw.theMultiEdge[edge].column * vsDraw.spaceWidth); +				rcSegment.left = static_cast<XYPOSITION>(edgeX + xStart); +				if ((ll->wrapIndent != 0) && (lineRange.start != 0)) +					rcSegment.left -= ll->wrapIndent; +				rcSegment.right = rcSegment.left + 1; +				surface->FillRectangle(rcSegment, vsDraw.theMultiEdge[edge].colour); +			} +		}  	}  } @@ -1919,10 +1931,19 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan  		if (rcBeyondEOF.top < rcBeyondEOF.bottom) {  			surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.styles[STYLE_DEFAULT].back);  			if (vsDraw.edgeState == EDGE_LINE) { -				int edgeX = static_cast<int>(vsDraw.theEdge * vsDraw.spaceWidth); +				int edgeX = static_cast<int>(vsDraw.theEdge.column * vsDraw.spaceWidth);  				rcBeyondEOF.left = static_cast<XYPOSITION>(edgeX + xStart);  				rcBeyondEOF.right = rcBeyondEOF.left + 1; -				surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.edgecolour); +				surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.theEdge.colour); +			} else if (vsDraw.edgeState == EDGE_MULTILINE) { +				for (size_t edge = 0; edge < vsDraw.theMultiEdge.size(); edge++) { +					if (vsDraw.theMultiEdge[edge].column >= 0) { +						int edgeX = static_cast<int>(vsDraw.theMultiEdge[edge].column * vsDraw.spaceWidth); +						rcBeyondEOF.left = static_cast<XYPOSITION>(edgeX + xStart); +						rcBeyondEOF.right = rcBeyondEOF.left + 1; +						surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.theMultiEdge[edge].colour); +					} +				}  			}  		}  		//Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset); diff --git a/src/Editor.cxx b/src/Editor.cxx index 12ec73239..beec634d3 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7433,10 +7433,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		return vs.zoomLevel;  	case SCI_GETEDGECOLUMN: -		return vs.theEdge; +		return vs.theEdge.column;  	case SCI_SETEDGECOLUMN: -		vs.theEdge = static_cast<int>(wParam); +		vs.theEdge.column = static_cast<int>(wParam);  		InvalidateStyleRedraw();  		break; @@ -7449,10 +7449,20 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		break;  	case SCI_GETEDGECOLOUR: -		return vs.edgecolour.AsLong(); +		return vs.theEdge.colour.AsLong();  	case SCI_SETEDGECOLOUR: -		vs.edgecolour = ColourDesired(static_cast<long>(wParam)); +		vs.theEdge.colour = ColourDesired(static_cast<long>(wParam)); +		InvalidateStyleRedraw(); +		break; + +	case SCI_MULTIEDGEADDLINE: +		vs.theMultiEdge.push_back(EdgeProperties(wParam, lParam)); +		InvalidateStyleRedraw(); +		break; + +	case SCI_MULTIEDGECLEARALL: +		std::vector<EdgeProperties>().swap(vs.theMultiEdge); // Free vector and memory, C++03 compatible  		InvalidateStyleRedraw();  		break; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index ae68d8bff..33be28422 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -139,8 +139,6 @@ ViewStyle::ViewStyle(const ViewStyle &source) {  	alwaysShowCaretLineBackground = source.alwaysShowCaretLineBackground;  	caretLineBackground = source.caretLineBackground;  	caretLineAlpha = source.caretLineAlpha; -	edgecolour = source.edgecolour; -	edgeState = source.edgeState;  	caretStyle = source.caretStyle;  	caretWidth = source.caretWidth;  	someStylesProtected = false; @@ -171,7 +169,9 @@ ViewStyle::ViewStyle(const ViewStyle &source) {  	braceBadLightIndicatorSet = source.braceBadLightIndicatorSet;  	braceBadLightIndicator = source.braceBadLightIndicator; +	edgeState = source.edgeState;  	theEdge = source.theEdge; +	theMultiEdge = source.theMultiEdge;  	marginNumberPadding = source.marginNumberPadding;  	ctrlCharPadding = source.ctrlCharPadding; @@ -268,8 +268,6 @@ void ViewStyle::Init(size_t stylesSize_) {  	alwaysShowCaretLineBackground = false;  	caretLineBackground = ColourDesired(0xff, 0xff, 0);  	caretLineAlpha = SC_ALPHA_NOALPHA; -	edgecolour = ColourDesired(0xc0, 0xc0, 0xc0); -	edgeState = EDGE_NONE;  	caretStyle = CARETSTYLE_LINE;  	caretWidth = 1;  	someStylesProtected = false; @@ -310,7 +308,8 @@ void ViewStyle::Init(size_t stylesSize_) {  	braceBadLightIndicatorSet = false;  	braceBadLightIndicator = 0; -	theEdge = 0; +	edgeState = EDGE_NONE; +	theEdge = EdgeProperties(0, ColourDesired(0xc0, 0xc0, 0xc0));  	marginNumberPadding = 3;  	ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side diff --git a/src/ViewStyle.h b/src/ViewStyle.h index d5a9d5b71..be84598f1 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -72,6 +72,17 @@ struct ForeBackColours {  	ColourOptional back;  }; +struct EdgeProperties { +	int column; +	ColourDesired colour; +	EdgeProperties(int column_ = 0, ColourDesired colour_ = ColourDesired(0)) : +		column(column_), colour(colour_) { +	} +	EdgeProperties(uptr_t wParam, sptr_t lParam) : +		column(static_cast<int>(wParam)), colour(static_cast<long>(lParam)) { +	} +}; +  /**   */  class ViewStyle { @@ -130,8 +141,6 @@ public:  	bool alwaysShowCaretLineBackground;  	ColourDesired caretLineBackground;  	int caretLineAlpha; -	ColourDesired edgecolour; -	int edgeState;  	int caretStyle;  	int caretWidth;  	bool someStylesProtected; @@ -146,7 +155,9 @@ public:  	int braceHighlightIndicator;  	bool braceBadLightIndicatorSet;  	int braceBadLightIndicator; -	int theEdge; +	int edgeState; +	EdgeProperties theEdge; +	std::vector<EdgeProperties> theMultiEdge;  	int marginNumberPadding; // the right-side padding of the number margin  	int ctrlCharPadding; // the padding around control character text blobs  	int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs | 
