X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXRC.cpp;h=99289aa1b02fd68de1036dc8d3ef695149d34887;hb=1e519d1115f41f71c253cb9e2fbb7803e9a583a9;hp=42dfad3731b7c4b057a9cb50ebafe92cf392b29e;hpb=9fe101e8900300661c999e1edc834f1dbcf2e40c;p=lyx.git diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 42dfad3731..99289aa1b0 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -23,6 +23,8 @@ #include "Converter.h" #include "FontEnums.h" #include "Format.h" +#include "FuncCode.h" +#include "FuncRequest.h" #include "Lexer.h" #include "LyX.h" #include "Mover.h" @@ -209,160 +211,6 @@ LexerKeyword lyxrcTags[] = { const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]); -} // namespace - - -LyXRC::LyXRC() -{ - setDefaults(); -} - - -void LyXRC::setDefaults() -{ - icon_set = string(); - use_system_theme_icons = false; - bind_file = "cua"; - def_file = "default"; - ui_file = "default"; - // The current document directory - texinputs_prefix = "."; - print_landscape_flag = "-t landscape"; - print_paper_flag = "-t"; - print_paper_dimension_flag = "-T"; - document_path.erase(); - view_dvi_paper_option.erase(); - default_view_format = "pdf2"; - default_otf_view_format = "pdf4"; - default_platex_view_format = "pdf3"; - chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"; - bibtex_command = "automatic"; - index_command = "makeindex -c -q"; - nomencl_command = "makeindex -s nomencl.ist"; - pygmentize_command = string(); - dpi = 75; - // Because a screen is typically wider than a piece of paper: - defaultZoom = 150; - currentZoom = defaultZoom; - allow_geometry_session = true; - // Default LaTeX font size: - font_sizes[FONT_SIZE_TINY] = "5.0"; - font_sizes[FONT_SIZE_SCRIPT] = "7.0"; - font_sizes[FONT_SIZE_FOOTNOTE] = "8.0"; - font_sizes[FONT_SIZE_SMALL] = "9.0"; - font_sizes[FONT_SIZE_NORMAL] = "10.0"; - font_sizes[FONT_SIZE_LARGE] = "12.0"; - font_sizes[FONT_SIZE_LARGER] = "14.4"; - font_sizes[FONT_SIZE_LARGEST] = "17.26"; - font_sizes[FONT_SIZE_HUGE] = "20.74"; - font_sizes[FONT_SIZE_HUGER] = "24.88"; - use_scalable_fonts = true; - roman_font_name = ""; - sans_font_name = ""; - typewriter_font_name = ""; - autosave = 300; - auto_region_delete = true; - auto_reset_options = false; - plaintext_linelen = 65; - mouse_wheel_speed = 1.0; - num_lastfiles = 20; - check_lastfiles = true; - use_lastfilepos = true; - use_native_filedialog = true; - load_session = false; - make_backup = true; - save_compressed = false; - save_origin = false; - backupdir_path.erase(); - display_graphics = true; - // Spellchecker settings: -// FIXME: this check should test the target platform (darwin) -#if defined(USE_MACOSX_PACKAGING) - spellchecker = "native"; -#elif defined(USE_ENCHANT) - spellchecker = "enchant"; -#elif defined(USE_ASPELL) - spellchecker = "aspell"; -#elif defined(USE_HUNSPELL) - spellchecker = "hunspell"; -#else - spellchecker = "aspell"; -#endif - spellchecker_accept_compound = false; - spellcheck_continuously = false; - completion_minlength = 6; - spellcheck_notes = true; - use_kbmap = false; - visual_cursor = false; - auto_number = true; - mark_foreign_language = true; - language_auto_begin = true; - language_auto_end = true; - language_global_options = true; - language_package_selection = LP_AUTO; - language_custom_package = "\\usepackage{babel}"; - language_command_begin = "\\selectlanguage{$$lang}"; - language_command_local = "\\foreignlanguage{$$lang}{"; - sort_layouts = false; - group_layouts = true; - gui_language = "auto"; - show_banner = true; - windows_style_tex_paths = false; - tex_allows_spaces = false; - cursor_follows_scrollbar = false; - scroll_below_document = false; - scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL; - paragraph_markers = false; - mac_dontswap_ctrl_meta = false; - mac_like_cursor_movement = false; - macro_edit_style = MACRO_EDIT_INLINE_BOX; - dialogs_iconify_with_main = false; - preview = PREVIEW_OFF; - 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; - converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months - user_name = to_utf8(support::user_name()); - user_email = to_utf8(support::user_email()); - open_buffers_in_tabs = true; - single_close_tab_button = false; - single_instance = true; - forward_search_dvi = string(); - forward_search_pdf = string(); - export_overwrite = NO_FILES; - - // Fullscreen settings - full_screen_limit = false; - full_screen_toolbars = true; - full_screen_tabbar = true; - full_screen_menubar = true; - full_screen_statusbar = true; - full_screen_scrollbar = true; - full_screen_width = 700; - - completion_cursor_text = true; - completion_popup_math = true; - completion_popup_text = false; - completion_popup_delay = 2.0; - completion_popup_after_complete = true; - autocorrection_math = false; - completion_inline_math = true; - completion_inline_text = false; - completion_inline_dots = -1; - completion_inline_delay = 0.2; - default_decimal_point = "."; - default_length_unit = Length::CM; - cursor_width = 1; - close_buffer_with_last_view = "yes"; - mouse_middlebutton_paste = true; -} - - -namespace { void oldFontFormat(string & family, string & foundry) { @@ -2936,12 +2784,20 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_PARAGRAPH_MARKERS: case LyXRC::RC_PATH_PREFIX: if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) { - prependEnvPath("PATH", lyxrc_new.path_prefix); + prependEnvPath("PATH", replaceEnvironmentPath(lyxrc_new.path_prefix)); // Resets python path support::os::python(true); } // fall through case LyXRC::RC_PREVIEW: + if (lyxrc_orig.preview != lyxrc_new.preview) { + // Update all previews of all documents. + /* FIXME: this can be very expensive. It would be cheaper + * to kill all existing previews and update visible + * previews.*/ + theBufferList().updatePreviews(); + } + // fall through case LyXRC::RC_PREVIEW_HASHED_LABELS: case LyXRC::RC_PREVIEW_SCALE_FACTOR: case LyXRC::RC_PRINTLANDSCAPEFLAG: @@ -2950,6 +2806,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_SAVE_COMPRESSED: case LyXRC::RC_SAVE_ORIGIN: case LyXRC::RC_SCREEN_DPI: + case LyXRC::RC_SCREEN_FONT_ROMAN: case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY: case LyXRC::RC_SCREEN_FONT_SANS: @@ -2958,8 +2815,20 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_SCREEN_FONT_SIZES: case LyXRC::RC_SCREEN_FONT_TYPEWRITER: case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY: - case LyXRC::RC_GEOMETRY_SESSION: case LyXRC::RC_SCREEN_ZOOM: + if (lyxrc_orig.roman_font_name != lyxrc_new.roman_font_name + || lyxrc_orig.sans_font_name != lyxrc_new.sans_font_name + || lyxrc_orig.typewriter_font_name != lyxrc_new.typewriter_font_name + || 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 + || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry + || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) { + dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE)); + } + // fall through + case LyXRC::RC_GEOMETRY_SESSION: case LyXRC::RC_SERVERPIPE: case LyXRC::RC_SET_COLOR: case LyXRC::RC_SHOW_BANNER: