From 2d40854a462385138ebbb2a2e20cc112606876c8 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Thu, 9 Apr 2009 23:17:20 +0000 Subject: [PATCH] Move handling of LFUN_INSET_SETTINGS to Inset.cpp * 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 | 30 ------------------------------ src/LyXAction.cpp | 2 +- src/Text3.cpp | 18 ------------------ src/insets/Inset.cpp | 7 +++++++ 4 files changed, 8 insertions(+), 49 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 8f341ad5be..3c2fd470f4 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -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); diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index f5669b166a..d9da017dc0 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -2246,7 +2246,7 @@ void LyXAction::init() * \li Params: : * \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. diff --git a/src/Text3.cpp b/src/Text3.cpp index fdd6e9c406..3ac094d033 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -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) diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 06d56e66ef..ae91223d0a 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -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; } -- 2.39.2