Fix bug 440

* src/frontends/controllers/ControlCharacter.[Ch]
	(reset_lang_) New flag (needed because the language is never
	inherited)

	* src/frontends/controllers/ControlCharacter.C
	(ControlCharacter::getLanguage): Use reset_lang_
	(ControlCharacter::setLanguage): Set reset_lang_ if needed


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17526 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2007-03-23 15:09:21 +00:00
parent 556bf23be9
commit 6c8520bb88
2 changed files with 10 additions and 5 deletions

View File

@ -28,7 +28,7 @@ namespace frontend {
ControlCharacter::ControlCharacter(Dialog & parent)
: Dialog::Controller(parent),
font_(0), toggleall_(false)
font_(0), toggleall_(false), reset_lang_(false)
{}
@ -211,6 +211,8 @@ void ControlCharacter::setColor(LColor_color val)
string ControlCharacter::getLanguage() const
{
if (reset_lang_)
return "reset";
if (font_.get() && font_->language())
return font_->language()->lang();
return "ignore";
@ -221,11 +223,11 @@ void ControlCharacter::setLanguage(string const & val)
{
if (val == "ignore")
font_->setLanguage(ignore_language);
else if (val == "reset")
else if (val == "reset") {
reset_lang_ = true;
// Ignored in getLanguage, but needed for dispatchParams
font_->setLanguage(kernel().buffer().params().language);
else
} else
font_->setLanguage(languages.getLanguage(val));
}

View File

@ -76,6 +76,9 @@ private:
boost::scoped_ptr<LyXFont> font_;
///
bool toggleall_;
/// If true the language should be reset.
/// If false the language of font_ is used.
bool reset_lang_;
};
} // namespace frontend