Support FreeSpacing in InsetArgument

This commit is contained in:
Juergen Spitzmueller 2019-06-02 16:33:06 +02:00
parent 378c7e8edb
commit 9f04eeae03
9 changed files with 136 additions and 8 deletions

View File

@ -1,5 +1,5 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/ #LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 573 \lyxformat 575
\begin_document \begin_document
\begin_header \begin_header
\save_transient_properties true \save_transient_properties true
@ -102,6 +102,8 @@ logicalmkup
\justification true \justification true
\use_refstyle 0 \use_refstyle 0
\use_minted 0 \use_minted 0
\use_lineno 0
\lineno_options
\notefontcolor #0000ff \notefontcolor #0000ff
\branch OutDated \branch OutDated
\selected 0 \selected 0
@ -12296,6 +12298,64 @@ reference "subsec:Font-description"
\end_inset \end_inset
. .
\change_inserted -712698321 1559484228
\end_layout
\begin_layout Itemize
\change_inserted -712698321 1559484228
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1559484228
FreeSpacing
\end_layout
\end_inset
[
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1559484228
\emph on
0
\end_layout
\end_inset
,
\begin_inset space \thinspace{}
\end_inset
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1559484228
1
\end_layout
\end_inset
] As with paragraph styles, see
\begin_inset CommandInset ref
LatexCommand ref
reference "subsec:Paragraph-Styles"
\end_inset
.
\change_unchanged
\end_layout \end_layout
\begin_layout Itemize \begin_layout Itemize
@ -12376,8 +12436,12 @@ status collapsed
\end_inset \end_inset
, this argument is automatically inserted when the respective style is selected. , this argument is automatically inserted when the respective style is selected.
\change_deleted -712698321 1559484200
Currently, only one argument per style\SpecialChar breakableslash Currently, only one argument per style\SpecialChar breakableslash
layout can be automatically inserted. layout can be automatically inserted.
\change_unchanged
\end_layout \end_layout
\begin_layout Itemize \begin_layout Itemize

View File

@ -1,5 +1,5 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/ #LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 573 \lyxformat 575
\begin_document \begin_document
\begin_header \begin_header
\save_transient_properties true \save_transient_properties true
@ -110,6 +110,8 @@ logicalmkup
\justification true \justification true
\use_refstyle 0 \use_refstyle 0
\use_minted 0 \use_minted 0
\use_lineno 0
\lineno_options
\notefontcolor #0000ff \notefontcolor #0000ff
\branch OutDated \branch OutDated
\selected 0 \selected 0
@ -10459,6 +10461,52 @@ reference "subsec:Beschreibung-des-Zeichensatzes"
\begin_inset Flex Code \begin_inset Flex Code
status collapsed status collapsed
\begin_layout Plain Layout
FreeSpacing
\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
] Wie bei Absatz-Layouts, siehe
\begin_inset CommandInset ref
LatexCommand ref
reference "subsec:Einzelne-Absatz-Layouts"
\end_inset
.
\end_layout
\begin_layout Itemize
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout \begin_layout Plain Layout
LabelFont LabelFont
\end_layout \end_layout
@ -10534,8 +10582,6 @@ status collapsed
gesetzt wird, wird dieses Argument automatisch eingefügt, sobald der betreffend gesetzt wird, wird dieses Argument automatisch eingefügt, sobald der betreffend
e Absatzstil ausgewählt wird. e Absatzstil ausgewählt wird.
Momentan ist es nur möglich, ein Argument pro Stil\SpecialChar breakableslash
Format automatisch einzufügen.
\end_layout \end_layout
\begin_layout Itemize \begin_layout Itemize

View File

@ -11,7 +11,7 @@
# This script will update a .layout file to current format # This script will update a .layout file to current format
# The latest layout format is also defined in src/TextClass.cpp # The latest layout format is also defined in src/TextClass.cpp
currentFormat = 74 currentFormat = 75
# Incremented to format 4, 6 April 2007, lasgouttes # Incremented to format 4, 6 April 2007, lasgouttes
@ -248,6 +248,9 @@ currentFormat = 74
# Incremented to format 74, 18 April 2019 by spitz # Incremented to format 74, 18 April 2019 by spitz
# New InsetLayout and Argument tag NewlineCmd # New InsetLayout and Argument tag NewlineCmd
# Incremented to format 75, 2 June 2019 by spitz
# New Argument tag FreeSpacing
# Do not forget to document format change in Customization # Do not forget to document format change in Customization
# Manual (section "Declaring a new text class"). # Manual (section "Declaring a new text class").
@ -497,7 +500,7 @@ def convert(lines, end_format):
i += 1 i += 1
continue continue
if format >= 65 and format <= 73: if format >= 65 and format <= 74:
# nothing to do. # nothing to do.
i += 1 i += 1
continue continue

View File

@ -1022,6 +1022,7 @@ void Layout::readArgument(Lexer & lex)
arg.labelfont = inherit_font; arg.labelfont = inherit_font;
arg.is_toc_caption = false; arg.is_toc_caption = false;
arg.passthru = PT_INHERITED; arg.passthru = PT_INHERITED;
arg.free_spacing = false;
string id; string id;
lex >> id; lex >> id;
bool const itemarg = prefixIs(id, "item:"); bool const itemarg = prefixIs(id, "item:");
@ -1098,6 +1099,9 @@ void Layout::readArgument(Lexer & lex)
} else if (tok == "istoccaption") { } else if (tok == "istoccaption") {
lex.next(); lex.next();
arg.is_toc_caption = lex.getBool(); arg.is_toc_caption = lex.getBool();
} else if (tok == "freespacing") {
lex.next();
arg.free_spacing = lex.getBool();
} else { } else {
lex.printError("Unknown tag"); lex.printError("Unknown tag");
error = true; error = true;

View File

@ -109,6 +109,7 @@ public:
ArgPassThru passthru; ArgPassThru passthru;
docstring pass_thru_chars; docstring pass_thru_chars;
bool is_toc_caption; bool is_toc_caption;
bool free_spacing;
std::string newlinecmd; std::string newlinecmd;
}; };
/// ///

View File

@ -62,7 +62,7 @@ namespace lyx {
// You should also run the development/tools/updatelayouts.py script, // You should also run the development/tools/updatelayouts.py script,
// to update the format of all of our layout files. // to update the format of all of our layout files.
// //
int const LAYOUT_FORMAT = 74; // spitz: NewlineCmd int const LAYOUT_FORMAT = 75; // spitz: FreeSpacing (Argument)
// Layout format for the current lyx file format. Controls which format is // Layout format for the current lyx file format. Controls which format is

View File

@ -43,7 +43,8 @@ InsetArgument::InsetArgument(Buffer * buf, string const & name)
: InsetCollapsible(buf), name_(name), labelstring_(docstring()), : InsetCollapsible(buf), name_(name), labelstring_(docstring()),
font_(inherit_font), labelfont_(inherit_font), decoration_(string()), font_(inherit_font), labelfont_(inherit_font), decoration_(string()),
pass_thru_context_(false), pass_thru_local_(false), pass_thru_(false), pass_thru_context_(false), pass_thru_local_(false), pass_thru_(false),
pass_thru_chars_(docstring()), is_toc_caption_(false), newline_cmd_(string()) free_spacing_(false), pass_thru_chars_(docstring()), is_toc_caption_(false),
newline_cmd_(string())
{} {}
@ -119,6 +120,7 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype)
decoration_ = (*lait).second.decoration; decoration_ = (*lait).second.decoration;
pass_thru_chars_ = (*lait).second.pass_thru_chars; pass_thru_chars_ = (*lait).second.pass_thru_chars;
newline_cmd_ = (*lait).second.newlinecmd; newline_cmd_ = (*lait).second.newlinecmd;
free_spacing_ = (*lait).second.free_spacing;
pass_thru_local_ = false; pass_thru_local_ = false;
if (lait->second.is_toc_caption) { if (lait->second.is_toc_caption) {
is_toc_caption_ = true; is_toc_caption_ = true;

View File

@ -69,6 +69,8 @@ public:
/// ///
bool isPassThru() const { return pass_thru_; } bool isPassThru() const { return pass_thru_; }
/// ///
bool isFreeSpacing() const { return free_spacing_; }
///
bool isTocCaption() const { return is_toc_caption_; } bool isTocCaption() const { return is_toc_caption_; }
/// ///
bool resetFontEdit() const { return false; } bool resetFontEdit() const { return false; }
@ -114,6 +116,8 @@ private:
/// Effective pass-thru setting (inherited or local) /// Effective pass-thru setting (inherited or local)
bool pass_thru_; bool pass_thru_;
/// ///
bool free_spacing_;
///
docstring pass_thru_chars_; docstring pass_thru_chars_;
/// Does this argument provide content for the TOC? /// Does this argument provide content for the TOC?
bool is_toc_caption_; bool is_toc_caption_;

View File

@ -610,6 +610,7 @@ void InsetLayout::readArgument(Lexer & lex)
arg.font = inherit_font; arg.font = inherit_font;
arg.labelfont = inherit_font; arg.labelfont = inherit_font;
arg.is_toc_caption = false; arg.is_toc_caption = false;
arg.free_spacing = false;
arg.passthru = PT_INHERITED; arg.passthru = PT_INHERITED;
arg.nodelims = false; arg.nodelims = false;
string nr; string nr;
@ -685,6 +686,9 @@ void InsetLayout::readArgument(Lexer & lex)
} else if (tok == "istoccaption") { } else if (tok == "istoccaption") {
lex.next(); lex.next();
arg.is_toc_caption = lex.getBool(); arg.is_toc_caption = lex.getBool();
} else if (tok == "freespacing") {
lex.next();
arg.free_spacing = lex.getBool();
} else { } else {
lex.printError("Unknown tag"); lex.printError("Unknown tag");
error = true; error = true;