X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXRC.cpp;h=6c7809c7e5811ea933e1021f9e059e3df8fdfe16;hb=4db3e641ed6765e005343010cb90ee8af26f8f99;hp=d980c22ae58481905b05701c723811096a3a0f7d;hpb=2dd84b3417ba6e5329dca681dc69059e201b7cf5;p=lyx.git diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index d980c22ae5..6c7809c7e5 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -55,7 +55,7 @@ namespace os = support::os; namespace { -static unsigned int const LYXRC_FILEFORMAT = 8; // rgh: add "nice" flag +static unsigned int const LYXRC_FILEFORMAT = 13; // vfr: System theme's icons // when adding something to this array keep it sorted! LexerKeyword lyxrcTags[] = { @@ -73,6 +73,7 @@ LexerKeyword lyxrcTags[] = { { "\\bind_file", LyXRC::RC_BINDFILE }, { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES }, { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND }, + { "\\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 }, { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS }, @@ -133,7 +134,7 @@ LexerKeyword lyxrcTags[] = { { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION }, { "\\load_session", LyXRC::RC_LOADSESSION }, { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META }, - { "\\mac_like_word_movement", LyXRC::RC_MAC_LIKE_WORD_MOVEMENT }, + { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT }, { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE }, { "\\make_backup", LyXRC::RC_MAKE_BACKUP }, { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE }, @@ -202,6 +203,7 @@ LexerKeyword lyxrcTags[] = { { "\\use_qimage", LyXRC::RC_USE_QIMAGE }, // compatibility with versions older than 1.4.0 only { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS }, + { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS }, { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP }, { "\\user_email", LyXRC::RC_USER_EMAIL }, { "\\user_name", LyXRC::RC_USER_NAME }, @@ -227,6 +229,7 @@ LyXRC::LyXRC() void LyXRC::setDefaults() { icon_set = string(); + use_system_theme_icons = false; bind_file = "cua"; def_file = "default"; ui_file = "default"; @@ -328,7 +331,7 @@ void LyXRC::setDefaults() scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL; paragraph_markers = false; mac_dontswap_ctrl_meta = false; - mac_like_word_movement = false; + mac_like_cursor_movement = false; macro_edit_style = MACRO_EDIT_INLINE_BOX; dialogs_iconify_with_main = false; preview = PREVIEW_OFF; @@ -370,6 +373,7 @@ void LyXRC::setDefaults() default_decimal_point = "."; default_length_unit = Length::CM; cursor_width = 1; + close_buffer_with_last_view = "yes"; } @@ -831,6 +835,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) lexrc >> icon_set; break; + case RC_USE_SYSTEM_THEME_ICONS: + lexrc >> use_system_theme_icons; + break; + case RC_SCREEN_FONT_ROMAN: if (lexrc.next()) { roman_font_name = lexrc.getString(); @@ -923,8 +931,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) lexrc >> mac_dontswap_ctrl_meta; break; - case RC_MAC_LIKE_WORD_MOVEMENT: - lexrc >> mac_like_word_movement; + case RC_MAC_LIKE_CURSOR_MOVEMENT: + lexrc >> mac_like_cursor_movement; break; case RC_MACRO_EDIT_STYLE: @@ -1042,6 +1050,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) case RC_VISUAL_CURSOR: lexrc >> visual_cursor; break; + case RC_CLOSE_BUFFER_WITH_LAST_VIEW: + lexrc >> close_buffer_with_last_view; + break; case RC_AUTO_NUMBER: lexrc >> auto_number; break; @@ -1138,19 +1149,15 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) } case RC_VIEWER_ALTERNATIVES: { string format, command; - if (lexrc.next()) - format = lexrc.getString(); - if (lexrc.eatLine()) - command = lexrc.getString(); + lexrc >> format; + lexrc >> command; viewer_alternatives[format].insert(command); break; } case RC_EDITOR_ALTERNATIVES: { string format, command; - if (lexrc.next()) - format = lexrc.getString(); - if (lexrc.eatLine()) - command = lexrc.getString(); + lexrc >> format; + lexrc >> command; editor_alternatives[format].insert(command); break; } @@ -1700,6 +1707,16 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; + case RC_USE_SYSTEM_THEME_ICONS: + if (ignore_system_lyxrc || + use_system_theme_icons != system_lyxrc.use_system_theme_icons) { + os << "\\use_system_theme_icons " + << convert(use_system_theme_icons) + << "\n"; + } + if (tag != RC_LAST) + break; + case RC_SCREEN_DPI: if (ignore_system_lyxrc || dpi != system_lyxrc.dpi) { @@ -1767,12 +1784,12 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; - case RC_MAC_LIKE_WORD_MOVEMENT: + case RC_MAC_LIKE_CURSOR_MOVEMENT: if (ignore_system_lyxrc || - mac_like_word_movement - != system_lyxrc.mac_like_word_movement) { - os << "\\mac_like_word_movement " - << convert(mac_like_word_movement) << '\n'; + mac_like_cursor_movement + != system_lyxrc.mac_like_cursor_movement) { + os << "\\mac_like_cursor_movement " + << convert(mac_like_cursor_movement) << '\n'; } if (tag != RC_LAST) break; @@ -2528,6 +2545,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_CLOSE_BUFFER_WITH_LAST_VIEW: + if (ignore_system_lyxrc || + close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) { + os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n"; + os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n'; + } + if (tag != RC_LAST) + break; case RC_LANGUAGE_CUSTOM_PACKAGE: if (ignore_system_lyxrc || language_custom_package != system_lyxrc.language_custom_package) { @@ -2751,7 +2776,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c || sysfmt == sysend // format not found || sysfmt->second.count(cmd) == 0 // this command not found ) - os << "\\viewer_alternatives " << fmt << " " << cmd << "\n"; + os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n"; } } if (tag != RC_LAST) @@ -2776,7 +2801,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c || sysfmt == sysend // format not found || sysfmt->second.count(cmd) == 0 // this command not found ) - os << "\\editor_alternatives " << fmt << " " << cmd << "\n"; + os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n"; } } if (tag != RC_LAST) @@ -2942,7 +2967,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION: case LyXRC::RC_LYXRCFORMAT: case LyXRC::RC_MAC_DONTSWAP_CTRL_META: - case LyXRC::RC_MAC_LIKE_WORD_MOVEMENT: + case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT: case LyXRC::RC_MACRO_EDIT_STYLE: case LyXRC::RC_MAKE_BACKUP: case LyXRC::RC_MARK_FOREIGN_LANGUAGE: @@ -3014,6 +3039,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_USE_TOOLTIP: case LyXRC::RC_USE_PIXMAP_CACHE: case LyXRC::RC_USE_QIMAGE: + case LyXRC::RC_USE_SYSTEM_THEME_ICONS: case LyXRC::RC_VIEWDVI_PAPEROPTION: case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON: case LyXRC::RC_SINGLE_INSTANCE: @@ -3025,6 +3051,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_FULL_SCREEN_TOOLBARS: case LyXRC::RC_FULL_SCREEN_WIDTH: case LyXRC::RC_VISUAL_CURSOR: + case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW: case LyXRC::RC_VIEWER: case LyXRC::RC_VIEWER_ALTERNATIVES: case LyXRC::RC_FORWARD_SEARCH_DVI: @@ -3118,8 +3145,8 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Make Apple key act as Meta and Control key as Ctrl."); break; - case RC_MAC_LIKE_WORD_MOVEMENT: - str = _("Use the Mac OS X conventions for the word-level cursor movement"); + case RC_MAC_LIKE_CURSOR_MOVEMENT: + str = _("Use the Mac OS X conventions for cursor movement"); break; case RC_SHOW_MACRO_LABEL: @@ -3387,6 +3414,10 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Select to have visual bidi cursor movement, unselect for logical movement."); break; + case RC_CLOSE_BUFFER_WITH_LAST_VIEW: + str = _("Specify whether, closing the last view of an open document, LyX should close the document (yes), hide it (no), or ask the user (ask)."); + break; + case RC_SCREEN_DPI: str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here."); break;