]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.C
Fix bug 2485 and crash on middle mouse paste on math
[lyx.git] / src / LaTeXFeatures.C
index 3fbb86210256680a217ad596a8de41ea93c363b7..0e5b4dcf8184e6c4dd633f41155d3fc27011d488 100644 (file)
 
 #include <sstream>
 
-using lyx::support::IsSGMLFilename;
-using lyx::support::LibFileSearch;
-using lyx::support::MakeRelPath;
-using lyx::support::OnlyPath;
+using lyx::support::isSGMLFilename;
+using lyx::support::libFileSearch;
+using lyx::support::makeRelPath;
+using lyx::support::onlyPath;
 
 using std::endl;
 using std::find;
@@ -49,8 +49,9 @@ namespace biblio = lyx::biblio;
 LaTeXFeatures::PackagesList LaTeXFeatures::packages_;
 
 
-LaTeXFeatures::LaTeXFeatures(Buffer const & b, BufferParams const & p, bool n)
-       : buffer_(&b), params_(p), nice_(n)
+LaTeXFeatures::LaTeXFeatures(Buffer const & b, BufferParams const & p,
+                            OutputParams const & r)
+       : buffer_(&b), params_(p), runparams_(r)
 {}
 
 
@@ -74,19 +75,19 @@ void LaTeXFeatures::require(string const & name)
 void LaTeXFeatures::getAvailable()
 {
        LyXLex lex(0, 0);
-       string real_file = LibFileSearch("", "packages.lst");
+       string real_file = libFileSearch("", "packages.lst");
 
        if (real_file.empty())
                return;
 
        lex.setFile(real_file);
 
-       if (!lex.isOK()) 
+       if (!lex.isOK())
                return;
 
        // Make sure that we are clean
        packages_.clear();
-       
+
        bool finished = false;
        // Parse config-file
        while (lex.isOK() && !finished) {
@@ -219,8 +220,8 @@ set<string> LaTeXFeatures::getEncodingSet(string const & doc_encoding) const
        LanguageList::const_iterator it  = UsedLanguages_.begin();
        LanguageList::const_iterator end = UsedLanguages_.end();
        for (; it != end; ++it)
-               if ((*it)->encoding()->LatexName() != doc_encoding)
-                       encodings.insert((*it)->encoding()->LatexName());
+               if ((*it)->encoding()->latexName() != doc_encoding)
+                       encodings.insert((*it)->encoding()->latexName());
        return encodings;
 }
 
@@ -238,10 +239,10 @@ char const * simplefeatures[] = {
        "varioref",
        "prettyref",
        "float",
-       "wasysym",
        "dvipost",
        "fancybox",
        "calc",
+       "nicefrac",
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
@@ -275,14 +276,18 @@ string const LaTeXFeatures::getPackages() const
                packages << "\\usepackage{amsmath}\n";
        }
 
+       // wasysym is a simple feature, but it must be after amsmath if both
+       // are used
+       if (isRequired("wasysym"))
+               packages << "\\usepackage{wasysym}\n";
+
        // color.sty
        if (isRequired("color")) {
                if (params_.graphicsDriver == "default")
-                       packages << "\\usepackage[usenames]{color}\n";
+                       packages << "\\usepackage{color}\n";
                else
                        packages << "\\usepackage["
                                 << params_.graphicsDriver
-                                << ",usenames"
                                 << "]{color}\n";
        }
 
@@ -498,14 +503,14 @@ string const LaTeXFeatures::getLyXSGMLEntities() const
 string const LaTeXFeatures::getIncludedFiles(string const & fname) const
 {
        ostringstream sgmlpreamble;
-       string const basename = OnlyPath(fname);
+       string const basename = onlyPath(fname);
 
        FileMap::const_iterator end = IncludedFiles_.end();
        for (FileMap::const_iterator fi = IncludedFiles_.begin();
             fi != end; ++fi)
                sgmlpreamble << "\n<!ENTITY " << fi->first
-                            << (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
-                            << MakeRelPath(fi->second, basename) << "\">";
+                            << (isSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
+                            << makeRelPath(fi->second, basename) << "\">";
 
        return sgmlpreamble.str();
 }