]> git.lyx.org Git - lyx.git/commitdiff
Add InsertOnNewline argument tag
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 2 Jun 2019 16:07:10 +0000 (18:07 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 2 Jun 2019 16:07:10 +0000 (18:07 +0200)
This adds a paragraph break before auto-inserting arguments in flex
insets.

Useful for specific arguments (particularly ling glosses)

lib/doc/Customization.lyx
lib/doc/de/Customization.lyx
lib/scripts/layout2layout.py
src/Layout.cpp
src/Layout.h
src/Text3.cpp
src/insets/InsetLayout.cpp

index 6a5e3696c5c91a0ef33bb05409d8ad06413a44ce..fcd8c165c3c7a36218007f00028659ff33f89b89 100644 (file)
@@ -12444,6 +12444,59 @@ layout can be automatically inserted.
 
 \end_layout
 
+\begin_layout Itemize
+
+\change_inserted -712698321 1559491402
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1559490711
+InsertOnNewline
+\end_layout
+
+\end_inset
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1559490703
+[int=0]
+\end_layout
+
+\end_inset
+
+ If this is set to 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1559490703
+1
+\end_layout
+
+\end_inset
+
+, this argument will be inserted on a new line with 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1559491402
+AutoInsert
+\end_layout
+
+\end_inset
+
+ (only available within Flex insets).
+\end_layout
+
 \begin_layout Itemize
 \begin_inset Flex Code
 status collapsed
index 97e876f83de0063db953cf427724762d4594916a..011b4836772434c0056a2bccb9bf845a8f4a5894 100644 (file)
@@ -10588,6 +10588,49 @@ e Absatzstil ausgewählt wird.
 \begin_inset Flex Code
 status collapsed
 
+\begin_layout Plain Layout
+InsertOnNewline
+\end_layout
+
+\end_inset
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+[int=0]
+\end_layout
+
+\end_inset
+
+ Wenn dies auf 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+1
+\end_layout
+
+\end_inset
+
+ gesetzt ist, wird dieses Argument mit 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+AutoInsert
+\end_layout
+
+\end_inset
+
+ auf eine neue Zeile gesetzt (nur mit Flex-Einfügungen verfügbar).
+\end_layout
+
+\begin_layout Itemize
+\begin_inset Flex Code
+status collapsed
+
 \begin_layout Plain Layout
 InsertCotext
 \end_layout
index 80a21d78131123fdf88c481ae47886e755d56420..ad588bf7970c57dde717cb96438b7cdf3177d26e 100644 (file)
@@ -249,7 +249,7 @@ currentFormat = 75
 # New InsetLayout and Argument tag NewlineCmd
 
 # Incremented to format 75, 2 June 2019 by spitz
-# New Argument tag FreeSpacing
+# New Argument tags FreeSpacing, InsertOnNewline
 
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
index 7d3a1f89ff5accb4c28a32d6a25ff9a6405819c5..3c1a9bd955515d321e847e1a7c408a50e59de9f8 100644 (file)
@@ -1016,6 +1016,7 @@ void Layout::readArgument(Lexer & lex)
        arg.nodelims = false;
        arg.autoinsert = false;
        arg.insertcotext = false;
+       arg.insertonnewline = false;
        bool error = false;
        bool finished = false;
        arg.font = inherit_font;
index 5a2567c13dd8ac02206b5a192c87246f76bdc8f9..53fb682a6ef279c5b5ed87f23796f591a8105b1c 100644 (file)
@@ -106,6 +106,7 @@ public:
                FontInfo labelfont;
                bool autoinsert;
                bool insertcotext;
+               bool insertonnewline;
                ArgPassThru passthru;
                docstring pass_thru_chars;
                bool is_toc_caption;
index 30cc08d08568a973952a853672ce0a07f4e664e2..f234c7cb7d027c95fd979b3cd281c0709092493a 100644 (file)
@@ -2078,6 +2078,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                Layout::LaTeXArgMap::const_iterator const laend = args.end();
                for (; lait != laend; ++lait) {
                        Layout::latexarg arg = (*lait).second;
+                       if (!inautoarg && arg.insertonnewline && cur.pos() > 0) {
+                               FuncRequest cmd2(LFUN_PARAGRAPH_BREAK);
+                               lyx::dispatch(cmd2);
+                       }
                        if (arg.autoinsert) {
                                // The cursor might have been invalidated by the replaceSelection.
                                cur.buffer()->changed(true);
@@ -2087,6 +2091,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                        cur.leaveInset(cur.inset());
                                        cur.posForward();
                                        inautoarg = false;
+                                       if (arg.insertonnewline && cur.pos() > 0) {
+                                               FuncRequest cmd2(LFUN_PARAGRAPH_BREAK);
+                                               lyx::dispatch(cmd2);
+                                       }
                                }
                                FuncRequest cmd2(LFUN_ARGUMENT_INSERT, (*lait).first);
                                lyx::dispatch(cmd2);
index f486e3d3d87ed9c613f37529257fcefabbd115cf..d81acf32670aaf18401ea782aed3186ac5460bcb 100644 (file)
@@ -605,6 +605,7 @@ void InsetLayout::readArgument(Lexer & lex)
        arg.mandatory = false;
        arg.autoinsert = false;
        arg.insertcotext = false;
+       arg.insertonnewline = false;
        bool error = false;
        bool finished = false;
        arg.font = inherit_font;
@@ -639,6 +640,9 @@ void InsetLayout::readArgument(Lexer & lex)
                } else if (tok == "insertcotext") {
                        lex.next();
                        arg.insertcotext = lex.getBool();
+               } else if (tok == "insertonnewline") {
+                       lex.next();
+                       arg.insertonnewline = lex.getBool();
                } else if (tok == "leftdelim") {
                        lex.next();
                        arg.ldelim = lex.getDocString();