From: Jürgen Vigna Date: Wed, 27 Sep 2000 15:23:24 +0000 (+0000) Subject: Various fixes, removed "default" language, inserted new lyxrc tag X-Git-Tag: 1.6.10~21967 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4148a9244547e7184c1dcc8234e9e62d3143a42c;p=lyx.git Various fixes, removed "default" language, inserted new lyxrc tag default_language. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1047 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/ChangeLog b/ChangeLog index ae2ff75b9f..c4b0f7cdba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2000-09-27 Juergen Vigna + + * various files: remove "default" language check. + + * src/insets/insetquotes.C: removed use of current_view. + + * src/lyxfunc.C (MenuNew): I don't know how put the AddPath here but + the one should have red ears by now! + + * src/insets/insettext.C (LocalDispatch): fixed setting of same layouts + in more then one paragraph. Fixed cursor-movement/selection. + + * src/frontends/xforms/FormParagraph.C: disable pagebreaks for + paragraphs inside a text inset. + + * src/text.C (GetVisibleRow): paint top/bottom line only as wide as the + text-inset if this owner is an inset. + 2000-09-27 Lars Gullik Bjønnes * src/Bullet.h: changed type of font, character and size to int diff --git a/src/bufferparams.C b/src/bufferparams.C index 0a0a51ee94..1059010789 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -50,7 +50,7 @@ BufferParams::BufferParams() use_amsmath = false; secnumdepth = 3; tocdepth = 3; - language = "default"; + language = default_language->lang(); language_info = default_language; fonts = "default"; inputenc = "auto"; @@ -209,7 +209,7 @@ void BufferParams::readLanguage(LyXLex & lex) language_info = &(*lit).second; } else { // not found - language = "default"; + language = default_language->lang(); language_info = default_language; if (tmptok != "default") { lyxerr << "Warning: language `" diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index 1cd89f50c2..05e80ab334 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -209,7 +209,9 @@ void FormDocument::build() combo_language->setcallback(ComboInputCB, this); fl_end_form(); // "default" is not part of the languages array any more. +#ifdef DO_USE_DEFAULT_LANGUAGE combo_language->addto("default"); +#endif for(Languages::iterator cit = languages.begin(); cit != languages.end(); ++cit) { combo_language->addto((*cit).second.lang().c_str()); diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index 3dfdc68f96..9fe672b52c 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -100,8 +100,6 @@ void FormParagraph::build() bc_->addReadOnly (general_->radio_align_center); bc_->addReadOnly (general_->check_lines_top); bc_->addReadOnly (general_->check_lines_bottom); - bc_->addReadOnly (general_->check_pagebreaks_top); - bc_->addReadOnly (general_->check_pagebreaks_bottom); bc_->addReadOnly (general_->choice_space_above); bc_->addReadOnly (general_->input_space_above); bc_->addReadOnly (general_->check_space_above); @@ -466,6 +464,19 @@ void FormParagraph::general_update() added_space_bottom.keep()); fl_set_button(general_->check_noindent, text->cursor.par()->FirstPhysicalPar()->noindent); + if (text->cursor.par()->FirstPhysicalPar()->InInset()) { + fl_set_button(general_->check_pagebreaks_top, 0); + fl_deactivate_object(general_->check_pagebreaks_top); + fl_set_object_lcol(general_->check_pagebreaks_top, FL_INACTIVE); + fl_set_button(general_->check_pagebreaks_bottom, 0); + fl_deactivate_object(general_->check_pagebreaks_bottom); + fl_set_object_lcol(general_->check_pagebreaks_bottom, FL_INACTIVE); + } else { + fl_activate_object(general_->check_pagebreaks_top); + fl_set_object_lcol(general_->check_pagebreaks_top, FL_BLACK); + fl_activate_object(general_->check_pagebreaks_bottom); + fl_set_object_lcol(general_->check_pagebreaks_bottom, FL_BLACK); + } #else fl_set_input(general_->input_space_below, text->cursor.par()-> added_space_bottom.length().asString().c_str()); @@ -487,7 +498,9 @@ void FormParagraph::extra_update() LyXParagraph * par = lv_->view()->text->cursor.par(); fl_activate_object(extra_->input_pextra_width); + fl_set_object_lcol(extra_->input_pextra_width, FL_BLACK); fl_activate_object(extra_->input_pextra_widthp); + fl_set_object_lcol(extra_->input_pextra_widthp, FL_BLACK); fl_set_input(extra_->input_pextra_width, par->pextra_width.c_str()); fl_set_input(extra_->input_pextra_widthp, diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 8e1bbe75f4..df69302a40 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -73,7 +73,7 @@ int InsetLabel::Latex(Buffer const *, ostream & os, return 0; } -int InsetLabel::Ascii(Buffer const *, ostream & os, int linelen) const +int InsetLabel::Ascii(Buffer const *, ostream & os, int) const { os << "<" << getContents() << ">"; return 0; diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 8444ee0aa9..93104a4a43 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -31,8 +31,6 @@ using std::endl; // Quotes. Used for the various quotes. German, English, French, // Danish, Polish, all either double or single. -extern BufferView * current_view; - // codes used to read/write quotes to LyX files static char const * const language_char = "esgpfa"; static char const * const side_char = "lr" ; @@ -229,11 +227,10 @@ void InsetQuotes::Read(Buffer const *, LyXLex & lex) } -int InsetQuotes::Latex(Buffer const *, ostream & os, +int InsetQuotes::Latex(Buffer const * buf, ostream & os, bool /*fragile*/, bool) const { - string doclang = - current_view->buffer()->GetLanguage(); + string doclang = buf->GetLanguage(); int quoteind = quote_index[side][language]; string qstr; @@ -294,7 +291,7 @@ void InsetQuotes::Validate(LaTeXFeatures & features) const { char type = quote_char[quote_index[side][language]]; - if (current_view->buffer()->GetLanguage() == "default" + if (features.bufferParams().language == "default" && lyxrc.fontenc != "T1") { if (times == InsetQuotes::SingleQ) switch (type) { diff --git a/src/insets/insetref.C b/src/insets/insetref.C index 01008adad2..ca83db0a0e 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -72,7 +72,7 @@ int InsetRef::Latex(Buffer const *, ostream & os, } -int InsetRef::Ascii(Buffer const *, ostream & os, int linelen) const +int InsetRef::Ascii(Buffer const *, ostream & os, int) const { os << "[" << getContents() << "]"; return 0; diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 3b224b9b49..a22efa5466 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -757,7 +757,7 @@ InsetText::LocalDispatch(BufferView * bv, // --- Cursor Movements --------------------------------------------- case LFUN_RIGHTSEL: bv->text->FinishUndo(); - moveRight(bv, false); + moveRight(bv, false, true); TEXT(bv)->SetSelection(); UpdateLocal(bv, SELECTION, false); break; @@ -768,7 +768,7 @@ InsetText::LocalDispatch(BufferView * bv, break; case LFUN_LEFTSEL: bv->text->FinishUndo(); - moveLeft(bv, false); + moveLeft(bv, false, true); TEXT(bv)->SetSelection(); UpdateLocal(bv, SELECTION, false); break; @@ -919,7 +919,7 @@ InsetText::LocalDispatch(BufferView * bv, case LFUN_LAYOUT: // do not set layouts on non breakable textinsets if (autoBreakRows) { - static LyXTextClass::size_type cur_layout = cpar(bv)->layout; + LyXTextClass::size_type cur_layout = cpar(bv)->layout; // Derive layout number from given argument (string) // and current buffer's textclass (number). */ @@ -1121,23 +1121,23 @@ void InsetText::HideInsetCursor(BufferView * bv) UpdatableInset::RESULT -InsetText::moveRight(BufferView * bv, bool activate_inset) +InsetText::moveRight(BufferView * bv, bool activate_inset, bool selecting) { if (!cpar(bv)->next && (cpos(bv) >= cpar(bv)->Last())) return FINISHED; if (activate_inset && checkAndActivateInset(bv, false)) return DISPATCHED; - TEXT(bv)->CursorRight(bv); + TEXT(bv)->CursorRight(bv, selecting); return DISPATCHED_NOUPDATE; } UpdatableInset::RESULT -InsetText::moveLeft(BufferView * bv, bool activate_inset) +InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting) { if (!cpar(bv)->previous && (cpos(bv) <= 0)) return FINISHED; - TEXT(bv)->CursorLeft(bv); + TEXT(bv)->CursorLeft(bv, selecting); if (activate_inset && checkAndActivateInset(bv, true)) return DISPATCHED; return DISPATCHED_NOUPDATE; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 24c72ca054..d1be15fc08 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -200,9 +200,11 @@ private: /// void HideInsetCursor(BufferView *); /// - UpdatableInset::RESULT moveRight(BufferView *, bool activate_inset = true); + UpdatableInset::RESULT moveRight(BufferView *, bool activate_inset = true, + bool selecting = false); /// - UpdatableInset::RESULT moveLeft(BufferView *, bool activate_inset = true); + UpdatableInset::RESULT moveLeft(BufferView *, bool activate_inset = true, + bool selecting = false); /// UpdatableInset::RESULT moveUp(BufferView *); /// diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index ab8aec39df..3f6cb00412 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -54,7 +54,7 @@ int InsetUrl::Latex(Buffer const *, ostream & os, } -int InsetUrl::Ascii(Buffer const *, ostream & os, int linelen) const +int InsetUrl::Ascii(Buffer const *, ostream & os, int) const { if (getOptions().empty()) os << "[" << getContents() << "]"; diff --git a/src/intl.C b/src/intl.C index c6292d7ddc..28bcae1716 100644 --- a/src/intl.C +++ b/src/intl.C @@ -275,8 +275,10 @@ void Intl::InitKeyMapper(bool on) int n = 1; // Default is not in the language map +#ifdef DO_USE_DEFAULT_LANGUAGE Language->addto("default"); Language2->addto("default"); +#endif for (Languages::const_iterator cit = languages.begin(); cit != languages.end(); ++cit) { Language->addto((*cit).second.lang()); diff --git a/src/language.C b/src/language.C index cffd06447f..963c979055 100644 --- a/src/language.C +++ b/src/language.C @@ -17,10 +17,12 @@ #include "language.h" #include "gettext.h" #include "encoding.h" +#include "lyxrc.h" +#include "lyx_gui_misc.h" Languages languages; Language const * default_language; -Language ignore_lang("ignore", "Ignore", false, 0, "ignore"); +Language ignore_lang("ignore", "ignore", "Ignore", false, 0, "ignore"); Language const * ignore_language = &ignore_lang; /// @@ -41,6 +43,7 @@ private: struct lang_item { char const * lang; + char const * babel; char const * display; bool rtl; Encoding const * encoding; @@ -54,73 +57,80 @@ void LangInit::initL() // Same method is used in LyXAction.C (Lgb) lang_item items[] = { - { "afrikaans", N_("Afrikaans"), false, &iso8859_1, "af_ZA" }, - { "american", N_("American"), false, &iso8859_1, "en_US" }, - { "arabic", N_("Arabic"), true, &iso8859_6, "ar_SA" }, - { "austrian", N_("Austrian"), false, &iso8859_1, "de_AU" }, - { "bahasa", N_("Bahasa"), false, &iso8859_1, "in_ID" }, - { "brazil", N_("Brazil"), false, &iso8859_1, "pt_BR" }, - { "breton", N_("Breton"), false, &iso8859_1, "br_FR" }, - { "british", N_("British"), false, &iso8859_1, "en" }, - { "canadian", N_("Canadian"), false, &iso8859_1, "en_CA" }, - { "catalan", N_("Catalan"), false, &iso8859_1, "ca_ES" }, - { "croatian", N_("Croatian"), false, &iso8859_2, "hr" }, - { "czech", N_("Czech"), false, &iso8859_2, "cs_CZ" }, - { "danish", N_("Danish"), false, &iso8859_1, "da_DK" }, - { "default", N_("Document wide language"), false, &iso8859_1, "" }, - { "dutch", N_("Dutch"), false, &iso8859_1, "nl" }, - { "english", N_("English"), false, &iso8859_1, "en" }, - { "esperanto", N_("Esperanto"), false, &iso8859_3, "eo" }, + { "afrikaans", "afrikaans", N_("Afrikaans"), false, &iso8859_1, "af_ZA" }, + { "american", "american", N_("American"), false, &iso8859_1, "en_US" }, + { "arabic", "arabic", N_("Arabic"), true, &iso8859_6, "ar_SA" }, + { "austrian", "austrian", N_("Austrian"), false, &iso8859_1, "de_AU" }, + { "bahasa", "bahasa", N_("Bahasa"), false, &iso8859_1, "in_ID" }, + { "brazil", "brazil", N_("Brazil"), false, &iso8859_1, "pt_BR" }, + { "breton", "breton", N_("Breton"), false, &iso8859_1, "br_FR" }, + { "british", "british", N_("British"), false, &iso8859_1, "en_GB" }, + { "canadian", "canadian", N_("Canadian"), false, &iso8859_1, "en_CA" }, + { "canadien", "frenchb", N_("French Canadian"), false, &iso8859_1, "fr_CA" }, + { "catalan", "catalan", N_("Catalan"), false, &iso8859_1, "ca_ES" }, + { "croatian", "croatian", N_("Croatian"), false, &iso8859_2, "hr" }, + { "czech", "czech", N_("Czech"), false, &iso8859_2, "cs_CZ" }, + { "danish", "danish", N_("Danish"), false, &iso8859_1, "da_DK" }, +#ifdef DO_USE_DEFAULT_LANGUAGE + { "default", "default", N_("Document wide language"), false, &iso8859_1, "" }, +#endif + { "dutch", "dutch", N_("Dutch"), false, &iso8859_1, "nl" }, + { "english", "english", N_("English"), false, &iso8859_1, "en" }, + { "esperanto", "esperanto", N_("Esperanto"), false, &iso8859_3, "eo" }, // and what country code should esperanto have?? (Garst) - { "estonian", N_("Estonian"), false, &iso8859_4, "et_EE" }, - { "finnish", N_("Finnish"), false, &iso8859_1, "fi" }, - { "frenchb", N_("French"), false, &iso8859_1, "fr" }, - { "frenchc", N_("French Canadien"), false, &iso8859_1, "fr_CA" }, - { "french", N_("French (GUTenberg)"), false, &iso8859_1, "fr" }, - { "galician", N_("Galician"), false, &iso8859_1, "gl_ES" }, + { "estonian", "estonian", N_("Estonian"), false, &iso8859_4, "et_EE" }, + { "finnish", "finnish", N_("Finnish"), false, &iso8859_1, "fi" }, + { "frenchb", "frenchb", N_("French"), false, &iso8859_1, "fr" }, + { "french", "french", N_("French (GUTenberg)"), false, &iso8859_1, "fr" }, + { "galician", "galician", N_("Galician"), false, &iso8859_1, "gl_ES" }, /*There are two Galicia's, one in Spain, one in E.Europe. Because of the font encoding, I am assuming this is the one in Spain. (Garst) */ - { "german", N_("German"), false, &iso8859_1, "de" }, - { "greek", N_("Greek"), false, &iso8859_7, "el_GR" }, - { "hebrew", N_("Hebrew"), true, &cp1255, "he_IL" }, + { "german", "german", N_("German"), false, &iso8859_1, "de" }, + { "greek", "greek", N_("Greek"), false, &iso8859_7, "el_GR" }, + { "hebrew", "hebrew", N_("Hebrew"), true, &cp1255, "he_IL" }, /* According to Zrubecz Laszlo , "magyar" is better. I kept it here in case we want to provide aliasing of languages. (JMarc) */ - //{ "hungarian", N_("Hungarian"), false, &iso8859_2, "" }, - { "irish", N_("Irish"), false, &iso8859_1, "ga_IE" }, - { "italian", N_("Italian"), false, &iso8859_1, "it" }, - { "lsorbian", N_("Lsorbian"), false, &iso8859_2, "" }, + //{ "hungarian", "hungarian", N_("Hungarian"), false, &iso8859_2, "" }, + { "irish", "irish", N_("Irish"), false, &iso8859_1, "ga_IE" }, + { "italian", "italian", N_("Italian"), false, &iso8859_1, "it" }, + { "lsorbian", "lsorbian", N_("Lsorbian"), false, &iso8859_2, "" }, // no ISO listing for lsorbian (Garst) - { "magyar", N_("Magyar"), false, &iso8859_2, "hu" }, - { "norsk", N_("Norsk"), false, &iso8859_1, "no" }, - { "polish", N_("Polish"), false, &iso8859_2, "pl" }, - { "portuges", N_("Portuges"), false, &iso8859_1, "pt" }, - { "romanian", N_("Romanian"), false, &iso8859_2, "ro" }, - { "russian", N_("Russian"), false, &koi8, "ru" }, - { "scottish", N_("Scottish"), false, &iso8859_1, "gd_GB" }, - { "spanish", N_("Spanish"), false, &iso8859_1, "es" }, - { "slovak", N_("Slovak"), false, &iso8859_2, "sk_SL" }, - { "slovene", N_("Slovene"), false, &iso8859_2, "sl_SI" }, - { "swedish", N_("Swedish"), false, &iso8859_1, "sv_SE" }, - { "turkish", N_("Turkish"), false, &iso8859_9, "tr" }, - { "usorbian", N_("Usorbian"), false, &iso8859_2, "" }, + { "magyar", "magyar", N_("Magyar"), false, &iso8859_2, "hu" }, + { "norsk", "norsk", N_("Norsk"), false, &iso8859_1, "no" }, + { "polish", "polish", N_("Polish"), false, &iso8859_2, "pl" }, + { "portuges", "portuges", N_("Portuges"), false, &iso8859_1, "pt" }, + { "romanian", "romanian", N_("Romanian"), false, &iso8859_2, "ro" }, + { "russian", "russian", N_("Russian"), false, &koi8, "ru" }, + { "scottish", "scottish", N_("Scottish"), false, &iso8859_1, "gd_GB" }, + { "spanish", "spanish", N_("Spanish"), false, &iso8859_1, "es" }, + { "slovak", "slovak", N_("Slovak"), false, &iso8859_2, "sk_SL" }, + { "slovene", "slovene", N_("Slovene"), false, &iso8859_2, "sl_SI" }, + { "swedish", "swedish", N_("Swedish"), false, &iso8859_1, "sv_SE" }, + { "turkish", "turkish", N_("Turkish"), false, &iso8859_9, "tr" }, + { "usorbian", "usorbian", N_("Usorbian"), false, &iso8859_2, "" }, // no ISO listing for usorbian (Garst) - { "welsh", N_("Welsh"), false, &iso8859_1, "cy_GB" }, - { 0, 0, false, 0, 0 } + { "welsh", "welsh", N_("Welsh"), false, &iso8859_1, "cy_GB" }, + { 0, 0, 0, false, 0, 0 } }; int i = 0; while (items[i].lang) { languages[items[i].lang] = - Language(items[i].lang, items[i].display, - items[i].rtl, items[i].encoding, - items[i].code); + Language(items[i].lang, items[i].babel, + items[i].display, items[i].rtl, + items[i].encoding, items[i].code); ++i; } - - default_language = &languages["default"]; + if (languages.find(lyxrc.default_language) == languages.end()) { + string l1 = _("Default language \"") + lyxrc.default_language + + _("\" not found!"); + WriteAlert(l1.c_str(), _("Using \"english\" instead!"),""); + default_language = &languages["english"]; + } else + default_language = &languages[lyxrc.default_language]; } diff --git a/src/language.h b/src/language.h index 135fac5921..7015a59f79 100644 --- a/src/language.h +++ b/src/language.h @@ -27,16 +27,20 @@ public: /// Language() : RightToLeft_(false) {} /// - Language(string const & l, string const & d, + Language(string const & l, string const & b, string const & d, bool rtl, Encoding const * e, string const & c) - : lang_(l), display_(d), RightToLeft_(rtl) , encoding_(e), - code_(c) + : lang_(l), babel_(b), display_(d), RightToLeft_(rtl), + encoding_(e), code_(c) {} /// string const & lang() const { return lang_; } /// + string const & babel() const { + return babel_; + } + /// string const & display() const { return display_; } @@ -56,6 +60,8 @@ private: /// string lang_; /// + string babel_; + /// string display_; /// bool RightToLeft_; diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 8c53ad0b89..80e99b21f0 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -331,7 +331,9 @@ void LyXGUI::create_forms() combo_language2->addto(_("Reset")); for(Languages::iterator cit = languages.begin(); cit != languages.end(); ++cit) { +#ifdef DO_USE_DEFAULT_LANGUAGE if ((*cit).second.lang() != "default") +#endif 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 60cd2fe81d..3a70535afe 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -291,10 +291,7 @@ void LyXFont::update(LyXFont const & newfont, setLatex(setMisc(newfont.latex(), latex())); if (newfont.language() == language() && toggleall) - if (language() == document_language) - setLanguage(default_language); - else - setLanguage(document_language); + setLanguage(document_language); else if (newfont.language() != ignore_language) setLanguage(newfont.language()); @@ -406,8 +403,7 @@ string const LyXFont::stateText(BufferParams * params) const ost << _("Latex ") << _(GUIMiscNames[latex()]) << ", "; if (bits == inherit) ost << _("Default") << ", "; - if (!params || (language() != params->language_info && - language()->lang() != "default")) + if (!params || (language() != params->language_info)) ost << _("Language: ") << _(language()->display().c_str()); string buf(ost.str().c_str()); @@ -656,8 +652,7 @@ 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() && - language()->lang() != "default") { + if (orgfont.language() != language()) { if (language()) os << "\\lang " << language()->lang() << "\n"; else @@ -674,8 +669,7 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base, int count = 0; bool env = false; - if (language() != base.language() && language() != prev.language() && - language()->lang() != "default") { + if (language() != base.language() && language() != prev.language()) { if (isRightToLeft() != prev.isRightToLeft()) { if (isRightToLeft()) { os << "\\R{"; @@ -767,8 +761,7 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base, int count = 0; bool env = false; - if (language() != base.language() && language() != next.language() - && language()->lang() != "default") { + if (language() != base.language() && language() != next.language()) { os << "}"; ++count; env = true; // Size change need not bother about closing env. diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 662acd8a0f..abda8b84dd 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -3104,13 +3104,14 @@ void LyXFunc::MenuNew(bool fromTemplate) } } } else { - s = AddPath(lyxrc.document_path, - "newfile" + tostr(++newfile_number)); + s = lyxrc.document_path + + "newfile" + tostr(++newfile_number) + ".lyx"; FileInfo fi(s); while (bufferlist.exists(s) || fi.readable()) { ++newfile_number; - s = AddPath(lyxrc.document_path, - "newfile" + tostr(newfile_number)); + s = lyxrc.document_path + + "newfile" + tostr(newfile_number) + + ".lyx"; fi.newFile(s); } } diff --git a/src/lyxrc.C b/src/lyxrc.C index fc7aba494e..f20a3cdf63 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -159,6 +159,7 @@ enum LyXRCTags { RC_CONVERTER, RC_VIEWER, RC_NEW_ASK_FILENAME, + RC_DEFAULT_LANGUAGE, RC_LAST }; @@ -184,6 +185,7 @@ keyword_item lyxrcTags[] = { { "\\custom_export_command", RC_CUSTOM_EXPORT_COMMAND }, { "\\custom_export_format", RC_CUSTOM_EXPORT_FORMAT }, { "\\date_insert_format", RC_DATE_INSERT_FORMAT }, + { "\\default_language", RC_DEFAULT_LANGUAGE }, { "\\default_papersize", RC_DEFAULT_PAPERSIZE }, { "\\display_shortcuts", RC_DISPLAY_SHORTCUTS }, { "\\docbook_to_dvi_command", RC_DOCBOOK_TO_DVI_COMMAND }, @@ -383,6 +385,7 @@ void LyXRC::setDefaults() { language_auto_end = true; language_command_begin = "\\selectlanguage{$$lang}"; language_command_end = "\\selectlanguage{$$lang}"; + default_language = "english"; /// new_ask_filename = false; @@ -1134,6 +1137,10 @@ int LyXRC::read(string const & filename) Formats::SetViewer(format, command); break; } + case RC_DEFAULT_LANGUAGE: + if ( lexrc.next()) + default_language = lexrc.GetString(); + break; case RC_LAST: break; // this is just a dummy } @@ -1565,6 +1572,8 @@ void LyXRC::output(ostream & os) const os << "\\use_gui " << tostr(use_gui) << "\n"; case RC_NEW_ASK_FILENAME: os << "\\new_ask_filename " << tostr(new_ask_filename) << "\n"; + case RC_DEFAULT_LANGUAGE: + os << "\\default_language " << default_language << "\n"; } os.flush(); } diff --git a/src/lyxrc.h b/src/lyxrc.h index 77a292e953..5db59f3198 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -261,6 +261,8 @@ public: string docbook_to_pdf_command; /// bool new_ask_filename; + /// + string default_language; }; /// diff --git a/src/paragraph.C b/src/paragraph.C index b28a66e4d8..2c99a748d2 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -3877,7 +3877,7 @@ LyXParagraph::getParLanguage(BufferParams const & bparams) const if (size() > 0) { Language const * lang = GetFirstFontSettings().language(); - if (lang->lang() == "default") + if (lang->lang() == default_language->lang()) return bparams.language_info; return lang; } else if (previous) diff --git a/src/text.C b/src/text.C index 5f3e19075d..e9ef5677e6 100644 --- a/src/text.C +++ b/src/text.C @@ -502,7 +502,6 @@ 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, @@ -614,7 +613,6 @@ 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, @@ -3403,9 +3401,10 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset, y_top += lyxfont::ascent('x', GetFont(bview->buffer(), row_ptr->par(), 0)); - - pain.line(0, y_offset + y_top, - ww, y_offset + y_top, + int w = (inset_owner ? inset_owner->width(bview, font) : ww); + int xp = (inset_owner ? x : 0); + pain.line(xp, y_offset + y_top, + w, y_offset + y_top, LColor::topline, Painter::line_solid, Painter::line_thick); @@ -3583,8 +3582,10 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset, /* draw a bottom line */ y_bottom -= lyxfont::ascent('x', GetFont(bview->buffer(), par, par->Last() - 1)); - pain.line(0, y_offset + y_bottom, - ww, y_offset + y_bottom, + int w = (inset_owner ? inset_owner->width(bview, font) : ww); + int xp = (inset_owner ? x : 0); + pain.line(xp, y_offset + y_bottom, + w, y_offset + y_bottom, LColor::topline, Painter::line_solid, Painter::line_thick); y_bottom -= lyxfont::ascent('x', GetFont(bview->buffer(),