X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXRC.cpp;h=6bc28e960a979dd3a7d73fefc773848fe2e1d9d2;hb=33b7088719c3c72e81483e3a82a321971403f505;hp=cfd296a9858ed17f803a4f6b972221558d4132d9;hpb=2b1515a9368a25d4f54471ebaf0557305b7baa18;p=lyx.git diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index cfd296a985..6bc28e960a 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -28,23 +28,22 @@ #include "Lexer.h" #include "LyX.h" #include "Mover.h" -#include "Session.h" #include "SpellChecker.h" #include "version.h" -#include "graphics/GraphicsTypes.h" - #include "support/convert.h" #include "support/debug.h" #include "support/environment.h" #include "support/FileName.h" #include "support/filetools.h" -#include "support/gettext.h" #include "support/lstrings.h" #include "support/os.h" #include "support/Package.h" #include "support/TempFile.h" -#include "support/userinfo.h" + +#ifdef USE_MACOSX_PACKAGING +#include "support/AppleSupport.h" +#endif #include #include @@ -61,7 +60,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 = 29; // spitz: remove \\date_insert_format +static unsigned int const LYXRC_FILEFORMAT = 36; // rkh: spellcheck_continuously default // when adding something to this array keep it sorted! LexerKeyword lyxrcTags[] = { { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND }, @@ -78,6 +77,9 @@ LexerKeyword lyxrcTags[] = { { "\\bind_file", LyXRC::RC_BINDFILE }, { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES }, { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND }, + { "\\citation_search", LyXRC::RC_CITATION_SEARCH }, + { "\\citation_search_pattern", LyXRC::RC_CITATION_SEARCH_PATTERN }, + { "\\citation_search_view", LyXRC::RC_CITATION_SEARCH_VIEW }, { "\\close_buffer_with_last_view", LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW }, { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT }, { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY }, @@ -92,10 +94,12 @@ LexerKeyword lyxrcTags[] = { { "\\converter", LyXRC::RC_CONVERTER }, { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE }, { "\\copier", LyXRC::RC_COPIER }, + { "\\ct_additions_underlined", LyXRC::RC_CT_ADDITIONS_UNDERLINED }, + { "\\ct_markup_copied", LyXRC::RC_CT_MARKUP_COPIED }, { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR }, { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH }, { "\\def_file", LyXRC::RC_DEFFILE }, - { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT }, + { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_SEP }, { "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT }, { "\\default_otf_view_format", LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT }, { "\\default_platex_view_format", LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT }, @@ -106,6 +110,7 @@ LexerKeyword lyxrcTags[] = { { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES }, { "\\escape_chars", LyXRC::RC_ESC_CHARS }, { "\\example_path", LyXRC::RC_EXAMPLEPATH }, + { "\\experimental:bookmarks_visibility", LyXRC::RC_BOOKMARKS_VISIBILITY }, { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE }, { "\\format", LyXRC::RC_FILEFORMAT }, { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI }, @@ -159,6 +164,7 @@ LexerKeyword lyxrcTags[] = { { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG }, { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG }, { "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND }, + { "\\respect_os_kbd_language", LyXRC::RC_RESPECT_OS_KBD_LANGUAGE }, { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED }, { "\\save_origin", LyXRC::RC_SAVE_ORIGIN }, { "\\screen_dpi", LyXRC::RC_SCREEN_DPI }, @@ -200,6 +206,7 @@ LexerKeyword lyxrcTags[] = { { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS }, { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP }, { "\\user_email", LyXRC::RC_USER_EMAIL }, + { "\\user_initials", LyXRC::RC_USER_INITIALS }, { "\\user_name", LyXRC::RC_USER_NAME }, { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION }, // compatibility with versions older than 1.4.0 only @@ -279,6 +286,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) // format prior to 2.0 and introduction of format tag unsigned int rc_format = 0; +#ifdef USE_MACOSX_PACKAGING + open_buffers_in_tabs = appleUserTabbingPreferenceAlways(); +#endif + while (lexrc.isOK()) { // By using two switches we take advantage of the compiler // telling us if we have missed a LyXRCTags element in @@ -639,13 +650,17 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) lexrc.printError("Missing color tag."); break; } - string lyx_name = lexrc.getString(); + string const lyx_name = lexrc.getString(); if (!lexrc.next()) { lexrc.printError("Missing color name for color: `$$Token'"); break; } - string x11_name = lexrc.getString(); + string const x11_name = lexrc.getString(); + + string x11_darkname = x11_name; + if (lexrc.next()) + x11_darkname = lexrc.getString(); ColorCode const col = lcolor.getFromLyXName(lyx_name); @@ -654,8 +669,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) col == Color_ignore) break; - if (!lcolor.setColor(col, x11_name)) + if (!lcolor.setColor(col, x11_name, x11_darkname)) LYXERR0("Bad lyxrc set_color for " << lyx_name); + LYXERR(Debug::LYXRC, "Set " << lyx_name << "(" << col << ") to " + << x11_name << " and " << x11_darkname); break; } @@ -665,8 +682,35 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) break; case RC_SERVERPIPE: + if (lexrc.next()) { + string userdir = package().user_support().absFileName(); + if (userdir.back() == '/') + userdir.pop_back(); + lyxpipes = subst(os::internal_path(lexrc.getString()), "$$UserDir", + userdir); + } + break; + + case RC_CITATION_SEARCH: + lexrc >> citation_search; + break; + + case RC_CITATION_SEARCH_PATTERN: if (lexrc.next()) - lyxpipes = os::internal_path(lexrc.getString()); + citation_search_pattern = lexrc.getString(); + break; + + case RC_CITATION_SEARCH_VIEW: + if (lexrc.next()) + citation_search_view = lexrc.getString(); + break; + + case RC_CT_ADDITIONS_UNDERLINED: + lexrc >> ct_additions_underlined; + break; + + case RC_CT_MARKUP_COPIED: + lexrc >> ct_markup_copied; break; case RC_CURSOR_FOLLOWS_SCROLLBAR: @@ -751,8 +795,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) if (lexrc.next()) backupdir_path = os::internal_path(lexrc.getString()); break; - case RC_DEFAULT_DECIMAL_POINT: - lexrc >> default_decimal_point; + case RC_DEFAULT_DECIMAL_SEP: + lexrc >> default_decimal_sep; break; case RC_DEFAULT_LENGTH_UNIT: if (lexrc.next()) @@ -797,6 +841,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) case RC_LANGUAGE_COMMAND_LOCAL: lexrc >> language_command_local; break; + case RC_RESPECT_OS_KBD_LANGUAGE: + lexrc >> respect_os_kbd_language; + break; case RC_VISUAL_CURSOR: lexrc >> visual_cursor; break; @@ -880,6 +927,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) flgs |= Format::zipped_native; else if (flag == "menu=export") flgs |= Format::export_menu; + else if (flag == "menu=none") + flgs |= Format::no_menu; else LYXERR0("Ignoring unknown flag `" << flag << "' for format `" @@ -965,6 +1014,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) case RC_USER_EMAIL: lexrc >> user_email; break; + case RC_USER_INITIALS: + lexrc >> user_initials; + break; case RC_PATH_PREFIX: lexrc >> path_prefix; @@ -1066,6 +1118,23 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) lexrc >> mouse_middlebutton_paste; break; + case RC_BOOKMARKS_VISIBILITY: + if (lexrc.next()) { + string const tmp = lexrc.getString(); + if (tmp == "none") + bookmarks_visibility = BMK_NONE; + else if (tmp == "margin") + bookmarks_visibility = BMK_MARGIN; + else if (tmp == "inline") + bookmarks_visibility = BMK_INLINE; + else { + bookmarks_visibility = BMK_NONE; + LYXERR0("Unrecognized bookmark visibility " << tmp <<'"'); + } + } + break; + + case RC_LAST: break; // this is just a dummy } @@ -1440,6 +1509,11 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; // fall through + case RC_USER_INITIALS: + os << "\\user_initials \"" << user_initials << "\"\n"; + if (tag != RC_LAST) + break; + // fall through case RC_SHOW_BANNER: if (ignore_system_lyxrc || show_banner != system_lyxrc.show_banner) { @@ -1571,6 +1645,56 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; // fall through + case RC_CITATION_SEARCH: + if (ignore_system_lyxrc || + citation_search != system_lyxrc.citation_search) { + os << "# Set to true to use script to search\n" + << "# locl disk for citation targets.\n" + << "\\citation_search " + << convert(citation_search) + << '\n'; + } + if (tag != RC_LAST) + break; + // fall through + case RC_CITATION_SEARCH_VIEW: + if (ignore_system_lyxrc || + citation_search_view != system_lyxrc.citation_search_view) { + os << "\\citation_search_view \"" + << citation_search_view << "\"\n"; + } + if (tag != RC_LAST) + break; + // fall through + case RC_CITATION_SEARCH_PATTERN: + if (ignore_system_lyxrc || + citation_search_pattern != system_lyxrc.citation_search_pattern) { + os << "\\citation_search_pattern \"" + << citation_search_pattern << "\"\n"; + } + if (tag != RC_LAST) + break; + // fall through + case RC_CT_ADDITIONS_UNDERLINED: + if (ignore_system_lyxrc || + ct_additions_underlined + != system_lyxrc.ct_additions_underlined) { + os << "\\ct_additions_underlined " + << convert(ct_additions_underlined) << '\n'; + } + if (tag != RC_LAST) + break; + // fall through + case RC_CT_MARKUP_COPIED: + if (ignore_system_lyxrc || + ct_markup_copied + != system_lyxrc.ct_markup_copied) { + os << "\\ct_markup_copied " + << convert(ct_markup_copied) << '\n'; + } + if (tag != RC_LAST) + break; + // fall through case RC_CURSOR_FOLLOWS_SCROLLBAR: if (ignore_system_lyxrc || cursor_follows_scrollbar @@ -1611,6 +1735,26 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; // fall through + case RC_BOOKMARKS_VISIBILITY: + if (ignore_system_lyxrc || + bookmarks_visibility != system_lyxrc.bookmarks_visibility) { + string status; + switch (bookmarks_visibility) { + case BMK_NONE: + status = "none"; + break; + case BMK_INLINE: + status = "inline"; + break; + case BMK_MARGIN: + status = "margin"; + break; + } + os << "\\experimental:bookmarks_visibility " << status << '\n'; + } + if (tag != RC_LAST) + break; + // fall through case RC_MAC_DONTSWAP_CTRL_META: if (ignore_system_lyxrc || mac_dontswap_ctrl_meta @@ -1886,12 +2030,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c case RC_SET_COLOR: for (int i = 0; i < Color_ignore; ++i) { ColorCode lc = static_cast(i); - string const col = lcolor.getX11Name(lc); + string const col = lcolor.getAllX11HexNames(lc).first; + string const darkcol = lcolor.getAllX11HexNames(lc).second; if (ignore_system_lyxrc - || col != system_lcolor.getX11Name(lc)) { + || col != system_lcolor.getAllX11HexNames(lc).first + || darkcol != system_lcolor.getAllX11HexNames(lc).second) { os << "\\set_color \"" << lcolor.getLyXName(lc) << "\" \"" - << col << "\"\n"; + << col << "\" \"" + << darkcol << "\"\n"; } } if (tag != RC_LAST) @@ -2263,10 +2410,10 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c << "#\n\n"; // fall through - case RC_DEFAULT_DECIMAL_POINT: + case RC_DEFAULT_DECIMAL_SEP: if (ignore_system_lyxrc || - default_decimal_point != system_lyxrc.default_decimal_point) { - os << "\\default_decimal_point " << default_decimal_point << '\n'; + default_decimal_sep != system_lyxrc.default_decimal_sep) { + os << "\\default_decimal_point \"" << default_decimal_sep << "\"" << '\n'; } if (tag != RC_LAST) break; @@ -2421,6 +2568,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c os << "\\mark_foreign_language " << convert(mark_foreign_language) << '\n'; } + // fall through + case RC_RESPECT_OS_KBD_LANGUAGE: + if (ignore_system_lyxrc || + respect_os_kbd_language + != system_lyxrc.respect_os_kbd_language) { + os << "\\respect_os_kbd_language " << + convert(respect_os_kbd_language) << '\n'; + } + //fall through if (tag != RC_LAST) break; @@ -2508,6 +2664,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c format->documentFormat() != cit->documentFormat() || format->vectorFormat() != cit->vectorFormat() || format->inExportMenu() != cit->inExportMenu() || + format->noMenu() != cit->noMenu() || format->mime() != cit->mime()) { os << "\\format \"" << cit->name() << "\" \"" << cit->extensions() << "\" \"" @@ -2610,8 +2767,9 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c break; // fall through case RC_DEFAULT_VIEW_FORMAT: - if (ignore_system_lyxrc || - default_view_format != system_lyxrc.default_view_format) { + if ((ignore_system_lyxrc || + default_view_format != system_lyxrc.default_view_format) + && !default_view_format.empty()) { os << "\\default_view_format " << default_view_format << '\n'; } if (tag != RC_LAST) @@ -2713,6 +2871,10 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_BIBTEX_ALTERNATIVES: case LyXRC::RC_BIBTEX_COMMAND: case LyXRC::RC_BINDFILE: + case LyXRC::RC_BOOKMARKS_VISIBILITY: + case LyXRC::RC_CITATION_SEARCH: + case LyXRC::RC_CITATION_SEARCH_PATTERN: + case LyXRC::RC_CITATION_SEARCH_VIEW: case LyXRC::RC_CHECKLASTFILES: case LyXRC::RC_COMPLETION_CURSOR_TEXT: case LyXRC::RC_COMPLETION_INLINE_DELAY: @@ -2730,6 +2892,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_CONVERTER: case LyXRC::RC_CONVERTER_CACHE_MAXAGE: case LyXRC::RC_COPIER: + case LyXRC::RC_CT_ADDITIONS_UNDERLINED: + case LyXRC::RC_CT_MARKUP_COPIED: case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR: case LyXRC::RC_SCROLL_BELOW_DOCUMENT: case LyXRC::RC_GUI_LANGUAGE: @@ -2778,6 +2942,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_MACRO_EDIT_STYLE: case LyXRC::RC_MAKE_BACKUP: case LyXRC::RC_MARK_FOREIGN_LANGUAGE: + case LyXRC::RC_RESPECT_OS_KBD_LANGUAGE: case LyXRC::RC_MOUSE_WHEEL_SPEED: case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE: case LyXRC::RC_NUMLASTFILES: @@ -2822,7 +2987,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts - || lyxrc_orig.font_sizes != lyxrc_new.font_sizes + || !std::equal(std::begin(lyxrc_orig.font_sizes), std::end(lyxrc_orig.font_sizes), + std::begin(lyxrc_new.font_sizes)) || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) { dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE)); @@ -2852,6 +3018,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_THESAURUSDIRPATH: case LyXRC::RC_UIFILE: case LyXRC::RC_USER_EMAIL: + case LyXRC::RC_USER_INITIALS: case LyXRC::RC_USER_NAME: case LyXRC::RC_USE_CONVERTER_CACHE: case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN: @@ -2878,7 +3045,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_FORWARD_SEARCH_DVI: case LyXRC::RC_FORWARD_SEARCH_PDF: case LyXRC::RC_EXPORT_OVERWRITE: - case LyXRC::RC_DEFAULT_DECIMAL_POINT: + case LyXRC::RC_DEFAULT_DECIMAL_SEP: case LyXRC::RC_DEFAULT_LENGTH_UNIT: case LyXRC::RC_SCROLL_WHEEL_ZOOM: case LyXRC::RC_CURSOR_WIDTH: @@ -3099,6 +3266,10 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Select to control the highlighting of words with a language foreign to that of the document."); break; + case RC_RESPECT_OS_KBD_LANGUAGE: + str = _("Select to use the current keyboard language, as set from the operating system, as default input language."); + break; + case RC_MOUSE_WHEEL_SPEED: str = _("The scrolling speed of the mouse wheel."); break;