]> git.lyx.org Git - lyx.git/commitdiff
* TextMetrics::draw(): withdraw first row ascent before drawing because the conventio...
authorAbdelrazak Younes <younes@lyx.org>
Sun, 9 Sep 2007 20:21:43 +0000 (20:21 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 9 Sep 2007 20:21:43 +0000 (20:21 +0000)
All other files: adapt to above change.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20177 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp
src/TextMetrics.cpp
src/insets/InsetCaption.cpp
src/insets/InsetCollapsable.cpp
src/insets/InsetTabular.cpp
src/insets/InsetText.cpp

index b3009da16a9837d0148d54793e88fae1b6bda049..cec416633d704951bdf8542fd78374e287502662 100644 (file)
@@ -1547,11 +1547,11 @@ void BufferView::draw(frontend::Painter & pain)
        LYXERR(Debug::PAINTING) << "\t\t*** START DRAWING ***" << endl;
        Text & text = buffer_.text();
        TextMetrics const & tm = text_metrics_[&text];
+       int y = metrics_info_.y1 + tm.parMetrics(metrics_info_.p1).ascent();
        if (!pi.full_repaint)
-               tm.drawParagraph(pi, metrics_info_.p1, 0,
-               metrics_info_.y1 + tm.parMetrics(metrics_info_.p1).ascent());
+               tm.drawParagraph(pi, metrics_info_.p1, 0, y);
        else
-               tm.draw(pi, 0, metrics_info_.y1);
+               tm.draw(pi, 0, y);
        LYXERR(Debug::PAINTING) << "\n\t\t*** END DRAWING  ***" << endl;
 
        // and grey out above (should not happen later)
index 2c6ec96c6da2f90c558c9fc7f448d18408c6acc4..f9c533e7e3ae7ea5d8aa86666ea5ff66b308c852 100644 (file)
@@ -1806,6 +1806,7 @@ void TextMetrics::draw(PainterInfo & pi, int x, int y) const
 
        ParMetricsCache::const_iterator it = par_metrics_.begin();
        ParMetricsCache::const_iterator const pm_end = par_metrics_.end();
+       y -= it->second.ascent();
        for (; it != pm_end; ++it) {
                ParagraphMetrics const & pmi = it->second;
                y += pmi.ascent();
index 3505728c937d0fa39e588a4777f794640e1dcaa7..7b25e463d1723345b9cedcc3e9579c46633944c8 100644 (file)
@@ -163,8 +163,7 @@ void InsetCaption::draw(PainterInfo & pi, int x, int y) const
        labelwidth_ = pi.pain.text(x, y, full_label_, pi.base.font);
        // add some space to separate the label from the inset text
        labelwidth_ += 2 * TEXT_TO_INSET_OFFSET;
-       int const ty  = y - ascent() + TEXT_TO_INSET_OFFSET;
-       InsetText::draw(pi, x + labelwidth_, ty);
+       InsetText::draw(pi, x + labelwidth_, y);
        setPosCache(pi, x, y);
 }
 
index 47c55fe110aa60637cf6204ca61dbe078ffb0ddf..bec8c17c80ed5fc12e1691a206688a29db3b0413 100644 (file)
@@ -267,8 +267,7 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
                button_dim.y2 = 0;
        }
 
-       TextMetrics const & tm = pi.base.bv->textMetrics(&text_);
-       int const baseline = y - tm.ascent();
+       int const baseline = y;
        int textx, texty;
        switch (geometry()) {
        case LeftButton:
index d2a125c2eb681774aad96cfb55e201df0a1655bf..ff89ddd931bc79b265dd8b576b6d6015bfab2108 100644 (file)
@@ -3015,7 +3015,6 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
                int const a = tabular.rowAscent(i);
                int const d = tabular.rowDescent(i);
                idx = tabular.cellIndex(i, 0);
-               int const cy = y - a;
                for (col_type j = 0; j < tabular.columnCount(); ++j) {
                        if (tabular.isPartOfMultiColumn(i, j))
                                continue;
@@ -3028,11 +3027,11 @@ void InsetTabular::draw(PainterInfo & pi, int x, int y) const
                            || y + d < 0
                            || y - a > bv->workHeight()) {
                                pi.pain.setDrawingEnabled(false);
-                               cell(idx)->draw(pi, cx, cy);
+                               cell(idx)->draw(pi, cx, y);
                                drawCellLines(pi.pain, nx, y, i, idx, pi.erased_);
                                pi.pain.setDrawingEnabled(true);
                        } else {
-                               cell(idx)->draw(pi, cx, cy);
+                               cell(idx)->draw(pi, cx, y);
                                drawCellLines(pi.pain, nx, y, i, idx, pi.erased_);
                        }
                        nx += tabular.columnWidth(idx);
index d6a01cc60780397b046ba2ec8474cddbe8cee9bd..ebd2f3873452c7661fa1c87426a3f798afe0c65d 100644 (file)
@@ -191,9 +191,9 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
                int const a = border_;
                int const h = a + tm.height() + border_;
                if (pi.full_repaint)
-                       pi.pain.fillRectangle(x, y - a, w, h, backgroundColor());
+                       pi.pain.fillRectangle(x, y - a - tm.ascent(), w, h, backgroundColor());
                if (drawFrame_)
-                       pi.pain.rectangle(x, y - a, w, h, frameColor());
+                       pi.pain.rectangle(x, y - a - tm.ascent(), w, h, frameColor());
        }
        tm.draw(pi, x + border_, y);
 }