... could die. The attached patch basically disables Inset::update() and yet the sky does not fall on our heads.
There are some glitches in the table drawing (I've seen diagonal(!) lines once) and somehow everything is left-aligned there but nested minipages etc seem flawlessly. 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: rowpainter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v retrieving revision 1.18 diff -u -p -r1.18 rowpainter.C --- rowpainter.C 30 May 2003 06:48:20 -0000 1.18 +++ rowpainter.C 3 Jun 2003 06:42:42 -0000 @@ -105,7 +105,12 @@ void RowPainter::paintInset(pos_type con lyx::Assert(inset); #warning inset->update FIXME - inset->update(perv(bv_), false); + //inset->update(perv(bv_), false); + MetricsInfo mi; + mi.base.bv = perv(bv_); + mi.base.font = getFont(pos); + Dimension dim; + inset->metrics(mi, dim); PainterInfo pi(perv(bv_)); pi.base.font = getFont(pos); @@ -291,8 +296,6 @@ void RowPainter::paintFromPos(pos_type & } paintForeignMark(orig_x, orig_font); - - return; } Index: text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.365 diff -u -p -r1.365 text.C --- text.C 28 May 2003 16:36:53 -0000 1.365 +++ text.C 3 Jun 2003 06:42:43 -0000 @@ -310,7 +310,7 @@ int LyXText::singleWidth(ParagraphList:: // this IS needed otherwise on initialitation we don't get the fill // of the row right (ONLY on initialization if we read a file!) // should be changed! (Jug 20011204) - tmpinset->update(bv()); + //tmpinset->update(bv()); #endif return tmpinset->width(bv(), font); } @@ -1071,7 +1071,7 @@ void LyXText::setHeightOfRow(RowList::it if (tmpinset) { #if 1 // this is needed for deep update on initialitation #warning inset->update FIXME - tmpinset->update(bv()); + //tmpinset->update(bv()); #endif maxwidth += tmpinset->width(bv(), tmpfont); maxasc = max(maxasc, Index: frontends/font_metrics.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/font_metrics.h,v retrieving revision 1.6 diff -u -p -r1.6 font_metrics.h --- frontends/font_metrics.h 1 Dec 2002 22:59:18 -0000 1.6 +++ frontends/font_metrics.h 3 Jun 2003 06:42:43 -0000 @@ -16,6 +16,7 @@ #include "LString.h" class LyXFont; +class Dimension; /** * A namespace holding helper functions for determining @@ -55,6 +56,10 @@ namespace font_metrics { int rbearing(char c, LyXFont const & f); /// return the width of the string in the font int width(char const * s, size_t n, LyXFont const & f); + /// dimension of string + void dim(string const & s, LyXFont const & f, Dimension & dim); + /// dimension of string + void dim(char c, LyXFont const & f, Dimension & dim); /// return the width of the char in the font inline int width(char c, LyXFont const & f) { return width(&c, 1, f); Index: insets/inset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/inset.h,v retrieving revision 1.98 diff -u -p -r1.98 inset.h --- insets/inset.h 2 Jun 2003 16:14:33 -0000 1.98 +++ insets/inset.h 3 Jun 2003 06:42:43 -0000 @@ -161,8 +161,8 @@ public: /// int width(BufferView *, LyXFont const &) const; /// update the inset representation - virtual void update(BufferView *, bool = false) - {} + //virtual void update(BufferView *, bool = false) + // {} /// what appears in the minibuffer when opening virtual string const editMessage() const; /// Index: insets/insetcollapsable.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v retrieving revision 1.147 diff -u -p -r1.147 insetcollapsable.C --- insets/insetcollapsable.C 2 Jun 2003 10:03:22 -0000 1.147 +++ insets/insetcollapsable.C 3 Jun 2003 06:42:43 -0000 @@ -285,7 +285,7 @@ int InsetCollapsable::docbook(Buffer con return inset.docbook(buf, os, mixcont); } - +/* void InsetCollapsable::update(BufferView * bv, bool reinit) { if (in_update) { @@ -301,6 +301,7 @@ void InsetCollapsable::update(BufferView } in_update = false; } +*/ Inset::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd) 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 3 Jun 2003 06:42:43 -0000 @@ -83,16 +83,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/insetert.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v retrieving revision 1.128 diff -u -p -r1.128 insetert.C --- insets/insetert.C 2 Jun 2003 10:03:22 -0000 1.128 +++ insets/insetert.C 3 Jun 2003 06:42:43 -0000 @@ -456,7 +456,7 @@ Inset::RESULT InsetERT::localDispatch(Fu t->need_break_row = t->rows().begin(); t->fullRebreak(); t->setCursorIntern(t->cursor.par(), t->cursor.pos()); - inset.update(cmd.view(), true); + //inset.update(cmd.view(), true); bv->updateInset(this); result = DISPATCHED; } @@ -674,7 +674,7 @@ void InsetERT::update(BufferView * bv, b setButtonLabel(); } - InsetCollapsable::update(bv, reinit); + //InsetCollapsable::update(bv, reinit); } 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 3 Jun 2003 06:42:43 -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/insetinclude.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetinclude.C,v retrieving revision 1.120 diff -u -p -r1.120 insetinclude.C --- insets/insetinclude.C 2 Jun 2003 10:03:22 -0000 1.120 +++ insets/insetinclude.C 3 Jun 2003 06:42:43 -0000 @@ -536,14 +536,7 @@ void InsetInclude::draw(PainterInfo & pi if (!preview_->monitoring()) preview_->startMonitoring(); - Dimension dim; - MetricsInfo mi; - mi.base.bv = pi.base.bv; - mi.base.font = pi.base.font; - metrics(mi, dim); - dim_ = dim; - - pi.pain.image(x, y - dim.asc, dim.wid, dim.height(), + pi.pain.image(x, y - dim_.asc, dim_.wid, dim_.height(), *(preview_->pimage()->image())); } 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 3 Jun 2003 06:42:44 -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: insets/insetminipage.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetminipage.C,v retrieving revision 1.76 diff -u -p -r1.76 insetminipage.C --- insets/insetminipage.C 2 Jun 2003 10:03:22 -0000 1.76 +++ insets/insetminipage.C 3 Jun 2003 06:42:44 -0000 @@ -121,7 +121,7 @@ dispatch_result InsetMinipage::localDisp LyXText * t = inset.getLyXText(cmd.view()); t->need_break_row = t->rows().begin(); t->fullRebreak(); - inset.update(cmd.view(), true); + //inset.update(cmd.view(), true); t->setCursorIntern(t->cursor.par(), t->cursor.pos()); cmd.view()->updateInset(this); return DISPATCHED; Index: insets/insettabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v retrieving revision 1.284 diff -u -p -r1.284 insettabular.C --- insets/insettabular.C 2 Jun 2003 16:40:38 -0000 1.284 +++ insets/insettabular.C 3 Jun 2003 06:42:44 -0000 @@ -243,9 +243,9 @@ void InsetTabular::read(Buffer const * b } -void InsetTabular::metrics(MetricsInfo &, - Dimension & dim) const +void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const { + calculate_dimensions_of_cells(mi.base.bv, true); dim.asc = tabular->GetAscentOfRow(0); dim.des = tabular->GetHeightOfTabular() - tabular->GetAscentOfRow(0) + 1; dim.wid = tabular->GetWidthOfTabular() + 2 * ADD_TO_TABULAR_WIDTH; @@ -382,7 +382,7 @@ void InsetTabular::drawCellSelection(Pai } } - +/* void InsetTabular::update(BufferView * bv, bool reinit) { if (in_update) { @@ -428,6 +428,7 @@ void InsetTabular::update(BufferView * b } in_update = false; } +*/ string const InsetTabular::editMessage() const @@ -1285,8 +1286,8 @@ bool InsetTabular::calculate_dimensions_ continue; ++cell; inset = tabular->GetCellInset(cell); - if (!reinit && !tabular->GetPWidth(cell).zero()) - inset->update(bv, false); + //if (!reinit && !tabular->GetPWidth(cell).zero()) + // inset->update(bv, false); maxAsc = max(maxAsc, inset->ascent(bv, font)); maxDesc = max(maxDesc, inset->descent(bv, font)); changed = tabular->SetWidthOfCell(cell, inset->width(bv, font)) || changed; Index: insets/insettext.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v retrieving revision 1.404 diff -u -p -r1.404 insettext.C --- insets/insettext.C 2 Jun 2003 10:03:23 -0000 1.404 +++ insets/insettext.C 3 Jun 2003 06:42:44 -0000 @@ -422,7 +422,7 @@ void InsetText::draw(PainterInfo & pi, i void InsetText::drawFrame(Painter & pain, int x) const { - static int const ttoD2 = TEXT_TO_INSET_OFFSET / 2; + int const ttoD2 = TEXT_TO_INSET_OFFSET / 2; frame_x = x + ttoD2; frame_y = top_baseline - dim_.asc + ttoD2; frame_w = dim_.wid - TEXT_TO_INSET_OFFSET; @@ -432,6 +432,7 @@ void InsetText::drawFrame(Painter & pain } +/* void InsetText::update(BufferView * bv, bool reinit) { if (in_update) { @@ -492,6 +493,7 @@ void InsetText::update(BufferView * bv, old_max_width = nw; } } +*/ void InsetText::setUpdateStatus(BufferView * bv, int what) const Index: mathed/button_inset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/button_inset.C,v retrieving revision 1.11 diff -u -p -r1.11 button_inset.C --- mathed/button_inset.C 2 Jun 2003 10:03:24 -0000 1.11 +++ mathed/button_inset.C 3 Jun 2003 06:42:44 -0000 @@ -4,6 +4,7 @@ #include "button_inset.h" #include "math_support.h" #include "metricsinfo.h" +#include "math_data.h" #include "frontends/Painter.h" #include <algorithm> 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 3 Jun 2003 06:42:44 -0000 @@ -21,6 +21,7 @@ #include "math_charinset.h" #include "math_arrayinset.h" #include "metricsinfo.h" +#include "math_data.h" #include "math_deliminset.h" #include "math_hullinset.h" #include "math_support.h" @@ -219,15 +220,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 3 Jun 2003 06:42:44 -0000 @@ -21,6 +21,7 @@ #include "math_macrotable.h" #include "math_macrotemplate.h" #include "metricsinfo.h" +#include "math_data.h" #include "math_support.h" #include "math_mathmlstream.h" #include "BufferView.h" @@ -171,15 +172,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); Index: mathed/math_amsarrayinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_amsarrayinset.C,v retrieving revision 1.16 diff -u -p -r1.16 math_amsarrayinset.C --- mathed/math_amsarrayinset.C 2 Jun 2003 10:03:24 -0000 1.16 +++ mathed/math_amsarrayinset.C 3 Jun 2003 06:42:44 -0000 @@ -2,6 +2,7 @@ #include "math_amsarrayinset.h" #include "math_mathmlstream.h" +#include "math_data.h" #include "metricsinfo.h" #include "math_streamstr.h" #include "math_support.h" Index: mathed/math_arrayinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_arrayinset.C,v retrieving revision 1.41 diff -u -p -r1.41 math_arrayinset.C --- mathed/math_arrayinset.C 2 Jun 2003 10:03:24 -0000 1.41 +++ mathed/math_arrayinset.C 3 Jun 2003 06:42:44 -0000 @@ -1,10 +1,10 @@ #include <config.h> - #include "math_arrayinset.h" #include "math_parser.h" #include "math_mathmlstream.h" #include "metricsinfo.h" +#include "math_data.h" #include "math_streamstr.h" #include "Lsstream.h" Index: mathed/math_binaryopinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_binaryopinset.C,v retrieving revision 1.14 diff -u -p -r1.14 math_binaryopinset.C --- mathed/math_binaryopinset.C 2 Jun 2003 10:03:24 -0000 1.14 +++ mathed/math_binaryopinset.C 3 Jun 2003 06:42:44 -0000 @@ -1,10 +1,10 @@ #include <config.h> - #include "math_binaryopinset.h" #include "PainterInfo.h" #include "support/LOstream.h" #include "math_support.h" +#include "math_data.h" #include "math_mathmlstream.h" Index: mathed/math_binominset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_binominset.C,v retrieving revision 1.22 diff -u -p -r1.22 math_binominset.C --- mathed/math_binominset.C 2 Jun 2003 10:03:24 -0000 1.22 +++ mathed/math_binominset.C 3 Jun 2003 06:42:44 -0000 @@ -2,6 +2,7 @@ #include "math_binominset.h" #include "math_support.h" +#include "math_data.h" #include "support/LOstream.h" #include "math_mathmlstream.h" Index: mathed/math_boxinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_boxinset.C,v retrieving revision 1.26 diff -u -p -r1.26 math_boxinset.C --- mathed/math_boxinset.C 2 Jun 2003 10:03:24 -0000 1.26 +++ mathed/math_boxinset.C 3 Jun 2003 06:42:44 -0000 @@ -2,6 +2,7 @@ #include "math_boxinset.h" #include "math_support.h" +#include "math_data.h" #include "math_mathmlstream.h" #include "math_streamstr.h" #include "support/LOstream.h" Index: mathed/math_braceinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_braceinset.C,v retrieving revision 1.21 diff -u -p -r1.21 math_braceinset.C --- mathed/math_braceinset.C 2 Jun 2003 10:03:24 -0000 1.21 +++ mathed/math_braceinset.C 3 Jun 2003 06:42:44 -0000 @@ -1,6 +1,7 @@ #include <config.h> #include "math_braceinset.h" +#include "math_data.h" #include "math_parser.h" #include "math_support.h" #include "math_mathmlstream.h" Index: mathed/math_casesinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_casesinset.C,v retrieving revision 1.19 diff -u -p -r1.19 math_casesinset.C --- mathed/math_casesinset.C 2 Jun 2003 10:03:24 -0000 1.19 +++ mathed/math_casesinset.C 3 Jun 2003 06:42:44 -0000 @@ -1,7 +1,7 @@ #include <config.h> - #include "math_casesinset.h" +#include "math_data.h" #include "math_parser.h" #include "math_mathmlstream.h" #include "math_support.h" Index: mathed/math_decorationinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_decorationinset.C,v retrieving revision 1.56 diff -u -p -r1.56 math_decorationinset.C --- mathed/math_decorationinset.C 2 Jun 2003 10:03:25 -0000 1.56 +++ mathed/math_decorationinset.C 3 Jun 2003 06:42:45 -0000 @@ -1,8 +1,8 @@ #include <config.h> - #include "math_decorationinset.h" #include "math_support.h" +#include "math_data.h" #include "math_parser.h" #include "math_mathmlstream.h" #include "math_streamstr.h" Index: mathed/math_deliminset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_deliminset.C,v retrieving revision 1.64 diff -u -p -r1.64 math_deliminset.C --- mathed/math_deliminset.C 2 Jun 2003 10:03:25 -0000 1.64 +++ mathed/math_deliminset.C 3 Jun 2003 06:42:45 -0000 @@ -1,6 +1,7 @@ #include <config.h> #include "math_deliminset.h" +#include "math_data.h" #include "math_parser.h" #include "math_support.h" #include "math_mathmlstream.h" Index: mathed/math_diffinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_diffinset.C,v retrieving revision 1.14 diff -u -p -r1.14 math_diffinset.C --- mathed/math_diffinset.C 2 Jun 2003 10:03:25 -0000 1.14 +++ mathed/math_diffinset.C 3 Jun 2003 06:42:45 -0000 @@ -1,5 +1,6 @@ #include "math_diffinset.h" +#include "math_data.h" #include "math_support.h" #include "math_mathmlstream.h" #include "math_symbolinset.h" Index: mathed/math_tabularinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_tabularinset.C,v retrieving revision 1.4 diff -u -p -r1.4 math_tabularinset.C --- mathed/math_tabularinset.C 2 Jun 2003 10:03:27 -0000 1.4 +++ mathed/math_tabularinset.C 3 Jun 2003 06:42:46 -0000 @@ -5,6 +5,7 @@ #include "math_parser.h" #include "math_mathmlstream.h" #include "metricsinfo.h" +#include "math_data.h" #include "math_streamstr.h" #include "Lsstream.h" Index: mathed/math_textinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_textinset.C,v retrieving revision 1.10 diff -u -p -r1.10 math_textinset.C --- mathed/math_textinset.C 2 Jun 2003 10:03:27 -0000 1.10 +++ mathed/math_textinset.C 3 Jun 2003 06:42:46 -0000 @@ -1,6 +1,7 @@ #include "math_textinset.h" #include "metricsinfo.h" +#include "math_data.h" #include "debug.h"