mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-20 06:49:56 +00:00
* TextMetrics::draw(): withdraw first row ascent before drawing because the convention is that the baseline of a multirow text is the baseline of the first row.
All other files: adapt to above change. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20177 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
36174647c8
commit
c3e3534148
@ -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)
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user