]> git.lyx.org Git - lyx.git/commitdiff
Make layout membership to ParagraphGroup settable (see #6854)
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 1 Jun 2015 14:11:05 +0000 (16:11 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 1 Jun 2015 14:11:05 +0000 (16:11 +0200)
lib/scripts/layout2layout.py
src/Layout.cpp
src/Layout.h
src/TextClass.cpp

index 017bf6f2ee2118e1d84db7433127ac6c40125cc7..617b0ccf44cdf0cc674ba1f238fe115996c4155d 100644 (file)
@@ -186,6 +186,9 @@ import os, re, string, sys
 # Incremented to format 56, 20 May 2015 by spitz
 # New Float tags "AllowedPlacement", "AllowsWide", "AllowsSideways"
 
+# Incremented to format 57, 30 May 2015 by spitz
+# New Layout tag "ParagraphGroup"
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -193,7 +196,7 @@ import os, re, string, sys
 # development/tools/updatelayouts.py script to update all
 # layout files to the new format.
 
-currentFormat = 56
+currentFormat = 57
 
 
 def usage(prog_name):
@@ -417,7 +420,7 @@ def convert(lines):
                 i += 1
             continue
 
-        if format >= 50 and format <= 55:
+        if format >= 50 and format <= 56:
             # nothing to do.
             i += 1
             continue
index 748d867a36a8824cfd5b3a89ab9ffa91e2e592b9..17be45c2270fc77efd999c7da41acd8f260b3ffa 100644 (file)
@@ -75,6 +75,7 @@ enum LayoutTags {
        LT_NEED_PROTECT,
        LT_NEWLINE,
        LT_NEXTNOINDENT,
+       LT_PAR_GROUP,
        LT_PARINDENT,
        LT_PARSEP,
        LT_PARSKIP,
@@ -151,6 +152,7 @@ Layout::Layout()
        forcelocal = 0;
        itemcommand_ = "item";
        toggle_indent = ITOGGLE_DOCUMENT_DEFAULT;
+       par_group_ = false;
 }
 
 
@@ -231,6 +233,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
                { "newline",        LT_NEWLINE },
                { "nextnoindent",   LT_NEXTNOINDENT },
                { "obsoletedby",    LT_OBSOLETEDBY },
+               { "paragraphgroup", LT_PAR_GROUP },
                { "parbreakisnewline", LT_PARBREAK_IS_NEWLINE },
                { "parindent",      LT_PARINDENT },
                { "parsep",         LT_PARSEP },
@@ -542,6 +545,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
                        counter = trim(counter);
                        break;
 
+               case LT_PAR_GROUP:
+                       lex >> par_group_;
+                       break;
+
                case LT_FREE_SPACING:
                        lex >> free_spacing;
                        break;
@@ -875,12 +882,15 @@ void Layout::readLatexType(Lexer & lex)
                return;
        case LATEX_PARAGRAPH:
        case LATEX_COMMAND:
-       case LATEX_ENVIRONMENT:
        case LATEX_ITEM_ENVIRONMENT:
-       case LATEX_BIB_ENVIRONMENT:
        case LATEX_LIST_ENVIRONMENT:
                latextype = static_cast<LatexType>(le);
                break;
+       case LATEX_ENVIRONMENT:
+       case LATEX_BIB_ENVIRONMENT:
+               latextype = static_cast<LatexType>(le);
+               par_group_ = true;
+               break;
        default:
                LYXERR0("Unhandled value " << le);
                break;
@@ -1210,6 +1220,7 @@ void Layout::write(ostream & os) const
                os << "\tEndLabelType Static\n";
                break;
        }
+       os << "\tParagraphGroup \"" << par_group_ << "\"\n";
        if (!leftmargin.empty())
                os << "\tLeftMargin \"" << to_utf8(leftmargin) << "\"\n";
        if (!rightmargin.empty())
index b18271a0a5c56afd40a7c38863d15592f64636ae..091e319cb1d02830ae3bd62ce5cfdfbb38f6d530 100644 (file)
@@ -190,10 +190,7 @@ public:
        }
        /// Is this the kind of layout in which adjacent paragraphs
        /// are handled as one group?
-       bool isParagraphGroup() const {
-       return latextype == LATEX_ENVIRONMENT
-               || latextype == LATEX_BIB_ENVIRONMENT;
-       }
+       bool isParagraphGroup() const { return par_group_; }
        ///
        bool labelIsInline() const {
                return labeltype == LABEL_STATIC
@@ -452,6 +449,8 @@ private:
        docstring langpreamble_;
        /// Language and babel dependent macro definitions needed for this layout
        docstring babelpreamble_;
+       /// Are adjacent paragraphs handled as one group?
+       bool par_group_;
        /// Packages needed for this layout
        std::set<std::string> requires_;
        ///
index 3c9806c6588083696cd4baf4981da7625e032ed6..6027a2358302f40cfafeb830b492f814326b3bf4 100644 (file)
@@ -61,7 +61,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 = 56; //spitz: New Float tags AllowedPlacement, AllowsWide, AllowsSideways
+int const LAYOUT_FORMAT = 57; //spitz: New Layout tag ParagraphGroup
 
 namespace {