mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Fix more of bug #5446: Enable to copy the contents of an InsetInfo through the context menu.
This introduces a new LFUN LFUN_INSET_COPY_AS, which copies a certain Inset to the clipboard. For InsetInfo this is the text that is visible, but this could also replace LFUN_LABEL_COPY_AS_REF, by copying the INSET to the clipboard as a reference, and also a Math inset to copy to the clipboard as latex (including $'s or \[..\]). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34223 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
87caf487e1
commit
1df3f70ed1
@ -453,6 +453,7 @@ Menuset
|
||||
Menu "context-info"
|
||||
Submenu "Document Info|D" "buffer-info"
|
||||
Separator
|
||||
Item "Copy Text|o" "inset-copy-as"
|
||||
Item "Settings...|S" "inset-settings info"
|
||||
End
|
||||
|
||||
|
@ -446,6 +446,7 @@ enum FuncCode
|
||||
// 345
|
||||
LFUN_PREVIEW_INSERT, // vfr, 20100328
|
||||
LFUN_FORWARD_SEARCH,
|
||||
LFUN_INSET_COPY_AS, // vfr, 20100419
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
@ -3496,7 +3496,17 @@ void LyXAction::init()
|
||||
*/
|
||||
{ LFUN_BUFFER_ZOOM_OUT, "buffer-zoom-out", ReadOnly, Buffer },
|
||||
|
||||
|
||||
/*!
|
||||
* \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 | AtPoint, Edit },
|
||||
|
||||
{ LFUN_NOACTION, "", Noop, Hidden }
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
@ -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"
|
||||
@ -209,6 +210,7 @@ bool InsetInfo::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
return InsetCollapsable::getStatus(cur, cmd, flag);
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
case LFUN_INSET_COPY_AS:
|
||||
flag.setEnabled(true);
|
||||
return true;
|
||||
|
||||
@ -232,6 +234,20 @@ void InsetInfo::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
setInfo(to_utf8(cmd.argument()));
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user