On Wed, Nov 12, 2003 at 05:10:41PM +0000, Angus Leeming spake thusly: ...
Progress! Now I have the attached, and the dialog comes up and if you enter a string there, it becomes the inset name. I.e., the "APPLY: no inset" branch now functions. And not only for label, but for URLs as well. The "APPLY: we have an inset" branch still fails though. Still, this is an improvement. I propose to check this in -- unless you have an easy, off-the-cuff proposal to get the MODIFY branch going as well... - Martin
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.177
diff -u -p -r1.177 text3.C
--- text3.C 12 Nov 2003 14:38:26 -0000 1.177
+++ text3.C 12 Nov 2003 19:41:18 -0000
@@ -992,6 +992,26 @@ DispatchResult LyXText::dispatch(FuncReq
break;
}
+ case LFUN_INSET_APPLY: {
+ string const name = cmd.getArg(0);
+ lyxerr << "INSET APPLY name:" << name << endl;
+ InsetBase * inset = bv->owner()->getDialogs().getOpenInset(name);
+ if (inset) {
+lyxerr << "APPLY: we have an inset" << endl;
+ FuncRequest fr(bv, LFUN_INSET_MODIFY, name);
+ inset->dispatch(fr);
+ } else {
+lyxerr << "APPLY: no inset" << endl;
+ //FuncRequest fr(bv, LFUN_INSET_INSERT, name);
+ //dispatch(fr);
+ FuncRequest cmd2 = cmd;
+ cmd2.action = LFUN_INSET_INSERT;
+ doInsertInset(this, cmd2, true, false);
+lyxerr << "APPLY inset:" << inset << ":" << cmd2.action << endl;
+ }
+ break;
+ }
+
case LFUN_INSET_SETTINGS:
bv->cursor().innerInset()->showInsetDialog(bv);
break;
@@ -1489,7 +1509,6 @@ DispatchResult LyXText::dispatch(FuncReq
}
case LFUN_URL: {
- doInsertInset(this, cmd, true, false);
InsetCommandParams p("url");
string const data = InsetCommandMailer::params2string("url", p);
bv->owner()->getDialogs().show("url", data, 0);
@@ -1497,10 +1516,16 @@ DispatchResult LyXText::dispatch(FuncReq
}
case LFUN_HTMLURL: {
- doInsertInset(this, cmd, true, false);
InsetCommandParams p("htmlurl");
string const data = InsetCommandMailer::params2string("url", p);
bv->owner()->getDialogs().show("url", data, 0);
+ break;
+ }
+
+ case LFUN_INSERT_LABEL: {
+ InsetCommandParams p("label");
+ string const data = InsetCommandMailer::params2string("label", p);
+ bv->owner()->getDialogs().show("label", data, 0);
break;
}
pgp00000.pgp
Description: PGP signature
