From: André Pönitz Date: Thu, 17 Jul 2003 07:32:01 +0000 (+0000) Subject: remove Inset::update() X-Git-Tag: 1.6.10~16526 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e62ce55f8cf6fb852449d8922e025c3c18829f0d;p=lyx.git remove Inset::update() git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7298 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/inset.h b/src/insets/inset.h index 84aa5b4b9a..f5c9635678 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -162,9 +162,6 @@ public: int descent(BufferView *, LyXFont const &) const; /// int width(BufferView *, LyXFont const &) const; - /// update the inset representation - virtual void update(BufferView *, bool = false) - {} /// what appears in the minibuffer when opening virtual string const editMessage() const; /// diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 43d81cc2d3..e68267c85d 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -289,23 +289,6 @@ int InsetCollapsable::docbook(Buffer const * buf, ostream & os, bool mixcont) co } -void InsetCollapsable::update(BufferView * bv, bool reinit) -{ - if (in_update) { - if (reinit && owner()) { - owner()->update(bv, true); - } - return; - } - in_update = true; - inset.update(bv, reinit); - if (reinit && owner()) { - owner()->update(bv, true); - } - in_update = false; -} - - Inset::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd) { lyxerr << "InsetCollapsable::localDispatch: " diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 3908081e6d..bfecd73dd8 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -51,8 +51,6 @@ public: /// draw, either inlined (no button) or collapsed/open void draw(PainterInfo & pi, int x, int y, bool inlined) const; /// - void update(BufferView *, bool = false); - /// EDITABLE editable() const; /// bool insertInset(BufferView *, Inset * inset); diff --git a/src/insets/insetert.C b/src/insets/insetert.C index b0f96d2497..9ac0dbe808 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -453,7 +453,6 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd) * taken by the text). */ inset.getLyXText(cmd.view())->fullRebreak(); - inset.update(cmd.view(), true); bv->updateInset(this); result = DISPATCHED; } @@ -550,6 +549,7 @@ bool InsetERT::checkInsertChar(LyXFont & /* font */) void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const { + setButtonLabel(); if (inlined()) inset.metrics(mi, dim); else @@ -662,17 +662,6 @@ int InsetERT::getMaxWidth(BufferView * bv, UpdatableInset const * in) const } -void InsetERT::update(BufferView * bv, bool reinit) -{ - if (inset.need_update & InsetText::INIT || - inset.need_update & InsetText::FULL) { - setButtonLabel(); - } - - InsetCollapsable::update(bv, reinit); -} - - string const InsetERTMailer::name_("ert"); InsetERTMailer::InsetERTMailer(InsetERT & inset) diff --git a/src/insets/insetert.h b/src/insets/insetert.h index 86811b6ac3..a6ed08548b 100644 --- a/src/insets/insetert.h +++ b/src/insets/insetert.h @@ -114,8 +114,6 @@ public: } /// int getMaxWidth(BufferView *, UpdatableInset const *) const; - /// - void update(BufferView *, bool =false); private: /// diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index ecd4a0070d..69e84c7cd0 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -119,7 +119,6 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd) /* FIXME: I refuse to believe we have to live * with ugliness like this ... */ inset.getLyXText(cmd.view())->fullRebreak(); - inset.update(cmd.view(), true); cmd.view()->updateInset(this); return DISPATCHED; } diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 7a2229a015..1672bdfa5b 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -410,11 +410,6 @@ void InsetTabular::drawCellSelection(Painter & pain, int x, int y, } -void InsetTabular::update(BufferView * bv, bool reinit) -{ -} - - string const InsetTabular::editMessage() const { return _("Opened table"); @@ -1270,8 +1265,6 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv, bool reinit) c continue; ++cell; inset = tabular.getCellInset(cell); - 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; diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index f1a4d012a2..9ff09c9c46 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -86,8 +86,6 @@ public: /// void draw(PainterInfo & pi, int x, int y) const; /// - void update(BufferView *, bool = false); - /// string const editMessage() const; // void insetUnlock(BufferView *); diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 570e8b486c..d359758e08 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -403,12 +403,6 @@ void InsetText::drawFrame(Painter & pain, int x) const } -void InsetText::update(BufferView * bv, bool reinit) -{ - setViewCache(bv); -} - - void InsetText::setUpdateStatus(int what) const { need_update |= what; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 62db777f94..8672ae8071 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -92,8 +92,6 @@ public: /// void draw(PainterInfo & pi, int x, int y) const; /// - void update(BufferView *, bool = false); - /// void setUpdateStatus(int what) const; /// string const editMessage() const; diff --git a/src/text.C b/src/text.C index d6b9af3b36..174bd209a9 100644 --- a/src/text.C +++ b/src/text.C @@ -35,6 +35,7 @@ #include "paragraph_funcs.h" #include "rowpainter.h" #include "lyxrow_funcs.h" +#include "metricsinfo.h" #include "insets/insettext.h" @@ -319,9 +320,15 @@ int LyXText::singleWidth(ParagraphList::iterator pit, // 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()); + Dimension dim; + MetricsInfo mi; + mi.base.bv = bv(); + mi.base.font = font; + tmpinset->metrics(mi, dim); #endif - return tmpinset->width(bv(), font); + //return tmpinset->width(bv(), font); + return dim.wid; } return 0; } @@ -1079,13 +1086,21 @@ void LyXText::setHeightOfRow(RowList::iterator rit) if (tmpinset) { #if 1 // this is needed for deep update on initialitation #warning inset->update FIXME - tmpinset->update(bv()); + //tmpinset->update(bv()); + Dimension dim; + MetricsInfo mi; + mi.base.bv = bv(); + mi.base.font = tmpfont; + tmpinset->metrics(mi, dim); #endif - maxwidth += tmpinset->width(bv(), tmpfont); - maxasc = max(maxasc, - tmpinset->ascent(bv(), tmpfont)); - maxdesc = max(maxdesc, - tmpinset->descent(bv(), tmpfont)); + //maxwidth += tmpinset->width(bv(), tmpfont); + //maxasc = max(maxasc, + // tmpinset->ascent(bv(), tmpfont)); + //maxdesc = max(maxdesc, + // tmpinset->descent(bv(), tmpfont)); + maxwidth += dim.wid; + maxasc = max(maxasc, dim.asc); + maxdesc = max(maxdesc, dim.des); } } else { maxwidth += singleWidth(pit, pos);