]> git.lyx.org Git - lyx.git/blobdiff - src/TextClass.cpp
Try even harder to obtain an instant preview
[lyx.git] / src / TextClass.cpp
index e0e302a9acf0dfd0d1d287a0371e5467091ba6a3..02fc86e9f96aaadd48a1f085b1e8ffc775dcde28 100644 (file)
@@ -61,7 +61,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 51; //spitz: add ToggleIndent tag
+int const LAYOUT_FORMAT = 55; //spitz: InsetLayout and Layout tags PassThruChars
 
 namespace {
 
@@ -126,7 +126,7 @@ string translateReadType(TextClass::ReadType rt)
 
 // This string should not be translated here,
 // because it is a layout identifier.
-docstring const TextClass::plain_layout_ = from_ascii("Plain Layout");
+docstring const TextClass::plain_layout_ = from_ascii(N_("Plain Layout"));
 
 
 InsetLayout DocumentClass::plain_insetlayout_;
@@ -155,7 +155,6 @@ TextClass::TextClass()
        titletype_ = TITLE_COMMAND_AFTER;
        titlename_ = "maketitle";
        loaded_ = false;
-       _("Plain Layout"); // a hack to make this translatable
 }
 
 
@@ -1422,13 +1421,20 @@ InsetLayout const & DocumentClass::insetLayout(docstring const & name) const
        InsetLayouts::const_iterator cen = insetlayoutlist_.end();
        while (!n.empty()) {
                InsetLayouts::const_iterator cit = insetlayoutlist_.lower_bound(n);
-               if (cit != cen && cit->first == n)
-                       return cit->second;
+               if (cit != cen && cit->first == n) {
+                       if (cit->second.obsoleted_by().empty())
+                               return cit->second;
+                       n = cit->second.obsoleted_by();
+                       return insetLayout(n);
+               }
+               // If we have a generic prefix (e.g., "Note:"),
+               // try if this one alone is found.
                size_t i = n.find(':');
                if (i == string::npos)
                        break;
                n = n.substr(0, i);
        }
+       // Layout "name" not found.
        return plain_insetlayout_;
 }