mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 12:26:59 +00:00
re-implement LFUN_REFERENCE_INSERT
this is in preparation of another feature
(cherry picked from commit 181c8ce7c1
)
This commit is contained in:
parent
a6a2cdcf92
commit
18d9d7ee9d
@ -509,6 +509,8 @@ enum FuncCode
|
|||||||
LFUN_TAB_GROUP_PREVIOUS, // daniel 20220130
|
LFUN_TAB_GROUP_PREVIOUS, // daniel 20220130
|
||||||
LFUN_BIBTEX_DATABASE_LIST, // bpiwowar, 20221218
|
LFUN_BIBTEX_DATABASE_LIST, // bpiwowar, 20221218
|
||||||
LFUN_STATISTICS_REFERENCE_CLAMP,// sanda, 20240324
|
LFUN_STATISTICS_REFERENCE_CLAMP,// sanda, 20240324
|
||||||
|
LFUN_REFERENCE_INSERT, // spitz, 20240728
|
||||||
|
// 400
|
||||||
LFUN_LASTACTION // end of the table
|
LFUN_LASTACTION // end of the table
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3512,6 +3512,16 @@ void LyXAction::init()
|
|||||||
*/
|
*/
|
||||||
{ LFUN_REDO, "redo", ReadOnly, Edit },
|
{ LFUN_REDO, "redo", ReadOnly, Edit },
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \var lyx::FuncCode lyx::LFUN_REFERENCE_INSERT
|
||||||
|
* \li Action: Inserts a cross-reference into the document.
|
||||||
|
* \li Notion: Optional <TYPE> can be used to set the type of reference
|
||||||
|
* \li Syntax: reference-insert <LABEL> [<TYPE>]
|
||||||
|
* \li Origin: spitz, 28 Jul 2024
|
||||||
|
* \endvar
|
||||||
|
*/
|
||||||
|
{ LFUN_REFERENCE_INSERT, "reference-insert", Noop, Edit },
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \var lyx::FuncCode lyx::LFUN_REFERENCE_NEXT
|
* \var lyx::FuncCode lyx::LFUN_REFERENCE_NEXT
|
||||||
* \li Action: Go to the next label or cross-reference.
|
* \li Action: Go to the next label or cross-reference.
|
||||||
|
20
src/Text.cpp
20
src/Text.cpp
@ -82,6 +82,7 @@
|
|||||||
#include "insets/InsetIPAMacro.h"
|
#include "insets/InsetIPAMacro.h"
|
||||||
#include "insets/InsetNewline.h"
|
#include "insets/InsetNewline.h"
|
||||||
#include "insets/InsetQuotes.h"
|
#include "insets/InsetQuotes.h"
|
||||||
|
#include "insets/InsetRef.h"
|
||||||
#include "insets/InsetSpecialChar.h"
|
#include "insets/InsetSpecialChar.h"
|
||||||
#include "insets/InsetTabular.h"
|
#include "insets/InsetTabular.h"
|
||||||
#include "insets/InsetText.h"
|
#include "insets/InsetText.h"
|
||||||
@ -5480,6 +5481,18 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LFUN_REFERENCE_INSERT: {
|
||||||
|
string const label = cmd.getArg(0);
|
||||||
|
string const type = cmd.getArg(1);
|
||||||
|
InsetCommandParams p(REF_CODE, "ref");
|
||||||
|
if (!type.empty())
|
||||||
|
p.setCmdName(type);
|
||||||
|
p["reference"] = from_utf8(label);
|
||||||
|
string const data = InsetCommand::params2string(p);
|
||||||
|
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case LFUN_INFO_INSERT: {
|
case LFUN_INFO_INSERT: {
|
||||||
if (cmd.argument().empty()) {
|
if (cmd.argument().empty()) {
|
||||||
bv->showDialog("info", cur.current_font.language()->lang());
|
bv->showDialog("info", cur.current_font.language()->lang());
|
||||||
@ -6739,6 +6752,13 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
case LFUN_PREVIEW_INSERT:
|
case LFUN_PREVIEW_INSERT:
|
||||||
code = PREVIEW_CODE;
|
code = PREVIEW_CODE;
|
||||||
break;
|
break;
|
||||||
|
case LFUN_REFERENCE_INSERT: {
|
||||||
|
string const type = cmd.getArg(1);
|
||||||
|
if (!type.empty())
|
||||||
|
enable = InsetRef::isCompatibleCommand(type);
|
||||||
|
code = REF_CODE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case LFUN_SCRIPT_INSERT:
|
case LFUN_SCRIPT_INSERT:
|
||||||
code = SCRIPT_CODE;
|
code = SCRIPT_CODE;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user