mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-12 16:50:39 +00:00
branch: Fix bug #5446: Cursor gets stuck in InsetInfo.
Do not allow to put the cursor in an InsetInfo. Instead, a context menu item is added to facilitate copying of the contents. see r33285, r34216 and r34223. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@36589 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c3ec8506f7
commit
f839b04573
@ -398,6 +398,7 @@ Menuset
|
||||
#
|
||||
|
||||
Menu "context-info"
|
||||
Item "Copy Text|o" "inset-copy-as"
|
||||
Item "Settings...|S" "inset-settings info"
|
||||
End
|
||||
|
||||
|
@ -941,6 +941,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
|
||||
case LFUN_INSET_COPY_AS:
|
||||
case LFUN_GRAPHICS_RELOAD:
|
||||
case LFUN_COPY_LABEL_AS_REF: {
|
||||
// if there is an inset at cursor, see whether it
|
||||
@ -1037,6 +1038,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
case BRANCH_CODE:
|
||||
case BOX_CODE:
|
||||
case LISTINGS_CODE:
|
||||
case INFO_CODE:
|
||||
enable = (cmd.argument().empty() ||
|
||||
cmd.getArg(0) == insetName(next_code));
|
||||
break;
|
||||
@ -1401,6 +1403,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
buffer_.params().compressed = !buffer_.params().compressed;
|
||||
break;
|
||||
|
||||
case LFUN_INSET_COPY_AS:
|
||||
case LFUN_GRAPHICS_RELOAD: {
|
||||
Inset * inset = cur.nextInset();
|
||||
if (inset) {
|
||||
|
@ -429,6 +429,7 @@ enum FuncCode
|
||||
LFUN_SCREEN_SHOW_CURSOR, // vfr, 20090325
|
||||
LFUN_CURSOR_FOLLOWS_SCROLLBAR_TOGGLE, // ARRae 971202
|
||||
LFUN_BUFFER_CLOSE_ALL, // vfr 20090806
|
||||
LFUN_INSET_COPY_AS, // vfr, 20100419
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
@ -3276,6 +3276,17 @@ void LyXAction::init()
|
||||
*/
|
||||
{ LFUN_GRAPHICS_RELOAD, "graphics-reload", ReadOnly, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_INSET_COPY_AS
|
||||
* \li Action: Copies the inset to the clipboard as a certain type
|
||||
* \li Syntax: inset-copy-as [<TYPE>]
|
||||
* \li Params: <TYPE>: The type as which the inset is copied. This
|
||||
can vary from inset to inset.
|
||||
* \li Sample: InsetInfo is copied as text
|
||||
* \li Origin: vfr, 18 Apr 2010
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_INSET_COPY_AS, "inset-copy-as", ReadOnly | NoUpdate, Edit },
|
||||
|
||||
{ LFUN_NOACTION, "", Noop, Hidden }
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
@ -97,7 +97,7 @@ void GuiInfo::applyView()
|
||||
if (!ii->validate(argument))
|
||||
return;
|
||||
|
||||
dispatch(FuncRequest(LFUN_INSET_MODIFY, argument));
|
||||
dispatch(FuncRequest(LFUN_NEXT_INSET_MODIFY, argument));
|
||||
// FIXME: update the inset contents
|
||||
updateLabels(bufferview()->buffer());
|
||||
BufferView * bv = const_cast<BufferView *>(bufferview());
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "Buffer.h"
|
||||
#include "BufferParams.h"
|
||||
#include "BufferView.h"
|
||||
#include "CutAndPaste.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "InsetGraphics.h"
|
||||
@ -90,14 +91,6 @@ InsetInfo::InsetInfo(Buffer const & buf, string const & name)
|
||||
status_ = Collapsed;
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetInfo::editXY(Cursor & cur, int x, int y)
|
||||
{
|
||||
cur.push(*this);
|
||||
return InsetCollapsable::editXY(cur, x, y);
|
||||
}
|
||||
|
||||
|
||||
string InsetInfo::infoType() const
|
||||
{
|
||||
return nameTranslator().find(type_);
|
||||
@ -117,6 +110,12 @@ docstring InsetInfo::toolTip(BufferView const &, int, int) const
|
||||
}
|
||||
|
||||
|
||||
void InsetInfo::edit(Cursor & cur, bool, EntryDirection)
|
||||
{
|
||||
showInsetDialog(&cur.bv());
|
||||
}
|
||||
|
||||
|
||||
void InsetInfo::read(Lexer & lex)
|
||||
{
|
||||
string token;
|
||||
@ -200,6 +199,7 @@ bool InsetInfo::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_INSET_SETTINGS:
|
||||
return InsetCollapsable::getStatus(cur, cmd, flag);
|
||||
|
||||
case LFUN_INSET_COPY_AS:
|
||||
case LFUN_INSET_MODIFY:
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
@ -213,24 +213,41 @@ bool InsetInfo::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
void InsetInfo::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
{
|
||||
// allow selection, copy but not cut, delete etc
|
||||
switch (cmd.action) {
|
||||
case LFUN_MOUSE_PRESS:
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
case LFUN_MOUSE_MOTION:
|
||||
case LFUN_MOUSE_DOUBLE:
|
||||
case LFUN_MOUSE_TRIPLE:
|
||||
case LFUN_COPY:
|
||||
case LFUN_INSET_SETTINGS:
|
||||
InsetCollapsable::doDispatch(cur, cmd);
|
||||
cur.undispatched();
|
||||
break;
|
||||
|
||||
case LFUN_MOUSE_RELEASE: {
|
||||
if (!cur.selection() && cmd.button() != mouse_button::button3)
|
||||
edit(cur, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_INSET_MODIFY:
|
||||
setInfo(to_utf8(cmd.argument()));
|
||||
cur.pos() = 0;
|
||||
break;
|
||||
|
||||
case LFUN_INSET_COPY_AS: {
|
||||
cap::clearSelection();
|
||||
Cursor copy(cur);
|
||||
copy.pushBackward(*this);
|
||||
copy.pit() = 0;
|
||||
copy.pos() = 0;
|
||||
copy.resetAnchor();
|
||||
copy.pit() = copy.lastpit();
|
||||
copy.pos() = copy.lastpos();
|
||||
copy.setSelection();
|
||||
cap::copySelection(copy);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
InsetCollapsable::doDispatch(cur, cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,8 @@ public:
|
||||
///
|
||||
docstring name() const;
|
||||
///
|
||||
Inset * editXY(Cursor & cur, int x, int y);
|
||||
void edit(Cursor & cur, bool front,
|
||||
EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
|
||||
///
|
||||
EDITABLE editable() const { return NOT_EDITABLE; }
|
||||
///
|
||||
|
@ -76,6 +76,9 @@ What's new
|
||||
|
||||
- Correct the Denomination of norsk and nynorsk languages.
|
||||
|
||||
- Do not allow to put the cursor in an InsetInfo. Instead, a context
|
||||
menu item is added to facilitate copying of the contents (bug 5446).
|
||||
|
||||
|
||||
* DOCUMENTATION AND LOCALIZATION
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user