X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXRC.cpp;h=ece84acc8e8d97bd914471cc2c88c0701fff99bf;hb=2098f1d8c20d51e63e670bcdc9da8996068975bf;hp=97259a7cde6c99da9db5dcac57836112fd1e43f2;hpb=3f170ec08c934fbe8a5f7f56d7216c44578b007b;p=lyx.git diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 97259a7cde..ece84acc8e 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -277,7 +277,13 @@ void LyXRC::setDefaults() backupdir_path.erase(); display_graphics = true; // Spellchecker settings: +#if defined(USE_ASPELL) spellchecker = "aspell"; +#elif defined(USE_HUNSPELL) + spellchecker = "hunspell"; +#else + spellchecker = "aspell"; +#endif spellchecker_accept_compound = false; spellcheck_continuously = false; use_kbmap = false; @@ -1044,13 +1050,13 @@ int LyXRC::read(Lexer & lexrc) format = lexrc.getString(); if (lexrc.eatLine()) command = lexrc.getString(); - viewer_alternatives.push_back(make_pair(format, command)); + viewer_alternatives[format].insert(command); break; } case RC_EDITOR_ALTERNATIVES: { string format, command; lexrc >> format >> command; - editor_alternatives.push_back(make_pair(format, command)); + editor_alternatives[format].insert(command); break; } @@ -1393,8 +1399,8 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; case RC_BIBTEX_ALTERNATIVES: { - set::const_iterator it = bibtex_alternatives.begin(); - set::const_iterator end = bibtex_alternatives.end(); + CommandSet::const_iterator it = bibtex_alternatives.begin(); + CommandSet::const_iterator end = bibtex_alternatives.end(); for ( ; it != end; ++it) { if (ignore_system_lyxrc || !system_lyxrc.bibtex_alternatives.count(*it)) @@ -1419,8 +1425,8 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; case RC_INDEX_ALTERNATIVES: { - set::const_iterator it = index_alternatives.begin(); - set::const_iterator end = index_alternatives.end(); + CommandSet::const_iterator it = index_alternatives.begin(); + CommandSet::const_iterator end = index_alternatives.end(); for ( ; it != end; ++it) { if (ignore_system_lyxrc || !system_lyxrc.index_alternatives.count(*it)) @@ -2491,26 +2497,56 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n"; if (tag != RC_LAST) break; - case RC_VIEWER_ALTERNATIVES: - if (ignore_system_lyxrc || - viewer_alternatives != system_lyxrc.viewer_alternatives) { - for (vector >::const_iterator it = viewer_alternatives.begin(); - it != viewer_alternatives.end(); ++it) - os << "\\viewer_alternatives " - << it->first << " " << it->second << "\n"; + case RC_VIEWER_ALTERNATIVES: { + Alternatives::const_iterator it = viewer_alternatives.begin(); + Alternatives::const_iterator const en = viewer_alternatives.end(); + Alternatives::const_iterator const sysend = + system_lyxrc.viewer_alternatives.end(); + for (; it != en; ++it) { + string const & fmt = it->first; + CommandSet const & cmd = it->second; + CommandSet::const_iterator sit = cmd.begin(); + CommandSet::const_iterator const sen = cmd.end(); + Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ? + system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case + system_lyxrc.viewer_alternatives.find(fmt); + for (; sit != sen; ++sit) { + string const & cmd = *sit; + if (ignore_system_lyxrc + || sysfmt == sysend // format not found + || sysfmt->second.count(cmd) == 0 // this command not found + ) + os << "\\viewer_alternatives " << fmt << " " << cmd << "\n"; + } } if (tag != RC_LAST) break; - case RC_EDITOR_ALTERNATIVES: - if (ignore_system_lyxrc || - editor_alternatives != system_lyxrc.editor_alternatives) { - for (vector >::const_iterator it = editor_alternatives.begin(); - it != editor_alternatives.end(); ++it) - os << "\\editor_alternatives " - << it->first << " " << it->second << "\n"; + } + case RC_EDITOR_ALTERNATIVES: { + Alternatives::const_iterator it = editor_alternatives.begin(); + Alternatives::const_iterator const en = editor_alternatives.end(); + Alternatives::const_iterator const sysend = + system_lyxrc.editor_alternatives.end(); + for (; it != en; ++it) { + string const & fmt = it->first; + CommandSet const & cmd = it->second; + CommandSet::const_iterator sit = cmd.begin(); + CommandSet::const_iterator const sen = cmd.end(); + Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ? + system_lyxrc.editor_alternatives.begin() : // we won't use it in this case + system_lyxrc.editor_alternatives.find(fmt); + for (; sit != sen; ++sit) { + string const & cmd = *sit; + if (ignore_system_lyxrc + || sysfmt == sysend // format not found + || sysfmt->second.count(cmd) == 0 // this command not found + ) + os << "\\editor_alternatives " << fmt << " " << cmd << "\n"; + } } if (tag != RC_LAST) break; + } case RC_DEFAULT_VIEW_FORMAT: if (ignore_system_lyxrc || default_view_format != system_lyxrc.default_view_format) { @@ -2741,6 +2777,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_USE_PIXMAP_CACHE: case LyXRC::RC_USE_SPELL_LIB: case LyXRC::RC_VIEWDVI_PAPEROPTION: + case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON: case LyXRC::RC_SORT_LAYOUTS: case LyXRC::RC_FULL_SCREEN_LIMIT: case LyXRC::RC_FULL_SCREEN_SCROLLBAR: