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