As I said, we call metrics() immediately before draw() (and stores it in the 'dim_' 'cache) so there should be no need to do it in draw() again.
If there was, something else is broken... Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson or B. Franklin or both...)
Index: insets/inseterror.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/inseterror.C,v retrieving revision 1.59 diff -u -p -r1.59 inseterror.C --- insets/inseterror.C 2 Jun 2003 10:03:22 -0000 1.59 +++ insets/inseterror.C 2 Jun 2003 10:15:09 -0000 @@ -13,7 +13,6 @@ #include "inseterror.h" #include "BufferView.h" -#include "dimension.h" #include "funcrequest.h" #include "gettext.h" #include "lyxfont.h" @@ -83,16 +82,10 @@ void InsetError::draw(PainterInfo & pi, // Draw as "Error" in a framed box x += 1; - Dimension dim; - MetricsInfo mi; - mi.base.bv = pi.base.bv; - mi.base.font = pi.base.font; - metrics(mi, dim); - dim_ = dim; - pi.pain.fillRectangle(x, y - dim.asc + 1, - dim.wid - 2, dim.asc + dim.des - 2, LColor::insetbg); - pi.pain.rectangle(x, y - dim.asc + 1, - dim.wid - 2, dim.asc + dim.des - 2, LColor::error); + pi.pain.fillRectangle(x, y - dim_.asc + 1, + dim_.wid - 2, dim_.asc + dim_.des - 2, LColor::insetbg); + pi.pain.rectangle(x, y - dim_.asc + 1, + dim_.wid - 2, dim_.asc + dim_.des - 2, LColor::error); pi.pain.text(x + 2, y, _("Error"), efont); } Index: insets/insetgraphics.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v retrieving revision 1.179 diff -u -p -r1.179 insetgraphics.C --- insets/insetgraphics.C 2 Jun 2003 10:03:22 -0000 1.179 +++ insets/insetgraphics.C 2 Jun 2003 10:15:09 -0000 @@ -342,19 +342,12 @@ void InsetGraphics::draw(PainterInfo & p cache_->view = bv->owner()->view(); int oasc = cache_->old_ascent; - Dimension dim; - MetricsInfo mi; - mi.base.bv = pi.base.bv; - mi.base.font = pi.base.font; - metrics(mi, dim); - dim_ = dim; - // we may have changed while someone other was drawing us so better // to not draw anything as we surely call to redraw ourself soon. // This is not a nice thing to do and should be fixed properly somehow. // But I still don't know the best way to go. So let's do this like this // for now (Jug 20020311) - if (dim.asc != oasc) + if (dim_.asc != oasc) return; // Make sure now that x is updated upon exit from this routine Index: insets/insetlatexaccent.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetlatexaccent.C,v retrieving revision 1.70 diff -u -p -r1.70 insetlatexaccent.C --- insets/insetlatexaccent.C 2 Jun 2003 10:03:22 -0000 1.70 +++ insets/insetlatexaccent.C 2 Jun 2003 10:15:09 -0000 @@ -362,13 +362,6 @@ void InsetLatexAccent::draw(PainterInfo if (lyxrc.font_norm_type == LyXRC::ISO_10646_1) font.setLanguage(english_language); - Dimension dim; - MetricsInfo mi; - mi.base.bv = pi.base.bv; - mi.base.font = pi.base.font; - metrics(mi, dim); - dim_ = dim; - if (candisp) { float x2 = x + (rbearing(font) - lbearing(font)) / 2.0; float hg; Index: mathed/formula.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/formula.C,v retrieving revision 1.267 diff -u -p -r1.267 formula.C --- mathed/formula.C 2 Jun 2003 10:03:24 -0000 1.267 +++ mathed/formula.C 2 Jun 2003 10:15:10 -0000 @@ -219,15 +219,9 @@ void InsetFormula::draw(PainterInfo & pi // before the metrics are computed. bool const use_preview = preview_->previewReady(); - Dimension dim; - MetricsInfo mi; - mi.base.bv = pi.base.bv; - mi.base.font = pi.base.font; - metrics(mi, dim); - dim_ = dim; - int const w = dim.wid; - int const d = dim.des; - int const a = dim.asc; + int const w = dim_.wid; + int const d = dim_.des; + int const a = dim_.asc; int const h = a + d; if (use_preview) { Index: mathed/formulamacro.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/formulamacro.C,v retrieving revision 1.126 diff -u -p -r1.126 formulamacro.C --- mathed/formulamacro.C 2 Jun 2003 10:03:24 -0000 1.126 +++ mathed/formulamacro.C 2 Jun 2003 10:15:10 -0000 @@ -132,9 +132,8 @@ string InsetFormulaMacro::prefix() const } -void InsetFormulaMacro::metrics(MetricsInfo & m, Dimension & dim) const +void InsetFormulaMacro::metrics(MetricsInfo & mi, Dimension & dim) const { - MetricsInfo mi = m; par()->metrics(mi, dim_); dim_.asc += 5; dim_.des += 5; @@ -171,15 +170,9 @@ void InsetFormulaMacro::draw(PainterInfo pi.base.style = LM_ST_TEXT; pi.base.font = font; - Dimension dim; - MetricsInfo mi; - mi.base.bv = pi.base.bv; - mi.base.font = pi.base.font; - metrics(mi, dim); - dim_ = dim; - int const a = y - dim.asc + 1; - int const w = dim.wid - 2; - int const h = dim.height() - 2; + int const a = y - dim_.asc + 1; + int const w = dim_.wid - 2; + int const h = dim_.height() - 2; // LColor::mathbg used to be "AntiqueWhite" but is "linen" now, too pi.pain.fillRectangle(x, a, w, h, LColor::mathmacrobg);