void RowPainter::paintTextDecoration(Row::Element const & e) const { // element selected? bool const sel = (e.pos >= row_.sel_beg && e.endpos <= row_.sel_end) || pi_.selected; FontInfo copy = e.font.fontInfo(); if (sel || e.change.changed()) { Color const col = e.change.changed() ? e.change.color() : Color_selectiontext; copy.setPaintColor(col); } pi_.pain.textDecoration(copy, int(x_), yo_, int(e.full_width())); }
void RowPainter::paintLast() const { int const endlabel = text_.getEndLabel(row_.pit()); switch (endlabel) { case END_LABEL_BOX: case END_LABEL_FILLED_BOX: { FontInfo font = labelFont(true); if (font.realColor() != Color_selectiontext) font.setPaintColor(Color_eolmarker); FontMetrics const & fm = theFontMetrics(font); int const size = int(0.75 * fm.maxAscent()); int const y = yo_ - size; // If needed, move the box a bit to avoid overlapping with text. int x = 0; if (row_.isRTL()) { int const normal_x = nestMargin() + changebarMargin(); x = min(normal_x, row_.left_margin - size - Inset::TEXT_TO_INSET_OFFSET); } else { int const normal_x = tm_.width() - row_.right_margin - size - Inset::TEXT_TO_INSET_OFFSET; x = max(normal_x, row_.width()); } if (endlabel == END_LABEL_BOX) pi_.pain.rectangle(int(xo_) + x, y, size, size, font.realColor()); else pi_.pain.fillRectangle(int(xo_) + x, y, size, size, font.realColor()); break; } case END_LABEL_STATIC: { FontInfo const font = labelFont(true); FontMetrics const & fm = theFontMetrics(font); docstring const & str = par_.layout().endlabelstring(); double const x = row_.isRTL() ? x_ - fm.width(str) : x_; pi_.pain.text(int(x), yo_, str, font); break; } case END_LABEL_NO_LABEL: break; } }