mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Compare commits
19 Commits
6a07b642d5
...
2ac0db401e
Author | SHA1 | Date | |
---|---|---|---|
|
2ac0db401e | ||
|
07df92108e | ||
|
c0f969ea35 | ||
|
2273ab1c20 | ||
|
32bc034ef7 | ||
|
d9d81b3f7a | ||
|
a1cf383a50 | ||
|
608e678217 | ||
|
173464b8a3 | ||
|
0c77174406 | ||
|
8fc5266996 | ||
|
454800a096 | ||
|
2f6838cab3 | ||
|
179983a7fb | ||
|
69614db1ec | ||
|
ce64021ce9 | ||
|
dcc91b4a85 | ||
|
18d9d7ee9d | ||
|
a6a2cdcf92 |
@ -4433,6 +4433,27 @@ Action Redoes the last thing undone.
|
||||
Syntax redo
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection*
|
||||
reference-insert
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Action Inserts a cross-reference into the document.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Notion Optional <TYPE> can be used to set the type of reference
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Syntax reference-insert <LABEL> [<TYPE>]
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Origin spitz,
|
||||
28 Jul 2024
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection*
|
||||
reference-next
|
||||
\end_layout
|
||||
@ -4450,6 +4471,45 @@ Origin Dekel,
|
||||
14 Jan 2001
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection*
|
||||
reference-to-paragraph
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Action Inserts a cross-reference to the paragraph with a given ID
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Notion The function checks of the paragraph already has a label.
|
||||
If so,
|
||||
it uses that.
|
||||
Otherwise it inserts a label and uses this.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Syntax reference-to-paragraph <PAR_ID> [<TYPE>]
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Params <PAR_IDs>:
|
||||
paragraph ids,
|
||||
might be a comma-separated list
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
if it is in a nested inset
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
<TYPE>:
|
||||
cross-references type
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Origin spitz,
|
||||
28 Jul 2024
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection*
|
||||
repeat
|
||||
\end_layout
|
||||
@ -4657,8 +4717,12 @@ Action Pastes the internal selection text in permanent selection.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Notion Created in order to have middle mouse button pasting correct (bound to command-alternatives selection-paste ;
|
||||
primary-selection-paste paragraph).
|
||||
Notion Created in order to have middle mouse button pasting correct.
|
||||
The middle button is bound to "command-alternatives selection-paste ;
|
||||
primary-selection-paste".
|
||||
selection-paste makes sure that if something is highlighted in LyX window it gets into selection buffer and pasted.
|
||||
If nothing is highlighted,
|
||||
then primary-selection-paste covers the cases of pasting from selection buffer from another apps (or from LyX once the highlight is gone).
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
@ -30993,11 +30993,30 @@ name "sec:Cross-References"
|
||||
\begin_layout Standard
|
||||
One of \SpecialChar LyX
|
||||
's strengths is cross-references.
|
||||
You can reference every section,
|
||||
You can reference every
|
||||
\change_inserted -712698321 1723183496
|
||||
thing in the document that has a counter
|
||||
\change_unchanged
|
||||
|
||||
\change_inserted -712698321 1723183501
|
||||
(e.
|
||||
\begin_inset space \thinspace{}
|
||||
\end_inset
|
||||
|
||||
g.,
|
||||
|
||||
\change_unchanged
|
||||
section,
|
||||
float,
|
||||
footnote,
|
||||
formula,
|
||||
and list in the document.
|
||||
and list
|
||||
\change_inserted -712698321 1723183507
|
||||
)
|
||||
\change_deleted -712698321 1723183511
|
||||
in the document
|
||||
\change_unchanged
|
||||
.
|
||||
To reference a document part,
|
||||
you have to insert a label into it.
|
||||
The label is used as an anchor and a name for the reference.
|
||||
@ -31133,16 +31152,79 @@ enu:Second-item
|
||||
|
||||
.
|
||||
At the position of the cross-reference box the item number will appear in the output.
|
||||
\change_inserted -712698321 1723183607
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
As an alternative to
|
||||
|
||||
\change_inserted -712698321 1723185545
|
||||
For section headings,
|
||||
footnotes,
|
||||
table and figure floats,
|
||||
this procedure can be simplified by using the outliner (see section
|
||||
\begin_inset space ~
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset CommandInset ref
|
||||
LatexCommand ref
|
||||
reference "subsec:The-Outliner"
|
||||
|
||||
\end_inset
|
||||
|
||||
).
|
||||
To insert a reference,
|
||||
simply right-click on the item you want to refer to,
|
||||
select
|
||||
\family sans
|
||||
Insert Cross-Reference to this Item
|
||||
\family default
|
||||
and the desired cross-reference format (see below for those) in the context menu.
|
||||
\SpecialChar LyX
|
||||
will check if the item already has a label and if not,
|
||||
creates one before inserting the reference.
|
||||
So all of the above boils down to two clicks!
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\change_deleted -712698321 1723184542
|
||||
A
|
||||
\change_inserted -712698321 1723184543
|
||||
Other
|
||||
\change_deleted -712698321 1723184013
|
||||
s an
|
||||
\change_unchanged
|
||||
alternative
|
||||
\change_inserted -712698321 1723184545
|
||||
s
|
||||
\change_unchanged
|
||||
to
|
||||
\family sans
|
||||
Insert\SpecialChar menuseparator
|
||||
Cross-Reference
|
||||
\change_inserted -712698321 1723184603
|
||||
|
||||
\family default
|
||||
which work for all item types (but require a label to exist already) are the following:
|
||||
\change_deleted -712698321 1723184051
|
||||
,
|
||||
you can right-click on a label and in the popup menu select
|
||||
you can
|
||||
\change_inserted -712698321 1723184553
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
|
||||
\change_deleted -712698321 1723184557
|
||||
|
||||
\change_inserted -712698321 1723184638
|
||||
R
|
||||
\change_deleted -712698321 1723184638
|
||||
r
|
||||
\change_unchanged
|
||||
ight-click on a label and in the popup menu select
|
||||
\family sans
|
||||
Copy as Reference
|
||||
\family default
|
||||
@ -31159,10 +31241,45 @@ arg "paste"
|
||||
\end_inset
|
||||
|
||||
).
|
||||
\change_inserted -712698321 1723184640
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
|
||||
\change_inserted -712698321 1723184714
|
||||
In the outliner,
|
||||
section
|
||||
\family sans
|
||||
Labels and Cross-References
|
||||
\family default
|
||||
,
|
||||
right-click on the label you want to refer to and select
|
||||
\family sans
|
||||
Insert Reference at Cursor Position
|
||||
\family default
|
||||
from the context menu.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Here is our cross-reference:
|
||||
|
||||
\change_inserted -712698321 1723184132
|
||||
Whatever approach you take,
|
||||
|
||||
\change_deleted -712698321 1723184093
|
||||
H
|
||||
\change_inserted -712698321 1723184094
|
||||
h
|
||||
\change_unchanged
|
||||
ere is
|
||||
\change_inserted -712698321 1723184100
|
||||
how
|
||||
\change_unchanged
|
||||
our cross-reference
|
||||
\change_inserted -712698321 1723185807
|
||||
ultimately comes out
|
||||
\change_unchanged
|
||||
:
|
||||
Item
|
||||
\begin_inset space ~
|
||||
\end_inset
|
||||
|
@ -9302,10 +9302,12 @@ Unformatiert
|
||||
\end_layout
|
||||
|
||||
\begin_layout Verbatim
|
||||
|
||||
Dies ist Unformatiert.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Verbatim
|
||||
|
||||
Die folgenden 2 Zeilen sind leer:
|
||||
\end_layout
|
||||
|
||||
@ -9318,6 +9320,7 @@ Die folgenden 2 Zeilen sind leer:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Verbatim
|
||||
|
||||
Fast alles ist in Unformatiert erlaubt:"%&$§#~'`
|
||||
\backslash
|
||||
}][{|
|
||||
@ -9343,6 +9346,7 @@ Unformatiert
|
||||
\end_layout
|
||||
|
||||
\begin_layout Verbatim*
|
||||
|
||||
Dies ist Unformatiert*.
|
||||
\end_layout
|
||||
|
||||
@ -30219,10 +30223,12 @@ name "sec:Querverweise"
|
||||
\begin_layout Standard
|
||||
Eine von \SpecialChar LyX
|
||||
’ Stärken sind Querverweise.
|
||||
Sie können auf jeden Abschnitt,
|
||||
jedes Gleitobjekt,
|
||||
jede Fußnote,
|
||||
Formel und Liste im Dokument referenzieren.
|
||||
Sie können auf jeden alles im Dokument verweisen,
|
||||
was einen Zähler hat (Kapitel\SpecialChar breakableslash
|
||||
Abschnitte,
|
||||
Gleitobjekte,
|
||||
Fußnote,
|
||||
Formel und Listen).
|
||||
Für eine Referenz müssen Sie zuerst eine Marke in den zu referenzieren Teil einfügen.
|
||||
Die Marke dient als Anker und Name für die Referenz.
|
||||
Angenommen Sie wollen den zweiten Eintrag der folgenden Liste referenzieren:
|
||||
@ -30349,16 +30355,52 @@ Format
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Alternativ zu
|
||||
Für Kapitel\SpecialChar breakableslash
|
||||
Abschnitte,
|
||||
Fußnoten,
|
||||
Tabellen- und Abbildungsgleitobjekte geht das Ganze auch noch einfacher,
|
||||
wenn Sie die Gliederungsansicht (siehe Abschnitt
|
||||
\begin_inset space ~
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset CommandInset ref
|
||||
LatexCommand ref
|
||||
reference "subsec:Gliederung"
|
||||
|
||||
\end_inset
|
||||
|
||||
) verwenden.
|
||||
Um einen Querverweis einzufügen,
|
||||
klicken Sie dort einfach mit der rechten Maustaste auf den Eintrag,
|
||||
auf den Sie verweisen wollen,
|
||||
wählen dann Querverweis auf diesen Eintrag einfügen und den gewünschten Querverweisstil (s.
|
||||
dazu unten) aus dem Kontextmenü.
|
||||
\SpecialChar LyX
|
||||
prüft,
|
||||
ob eine entsprechende Marke vorhanden ist,
|
||||
falls nicht,
|
||||
legt es diese an,
|
||||
bevor es den Querverweis einfügt.
|
||||
Das ganze Prozedere reduziert sich damit auf zwei Klicks!
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Andere Alternativen zu
|
||||
\family sans
|
||||
Einfügen\SpecialChar menuseparator
|
||||
Querverweis
|
||||
\family default
|
||||
können Sie mit rechts auf die Marke klicken und im erscheinenden Kontextmenü
|
||||
,
|
||||
die für alle Eintragstypen funktionieren (so lange ein Label vorhanden ist) sind diese:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
Klicken Sie mit rechts auf die Marke und verwenden Sie dann im erscheinenden Kontextmenü
|
||||
\family sans
|
||||
Als Querverweis kopieren
|
||||
\family default
|
||||
verwenden.
|
||||
.
|
||||
Der Querverweis zu dieser Marke ist nun in der Zwischenablage und kann an der aktuellen Cursorposition mit dem Menü
|
||||
\family sans
|
||||
Bearbeiten\SpecialChar menuseparator
|
||||
@ -30371,8 +30413,24 @@ Ctrl+V
|
||||
) eingefügt werden.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
In der Gliederungsansicht,
|
||||
Abschnitt
|
||||
\family sans
|
||||
Marken und Querverweise
|
||||
\family default
|
||||
,
|
||||
klicken Sie mit rechts auf die Marke,
|
||||
auf die Sie verweisen möchten und wählen dann im Kontextmenü
|
||||
\family sans
|
||||
Verweis an der Cursor-Position einfügen
|
||||
\family default
|
||||
.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Hier ist unser Querverweis:
|
||||
Welche dieser Möglichkeiten Sie auch immer wählen,
|
||||
so sieht unser Querverweis schließlich aus:
|
||||
Eintrag
|
||||
\begin_inset space ~
|
||||
\end_inset
|
||||
@ -30386,13 +30444,6 @@ nolink "false"
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\begin_inset Newpage newpage
|
||||
\end_inset
|
||||
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
@ -5,7 +5,7 @@
|
||||
\save_transient_properties true
|
||||
\origin /systemlyxdir/examples/es/Handouts/
|
||||
\textclass tufte-handout
|
||||
\use_default_options true
|
||||
\use_default_options false
|
||||
\maintain_unincluded_children no
|
||||
\language spanish
|
||||
\language_package default
|
||||
@ -30,6 +30,8 @@
|
||||
\output_sync 0
|
||||
\bibtex_command bibtex
|
||||
\index_command default
|
||||
\float_placement class
|
||||
\float_alignment class
|
||||
\paperfontsize default
|
||||
\spacing single
|
||||
\use_hyperref false
|
||||
@ -45,7 +47,7 @@
|
||||
\use_package stackrel 1
|
||||
\use_package stmaryrd 1
|
||||
\use_package undertilde 1
|
||||
\cite_engine basic
|
||||
\cite_engine natbib
|
||||
\cite_engine_type default
|
||||
\biblio_style plain
|
||||
\use_bibtopic false
|
||||
@ -54,6 +56,7 @@
|
||||
\suppress_date false
|
||||
\justification true
|
||||
\use_refstyle 0
|
||||
\use_formatted_ref 0
|
||||
\use_minted 0
|
||||
\use_lineno 0
|
||||
\index Índice
|
||||
@ -1735,7 +1738,7 @@ GitHub
|
||||
\begin_layout Standard
|
||||
\begin_inset CommandInset bibtex
|
||||
LatexCommand bibtex
|
||||
bibfiles "../../biblioExample"
|
||||
bibfiles "../../../../../lyx-devel/lib/examples/biblioExample"
|
||||
options "plainnat"
|
||||
|
||||
\end_inset
|
||||
|
@ -584,6 +584,17 @@ Menuset
|
||||
|
||||
Menu "context-toc-figure"
|
||||
Item "Settings...|S" "inset-settings"
|
||||
Separator
|
||||
SubMenu "Insert Cross-Reference to this Item|C" "context-toc-ref-to-par"
|
||||
End
|
||||
|
||||
|
||||
#
|
||||
# Toc Footnotes context menu
|
||||
#
|
||||
|
||||
Menu "context-toc-footnote"
|
||||
SubMenu "Insert Cross-Reference to this Item|C" "context-toc-ref-to-par"
|
||||
End
|
||||
|
||||
#
|
||||
@ -600,6 +611,8 @@ Menuset
|
||||
|
||||
Menu "context-toc-table"
|
||||
Item "Settings...|S" "inset-settings"
|
||||
Separator
|
||||
SubMenu "Insert Cross-Reference to this Item|C" "context-toc-ref-to-par"
|
||||
End
|
||||
|
||||
#
|
||||
@ -707,6 +720,18 @@ Menuset
|
||||
# Toc Table of Context context menu
|
||||
#
|
||||
|
||||
Menu "context-toc-ref-to-par"
|
||||
Item "<Reference>|R" "reference-to-paragraph ref"
|
||||
Item "(<Reference>)|e" "reference-to-paragraph eqref"
|
||||
Item "<Page>|P" "reference-to-paragraph pageref"
|
||||
Item "On Page <Page>|O" "reference-to-paragraph vpageref"
|
||||
Item "<Reference> on Page <Page>|f" "reference-to-paragraph vref"
|
||||
Item "Formatted Reference|t" "reference-to-paragraph formatted"
|
||||
Item "Textual Reference|x" "reference-to-paragraph nameref"
|
||||
Item "Label Only|L" "reference-to-paragraph labelonly"
|
||||
|
||||
End
|
||||
|
||||
Menu "context-toc-tableofcontents"
|
||||
Item "Promote Section|P" "outline-out"
|
||||
Item "Demote Section|D" "outline-in"
|
||||
@ -714,6 +739,8 @@ Menuset
|
||||
Item "Move Section Down|w" "outline-down"
|
||||
Separator
|
||||
Item "Select Section|S" "section-select"
|
||||
Separator
|
||||
SubMenu "Insert Cross-Reference to this Item|C" "context-toc-ref-to-par"
|
||||
End
|
||||
|
||||
#
|
||||
|
15
po/sk.po
15
po/sk.po
@ -8,8 +8,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: LyX-2.4\n"
|
||||
"Report-Msgid-Bugs-To: lyx-devel@lists.lyx.org\n"
|
||||
"POT-Creation-Date: 2024-09-18 09:39+0200\n"
|
||||
"PO-Revision-Date: 2024-09-21 19:58+0000\n"
|
||||
"POT-Creation-Date: 2024-09-22 11:38+0200\n"
|
||||
"PO-Revision-Date: 2024-09-22 11:32+0000\n"
|
||||
"Last-Translator: Kornel Benko <kornel@lyx.org>\n"
|
||||
"Language-Team: Slovak <kornel@lyx.org>\n"
|
||||
"Language: sk\n"
|
||||
@ -313,7 +313,7 @@ msgstr "&Pridať lokálnu…"
|
||||
|
||||
#: src/frontends/qt/ui/BibtexUi.ui:91
|
||||
msgid "Transfer an absolute local path to a relative one or vice versa"
|
||||
msgstr ""
|
||||
msgstr "Preniesť absolútnu lokálnu cestu na relatívnu alebo naopak"
|
||||
|
||||
#: src/frontends/qt/ui/BibtexUi.ui:91
|
||||
msgid "Inherit bibliography databases from the master document"
|
||||
@ -20929,6 +20929,11 @@ msgstr "Pridať neznámu vetvu|P"
|
||||
msgid "Insert Reference at Cursor Position|I"
|
||||
msgstr "Vložiť referenciu na pozícii kurzoru|V"
|
||||
|
||||
#: lib/ui/stdcontext.inc:588 lib/ui/stdcontext.inc:597
|
||||
#: lib/ui/stdcontext.inc:615 lib/ui/stdcontext.inc:743
|
||||
msgid "Insert Cross-Reference to this Item|C"
|
||||
msgstr "Vložiť krížovú referenciu na túto položku|k"
|
||||
|
||||
#: lib/ui/stdcontext.inc:625
|
||||
msgid "Insert Copy at Cursor Position|I"
|
||||
msgstr "Vložiť kópiu k pozícii kurzoru|V"
|
||||
@ -32322,11 +32327,11 @@ msgstr "Kódovanie dokumentu"
|
||||
|
||||
#: src/frontends/qt/GuiBibtex.cpp:365 src/frontends/qt/ui/BibtexUi.ui:94
|
||||
msgid "&Make Relative"
|
||||
msgstr ""
|
||||
msgstr "&Vytvoriť relatívne"
|
||||
|
||||
#: src/frontends/qt/GuiBibtex.cpp:369
|
||||
msgid "&Make Absolute"
|
||||
msgstr ""
|
||||
msgstr "&Vytvoriť absolútne"
|
||||
|
||||
#: src/frontends/qt/GuiBibtex.cpp:312
|
||||
msgid "Database"
|
||||
|
@ -1282,6 +1282,19 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
|| getInsetByCode<InsetMathRef>(cur, MATH_REF_CODE));
|
||||
break;
|
||||
|
||||
case LFUN_REFERENCE_TO_PARAGRAPH: {
|
||||
vector<string> const pids = getVectorFromString(cmd.getArg(0));
|
||||
for (string const & s : pids) {
|
||||
int const id = convert<int>(s);
|
||||
if (id < 0) {
|
||||
flag.setEnabled(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
flag.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_CHANGES_MERGE:
|
||||
case LFUN_CHANGE_NEXT:
|
||||
case LFUN_CHANGE_PREVIOUS:
|
||||
@ -1641,6 +1654,58 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_REFERENCE_TO_PARAGRAPH: {
|
||||
vector<string> const pids = getVectorFromString(cmd.getArg(0));
|
||||
string const type = cmd.getArg(1);
|
||||
int id = convert<int>(pids.back());
|
||||
if (id < 0)
|
||||
break;
|
||||
int i = 0;
|
||||
for (Buffer * b = &buffer_; i == 0 || b != &buffer_;
|
||||
b = theBufferList().next(b)) {
|
||||
DocIterator dit = b->getParFromID(id);
|
||||
if (dit.empty()) {
|
||||
LYXERR(Debug::INFO, "No matching paragraph found! [" << id << "].");
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
string label = dit.innerParagraph().getLabelForXRef();
|
||||
if (!label.empty()) {
|
||||
// if the paragraph has a label, we refer to this
|
||||
string const arg = (type.empty()) ? label : label + " " + type;
|
||||
lyx::dispatch(FuncRequest(LFUN_REFERENCE_INSERT, arg));
|
||||
break;
|
||||
} else {
|
||||
// if there is not a label yet
|
||||
// go to the paragraph (including nested insets) ...
|
||||
lyx::dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
|
||||
for (string const & s : pids) {
|
||||
id = convert<int>(s);
|
||||
if (id < 0)
|
||||
break;
|
||||
dit = b->getParFromID(id);
|
||||
lyx::dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, s));
|
||||
}
|
||||
// ... if not, insert a new label
|
||||
// we do not want to open the dialog, hence we
|
||||
// do not employ LFUN_LABEL_INSERT
|
||||
InsetCommandParams p(LABEL_CODE);
|
||||
docstring const new_label = dit.getPossibleLabel();
|
||||
p["name"] = new_label;
|
||||
string const data = InsetCommand::params2string(p);
|
||||
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
|
||||
string const arg = (type.empty()) ? to_utf8(new_label)
|
||||
: to_utf8(new_label) + " " + type;
|
||||
// ... and go back to the original position
|
||||
lyx::dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"));
|
||||
// ... to insert the ref
|
||||
lyx::dispatch(FuncRequest(LFUN_REFERENCE_INSERT, arg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_NOTE_NEXT:
|
||||
if (gotoInset(this, { NOTE_CODE }, false))
|
||||
dr.screenUpdate(Update::Force);
|
||||
|
@ -225,11 +225,12 @@ CursorSlice const & DocIterator::innerTextSlice() const
|
||||
}
|
||||
|
||||
|
||||
docstring DocIterator::paragraphGotoArgument() const
|
||||
docstring DocIterator::paragraphGotoArgument(bool const nopos) const
|
||||
{
|
||||
CursorSlice const & s = innerTextSlice();
|
||||
return convert<docstring>(s.paragraph().id()) + ' ' +
|
||||
convert<docstring>(s.pos());
|
||||
return nopos ? convert<docstring>(s.paragraph().id())
|
||||
: convert<docstring>(s.paragraph().id())
|
||||
+ ' ' + convert<docstring>(s.pos());
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,8 +167,9 @@ public:
|
||||
Paragraph & innerParagraph() const;
|
||||
/// return the inner text slice.
|
||||
CursorSlice const & innerTextSlice() const;
|
||||
// convert a DocIterator into an argument to LFUN_PARAGRAPH_GOTO
|
||||
docstring paragraphGotoArgument() const;
|
||||
/// convert a DocIterator into an argument to LFUN_PARAGRAPH_GOTO
|
||||
/// \p nopos determines whether the cursor position is returned
|
||||
docstring paragraphGotoArgument(bool const nopos = false) const;
|
||||
/// returns a DocIterator for the containing text inset
|
||||
DocIterator getInnerText() const;
|
||||
/// the first and last positions of a word at top cursor slice
|
||||
|
@ -509,6 +509,9 @@ enum FuncCode
|
||||
LFUN_TAB_GROUP_PREVIOUS, // daniel 20220130
|
||||
LFUN_BIBTEX_DATABASE_LIST, // bpiwowar, 20221218
|
||||
LFUN_STATISTICS_REFERENCE_CLAMP,// sanda, 20240324
|
||||
LFUN_REFERENCE_INSERT, // spitz, 20240728
|
||||
// 400
|
||||
LFUN_REFERENCE_TO_PARAGRAPH, // spitz, 20240728
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
||||
|
@ -3512,6 +3512,16 @@ void LyXAction::init()
|
||||
*/
|
||||
{ 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
|
||||
* \li Action: Go to the next label or cross-reference.
|
||||
@ -3521,6 +3531,20 @@ void LyXAction::init()
|
||||
*/
|
||||
{ LFUN_REFERENCE_NEXT, "reference-next", ReadOnly, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_REFERENCE_TO_PARAGRAPH
|
||||
* \li Action: Inserts a cross-reference to the paragraph with a given ID
|
||||
* \li Notion: The function checks of the paragraph already has a label.
|
||||
* If so, it uses that. Otherwise it inserts a label and uses this.
|
||||
* \li Syntax: reference-to-paragraph <PAR_ID> [<TYPE>]
|
||||
* \li Params: <PAR_IDs>: paragraph ids, might be a comma-separated list\n
|
||||
* if it is in a nested inset\n
|
||||
* <TYPE>: cross-references type
|
||||
* \li Origin: spitz, 28 Jul 2024
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_REFERENCE_TO_PARAGRAPH, "reference-to-paragraph", Noop, Edit },
|
||||
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_REGEXP_MODE
|
||||
|
@ -3337,6 +3337,21 @@ string Paragraph::getID(Buffer const &, OutputParams const &)
|
||||
}
|
||||
|
||||
|
||||
string Paragraph::getLabelForXRef() const
|
||||
{
|
||||
for (pos_type i = 0; i < size(); ++i) {
|
||||
if (Inset const * inset = getInset(i)) {
|
||||
InsetCode lyx_code = inset->lyxCode();
|
||||
if (lyx_code == LABEL_CODE) {
|
||||
InsetLabel const * const il = static_cast<InsetLabel const *>(inset);
|
||||
return to_utf8(il->getParam("name"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
pos_type Paragraph::firstWordDocBook(XMLStream & xs, OutputParams const & runparams) const
|
||||
{
|
||||
pos_type i;
|
||||
|
@ -201,6 +201,10 @@ public:
|
||||
/// Get the id of the paragraph, useful for DocBook
|
||||
std::string getID(Buffer const & buf, OutputParams const & runparams) const;
|
||||
|
||||
/// Return the string of the (first) \label (cross-referencing target)
|
||||
/// in this paragraph, or an empty string
|
||||
std::string getLabelForXRef() const;
|
||||
|
||||
/// Output the first word of a paragraph, return the position where it left.
|
||||
pos_type firstWordDocBook(XMLStream & xs, OutputParams const & runparams) const;
|
||||
|
||||
|
20
src/Text.cpp
20
src/Text.cpp
@ -82,6 +82,7 @@
|
||||
#include "insets/InsetIPAMacro.h"
|
||||
#include "insets/InsetNewline.h"
|
||||
#include "insets/InsetQuotes.h"
|
||||
#include "insets/InsetRef.h"
|
||||
#include "insets/InsetSpecialChar.h"
|
||||
#include "insets/InsetTabular.h"
|
||||
#include "insets/InsetText.h"
|
||||
@ -5480,6 +5481,18 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
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: {
|
||||
if (cmd.argument().empty()) {
|
||||
bv->showDialog("info", cur.current_font.language()->lang());
|
||||
@ -6739,6 +6752,13 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_PREVIEW_INSERT:
|
||||
code = PREVIEW_CODE;
|
||||
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:
|
||||
code = SCRIPT_CODE;
|
||||
break;
|
||||
|
@ -75,17 +75,22 @@ public:
|
||||
///
|
||||
docstring const & prettyStr() const { return pretty_str_; }
|
||||
///
|
||||
void prettyStr (docstring const & s) { pretty_str_ = s; }
|
||||
void prettyStr(docstring const & s) { pretty_str_ = s; }
|
||||
///
|
||||
bool isOutput() const { return output_; }
|
||||
///
|
||||
bool isMissing() const { return missing_; }
|
||||
///
|
||||
void setAction(FuncRequest const & a) { action_ = a; }
|
||||
/// return comma-separated list of all par IDs (including nested insets)
|
||||
/// this is used by captioned elements
|
||||
docstring const parIDs() const { return par_ids_; }
|
||||
///
|
||||
void setParIDs(docstring const & ids) { par_ids_ = ids; }
|
||||
|
||||
/// custom action, or the default one (paragraph-goto) if not customised
|
||||
FuncRequest action() const;
|
||||
///
|
||||
/// return only main par ID
|
||||
int id() const;
|
||||
/// String for display, e.g. it has a mark if output is inactive
|
||||
docstring const asString() const;
|
||||
@ -105,6 +110,8 @@ private:
|
||||
bool missing_;
|
||||
/// Custom action
|
||||
FuncRequest action_;
|
||||
/// Paragraph IDs including nested insets (comma-separated).
|
||||
docstring par_ids_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -46,10 +46,13 @@ void TocBuilder::captionItem(DocIterator const & dit, docstring const & s,
|
||||
bool output_active)
|
||||
{
|
||||
// first show the float before moving to the caption
|
||||
docstring parids = dit.paragraphGotoArgument(true);
|
||||
docstring arg = "paragraph-goto " + dit.paragraphGotoArgument();
|
||||
if (!stack_.empty())
|
||||
if (!stack_.empty()) {
|
||||
arg = "paragraph-goto " +
|
||||
(*toc_)[stack_.top().pos].dit().paragraphGotoArgument() + ";" + arg;
|
||||
parids = (*toc_)[stack_.top().pos].dit().paragraphGotoArgument(true) + "," + parids;
|
||||
}
|
||||
FuncRequest func(LFUN_COMMAND_SEQUENCE, arg);
|
||||
|
||||
if (!stack_.empty() && !stack_.top().is_captioned) {
|
||||
@ -58,6 +61,7 @@ void TocBuilder::captionItem(DocIterator const & dit, docstring const & s,
|
||||
TocItem & captionable = (*toc_)[stack_.top().pos];
|
||||
captionable.str(s);
|
||||
captionable.setAction(func);
|
||||
captionable.setParIDs(parids);
|
||||
stack_.top().is_captioned = true;
|
||||
} else {
|
||||
// This is a new entry.
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "FuncStatus.h"
|
||||
#include "LyX.h"
|
||||
#include "Menus.h"
|
||||
#include "Paragraph.h"
|
||||
#include "TocBackend.h"
|
||||
|
||||
#include "insets/InsetCommand.h"
|
||||
@ -180,6 +181,7 @@ bool TocWidget::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_OUTLINE_DOWN:
|
||||
case LFUN_OUTLINE_IN:
|
||||
case LFUN_OUTLINE_OUT:
|
||||
case LFUN_REFERENCE_TO_PARAGRAPH:
|
||||
case LFUN_SECTION_SELECT:
|
||||
status.setEnabled((bool)item.dit());
|
||||
return true;
|
||||
@ -248,6 +250,18 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd,
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_REFERENCE_TO_PARAGRAPH: {
|
||||
docstring const type = cmd.argument();
|
||||
TocItem const & item =
|
||||
gui_view_.tocModels().currentItem(current_type_, index);
|
||||
docstring const id = (item.parIDs().empty())
|
||||
? item.dit().paragraphGotoArgument(true)
|
||||
: item.parIDs();
|
||||
docstring const arg = (type.empty()) ? id : id + " " + type;
|
||||
dispatch(FuncRequest(cmd, arg));
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_OUTLINE_UP:
|
||||
case LFUN_OUTLINE_DOWN:
|
||||
case LFUN_OUTLINE_IN:
|
||||
|
@ -27,6 +27,9 @@ What's new
|
||||
|
||||
* USER INTERFACE
|
||||
|
||||
- It is now possible to inserts cross references to sections via
|
||||
the outliner, even of they do not have a label yet. In the latter
|
||||
case, a label is autonatically inserted.
|
||||
|
||||
|
||||
* DOCUMENTATION AND LOCALIZATION
|
||||
|
Loading…
Reference in New Issue
Block a user