commit 9f04eeae032d57fd8275e29794645be434e16086
Author: Juergen Spitzmueller <[email protected]>
Date:   Sun Jun 2 16:33:06 2019 +0200

    Support FreeSpacing in InsetArgument
---
 lib/doc/Customization.lyx    |   66 +++++++++++++++++++++++++++++++++++++++++-
 lib/doc/de/Customization.lyx |   52 +++++++++++++++++++++++++++++++--
 lib/scripts/layout2layout.py |    7 +++-
 src/Layout.cpp               |    4 ++
 src/Layout.h                 |    1 +
 src/TextClass.cpp            |    2 +-
 src/insets/InsetArgument.cpp |    4 ++-
 src/insets/InsetArgument.h   |    4 ++
 src/insets/InsetLayout.cpp   |    4 ++
 9 files changed, 136 insertions(+), 8 deletions(-)

diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx
index 53e7687..6a5e369 100644
--- a/lib/doc/Customization.lyx
+++ b/lib/doc/Customization.lyx
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 573
+\lyxformat 575
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -102,6 +102,8 @@ logicalmkup
 \justification true
 \use_refstyle 0
 \use_minted 0
+\use_lineno 0
+\lineno_options 
 \notefontcolor #0000ff
 \branch OutDated
 \selected 0
@@ -12296,6 +12298,64 @@ reference "subsec:Font-description"
 \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
 
 \begin_layout Itemize
@@ -12376,8 +12436,12 @@ status collapsed
 \end_inset
 
 , this argument is automatically inserted when the respective style is 
selected.
+
+\change_deleted -712698321 1559484200
  Currently, only one argument per style\SpecialChar breakableslash
 layout can be automatically inserted.
+\change_unchanged
+
 \end_layout
 
 \begin_layout Itemize
diff --git a/lib/doc/de/Customization.lyx b/lib/doc/de/Customization.lyx
index cec6b8f..97e876f 100644
--- a/lib/doc/de/Customization.lyx
+++ b/lib/doc/de/Customization.lyx
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 573
+\lyxformat 575
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -110,6 +110,8 @@ logicalmkup
 \justification true
 \use_refstyle 0
 \use_minted 0
+\use_lineno 0
+\lineno_options 
 \notefontcolor #0000ff
 \branch OutDated
 \selected 0
@@ -10460,6 +10462,52 @@ reference "subsec:Beschreibung-des-Zeichensatzes"
 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
 LabelFont
 \end_layout
 
@@ -10534,8 +10582,6 @@ status collapsed
 
  gesetzt wird, wird dieses Argument automatisch eingefügt, sobald der 
betreffend
 e Absatzstil ausgewählt wird.
- Momentan ist es nur möglich, ein Argument pro Stil\SpecialChar breakableslash
-Format automatisch einzufügen.
 \end_layout
 
 \begin_layout Itemize
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 8fdc9fd..80a21d7 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -11,7 +11,7 @@
 # This script will update a .layout file to current format
 
 # The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 74
+currentFormat = 75
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -248,6 +248,9 @@ currentFormat = 74
 # Incremented to format 74, 18 April 2019 by spitz
 # 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
 # Manual (section "Declaring a new text class").
 
@@ -497,7 +500,7 @@ def convert(lines, end_format):
                 i += 1
             continue
 
-        if format >= 65 and format <= 73:
+        if format >= 65 and format <= 74:
             # nothing to do.
             i += 1
             continue
diff --git a/src/Layout.cpp b/src/Layout.cpp
index be31ccb..fa6b58c 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -1022,6 +1022,7 @@ void Layout::readArgument(Lexer & lex)
        arg.labelfont = inherit_font;
        arg.is_toc_caption = false;
        arg.passthru = PT_INHERITED;
+       arg.free_spacing = false;
        string id;
        lex >> id;
        bool const itemarg = prefixIs(id, "item:");
@@ -1098,6 +1099,9 @@ void Layout::readArgument(Lexer & lex)
                } else if (tok == "istoccaption") {
                        lex.next();
                        arg.is_toc_caption = lex.getBool();
+               } else if (tok == "freespacing") {
+                       lex.next();
+                       arg.free_spacing = lex.getBool();
                } else {
                        lex.printError("Unknown tag");
                        error = true;
diff --git a/src/Layout.h b/src/Layout.h
index fcfdc11..5a2567c 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -109,6 +109,7 @@ public:
                ArgPassThru passthru;
                docstring pass_thru_chars;
                bool is_toc_caption;
+               bool free_spacing;
                std::string newlinecmd;
        };
        ///
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 0dd4434..43abe67 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -62,7 +62,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 = 74; // spitz: NewlineCmd
+int const LAYOUT_FORMAT = 75; // spitz: FreeSpacing (Argument)
 
 
 // Layout format for the current lyx file format. Controls which format is
diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp
index 37c244d..5dd8644 100644
--- a/src/insets/InsetArgument.cpp
+++ b/src/insets/InsetArgument.cpp
@@ -43,7 +43,8 @@ InsetArgument::InsetArgument(Buffer * buf, string const & 
name)
     : InsetCollapsible(buf), name_(name), labelstring_(docstring()),
       font_(inherit_font), labelfont_(inherit_font), decoration_(string()),
       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;
                pass_thru_chars_ = (*lait).second.pass_thru_chars;
                newline_cmd_ = (*lait).second.newlinecmd;
+               free_spacing_ = (*lait).second.free_spacing;
                pass_thru_local_ = false;
                if (lait->second.is_toc_caption) {
                        is_toc_caption_ = true;
diff --git a/src/insets/InsetArgument.h b/src/insets/InsetArgument.h
index 88af23d..5c63702 100644
--- a/src/insets/InsetArgument.h
+++ b/src/insets/InsetArgument.h
@@ -69,6 +69,8 @@ public:
        ///
        bool isPassThru() const { return pass_thru_; }
        ///
+       bool isFreeSpacing() const { return free_spacing_; }
+       ///
        bool isTocCaption() const { return is_toc_caption_; }
        ///
        bool resetFontEdit() const { return false; }
@@ -114,6 +116,8 @@ private:
        /// Effective pass-thru setting (inherited or local)
        bool pass_thru_;
        ///
+       bool free_spacing_;
+       ///
        docstring pass_thru_chars_;
        /// Does this argument provide content for the TOC?
        bool is_toc_caption_;
diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
index 4d6a5ed..f486e3d 100644
--- a/src/insets/InsetLayout.cpp
+++ b/src/insets/InsetLayout.cpp
@@ -610,6 +610,7 @@ void InsetLayout::readArgument(Lexer & lex)
        arg.font = inherit_font;
        arg.labelfont = inherit_font;
        arg.is_toc_caption = false;
+       arg.free_spacing = false;
        arg.passthru = PT_INHERITED;
        arg.nodelims = false;
        string nr;
@@ -685,6 +686,9 @@ void InsetLayout::readArgument(Lexer & lex)
                } else if (tok == "istoccaption") {
                        lex.next();
                        arg.is_toc_caption = lex.getBool();
+               } else if (tok == "freespacing") {
+                       lex.next();
+                       arg.free_spacing = lex.getBool();
                } else {
                        lex.printError("Unknown tag");
                        error = true;

Reply via email to