aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/EditView.cxx26
-rw-r--r--src/Editor.cxx8
-rw-r--r--src/ViewStyle.cxx2
-rw-r--r--src/ViewStyle.h3
4 files changed, 28 insertions, 11 deletions
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;