]> git.lyx.org Git - lyx.git/commitdiff
Various fixes, removed "default" language, inserted new lyxrc tag
authorJürgen Vigna <jug@sad.it>
Wed, 27 Sep 2000 15:23:24 +0000 (15:23 +0000)
committerJürgen Vigna <jug@sad.it>
Wed, 27 Sep 2000 15:23:24 +0000 (15:23 +0000)
default_language.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1047 a592a061-630c-0410-9148-cb99ea01b6c8

20 files changed:
ChangeLog
src/bufferparams.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormParagraph.C
src/insets/insetlabel.C
src/insets/insetquotes.C
src/insets/insetref.C
src/insets/insettext.C
src/insets/insettext.h
src/insets/inseturl.C
src/intl.C
src/language.C
src/language.h
src/lyx_gui.C
src/lyxfont.C
src/lyxfunc.C
src/lyxrc.C
src/lyxrc.h
src/paragraph.C
src/text.C

index ae2ff75b9fc8ca02df8e49c3e3f81a51b602aef4..c4b0f7cdba10bf848fe92a0e9830f88fbe800066 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2000-09-27  Juergen Vigna  <jug@sad.it>
+
+       * 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  <larsbj@lyx.org>
 
        * src/Bullet.h: changed type of font, character and size to int
index 0a0a51ee94f40342bbc2f87c862c0eec2e343841..1059010789b2d7e4514e9eaeabbb13949998d3df 100644 (file)
@@ -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 `"
index 1cd89f50c2b958938063fdfe5b8ae6ddadc3a313..05e80ab334918372c23f7a63b79fd4c381f29cec 100644 (file)
@@ -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());
index 3dfdc68f96abc9ffe2d483fc6aa78223d4a97ec9..9fe672b52c8605f53644f14b88cabb6600c652c5 100644 (file)
@@ -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,
index 8e1bbe75f4ecf181bfb98b94e9fb6d2d775d0663..df69302a406af73db7f9b02395138e5ec533674a 100644 (file)
@@ -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;
index 8444ee0aa9819e67dd4a2e56c209fb3bee75ff89..93104a4a43ac55f809308bd3fac748efe1d63aa5 100644 (file)
@@ -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) {
index 01008adad2e5ce81591a80e8ac3c4e7dd0d3e95e..ca83db0a0e9c5bb1c5a9aedeb0c04eb7eb56e865 100644 (file)
@@ -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;
index 3b224b9b4945b1f7583beac871109e154be621c4..a22efa54664d80ec92768762fc8338c4c8c47c4b 100644 (file)
@@ -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;
index 24c72ca05452cb6d93a7bd887866f02f3521a592..d1be15fc08a52708069e677174b3aeb3dca9d2ac 100644 (file)
@@ -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 *);
     ///
index ab8aec39dfe7aad63de0b2eb7b83c5e014461046..3f6cb00412fb1de1d2ce21d3dd62cbb577547976 100644 (file)
@@ -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() << "]";
index c6292d7ddcf6b324a5d58564ac4ba32967029caa..28bcae1716054c9dda55d0ad6ef86e0dbb8ad0a8 100644 (file)
@@ -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());
index cffd06447f68b80ae00ea5c2c0271758acee5523..963c9790554f72f1e2e20b9d42345dc9c20843c3 100644 (file)
 #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 <zrubi@k2.jozsef.kando.hu>,
           "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];
 }
 
 
index 135fac5921607a0d254444154c551a0a66d1e116..7015a59f79c7d120cb7c7de14844f12076c8de2f 100644 (file)
@@ -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_;
index 8c53ad0b893af6bbfcc3ad324103e9625bafb672..80e99b21f0d9b2b90f1ec37f8c948898a27deb97 100644 (file)
@@ -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"));
index 60cd2fe81d6cd70972293b84a4366da5f66a4836..3a70535afe5ee95f17517844f8eb1dd6290d9a13 100644 (file)
@@ -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.
index 662acd8a0f44c2fb2f17c67e9b1c05e04d8a2300..abda8b84dd46b20279170baecd893418c1716679 100644 (file)
@@ -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);
                }
        }
index fc7aba494eaab99ab36bb6ded700b5158a1bfbe4..f20a3cdf6354dd97c585965d7a9a4ed004434640 100644 (file)
@@ -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();
 }
index 77a292e95365f2292561c1845ebd55ccacd2d2d8..5db59f319899e962e1b6ccfb2de7454fb64a2ed9 100644 (file)
@@ -261,6 +261,8 @@ public:
        string docbook_to_pdf_command;
        ///
        bool new_ask_filename;
+       ///
+       string default_language;
 };
 
 ///
index b28a66e4d80bab1f967f0bdcf92a5840a1f4c00c..2c99a748d2d854487138a8b7b28286bece7d51b0 100644 (file)
@@ -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)
index 5f3e19075db868636e72942ca22cda2460652475..e9ef5677e6cb37ca4f54771df4950527289a4bc1 100644 (file)
@@ -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(),