InsetCollapsable::InsetCollapsable(bool collapsed)
: UpdatableInset(), collapsed_(collapsed),
button_length(0), button_top_y(0), button_bottom_y(0),
- need_update(FULL), label("Label"),
+ need_update(NONE), label("Label"),
#if 0
autocollapse(false),
#endif
- oldWidth(0)
+ oldWidth(0), in_update(false)
{
inset.setOwner(this);
inset.setAutoBreakRows(true);
: UpdatableInset(in, same_id), collapsed_(in.collapsed_),
framecolor(in.framecolor), labelfont(in.labelfont),
button_length(0), button_top_y(0), button_bottom_y(0),
- need_update(FULL), label(in.label),
+ need_update(NONE), label(in.label),
#if 0
autocollapse(in.autocollapse),
#endif
- oldWidth(0)
+ oldWidth(0), in_update(false)
{
inset.init(&(in.inset), same_id);
inset.setOwner(this);
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const
{
+ if (need_update != NONE) {
+ const_cast<InsetText *>(&inset)->update(bv, f, true);
+ bv->text->status(bv, LyXText::CHANGED_IN_DRAW);
+ need_update = NONE;
+ return;
+ }
if (nodraw())
return;
inset.draw(bv, f,
bl + descent_collapsed() + inset.ascent(bv, f),
x, cleared);
- need_update = NONE;
}
void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
- bool reinit)
+ bool reinit)
{
+ if (in_update)
+ return;
+ in_update = true;
inset.update(bv, font, reinit);
+ if (reinit && owner()) {
+ owner()->update(bv, font, true);
+ }
+ in_update = false;
}