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
This commit is contained in:
Richard Heck 2010-07-18 11:58:38 +00:00
parent 9034323d59
commit 88329a656c
3 changed files with 15 additions and 5 deletions

View File

@ -218,7 +218,7 @@ LayoutFileIndex LayoutFileList::addEmptyClass(string const & textclass)
// stdclass.inc. That would give us something moderately usable. // stdclass.inc. That would give us something moderately usable.
ofs << "# This layout is automatically generated\n" ofs << "# This layout is automatically generated\n"
"# \\DeclareLaTeXClass{" << textclass << "}\n\n" "# \\DeclareLaTeXClass{" << textclass << "}\n\n"
"Format 26\n" "Format " << LAYOUT_FORMAT << "\n"
"Input stdclass.inc\n\n" "Input stdclass.inc\n\n"
<< layoutpost; << layoutpost;
ofs.close(); ofs.close();
@ -236,7 +236,7 @@ LayoutFileIndex LayoutFileList::addEmptyClass(string const & textclass)
ofstream ofs2(tempLayout.toFilesystemEncoding().c_str()); ofstream ofs2(tempLayout.toFilesystemEncoding().c_str());
ofs2 << "# This layout is automatically generated\n" ofs2 << "# This layout is automatically generated\n"
"# \\DeclareLaTeXClass{" << textclass << "}\n\n" "# \\DeclareLaTeXClass{" << textclass << "}\n\n"
"Format 26\n\n" "Format " << LAYOUT_FORMAT << "\n"
<< layoutpost; << layoutpost;
ofs2.close(); ofs2.close();
if (!tc->load(tempLayout.absFileName())) { if (!tc->load(tempLayout.absFileName())) {

View File

@ -49,6 +49,16 @@ using namespace lyx::support;
namespace lyx { 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 { namespace {
class LayoutNamesEqual : public unary_function<Layout, bool> { class LayoutNamesEqual : public unary_function<Layout, bool> {
@ -64,9 +74,6 @@ private:
docstring name_; docstring name_;
}; };
// Keep the changes documented in the Customization manual.
int const LAYOUT_FORMAT = 27;
bool layout2layout(FileName const & filename, FileName const & tempfile) bool layout2layout(FileName const & filename, FileName const & tempfile)
{ {

View File

@ -480,6 +480,9 @@ private:
/// convert page sides option to text 1 or 2 /// convert page sides option to text 1 or 2
std::ostream & operator<<(std::ostream & os, PageSides p); std::ostream & operator<<(std::ostream & os, PageSides p);
/// current format of layout files
extern int const LAYOUT_FORMAT;
} // namespace lyx } // namespace lyx