X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXRC.cpp;h=94e78376f5a3fbe0de9abe829df5eb7616bb346e;hb=2a0e4c199c4f18d80ec5a2ab452f3cf18eafc56c;hp=c8b69d1ec50b1d49f39124bdc079a261acabfa6c;hpb=9b64d7bd24d606490c344a548fff4b93f837ccaf;p=lyx.git diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index c8b69d1ec5..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"; @@ -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; @@ -568,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()); @@ -982,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) @@ -1032,9 +1045,9 @@ 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; @@ -1110,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; @@ -1208,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; } @@ -1428,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(); @@ -1590,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) { @@ -2508,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() || @@ -2524,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()) << "\" \""; @@ -2544,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) @@ -2755,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: @@ -2830,6 +2881,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) 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: @@ -2922,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;