commit 250b0581927efbd8fd3dfdb2d513e01d75fec802
Author: Georg Baum <[email protected]>
Date: Sun Jan 31 12:37:22 2016 +0100
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 05c3c40..2a14aee 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_sep<name>package_mid_sep<package loading
code>package_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 a8bf4ee..01a5cd3 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;