]> git.lyx.org Git - features.git/commitdiff
Move handling of LFUN_INSET_SETTINGS to Inset.cpp
authorVincent van Ravesteijn <vfr@lyx.org>
Thu, 9 Apr 2009 23:17:20 +0000 (23:17 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Thu, 9 Apr 2009 23:17:20 +0000 (23:17 +0000)
* Inset
Handle LFUN_INSET_SETTINGS.

* LyXAction
Use the AtPoint command flag.

* BufferView
* Text3
Remove code that handled LFUN_INSET_SETTINGS. The inset/next-inset part is handled by the AtPoint lfun flag. showInsetDialog is called by Inset::doDispatch and getStatus will be handled by all insets themselves.

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

src/BufferView.cpp
src/LyXAction.cpp
src/Text3.cpp
src/insets/Inset.cpp

index 8f341ad5bea37f48dc33bd6713d722b8ac84f0dd..3c2fd470f4bbb4a93d125b26bfda6c01b30264a5 100644 (file)
@@ -1017,36 +1017,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                flag.setEnabled(cur.inset().allowParagraphCustomization(cur.idx()));
                break;
 
-       case LFUN_INSET_SETTINGS: {
-               InsetCode code = cur.inset().lyxCode();
-               if (cmd.getArg(0) == insetName(code)) {
-                       flag.setEnabled(true);
-                       break;
-               }
-               bool enable = false;
-               InsetCode next_code = cur.nextInset()
-                       ? cur.nextInset()->lyxCode() : NO_CODE;
-               //FIXME: remove these special cases:
-               switch (next_code) {
-                       case TABULAR_CODE:
-                       case ERT_CODE:
-                       case FLOAT_CODE:
-                       case WRAP_CODE:
-                       case NOTE_CODE:
-                       case BRANCH_CODE:
-                       case PHANTOM_CODE:
-                       case BOX_CODE:
-                       case LISTINGS_CODE:
-                               enable = (cmd.argument().empty() ||
-                                         cmd.getArg(0) == insetName(next_code));
-                               break;
-                       default:
-                               break;
-               }
-               flag.setEnabled(enable);
-               break;
-       }
-
        case LFUN_DIALOG_SHOW_NEW_INSET:
                if (cur.inset().lyxCode() == CAPTION_CODE)
                        return cur.inset().getStatus(cur, cmd, flag);
index f5669b166aa1698efc21ba1bc7ab69acc6b72559..d9da017dc07d856dff77dd0c86eba6d44cd726cf 100644 (file)
@@ -2246,7 +2246,7 @@ void LyXAction::init()
  * \li Params: <INSET>: <box|branch|ert|float|listings|note|phantom|tabular|wrap>
  * \endvar
  */
-               { LFUN_INSET_SETTINGS, "inset-settings", ReadOnly, Edit },
+               { LFUN_INSET_SETTINGS, "inset-settings", ReadOnly | AtPoint, Edit },
 /*!
  * \var lyx::FuncCode lyx::LFUN_INSET_TOGGLE
  * \li Action: Toggles the collapsable inset we are currently in.
index fdd6e9c4061a1e240ec625c70cd38fcf554a464c..3ac094d033c994f3ad2cfa5fe0cb121626ac14e3 100644 (file)
@@ -945,24 +945,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
 
-       case LFUN_INSET_SETTINGS: {
-               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 then access the underlying inset.
-               inset.showInsetDialog(bv);
-               break;
-       }
-
        case LFUN_SET_GRAPHICS_GROUP: {
                InsetGraphics * ins = graphics::getCurrentGraphicsInset(cur);
                if (!ins)
index 06d56e66ef399fd91fd2f6dcdd3b4c8385453e99..ae91223d0ad210c27e305610a3511c37351c725b 100644 (file)
@@ -224,6 +224,9 @@ void Inset::doDispatch(Cursor & cur, FuncRequest &cmd)
                edit(cur, true);
                cur.dispatched();
                break;
+       case LFUN_INSET_SETTINGS:
+               showInsetDialog(&cur.bv());
+               break;
        default:
                cur.noUpdate();
                cur.undispatched();
@@ -263,6 +266,10 @@ bool Inset::getStatus(Cursor &, FuncRequest const & cmd,
                flag.setEnabled(editable() == IS_EDITABLE);
                return true;
 
+       case LFUN_INSET_SETTINGS:
+               flag.setEnabled(false);
+               return true;
+
        default:
                break;
        }