]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
A little more lv cleanup.
[lyx.git] / src / BufferParams.cpp
index 0bdee627163a8bf0384c8c59ca0d1dbc4913ea8b..5d6e56046ff45220afd5ab4d19a80145646c783c 100644 (file)
@@ -367,8 +367,9 @@ BufferParams::BufferParams()
        listings_params = string();
        pagestyle = "default";
        suppress_date = false;
-       // white is equal to no background color
+       // no color is the default (white)
        backgroundcolor = lyx::rgbFromHexName("#ffffff");
+       isbackgroundcolor = false;
        // no color is the default (black)
        fontcolor = lyx::rgbFromHexName("#000000");
        isfontcolor = false;
@@ -726,6 +727,7 @@ string BufferParams::readToken(Lexer & lex, string const & token,
        } else if (token == "\\backgroundcolor") {
                lex.eatLine();
                backgroundcolor = lyx::rgbFromHexName(lex.getString());
+               isbackgroundcolor = true;
        } else if (token == "\\fontcolor") {
                lex.eatLine();
                fontcolor = lyx::rgbFromHexName(lex.getString());
@@ -735,6 +737,7 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                string color = lex.getString();
                notefontcolor = lyx::rgbFromHexName(color);
                // set the font color within LyX
+               // FIXME: the color is correctly set but later overwritten by the default
                lcolor.setColor(Color_greyedouttext, color);
        } else if (token == "\\paperwidth") {
                lex >> paperwidth;
@@ -926,11 +929,11 @@ void BufferParams::writeFile(ostream & os) const
           << "\n\\paperorientation " << string_orientation[orientation]
           << "\n\\suppress_date " << convert<string>(suppress_date)
           << '\n';
-          if (backgroundcolor != lyx::rgbFromHexName("#ffffff"))
+       if (isbackgroundcolor == true)
                os << "\\backgroundcolor " << lyx::X11hexname(backgroundcolor) << '\n';
-          if (isfontcolor == true)
+       if (isfontcolor == true)
                os << "\\fontcolor " << lyx::X11hexname(fontcolor) << '\n';
-          if (notefontcolor != lyx::rgbFromHexName("#cccccc"))
+       if (notefontcolor != lyx::rgbFromHexName("#cccccc"))
                os << "\\notefontcolor " << lyx::X11hexname(notefontcolor) << '\n';
 
        BranchList::const_iterator it = branchlist().begin();
@@ -1454,8 +1457,8 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                texrow.newline();
        }
 
-       // only output when the background color is not white
-       if (backgroundcolor != lyx::rgbFromHexName("#ffffff")) {
+       // only output when the background color is not default
+       if (isbackgroundcolor == true) {
                // only require color here, the background color will be defined
                // in LaTeXFeatures.cpp to avoid interferences with the LaTeX
                // package pdfpages 
@@ -1463,7 +1466,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                features.require("pagecolor");
        }
 
-       // only output when the font color is not black
+       // only output when the font color is not default
        if (isfontcolor == true) {
                // only require color here, the font color will be defined
                // in LaTeXFeatures.cpp to avoid interferences with the LaTeX