From 06cac41193e82e5e10d36958abc21129ba89cdbb Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Sat, 9 Feb 2013 14:31:26 -0500 Subject: [PATCH] Add "NoInsetLayout" tag for Uwe. Fixes bug #8545. --- lib/doc/Customization.lyx | 47 +++++++++++++++++++++++++++++++++++- lib/scripts/layout2layout.py | 8 ++++++ src/TextClass.cpp | 18 ++++++++++++++ src/TextClass.h | 2 ++ 4 files changed, 74 insertions(+), 1 deletion(-) diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx index 0de6d4ac01..632964499b 100644 --- a/lib/doc/Customization.lyx +++ b/lib/doc/Customization.lyx @@ -1,5 +1,5 @@ #LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 460 +\lyxformat 461 \begin_document \begin_header \textclass scrbook @@ -18532,6 +18532,51 @@ protect not \emph default whether the command should itself be protected.) Default is false. +\change_inserted 1414654397 1360681873 + +\end_layout + +\begin_layout Description + +\change_inserted 1414654397 1360681892 +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted 1414654397 1360681880 +NoInsetLayout +\end_layout + +\end_inset + + [ +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted 1414654397 1360681883 + +\end_layout + +\end_inset + +] Deletes an existing +\begin_inset Flex Code +status open + +\begin_layout Plain Layout + +\change_inserted 1414654397 1360681892 +InsetLayout +\change_unchanged + +\end_layout + +\end_inset + +. \end_layout \begin_layout Description diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index b6345f1234..bded39d315 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -151,6 +151,9 @@ import os, re, string, sys # Remove COUNTER label style; rename as STATIC # Rename TOP_ENVIRONMENT to ABOVE and CENTERED_TOP_ENVIRONMENT to CENTERED +# Incremented to format 45, 12 February 2013 by rgh +# New Tag "NoInsetLayout" + # Do not forget to document format change in Customization # Manual (section "Declaring a new text class"). @@ -375,6 +378,11 @@ def convert(lines): i += 1 continue + if format == 44: + # nothing to do. + i += 1 + continue + if format == 43: match = re_LabelTypeIsCounter.match(lines[i]) if match: diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 3609deec2c..a34cf9020f 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -182,6 +182,7 @@ enum TextClassTags { TC_IFSTYLE, TC_DEFAULTSTYLE, TC_INSETLAYOUT, + TC_NOINSETLAYOUT, TC_NOSTYLE, TC_COLUMNS, TC_SIDES, @@ -250,6 +251,7 @@ LexerKeyword textClassTags[] = { { "leftmargin", TC_LEFTMARGIN }, { "nocounter", TC_NOCOUNTER }, { "nofloat", TC_NOFLOAT }, + { "noinsetlayout", TC_NOINSETLAYOUT }, { "nostyle", TC_NOSTYLE }, { "outputformat", TC_OUTPUTFORMAT }, { "outputtype", TC_OUTPUTTYPE }, @@ -525,6 +527,16 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) } break; + case TC_NOINSETLAYOUT: + if (lexrc.next()) { + docstring const style = from_utf8(subst(lexrc.getString(), + '_', ' ')); + if (!deleteInsetLayout(style)) + LYXERR0("Style `" << style << "' cannot be removed\n" + "because it was not found!"); + } + break; + case TC_COLUMNS: if (lexrc.next()) columns_ = lexrc.getInteger(); @@ -1315,6 +1327,12 @@ bool TextClass::deleteLayout(docstring const & name) } +bool TextClass::deleteInsetLayout(docstring const & name) +{ + return insetlayoutlist_.erase(name); +} + + // Load textclass info if not loaded yet bool TextClass::load(string const & path) const { diff --git a/src/TextClass.h b/src/TextClass.h index b3daa4c5b5..bc900fa7a5 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -333,6 +333,8 @@ private: /// bool deleteLayout(docstring const &); /// + bool deleteInsetLayout(docstring const &); + /// bool convertLayoutFormat(support::FileName const &, ReadType); /// Reads the layout file without running layout2layout. ReturnValues readWithoutConv(support::FileName const & filename, ReadType rt);