Add "NoInsetLayout" tag for Uwe. Fixes bug #8545.

This commit is contained in:
Richard Heck 2013-02-09 14:31:26 -05:00
parent 36c5c7b9c5
commit 06cac41193
4 changed files with 74 additions and 1 deletions

View File

@ -1,5 +1,5 @@
#LyX 2.1 created this file. For more info see http://www.lyx.org/ #LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 460 \lyxformat 461
\begin_document \begin_document
\begin_header \begin_header
\textclass scrbook \textclass scrbook
@ -18532,6 +18532,51 @@ protect
not not
\emph default \emph default
whether the command should itself be protected.) Default is false. 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
<layout>
\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 \end_layout
\begin_layout Description \begin_layout Description

View File

@ -151,6 +151,9 @@ import os, re, string, sys
# Remove COUNTER label style; rename as STATIC # Remove COUNTER label style; rename as STATIC
# Rename TOP_ENVIRONMENT to ABOVE and CENTERED_TOP_ENVIRONMENT to CENTERED # 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 # Do not forget to document format change in Customization
# Manual (section "Declaring a new text class"). # Manual (section "Declaring a new text class").
@ -375,6 +378,11 @@ def convert(lines):
i += 1 i += 1
continue continue
if format == 44:
# nothing to do.
i += 1
continue
if format == 43: if format == 43:
match = re_LabelTypeIsCounter.match(lines[i]) match = re_LabelTypeIsCounter.match(lines[i])
if match: if match:

View File

@ -182,6 +182,7 @@ enum TextClassTags {
TC_IFSTYLE, TC_IFSTYLE,
TC_DEFAULTSTYLE, TC_DEFAULTSTYLE,
TC_INSETLAYOUT, TC_INSETLAYOUT,
TC_NOINSETLAYOUT,
TC_NOSTYLE, TC_NOSTYLE,
TC_COLUMNS, TC_COLUMNS,
TC_SIDES, TC_SIDES,
@ -250,6 +251,7 @@ LexerKeyword textClassTags[] = {
{ "leftmargin", TC_LEFTMARGIN }, { "leftmargin", TC_LEFTMARGIN },
{ "nocounter", TC_NOCOUNTER }, { "nocounter", TC_NOCOUNTER },
{ "nofloat", TC_NOFLOAT }, { "nofloat", TC_NOFLOAT },
{ "noinsetlayout", TC_NOINSETLAYOUT },
{ "nostyle", TC_NOSTYLE }, { "nostyle", TC_NOSTYLE },
{ "outputformat", TC_OUTPUTFORMAT }, { "outputformat", TC_OUTPUTFORMAT },
{ "outputtype", TC_OUTPUTTYPE }, { "outputtype", TC_OUTPUTTYPE },
@ -525,6 +527,16 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
} }
break; 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: case TC_COLUMNS:
if (lexrc.next()) if (lexrc.next())
columns_ = lexrc.getInteger(); 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 // Load textclass info if not loaded yet
bool TextClass::load(string const & path) const bool TextClass::load(string const & path) const
{ {

View File

@ -333,6 +333,8 @@ private:
/// ///
bool deleteLayout(docstring const &); bool deleteLayout(docstring const &);
/// ///
bool deleteInsetLayout(docstring const &);
///
bool convertLayoutFormat(support::FileName const &, ReadType); bool convertLayoutFormat(support::FileName const &, ReadType);
/// Reads the layout file without running layout2layout. /// Reads the layout file without running layout2layout.
ReturnValues readWithoutConv(support::FileName const & filename, ReadType rt); ReturnValues readWithoutConv(support::FileName const & filename, ReadType rt);