From 5d429a45a33ef33b502f631ec58c483bafa22adb Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Fri, 23 May 2003 11:18:43 +0000 Subject: [PATCH] Get rid of the global use_babel variable. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7026 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/LaTeXFeatures.C | 8 ++++++++ src/LaTeXFeatures.h | 3 ++- src/bufferparams.C | 14 +++----------- src/insets/ChangeLog | 4 ++++ src/insets/insetquotes.C | 3 +-- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index cb0879a522..98b5df0690 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2003-05-23 Angus Leeming + + * LaTeXFeatures.[Ch] (useBabel): new method. + * bufferparams.C (writeLaTeX): use it. + 2003-05-23 Lars Gullik Bjønnes * ParagraphList.h (set): remove unused function. diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index ae9e23002b..a8754d033f 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -38,6 +38,14 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p) {} +bool LaTeXFeatures::useBabel() const +{ + return lyxrc.language_use_babel || + bufferParams().language->lang() != lyxrc.default_language || + this->hasLanguages(); +} + + void LaTeXFeatures::require(string const & name) { if (isRequired(name)) diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index b95c8e4115..6cf6c8d159 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -78,7 +78,8 @@ public: void useLayout(string const & lyt); /// BufferParams const & bufferParams() const; - /// + /// the return value is dependent upon both LyXRC and LaTeXFeatures. + bool useBabel() const; private: string externalPreambles; diff --git a/src/bufferparams.C b/src/bufferparams.C index f4bfd76fef..d4c166aaf8 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -38,11 +38,6 @@ using std::ostream; using std::endl; using std::pair; -#ifdef WITH_WARNINGS -#warning Do we need this horrible thing? (JMarc) -#endif -bool use_babel; - BufferParams::BufferParams() // Initialize textclass to point to article. if `first' is @@ -524,17 +519,14 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features, clsoptions << "landscape,"; // language should be a parameter to \documentclass - use_babel = false; - ostringstream language_options; if (language->babel() == "hebrew" && default_language->babel() != "hebrew") // This seems necessary features.useLanguage(default_language); - if (lyxrc.language_use_babel || - language->lang() != lyxrc.default_language || - features.hasLanguages()) { - use_babel = true; + ostringstream language_options; + bool const use_babel = features.useBabel(); + if (use_babel) { language_options << features.getLanguages(); language_options << language->babel(); if (lyxrc.language_global_options) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 2f52420869..f51c6c5b7b 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2003-05-23 Angus Leeming + + * insetquotes (validate): use the new LaTeXFeatures::useBabel() method. + 2003-05-23 Angus Leeming * insetfoot.C (latex): diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 571adbf73b..d438de51bf 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -322,10 +322,9 @@ int InsetQuotes::docbook(Buffer const *, ostream & os, bool) const } -extern bool use_babel; - void InsetQuotes::validate(LaTeXFeatures & features) const { + bool const use_babel = features.useBabel(); char type = quote_char[quote_index[side_][language_]]; #ifdef DO_USE_DEFAULT_LANGUAGE