Fix shaded box UI color (#7395) as good as it gets ATM

This commit is contained in:
Juergen Spitzmueller 2012-11-30 17:11:07 +01:00
parent e235b96378
commit ee0860e403
3 changed files with 18 additions and 0 deletions

View 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") {

View 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()) {

View 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;