mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Add InsertCotext tag to InsetLayout
Avoids hardcoding of insets, and this behavior is possibly useful to other insets than index and nomencl We take this on yesterday's layout format change
This commit is contained in:
parent
dceed8d87d
commit
0659af15fb
@ -13050,6 +13050,8 @@ status collapsed
|
||||
|
||||
\change_inserted -712698321 1723455730
|
||||
EscapeChars
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -13062,6 +13064,8 @@ status collapsed
|
||||
|
||||
\change_inserted -712698321 1723455616
|
||||
string
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -19776,6 +19780,8 @@ status collapsed
|
||||
|
||||
\change_inserted -712698321 1723455884
|
||||
EscapeChars
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -19788,6 +19794,8 @@ status collapsed
|
||||
|
||||
\change_inserted -712698321 1723455884
|
||||
string
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -20250,6 +20258,82 @@ status collapsed
|
||||
export if this parameter is 1,
|
||||
as well as on screen.
|
||||
Otherwise the document default font is used.
|
||||
\change_inserted -712698321 1723525171
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1723526674
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1723525171
|
||||
InsertCotext
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1723525183
|
||||
[
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1723525183
|
||||
0
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
,
|
||||
\begin_inset space \thinspace{}
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1723525183
|
||||
|
||||
\emph on
|
||||
1
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
]
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
If this is set to
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1723525171
|
||||
1
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
,
|
||||
a copy of the co-text (either selected text or the word preceding the cursor) is inserted as content on inset creation.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
@ -22787,6 +22871,8 @@ status collapsed
|
||||
|
||||
\change_inserted -712698321 1723455760
|
||||
EscapeChars
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -22799,6 +22885,8 @@ status collapsed
|
||||
|
||||
\change_inserted -712698321 1723455760
|
||||
string
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -22817,6 +22905,8 @@ status collapsed
|
||||
|
||||
\change_inserted -712698321 1723455760
|
||||
%!@
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -22829,6 +22919,8 @@ status collapsed
|
||||
|
||||
\change_inserted -712698321 1723455760
|
||||
!
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -22841,6 +22933,8 @@ status collapsed
|
||||
|
||||
\change_inserted -712698321 1723455760
|
||||
@
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -22853,6 +22947,8 @@ status collapsed
|
||||
|
||||
\change_inserted -712698321 1723455760
|
||||
%
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
@ -19026,6 +19026,56 @@ nolink "false"
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
InsertCotext
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
[
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\emph on
|
||||
0
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
,
|
||||
\begin_inset space \thinspace{}
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
1
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
] Wenn dies auf
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
1
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
gesetzt wird,
|
||||
wird eine Kopie des umgebenden Texts (entweder der ausgewählte Text oder das Wort vor dem Cursor) bei der Erstellung als Inhalt eingefügt.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
InToc
|
||||
\end_layout
|
||||
|
@ -421,6 +421,7 @@ InsetLayout Index
|
||||
ForcePlain true
|
||||
ContentAsLabel true
|
||||
EscapeChars \"@|!
|
||||
InsertCotext 1
|
||||
End
|
||||
|
||||
InsetLayout IndexMacro:see
|
||||
@ -482,6 +483,7 @@ InsetLayout Nomenclature
|
||||
EscapeChars %!@|
|
||||
EndArgument
|
||||
EscapeChars %!@|
|
||||
InsertCotext 1
|
||||
End
|
||||
|
||||
InsetLayout Box
|
||||
|
@ -356,7 +356,8 @@ currentFormat = 107
|
||||
# New CiteEngine type "notes"
|
||||
|
||||
# Incremented to format 107, 12 August 2023 by spitz
|
||||
# New InsetLayout and Layout tags "EscapeChars"
|
||||
# New InsetLayout, Argument and Layout tags "EscapeChars"
|
||||
# New InsetLayout tag "InsertCotext"
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
@ -3643,8 +3643,7 @@ bool doInsertInset(Cursor & cur, Text * text,
|
||||
|
||||
bool gotsel = false;
|
||||
bool move_layout = false;
|
||||
bool const copy_cotext = cmd.action() == LFUN_INDEX_INSERT
|
||||
|| cmd.action() == LFUN_NOMENCL_INSERT;
|
||||
bool const copy_cotext = inset->getLayout().insertCotext();
|
||||
if (cur.selection()) {
|
||||
if (copy_cotext)
|
||||
copySelectionToTemp(cur);
|
||||
|
@ -59,7 +59,7 @@ namespace lyx {
|
||||
// You should also run the development/tools/updatelayouts.py script,
|
||||
// to update the format of all of our layout files.
|
||||
//
|
||||
int const LAYOUT_FORMAT = 107; // spitz: EscapeChars
|
||||
int const LAYOUT_FORMAT = 107; // spitz: EscapeChars and InsertCotext
|
||||
|
||||
|
||||
// Layout format for the current lyx file format. Controls which format is
|
||||
|
@ -125,6 +125,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
|
||||
IL_DOCBOOKRENDERASIMAGE,
|
||||
IL_ESCAPE_CHARS,
|
||||
IL_INHERITFONT,
|
||||
IL_INSERTCOTEXT,
|
||||
IL_INTOC,
|
||||
IL_ISTOCCAPTION,
|
||||
IL_LABELFONT,
|
||||
@ -217,6 +218,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
|
||||
{ "htmlstyle", IL_HTMLSTYLE },
|
||||
{ "htmltag", IL_HTMLTAG },
|
||||
{ "inheritfont", IL_INHERITFONT },
|
||||
{ "insertcotext", IL_INSERTCOTEXT },
|
||||
{ "intoc", IL_INTOC },
|
||||
{ "istoccaption", IL_ISTOCCAPTION },
|
||||
{ "keepempty", IL_KEEPEMPTY },
|
||||
@ -362,6 +364,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
|
||||
case IL_INHERITFONT:
|
||||
lex >> inheritfont_;
|
||||
break;
|
||||
case IL_INSERTCOTEXT:
|
||||
lex >> insert_cotext_;
|
||||
break;
|
||||
case IL_INTOC:
|
||||
lex >> intoc_;
|
||||
break;
|
||||
|
@ -271,6 +271,8 @@ public:
|
||||
int allowedOccurrences() const { return allowed_occurrences_; }
|
||||
///
|
||||
bool allowedOccurrencesPerItem() const { return allowed_occurrences_per_item_; }
|
||||
///
|
||||
bool insertCotext() const { return insert_cotext_; }
|
||||
private:
|
||||
///
|
||||
void makeDefaultCSS() const;
|
||||
@ -468,6 +470,8 @@ private:
|
||||
int allowed_occurrences_ = -1;
|
||||
///
|
||||
bool allowed_occurrences_per_item_ = false;
|
||||
///
|
||||
bool insert_cotext_ = false;
|
||||
};
|
||||
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user