diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 7443931dd6..6454ba3c92 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -988,7 +988,7 @@ int Buffer::readHeader(Lexer & lex) << token << '\''); string const result = - params().readToken(lex, token, d->filename.onlyPath()); + params().readToken(lex, token, d->filename); if (!result.empty()) { if (token == "\\textclass") { d->layout_position = result; diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 46d56581ca..a4756ec24e 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -704,9 +704,10 @@ BufferParams::MathNumber BufferParams::getMathNumber() const string BufferParams::readToken(Lexer & lex, string const & token, - FileName const & filepath) + FileName const & filename) { string result; + FileName const & filepath = filename.onlyPath(); if (token == "\\textclass") { lex.next(); @@ -1028,7 +1029,7 @@ string BufferParams::readToken(Lexer & lex, string const & token, color = lcolor.getX11HexName(Color_background); // FIXME UNICODE if (!shortcut.empty()) - lcolor.setColor(to_utf8(shortcut), color); + lcolor.setColor(to_utf8(shortcut)+ "@" + filename.absFileName(), color); } } } else if (token == "\\author") { @@ -1055,12 +1056,14 @@ string BufferParams::readToken(Lexer & lex, string const & token, notefontcolor = lyx::rgbFromHexName(color); lcolor.setColor("notefontcolor", color); lcolor.setLaTeXName("notefontcolor", "note_fontcolor"); + // set a local name for the painter + lcolor.setColor("notefontcolor@" + filename.absFileName(), color); isnotefontcolor = true; } else if (token == "\\boxbgcolor") { lex.eatLine(); string color = lex.getString(); boxbgcolor = lyx::rgbFromHexName(color); - lcolor.setColor("boxbgcolor", color); + lcolor.setColor("boxbgcolor@" + filename.absFileName(), color); isboxbgcolor = true; } else if (token == "\\paperwidth") { lex >> paperwidth; diff --git a/src/BufferParams.h b/src/BufferParams.h index 73bb9f6ff5..ff5604eb52 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -17,6 +17,7 @@ #include "Citation.h" #include "ColorCode.h" +#include "ColorSet.h" #include "DocumentClassPtr.h" #include "LayoutModuleList.h" #include "paper.h" @@ -78,7 +79,7 @@ public: /// read a header token, if unrecognised, return it or an unknown class name std::string readToken(Lexer & lex, std::string const & token, ///< token to read. - support::FileName const & filepath); + support::FileName const & filename); /// void writeFile(std::ostream &, Buffer const *) const; diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index 34e33a561a..c04bd1e927 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -34,6 +34,7 @@ #include "support/debug.h" #include "support/docstream.h" +#include "support/FileName.h" #include "support/gettext.h" #include "support/lstrings.h" #include "support/Translator.h" @@ -220,10 +221,10 @@ ColorCode InsetBox::backgroundColor(PainterInfo const &) const return getLayout().bgcolor(); if (params_.type == "Shaded") { - if (buffer().params().isboxbgcolor) + if (!buffer().params().isboxbgcolor) return getLayout().bgcolor(); - ColorCode c = lcolor.getFromLyXName("boxbgcolor"); + ColorCode c = lcolor.getFromLyXName("boxbgcolor@" + buffer().fileName().absFileName()); if (c == Color_none) return getLayout().bgcolor(); return c; diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 149ef6506a..7790ad91fb 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -34,6 +34,7 @@ #include "support/debug.h" #include "support/docstream.h" +#include "support/FileName.h" #include "support/gettext.h" #include "support/lstrings.h" @@ -456,7 +457,8 @@ ColorCode InsetIndex::labelColor() const if (params_.index.empty() || params_.index == from_ascii("idx")) return InsetCollapsible::labelColor(); // FIXME UNICODE - ColorCode c = lcolor.getFromLyXName(to_utf8(params_.index)); + ColorCode c = lcolor.getFromLyXName(to_utf8(params_.index) + + "@" + buffer().fileName().absFileName()); if (c == Color_none) c = InsetCollapsible::labelColor(); return c; diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp index c9b0b8823a..adacef3bae 100644 --- a/src/insets/InsetNote.cpp +++ b/src/insets/InsetNote.cpp @@ -332,6 +332,10 @@ FontInfo InsetNote::getFont() const ColorCode c = lcolor.getFromLyXName("notefontcolor"); if (c != Color_none) font.setColor(c); + // This is the local color (not overridden by other documents) + ColorCode lc = lcolor.getFromLyXName("notefontcolor@" + buffer().fileName().absFileName()); + if (lc != Color_none) + font.setPaintColor(lc); } return font; }