]> git.lyx.org Git - lyx.git/blobdiff - src/rowpainter.C
"Inter-word Space"
[lyx.git] / src / rowpainter.C
index 4e10bb0ab7df5d4615f7c71b79825e7cf1581ee4..39745f1ecff23eba18c2fcff96af72500e6a9b72 100644 (file)
@@ -33,6 +33,7 @@
 #include "rowpainter.h"
 #include "lyxrc.h"
 #include "lyxrow_funcs.h"
+#include "metricsinfo.h"
 
 using std::max;
 using lyx::pos_type;
@@ -81,7 +82,7 @@ int RowPainter::singleWidth(lyx::pos_type pos, char c) const
 
 LyXFont const RowPainter::getLabelFont() const
 {
-       return text_.getLabelFont(bv_.buffer(), &*pit_);
+       return text_.getLabelFont(bv_.buffer(), pit_);
 }
 
 
@@ -103,12 +104,14 @@ void RowPainter::paintInset(pos_type const pos)
 
        lyx::Assert(inset);
 
-       LyXFont const & font = getFont(pos);
-
 #warning inset->update FIXME
        inset->update(perv(bv_), false);
 
-       inset->draw(perv(bv_), font, yo_ + row_->baseline(), x_);
+       PainterInfo pi(perv(bv_));
+       pi.base.font = getFont(pos);
+       int const w = inset->width(perv(bv_), pi.base.font);
+       inset->draw(pi, int(x_), yo_ + row_->baseline());
+       x_ += w;
 }
 
 
@@ -634,7 +637,7 @@ void RowPainter::paintFirst()
        LyXLayout_ptr const & layout = pit_->layout();
 
        if (buffer->params.paragraph_separation == BufferParams::PARSEP_SKIP) {
-               if (pit_->previous()) {
+               if (pit_ != text_.ownerParagraphs().begin()) {
                        if (layout->latextype == LATEX_PARAGRAPH
                                && !pit_->getDepth()) {
                                y_top += buffer->params.getDefSkip().inPixels(bv_);
@@ -674,7 +677,7 @@ void RowPainter::paintFirst()
        if (layout->labeltype >= LABEL_STATIC
            && (layout->labeltype != LABEL_STATIC
                || layout->latextype != LATEX_ENVIRONMENT
-               || isFirstInSequence(&*pit_))) {
+               || isFirstInSequence(pit_, text_.ownerParagraphs()))) {
 
                LyXFont font = getLabelFont();
                if (!pit_->getLabelstring().empty()) {
@@ -722,7 +725,7 @@ void RowPainter::paintFirst()
 
        // the labels at the top of an environment.
        // More or less for bibliography
-       } else if (isFirstInSequence(&*pit_) &&
+       } else if (isFirstInSequence(pit_, text_.ownerParagraphs()) &&
                (layout->labeltype == LABEL_TOP_ENVIRONMENT ||
                layout->labeltype == LABEL_BIBLIO ||
                layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
@@ -797,7 +800,7 @@ void RowPainter::paintLast()
        }
 
        bool const is_rtl = pit_->isRightToLeftPar(bv_.buffer()->params);
-       int const endlabel = getEndLabel(&*pit_);
+       int const endlabel = getEndLabel(pit_, text_.ownerParagraphs());
 
        // draw an endlabel
        switch (endlabel) {