From 0b92e538d9fa259a1bdce58d2a70bf7663678dc9 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 19 Apr 2010 17:11:43 +0000 Subject: [PATCH] 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 --- src/BufferView.cpp | 46 ---------------------------------------------- src/LyXAction.cpp | 5 +++-- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 52cd139157..260866a8e8 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -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(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(cmd.getArg(0)); int const pos = convert(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()); diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 818011ac31..b43b426c60 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -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 -- 2.39.5