X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXRC.cpp;h=94e78376f5a3fbe0de9abe829df5eb7616bb346e;hb=52019917f411c72ffa6fd8200bc5a89d286d87be;hp=d4bac81278c0682b98568ffa6a196dd5a7e8f085;hpb=c671740d8323c99526f0d3d2e9bc34b6accc65b6;p=lyx.git diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index d4bac81278..94e78376f5 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -18,6 +18,7 @@ #include "LyXRC.h" +#include "BufferList.h" #include "ColorSet.h" #include "Converter.h" #include "FontEnums.h" @@ -58,7 +59,7 @@ namespace { // The format should also be updated in configure.py, and conversion code // should be added to prefs2prefs_prefs.py. -static unsigned int const LYXRC_FILEFORMAT = 19; // rgh: remove print support +static unsigned int const LYXRC_FILEFORMAT = 21; // spitz: jbibtex_alternatives // when adding something to this array keep it sorted! LexerKeyword lyxrcTags[] = { @@ -123,6 +124,7 @@ LexerKeyword lyxrcTags[] = { { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES }, { "\\index_command", LyXRC::RC_INDEX_COMMAND }, { "\\input", LyXRC::RC_INPUT }, + { "\\jbibtex_alternatives", LyXRC::RC_JBIBTEX_ALTERNATIVES }, { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND }, { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND }, { "\\kbmap", LyXRC::RC_KBMAP }, @@ -188,6 +190,8 @@ LexerKeyword lyxrcTags[] = { { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH }, { "\\ui_file", LyXRC::RC_UIFILE }, { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE }, + { "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH }, + { "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN }, { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS }, { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE }, { "\\use_qimage", LyXRC::RC_USE_QIMAGE }, @@ -233,7 +237,7 @@ void LyXRC::setDefaults() default_view_format = "pdf2"; default_otf_view_format = "pdf4"; chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"; - bibtex_command = "bibtex"; + bibtex_command = "automatic"; fontenc = "default"; index_command = "makeindex -c -q"; nomencl_command = "makeindex -s nomencl.ist"; @@ -261,7 +265,7 @@ void LyXRC::setDefaults() auto_reset_options = false; plaintext_linelen = 65; mouse_wheel_speed = 1.0; - num_lastfiles = maxlastfiles; + num_lastfiles = 20; check_lastfiles = true; use_lastfilepos = true; load_session = false; @@ -315,6 +319,8 @@ void LyXRC::setDefaults() preview_hashed_labels = false; preview_scale_factor = 1.0; use_converter_cache = true; + use_converter_needauth_forbidden = true; + use_converter_needauth = true; use_system_colors = false; use_tooltip = true; use_pixmap_cache = false; @@ -334,6 +340,7 @@ void LyXRC::setDefaults() full_screen_toolbars = true; full_screen_tabbar = true; full_screen_menubar = true; + full_screen_statusbar = true; full_screen_scrollbar = true; full_screen_width = 700; @@ -567,6 +574,12 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) } break; + case RC_JBIBTEX_ALTERNATIVES: + if (lexrc.next(true)) { + jbibtex_alternatives.insert(lexrc.getString()); + } + break; + case RC_INDEX_ALTERNATIVES: if (lexrc.next(true)) { index_alternatives.insert(lexrc.getString()); @@ -603,6 +616,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) case RC_SCREEN_ZOOM: lexrc >> zoom; + if (zoom < 10) + zoom = 10; break; case RC_GEOMETRY_SESSION: @@ -631,45 +646,33 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) break; case RC_DOCUMENTPATH: - if (lexrc.next()) { + if (lexrc.next()) document_path = os::internal_path(lexrc.getString()); - document_path = expandPath(document_path); - } break; case RC_EXAMPLEPATH: - if (lexrc.next()) { + if (lexrc.next()) example_path = os::internal_path(lexrc.getString()); - example_path = expandPath(example_path); - } break; case RC_TEMPLATEPATH: - if (lexrc.next()) { + if (lexrc.next()) template_path = os::internal_path(lexrc.getString()); - template_path = expandPath(template_path); - } break; case RC_TEMPDIRPATH: - if (lexrc.next()) { + if (lexrc.next()) tempdir_path = os::internal_path(lexrc.getString()); - tempdir_path = expandPath(tempdir_path); - } break; case RC_THESAURUSDIRPATH: - if (lexrc.next()) { + if (lexrc.next()) thesaurusdir_path = os::internal_path(lexrc.getString()); - thesaurusdir_path = expandPath(thesaurusdir_path); - } break; case RC_HUNSPELLDIR_PATH: - if (lexrc.next()) { + if (lexrc.next()) hunspelldir_path = os::internal_path(lexrc.getString()); - hunspelldir_path = expandPath(hunspelldir_path); - } break; case RC_USELASTFILEPOS: @@ -810,10 +813,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) break; case RC_SERVERPIPE: - if (lexrc.next()) { + if (lexrc.next()) lyxpipes = os::internal_path(lexrc.getString()); - lyxpipes = expandPath(lyxpipes); - } break; case RC_CURSOR_FOLLOWS_SCROLLBAR: @@ -898,10 +899,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) lexrc >> save_origin; break; case RC_BACKUPDIR_PATH: - if (lexrc.next()) { + if (lexrc.next()) backupdir_path = os::internal_path(lexrc.getString()); - backupdir_path = expandPath(backupdir_path); - } break; case RC_DEFAULT_DECIMAL_POINT: lexrc >> default_decimal_point; @@ -995,16 +994,17 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) case RC_VIEWER: { string format, command; lexrc >> format >> command; - formats.setViewer(format, command); + theFormats().setViewer(format, command); break; } case RC_FILEFORMAT: { bool ok = true; - string format, extensions, prettyname, shortcut; + string format, extensions, shortcut; + docstring prettyname; if (!(lexrc >> format >> extensions)) ok = false; if (ok && lexrc.next(true)) - prettyname = lexrc.getString(); + prettyname = lexrc.getDocString(); else ok = false; if (ok) @@ -1045,25 +1045,27 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) if (theConverters().formatIsUsed(format)) LYXERR0("Can't delete format " << format); else - formats.erase(format); + theFormats().erase(format); } else { - formats.add(format, extensions, prettyname, + theFormats().add(format, extensions, prettyname, shortcut, viewer, editor, mime, flgs); } break; } case RC_VIEWER_ALTERNATIVES: { string format, command; - lexrc >> format; - lexrc >> command; - viewer_alternatives[format].insert(command); + if ((lexrc >> format) && lexrc.next(true)) { + command = lexrc.getString(); + viewer_alternatives[format].insert(command); + } break; } case RC_EDITOR_ALTERNATIVES: { string format, command; - lexrc >> format; - lexrc >> command; - editor_alternatives[format].insert(command); + if ((lexrc >> format) && lexrc.next(true)) { + command = lexrc.getString(); + editor_alternatives[format].insert(command); + } break; } @@ -1121,6 +1123,12 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) case RC_USE_CONVERTER_CACHE: lexrc >> use_converter_cache; break; + case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN: + lexrc >> use_converter_needauth_forbidden; + break; + case RC_USE_CONVERTER_NEEDAUTH: + lexrc >> use_converter_needauth; + break; case RC_CONVERTER_CACHE_MAXAGE: lexrc >> converter_cache_maxage; break; @@ -1219,8 +1227,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) } /// Update converters data-structures - theConverters().update(formats); + theConverters().update(theFormats()); theConverters().buildGraph(); + theBufferList().invalidateConverterCache(); return ReadOK; } @@ -1439,6 +1448,18 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_JBIBTEX_ALTERNATIVES: { + CommandSet::const_iterator it = jbibtex_alternatives.begin(); + CommandSet::const_iterator end = jbibtex_alternatives.end(); + for ( ; it != end; ++it) { + if (ignore_system_lyxrc + || !system_lyxrc.jbibtex_alternatives.count(*it)) + os << "\\jbibtex_alternatives \"" + << *it << "\"\n"; + } + if (tag != RC_LAST) + break; + } case RC_INDEX_ALTERNATIVES: { CommandSet::const_iterator it = index_alternatives.begin(); CommandSet::const_iterator end = index_alternatives.end(); @@ -1601,6 +1622,24 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; + case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN: + if (ignore_system_lyxrc || + use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) { + os << "\\use_converter_needauth_forbidden " + << convert(use_converter_needauth_forbidden) << '\n'; + } + if (tag != RC_LAST) + break; + + case RC_USE_CONVERTER_NEEDAUTH: + if (ignore_system_lyxrc || + use_converter_needauth != system_lyxrc.use_converter_needauth) { + os << "\\use_converter_needauth " + << convert(use_converter_needauth) << '\n'; + } + if (tag != RC_LAST) + break; + case RC_CONVERTER_CACHE_MAXAGE: if (ignore_system_lyxrc || converter_cache_maxage != system_lyxrc.converter_cache_maxage) { @@ -2519,10 +2558,10 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c case RC_FILEFORMAT: // New/modified formats - for (Formats::const_iterator cit = formats.begin(); - cit != formats.end(); ++cit) { + for (Formats::const_iterator cit = theFormats().begin(); + cit != theFormats().end(); ++cit) { Format const * format = - system_formats.getFormat(cit->name()); + theSystemFormats().getFormat(cit->name()); if (!format || format->extensions() != cit->extensions() || format->prettyname() != cit->prettyname() || @@ -2535,7 +2574,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c format->mime() != cit->mime()) { os << "\\format \"" << cit->name() << "\" \"" << cit->extensions() << "\" \"" - << cit->prettyname() << "\" \"" + << to_utf8(cit->prettyname()) << "\" \"" << cit->shortcut() << "\" \"" << escapeCommand(cit->viewer()) << "\" \"" << escapeCommand(cit->editor()) << "\" \""; @@ -2555,9 +2594,9 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } // Look for deleted formats - for (Formats::const_iterator cit = system_formats.begin(); - cit != system_formats.end(); ++cit) - if (!formats.getFormat(cit->name())) + for (Formats::const_iterator cit = theSystemFormats().begin(); + cit != theSystemFormats().end(); ++cit) + if (!theFormats().getFormat(cit->name())) os << "\\format \"" << cit->name() << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n"; if (tag != RC_LAST) @@ -2710,6 +2749,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_ACCEPT_COMPOUND: if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound) if (theSpellChecker()) theSpellChecker()->advanceChangeNumber(); + // fall through case LyXRC::RC_ALT_LANG: case LyXRC::RC_PLAINTEXT_LINELEN: case LyXRC::RC_AUTOCORRECTION_MATH: @@ -2753,6 +2793,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) if (path.exists() && path.isDirectory()) package().document_dir() = FileName(lyxrc.document_path); } + // fall through case LyXRC::RC_EDITOR_ALTERNATIVES: case LyXRC::RC_ESC_CHARS: case LyXRC::RC_EXAMPLEPATH: @@ -2764,6 +2805,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_INDEX_ALTERNATIVES: case LyXRC::RC_INDEX_COMMAND: case LyXRC::RC_JBIBTEX_COMMAND: + case LyXRC::RC_JBIBTEX_ALTERNATIVES: case LyXRC::RC_JINDEX_COMMAND: case LyXRC::RC_NOMENCL_COMMAND: case LyXRC::RC_INPUT: @@ -2794,6 +2836,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) // Resets python path support::os::python(true); } + // fall through case LyXRC::RC_PREVIEW: case LyXRC::RC_PREVIEW_HASHED_LABELS: case LyXRC::RC_PREVIEW_SCALE_FACTOR: @@ -2820,6 +2863,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_SPELLCHECKER: if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker) setSpellChecker(); + // fall through case LyXRC::RC_SPELLCHECK_CONTINUOUSLY: case LyXRC::RC_SPELLCHECK_NOTES: case LyXRC::RC_SPLITINDEX_COMMAND: @@ -2830,12 +2874,15 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) { os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths); } + // fall through case LyXRC::RC_TEXINPUTS_PREFIX: case LyXRC::RC_THESAURUSDIRPATH: case LyXRC::RC_UIFILE: case LyXRC::RC_USER_EMAIL: case LyXRC::RC_USER_NAME: case LyXRC::RC_USE_CONVERTER_CACHE: + case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN: + case LyXRC::RC_USE_CONVERTER_NEEDAUTH: case LyXRC::RC_USE_SYSTEM_COLORS: case LyXRC::RC_USE_TOOLTIP: case LyXRC::RC_USE_PIXMAP_CACHE: @@ -2928,6 +2975,14 @@ string const LyXRC::getDescription(LyXRCTags tag) case RC_CONVERTER: break; + case RC_CONVERTER_NEEDAUTH_FORBIDDEN: + str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects."); + break; + + case RC_CONVERTER_NEEDAUTH: + str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects."); + break; + case RC_COPIER: break; @@ -3069,8 +3124,7 @@ string const LyXRC::getDescription(LyXRCTags tag) break; case RC_MOUSE_WHEEL_SPEED: - str = bformat(_("The scrolling speed of the mouse wheel."), - maxlastfiles); + str = _("The scrolling speed of the mouse wheel."); break; case RC_COMPLETION_POPUP_DELAY: