used pre-computed metrics a bit more...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7269 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-07-14 13:49:13 +00:00
parent 7e5c4e7695
commit cf319aa81c
2 changed files with 11 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2003-07-14 André Pönitz <poenitz@gmx.net>
* insettext.[Ch]: used cached metrics a bit more
2003-07-10 Alfredo Brauntein <abraunst@libero.it>
* insettabular.[Ch]: invalidate InsetTabular::view(), added buffer()

View File

@ -274,10 +274,10 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
{
BufferView * bv = mi.base.bv;
LyXText * text = getLyXText(bv);
dim.asc = text->rows().begin()->ascent_of_text() + TEXT_TO_INSET_OFFSET;
dim.des = text->height - dim.asc + TEXT_TO_INSET_OFFSET;
dim.wid = max(textWidth(bv), int(text->width)) + 2 * TEXT_TO_INSET_OFFSET;
setViewCache(bv);
dim.asc = text_.rows().begin()->ascent_of_text() + TEXT_TO_INSET_OFFSET;
dim.des = text_.height - dim.asc + TEXT_TO_INSET_OFFSET;
dim.wid = max(textWidth(bv), int(text_.width)) + 2 * TEXT_TO_INSET_OFFSET;
dim.wid = max(dim.wid, 10);
dim_ = dim;
}
@ -1938,15 +1938,13 @@ int InsetText::cix(BufferView * bv) const
int InsetText::cy(BufferView * bv) const
{
LyXFont font;
return text_.cursor.y() - ascent(bv, font) + TEXT_TO_INSET_OFFSET;
return text_.cursor.y() - dim_.asc + TEXT_TO_INSET_OFFSET;
}
int InsetText::ciy(BufferView * bv) const
{
LyXFont font;
return text_.cursor.iy() - ascent(bv, font) + TEXT_TO_INSET_OFFSET;
return text_.cursor.iy() - dim_.asc + TEXT_TO_INSET_OFFSET;
}