aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-04-01 13:41:21 +1100
committerNeil <nyamatongwe@gmail.com>2021-04-01 13:41:21 +1100
commitae3d3fb6776d56ccc16eea5e9757d522258e4c2a (patch)
tree9eee66776fd12514fef442d4ba2be96613b68b94
parentda38c9eed4232ced1ab0ff9e7ccc69f0724fbeba (diff)
downloadscintilla-mirror-ae3d3fb6776d56ccc16eea5e9757d522258e4c2a.tar.gz
Changed parameters for DrawTabArrow and DrawTabArrowFn to allow additional
traits in the future.
-rw-r--r--src/EditView.cxx15
-rw-r--r--src/EditView.h3
2 files changed, 9 insertions, 9 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index b2714f7ac..c1722a047 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -271,10 +271,10 @@ static const char *ControlCharacterString(unsigned char ch) noexcept {
}
}
-static void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid, const ViewStyle &vsDraw,
- ColourAlpha textFore, XYPOSITION widthStroke) {
+static void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid,
+ const ViewStyle &vsDraw, Stroke stroke) {
- const XYPOSITION halfWidth = widthStroke / 2.0f;
+ const XYPOSITION halfWidth = stroke.width / 2.0;
const XYPOSITION leftStroke = std::round(std::min(rcTab.left + 2, rcTab.right - 1)) + halfWidth;
const XYPOSITION rightStroke = std::max(leftStroke, std::round(rcTab.right) - 1.0f - halfWidth);
@@ -282,8 +282,7 @@ static void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid, const Vie
const Point arrowPoint(rightStroke, yMidAligned);
if (rightStroke > leftStroke) {
// When not enough room, don't draw the arrow shaft
- surface->LineDraw(Point(leftStroke, yMidAligned), arrowPoint,
- Stroke(textFore, widthStroke));
+ surface->LineDraw(Point(leftStroke, yMidAligned), arrowPoint, stroke);
}
// Draw the arrow head if needed
@@ -299,7 +298,7 @@ static void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid, const Vie
arrowPoint,
Point(xhead, yMidAligned + ydiff)
};
- surface->PolyLine(ptsHead, std::size(ptsHead), Stroke(textFore, widthStroke));
+ surface->PolyLine(ptsHead, std::size(ptsHead), stroke);
}
}
@@ -1981,9 +1980,9 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent);
const int segmentTop = static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2);
if (!customDrawTabArrow)
- DrawTabArrow(surface, rcTab, segmentTop, vsDraw, textFore, 1.0f);
+ DrawTabArrow(surface, rcTab, segmentTop, vsDraw, Stroke(textFore, 1.0f));
else
- customDrawTabArrow(surface, rcTab, segmentTop);
+ customDrawTabArrow(surface, rcTab, segmentTop, vsDraw, Stroke(textFore, 1.0f));
}
}
} else {
diff --git a/src/EditView.h b/src/EditView.h
index f5df7143f..91a925f4a 100644
--- a/src/EditView.h
+++ b/src/EditView.h
@@ -41,7 +41,8 @@ void DrawTextNoClipPhase(Surface *surface, PRectangle rc, const Style &style, XY
void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText,
const StyledText &st, size_t start, size_t length, DrawPhase phase);
-typedef void (*DrawTabArrowFn)(Surface *surface, PRectangle rcTab, int ymid);
+typedef void (*DrawTabArrowFn)(Surface *surface, PRectangle rcTab, int ymid,
+ const ViewStyle &vsDraw, Stroke stroke);
class LineTabstops;