]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
Workaround for #6865: smarter FontList::setMisspelled implementation
[lyx.git] / src / LaTeXFeatures.cpp
index 8f78e02d1ab0ce1c9ff00195dbc25d5d9d8a9b0c..0a4c840bd2a5af8e35504e0d230df84814bce847 100644 (file)
@@ -38,6 +38,9 @@
 #include "support/gettext.h"
 #include "support/lstrings.h"
 
+#include <algorithm>
+
+
 using namespace std;
 using namespace lyx::support;
 
@@ -195,13 +198,11 @@ static docstring const changetracking_none_def = from_ascii(
        "\\newcommand{\\lyxdeleted}[3]{}\n");
 
 static docstring const textgreek_def = from_ascii(
-       "\\providecommand*{\\perispomeni}{\\char126}\n"
-       "\\AtBeginDocument{\\DeclareRobustCommand{\\greektext}{%\n"
-       "  \\fontencoding{LGR}\\selectfont\\def\\encodingdefault{LGR}%\n"
-       "  \\renewcommand{\\~}{\\perispomeni}%\n"
-       "}}\n"
+       "\\DeclareRobustCommand{\\greektext}{%\n"
+       "  \\fontencoding{LGR}\\selectfont\\def\\encodingdefault{LGR}}\n"
        "\\DeclareRobustCommand{\\textgreek}[1]{\\leavevmode{\\greektext #1}}\n"
-       "\\DeclareFontEncoding{LGR}{}{}\n");
+       "\\DeclareFontEncoding{LGR}{}{}\n"
+       "\\DeclareTextSymbol{\\~}{LGR}{126}");
 
 static docstring const textcyr_def = from_ascii(
        "\\DeclareRobustCommand{\\cyrtext}{%\n"
@@ -590,11 +591,25 @@ string const LaTeXFeatures::getColorOptions() const
                colors << "\\pagecolor{page_backgroundcolor}\n";
        }
 
+       if (mustProvide("fontcolor")) {
+               colors << "\\definecolor{document_fontcolor}{rgb}{";
+               colors << outputLaTeXColor(params_.fontcolor) << "}\n";
+               // set the color
+               colors << "\\color{document_fontcolor}\n";
+       }
+
        if (mustProvide("lyxgreyedout")) {
                colors << "\\definecolor{note_fontcolor}{rgb}{";
                colors << outputLaTeXColor(params_.notefontcolor) << "}\n";
                // the color will be set together with the definition of
-               // the lyxgreyedout environment (lyxgreyedout_def)
+               // the lyxgreyedout environment (see lyxgreyedout_def)
+       }
+
+       // color for shaded boxes
+       if (isRequired("framed") && mustProvide("color")) {
+               colors << "\\definecolor{shadecolor}{rgb}{";
+               colors << outputLaTeXColor(params_.boxbgcolor) << "}\n";
+               // this color is automatically used by the LaTeX-package "framed"
        }
 
        return colors.str();
@@ -686,21 +701,7 @@ string const LaTeXFeatures::getPackages() const
                                 << params_.graphicsDriver
                                 << "]{graphicx}\n";
        }
-       // shadecolor for shaded
-       if (isRequired("framed") && mustProvide("color")) {
-               RGBColor c = rgbFromHexName(lcolor.getX11Name(Color_shadedbg));
-               //255.0 to force conversion to double
-               //NOTE As Jürgen Spitzmüller pointed out, an alternative would be
-               //to use the xcolor package instead, and then we can do
-               // \define{shadcolor}{RGB}...
-               //and not do any conversion. We'd then need to require xcolor
-               //in InsetNote::validate().
-               int const stmSize = packages.precision(2);
-               packages << "\\definecolor{shadecolor}{rgb}{"
-                       << c.r / 255.0 << ',' << c.g / 255.0 << ',' << c.b / 255.0 << "}\n";
-               packages.precision(stmSize);
-       }
-
+       
        // lyxskak.sty --- newer chess support based on skak.sty
        if (mustProvide("chess"))
                packages << "\\usepackage[ps,mover]{lyxskak}\n";
@@ -1114,7 +1115,7 @@ docstring const LaTeXFeatures::getIncludedFiles(string const & fname) const
             fi != end; ++fi)
                // FIXME UNICODE
                sgmlpreamble << "\n<!ENTITY " << fi->first
-                            << (isSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
+                            << (isSGMLFileName(fi->second) ? " SYSTEM \"" : " \"")
                             << makeRelPath(from_utf8(fi->second), basename) << "\">";
 
        return sgmlpreamble.str();