]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrc.C
More fixes to insettabular/text (and some missing features added).
[lyx.git] / src / lyxrc.C
index db3b8c70bb9769bcc3e05a6cf95dc8f1775a8899..58eda541fb822f565b9c41c07e482a9798352745 100644 (file)
@@ -78,6 +78,7 @@ keyword_item lyxrcTags[] = {
        { "\\kbmap", LyXRC::RC_KBMAP },
        { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
        { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
+       { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
        { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
        { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
        { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
@@ -152,6 +153,8 @@ LyXRC::LyXRC()
 
 
 void LyXRC::setDefaults() {
+       bind_file = "cua";
+       hasBindFile = false;
        ui_file = "default";
        // Get printer from the environment. If fail, use default "",
        // assuming that everything is set up correctly.
@@ -221,7 +224,6 @@ void LyXRC::setDefaults() {
        isp_use_pers_dict = false;
        isp_use_esc_chars = false;
        use_kbmap = false;
-       hasBindFile = false;
        rtl_support = false;
        auto_number = true;
        mark_foreign_language = true;
@@ -238,6 +240,7 @@ void LyXRC::setDefaults() {
        date_insert_format = "%A, %e %B %Y";
        show_banner = true;
        cursor_follows_scrollbar = false;
+       label_init_length = 3;
 
        /// These variables are not stored on disk (perhaps they
        // should be moved from the LyXRC class).
@@ -258,12 +261,14 @@ int LyXRC::ReadBindFile(string const & name)
        return result;
 }
 
+void LyXRC::readBindFileIfNeeded()
+{
+       if (!hasBindFile)
+               ReadBindFile(bind_file);
+}
 
 int LyXRC::read(string const & filename)
-{
-       // Default bindfile.
-       static string const bindFile("cua");
-       
+{      
        LyXLex lexrc(lyxrcTags, lyxrcCount);
        if (lyxerr.debugging(Debug::PARSER))
                lexrc.printTable(lyxerr);
@@ -304,13 +309,16 @@ int LyXRC::read(string const & filename)
                case RC_BINDFILE:                     // RVDK_PATCH_5
                        if (lexrc.next()) {
                                string tmp(lexrc.GetString());
-                               if (bind_file.empty()) {
-                                       // we only need the name of the first
-                                       // bind file since that (usually)
-                                       // includes several others.
+                               if (hasBindFile)
+                                       // We are already in the
+                                       // "actually read bind file"
+                                       // mode.
+                                       ReadBindFile(tmp);
+                               else
+                                       // We are still in the "just
+                                       // remember the name of the
+                                       // bind file" mode.
                                        bind_file = tmp;
-                               }
-                               ReadBindFile(tmp);
                        }
                        break;
                        
@@ -676,10 +684,8 @@ int LyXRC::read(string const & filename)
                        // we should not do an explicit binding before
                        // loading a bind file. So, in this case, load
                        // the default bind file.
-                       if (!hasBindFile) {
-                               bind_file = bindFile;
-                               ReadBindFile();
-                       }
+                       readBindFileIfNeeded();
+
                        // !!!chb, dynamic key binding...
                        int action, res = 0;
                        string seq, cmd;
@@ -901,6 +907,11 @@ int LyXRC::read(string const & filename)
                                default_language = lexrc.GetString();
                        break;
 
+               case RC_LABEL_INIT_LENGTH:
+                       if (lexrc.next())
+                               label_init_length = lexrc.GetInteger();
+                       break;
+
                case RC_LAST: break; // this is just a dummy
                }
        }
@@ -1062,7 +1073,12 @@ void LyXRC::output(ostream & os) const
                        os << "\\date_insert_format \"" << date_insert_format
                           << "\"\n";
                }
-               
+       case RC_LABEL_INIT_LENGTH:
+               if (label_init_length != system_lyxrc.label_init_length) {
+                       os << "\\label_init_length " << label_init_length
+                          << "\n";
+               }
+
                os << "\n#\n"
                   << "# SCREEN & FONTS SECTION ############################\n"
                   << "#\n\n";
@@ -1895,6 +1911,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
        case RC_DEFAULT_LANGUAGE:
                str = N_("New documents will be assigned this language.");
                break;
+
+       case RC_LABEL_INIT_LENGTH:
+               str = N_("Maximum number of words in the initialization string for a new label");
+               break;
                
        default:
                break;