mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
Do not rely on hardcoded color when determining notefontcolor
This commit is contained in:
parent
3375dccef6
commit
024980cf43
@ -946,6 +946,7 @@ int Buffer::readHeader(Lexer & lex)
|
||||
params().fontcolor = RGBColor(0, 0, 0);
|
||||
params().isfontcolor = false;
|
||||
params().notefontcolor = RGBColor(0xCC, 0xCC, 0xCC);
|
||||
params().isnotefontcolor = false;
|
||||
params().boxbgcolor = RGBColor(0xFF, 0, 0);
|
||||
params().html_latex_start.clear();
|
||||
params().html_latex_end.clear();
|
||||
|
@ -461,6 +461,7 @@ 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");
|
||||
boxbgcolor = lyx::rgbFromHexName("#ff0000");
|
||||
compressed = lyxrc.save_compressed;
|
||||
@ -1053,6 +1054,7 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
||||
notefontcolor = lyx::rgbFromHexName(color);
|
||||
lcolor.setColor("notefontcolor", color);
|
||||
lcolor.setLaTeXName("notefontcolor", "note_fontcolor");
|
||||
isnotefontcolor = true;
|
||||
} else if (token == "\\boxbgcolor") {
|
||||
lex.eatLine();
|
||||
string color = lex.getString();
|
||||
@ -1378,7 +1380,7 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
|
||||
os << "\\backgroundcolor " << lyx::X11hexname(backgroundcolor) << '\n';
|
||||
if (isfontcolor)
|
||||
os << "\\fontcolor " << lyx::X11hexname(fontcolor) << '\n';
|
||||
if (notefontcolor != lyx::rgbFromHexName("#cccccc"))
|
||||
if (isnotefontcolor)
|
||||
os << "\\notefontcolor " << lyx::X11hexname(notefontcolor) << '\n';
|
||||
if (boxbgcolor != lyx::rgbFromHexName("#ff0000"))
|
||||
os << "\\boxbgcolor " << lyx::X11hexname(boxbgcolor) << '\n';
|
||||
|
@ -396,6 +396,8 @@ public:
|
||||
///
|
||||
RGBColor notefontcolor;
|
||||
///
|
||||
bool isnotefontcolor;
|
||||
///
|
||||
RGBColor boxbgcolor;
|
||||
/// \param index should lie in the range 0 <= \c index <= 3.
|
||||
Bullet & temp_bullet(size_type index);
|
||||
|
@ -162,6 +162,7 @@ bool is_backgroundcolor;
|
||||
lyx::RGBColor set_fontcolor;
|
||||
bool is_fontcolor;
|
||||
lyx::RGBColor set_notefontcolor;
|
||||
bool is_notefontcolor;
|
||||
lyx::RGBColor set_boxbgcolor;
|
||||
bool forced_fontspec_activation;
|
||||
|
||||
@ -2264,6 +2265,7 @@ void GuiDocument::changeNoteFontColor()
|
||||
colorButtonStyleSheet(newColor));
|
||||
// save color
|
||||
set_notefontcolor = rgbFromHexName(fromqstr(newColor.name()));
|
||||
is_notefontcolor = true;
|
||||
change_adaptor();
|
||||
}
|
||||
|
||||
@ -2274,6 +2276,7 @@ void GuiDocument::deleteNoteFontColor()
|
||||
theApp()->getRgbColor(Color_greyedouttext, set_notefontcolor);
|
||||
colorModule->noteFontColorPB->setStyleSheet(
|
||||
colorButtonStyleSheet(rgb2qcolor(set_notefontcolor)));
|
||||
is_notefontcolor = false;
|
||||
change_adaptor();
|
||||
}
|
||||
|
||||
@ -3516,6 +3519,7 @@ void GuiDocument::applyView()
|
||||
bp_.fontcolor = set_fontcolor;
|
||||
bp_.isfontcolor = is_fontcolor;
|
||||
bp_.notefontcolor = set_notefontcolor;
|
||||
bp_.isnotefontcolor = is_notefontcolor;
|
||||
bp_.boxbgcolor = set_boxbgcolor;
|
||||
|
||||
// numbering
|
||||
@ -4034,6 +4038,7 @@ void GuiDocument::paramsToDialog()
|
||||
colorModule->noteFontColorPB->setStyleSheet(
|
||||
colorButtonStyleSheet(rgb2qcolor(bp_.notefontcolor)));
|
||||
set_notefontcolor = bp_.notefontcolor;
|
||||
is_notefontcolor = bp_.isnotefontcolor;
|
||||
|
||||
if (bp_.isbackgroundcolor) {
|
||||
colorModule->backgroundPB->setStyleSheet(
|
||||
|
@ -327,9 +327,8 @@ bool InsetNote::allowSpellCheck() const
|
||||
FontInfo InsetNote::getFont() const
|
||||
{
|
||||
FontInfo font = getLayout().font();
|
||||
// FIXME: This hardcoded color is a hack!
|
||||
if (params_.type == InsetNoteParams::Greyedout
|
||||
&& buffer().params().notefontcolor != lyx::rgbFromHexName("#cccccc")) {
|
||||
&& buffer().params().isnotefontcolor) {
|
||||
ColorCode c = lcolor.getFromLyXName("notefontcolor");
|
||||
if (c != Color_none)
|
||||
font.setColor(c);
|
||||
|
Loading…
Reference in New Issue
Block a user