]> git.lyx.org Git - features.git/commitdiff
Convert LFUN_NOMENCL_INSERT to the newer style, fixing bug 5151.
authorRichard Heck <rgheck@comcast.net>
Sat, 9 Aug 2008 03:11:53 +0000 (03:11 +0000)
committerRichard Heck <rgheck@comcast.net>
Sat, 9 Aug 2008 03:11:53 +0000 (03:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26107 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text3.cpp

index 993aa9810e9bbc814abf69aa36e84393bb029d49..e116e3ed89cbe600974cceb7e99d1fb4f99f1faa 100644 (file)
@@ -1431,21 +1431,18 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_NOMENCL_INSERT: {
-               FuncRequest cmd1 = cmd;
-               if (cmd.argument().empty())
-                       cmd1 = FuncRequest(cmd,
-                               bv->cursor().innerText()->getStringToIndex(bv->cursor()));
-               Inset * inset = createInset(cur.bv().buffer(), cmd1);
-               if (!inset)
-                       break;
-               cur.recordUndo();
-               cur.clearSelection();
-               insertInset(cur, inset);
-               // Show the dialog for the nomenclature entry, since the
-               // description entry still needs to be filled in.
-               if (cmd.action == LFUN_NOMENCL_INSERT)
-                       inset->edit(cur, true);
-               cur.posForward();
+               InsetCommandParams p(NOMENCL_CODE);
+               docstring const content = cmd.argument().empty() ?
+                               bv->cursor().innerText()->getStringToIndex(bv->cursor()) :
+                               cmd.argument();
+               p["symbol"] = content;
+               string const data = InsetCommand::params2string("nomenclature", p);
+               if (p["symbol"].empty()) {
+                       bv->showDialog("nomenclature", data);
+               } else {
+                       FuncRequest fr(LFUN_INSET_INSERT, data);
+                       dispatch(cur, fr);
+               }
                break;
        }