mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
next try to single Inset::metrics() computation
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7592 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
371e05fd3e
commit
95e822007d
26
src/text.C
26
src/text.C
@ -999,21 +999,9 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
|
|||||||
if (par.isInset(pos)) {
|
if (par.isInset(pos)) {
|
||||||
InsetOld const * tmpinset = par.getInset(pos);
|
InsetOld const * tmpinset = par.getInset(pos);
|
||||||
if (tmpinset) {
|
if (tmpinset) {
|
||||||
#if 1 // this is needed for deep update on initialitation
|
|
||||||
#warning inset->update FIXME
|
|
||||||
//tmpinset->update(bv());
|
|
||||||
LyXFont const tmpfont = getFont(pit, pos);
|
|
||||||
Dimension dim;
|
|
||||||
MetricsInfo mi(bv(), tmpfont, workWidth());
|
|
||||||
tmpinset->metrics(mi, dim);
|
|
||||||
maxwidth += dim.wid;
|
|
||||||
maxasc = max(maxasc, dim.asc);
|
|
||||||
maxdesc = max(maxdesc, dim.des);
|
|
||||||
#else
|
|
||||||
maxwidth += tmpinset->width();
|
maxwidth += tmpinset->width();
|
||||||
maxasc = max(maxasc, tmpinset->ascent());
|
maxasc = max(maxasc, tmpinset->ascent());
|
||||||
maxdesc = max(maxdesc, tmpinset->descent());
|
maxdesc = max(maxdesc, tmpinset->descent());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fall-back to normal case
|
// Fall-back to normal case
|
||||||
@ -1222,23 +1210,11 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
|
|||||||
maxasc += int(layoutasc * 2 / (2 + pit->getDepth()));
|
maxasc += int(layoutasc * 2 / (2 + pit->getDepth()));
|
||||||
maxdesc += int(layoutdesc * 2 / (2 + pit->getDepth()));
|
maxdesc += int(layoutdesc * 2 / (2 + pit->getDepth()));
|
||||||
|
|
||||||
// calculate the new height of the text
|
|
||||||
height -= rit->height();
|
|
||||||
|
|
||||||
rit->height(maxasc + maxdesc + labeladdon);
|
rit->height(maxasc + maxdesc + labeladdon);
|
||||||
rit->baseline(maxasc + labeladdon);
|
rit->baseline(maxasc + labeladdon);
|
||||||
|
|
||||||
height += rit->height();
|
|
||||||
|
|
||||||
rit->top_of_text(rit->baseline() - font_metrics::maxAscent(font));
|
rit->top_of_text(rit->baseline() - font_metrics::maxAscent(font));
|
||||||
|
|
||||||
double x = 0;
|
double x = 0;
|
||||||
#if 0
|
|
||||||
// this IS needed
|
|
||||||
rit->width(maxwidth);
|
|
||||||
double dummy;
|
|
||||||
prepareToPrint(pit, rit, x, dummy, dummy, dummy, false);
|
|
||||||
#endif
|
|
||||||
rit->width(int(maxwidth + x));
|
rit->width(int(maxwidth + x));
|
||||||
if (inset_owner) {
|
if (inset_owner) {
|
||||||
width = max(0, workWidth());
|
width = max(0, workWidth());
|
||||||
@ -1984,7 +1960,7 @@ void LyXText::backspace()
|
|||||||
cursorLeft(bv());
|
cursorLeft(bv());
|
||||||
|
|
||||||
// the layout things can change the height of a row !
|
// the layout things can change the height of a row !
|
||||||
setHeightOfRow(cursor.par(), cursorRow());
|
redoParagraph();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ void LyXText::redoParagraph(ParagraphList::iterator pit)
|
|||||||
InsetList::iterator iend = pit->insetlist.end();
|
InsetList::iterator iend = pit->insetlist.end();
|
||||||
for (; ii != iend; ++ii) {
|
for (; ii != iend; ++ii) {
|
||||||
Dimension dim;
|
Dimension dim;
|
||||||
MetricsInfo mi(bv(), getFont(pit, ii->pos), 0);
|
MetricsInfo mi(bv(), getFont(pit, ii->pos), workWidth());
|
||||||
ii->inset->metrics(mi, dim);
|
ii->inset->metrics(mi, dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,6 +577,7 @@ void LyXText::redoParagraph(ParagraphList::iterator pit)
|
|||||||
rit->fill(fill(pit, rit, workWidth()));
|
rit->fill(fill(pit, rit, workWidth()));
|
||||||
prepareToPrint(pit, rit);
|
prepareToPrint(pit, rit);
|
||||||
setHeightOfRow(pit, rit);
|
setHeightOfRow(pit, rit);
|
||||||
|
height += rit->height();
|
||||||
}
|
}
|
||||||
|
|
||||||
//lyxerr << "redoParagraph: " << pit->rows.size() << " rows\n";
|
//lyxerr << "redoParagraph: " << pit->rows.size() << " rows\n";
|
||||||
@ -598,8 +599,8 @@ void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
|
|||||||
//Assert(mi.base.textwidth);
|
//Assert(mi.base.textwidth);
|
||||||
|
|
||||||
// rebuild row cache
|
// rebuild row cache
|
||||||
width = 0;
|
width = 0;
|
||||||
height = 0;
|
///height = 0;
|
||||||
|
|
||||||
//anchor_y_ = 0;
|
//anchor_y_ = 0;
|
||||||
redoParagraphs(ownerParagraphs().begin(), ownerParagraphs().end());
|
redoParagraphs(ownerParagraphs().begin(), ownerParagraphs().end());
|
||||||
|
Loading…
Reference in New Issue
Block a user