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
This commit is contained in:
Abdelrazak Younes 2008-05-05 15:34:10 +00:00
parent f39515acac
commit 3a62e23018
2 changed files with 20 additions and 10 deletions

View File

@ -936,10 +936,14 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
case LFUN_INSET_SETTINGS: { case LFUN_INSET_SETTINGS: {
InsetCode code = cur.inset().lyxCode(); InsetCode code = cur.inset().lyxCode();
if (cur.nextInset()) if (cmd.getArg(0) == insetName(code)) {
code = cur.nextInset()->lyxCode(); flag.enabled(true);
break;
}
bool enable = false; bool enable = false;
switch (code) { InsetCode next_code = cur.nextInset()
? cur.nextInset()->lyxCode() : NO_CODE;
switch (next_code) {
case TABULAR_CODE: case TABULAR_CODE:
case ERT_CODE: case ERT_CODE:
case FLOAT_CODE: case FLOAT_CODE:
@ -949,7 +953,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
case BOX_CODE: case BOX_CODE:
case LISTINGS_CODE: case LISTINGS_CODE:
enable = (cmd.argument().empty() || enable = (cmd.argument().empty() ||
cmd.getArg(0) == insetName(code)); cmd.getArg(0) == insetName(next_code));
break; break;
default: default:
break; break;

View File

@ -873,14 +873,20 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
break; break;
case LFUN_INSET_SETTINGS: { case LFUN_INSET_SETTINGS: {
// if there is an inset at cursor, access this Inset & inset = cur.inset();
Inset * inset = cur.nextInset(); if (cmd.getArg(0) == insetName(inset.lyxCode())) {
if (inset) { // This inset dialog has been explicitely requested.
inset->showInsetDialog(bv); inset.showInsetDialog(bv);
break; break;
} }
// if not work, access the underlying inset. // else, if there is an inset at the cursor, access this
cur.inset().showInsetDialog(bv); Inset * next_inset = cur.nextInset();
if (next_inset) {
next_inset->showInsetDialog(bv);
break;
}
// if not then access the underlying inset.
inset.showInsetDialog(bv);
break; break;
} }