mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-19 22:40:26 +00:00
Add "Insert label as reference" to the context menu of the TOC.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29157 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
695870771f
commit
df3cddcd37
@ -414,11 +414,12 @@ Menuset
|
||||
End
|
||||
|
||||
#
|
||||
# InsetTocLabel context menu
|
||||
# Toc Labels and References context menu
|
||||
#
|
||||
|
||||
Menu "context-toc-label"
|
||||
Item "Copy Label as Reference|C" "copy-label-as-reference"
|
||||
Item "Insert Reference at Cursor Position|I" "insert-label-as-reference"
|
||||
End
|
||||
|
||||
End
|
||||
|
@ -412,10 +412,10 @@ enum FuncCode
|
||||
LFUN_TAB_DELETE,
|
||||
LFUN_WORD_FINDADV, // Tommaso, 20081003
|
||||
LFUN_REGEXP_MODE, // Tommaso, 20081003
|
||||
LFUN_COPY_LABEL_AS_REF, // sts, 20081116
|
||||
// 320
|
||||
LFUN_VC_COMMAND,
|
||||
LFUN_MATH_FONT_STYLE,
|
||||
// 320
|
||||
LFUN_COPY_LABEL_AS_REF, // sts, 20081116
|
||||
LFUN_INSERT_LABEL_AS_REF, // vfr, 20090407
|
||||
LFUN_PHANTOM_INSERT, // uwestoehr, 20090130
|
||||
LFUN_INSET_BEGIN, // JMarc, 20090316
|
||||
LFUN_INSET_END, // JMarc, 20090316
|
||||
@ -427,6 +427,7 @@ enum FuncCode
|
||||
LFUN_BUFFER_ZOOM_OUT, // vfr, 20090330
|
||||
// 330
|
||||
LFUN_MATH_BIGDELIM,
|
||||
LFUN_MATH_FONT_STYLE,
|
||||
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
|
@ -3225,6 +3225,15 @@ void LyXAction::init()
|
||||
*/
|
||||
{ LFUN_COPY_LABEL_AS_REF, "copy-label-as-reference", ReadOnly | NoUpdate, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_INSERT_LABEL_AS_REF
|
||||
* \li Action: Inserts the label as a cross-reference at the position of the cursor.
|
||||
* \li Syntax: insert-label-as-reference
|
||||
* \li Origin: vfr, 7 Apr 2009
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_INSERT_LABEL_AS_REF, "insert-label-as-reference", Noop, Edit},
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_BUFFER_ZOOM_IN
|
||||
* \li Action: Increases the zoom of the screen fonts.
|
||||
|
@ -98,15 +98,22 @@ void TocWidget::showContextMenu(const QPoint & pos)
|
||||
void TocWidget::doDispatch(Cursor const & cur, FuncRequest const & cmd)
|
||||
{
|
||||
switch(cmd.action) {
|
||||
case LFUN_COPY_LABEL_AS_REF: {
|
||||
|
||||
case LFUN_COPY_LABEL_AS_REF:
|
||||
case LFUN_INSERT_LABEL_AS_REF: {
|
||||
QModelIndex index = tocTV->currentIndex();
|
||||
TocItem const & item =
|
||||
gui_view_.tocModels().currentItem(current_type_, index);
|
||||
if (!item.str().empty()) {
|
||||
InsetCommandParams p(REF_CODE, "ref");
|
||||
p["reference"] = item.str();
|
||||
cap::clearSelection();
|
||||
cap::copyInset(cur, new InsetRef(*cur.buffer(), p), item.str());
|
||||
if (cmd.action == LFUN_COPY_LABEL_AS_REF) {
|
||||
cap::clearSelection();
|
||||
cap::copyInset(cur, new InsetRef(*cur.buffer(), p), item.str());
|
||||
} else {
|
||||
string const data = InsetCommand::params2string("ref", p);
|
||||
dispatch(FuncRequest(LFUN_INSET_INSERT, data));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user