]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/Preamble.cpp
Cmake build: Omit also hidden header files from globbing
[lyx.git] / src / tex2lyx / Preamble.cpp
index 9759663808c3d32bfe7cbffb09e47e492d791478..934420a9c1cd364ae4793a5a4a82674e26795d16 100644 (file)
@@ -21,6 +21,7 @@
 #include "Layout.h"
 #include "Lexer.h"
 #include "TextClass.h"
+#include "version.h"
 
 #include "support/convert.h"
 #include "support/FileName.h"
@@ -61,11 +62,12 @@ const char * const known_languages[] = {"acadian", "afrikaans", "albanian",
 "greek", "hebrew", "hungarian", "icelandic", "indon", "indonesian", "interlingua",
 "irish", "italian", "japanese", "kazakh", "kurmanji", "latin", "latvian", "lithuanian",
 "lowersorbian", "lsorbian", "magyar", "malay", "meyalu", "mongolian", "naustrian",
-"newzealand", "ngerman", "ngermanb", "norsk", "nynorsk", "polutonikogreek", "polish",
-"portuges", "portuguese", "romanian", "russian", "russianb", "samin",
-"scottish", "serbian", "serbian-latin", "slovak", "slovene", "spanish",
-"swedish", "thai", "turkish", "turkmen", "ukraineb", "ukrainian",
-"uppersorbian", "UKenglish", "USenglish", "usorbian", "vietnam", "welsh",
+"newzealand", "ngerman", "ngermanb", "norsk", "nswissgerman", "nynorsk",
+"polutonikogreek", "polish", "portuges", "portuguese", "romanian", "russian",
+"russianb", "samin", "scottish", "serbian", "serbian-latin", "slovak",
+"slovene", "spanish", "swedish", "swissgerman", "thai", "turkish", "turkmen",
+"ukraineb", "ukrainian", "uppersorbian", "UKenglish", "USenglish", "usorbian",
+"vietnam", "welsh",
 0};
 
 /**
@@ -81,11 +83,12 @@ const char * const known_coded_languages[] = {"french", "afrikaans", "albanian",
 "greek", "hebrew", "magyar", "icelandic", "bahasa", "bahasa", "interlingua",
 "irish", "italian", "japanese", "kazakh", "kurmanji", "latin", "latvian", "lithuanian",
 "lowersorbian", "lowersorbian", "magyar", "bahasam", "bahasam", "mongolian", "naustrian",
-"newzealand", "ngerman", "ngerman", "norsk", "nynorsk", "polutonikogreek", "polish",
-"portuguese", "portuguese", "romanian", "russian", "russian", "samin",
-"scottish", "serbian", "serbian-latin", "slovak", "slovene", "spanish",
-"swedish", "thai", "turkish", "turkmen", "ukrainian", "ukrainian",
-"uppersorbian", "uppersorbian", "english", "english", "vietnamese", "welsh",
+"newzealand", "ngerman", "ngerman", "norsk", "german-ch", "nynorsk",
+"polutonikogreek", "polish", "portuguese", "portuguese", "romanian", "russian",
+"russian", "samin", "scottish", "serbian", "serbian-latin", "slovak",
+"slovene", "spanish", "swedish", "german-ch-old", "thai", "turkish", "turkmen",
+"ukrainian", "ukrainian", "uppersorbian", "english", "english", "uppersorbian",
+"vietnamese", "welsh",
 0};
 
 /// languages with danish quotes (.lyx names)
@@ -132,9 +135,6 @@ const char * const known_sans_fonts[] = { "avant", "berasans", "biolinum-type1",
 "cmbr", "cmss", "helvet", "iwona", "iwonac", "iwonal", "iwonalc", "kurier",
 "kurierc", "kurierl", "kurierlc", "lmss", "tgadventor", "tgheros", 0};
 
-const char * const known_kurier_fonts[] = { "kurier", "kurierl",
-"kurier-condensed", "kurier-light-condensed", 0};
-
 const char * const known_typewriter_fonts[] = { "beramono", "cmtl", "cmtt",
 "courier", "lmtt", "luximono", "fourier", "lmodern", "mathpazo", "mathptmx",
 "newcent", "tgcursor", "txtt", 0};
@@ -297,6 +297,7 @@ string process_keyval_opt(vector<string> & options, string name)
 
 /**
  * known polyglossia language names (including variants)
+ * FIXME: support spelling=old for german variants (german vs. ngerman LyX names etc)
  */
 const char * const Preamble::polyglossia_languages[] = {
 "albanian", "croatian", "hebrew", "norsk", "swedish", "amharic", "czech", "hindi",
@@ -308,7 +309,7 @@ const char * const Preamble::polyglossia_languages[] = {
 "brazil", "brazilian", "finnish", "lithuanian", "scottish", "usorbian", "breton", 
 "french", "lsorbian", "serbian", "vietnamese", "bulgarian", "galician", "magyar",
 "slovak", "welsh", "catalan", "german", "malayalam", "slovenian", "coptic", "greek",
-"marathi", "spanish",
+"marathi", "spanish", "austrian",
 "american", "ancient", "australian", "british", "monotonic", "newzealand",
 "polytonic", 0};
 
@@ -326,7 +327,7 @@ const char * const Preamble::coded_polyglossia_languages[] = {
 "brazilian", "brazilian", "finnish", "lithuanian", "scottish", "uppersorbian", "breton",
 "french", "lowersorbian", "serbian", "vietnamese", "bulgarian", "galician", "magyar",
 "slovak", "welsh", "catalan", "ngerman", "malayalam", "slovene", "coptic", "greek",
-"marathi", "spanish",
+"marathi", "spanish", "naustrian",
 "american", "ancientgreek", "australian", "british", "greek", "newzealand",
 "polutonikogreek", 0};
 
@@ -423,7 +424,8 @@ bool scale_as_percentage(string const & scale, string & percentage)
        if (pos != string::npos) {
                string value = scale.substr(pos + 1);
                if (isStrDbl(value)) {
-                       percentage = convert<string>(100 * convert<double>(value));
+                       percentage = convert<string>(
+                               static_cast<int>(100 * convert<double>(value)));
                        return true;
                }
        }
@@ -499,7 +501,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
        //h_pdf_author;
        //h_pdf_subject;
        //h_pdf_keywords;
-       h_pdf_bookmarks           = "1";
+       h_pdf_bookmarks           = "0";
        h_pdf_bookmarksnumbered   = "0";
        h_pdf_bookmarksopen       = "0";
        h_pdf_bookmarksopenlevel  = "1";
@@ -507,7 +509,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
        h_pdf_pdfborder           = "0";
        h_pdf_colorlinks          = "0";
        h_pdf_backref             = "section";
-       h_pdf_pdfusetitle         = "1";
+       h_pdf_pdfusetitle         = "0";
        //h_pdf_pagemode;
        //h_pdf_quoted_options;
        h_quotes_language         = "english";
@@ -959,6 +961,18 @@ void Preamble::handle_package(Parser &p, string const & name,
        else if (name == "hyperref")
                handle_hyperref(options);
 
+       else if (name == "algorithm2e") {
+               // Load "algorithm2e" module
+               addModule("algorithm2e");
+               // Add the package options to the global document options
+               if (!options.empty()) {
+                       if (h_options.empty())
+                               h_options = join(options, ",");
+                       else
+                               h_options += ',' + join(options, ",");
+               }
+       }
+
        else if (!in_lyx_preamble) {
                if (options.empty())
                        h_preamble << "\\usepackage{" << name << '}';
@@ -1040,7 +1054,10 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc)
        }
 
        // output the LyX file settings
-       os << "#LyX file created by tex2lyx " << PACKAGE_VERSION << "\n"
+       // Important: Keep the version formatting in sync with LyX and
+       //            lyx2lyx (bug 7951)
+       os << "#LyX file created by tex2lyx " << lyx_version_major << '.'
+          << lyx_version_minor << '\n'
           << "\\lyxformat " << LYX_FORMAT << '\n'
           << "\\begin_document\n"
           << "\\begin_header\n"