+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:
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();
+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
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;
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;
}
params_.sideways = params.sideways;
wide(params_.wide, cur.buffer().params());
sideways(params_.sideways, cur.buffer().params());
- cur.bv().update();
break;
}
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;
}
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;
}
case LFUN_INSET_MODIFY:
InsetNoteMailer::string2params(cmd.argument, params_);
setButtonLabel();
- cur.bv().update();
break;
case LFUN_INSET_DIALOG_UPDATE:
InsetWrapMailer::string2params(cmd.argument, params);
params_.placement = params.placement;
params_.width = params.width;
- cur.bv().update();
break;
}
#include <boost/signals/connection.hpp>
class Buffer;
-class BufferView;
class LyXRC_PreviewStatus;
class MetricsInfo;
class PainterInfo;
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: