diff options
| -rw-r--r-- | doc/ScintillaDoc.html | 29 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
| -rw-r--r-- | include/Scintilla.h | 4 | ||||
| -rw-r--r-- | include/Scintilla.iface | 11 | ||||
| -rw-r--r-- | src/EditView.cxx | 26 | ||||
| -rw-r--r-- | src/Editor.cxx | 8 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 2 | ||||
| -rw-r--r-- | src/ViewStyle.h | 3 | 
8 files changed, 76 insertions, 11 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 9d60800cd..70ce8623f 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -2107,6 +2107,8 @@ struct Sci_TextToFind {       <a class="message" href="#SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int      size)</a><br />       <a class="message" href="#SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE → int</a><br /> +     <a class="message" href="#SCI_SETTABDRAWMODE">SCI_SETTABDRAWMODE(int tabDrawMode)</a><br /> +     <a class="message" href="#SCI_GETTABDRAWMODE">SCI_GETTABDRAWMODE → int</a><br />       <a class="message" href="#SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</a><br />       <a class="message" href="#SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT → int</a><br />       <a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br /> @@ -2174,6 +2176,33 @@ struct Sci_TextToFind {       The <code>SCI_GETWHITESPACESIZE</code> message retrieves the current size.      </p> +    <p><b id="SCI_SETTABDRAWMODE">SCI_SETTABDRAWMODE(int tabDrawMode)</b><br /> +     <b id="SCI_GETTABDRAWMODE">SCI_GETTABDRAWMODE → int</b><br /> +    These two messages get and set how tab characters are drawn when white space is visible. +    The <code class="parameter">tabDrawMode</code> argument can be one of:</p> + +    <table cellpadding="1" cellspacing="2" border="0" summary="White space policy"> +      <tbody valign="top"> +        <tr> +          <th align="left"><code>SCTD_LONGARROW</code></th> + +          <td>0</td> + +          <td>The default mode of an arrow stretching until the tabstop.</td> +        </tr> + +        <tr> +          <th align="left"><code>SCTD_STRIKEOUT</code></th> + +          <td>1</td> + +          <td>A horizontal line stretching until the tabstop.</td> +        </tr> +      </tbody> +    </table> + +    <p>The effect of using any other <code class="parameter">tabDrawMode</code> value is undefined.</p> +      <p>       <b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br />       <b id="SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT → int</b><br /> diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 3c156f49a..cd03b2b9d 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -531,6 +531,10 @@  	underneath positions or characters.  	</li>  	<li> +	Added alternate appearance for visible tabs which looks like a horizontal line. +	Controlled with SCI_SETTABDRAWMODE. +	</li> +	<li>  	Baan folder accomodates sections and lexer fixes definition of SCE_BAAN_FUNCDEF.  	</li>  	<li> diff --git a/include/Scintilla.h b/include/Scintilla.h index dd643e9ea..b6c75a32d 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -76,6 +76,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,  #define SCWS_VISIBLEONLYININDENT 3  #define SCI_GETVIEWWS 2020  #define SCI_SETVIEWWS 2021 +#define SCTD_LONGARROW 0 +#define SCTD_STRIKEOUT 1 +#define SCI_GETTABDRAWMODE 2698 +#define SCI_SETTABDRAWMODE 2699  #define SCI_POSITIONFROMPOINT 2022  #define SCI_POSITIONFROMPOINTCLOSE 2023  #define SCI_GOTOLINE 2024 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 6bb4da9b5..9f8a7db1c 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -168,6 +168,17 @@ get int GetViewWS=2020(,)  # Make white space characters invisible, always visible or visible outside indentation.  set void SetViewWS=2021(int viewWS,) +enu TabDrawMode=SCTD_ +val SCTD_LONGARROW=0 +val SCTD_STRIKEOUT=1 + +# Retrieve the current tab draw mode. +# Returns one of SCTD_* constants. +get int GetTabDrawMode=2698(,) + +# Set how tabs are drawn when visible. +set void SetTabDrawMode=2699(int tabDrawMode,) +  # Find the position from a point within the window.  fun position PositionFromPoint=2022(int x, int y) diff --git a/src/EditView.cxx b/src/EditView.cxx index 59e4e7ab7..04eea0ea5 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -306,21 +306,25 @@ static const char *ControlCharacterString(unsigned char ch) {  	}  } -static void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid) { -	int ydiff = static_cast<int>(rcTab.bottom - rcTab.top) / 2; -	int xhead = static_cast<int>(rcTab.right) - 1 - ydiff; -	if (xhead <= rcTab.left) { -		ydiff -= static_cast<int>(rcTab.left) - xhead - 1; -		xhead = static_cast<int>(rcTab.left) - 1; -	} +static void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid, const ViewStyle &vsDraw) {  	if ((rcTab.left + 2) < (rcTab.right - 1))  		surface->MoveTo(static_cast<int>(rcTab.left) + 2, ymid);  	else  		surface->MoveTo(static_cast<int>(rcTab.right) - 1, ymid);  	surface->LineTo(static_cast<int>(rcTab.right) - 1, ymid); -	surface->LineTo(xhead, ymid - ydiff); -	surface->MoveTo(static_cast<int>(rcTab.right) - 1, ymid); -	surface->LineTo(xhead, ymid + ydiff); + +	// Draw the arrow head if needed +	if (vsDraw.tabDrawMode == tdLongArrow) { +		int ydiff = static_cast<int>(rcTab.bottom - rcTab.top) / 2; +		int xhead = static_cast<int>(rcTab.right) - 1 - ydiff; +		if (xhead <= rcTab.left) { +			ydiff -= static_cast<int>(rcTab.left) - xhead - 1; +			xhead = static_cast<int>(rcTab.left) - 1; +		} +		surface->LineTo(xhead, ymid - ydiff); +		surface->MoveTo(static_cast<int>(rcTab.right) - 1, ymid); +		surface->LineTo(xhead, ymid + ydiff); +	}  }  void EditView::RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw) { @@ -1579,7 +1583,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi  							PRectangle rcTab(rcSegment.left + 1, rcSegment.top + tabArrowHeight,  								rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent);  							if (customDrawTabArrow == NULL) -								DrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2)); +								DrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2), vsDraw);  							else  								customDrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2));  						} diff --git a/src/Editor.cxx b/src/Editor.cxx index 6950ac66e..5f588b1fd 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -6288,6 +6288,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		Redraw();  		break; +	case SCI_GETTABDRAWMODE: +		return vs.tabDrawMode; + +	case SCI_SETTABDRAWMODE: +		vs.tabDrawMode = static_cast<TabDrawMode>(wParam); +		Redraw(); +		break; +  	case SCI_GETWHITESPACESIZE:  		return vs.whitespaceSize; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index e12620c96..b694a62e3 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -153,6 +153,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {  	textStart = source.textStart;  	zoomLevel = source.zoomLevel;  	viewWhitespace = source.viewWhitespace; +	tabDrawMode = source.tabDrawMode;  	whitespaceSize = source.whitespaceSize;  	viewIndentationGuides = source.viewIndentationGuides;  	viewEOL = source.viewEOL; @@ -293,6 +294,7 @@ void ViewStyle::Init(size_t stylesSize_) {  	textStart = marginInside ? fixedColumnWidth : leftMarginWidth;  	zoomLevel = 0;  	viewWhitespace = wsInvisible; +	tabDrawMode = tdLongArrow;  	whitespaceSize = 1;  	viewIndentationGuides = ivNone;  	viewEOL = false; diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 82c176c87..1a876f85e 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -55,6 +55,8 @@ enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth};  enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2, wsVisibleOnlyInIndent=3}; +enum TabDrawMode {tdLongArrow=0, tdStrikeOut=1}; +  typedef std::map<FontSpecification, FontRealised *> FontMap;  enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace }; @@ -133,6 +135,7 @@ public:  	int textStart;	///< Starting x position of text within the view  	int zoomLevel;  	WhiteSpaceVisibility viewWhitespace; +	TabDrawMode tabDrawMode;  	int whitespaceSize;  	IndentView viewIndentationGuides;  	bool viewEOL;  | 
