]> git.lyx.org Git - features.git/commitdiff
Fix shaded box UI color (#7395) as good as it gets ATM
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 30 Nov 2012 16:11:07 +0000 (17:11 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 30 Nov 2012 16:11:07 +0000 (17:11 +0100)
src/BufferParams.cpp
src/insets/InsetBox.cpp
src/insets/InsetBox.h

index 403a2cbbe1fa0d2a46ea3abb3c6f899a58053ab7..b18bf79602ff57b2d8fb4f5206558f246fd72e59 100644 (file)
@@ -819,6 +819,7 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                lex.eatLine();
                string color = lex.getString();
                boxbgcolor = lyx::rgbFromHexName(color);
+               lcolor.setColor("boxbgcolor", color);
        } else if (token == "\\paperwidth") {
                lex >> paperwidth;
        } else if (token == "\\paperheight") {
index 2e611ffd30d14e818c78b09952a59a8bc7155d6b..f55abcdfa1e0b1cc7d5138c97d7dc1bf914d1b15 100644 (file)
@@ -17,6 +17,7 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
+#include "ColorSet.h"
 #include "Cursor.h"
 #include "DispatchResult.h"
 #include "FuncStatus.h"
@@ -184,6 +185,20 @@ bool InsetBox::forcePlainLayout(idx_type) const
 }
 
 
+ColorCode InsetBox::backgroundColor(PainterInfo const &) const
+{
+       if (params_.type != "Shaded")
+               return getLayout().bgcolor();
+       // FIXME: This hardcoded color is a hack!
+       if (buffer().params().boxbgcolor == lyx::rgbFromHexName("#ff0000"))
+               return getLayout().bgcolor();
+       ColorCode c = lcolor.getFromLyXName("boxbgcolor");
+       if (c == Color_none)
+               return getLayout().bgcolor();
+       return c;
+}
+
+
 void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
        switch (cmd.action()) {
index 236525e7a88cb24e17fb61e43cebecc56384835f..cf0f689ed135b5f3ad294ea3f08d7e589dd7c2d5 100644 (file)
@@ -102,6 +102,8 @@ public:
        ///
        DisplayType display() const { return Inline; }
        ///
+       ColorCode backgroundColor(PainterInfo const &) const;
+       ///
        bool allowParagraphCustomization(idx_type = 0) const { return !forcePlainLayout(); }
        ///
        bool forcePlainLayout(idx_type = 0) const;