break;
case LFUN_REF_APPLY: {
- InsetCommandParams params;
- InsetCommandMailer::string2params(ev.argument, params);
-
+ dispatch_result result = UNDISPATCHED;
InsetBase * base = owner_->getDialogs().getOpenInset("ref");
- InsetRef * inset = 0;
+ Inset * inset = 0;
if (base) {
- inset = dynamic_cast<InsetRef *>(base);
- if (!inset)
- break;
-
- inset->setParams(params);
+ // This works both for 'original' and 'mathed' insets.
+ result = base->localDispatch(ev);
} else {
- InsetRef * inset = new InsetRef(params, *buffer_);
+ InsetCommandParams params;
+ InsetCommandMailer::string2params(ev.argument, params);
+
+ inset = new InsetRef(params, *buffer_);
if (!insertInset(inset)) {
delete inset;
- break;
+ result = UNDISPATCHED;
}
+ updateInset(inset, true);
}
- updateInset(inset, true);
}
break;
+2003-02-26 Angus Leeming <leeming@lyx.org>
+
+ * BufferView_pimpl.C (dispatch): use InsetCommand::localDispatch for
+ LFUN_REF_APPLY.
+
2003-02-25 John Levon <levon@movementarian.org>
* ispell.C: give the forked command a more accurate name
+2003-02-26 Angus Leeming <leeming@lyx.org>
+
+ * insetcommand.[Ch] (localDispatch): new method.
+
2003-02-26 Angus Leeming <leeming@lyx.org>
* insetinclude.C (draw): cache the BufferView* using cache not
#include <config.h>
-
#include "insetcommand.h"
+#include "BufferView.h"
#include "debug.h"
+#include "funcrequest.h"
+#include "lyxlex.h"
+
#include "frontends/Painter.h"
+
#include "Lsstream.h"
-#include "lyxlex.h"
using std::ostream;
using std::endl;
}
+dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
+{
+ InsetCommandParams p;
+ InsetCommandMailer::string2params(cmd.argument, p);
+ if (p.getCmdName().empty())
+ return UNDISPATCHED;
+
+ setParams(p);
+ if (view())
+ view()->updateInset(this, true);
+
+ return DISPATCHED;
+}
+
InsetCommandMailer::InsetCommandMailer(string const & name,
InsetCommand & inset)
: name_(name), inset_(inset)
InsetCommandParams const & params() const { return p_; }
///
void setParams(InsetCommandParams const &);
+ /// small wrapper for the time being
+ virtual dispatch_result localDispatch(FuncRequest const & cmd);
private:
///