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: {
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;

View 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;
}
// if not work, access the underlying inset.
cur.inset().showInsetDialog(bv);
// 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;
}