mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Use the AtPoint mechanism for the LFUN_INSET_EDIT and LFUN_LABEL_COPY_AS_REF.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34220 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
12a6a0774e
commit
0b92e538d9
@ -1012,7 +1012,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
case LFUN_FONT_STATE:
|
||||
case LFUN_LABEL_INSERT:
|
||||
case LFUN_INFO_INSERT:
|
||||
case LFUN_INSET_EDIT:
|
||||
case LFUN_PARAGRAPH_GOTO:
|
||||
case LFUN_NOTE_NEXT:
|
||||
case LFUN_REFERENCE_NEXT:
|
||||
@ -1037,15 +1036,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
|
||||
case LFUN_LABEL_COPY_AS_REF: {
|
||||
// if there is an inset at cursor, see whether it
|
||||
// handles the lfun
|
||||
Inset * inset = cur.nextInset();
|
||||
if (!inset || !inset->getStatus(cur, cmd, flag))
|
||||
flag.setEnabled(false);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_LABEL_GOTO: {
|
||||
flag.setEnabled(!cmd.argument().empty()
|
||||
|| getInsetByCode<InsetRef>(cur, REF_CODE));
|
||||
@ -1309,25 +1299,6 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_INSET_EDIT: {
|
||||
FuncRequest fr(cmd);
|
||||
// if there is an inset at cursor, see whether it
|
||||
// can be modified.
|
||||
Inset * inset = cur.nextInset();
|
||||
if (inset)
|
||||
inset->dispatch(cur, fr);
|
||||
// if it did not work, try the underlying inset.
|
||||
if (!inset || !cur.result().dispatched())
|
||||
cur.dispatch(cmd);
|
||||
|
||||
// FIXME I'm adding the last break to solve a crash,
|
||||
// but that is obviously not right.
|
||||
if (!cur.result().dispatched())
|
||||
// It did not work too; no action needed.
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_PARAGRAPH_GOTO: {
|
||||
int const id = convert<int>(cmd.getArg(0));
|
||||
int const pos = convert<int>(cmd.getArg(1));
|
||||
@ -1607,23 +1578,6 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
buffer_.params().compressed = !buffer_.params().compressed;
|
||||
break;
|
||||
|
||||
case LFUN_LABEL_COPY_AS_REF: {
|
||||
// if there is an inset at cursor, try to copy it
|
||||
Inset * inset = &cur.inset();
|
||||
if (!inset || !inset->asInsetMath())
|
||||
inset = cur.nextInset();
|
||||
if (inset) {
|
||||
FuncRequest tmpcmd = cmd;
|
||||
inset->dispatch(cur, tmpcmd);
|
||||
}
|
||||
if (!cur.result().dispatched())
|
||||
// It did not work too; no action needed.
|
||||
break;
|
||||
cur.clearSelection();
|
||||
dr.update(Update::SinglePar | Update::FitCursor);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_SCREEN_UP:
|
||||
case LFUN_SCREEN_DOWN: {
|
||||
Point p = getPos(cur, cur.boundary());
|
||||
|
@ -2053,7 +2053,7 @@ void LyXAction::init()
|
||||
* \li Origin: JSpitzm, 27 Apr 2006
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_INSET_EDIT, "inset-edit", ReadOnly, Edit },
|
||||
{ LFUN_INSET_EDIT, "inset-edit", ReadOnly | AtPoint, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_TABULAR_INSERT
|
||||
@ -3464,7 +3464,8 @@ void LyXAction::init()
|
||||
* \li Origin: sts, 16 Nov 2008
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_LABEL_COPY_AS_REF, "copy-label-as-reference", ReadOnly | NoUpdate, Edit },
|
||||
{ LFUN_LABEL_COPY_AS_REF, "copy-label-as-reference",
|
||||
ReadOnly | NoUpdate | AtPoint, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_LABEL_INSERT_AS_REF
|
||||
|
Loading…
Reference in New Issue
Block a user