remove unneeded calls to BufferView::update() in insets

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9925 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2005-05-09 17:29:22 +00:00
parent 40a54b25f7
commit 92379230ff
12 changed files with 53 additions and 21 deletions

View File

@ -1,3 +1,7 @@
2005-05-09 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* cursor.h (undispatched, noUpdate): add comments from André
2005-05-07 Michael Schmitt <michael.schmitt@teststep.org>
* lfuns.h:

View File

@ -146,13 +146,30 @@ public:
void reset(InsetBase &);
/// for spellchecking
void replaceWord(std::string const & replacestring);
/// the event was not (yet) dispatched
/**
* the event was not (yet) dispatched.
*
* Should only be called by an inset's doDispatch() method. It means:
* I, the doDispatch() method of InsetFoo, hereby declare that I am
* not able to handle that request and trust my parent will do the
* Right Thing (even if my getStatus partner said that I can do it).
* It is sort of a kludge that should be used only rarely...
*/
void undispatched();
/// the event was already dispatched
void dispatched();
/// call update() when done
void needsUpdate();
/// don't call update() when done
/**
* don't call update() when done
*
* Should only be called by an inset's doDispatch() method. It means:
* I handled that request and I can reassure you that the screen does
* not need to be re-drawn and all entries in the coord cache stay
* valid (and there are no other things to put in the coord cache).
* This is a fairly rare event as well and only some optimization.
* Not using noUpdate() should never be wrong.
*/
void noUpdate();
/// fix cursor in circumstances that should never happen
void fixIfBroken();

View File

@ -1,3 +1,11 @@
2005-05-09 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* insetbase.h (doDispatch): document a bit more
* insetcommand.C, insetfloat.C, insetgraphics.C, insetinclude.C,
insetnote.C, insetwrap.C, updatableinset.C (doDispatch): don't call
cur.bv().update(), because that leads to nested updates. Call
cur.noUpdate() instead where approriate.
2005-05-07 Michael Schmitt <michael.schmitt@teststep.org>
* insetbibtex.C: change screen label

View File

@ -402,8 +402,17 @@ public:
protected:
InsetBase();
InsetBase(InsetBase const &);
/// the real dispatcher.
/// \sa getStatus
/** The real dispatcher.
* Gets normally called from LCursor::dispatch(). LCursor::dispatch()
* assumes the common case of 'LFUN handled, need update'.
* This has to be overriden by calling LCursor::undispatched() or
* LCursor::noUpdate() if appropriate.
* If you need to call the dispatch method of some inset directly
* you may have to explicitly request an update at that place. Don't
* do it in doDispatch(), since that causes nested updates when
* called from LCursor::dispatch(), and these can lead to crashes.
* \sa getStatus
*/
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
private:
virtual std::auto_ptr<InsetBase> doClone() const = 0;

View File

@ -109,12 +109,10 @@ void InsetCommand::doDispatch(LCursor & cur, FuncRequest & cmd)
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
InsetCommandMailer::string2params(mailer_name_, cmd.argument, p);
if (p.getCmdName().empty()) {
cur.undispatched();
} else {
if (p.getCmdName().empty())
cur.noUpdate();
else
setParams(p);
cur.bv().update();
}
break;
}

View File

@ -160,7 +160,6 @@ void InsetFloat::doDispatch(LCursor & cur, FuncRequest & cmd)
params_.sideways = params.sideways;
wide(params_.wide, cur.buffer().params());
sideways(params_.sideways, cur.buffer().params());
cur.bv().update();
break;
}

View File

@ -197,10 +197,10 @@ void InsetGraphics::doDispatch(LCursor & cur, FuncRequest & cmd)
Buffer const & buffer = cur.buffer();
InsetGraphicsParams p;
InsetGraphicsMailer::string2params(cmd.argument, buffer, p);
if (!p.filename.empty()) {
if (!p.filename.empty())
setParams(p);
cur.bv().update();
}
else
cur.noUpdate();
break;
}

View File

@ -128,10 +128,10 @@ void InsetInclude::doDispatch(LCursor & cur, FuncRequest & cmd)
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
InsetIncludeMailer::string2params(cmd.argument, p);
if (!p.getCmdName().empty()) {
if (!p.getCmdName().empty())
set(p, cur.buffer());
cur.bv().update();
}
else
cur.noUpdate();
break;
}

View File

@ -192,7 +192,6 @@ void InsetNote::doDispatch(LCursor & cur, FuncRequest & cmd)
case LFUN_INSET_MODIFY:
InsetNoteMailer::string2params(cmd.argument, params_);
setButtonLabel();
cur.bv().update();
break;
case LFUN_INSET_DIALOG_UPDATE:

View File

@ -83,7 +83,6 @@ void InsetWrap::doDispatch(LCursor & cur, FuncRequest & cmd)
InsetWrapMailer::string2params(cmd.argument, params);
params_.placement = params.placement;
params_.width = params.width;
cur.bv().update();
break;
}

View File

@ -25,7 +25,6 @@
#include <boost/signals/connection.hpp>
class Buffer;
class BufferView;
class LyXRC_PreviewStatus;
class MetricsInfo;
class PainterInfo;

View File

@ -99,8 +99,8 @@ void UpdatableInset::doDispatch(LCursor & cur, FuncRequest & cmd)
scroll(cur.bv(), static_cast<float>(convert<double>(cmd.argument)));
else
scroll(cur.bv(), convert<int>(cmd.argument));
cur.bv().update();
}
} else
cur.noUpdate();
break;
default: