mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
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
This commit is contained in:
parent
305ac4e923
commit
2d40854a46
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user