case LFUN_MOUSE_MOTION:
//return lfunMouseMotion(cmd);
case LFUN_MOUSE_RELEASE:
- lyxerr << "Mouse single release\n";
+ //lyxerr << "Mouse single release\n";
return lfunMouseRelease(cmd);
case LFUN_MOUSE_DOUBLE:
//lyxerr << "Mouse double\n";
case LFUN_DIALOG_SHOW_NEW_INSET: {
string const & name = argument;
if (name == "ref") {
- string data = "LatexCommand \\ref{}\n\\end_inset\n\n";
+ string data = "ref LatexCommand \\ref{}\n\\end_inset\n\n";
bv->owner()->getDialogs().show(name, data, 0);
} else
result = UNDISPATCHED;
}
break;
- case LFUN_REF_APPLY: {
- // argument comes with a head "LatexCommand " and a
- // tail "\nend_inset\n\n". Strip them off.
- string trimmed;
- string body = split(argument, trimmed, ' ');
- split(body, trimmed, '\n');
- lyxerr << "passing '" << trimmed << "' to the math parser\n";
-
- MathAtom at;
- if (!mathed_parse_normal(at, trimmed)) {
- result = UNDISPATCHED;
- break;
- }
-
- RefInset * tmp = at.nucleus()->asRefInset();
- if (!tmp) {
- result = UNDISPATCHED;
- break;
- }
-
+ case LFUN_INSET_APPLY: {
+ string const name = cmd.getArg(0);
InsetBase * base =
- bv->owner()->getDialogs().getOpenInset("ref");
+ bv->owner()->getDialogs().getOpenInset(name);
+
if (base) {
- RefInset * inset = dynamic_cast<RefInset *>(base);
- if (!inset) {
+ FuncRequest fr(bv, LFUN_INSET_MODIFY, cmd.argument);
+ result = base->localDispatch(fr);
+ } else {
+ // Turn 'argument' into a temporary RefInset.
+ MathArray ar;
+ if (string2RefInset(cmd.argument, ar)) {
+ mathcursor->insert(ar);
+ } else {
result = UNDISPATCHED;
- break;
}
-
- *inset = *tmp;
- } else {
- mathcursor->insert(at);
}
- updateLocal(bv, true);
+ if (result == DISPATCHED)
+ updateLocal(bv, true);
}
break;