commit eb748d6330f6bbf727c28804c4a88dbc16d82830 Author: Juergen Spitzmueller <sp...@lyx.org> Date: Mon Jun 1 16:11:05 2015 +0200
Make layout membership to ParagraphGroup settable (see #6854) diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index 017bf6f..617b0cc 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -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 diff --git a/src/Layout.cpp b/src/Layout.cpp index 748d867..17be45c 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -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()) diff --git a/src/Layout.h b/src/Layout.h index b18271a..091e319 100644 --- a/src/Layout.h +++ b/src/Layout.h @@ -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_; /// diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 3c9806c..6027a23 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -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 {