]> git.lyx.org Git - features.git/commitdiff
Fix http://bugzilla.lyx.org/show_bug.cgi?id=4821
authorAbdelrazak Younes <younes@lyx.org>
Mon, 5 May 2008 15:34:10 +0000 (15:34 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 5 May 2008 15:34:10 +0000 (15:34 +0000)
Allow LFUN_INSET_SETTINGS with enclosing inset if this particular dialog has been explicitely requested.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24618 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp
src/Text3.cpp

index 27beef22c097ef2ef5c315a5ac12510f5ba05315..345d94a830cb532fada2b5f13351edeac3068e3b 100644 (file)
@@ -936,10 +936,14 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
 
        case LFUN_INSET_SETTINGS: {
                InsetCode code = cur.inset().lyxCode();
-               if (cur.nextInset())
-                       code = cur.nextInset()->lyxCode();
+               if (cmd.getArg(0) == insetName(code)) {
+                       flag.enabled(true);
+                       break;
+               }
                bool enable = false;
-               switch (code) {
+               InsetCode next_code = cur.nextInset()
+                       ? cur.nextInset()->lyxCode() : NO_CODE;
+               switch (next_code) {
                        case TABULAR_CODE:
                        case ERT_CODE:
                        case FLOAT_CODE:
@@ -949,7 +953,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
                        case BOX_CODE:
                        case LISTINGS_CODE:
                                enable = (cmd.argument().empty() ||
-                                         cmd.getArg(0) == insetName(code));
+                                         cmd.getArg(0) == insetName(next_code));
                                break;
                        default:
                                break;
index a38b5ab579b9da6d0118e67c1c1572666218f535..b5bdc3b4ec0816027853d61ae8722b37fcb9e7dc 100644 (file)
@@ -873,14 +873,20 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
 
        case LFUN_INSET_SETTINGS: {
-               // if there is an inset at cursor, access this
-               Inset * inset = cur.nextInset();
-               if (inset) {
-                       inset->showInsetDialog(bv);
+               Inset & inset = cur.inset();
+               if (cmd.getArg(0) == insetName(inset.lyxCode())) {
+                       // This inset dialog has been explicitely requested.
+                       inset.showInsetDialog(bv);
+                       break;
+               }
+               // else, if there is an inset at the cursor, access this
+               Inset * next_inset = cur.nextInset();
+               if (next_inset) {
+                       next_inset->showInsetDialog(bv);
                        break;
                }
-               // if not work, access the underlying inset.
-               cur.inset().showInsetDialog(bv);
+               // if not then access the underlying inset.
+               inset.showInsetDialog(bv);
                break;
        }