remove Inset::update()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7298 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-07-17 07:32:01 +00:00
parent cf31c9b219
commit e62ce55f8c
11 changed files with 24 additions and 62 deletions

View File

@ -162,9 +162,6 @@ public:
int descent(BufferView *, LyXFont const &) const; int descent(BufferView *, LyXFont const &) const;
/// ///
int width(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 /// what appears in the minibuffer when opening
virtual string const editMessage() const; virtual string const editMessage() const;
/// ///

View File

@ -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) Inset::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
{ {
lyxerr << "InsetCollapsable::localDispatch: " lyxerr << "InsetCollapsable::localDispatch: "

View File

@ -51,8 +51,6 @@ public:
/// draw, either inlined (no button) or collapsed/open /// draw, either inlined (no button) or collapsed/open
void draw(PainterInfo & pi, int x, int y, bool inlined) const; void draw(PainterInfo & pi, int x, int y, bool inlined) const;
/// ///
void update(BufferView *, bool = false);
///
EDITABLE editable() const; EDITABLE editable() const;
/// ///
bool insertInset(BufferView *, Inset * inset); bool insertInset(BufferView *, Inset * inset);

View File

@ -453,7 +453,6 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
* taken by the text). * taken by the text).
*/ */
inset.getLyXText(cmd.view())->fullRebreak(); inset.getLyXText(cmd.view())->fullRebreak();
inset.update(cmd.view(), true);
bv->updateInset(this); bv->updateInset(this);
result = DISPATCHED; result = DISPATCHED;
} }
@ -550,6 +549,7 @@ bool InsetERT::checkInsertChar(LyXFont & /* font */)
void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
setButtonLabel();
if (inlined()) if (inlined())
inset.metrics(mi, dim); inset.metrics(mi, dim);
else 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"); string const InsetERTMailer::name_("ert");
InsetERTMailer::InsetERTMailer(InsetERT & inset) InsetERTMailer::InsetERTMailer(InsetERT & inset)

View File

@ -114,8 +114,6 @@ public:
} }
/// ///
int getMaxWidth(BufferView *, UpdatableInset const *) const; int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
void update(BufferView *, bool =false);
private: private:
/// ///

View File

@ -119,7 +119,6 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
/* FIXME: I refuse to believe we have to live /* FIXME: I refuse to believe we have to live
* with ugliness like this ... */ * with ugliness like this ... */
inset.getLyXText(cmd.view())->fullRebreak(); inset.getLyXText(cmd.view())->fullRebreak();
inset.update(cmd.view(), true);
cmd.view()->updateInset(this); cmd.view()->updateInset(this);
return DISPATCHED; return DISPATCHED;
} }

View File

@ -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 string const InsetTabular::editMessage() const
{ {
return _("Opened table"); return _("Opened table");
@ -1270,8 +1265,6 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv, bool reinit) c
continue; continue;
++cell; ++cell;
inset = tabular.getCellInset(cell); inset = tabular.getCellInset(cell);
if (!reinit && !tabular.getPWidth(cell).zero())
inset->update(bv, false);
maxAsc = max(maxAsc, inset->ascent(bv, font)); maxAsc = max(maxAsc, inset->ascent(bv, font));
maxDesc = max(maxDesc, inset->descent(bv, font)); maxDesc = max(maxDesc, inset->descent(bv, font));
changed = tabular.setWidthOfCell(cell, inset->width(bv, font)) || changed; changed = tabular.setWidthOfCell(cell, inset->width(bv, font)) || changed;

View File

@ -86,8 +86,6 @@ public:
/// ///
void draw(PainterInfo & pi, int x, int y) const; void draw(PainterInfo & pi, int x, int y) const;
/// ///
void update(BufferView *, bool = false);
///
string const editMessage() const; string const editMessage() const;
// //
void insetUnlock(BufferView *); void insetUnlock(BufferView *);

View File

@ -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 void InsetText::setUpdateStatus(int what) const
{ {
need_update |= what; need_update |= what;

View File

@ -92,8 +92,6 @@ public:
/// ///
void draw(PainterInfo & pi, int x, int y) const; void draw(PainterInfo & pi, int x, int y) const;
/// ///
void update(BufferView *, bool = false);
///
void setUpdateStatus(int what) const; void setUpdateStatus(int what) const;
/// ///
string const editMessage() const; string const editMessage() const;

View File

@ -35,6 +35,7 @@
#include "paragraph_funcs.h" #include "paragraph_funcs.h"
#include "rowpainter.h" #include "rowpainter.h"
#include "lyxrow_funcs.h" #include "lyxrow_funcs.h"
#include "metricsinfo.h"
#include "insets/insettext.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 // this IS needed otherwise on initialitation we don't get the fill
// of the row right (ONLY on initialization if we read a file!) // of the row right (ONLY on initialization if we read a file!)
// should be changed! (Jug 20011204) // 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 #endif
return tmpinset->width(bv(), font); //return tmpinset->width(bv(), font);
return dim.wid;
} }
return 0; return 0;
} }
@ -1079,13 +1086,21 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
if (tmpinset) { if (tmpinset) {
#if 1 // this is needed for deep update on initialitation #if 1 // this is needed for deep update on initialitation
#warning inset->update FIXME #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 #endif
maxwidth += tmpinset->width(bv(), tmpfont); //maxwidth += tmpinset->width(bv(), tmpfont);
maxasc = max(maxasc, //maxasc = max(maxasc,
tmpinset->ascent(bv(), tmpfont)); // tmpinset->ascent(bv(), tmpfont));
maxdesc = max(maxdesc, //maxdesc = max(maxdesc,
tmpinset->descent(bv(), tmpfont)); // tmpinset->descent(bv(), tmpfont));
maxwidth += dim.wid;
maxasc = max(maxasc, dim.asc);
maxdesc = max(maxdesc, dim.des);
} }
} else { } else {
maxwidth += singleWidth(pit, pos); maxwidth += singleWidth(pit, pos);