mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
Leave handling of LFUN_COPY_LABEL_AS_REF to InsetLabel and move handling of LFUN_INSERT_LABEL_AS_REF also to InsetLabel.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29163 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
49fb2980eb
commit
2cd997962c
@ -97,30 +97,6 @@ void TocWidget::showContextMenu(const QPoint & pos)
|
|||||||
|
|
||||||
void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
|
void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
switch(cmd.action) {
|
|
||||||
|
|
||||||
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();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
#include "FuncStatus.h"
|
#include "FuncStatus.h"
|
||||||
#include "InsetIterator.h"
|
#include "InsetIterator.h"
|
||||||
|
#include "LyXFunc.h"
|
||||||
#include "ParIterator.h"
|
#include "ParIterator.h"
|
||||||
#include "sgml.h"
|
#include "sgml.h"
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
@ -177,6 +178,14 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LFUN_INSERT_LABEL_AS_REF: {
|
||||||
|
InsetCommandParams p(REF_CODE, "ref");
|
||||||
|
p["reference"] = getParam("name");
|
||||||
|
string const data = InsetCommand::params2string("ref", p);
|
||||||
|
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
InsetCommand::doDispatch(cur, cmd);
|
InsetCommand::doDispatch(cur, cmd);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user