]> git.lyx.org Git - lyx.git/blobdiff - src/TextClass.cpp
Next step in fixing problems noted by Vincent: Remove magic boolean from
[lyx.git] / src / TextClass.cpp
index bbf54cc946ac9c72760aa643207289a2d9af3fbb..42e774756dff69f7e2e5c3bae25eae0194cbb4f3 100644 (file)
@@ -49,6 +49,19 @@ 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. 
+// You should also run (or ask someone who has bash to run) the
+// development/updatelayouts.sh script, to update the format of 
+// all of our layout files.
+//
+int const LAYOUT_FORMAT = 27;
+       
 namespace {
 
 class LayoutNamesEqual : public unary_function<Layout, bool> {
@@ -64,9 +77,6 @@ private:
        docstring name_;
 };
 
-// Keep the changes documented in the Customization manual. 
-int const FORMAT = 26;
-
 
 bool layout2layout(FileName const & filename, FileName const & tempfile)
 {
@@ -246,7 +256,7 @@ namespace {
 
 bool TextClass::convertLayoutFormat(support::FileName const & filename, ReadType rt)
 {
-       LYXERR(Debug::TCLASS, "Converting layout file to " << FORMAT);
+       LYXERR(Debug::TCLASS, "Converting layout file to " << LAYOUT_FORMAT);
        FileName const tempfile = FileName::tempName("convert_layout");
        bool success = layout2layout(filename, tempfile);
        if (success)
@@ -293,7 +303,7 @@ bool TextClass::read(FileName const & filename, ReadType rt)
        bool const worx = convertLayoutFormat(filename, rt);
        if (!worx) {
                LYXERR0 ("Unable to convert " << filename << 
-                       " to format " << FORMAT);
+                       " to format " << LAYOUT_FORMAT);
                return false;
        }
        return true;
@@ -331,7 +341,7 @@ bool TextClass::read(std::string const & str, ReadType rt)
        bool const worx = convertLayoutFormat(tempfile, rt);
        if (!worx) {
                LYXERR0("Unable to convert internal layout information to format " 
-                       << FORMAT);
+                       << LAYOUT_FORMAT);
        }
        tempfile.removeFile();
        return worx;
@@ -685,7 +695,7 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
 
                // Note that this is triggered the first time through the loop unless
                // we hit a format tag.
-               if (format != FORMAT)
+               if (format != LAYOUT_FORMAT)
                        return FORMAT_MISMATCH;
        }