]> git.lyx.org Git - lyx.git/blobdiff - src/RowPainter.cpp
Update some files
[lyx.git] / src / RowPainter.cpp
index e547888cf9bd7b82ffb5daec3451aa248e785843..b05b143fb481e2a00b2214b6bcc3eebd75612847 100644 (file)
@@ -119,6 +119,7 @@ void RowPainter::paintInset(Row::Element const & e) const
        e.inset->drawBackground(pi_, x1, yo_);
        e.inset->drawSelection(pi_, x1, yo_);
        e.inset->draw(pi_, x1, yo_);
+       paintTextDecoration(e);
 
        // Restore full_repaint status.
        pi_.full_repaint = pi_full_repaint;
@@ -429,14 +430,10 @@ void RowPainter::paintLabel() const
        Layout const & layout = par_.layout();
        FontInfo const font = labelFont(false);
        FontMetrics const & fm = theFontMetrics(font);
-       double x = x_;
-
-       if (row_.isRTL())
-               x = xo_ + row_.width() + fm.width(layout.labelsep);
-       else
-               x = x_ - fm.width(layout.labelsep) - fm.width(str);
+       int const x = row_.isRTL() ? row_.width() + fm.width(layout.labelsep)
+                                  : row_.left_margin - fm.width(layout.labelsep) - fm.width(str);
 
-       pi_.pain.text(int(x), yo_, str, font);
+       pi_.pain.text(int(xo_) + x, yo_, str, font);
 }
 
 
@@ -476,65 +473,9 @@ void RowPainter::paintTopLevelLabel() const
 }
 
 
-/** Check if the current paragraph is the last paragraph in a
-    proof environment */
-static int getEndLabel(pit_type p, Text const & text)
-{
-       ParagraphList const & pars = text.paragraphs();
-       pit_type pit = p;
-       depth_type par_depth = pars[p].getDepth();
-       while (pit != pit_type(pars.size())) {
-               Layout const & layout = pars[pit].layout();
-               int const endlabeltype = layout.endlabeltype;
-
-               if (endlabeltype != END_LABEL_NO_LABEL) {
-                       if (p + 1 == pit_type(pars.size()))
-                               return endlabeltype;
-
-                       depth_type const next_depth =
-                               pars[p + 1].getDepth();
-                       if (par_depth > next_depth ||
-                           (par_depth == next_depth && layout != pars[p + 1].layout()))
-                               return endlabeltype;
-                       break;
-               }
-               if (par_depth == 0)
-                       break;
-               pit = text.outerHook(pit);
-               if (pit != pit_type(pars.size()))
-                       par_depth = pars[pit].getDepth();
-       }
-       return END_LABEL_NO_LABEL;
-}
-
-
 void RowPainter::paintLast() const
 {
-       int const endlabel = getEndLabel(row_.pit(), text_);
-
-       // paint imaginary end-of-paragraph character
-
-       Change const & change = par_.lookupChange(par_.size());
-       if (change.changed()) {
-               FontMetrics const & fm =
-                       theFontMetrics(pi_.base.bv->buffer().params().getFont());
-               int const length = fm.maxAscent() / 2;
-               Color col = change.color();
-
-               pi_.pain.line(int(x_) + 1, yo_ + 2, int(x_) + 1, yo_ + 2 - length, col,
-                          Painter::line_solid, 3);
-
-               if (change.deleted()) {
-                       pi_.pain.line(int(x_) + 1 - length, yo_ + 2, int(x_) + 1 + length,
-                               yo_ + 2, col, Painter::line_solid, 3);
-               } else {
-                       pi_.pain.line(int(x_) + 1 - length, yo_ + 2, int(x_) + 1,
-                               yo_ + 2, col, Painter::line_solid, 3);
-               }
-       }
-
-       // draw an endlabel
-
+       int const endlabel = text_.getEndLabel(row_.pit());
        switch (endlabel) {
        case END_LABEL_BOX:
        case END_LABEL_FILLED_BOX: {
@@ -557,9 +498,9 @@ void RowPainter::paintLast() const
                }
 
                if (endlabel == END_LABEL_BOX)
-                       pi_.pain.rectangle(xo_ + x, y, size, size, font.realColor());
+                       pi_.pain.rectangle(int(xo_) + x, y, size, size, font.realColor());
                else
-                       pi_.pain.fillRectangle(xo_ + x, y, size, size, font.realColor());
+                       pi_.pain.fillRectangle(int(xo_) + x, y, size, size, font.realColor());
                break;
        }
 
@@ -611,7 +552,6 @@ void RowPainter::paintText()
 
                case Row::INSET:
                        paintInset(e);
-                       paintTextDecoration(e);
                        break;
 
                case Row::SPACE: