mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Do not rely on hardcoded color when determining boxbgcolor
This commit is contained in:
parent
024980cf43
commit
ee475b62fa
@ -948,6 +948,7 @@ int Buffer::readHeader(Lexer & lex)
|
||||
params().notefontcolor = RGBColor(0xCC, 0xCC, 0xCC);
|
||||
params().isnotefontcolor = false;
|
||||
params().boxbgcolor = RGBColor(0xFF, 0, 0);
|
||||
params().isboxbgcolor = false;
|
||||
params().html_latex_start.clear();
|
||||
params().html_latex_end.clear();
|
||||
params().html_math_img_scale = 1.0;
|
||||
|
@ -461,9 +461,10 @@ BufferParams::BufferParams()
|
||||
fontcolor = lyx::rgbFromHexName("#000000");
|
||||
isfontcolor = false;
|
||||
// light gray is the default font color for greyed-out notes
|
||||
isnotefontcolor = false;
|
||||
notefontcolor = lyx::rgbFromHexName("#cccccc");
|
||||
isnotefontcolor = false;
|
||||
boxbgcolor = lyx::rgbFromHexName("#ff0000");
|
||||
isboxbgcolor = false;
|
||||
compressed = lyxrc.save_compressed;
|
||||
for (int iter = 0; iter < 4; ++iter) {
|
||||
user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
|
||||
@ -1060,6 +1061,7 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
||||
string color = lex.getString();
|
||||
boxbgcolor = lyx::rgbFromHexName(color);
|
||||
lcolor.setColor("boxbgcolor", color);
|
||||
isboxbgcolor = true;
|
||||
} else if (token == "\\paperwidth") {
|
||||
lex >> paperwidth;
|
||||
} else if (token == "\\paperheight") {
|
||||
@ -1382,7 +1384,7 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
|
||||
os << "\\fontcolor " << lyx::X11hexname(fontcolor) << '\n';
|
||||
if (isnotefontcolor)
|
||||
os << "\\notefontcolor " << lyx::X11hexname(notefontcolor) << '\n';
|
||||
if (boxbgcolor != lyx::rgbFromHexName("#ff0000"))
|
||||
if (isboxbgcolor)
|
||||
os << "\\boxbgcolor " << lyx::X11hexname(boxbgcolor) << '\n';
|
||||
|
||||
for (auto const & br : branchlist()) {
|
||||
|
@ -399,6 +399,8 @@ public:
|
||||
bool isnotefontcolor;
|
||||
///
|
||||
RGBColor boxbgcolor;
|
||||
///
|
||||
bool isboxbgcolor;
|
||||
/// \param index should lie in the range 0 <= \c index <= 3.
|
||||
Bullet & temp_bullet(size_type index);
|
||||
Bullet const & temp_bullet(size_type index) const;
|
||||
|
@ -164,6 +164,7 @@ bool is_fontcolor;
|
||||
lyx::RGBColor set_notefontcolor;
|
||||
bool is_notefontcolor;
|
||||
lyx::RGBColor set_boxbgcolor;
|
||||
bool is_boxbgcolor;
|
||||
bool forced_fontspec_activation;
|
||||
|
||||
} // anonymous namespace
|
||||
@ -2292,6 +2293,7 @@ void GuiDocument::changeBoxBackgroundColor()
|
||||
colorButtonStyleSheet(newColor));
|
||||
// save color
|
||||
set_boxbgcolor = rgbFromHexName(fromqstr(newColor.name()));
|
||||
is_boxbgcolor = true;
|
||||
change_adaptor();
|
||||
}
|
||||
|
||||
@ -2302,6 +2304,7 @@ void GuiDocument::deleteBoxBackgroundColor()
|
||||
theApp()->getRgbColor(Color_shadedbg, set_boxbgcolor);
|
||||
colorModule->boxBackgroundPB->setStyleSheet(
|
||||
colorButtonStyleSheet(rgb2qcolor(set_boxbgcolor)));
|
||||
is_boxbgcolor = false;
|
||||
change_adaptor();
|
||||
}
|
||||
|
||||
@ -3521,6 +3524,7 @@ void GuiDocument::applyView()
|
||||
bp_.notefontcolor = set_notefontcolor;
|
||||
bp_.isnotefontcolor = is_notefontcolor;
|
||||
bp_.boxbgcolor = set_boxbgcolor;
|
||||
bp_.isboxbgcolor = is_boxbgcolor;
|
||||
|
||||
// numbering
|
||||
if (bp_.documentClass().hasTocLevels()) {
|
||||
@ -4050,6 +4054,7 @@ void GuiDocument::paramsToDialog()
|
||||
colorModule->boxBackgroundPB->setStyleSheet(
|
||||
colorButtonStyleSheet(rgb2qcolor(bp_.boxbgcolor)));
|
||||
set_boxbgcolor = bp_.boxbgcolor;
|
||||
is_boxbgcolor = bp_.isboxbgcolor;
|
||||
|
||||
// numbering
|
||||
int const min_toclevel = documentClass().min_toclevel();
|
||||
|
@ -220,8 +220,7 @@ ColorCode InsetBox::backgroundColor(PainterInfo const &) const
|
||||
return getLayout().bgcolor();
|
||||
|
||||
if (params_.type == "Shaded") {
|
||||
// FIXME: This hardcoded color is a hack!
|
||||
if (buffer().params().boxbgcolor == lyx::rgbFromHexName("#ff0000"))
|
||||
if (buffer().params().isboxbgcolor)
|
||||
return getLayout().bgcolor();
|
||||
|
||||
ColorCode c = lcolor.getFromLyXName("boxbgcolor");
|
||||
|
Loading…
Reference in New Issue
Block a user