Make layout membership to ParagraphGroup settable (see #6854)

This commit is contained in:
Juergen Spitzmueller 2015-06-01 16:11:05 +02:00
parent 83a9ed4e62
commit eb748d6330
4 changed files with 22 additions and 9 deletions

View 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

View 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())

View 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_;
///

View 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 {