[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-devel
Subject:    Re: force local flag for layouts?
From:       Georg Baum <Georg.Baum () post ! rwth-aachen ! de>
Date:       2013-03-31 19:29:41
Message-ID: kja2r1$nh3$1 () ger ! gmane ! org
[Download RAW message or body]

Richard Heck wrote:

> On 03/15/2013 04:44 PM, Georg Baum wrote:
>> Some time ago we had a discussion about what changes to layout files are
>> allowed in a stable release. There were several proposals, from simple
>> but limited to powerful but complicated. Meanwhile I had another idea
>> which is IMHO quite simple but still powerful: Introduce a new "force
>> local" flag for layouts. If this flag is set, the layout is always stored
>> as a special local layout in the .lyx file. This flag would be set for
>> any style which is added to LyX 2.1.x (with x > 0). Then any such
>> document could always be used by LyX 2.1.x-1 as well, even including
>> export. The same style in 2.2 (or whathever it will be called) would not
>> use this flag. Therefore, the stored local layouts would be automatically
>> deleted once the document is saved by 2.2.
>>
>> Attached is an untested sketch of the idea. The only missing part is
>> Layout::write(). Implementing this will be some work (which could be
>> reused for a layout editor btw), and therefore I'll only do it if this
>> will go in. What do you think?
> 
> Saw the commit of the write() routine. Looks good.
> 
> I'm not sure I fully understand the implementation details here, but the
> idea seems like a good one. It might be worth having a button somewhere,
> too, that allows anyone at any time to write the layout then in effect
> to the LyX file. This would allow people to share their own layouts with
> collaborators without having to send a layout file separately.

That sounds interesting, although I believe that layouts created by such a 
button should go to the existing local layout section. I implemented a 
second section which is completely managed automatically with the help of 
the new ForceLocal flag.

Attached is an updated patch, including a dummy test style to try it out. I 
also took the versioning comment of Jean-Marc into account. How it works is 
explained in the documentation changes, the short version is this: If you 
want to backport a style, add a line

ForceLocal -1

to the development version of a style, and

ForceLocal 1

to the backported version. This is all, no lyx2lyx required apart from 
bumping the version number in the new version. From my point of view this is 
now ready, and unless I get complaints I'll commit it.


Georg
["x.diff" (text/x-patch)]

diff --git a/development/FORMAT b/development/FORMAT
index a9d62bd..43d71aa 100644
--- a/development/FORMAT
+++ b/development/FORMAT
@@ -11,6 +11,11 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
 
 -----------------------
 
+2013-03-31 Georg Baum  <Georg.Baum@post.rwth-aachen.de>
+	* Format incremented to 470
+	  forced local layouts for future layout backward compatibility:
+	  \begin_forced_local_layout, \end_forced_local_layout
+
 2013-03-23 Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 	* Format incremented to 469
 	  support for \caption* in longtables (fix bug 3209)
diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx
index aa72508..6059c60 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 469
+\lyxformat 470
 \begin_document
 \begin_header
 \textclass scrbook
@@ -11901,6 +11901,77 @@ LabelFont
 \end_inset
 
 .
+\change_inserted -195340706 1364753581
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -195340706 1364753581
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -195340706 1364753581
+ForceLocal n
+\end_layout
+
+\end_inset
+
+ Used for backporting new styles to stable LyX versions.
+ The first stable version that supports this tag is LyX 2.1.0.
+ 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -195340706 1364753581
+n
+\end_layout
+
+\end_inset
+
+ is a number which may either be 0 (this is the default if the tag is not
+ given), -1 or any value greater than zero.
+ If the 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -195340706 1364753581
+ForceLocal
+\end_layout
+
+\end_inset
+
+ flag of a style is greater than zero, it will always be written to the
+ document header.
+ If a .lyx file is read, the style definitions from the document header are
+ added to the document class.
+ Therefore even older versions can handle the style.
+ The argument of 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -195340706 1364753581
+ForceLocal
+\end_layout
+
+\end_inset
+
+ is a version number: If such a style is read, and the version number is
+ less than the version number of the already existing style in the document
+ class, the new style is ignored.
+ If the version number is higher, the new style replaces the existing style.
+ A value of -1 means an infinite version number, i.e.
+ it is always used.
+\change_unchanged
+
 \end_layout
 
 \begin_layout Description
diff --git a/lib/doc/Development.lyx b/lib/doc/Development.lyx
index f16e8bb..5ad3fc7 100644
--- a/lib/doc/Development.lyx
+++ b/lib/doc/Development.lyx
@@ -1,5 +1,5 @@
 #LyX 2.1 created this file. For more info see http://www.lyx.org/
-\lyxformat 462
+\lyxformat 470
 \begin_document
 \begin_header
 \textclass scrbook
@@ -68,6 +68,7 @@ End
 \use_geometry false
 \use_package amsmath 1
 \use_package amssymb 1
+\use_package cancel 0
 \use_package esint 0
 \use_package mathdots 1
 \use_package mathtools 0
@@ -435,6 +436,95 @@ src/tex2lyx/TODO.txt
  recommendation were related to mixed version syntax, not ERT.
 \end_layout
 
+\begin_layout Section
+Backporting new styles to the stable version
+\end_layout
+
+\begin_layout Standard
+Starting with the stable LyX 2.1 branch, there is a mechanism in place to
+ backport new styles to the stable version without the need to update the
+ file format.
+ The basic idea is that the new style definition is automatically copied
+ to the document preamble, so that it can even be used by older minor revisions
+ that did not yet include the style.
+ To backport a new style to the stable version, the following steps are
+ needed:
+\end_layout
+
+\begin_layout Enumerate
+Add the line 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+ForceLocal -1
+\end_layout
+
+\end_inset
+
+ to the style definition in the development version.
+\end_layout
+
+\begin_layout Enumerate
+Copy the style definition to the stable version, but use 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+ForceLocal 1
+\end_layout
+
+\end_inset
+
+ instead.
+ If needed adjust the format to the one used by the stable version (see
+ the customization manual for details of the layout file format).
+\end_layout
+
+\begin_layout Enumerate
+For each update of the style in a later stable version, increase the argument
+ of 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+ForceLocal
+\end_layout
+
+\end_inset
+
+ by one (in the stable version, the development version should not be touched).
+\end_layout
+
+\begin_layout Standard
+For details about the 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+ForceLocal
+\end_layout
+
+\end_inset
+
+ flag see the customization manual.
+ No 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+lyx2lyx
+\end_layout
+
+\end_inset
+
+ support is needed for backported styles: Since the style of the development
+ version has an infinite version number, it will always be used.
+ Furthermore, since its version number is less than one, the style will
+ not be written anymore to the document header for files saved by the new
+ version.
+\end_layout
+
 \begin_layout Chapter
 Tests
 \end_layout
diff --git a/lib/layouts/article.layout b/lib/layouts/article.layout
index 06da371..06d77af 100644
--- a/lib/layouts/article.layout
+++ b/lib/layouts/article.layout
@@ -38,3 +38,8 @@ Style Part*
 	  Size                Larger
 	EndFont
 End
+
+Style DummyTest
+	CopyStyle Standard
+	ForceLocal 1
+End
diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py
index 8b51b2e..4143dda 100644
--- a/lib/lyx2lyx/lyx_2_1.py
+++ b/lib/lyx2lyx/lyx_2_1.py
@@ -4093,6 +4093,40 @@ def revert_starred_caption(document):
       i = i + 1
 
 
+def revert_forced_local_layout(document):
+    i = 0
+    while True:
+        i = find_token(document.header, "\\begin_forced_local_layout", i)
+        if i == -1:
+            return
+        j = find_end_of(document.header, i, "\\begin_forced_local_layout", "\\end_forced_local_layout")
+        if j == -1:
+            # this should not happen
+            break
+        regexp = re.compile(r'\s*forcelocal', re.IGNORECASE)
+        k = find_re(document.header, regexp, i, j)
+        while k != -1:
+            del document.header[k]
+            j = j - 1
+            k = find_re(document.header, regexp, i, j)
+        k = find_token(document.header, "\\begin_local_layout", 0)
+        if k == -1:
+            document.header[i] = "\\begin_local_layout"
+            document.header[j] = "\\end_local_layout"
+        else:
+            l = find_end_of(document.header, k, "\\begin_local_layout", "\\end_local_layout")
+            if j == -1:
+                # this should not happen
+                break
+            lines = document.header[i+1 : j]
+            if k > i:
+                document.header[k+1 : k+1] = lines
+                document.header[i   : j  ] = []
+            else:
+                document.header[i   : j  ] = []
+                document.header[k+1 : k+1] = lines
+
+
 ##
 # Conversion hub
 #
@@ -4154,10 +4188,12 @@ convert = [
            [466, []],
            [467, []],
            [468, []],
-           [469, []]
+           [469, []],
+           [470, []] 
           ]
 
 revert =  [
+           [469, [revert_forced_local_layout]],
            [468, [revert_starred_caption]],
            [467, [revert_mbox_fbox]],
            [466, [revert_iwona_fonts]],
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 01737e0..89dbfa9 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -154,6 +154,9 @@ import os, re, string, sys
 # Incremented to format 45, 12 February 2013 by rgh
 # New Tag "NoInsetLayout"
 
+# Incremented to format 46, 31 March 2013 by gb
+# New Tag "ForceLocal"
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -161,7 +164,7 @@ import os, re, string, sys
 # development/tools/updatelayouts.sh script to update all
 # layout files to the new format.
 
-currentFormat = 45
+currentFormat = 46
 
 
 def usage(prog_name):
@@ -355,7 +358,7 @@ def convert(lines):
                     # nothing to do
                     return format
                 else:
-                    error('Cannot convert file format %s' % format)
+                    error('Cannot convert file format %s to %s' % (format, currentFormat))
             else:
                 lines.insert(i, "Format 2")
                 only_comment = 0
@@ -378,7 +381,7 @@ def convert(lines):
                 i += 1
             continue
 
-        if format == 44:
+        if format == 44 or format == 45:
             # nothing to do.
             i += 1
             continue
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 9103abd..d41877c 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -831,7 +831,8 @@ int Buffer::readHeader(Lexer & lex)
 	params().html_latex_end.clear();
 	params().html_math_img_scale = 1.0;
 	params().output_sync_macro.erase();
-	params().local_layout.clear();
+	params().setLocalLayout(string(), false);
+	params().setLocalLayout(string(), true);
 
 	for (int i = 0; i < 4; ++i) {
 		params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 57ab957..8ca6e80 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -627,7 +627,9 @@ string BufferParams::readToken(Lexer & lex, string const & token,
 	} else if (token == "\\begin_preamble") {
 		readPreamble(lex);
 	} else if (token == "\\begin_local_layout") {
-		readLocalLayout(lex);
+		readLocalLayout(lex, false);
+	} else if (token == "\\begin_forced_local_layout") {
+		readLocalLayout(lex, true);
 	} else if (token == "\\begin_modules") {
 		readModules(lex);
 	} else if (token == "\\begin_removed_modules") {
@@ -990,6 +992,7 @@ void BufferParams::writeFile(ostream & os) const
 	   << convert<string>(maintain_unincluded_children) << '\n';
 
 	// local layout information
+	string const local_layout = getLocalLayout(false);
 	if (!local_layout.empty()) {
 		// remove '\n' from the end
 		string const tmplocal = rtrim(local_layout, "\n");
@@ -997,6 +1000,14 @@ void BufferParams::writeFile(ostream & os) const
 		   << tmplocal
 		   << "\n\\end_local_layout\n";
 	}
+	string const forced_local_layout = getLocalLayout(true);
+	if (!forced_local_layout.empty()) {
+		// remove '\n' from the end
+		string const tmplocal = rtrim(forced_local_layout, "\n");
+		os << "\\begin_forced_local_layout\n"
+		   << tmplocal
+		   << "\n\\end_forced_local_layout\n";
+	}
 
 	// then the text parameters
 	if (language != ignore_language)
@@ -2099,13 +2110,15 @@ void BufferParams::makeDocumentClass()
 
 	doc_class_ = getDocumentClass(*baseClass(), mods);
 
-	if (!local_layout.empty()) {
-		TextClass::ReturnValues success =
-			doc_class_->read(local_layout, TextClass::MODULE);
-		if (success != TextClass::OK && success != TextClass::OK_OLDFORMAT) {
-			docstring const msg = _("Error reading internal layout information");
-			frontend::Alert::warning(_("Read Error"), msg);
-		}
+	TextClass::ReturnValues success = TextClass::OK;
+	if (!forced_local_layout_.empty())
+		success = doc_class_->read(forced_local_layout_, TextClass::MODULE);
+	if (!local_layout_.empty() &&
+	    (success == TextClass::OK || success == TextClass::OK_OLDFORMAT))
+		success = doc_class_->read(local_layout_, TextClass::MODULE);
+	if (success != TextClass::OK && success != TextClass::OK_OLDFORMAT) {
+		docstring const msg = _("Error reading internal layout information");
+		frontend::Alert::warning(_("Read Error"), msg);
 	}
 }
 
@@ -2122,6 +2135,24 @@ bool BufferParams::citationModuleCanBeAdded(string const & modName) const
 }
 
 
+std::string BufferParams::getLocalLayout(bool forced) const
+{
+	if (forced)
+		return doc_class_->forcedLayouts();
+	else
+		return local_layout_;
+}
+
+
+void BufferParams::setLocalLayout(string const & layout, bool forced)
+{
+	if (forced)
+		forced_local_layout_ = layout;
+	else
+		local_layout_ = layout;
+}
+
+
 bool BufferParams::addLayoutModule(string const & modName)
 {
 	LayoutModuleList::const_iterator it = layout_modules_.begin();
@@ -2336,13 +2367,19 @@ void BufferParams::readPreamble(Lexer & lex)
 }
 
 
-void BufferParams::readLocalLayout(Lexer & lex)
+void BufferParams::readLocalLayout(Lexer & lex, bool forced)
 {
-	if (lex.getString() != "\\begin_local_layout")
+	string const expected = forced ? "\\begin_forced_local_layout" :
+	                                 "\\begin_local_layout";
+	if (lex.getString() != expected)
 		lyxerr << "Error (BufferParams::readLocalLayout):"
 			"consistency check failed." << endl;
 
-	local_layout = lex.getLongString("\\end_local_layout");
+	if (forced)
+		forced_local_layout_ =
+			lex.getLongString("\\end_forced_local_layout");
+	else
+		local_layout_ = lex.getLongString("\\end_local_layout");
 }
 
 
diff --git a/src/BufferParams.h b/src/BufferParams.h
index 2a669d0..9c558a6 100644
--- a/src/BufferParams.h
+++ b/src/BufferParams.h
@@ -162,6 +162,10 @@ public:
 	void clearLayoutModules() { layout_modules_.clear(); }
 	/// Clear the removed module list
 	void clearRemovedModules() { removed_modules_.clear(); }
+	/// Get the local layouts
+	std::string getLocalLayout(bool) const;
+	/// Set the local layouts
+	void setLocalLayout(std::string const &, bool);
 
 	/// returns \c true if the buffer contains a LaTeX document
 	bool isLatex() const;
@@ -305,8 +309,6 @@ public:
 	///
 	std::string preamble;
 	///
-	std::string local_layout;
-	///
 	std::string options;
 	/// use the class options defined in the layout?
 	bool use_default_options;
@@ -483,7 +485,7 @@ private:
 	///
 	void readPreamble(Lexer &);
 	///
-	void readLocalLayout(Lexer &);
+	void readLocalLayout(Lexer &, bool);
 	///
 	void readLanguage(Lexer &);
 	///
@@ -513,6 +515,10 @@ private:
 	/// this is for modules that are required by the document class but that
 	/// the user has chosen not to use
 	std::list<std::string> removed_modules_;
+	/// The local layouts without the forced ones
+	std::string local_layout_;
+	/// Forced local layouts only for reading (use getLocalLayout() instead)
+	std::string forced_local_layout_;
 
 	/// the list of included children (for includeonly)
 	std::list<std::string> included_children_;
diff --git a/src/Layout.cpp b/src/Layout.cpp
index b48b764..3545405 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -104,6 +104,7 @@ enum LayoutTags {
 	LT_REFPREFIX,
 	LT_RESETARGS,
 	LT_RIGHTDELIM,
+	LT_FORCELOCAL,
 	LT_INTITLE // keep this last!
 };
 
@@ -145,12 +146,33 @@ Layout::Layout()
 	htmlforcecss_ = false;
 	htmltitle_ = false;
 	spellcheck = true;
+	forcelocal = 0;
 	itemcommand_ = "item";
 }
 
 
 bool Layout::read(Lexer & lex, TextClass const & tclass)
 {
+	// If this is an empty layout, or if no force local version is set,
+	// we know that we will not discard the stuff to read
+	if (forcelocal == 0)
+		return readIgnoreForcelocal(lex, tclass);
+	Layout tmp(*this);
+	tmp.forcelocal = 0;
+	bool const ret = tmp.readIgnoreForcelocal(lex, tclass);
+	// Keep the stuff if
+	// - the read version is higher
+	// - both versions are infinity (arbitrary decision)
+	// - the file did not contain any local version (needed for not
+	//   skipping user defined local layouts)
+	if (tmp.forcelocal <= 0 || tmp.forcelocal > forcelocal)
+		*this = tmp;
+	return ret;
+}
+
+
+bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
+{
 	// This table is sorted alphabetically [asierra 30March96]
 	LexerKeyword layoutTags[] = {
 		{ "align",          LT_ALIGN },
@@ -166,6 +188,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
 		{ "endlabelstring", LT_ENDLABELSTRING },
 		{ "endlabeltype",   LT_ENDLABELTYPE },
 		{ "font",           LT_FONT },
+		{ "forcelocal",     LT_FORCELOCAL },
 		{ "freespacing",    LT_FREE_SPACING },
 		{ "htmlattr",       LT_HTMLATTR },
 		{ "htmlforcecss",   LT_HTMLFORCECSS },
@@ -582,6 +605,10 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
 		case LT_SPELLCHECK:
 			lex >> spellcheck;
 			break;
+
+		case LT_FORCELOCAL:
+			lex >> forcelocal;
+			break;
 		}
 	}
 	lex.popTable();
@@ -1093,17 +1120,17 @@ void Layout::write(ostream & os) const
 	if (!preamble_.empty())
 		os << "\tPreamble\n\t"
 		   << to_utf8(subst(rtrim(preamble_, "\n"),
-		                          from_ascii("\n"), from_ascii("\n\t")))
+		                    from_ascii("\n"), from_ascii("\n\t")))
 		   << "\n\tEndPreamble\n";
 	if (!langpreamble_.empty())
 		os << "\tLangPreamble\n\t"
 		   << to_utf8(subst(rtrim(langpreamble_, "\n"),
-		                          from_ascii("\n"), from_ascii("\n\t")))
+		                    from_ascii("\n"), from_ascii("\n\t")))
 		   << "\n\tEndLangPreamble\n";
 	if (!babelpreamble_.empty())
 		os << "\tBabelPreamble\n\t"
 		   << to_utf8(subst(rtrim(babelpreamble_, "\n"),
-		                          from_ascii("\n"), from_ascii("\n\t")))
+		                    from_ascii("\n"), from_ascii("\n\t")))
 		   << "\n\tEndBabelPreamble\n";
 	switch (labeltype) {
 	case LABEL_ABOVE:
@@ -1290,6 +1317,7 @@ void Layout::write(ostream & os) const
 		   << "\n\tEndPreamble\n";
 	os << "\tHTMLTitle " << htmltitle_ << "\n"
 	      "\tSpellcheck " << spellcheck << "\n"
+	      "\tForceLocal " << forcelocal << "\n"
 	      "End\n";
 }
 
diff --git a/src/Layout.h b/src/Layout.h
index b7c6e70..913546f 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -310,9 +310,23 @@ public:
 
 	/// Is this spellchecked?
 	bool spellcheck;
+	/**
+	 * Should this layout definition always be written to the document preamble?
+	 * Possible values are:
+	 *   0: Do not enforce local layout
+	 * >=1: Enforce local layout with version forcelocal
+	 *  -1: Enforce local layout with infinite version
+	 * On reading, the forced local layout is only used if its version
+	 * number is greater than the version number of the same layout in the
+	 * document class. Otherwise, it is ignored.
+	 */
+	int forcelocal;
 
 
 private:
+	/// Reads a layout definition from file
+	/// \return true on success.
+	bool readIgnoreForcelocal(Lexer &, TextClass const &);
 	/// generates the default CSS for this layout
 	void makeDefaultCSS() const;
 	///
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index c48b68e..41c5268 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -60,7 +60,7 @@ namespace lyx {
 // development/tools/updatelayouts.sh script, to update the format of
 // all of our layout files.
 //
-int const LAYOUT_FORMAT = 45; // rgh: New Tag "NoInsetLayout"
+int const LAYOUT_FORMAT = 46; // gb: New Tag "ForceLocal"
 
 namespace {
 
@@ -1371,6 +1371,24 @@ bool DocumentClass::addLayoutIfNeeded(docstring const & n) const
 }
 
 
+string DocumentClass::forcedLayouts() const
+{
+	ostringstream os;
+	bool first = true;
+	const_iterator const e = end();
+	for (const_iterator i = begin(); i != e; ++i) {
+		if (i->forcelocal > 0) {
+			if (first) {
+				os << "Format " << LAYOUT_FORMAT << '\n';
+				first = false;
+			}
+			i->write(os);
+		}
+	}
+	return os.str();
+}
+
+
 InsetLayout const & DocumentClass::insetLayout(docstring const & name) const
 {
 	// FIXME The fix for the InsetLayout part of 4812 would be here:
diff --git a/src/TextClass.h b/src/TextClass.h
index bc900fa..9625c3e 100644
--- a/src/TextClass.h
+++ b/src/TextClass.h
@@ -399,6 +399,8 @@ public:
 	/// add a new layout \c name if it does not exist in layoutlist_
 	/// \return whether we had to add one.
 	bool addLayoutIfNeeded(docstring const & name) const;
+	/// Forced layouts in layout file syntax
+	std::string forcedLayouts() const;
 
 	///////////////////////////////////////////////////////////////////
 	// accessors
diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp
index 57aef0f..e74535f 100644
--- a/src/frontends/qt4/GuiDocument.cpp
+++ b/src/frontends/qt4/GuiDocument.cpp
@@ -517,7 +517,7 @@ LocalLayout::LocalLayout() : current_id_(0), validated_(false)
 
 void LocalLayout::update(BufferParams const & params, BufferId id)
 {
-	QString layout = toqstr(params.local_layout);
+	QString layout = toqstr(params.getLocalLayout(false));
 	// Nothing to do if the params and preamble are unchanged.
 	if (id == current_id_
 		&& layout == locallayoutTE->document()->toPlainText())
@@ -533,7 +533,7 @@ void LocalLayout::update(BufferParams const & params, BufferId id)
 void LocalLayout::apply(BufferParams & params)
 {
 	string const layout = fromqstr(locallayoutTE->document()->toPlainText());
-	params.local_layout = layout;
+	params.setLocalLayout(layout, false);
 }
 
 
@@ -30,8 +30,8 @@ extern char const * const lyx_version_info;
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 469 // gb: \caption*{}
-#define LYX_FORMAT_TEX2LYX 469 // gb: \caption*{}
+#define LYX_FORMAT_LYX 470 // gb: new tag begin_forced_local_layout/end_forced_local_layout
+#define LYX_FORMAT_TEX2LYX 470 // gb: new tag begin_forced_local_layout/end_forced_local_layout
 
 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
 #ifndef _MSC_VER



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic