]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetLayout.cpp
Cleanup mouse/selection/context-menu interactions.
[lyx.git] / src / insets / InsetLayout.cpp
index a9d3e06fe4a8ec3633d39c2bec2e2674fba140a5..900881764999652e943c0921b78d7da58145bfc8 100644 (file)
@@ -29,6 +29,7 @@ namespace lyx {
 
 InsetLayout::InsetLayout() :
        name_(from_ascii("undefined")), labelstring_(from_ascii("UNDEFINED")),
+       decoration_(InsetLayout::Default),
        font_(sane_font), labelfont_(sane_font), bgcolor_(Color_error), 
        multipar_(false), passthru_(false), needprotect_(false),
        freespacing_(false), keepempty_(false), forceltr_(false)
@@ -59,6 +60,20 @@ enum InsetLayoutTags {
 };
 
 
+namespace {
+       InsetLayout::InsetDecoration translateDecoration(std::string const & str) 
+       {
+               if (str == "classic")
+                       return InsetLayout::Classic;
+               if (str == "minimalistic")
+                       return InsetLayout::Minimalistic;
+               if (str == "conglomerate")
+                       return InsetLayout::Conglomerate;
+               return InsetLayout::Default;
+       }
+}
+
+
 bool InsetLayout::read(Lexer & lexrc)
 {
        name_ = support::subst(lexrc.getDocString(), '_', ' ');
@@ -114,7 +129,7 @@ bool InsetLayout::read(Lexer & lexrc)
                        break;
                case IL_DECORATION:
                        lexrc.next();
-                       decoration_ = lexrc.getString();
+                       decoration_ = translateDecoration(lexrc.getString());
                        break;
                case IL_LATEXNAME:
                        lexrc.next();
@@ -152,9 +167,10 @@ bool InsetLayout::read(Lexer & lexrc)
                        needprotect_ = lexrc.getBool();
                        break;
                case IL_FONT: {
-                       font = lyxRead(lexrc, inherit_font);
-                       // So: define font before labelfont
-                       labelfont_ = font;
+                       font_ = lyxRead(lexrc, inherit_font);
+                       // If you want to define labelfont, you need to do so after
+                       // font is defined.
+                       labelfont_ = font_;
                        break;
                }
                case IL_BGCOLOR: {