diff --git a/src/render/text/viewer.cpp b/src/render/text/viewer.cpp index 4c41ac74..b807d40b 100644 --- a/src/render/text/viewer.cpp +++ b/src/render/text/viewer.cpp @@ -67,6 +67,11 @@ TextViewer::~TextViewer() {} void TextViewer::draw(RotatedDC& dc, const TextStyle& style, DrawWhat what) { assert(!lines.empty()); Rotater r(dc, style.getRotation()); + // separator lines? + // do this first, so pen is still set from drawing the field border + if (what & DRAW_BORDERS) { + drawSeparators(dc); + } // Draw the text, line by line FOR_EACH(l, lines) { if (l.visible(dc)) { @@ -98,6 +103,26 @@ void TextViewer::Line::drawSelection(RotatedDC& dc, size_t sel_start, size_t sel } } +void TextViewer::drawSeparators(RotatedDC& dc) { + // separator lines + bool separator = false; + double y = 0; + FOR_EACH(l, lines) { + double y2 = l.top + l.line_height; + if (separator && l.visible(dc)) { + // between the two lines + y = (y + l.top) / 2; + dc.DrawLine(RealPoint(0, y), RealPoint(dc.getInternalRect().width, y)); + } + separator = l.separator_after; + y = y2; + } + // separator at the end? + if (separator) { + dc.DrawLine(RealPoint(0, y), RealPoint(dc.getInternalRect().width, y)); + } +} + void TextViewer::prepare(RotatedDC& dc, const String& text, const TextStyle& style, Context& ctx) { if (lines.empty()) { // not prepared yet diff --git a/src/render/text/viewer.hpp b/src/render/text/viewer.hpp index 325f5119..2417048a 100644 --- a/src/render/text/viewer.hpp +++ b/src/render/text/viewer.hpp @@ -50,6 +50,8 @@ class TextViewer { void draw(RotatedDC& dc, const TextStyle& style, DrawWhat what); /// Draw an indicator for selected text void drawSelection(RotatedDC& dc, const TextStyle& style, size_t sel_start, size_t sel_end); + /// Draw separators for tags + void drawSeparators(RotatedDC& dc); /// Prepare the text for drawing, if it is not already prepared void prepare(RotatedDC& dc, const String& text, const TextStyle& style, Context&);