diff --git a/ChangeLog b/ChangeLog index eba8ce2cac..b03e4a2f48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2000-09-08 Juergen Vigna + + * src/lyx_gui.C (create_forms): don't display the "default" entry as + we have already "Reset". + + * src/language.C (initL): inserted "default" language and made this + THE default language (and not american!) + + * src/paragraph.C: inserted handling of "default" language! + + * src/lyxfont.C: ditto + + * src/text.C: ditto + + * src/paragraph.C: output the \\par only if we have a following + paragraph otherwise it's not needed. + 2000-09-05 Juergen Vigna * config/pspell.m4: added entry to lyx-flags diff --git a/src/language.C b/src/language.C index 8ce45c04a4..ec9dadd28e 100644 --- a/src/language.C +++ b/src/language.C @@ -64,6 +64,7 @@ void LangInit::initL() { "croatian", N_("Croatian"), false, &iso8859_2 }, { "czech", N_("Czech"), false, &iso8859_2 }, { "danish", N_("Danish"), false, &iso8859_1 }, + { "default", N_("Document wide language"), false, &iso8859_1 }, { "dutch", N_("Dutch"), false, &iso8859_1 }, { "english", N_("English"), false, &iso8859_1 }, { "esperanto", N_("Esperanto"), false, &iso8859_3 }, @@ -109,7 +110,7 @@ void LangInit::initL() ++i; } - default_language = &languages["american"]; + default_language = &languages["default"]; } diff --git a/src/lyx_gui.C b/src/lyx_gui.C index d9385d076b..a1d1b18265 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -379,6 +379,7 @@ void LyXGUI::create_forms() combo_language2->addto(_("Reset")); for(Languages::const_iterator cit = languages.begin(); cit != languages.end(); ++cit) { + if ((*cit).second.lang() != "default") combo_language2->addto((*cit).second.lang().c_str()); } combo_language2->select_text(_("No change")); diff --git a/src/lyxfont.C b/src/lyxfont.C index 9d0d7c911c..dd4706d37f 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -411,7 +411,8 @@ string LyXFont::stateText(BufferParams * params) const ost << _("Latex ") << _(GUIMiscNames[latex()]) << ", "; if (bits == inherit) ost << _("Default") << ", "; - if (!params || language() != params->language_info) + if (!params || (language() != params->language_info && + language()->lang() != "default")) ost << _("Language: ") << _(language()->display().c_str()); #ifdef HAVE_SSTREAM string buf(ost.str().c_str()); @@ -664,7 +665,8 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, ostream & os) const if (col_str == "inherit") col_str = "default"; os << "\\color " << col_str << "\n"; } - if (orgfont.language() != language()) { + if (orgfont.language() != language() && + language()->lang() != "default") { if (language()) os << "\\lang " << language()->lang() << "\n"; else @@ -681,7 +683,8 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base, int count = 0; bool env = false; - if (language() != base.language() && language() != prev.language()) { + if (language() != base.language() && language() != prev.language() && + language()->lang() != "default") { if (isRightToLeft() != prev.isRightToLeft()) { if (isRightToLeft()) { os << "\\R{"; @@ -773,7 +776,8 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base, int count = 0; bool env = false; - if (language() != base.language() && language() != next.language()) { + if (language() != base.language() && language() != next.language() + && language()->lang() != "default") { os << "}"; ++count; env = true; // Size change need not bother about closing env. diff --git a/src/paragraph.C b/src/paragraph.C index 2919ea2b7f..d4116332d8 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -2412,7 +2412,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(Buffer const * buf, // calculates the space between the baselines according // to this font. (Matthias) LyXFont font = getFont(bparams, Last() - 1); - if (need_par) { + if (need_par && next) { if (style.resfont.size() != font.size()) { os << '\\' << font.latexSize() @@ -2427,7 +2427,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(Buffer const * buf, << ' '; } os << '}'; - } else if (style.resfont.size() != font.size()){ + } else if ((style.resfont.size() != font.size()) && next){ os << "{\\" << font.latexSize() << " \\par}"; } @@ -4591,20 +4591,28 @@ LyXParagraph::getParLanguage(BufferParams const & bparams) const return FirstPhysicalPar()->getParLanguage(bparams); else #endif - if (size() > 0) + if (size() > 0) { + Language const * lang = 0; #ifndef NEW_TABULAR if (!table) #endif - return GetFirstFontSettings().language(); + lang = GetFirstFontSettings().language(); #ifndef NEW_TABULAR else { - for (size_type pos = 0; pos < size(); ++pos) - if (IsNewline(pos)) - return GetFontSettings(bparams, pos).language(); - return GetFirstFontSettings().language(); + for (size_type pos = 0; pos < size(); ++pos) { + if (IsNewline(pos)) { + lang = GetFontSettings(bparams, pos).language(); + break; + } + } + if (!lang) + lang = GetFirstFontSettings().language(); } #endif - else if (previous) + if (lang->lang() == "default") + return bparams.language_info; + return lang; + } else if (previous) return previous->getParLanguage(bparams); //else return bparams.language_info; diff --git a/src/text.C b/src/text.C index 175ef9e900..d9bc6e6c98 100644 --- a/src/text.C +++ b/src/text.C @@ -526,6 +526,7 @@ void LyXText::draw(BufferView * bview, Row const * row, ++vpos; if (lyxrc.mark_foreign_language && + font.language()->lang() != "default" && font.language() != bview->buffer()->params.language_info) { int y = offset + row->height() - 1; pain.line(int(tmpx), y, int(x), y, @@ -637,6 +638,7 @@ void LyXText::draw(BufferView * bview, Row const * row, } if (lyxrc.mark_foreign_language && + font.language()->lang() != "default" && font.language() != bview->buffer()->params.language_info) { int y = offset + row->height() - 1; pain.line(int(tmpx), y, int(x), y,