int const desc = e.inset ? e.dim.descent() : 0;
int const y = yo_ + min(3 * pi_.base.solidLineOffset() / 2 + desc,
row_.descent() - 1);
- pi_.pain.line(int(x_), y, int(x_ + e.full_width()), y, Color_language,
+ pi_.pain.line(int(x_), y, int(x_ + e.full_width() - 1), y, Color_language,
Painter::line_solid, pi_.base.solidLineThickness());
}
}
+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::paintChange(Row::Element const & e) const
{
e.change.paintCue(pi_, x_, yo_, x_ + e.full_width(), e.font.fontInfo());
for (depth_type i = 1; i <= depth; ++i) {
int const w = nestMargin() / 5;
int x = int(xo_) + w * i;
- // only consider the changebar space if we're drawing outermost text
+ // consider the bufferview left margin if we're drawing outermost text
if (text_.isMainText())
- x += changebarMargin();
+ x += pi_.base.bv->leftMargin();
int const starty = yo_ - row_.ascent();
int const h = row_.height() - 1 - (i - next_depth - 1) * 3;
Layout const & layout = par_.layout();
FontInfo const font = labelFont(false);
FontMetrics const & fm = theFontMetrics(font);
- double x = x_;
+ int const x = row_.isRTL() ? row_.width() + fm.width(layout.labelsep)
+ : row_.left_margin - fm.width(layout.labelsep) - fm.width(str);
- if (row_.isRTL())
- x = tm_.width() - row_.right_margin + fm.width(layout.labelsep);
- else
- x = x_ - fm.width(layout.labelsep) - fm.width(str);
-
- pi_.pain.text(int(x), yo_, str, font);
+ pi_.pain.text(xo_ + x, yo_, str, font);
}
double x = x_;
if (layout.labeltype == LABEL_CENTERED) {
- x = row_.left_margin + (tm_.width() - row_.left_margin - row_.right_margin) / 2;
+ x += (tm_.width() - row_.left_margin - row_.right_margin) / 2;
x -= fm.width(str) / 2;
} else if (row_.isRTL()) {
- x = tm_.width() - row_.right_margin - fm.width(str);
+ x = xo_ + tm_.width() - row_.right_margin - fm.width(str);
}
pi_.pain.text(int(x), yo_ - maxdesc - labeladdon, str, font);
}
}
if (endlabel == END_LABEL_BOX)
- pi_.pain.rectangle(x, y, size, size, font.realColor());
+ pi_.pain.rectangle(int(xo_) + x, y, size, size, font.realColor());
else
- pi_.pain.fillRectangle(x, y, size, size, font.realColor());
+ pi_.pain.fillRectangle(int(xo_) + x, y, size, size, font.realColor());
break;
}
void RowPainter::paintOnlyInsets()
{
- Row::const_iterator cit = row_.begin();
- Row::const_iterator const & end = row_.end();
- for ( ; cit != end ; ++cit) {
- Row::Element const & e = *cit;
+ for (Row::Element const & e : row_) {
if (e.type == Row::INSET) {
paintInset(e);
// The markings of foreign languages
void RowPainter::paintText()
{
- Row::const_iterator cit = row_.begin();
- Row::const_iterator const & end = row_.end();
- for ( ; cit != end ; ++cit) {
- Row::Element const & e = *cit;
-
+ for (Row::Element const & e : row_) {
switch (e.type) {
case Row::STRING:
case Row::VIRTUAL:
case Row::INSET:
paintInset(e);
+ paintTextDecoration(e);
break;
case Row::SPACE:
- pi_.pain.textDecoration(e.font.fontInfo(), int(x_), yo_, int(e.full_width()));
+ paintTextDecoration(e);
}
// The markings of foreign languages