X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXRC.cpp;h=252bbfb36d4c3c28c8a1a3feaa9f3355dfa2d296;hb=1712e4f35e3e8cb132f731dca773f7767a241bf6;hp=b320d9c316aefcf9b2d446ff84e5207c41fd100a;hpb=bd57d5ea563c2ae6327fe3026c6c9748fefb1af9;p=lyx.git diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index b320d9c316..252bbfb36d 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -23,6 +23,7 @@ #include "FontEnums.h" #include "Format.h" #include "Lexer.h" +#include "LyX.h" #include "Mover.h" #include "Session.h" #include "version.h" @@ -42,6 +43,7 @@ #include #include +#include using namespace std; using namespace lyx::support; @@ -83,6 +85,7 @@ LexerKeyword lyxrcTags[] = { { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR }, { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT }, { "\\def_file", LyXRC::RC_DEFFILE }, + { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT }, { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE }, { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE }, { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT }, @@ -92,8 +95,11 @@ LexerKeyword lyxrcTags[] = { { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES }, { "\\escape_chars", LyXRC::RC_ESC_CHARS }, { "\\example_path", LyXRC::RC_EXAMPLEPATH }, + { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE }, { "\\font_encoding", LyXRC::RC_FONT_ENCODING }, { "\\format", LyXRC::RC_FORMAT }, + { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI }, + { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF }, { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT }, { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR }, { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR }, @@ -111,7 +117,6 @@ LexerKeyword lyxrcTags[] = { { "\\kbmap", LyXRC::RC_KBMAP }, { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY }, { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY }, - { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH }, { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN }, { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END }, { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN }, @@ -156,6 +161,7 @@ LexerKeyword lyxrcTags[] = { { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER }, { "\\printer", LyXRC::RC_PRINTER }, { "\\rtl", LyXRC::RC_RTL_SUPPORT }, + { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED }, { "\\screen_dpi", LyXRC::RC_SCREEN_DPI }, { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN }, { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY }, @@ -167,6 +173,7 @@ LexerKeyword lyxrcTags[] = { { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY }, { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM }, { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT }, + { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM }, { "\\serverpipe", LyXRC::RC_SERVERPIPE }, { "\\set_color", LyXRC::RC_SET_COLOR }, { "\\show_banner", LyXRC::RC_SHOW_BANNER }, @@ -192,6 +199,7 @@ LexerKeyword lyxrcTags[] = { { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE }, // compatibility with versions older than 1.4.0 only { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB }, + { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS }, // compatibility with versions older than 1.4.0 only { "\\use_tempdir", LyXRC::RC_USETEMPDIR }, { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP }, @@ -275,10 +283,14 @@ void LyXRC::setDefaults() use_lastfilepos = true; load_session = false; make_backup = true; + save_compressed = false; backupdir_path.erase(); display_graphics = true; // Spellchecker settings: -#if defined(USE_ASPELL) +// FIXME: this check should test the target platform (darwin) +#if defined(USE_MACOSX_PACKAGING) + spellchecker = "native"; +#elif defined(USE_ASPELL) spellchecker = "aspell"; #elif defined(USE_HUNSPELL) spellchecker = "hunspell"; @@ -310,15 +322,16 @@ void LyXRC::setDefaults() date_insert_format = "%x"; cursor_follows_scrollbar = false; scroll_below_document = false; + scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL; paragraph_markers = false; mac_like_word_movement = false; macro_edit_style = MACRO_EDIT_INLINE_BOX; dialogs_iconify_with_main = false; - label_init_length = 3; preview = PREVIEW_OFF; preview_hashed_labels = false; preview_scale_factor = 1.0; use_converter_cache = true; + use_system_colors = false; use_tooltip = true; use_pixmap_cache = false; converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months @@ -326,6 +339,9 @@ void LyXRC::setDefaults() user_email = to_utf8(support::user_email()); open_buffers_in_tabs = true; single_close_tab_button = false; + forward_search_dvi = string(); + forward_search_pdf = string(); + export_overwrite = NO_FILES; // Fullscreen settings full_screen_limit = false; @@ -345,6 +361,7 @@ void LyXRC::setDefaults() completion_inline_text = false; completion_inline_dots = -1; completion_inline_delay = 0.2; + default_decimal_point = "."; } @@ -426,7 +443,7 @@ int LyXRC::read(Lexer & lexrc) lexrc.getString()); if (read(tmp)) { lexrc.printError("Error reading " - "included file: " + tmp.absFilename()); + "included file: " + tmp.absFileName()); } } break; @@ -899,6 +916,9 @@ int LyXRC::read(Lexer & lexrc) case RC_ACCEPT_COMPOUND: lexrc >> spellchecker_accept_compound; break; + case RC_USE_SYSTEM_COLORS: + lexrc >> use_system_colors; + break; case RC_USE_TOOLTIP: lexrc >> use_tooltip; break; @@ -923,12 +943,18 @@ int LyXRC::read(Lexer & lexrc) case RC_MAKE_BACKUP: lexrc >> make_backup; break; + case RC_SAVE_COMPRESSED: + lexrc >> save_compressed; + break; case RC_BACKUPDIR_PATH: 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; + break; case RC_DATE_INSERT_FORMAT: lexrc >> date_insert_format; break; @@ -1077,10 +1103,6 @@ int LyXRC::read(Lexer & lexrc) lexrc >> gui_language; break; - case RC_LABEL_INIT_LENGTH: - lexrc >> label_init_length; - break; - case RC_SHOW_BANNER: lexrc >> show_banner; break; @@ -1157,6 +1179,46 @@ int LyXRC::read(Lexer & lexrc) case RC_SINGLE_CLOSE_TAB_BUTTON: lexrc >> single_close_tab_button; break; + case RC_FORWARD_SEARCH_DVI: + if (lexrc.next(true)) + forward_search_dvi = lexrc.getString(); + break; + case RC_FORWARD_SEARCH_PDF: + if (lexrc.next(true)) + forward_search_pdf = lexrc.getString(); + break; + case RC_EXPORT_OVERWRITE: + if (lexrc.next()) { + string const tmp = lexrc.getString(); + if (tmp == "all" || tmp == "true") + export_overwrite = ALL_FILES; + else if (tmp == "main") + export_overwrite = MAIN_FILE; + else { + export_overwrite = NO_FILES; + if (tmp != "ask" && tmp != "false") + LYXERR0("Unrecognized export_overwrite status \"" + << tmp << '"'); + } + } + break; + case RC_SCROLL_WHEEL_ZOOM: + if (lexrc.next()) { + string const tmp = lexrc.getString(); + if (tmp == "ctrl") + scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL; + else if (tmp == "shift") + scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT; + else if (tmp == "alt") + scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT; + else { + scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF; + if (tmp != "off" && tmp != "false") + LYXERR0("Unrecognized scroll_wheel_zoom status \"" + << tmp << '"'); + } + } + break; // Obsoteted in 1.4.0 case RC_USETEMPDIR: @@ -1389,8 +1451,30 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c case PAPER_B5: os << "b5"; break; case PAPER_CUSTOM: + case PAPER_A0: + case PAPER_A1: + case PAPER_A2: + case PAPER_A6: + case PAPER_B0: + case PAPER_B1: + case PAPER_B2: case PAPER_B3: - case PAPER_B4: break; + case PAPER_B4: + case PAPER_B6: + case PAPER_C0: + case PAPER_C1: + case PAPER_C2: + case PAPER_C3: + case PAPER_C4: + case PAPER_C5: + case PAPER_C6: + case PAPER_JISB0: + case PAPER_JISB1: + case PAPER_JISB2: + case PAPER_JISB3: + case PAPER_JISB4: + case PAPER_JISB5: + case PAPER_JISB6: break; } os << "\"\n"; } @@ -1523,14 +1607,6 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; - case RC_LABEL_INIT_LENGTH: - if (ignore_system_lyxrc || - label_init_length != system_lyxrc.label_init_length) { - os << "\\label_init_length " << label_init_length - << '\n'; - } - if (tag != RC_LAST) - break; case RC_USER_NAME: os << "\\user_name \"" << user_name << "\"\n"; @@ -1849,6 +1925,8 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c << convert(open_buffers_in_tabs) << '\n'; } + if (tag != RC_LAST) + break; case RC_SINGLE_CLOSE_TAB_BUTTON: if (ignore_system_lyxrc || single_close_tab_button != system_lyxrc.single_close_tab_button) { @@ -1858,6 +1936,20 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_FORWARD_SEARCH_DVI: + if (ignore_system_lyxrc || + forward_search_dvi != system_lyxrc.forward_search_dvi) { + os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n"; + } + if (tag != RC_LAST) + break; + case RC_FORWARD_SEARCH_PDF: + if (ignore_system_lyxrc || + forward_search_pdf != system_lyxrc.forward_search_pdf) { + os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n"; + } + if (tag != RC_LAST) + break; os << "\n#\n" << "# COLOR SECTION ###################################\n" @@ -2232,6 +2324,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_SAVE_COMPRESSED: + if (ignore_system_lyxrc || + save_compressed != system_lyxrc.save_compressed) { + os << "\\save_compressed " << convert(save_compressed) << '\n'; + } + if (tag != RC_LAST) + break; case RC_BACKUPDIR_PATH: if (ignore_system_lyxrc || backupdir_path != system_lyxrc.backupdir_path) { @@ -2288,6 +2387,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c // obsoleted in 2.0 if (tag != RC_LAST) break; + case RC_USE_SYSTEM_COLORS: + if (ignore_system_lyxrc || + use_system_colors != system_lyxrc.use_system_colors) { + os << "\\use_system_colors " + << convert(use_system_colors) + << '\n'; + } + if (tag != RC_LAST) + break; case RC_USE_TOOLTIP: if (ignore_system_lyxrc || use_tooltip != system_lyxrc.use_tooltip) { @@ -2321,6 +2429,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; + case RC_DEFAULT_DECIMAL_POINT: + if (ignore_system_lyxrc || + default_decimal_point != system_lyxrc.default_decimal_point) { + os << "\\default_decimal_point " << default_decimal_point << '\n'; + } + if (tag != RC_LAST) + break; + case RC_SPELLCHECKER: if (ignore_system_lyxrc || spellchecker != system_lyxrc.spellchecker) { @@ -2468,6 +2584,48 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_EXPORT_OVERWRITE: + if (ignore_system_lyxrc || + export_overwrite != system_lyxrc.export_overwrite) { + string status; + switch (export_overwrite) { + case NO_FILES: + status = "ask"; + break; + case MAIN_FILE: + status = "main"; + break; + case ALL_FILES: + status = "all"; + break; + } + os << "\\export_overwrite " << status << '\n'; + } + if (tag != RC_LAST) + break; + + case RC_SCROLL_WHEEL_ZOOM: + if (ignore_system_lyxrc || + scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) { + string status; + switch (scroll_wheel_zoom) { + case SCROLL_WHEEL_ZOOM_OFF: + status = "off"; + break; + case SCROLL_WHEEL_ZOOM_CTRL: + status = "ctrl"; + break; + case SCROLL_WHEEL_ZOOM_SHIFT: + status = "shift"; + break; + case SCROLL_WHEEL_ZOOM_ALT: + status = "alt"; + break; + } + os << "\\scroll_wheel_zoom " << status << '\n'; + } + if (tag != RC_LAST) + break; os << "\n#\n" << "# FORMATS SECTION ##########################\n" @@ -2708,7 +2866,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_KBMAP: case LyXRC::RC_KBMAP_PRIMARY: case LyXRC::RC_KBMAP_SECONDARY: - case LyXRC::RC_LABEL_INIT_LENGTH: case LyXRC::RC_LANGUAGE_AUTO_BEGIN: case LyXRC::RC_LANGUAGE_AUTO_END: case LyXRC::RC_LANGUAGE_COMMAND_BEGIN: @@ -2751,6 +2908,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_PRINT_ADAPTOUTPUT: case LyXRC::RC_PRINT_COMMAND: case LyXRC::RC_RTL_SUPPORT: + case LyXRC::RC_SAVE_COMPRESSED: case LyXRC::RC_SCREEN_DPI: case LyXRC::RC_SCREEN_FONT_ROMAN: case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY: @@ -2788,6 +2946,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_USE_ESC_CHARS: case LyXRC::RC_USE_INP_ENC: case LyXRC::RC_USE_PERS_DICT: + case LyXRC::RC_USE_SYSTEM_COLORS: case LyXRC::RC_USE_TOOLTIP: case LyXRC::RC_USE_PIXMAP_CACHE: case LyXRC::RC_USE_SPELL_LIB: @@ -2803,6 +2962,11 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_VISUAL_CURSOR: case LyXRC::RC_VIEWER: case LyXRC::RC_VIEWER_ALTERNATIVES: + 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_SCROLL_WHEEL_ZOOM: case LyXRC::RC_LAST: break; } @@ -2963,10 +3127,6 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard."); break; - case RC_LABEL_INIT_LENGTH: - str = _("Maximum number of words in the initialization string for a new label"); - break; - case RC_LANGUAGE_AUTO_BEGIN: str = _("Select if a language switching command is needed at the beginning of the document."); break; @@ -3237,6 +3397,10 @@ string const LyXRC::getDescription(LyXRCTags tag) case RC_USETEMPDIR: break; + case RC_USE_USE_SYSTEM_COLORS: + str = _("Enable use the system colors for some things like main window background and selection."); + break; + case RC_USE_TOOLTIP: str = _("Enable the automatic appearance of tool tips in the work area."); break;