Rather trivial actually. See attached.

- Martin

Index: src/TextClass.cpp
===================================================================
--- src/TextClass.cpp   (revision 19790)
+++ src/TextClass.cpp   (working copy)
@@ -598,6 +598,7 @@
 
 enum InsetLayoutTags {
        IL_FONT = 1,
+       IL_BGCOLOR,
        IL_DECORATION,
        IL_LABELFONT,
        IL_LABELSTRING,
@@ -613,6 +614,7 @@
 void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
 {
        keyword_item elementTags[] = {
+               { "bgcolor", IL_BGCOLOR },
                { "decoration", IL_DECORATION },
                { "end", IL_END },
                { "font", IL_FONT },
@@ -635,6 +637,7 @@
        string latexparam;
        Font font(Font::ALL_INHERIT);
        Font labelfont(Font::ALL_INHERIT);
+       Color::color bgcolor(Color::background);
        string preamble;
 
        bool getout = false;
@@ -680,6 +683,12 @@
                        font.realize(defaultfont());
                        labelfont = font;
                        break;
+               case IL_BGCOLOR: {
+                       lexrc.next();
+                       string const token = lexrc.getString();
+                       bgcolor = lcolor.getFromLyXName(token);
+                       break;
+               }
                case IL_PREAMBLE:
                        preamble = lexrc.getLongString("EndPreamble");
                        break;
@@ -702,6 +711,7 @@
                il.latexparam = latexparam;
                il.font = font;
                il.labelfont = labelfont;
+               il.bgcolor = bgcolor;           
                il.preamble = preamble;
                insetlayoutlist_[name] = il;
        }
Index: src/TextClass.h
===================================================================
--- src/TextClass.h     (revision 19790)
+++ src/TextClass.h     (working copy)
@@ -40,6 +40,7 @@
        std::string latexparam;
        Font font;
        Font labelfont;
+       Color::color bgcolor;
        std::string preamble;
 };
 
Index: src/insets/InsetNote.cpp
===================================================================
--- src/insets/InsetNote.cpp    (revision 19788)
+++ src/insets/InsetNote.cpp    (working copy)
@@ -187,30 +187,6 @@
 }
 
 
-Color_color InsetNote::backgroundColor() const
-{
-       Color_color c;
-       switch (params_.type) {
-       case InsetNoteParams::Note:
-               c = Color::notebg;
-               break;
-       case InsetNoteParams::Comment:
-               c = Color::commentbg;
-               break;
-       case InsetNoteParams::Greyedout:
-               c = Color::greyedoutbg;
-               break;
-       case InsetNoteParams::Framed:
-               c = Color::greyedoutbg;
-               break;
-       case InsetNoteParams::Shaded:
-               c = Color::shadedbg;
-               break;
-       }
-       return c;
-}
-
-
 bool InsetNote::showInsetDialog(BufferView * bv) const
 {
        InsetNoteMailer(const_cast<InsetNote &>(*this)).showDialog(bv);
Index: src/insets/InsetNote.h
===================================================================
--- src/insets/InsetNote.h      (revision 19788)
+++ src/insets/InsetNote.h      (working copy)
@@ -61,8 +61,6 @@
        void read(Buffer const & buf, Lexer & lex);
        ///
        void setButtonLabel();
-       ///
-       virtual Color_color backgroundColor() const;
        /// show the note dialog
        bool showInsetDialog(BufferView * bv) const;
        ///
Index: src/insets/InsetCollapsable.h
===================================================================
--- src/insets/InsetCollapsable.h       (revision 19798)
+++ src/insets/InsetCollapsable.h       (working copy)
@@ -131,6 +131,8 @@
        ///
        bool setMouseHover(bool mouse_hover);
        ///
+       virtual Color_color backgroundColor() const {return layout_.bgcolor; }
+
        int latex(Buffer const &, odocstream &,
                  OutputParams const &) const;
        ///
Index: lib/layouts/stdinsets.inc
===================================================================
--- lib/layouts/stdinsets.inc   (revision 19804)
+++ lib/layouts/stdinsets.inc   (working copy)
@@ -28,6 +28,7 @@
        LabelString           comment
        LatexType             environment
        LatexName             comment
+       BgColor               commentbg
        LabelFont
          Color               comment
          Size                Small
@@ -39,6 +40,7 @@
        LabelString           note
        LatexType             command
        LatexName             note
+       BgColor               notebg
        LabelFont
          Color               note
          Size                Small
@@ -49,6 +51,7 @@
        LabelString           greyedout
        LatexType             environment
        LatexName             lyxgreyedout
+       BgColor               greyedoutbg
        LabelFont
          Color               greyedout
          Size                Small
@@ -59,6 +62,7 @@
        LabelString           framed
        LatexType             environment
        LatexName             framed
+       BgColor               greyedoutbg
        LabelFont
          Color               greyedout
          Size                Small
@@ -69,6 +73,7 @@
        LabelString           shaded
        LatexType             environment
        LatexName             shaded
+       BgColor               shaded
        LabelFont
          Color               greyedout
          Size                Small

Reply via email to