From 340b7d232c0b26df175ba93f7d830467dd06e91e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 5 Aug 2003 08:07:07 +0000 Subject: [PATCH] remove "deep update" git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7501 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 4 +-- src/BufferView.h | 2 +- src/BufferView_pimpl.C | 47 ++++++----------------------------- src/BufferView_pimpl.h | 2 +- src/ChangeLog | 8 ++++++ src/bufferview_funcs.C | 6 ++--- src/graphics/PreviewedInset.C | 2 +- src/insets/ChangeLog | 18 ++++++++++++++ src/insets/insetbibitem.C | 5 ++-- src/insets/insetcollapsable.C | 36 ++++++++++----------------- src/insets/insetcollapsable.h | 2 -- src/insets/insetcommand.C | 2 +- src/insets/insetert.C | 4 +-- src/insets/insetexternal.C | 4 +-- src/insets/insetfloat.C | 26 ++++++++----------- src/insets/insetgraphics.C | 4 +-- src/insets/insetinclude.C | 4 +-- src/insets/insetlabel.C | 11 +++----- src/insets/insetminipage.C | 5 ++-- src/insets/insetnote.C | 18 ++++++++------ src/insets/insettabular.C | 31 +---------------------- src/insets/insettabular.h | 2 -- src/insets/insettext.C | 43 ++------------------------------ src/insets/insettext.h | 2 -- src/insets/insetwrap.C | 9 +++---- src/insets/updatableinset.C | 2 +- src/insets/updatableinset.h | 3 --- src/mathed/formulabase.C | 20 +++++++-------- src/text2.C | 9 +++---- src/text3.C | 12 ++++----- 30 files changed, 120 insertions(+), 223 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index 0f9c1e77a1..dfeefc02c5 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -552,9 +552,9 @@ int BufferView::unlockInset(UpdatableInset * inset) } -void BufferView::updateInset(InsetOld * inset) +void BufferView::updateInset() { - pimpl_->updateInset(inset); + pimpl_->updateInset(); } diff --git a/src/BufferView.h b/src/BufferView.h index bbdffbfe04..af356db3d2 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -75,7 +75,7 @@ public: /// perform pending painting updates void update(); /// update for a particular inset - void updateInset(InsetOld * inset); + void updateInset(); /// reset the scrollbar to reflect current view position void updateScrollbar(); /// FIXME diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index f76faadb26..0664fd6772 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -1174,7 +1174,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in) case LFUN_INSET_INSERT: { InsetOld * inset = createInset(ev); if (inset && insertInset(inset)) { - updateInset(inset); + updateInset(); string const name = ev.getArg(0); if (name == "bibitem") { @@ -1370,46 +1370,13 @@ bool BufferView::Pimpl::insertInset(InsetOld * inset, string const & lout) } -void BufferView::Pimpl::updateInset(InsetOld * inset) +void BufferView::Pimpl::updateInset() { - if (!inset || !available()) + if (!available()) return; - // first check for locking insets - if (bv_->theLockingInset()) { - if (bv_->theLockingInset() == inset) { - if (bv_->text->updateInset(inset)) { - update(); - updateScrollbar(); - return; - } - } else if (bv_->theLockingInset()->updateInsetInInset(bv_, inset)) { - if (bv_->text->updateInset(bv_->theLockingInset())) { - update(); - updateScrollbar(); - return; - } - } - } - - // then check if the inset is a top_level inset (has no owner) - // if yes do the update as always otherwise we have to update the - // toplevel inset where this inset is inside - InsetOld * tl_inset = inset; - while (tl_inset->owner()) - tl_inset = tl_inset->owner(); - if (tl_inset == inset) { - update(); - if (bv_->text->updateInset(inset)) { - update(); - return; - } - } else if (static_cast(tl_inset) - ->updateInsetInInset(bv_, inset)) - { - if (bv_->text->updateInset(tl_inset)) { - update(); - updateScrollbar(); - } - } + // this should not be needed, but it is... + bv_->text->redoParagraph(bv_->text->cursor.par()); + update(); + updateScrollbar(); } diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index c14c962a99..c141167052 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -95,7 +95,7 @@ struct BufferView::Pimpl : public boost::signals::trackable { /// bool insertInset(InsetOld * inset, string const & lout = string()); /// - void updateInset(InsetOld * inset); + void updateInset(); /// a function should be executed from the workarea bool workAreaDispatch(FuncRequest const & ev); /// a function should be executed diff --git a/src/ChangeLog b/src/ChangeLog index d53d6343dc..ede4f47e31 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,12 @@ +2003-08-05 André Pönitz + + * BufferView.[Ch]: + * BufferView_pimpl.[Ch]: + * bufferview_funcs.C: + * text2.C: + * text3.C: rip out "deep update" + 2003-08-04 André Pönitz * BufferView.[Ch]: diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 48447dd6a8..c6a517f323 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -221,11 +221,11 @@ void number(BufferView * bv) void lang(BufferView * bv, string const & l) { - LyXFont font(LyXFont::ALL_IGNORE); Language const * lang = languages.getLanguage(l); if (!lang) return; + LyXFont font(LyXFont::ALL_IGNORE); font.setLanguage(lang); toggleAndShow(bv, font); } @@ -234,14 +234,14 @@ void lang(BufferView * bv, string const & l) bool changeDepth(BufferView * bv, LyXText * text, DEPTH_CHANGE type, bool test_only) { if (!bv->available() || !text) - return false; + return false; if (test_only) return text->changeDepth(type, true); bool const changed = text->changeDepth(type, false); if (text->inset_owner) - bv->updateInset((InsetOld *)text->inset_owner); + bv->updateInset(); bv->update(); return changed; } diff --git a/src/graphics/PreviewedInset.C b/src/graphics/PreviewedInset.C index 1881bc5122..39678b1022 100644 --- a/src/graphics/PreviewedInset.C +++ b/src/graphics/PreviewedInset.C @@ -125,7 +125,7 @@ void PreviewedInset::imageReady(PreviewImage const & pimage) const pimage_ = &pimage; if (view()) - view()->updateInset(&inset_); + view()->updateInset(); } } // namespace graphics diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 73153b62e8..1390060a01 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,4 +1,22 @@ +2003-08-05 André Pönitz + + * insetbibitem.C: + * insetcollapsable.[Ch]: + * insetcommand.C: + * insetert.C: + * insetexternal.C: + * insetfloat.C: + * insetgraphics.C: + * insetinclude.C: + * insetlabel.C: + * insetminipage.C: + * insetnote.C: + * insettabular.[Ch]: + * insettext.[Ch]: + * insetwrap.C: + * updatableinset.[Ch]: rip out "deep update" + 2003-08-04 André Pönitz * insettext.[Ch] (updateLocal): remove 'what' argument by assuimng it diff --git a/src/insets/insetbibitem.C b/src/insets/insetbibitem.C index 95b0f089ac..b292d16fb5 100644 --- a/src/insets/insetbibitem.C +++ b/src/insets/insetbibitem.C @@ -40,8 +40,7 @@ InsetBibitem::InsetBibitem(InsetCommandParams const & p) InsetBibitem::~InsetBibitem() { - InsetCommandMailer mailer("bibitem", *this); - mailer.hideDialog(); + InsetCommandMailer("bibitem", *this).hideDialog(); } @@ -67,7 +66,7 @@ dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd) if (p.getCmdName().empty()) return DISPATCHED; setParams(p); - cmd.view()->updateInset(this); + cmd.view()->updateInset(); cmd.view()->fitCursor(); return DISPATCHED; } diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 0d800e5bbf..6efb25a2b7 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -210,7 +210,7 @@ void InsetCollapsable::insetUnlock(BufferView * bv) inset.insetUnlock(bv); if (scroll()) scroll(bv, 0.0F); - bv->updateInset(this); + bv->updateInset(); } @@ -229,25 +229,22 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd) if (collapsed_ && cmd.button() != mouse_button::button3) { collapsed_ = false; - bv->updateInset(this); + bv->updateInset(); bv->buffer()->markDirty(); return; } - if (cmd.button() != mouse_button::button3 && hitButton(cmd)) - { + if (cmd.button() != mouse_button::button3 && hitButton(cmd)) { if (collapsed_) { collapsed_ = false; - bv->updateInset(this); - bv->buffer()->markDirty(); } else { collapsed_ = true; bv->unlockInset(this); - bv->updateInset(this); - bv->buffer()->markDirty(); } - } else if (!collapsed_ && (cmd.y > button_dim.y2)) { - ret = (inset.localDispatch(adjustCommand(cmd)) == DISPATCHED); + bv->updateInset(); + bv->buffer()->markDirty(); + } else if (!collapsed_ && cmd.y > button_dim.y2) { + ret = inset.localDispatch(adjustCommand(cmd)) == DISPATCHED; } if (cmd.button() == mouse_button::button3 && !ret) showInsetDialog(bv); @@ -298,7 +295,7 @@ InsetOld::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd) lyxerr << "branch collapsed_" << endl; collapsed_ = false; if (bv->lockInset(this)) { - bv->updateInset(this); + bv->updateInset(); bv->buffer()->markDirty(); inset.localDispatch(cmd); first_after_edit = true; @@ -326,7 +323,7 @@ InsetOld::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd) first_after_edit = true; if (!bv->lockInset(this)) return DISPATCHED; - bv->updateInset(this); + bv->updateInset(); bv->buffer()->markDirty(); inset.localDispatch(cmd); } else { @@ -386,14 +383,6 @@ bool InsetCollapsable::unlockInsetInInset(BufferView * bv, UpdatableInset * in, } -bool InsetCollapsable::updateInsetInInset(BufferView * bv, InsetOld *in) -{ - if (in == this) - return true; - return inset.updateInsetInInset(bv, in); -} - - int InsetCollapsable::insetInInsetY() const { return inset.insetInInsetY() - (top_baseline - inset.y()); @@ -501,10 +490,11 @@ InsetOld * InsetCollapsable::getInsetFromID(int id_arg) const void InsetCollapsable::open(BufferView * bv) { - if (!collapsed_) return; + if (!collapsed_) + return; collapsed_ = false; - bv->updateInset(this); + bv->updateInset(); } @@ -514,7 +504,7 @@ void InsetCollapsable::close(BufferView * bv) const return; collapsed_ = true; - bv->updateInset(const_cast(this)); + bv->updateInset(); } diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index d73daedfde..d4db2ec45d 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -73,8 +73,6 @@ public: bool unlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false); /// - bool updateInsetInInset(BufferView *, InsetOld *); - /// int insetInInsetY() const; /// RESULT localDispatch(FuncRequest const &); diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 0392743e4c..7f36b744c4 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -102,7 +102,7 @@ dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd) return UNDISPATCHED; setParams(p); - cmd.view()->updateInset(this); + cmd.view()->updateInset(); return DISPATCHED; } diff --git a/src/insets/insetert.C b/src/insets/insetert.C index b632bdde6b..1c5b2f93ee 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -454,7 +454,7 @@ InsetOld::RESULT InsetERT::localDispatch(FuncRequest const & cmd) * taken by the text). */ inset.getLyXText(cmd.view())->fullRebreak(); - bv->updateInset(this); + bv->updateInset(); result = DISPATCHED; } break; @@ -598,7 +598,7 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const break; } if (bv) { - bv->updateInset(const_cast(this)); + bv->updateInset(); bv->buffer()->markDirty(); } } diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index d8f4c83af2..1890e6bb70 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -127,7 +127,7 @@ void InsetExternal::statusChanged() { BufferView * bv = renderer_->view(); if (bv) - bv->updateInset(this); + bv->updateInset(); } @@ -152,7 +152,7 @@ dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd) InsetExternal::Params p; InsetExternalMailer::string2params(cmd.argument, *buffer, p); setParams(p, buffer); - cmd.view()->updateInset(this); + cmd.view()->updateInset(); return DISPATCHED; } diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index 0db037a0da..543fc5836f 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -162,9 +162,8 @@ InsetFloat::~InsetFloat() dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd) { - InsetOld::RESULT result = UNDISPATCHED; - switch (cmd.action) { + case LFUN_INSET_MODIFY: { InsetFloatParams params; InsetFloatMailer::string2params(cmd.argument, params); @@ -173,22 +172,18 @@ dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd) params_.wide = params.wide; wide(params_.wide, cmd.view()->buffer()->params); - cmd.view()->updateInset(this); - result = DISPATCHED; + cmd.view()->updateInset(); + return DISPATCHED; } - break; case LFUN_INSET_DIALOG_UPDATE: { - InsetFloatMailer mailer(*this); - mailer.updateDialog(cmd.view()); + InsetFloatMailer(*this).updateDialog(cmd.view()); + return DISPATCHED; } - break; default: - result = InsetCollapsable::localDispatch(cmd); + return InsetCollapsable::localDispatch(cmd); } - - return result; } @@ -197,14 +192,13 @@ void InsetFloatParams::write(ostream & os) const os << "Float " // getInsetName() << type << '\n'; - if (!placement.empty()) { + if (!placement.empty()) os << "placement " << placement << "\n"; - } - if (wide) { + + if (wide) os << "wide true\n"; - } else { + else os << "wide false\n"; - } } diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index bf8efcff29..f3b23a4a0c 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -169,7 +169,7 @@ void InsetGraphics::statusChanged() { BufferView * bv = graphic_->view(); if (bv) - bv->updateInset(this); + bv->updateInset(); } @@ -182,7 +182,7 @@ dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd) InsetGraphicsMailer::string2params(cmd.argument, buffer, p); if (!p.filename.empty()) { setParams(p); - cmd.view()->updateInset(this); + cmd.view()->updateInset(); } return DISPATCHED; } diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 03f9d0d5eb..27a521eb83 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -138,7 +138,7 @@ dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd) if (!p.cparams.getCmdName().empty()) { set(p); params_.masterFilename_ = cmd.view()->buffer()->fileName(); - cmd.view()->updateInset(this); + cmd.view()->updateInset(); } return DISPATCHED; } @@ -601,7 +601,7 @@ void InsetInclude::PreviewImpl::restartLoading() lyxerr << "restartLoading()" << std::endl; removePreview(); if (view()) - view()->updateInset(&parent()); + view()->updateInset(); generatePreview(); } diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 9c3de2e08e..2c7e2b013e 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -59,7 +59,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd) case LFUN_INSET_EDIT: InsetCommandMailer("label", *this).showDialog(cmd.view()); - result = DISPATCHED; + return DISPATCHED; break; case LFUN_INSET_MODIFY: { @@ -75,16 +75,13 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd) } setParams(p); - cmd.view()->updateInset(this); - result = DISPATCHED; + cmd.view()->updateInset(); + return DISPATCHED; } - break; default: - result = InsetCommand::localDispatch(cmd); + return InsetCommand::localDispatch(cmd); } - - return result; } diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index 7800b273ab..01f385850d 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -103,8 +103,7 @@ auto_ptr InsetMinipage::clone() const InsetMinipage::~InsetMinipage() { - InsetMinipageMailer mailer(*this); - mailer.hideDialog(); + InsetMinipageMailer(*this).hideDialog(); } @@ -121,7 +120,7 @@ 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(); - cmd.view()->updateInset(this); + cmd.view()->updateInset(); return DISPATCHED; } diff --git a/src/insets/insetnote.C b/src/insets/insetnote.C index 92e5dc4581..778917944e 100644 --- a/src/insets/insetnote.C +++ b/src/insets/insetnote.C @@ -122,28 +122,32 @@ dispatch_result InsetNote::localDispatch(FuncRequest const & cmd) BufferView * bv = cmd.view(); switch (cmd.action) { - case LFUN_INSET_MODIFY: - { + + case LFUN_INSET_MODIFY: { InsetNoteParams params; InsetNoteMailer::string2params(cmd.argument, params); params_.type = params.type; setButtonLabel(); - bv->updateInset(this); + bv->updateInset(); return DISPATCHED; - } + } + case LFUN_INSET_EDIT: - if (cmd.button() != mouse_button::button3) - return InsetCollapsable::localDispatch(cmd); - return UNDISPATCHED; + if (cmd.button() == mouse_button::button3) + return UNDISPATCHED; + return InsetCollapsable::localDispatch(cmd); + case LFUN_INSET_DIALOG_UPDATE: InsetNoteMailer("note", *this).updateDialog(bv); return DISPATCHED; + case LFUN_MOUSE_RELEASE: if (cmd.button() == mouse_button::button3 && hitButton(cmd)) { InsetNoteMailer("note", *this).showDialog(bv); return DISPATCHED; } // fallthrough: + default: return InsetCollapsable::localDispatch(cmd); } diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index aff3296c9c..5f3fee354b 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -436,7 +436,7 @@ void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what) const need_update = what; // Dirty Cast! (Lgb) if (need_update != NONE) { - bv->updateInset(const_cast(this)); + bv->updateInset(); if (locked) resetPos(bv); } @@ -516,25 +516,6 @@ bool InsetTabular::unlockInsetInInset(BufferView * bv, UpdatableInset * inset, } -bool InsetTabular::updateInsetInInset(BufferView * bv, InsetOld * inset) -{ - InsetOld * tl_inset = inset; - // look if this inset is really inside myself! - while (tl_inset->owner() && tl_inset->owner() != this) - tl_inset = tl_inset->owner(); - // if we enter here it's not ower inset - if (!tl_inset->owner()) - return false; - // we only have to do this if this is a subinset of our cells - if (tl_inset != inset) { - if (!static_cast(tl_inset)->updateInsetInInset(bv, inset)) - return false; - } - updateLocal(bv, CELL); - return true; -} - - int InsetTabular::insetInInsetY() const { if (!the_locking_inset) @@ -592,16 +573,6 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd) if (actrow != orow) updateLocal(bv, NONE); clearSelection(); -#if 0 - if (cmd.button() == mouse_button::button3) { - if ((ocell != actcell) && the_locking_inset) { - the_locking_inset->insetUnlock(bv); - updateLocal(bv, CELL); - the_locking_inset = 0; - } - return; - } -#endif bool const inset_hit = insetHit(bv, cmd.x, cmd.y); diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 67ed462a01..7822c11d95 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -96,8 +96,6 @@ public: bool unlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false); /// - bool updateInsetInInset(BufferView *, InsetOld *); - /// int insetInInsetY() const; /// UpdatableInset * getLockingInset() const; diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 1e0954d942..da9603f047 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -368,8 +368,7 @@ void InsetText::drawFrame(Painter & pain, int x) const frame_y = top_baseline - dim_.asc + ttoD2; frame_w = dim_.wid - TEXT_TO_INSET_OFFSET; frame_h = dim_.asc + dim_.des - TEXT_TO_INSET_OFFSET; - pain.rectangle(frame_x, frame_y, frame_w, frame_h, - frame_color); + pain.rectangle(frame_x, frame_y, frame_w, frame_h, frame_color); } @@ -389,7 +388,7 @@ void InsetText::updateLocal(BufferView * bv, bool mark_dirty) bv->fitCursor(); if (flag) - bv->updateInset(const_cast(this)); + bv->updateInset(); bv->owner()->view_state_changed(); bv->owner()->updateMenubar(); @@ -547,44 +546,6 @@ bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset, } -bool InsetText::updateInsetInInset(BufferView * bv, InsetOld * inset) -{ - if (!autoBreakRows && paragraphs.size() > 1) - collapseParagraphs(bv); - - if (inset == this) - return true; - - if (inset->owner() != this) { - bool found = false; - UpdatableInset * tl_inset = the_locking_inset; - if (tl_inset) - found = tl_inset->updateInsetInInset(bv, inset); - if (!found) { - tl_inset = static_cast(inset); - while(tl_inset->owner() && tl_inset->owner() != this) - tl_inset = static_cast(tl_inset->owner()); - if (!tl_inset->owner()) - return false; - found = tl_inset->updateInsetInInset(bv, inset); - } else { - text_.updateInset(tl_inset); - } - return found; - } - bool found = text_.updateInset(inset); - if (found) { - if (the_locking_inset && - cpar() == inset_par && cpos() == inset_pos) - { - inset_x = cix() - top_x + drawTextXOffset; - inset_y = ciy() + drawTextYOffset; - } - } - return found; -} - - void InsetText::lfunMousePress(FuncRequest const & cmd) { no_selection = true; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index d998a0f09f..e5adc0a135 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -84,8 +84,6 @@ public: bool unlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false); /// - bool updateInsetInInset(BufferView *, InsetOld *); - /// RESULT localDispatch(FuncRequest const &); /// int latex(Buffer const *, std::ostream &, diff --git a/src/insets/insetwrap.C b/src/insets/insetwrap.C index fe2f618f0a..12391ca8fa 100644 --- a/src/insets/insetwrap.C +++ b/src/insets/insetwrap.C @@ -91,7 +91,7 @@ dispatch_result InsetWrap::localDispatch(FuncRequest const & cmd) params_.placement = params.placement; params_.width = params.width; - cmd.view()->updateInset(this); + cmd.view()->updateInset(); return DISPATCHED; } @@ -107,12 +107,11 @@ dispatch_result InsetWrap::localDispatch(FuncRequest const & cmd) void InsetWrapParams::write(ostream & os) const { - os << "Wrap " // getInsetName() - << type << '\n'; + os << "Wrap " << type << '\n'; - if (!placement.empty()) { + if (!placement.empty()) os << "placement " << placement << "\n"; - } + os << "width \"" << width.asString() << "\"\n"; } diff --git a/src/insets/updatableinset.C b/src/insets/updatableinset.C index 9aa22573a4..d7ecdfc869 100644 --- a/src/insets/updatableinset.C +++ b/src/insets/updatableinset.C @@ -125,7 +125,7 @@ InsetOld::RESULT UpdatableInset::localDispatch(FuncRequest const & ev) int const xx = strToInt(ev.argument); scroll(ev.view(), xx); } - ev.view()->updateInset(this); + ev.view()->updateInset(); return DISPATCHED; } diff --git a/src/insets/updatableinset.h b/src/insets/updatableinset.h index d072699841..b8573ba404 100644 --- a/src/insets/updatableinset.h +++ b/src/insets/updatableinset.h @@ -78,9 +78,6 @@ public: /// virtual int insetInInsetY() const { return 0; } /// - virtual bool updateInsetInInset(BufferView *, InsetOld *) - { return false; } - /// virtual bool lockInsetInInset(BufferView *, UpdatableInset *) { return false; } /// diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 1e51f0c447..26214af1e5 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -156,12 +156,12 @@ void InsetFormulaBase::insetUnlock(BufferView * bv) if (mathcursor) { if (mathcursor->inMacroMode()) { mathcursor->macroModeClose(); - bv->updateInset(this); + bv->updateInset(); } releaseMathCursor(bv); } generatePreview(); - bv->updateInset(this); + bv->updateInset(); } @@ -207,7 +207,7 @@ void InsetFormulaBase::fitInsetCursor(BufferView * bv) const void InsetFormulaBase::toggleInsetSelection(BufferView * bv) { if (mathcursor) - bv->updateInset(this); + bv->updateInset(); } @@ -217,7 +217,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd) return UNDISPATCHED; BufferView * bv = cmd.view(); - bv->updateInset(this); + bv->updateInset(); //lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl; if (cmd.button() == mouse_button::button3) { @@ -236,7 +236,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd) mathcursor->selClear(); mathcursor->setPos(cmd.x + xo_, cmd.y + yo_); mathcursor->insert(ar); - bv->updateInset(this); + bv->updateInset(); return DISPATCHED; } @@ -283,7 +283,7 @@ dispatch_result InsetFormulaBase::lfunMousePress(FuncRequest const & cmd) return DISPATCHED; } - bv->updateInset(this); + bv->updateInset(); return DISPATCHED; } @@ -311,7 +311,7 @@ dispatch_result InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd) BufferView * bv = cmd.view(); mathcursor->setPos(cmd.x + xo_, cmd.y + yo_); - bv->updateInset(this); + bv->updateInset(); return DISPATCHED; } @@ -345,7 +345,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd) } // if that is removed, we won't get the magenta box when entering an // inset for the first time - bv->updateInset(this); + bv->updateInset(); return DISPATCHED; case LFUN_MOUSE_PRESS: @@ -723,7 +723,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd) } if (result == DISPATCHED) - bv->updateInset(this); + bv->updateInset(); mathcursor->normalize(); mathcursor->touch(); @@ -853,7 +853,7 @@ bool InsetFormulaBase::searchForward(BufferView * bv, string const & str, mathcursor->setSelection(it, ar.size()); current = it; it.jump(ar.size()); - bv->updateInset(this); + bv->updateInset(); return true; } } diff --git a/src/text2.C b/src/text2.C index ae1aa9ccbb..1678333bc4 100644 --- a/src/text2.C +++ b/src/text2.C @@ -320,13 +320,12 @@ void LyXText::toggleInset() if (!isHighlyEditableInset(inset)) recordUndo(bv(), Undo::ATOMIC); - if (inset->isOpen()) { + if (inset->isOpen()) inset->close(bv()); - } else { + else inset->open(bv()); - } - bv()->updateInset(inset); + bv()->updateInset(); } @@ -959,7 +958,7 @@ void LyXText::setParagraph(bool line_top, bool line_bottom, setSelection(); setCursor(tmpcursor.par(), tmpcursor.pos()); if (inset_owner) - bv()->updateInset(inset_owner); + bv()->updateInset(); } diff --git a/src/text3.C b/src/text3.C index 94a6665d30..26561b6422 100644 --- a/src/text3.C +++ b/src/text3.C @@ -70,7 +70,7 @@ namespace { if (selecting || lt->selection.mark()) { lt->setSelection(); if (lt->isInInset()) - bv->updateInset(lt->inset_owner); + bv->updateInset(); } bv->update(); @@ -363,7 +363,7 @@ void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind) if (!bv->insertInset(new_inset)) delete new_inset; else - bv->updateInset(new_inset); + bv->updateInset(); } @@ -975,7 +975,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd) update(); changeCase(LyXText::text_uppercase); if (inset_owner) - bv->updateInset(inset_owner); + bv->updateInset(); update(); break; @@ -983,7 +983,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd) update(); changeCase(LyXText::text_lowercase); if (inset_owner) - bv->updateInset(inset_owner); + bv->updateInset(); update(); break; @@ -991,7 +991,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd) update(); changeCase(LyXText::text_capitalization); if (inset_owner) - bv->updateInset(inset_owner); + bv->updateInset(); update(); break; @@ -1001,7 +1001,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd) if (transposeChars(cursor)) checkParagraph(cursor.par(), cursor.pos()); if (inset_owner) - bv->updateInset(inset_owner); + bv->updateInset(); update(); break;