From 3a62e23018c10f61e0b43a9c129fcafa49a6cc77 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 5 May 2008 15:34:10 +0000 Subject: [PATCH] Fix http://bugzilla.lyx.org/show_bug.cgi?id=4821 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 | 12 ++++++++---- src/Text3.cpp | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 27beef22c0..345d94a830 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -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; diff --git a/src/Text3.cpp b/src/Text3.cpp index a38b5ab579..b5bdc3b4ec 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -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; } -- 2.39.2