From 88329a656c4be4c9179ba10023b01800574a2f53 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Sun, 18 Jul 2010 11:58:38 +0000 Subject: [PATCH] Fix problem reported by Vincent, that absence of python can cause failure to load the empty class. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34971 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LayoutFile.cpp | 4 ++-- src/TextClass.cpp | 13 ++++++++++--- src/TextClass.h | 3 +++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/LayoutFile.cpp b/src/LayoutFile.cpp index 64e389ae70..1aa5dbfeb3 100644 --- a/src/LayoutFile.cpp +++ b/src/LayoutFile.cpp @@ -218,7 +218,7 @@ LayoutFileIndex LayoutFileList::addEmptyClass(string const & textclass) // stdclass.inc. That would give us something moderately usable. ofs << "# This layout is automatically generated\n" "# \\DeclareLaTeXClass{" << textclass << "}\n\n" - "Format 26\n" + "Format " << LAYOUT_FORMAT << "\n" "Input stdclass.inc\n\n" << layoutpost; ofs.close(); @@ -236,7 +236,7 @@ LayoutFileIndex LayoutFileList::addEmptyClass(string const & textclass) ofstream ofs2(tempLayout.toFilesystemEncoding().c_str()); ofs2 << "# This layout is automatically generated\n" "# \\DeclareLaTeXClass{" << textclass << "}\n\n" - "Format 26\n\n" + "Format " << LAYOUT_FORMAT << "\n" << layoutpost; ofs2.close(); if (!tc->load(tempLayout.absFileName())) { diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 47caf1f47a..7539fd8319 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -49,6 +49,16 @@ using namespace lyx::support; namespace lyx { +// Keep the changes documented in the Customization manual. +// +// If you change this format, then you MUST also make sure that +// your changes do not invalidate the hardcoded layout file in +// LayoutFile.cpp. Additions will never do so, but syntax changes +// could. See LayoutFileList::addEmptyClass() and, especially, the +// definition of the layoutpost string. +// +int const LAYOUT_FORMAT = 27; + namespace { class LayoutNamesEqual : public unary_function { @@ -64,9 +74,6 @@ private: docstring name_; }; -// Keep the changes documented in the Customization manual. -int const LAYOUT_FORMAT = 27; - bool layout2layout(FileName const & filename, FileName const & tempfile) { diff --git a/src/TextClass.h b/src/TextClass.h index fe68ceae78..f3d2197278 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -480,6 +480,9 @@ private: /// convert page sides option to text 1 or 2 std::ostream & operator<<(std::ostream & os, PageSides p); +/// current format of layout files +extern int const LAYOUT_FORMAT; + } // namespace lyx -- 2.39.5