Inserted handling for "default" language in language code and don't put out

a \\par if we have only one paragraph.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1005 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2000-09-08 11:15:01 +00:00
parent 260ae2415d
commit da5299d326
6 changed files with 47 additions and 14 deletions

View File

@ -1,3 +1,20 @@
2000-09-08 Juergen Vigna <jug@sad.it>
* 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 <jug@sad.it>
* config/pspell.m4: added entry to lyx-flags

View File

@ -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"];
}

View File

@ -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"));

View File

@ -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.

View File

@ -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;

View File

@ -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,