From: Georg Baum Date: Sun, 31 Jan 2016 11:37:22 +0000 (+0100) Subject: Do not use static objects in Preamble X-Git-Tag: 2.2.0beta1~36 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=250b0581927efbd8fd3dfdb2d513e01d75fec802;p=features.git Do not use static objects in Preamble This does not make any difference currently, since the only instance of the Preamble class is a global one, but it is cleaner and will be needed for parsing the encoding with a second Preamble instance. --- diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index 05c3c406f6..2a14aeeb0a 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -185,9 +185,6 @@ const char * const known_lyx_packages[] = {"amsbsy", "amsmath", "amssymb", "rotfloat", "splitidx", "setspace", "subscript", "textcomp", "tipa", "tipx", "tone", "ulem", "url", "varioref", "verbatim", "wrapfig", "xcolor", "xunicode", 0}; -// used for the handling of \newindex -int index_number = 0; - // codes used to remove packages that are loaded automatically by LyX. // Syntax: package_beg_seppackage_mid_seppackage_end_sep const char package_beg_sep = '\001'; @@ -460,7 +457,7 @@ string remove_braces(string const & value) Preamble::Preamble() : one_language(true), explicit_babel(false), - title_layout_found(false), h_font_cjk_set(false) + title_layout_found(false), index_number(0), h_font_cjk_set(false) { //h_backgroundcolor; //h_boxbgcolor; @@ -1413,9 +1410,9 @@ void Preamble::parse(Parser & p, string const & forceclass, // check the case that a standard color is used if (space.empty() && is_known(argument, known_basic_colors)) { h_fontcolor = rgbcolor2code(argument); - preamble.registerAutomaticallyLoadedPackage("color"); + registerAutomaticallyLoadedPackage("color"); } else if (space.empty() && argument == "document_fontcolor") - preamble.registerAutomaticallyLoadedPackage("color"); + registerAutomaticallyLoadedPackage("color"); // check the case that LyX's document_fontcolor is defined // but not used for \color else { @@ -1435,7 +1432,7 @@ void Preamble::parse(Parser & p, string const & forceclass, if (is_known(argument, known_basic_colors)) { h_backgroundcolor = rgbcolor2code(argument); } else if (argument == "page_backgroundcolor") - preamble.registerAutomaticallyLoadedPackage("color"); + registerAutomaticallyLoadedPackage("color"); // check the case that LyX's page_backgroundcolor is defined // but not used for \pagecolor else { diff --git a/src/tex2lyx/Preamble.h b/src/tex2lyx/Preamble.h index a8bf4ee059..01a5cd32e4 100644 --- a/src/tex2lyx/Preamble.h +++ b/src/tex2lyx/Preamble.h @@ -119,6 +119,9 @@ private: /// was at least one title layout found? bool title_layout_found; + /// used for the handling of \newindex + int index_number; + std::ostringstream h_preamble; std::string h_backgroundcolor; std::string h_biblio_style;