3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
14 * Full author contact details are available in file CREDITS.
21 #include "BufferList.h"
23 #include "Converter.h"
24 #include "FontEnums.h"
27 #include "FuncRequest.h"
30 #include "SpellChecker.h"
33 #include "support/convert.h"
34 #include "support/debug.h"
35 #include "support/environment.h"
36 #include "support/FileName.h"
37 #include "support/filetools.h"
38 #include "support/Lexer.h"
39 #include "support/lstrings.h"
40 #include "support/os.h"
41 #include "support/Package.h"
42 #include "support/TempFile.h"
44 #ifdef USE_MACOSX_PACKAGING
45 #include "support/AppleSupport.h"
53 using namespace lyx::support;
57 namespace os = support::os;
61 // The format should also be updated in configure.py, and conversion code
62 // should be added to prefs2prefs_prefs.py.
63 static unsigned int const LYXRC_FILEFORMAT = 38; // chillenb: screen_width and screen_limit
64 // when adding something to this array keep it sorted!
65 LexerKeyword lyxrcTags[] = {
66 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
67 { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION },
68 { "\\alternate_language", LyXRC::RC_ALT_LANG },
69 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
70 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
71 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
72 { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
73 { "\\autosave", LyXRC::RC_AUTOSAVE },
74 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
75 { "\\bibtex_alternatives", LyXRC::RC_BIBTEX_ALTERNATIVES },
76 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
77 { "\\bind_file", LyXRC::RC_BINDFILE },
78 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
79 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
80 { "\\citation_search", LyXRC::RC_CITATION_SEARCH },
81 { "\\citation_search_pattern", LyXRC::RC_CITATION_SEARCH_PATTERN },
82 { "\\citation_search_view", LyXRC::RC_CITATION_SEARCH_VIEW },
83 { "\\close_buffer_with_last_view", LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW },
84 { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
85 { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
86 { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
87 { "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
88 { "\\completion_inline_text", LyXRC::RC_COMPLETION_INLINE_TEXT },
89 { "\\completion_minlength", LyXRC::RC_COMPLETION_MINLENGTH },
90 { "\\completion_popup_after_complete", LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE },
91 { "\\completion_popup_delay", LyXRC::RC_COMPLETION_POPUP_DELAY },
92 { "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH },
93 { "\\completion_popup_text", LyXRC::RC_COMPLETION_POPUP_TEXT },
94 { "\\converter", LyXRC::RC_CONVERTER },
95 { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
96 { "\\copier", LyXRC::RC_COPIER },
97 { "\\ct_additions_underlined", LyXRC::RC_CT_ADDITIONS_UNDERLINED },
98 { "\\ct_markup_copied", LyXRC::RC_CT_MARKUP_COPIED },
99 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
100 { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
101 { "\\def_file", LyXRC::RC_DEFFILE },
102 { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_SEP },
103 { "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
104 { "\\default_otf_view_format", LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT },
105 { "\\default_platex_view_format", LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT },
106 { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
107 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
108 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
109 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
110 { "\\draw_strategy", LyXRC::RC_DRAW_STRATEGY },
111 { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
112 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
113 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
114 { "\\experimental:bookmarks_visibility", LyXRC::RC_BOOKMARKS_VISIBILITY },
115 { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
116 { "\\format", LyXRC::RC_FILEFORMAT },
117 { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
118 { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
119 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
120 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
121 { "\\fullscreen_statusbar", LyXRC::RC_FULL_SCREEN_STATUSBAR },
122 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
123 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
124 { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
125 { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
126 { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
127 { "\\icon_set", LyXRC::RC_ICON_SET },
128 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
129 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
130 { "\\input", LyXRC::RC_INPUT },
131 { "\\jbibtex_alternatives", LyXRC::RC_JBIBTEX_ALTERNATIVES },
132 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
133 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
134 { "\\kbmap", LyXRC::RC_KBMAP },
135 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
136 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
137 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
138 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
139 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
140 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
141 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
142 { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
143 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
144 { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
145 { "\\load_session", LyXRC::RC_LOADSESSION },
146 { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
147 { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
148 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
149 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
150 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
151 { "\\mouse_middlebutton_paste", LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE },
152 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
153 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
154 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
155 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
156 { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
157 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
158 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
159 { "\\preview", LyXRC::RC_PREVIEW },
160 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
161 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
162 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
163 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
164 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
165 { "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND },
166 { "\\respect_os_kbd_language", LyXRC::RC_RESPECT_OS_KBD_LANGUAGE },
167 { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
168 { "\\save_origin", LyXRC::RC_SAVE_ORIGIN },
169 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
170 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
171 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
172 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
173 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
174 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
175 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
176 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
177 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
178 { "\\screen_limit", LyXRC::RC_SCREEN_LIMIT },
179 { "\\screen_width", LyXRC::RC_SCREEN_WIDTH },
180 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
181 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
182 { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
183 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
184 { "\\set_color", LyXRC::RC_SET_COLOR },
185 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
186 { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
187 { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
188 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
189 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
190 { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
191 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
192 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
193 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
194 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
195 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
196 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
197 { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
198 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
199 { "\\ui_file", LyXRC::RC_UIFILE },
200 { "\\ui_style", LyXRC::RC_UI_STYLE },
201 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
202 { "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
203 { "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
204 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
205 { "\\use_native_filedialog", LyXRC::RC_USE_NATIVE_FILEDIALOG },
206 // compatibility with versions older than 1.4.0 only
207 { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
208 { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
209 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
210 { "\\user_email", LyXRC::RC_USER_EMAIL },
211 { "\\user_initials", LyXRC::RC_USER_INITIALS },
212 { "\\user_name", LyXRC::RC_USER_NAME },
213 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
214 // compatibility with versions older than 1.4.0 only
215 { "\\viewer", LyXRC::RC_VIEWER},
216 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
217 { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
218 { "format", LyXRC::RC_LYXRCFORMAT }
221 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
224 void oldFontFormat(string & family, string & foundry)
226 if (family.empty() || family[0] != '-')
228 foundry = token(family, '-', 1);
229 family = token(family, '-', 2);
237 bool LyXRC::read(FileName const & filename, bool check_format)
239 Lexer lexrc(lyxrcTags);
240 lexrc.setFile(filename);
241 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
242 ReturnValues retval = read(lexrc, check_format);
243 if (!check_format || retval != FormatMismatch)
244 return retval == ReadOK;
246 LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
247 TempFile tmp("convert_lyxrc");
248 FileName const tempfile = tmp.name();
249 bool const success = prefs2prefs(filename, tempfile, false);
251 LYXERR0 ("Unable to convert " << filename.absFileName() <<
252 " to format " << LYXRC_FILEFORMAT);
255 // Keep this in the else branch, such that lexrc2 goes out
256 // of scope and releases the lock on tempfile before we
257 // attempt to remove it. This matters on Windows.
258 Lexer lexrc2(lyxrcTags);
259 lexrc2.setFile(tempfile);
260 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
261 retval = read(lexrc2, check_format);
262 if (retval == FormatMismatch)
263 LYXERR0("Conversion failed for " << filename.absFileName());
265 return retval == ReadOK;
269 // don't need to worry about conversion, because this is always
270 // from an internal source
271 bool LyXRC::read(istream & is)
273 Lexer lexrc(lyxrcTags);
275 LYXERR(Debug::LYXRC, "Reading istream...");
276 return read(lexrc, false) == ReadOK;
280 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
282 if (lyxerr.debugging(Debug::PARSER))
283 lexrc.printTable(lyxerr);
288 // format prior to 2.0 and introduction of format tag
289 unsigned int rc_format = 0;
291 while (lexrc.isOK()) {
292 // By using two switches we take advantage of the compiler
293 // telling us if we have missed a LyXRCTags element in
294 // the second switch.
295 // Note that this also shows a problem with Lexer since it
296 // helps us avoid taking advantage of the strictness of the
299 int le = lexrc.lex();
301 case Lexer::LEX_UNDEF:
302 lexrc.printError("Unknown tag `$$Token'");
304 case Lexer::LEX_FEOF:
309 switch (static_cast<LyXRCTags>(le)) {
312 rc_format = lexrc.getInteger();
314 case RC_INPUT: // Include file
317 libFileSearch(string(),
319 if (!read(tmp, check_format)) {
321 "Error reading included file: " + tmp.absFileName());
327 bind_file = os::internal_path(lexrc.getString());
332 def_file = os::internal_path(lexrc.getString());
337 ui_file = os::internal_path(lexrc.getString());
340 case RC_AUTORESET_OPTIONS:
341 lexrc >> auto_reset_options;
344 case RC_DISPLAY_GRAPHICS:
346 display_graphics = lexrc.getString() == "true";
349 case RC_TEX_EXPECTS_WINDOWS_PATHS:
350 lexrc >> windows_style_tex_paths;
353 case RC_TEX_ALLOWS_SPACES:
354 lexrc >> tex_allows_spaces;
357 case RC_TEXINPUTS_PREFIX:
358 lexrc >> texinputs_prefix;
365 case RC_KBMAP_PRIMARY:
367 string const kmap(os::internal_path(lexrc.getString()));
368 if (!libFileSearch("kbd", kmap, "kmap").empty()
370 primary_kbmap = kmap;
372 lexrc.printError("LyX: Keymap `$$Token' not found");
377 case RC_KBMAP_SECONDARY:
379 string const kmap(os::internal_path(lexrc.getString()));
380 if (!libFileSearch("kbd", kmap, "kmap").empty()
382 secondary_kbmap = kmap;
384 lexrc.printError("LyX: Keymap `$$Token' not found");
389 case RC_PRINTLANDSCAPEFLAG:
390 lexrc >> print_landscape_flag;
393 case RC_PRINTPAPERDIMENSIONFLAG:
394 lexrc >> print_paper_dimension_flag;
397 case RC_PRINTPAPERFLAG:
398 lexrc >> print_paper_flag;
401 case RC_PYGMENTIZE_COMMAND:
402 if (lexrc.next(true)) {
403 pygmentize_command = lexrc.getString();
407 case RC_VIEWDVI_PAPEROPTION:
409 view_dvi_paper_option = lexrc.getString();
411 view_dvi_paper_option.erase();
414 case RC_CHKTEX_COMMAND:
415 if (lexrc.next(true)) {
416 chktex_command = lexrc.getString();
420 case RC_BIBTEX_ALTERNATIVES:
421 if (lexrc.next(true)) {
422 bibtex_alternatives.insert(lexrc.getString());
426 case RC_BIBTEX_COMMAND:
427 if (lexrc.next(true)) {
428 bibtex_command = lexrc.getString();
432 case RC_JBIBTEX_COMMAND:
433 if (lexrc.next(true)) {
434 jbibtex_command = lexrc.getString();
438 case RC_JBIBTEX_ALTERNATIVES:
439 if (lexrc.next(true)) {
440 jbibtex_alternatives.insert(lexrc.getString());
444 case RC_INDEX_ALTERNATIVES:
445 if (lexrc.next(true)) {
446 index_alternatives.insert(lexrc.getString());
450 case RC_INDEX_COMMAND:
451 if (lexrc.next(true)) {
452 index_command = lexrc.getString();
456 case RC_JINDEX_COMMAND:
457 if (lexrc.next(true)) {
458 jindex_command = lexrc.getString();
462 case RC_SPLITINDEX_COMMAND:
463 if (lexrc.next(true)) {
464 splitindex_command = lexrc.getString();
468 case RC_NOMENCL_COMMAND:
469 if (lexrc.next(true)) {
470 nomencl_command = lexrc.getString();
479 lexrc >> defaultZoom;
480 if (defaultZoom < 10)
484 case RC_GEOMETRY_SESSION:
485 lexrc >> allow_geometry_session;
488 case RC_SCREEN_FONT_SIZES:
489 lexrc >> font_sizes[TINY_SIZE];
490 lexrc >> font_sizes[SCRIPT_SIZE];
491 lexrc >> font_sizes[FOOTNOTE_SIZE];
492 lexrc >> font_sizes[SMALL_SIZE];
493 lexrc >> font_sizes[NORMAL_SIZE];
494 lexrc >> font_sizes[LARGE_SIZE];
495 lexrc >> font_sizes[LARGER_SIZE];
496 lexrc >> font_sizes[LARGEST_SIZE];
497 lexrc >> font_sizes[HUGE_SIZE];
498 lexrc >> font_sizes[HUGER_SIZE];
501 case RC_SCREEN_FONT_SCALABLE:
502 lexrc >> use_scalable_fonts;
509 case RC_DOCUMENTPATH:
511 document_path = os::internal_path(lexrc.getString());
516 example_path = os::internal_path(lexrc.getString());
519 case RC_TEMPLATEPATH:
521 template_path = os::internal_path(lexrc.getString());
526 tempdir_path = os::internal_path(lexrc.getString());
529 case RC_THESAURUSDIRPATH:
531 thesaurusdir_path = os::internal_path(lexrc.getString());
534 case RC_HUNSPELLDIR_PATH:
536 hunspelldir_path = os::internal_path(lexrc.getString());
539 case RC_USELASTFILEPOS:
540 lexrc >> use_lastfilepos;
544 lexrc >> load_session;
547 case RC_MOUSE_WHEEL_SPEED:
548 lexrc >> mouse_wheel_speed;
551 case RC_COMPLETION_INLINE_DELAY:
552 lexrc >> completion_inline_delay;
555 case RC_COMPLETION_INLINE_MATH:
556 lexrc >> completion_inline_math;
559 case RC_COMPLETION_INLINE_TEXT:
560 lexrc >> completion_inline_text;
563 case RC_COMPLETION_INLINE_DOTS:
564 lexrc >> completion_inline_dots;
567 case RC_AUTOCORRECTION_MATH:
568 lexrc >> autocorrection_math;
571 case RC_COMPLETION_POPUP_DELAY:
572 lexrc >> completion_popup_delay;
575 case RC_COMPLETION_POPUP_MATH:
576 lexrc >> completion_popup_math;
579 case RC_COMPLETION_POPUP_TEXT:
580 lexrc >> completion_popup_text;
583 case RC_COMPLETION_CURSOR_TEXT:
584 lexrc >> completion_cursor_text;
587 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
588 lexrc >> completion_popup_after_complete;
591 case RC_COMPLETION_MINLENGTH:
592 lexrc >> completion_minlength;
595 case RC_NUMLASTFILES:
596 lexrc >> num_lastfiles;
599 case RC_CHECKLASTFILES:
600 lexrc >> check_lastfiles;
611 case RC_USE_SYSTEM_THEME_ICONS:
612 lexrc >> use_system_theme_icons;
615 case RC_SCREEN_FONT_ROMAN:
617 roman_font_name = lexrc.getString();
618 oldFontFormat(roman_font_name,
623 case RC_SCREEN_FONT_SANS:
625 sans_font_name = lexrc.getString();
626 oldFontFormat(sans_font_name, sans_font_foundry);
630 case RC_SCREEN_FONT_TYPEWRITER:
632 typewriter_font_name = lexrc.getString();
633 oldFontFormat(typewriter_font_name,
634 typewriter_font_foundry);
638 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
639 lexrc >> roman_font_foundry;
642 case RC_SCREEN_FONT_SANS_FOUNDRY:
643 lexrc >> sans_font_foundry;
646 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
647 lexrc >> typewriter_font_foundry;
652 lexrc.printError("Missing color tag.");
655 string const lyx_name = lexrc.getString();
658 lexrc.printError("Missing color name for color: `$$Token'");
661 string const x11_name = lexrc.getString();
663 string x11_darkname = x11_name;
665 x11_darkname = lexrc.getString();
667 ColorCode const col =
668 lcolor.getFromLyXName(lyx_name);
669 if (col == Color_none ||
670 col == Color_inherit ||
674 if (!lcolor.setColor(col, x11_name, x11_darkname))
675 LYXERR0("Bad lyxrc set_color for " << lyx_name);
676 LYXERR(Debug::LYXRC, "Set " << lyx_name << "(" << col << ") to "
677 << x11_name << " and " << x11_darkname);
681 case RC_AUTOREGIONDELETE:
682 // Auto region delete defaults to true
683 lexrc >> auto_region_delete;
688 string userdir = package().user_support().absFileName();
689 if (userdir.back() == '/')
691 lyxpipes = subst(os::internal_path(lexrc.getString()), "$$UserDir",
696 case RC_CITATION_SEARCH:
697 lexrc >> citation_search;
700 case RC_CITATION_SEARCH_PATTERN:
702 citation_search_pattern = lexrc.getString();
705 case RC_CITATION_SEARCH_VIEW:
707 citation_search_view = lexrc.getString();
710 case RC_CT_ADDITIONS_UNDERLINED:
711 lexrc >> ct_additions_underlined;
714 case RC_CT_MARKUP_COPIED:
715 lexrc >> ct_markup_copied;
718 case RC_CURSOR_FOLLOWS_SCROLLBAR:
719 lexrc >> cursor_follows_scrollbar;
722 case RC_CURSOR_WIDTH:
723 lexrc >> cursor_width;
726 case RC_SCROLL_BELOW_DOCUMENT:
727 lexrc >> scroll_below_document;
730 case RC_PARAGRAPH_MARKERS:
731 lexrc >> paragraph_markers;
734 case RC_MAC_DONTSWAP_CTRL_META:
735 lexrc >> mac_dontswap_ctrl_meta;
738 case RC_MAC_LIKE_CURSOR_MOVEMENT:
739 lexrc >> mac_like_cursor_movement;
742 case RC_MACRO_EDIT_STYLE:
744 switch (lexrc.getInteger()) {
745 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
746 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
747 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
752 case RC_DIALOGS_ICONIFY_WITH_MAIN:
753 lexrc >> dialogs_iconify_with_main;
756 case RC_PLAINTEXT_LINELEN:
757 lexrc >> plaintext_linelen;
759 // Spellchecker settings:
760 case RC_ACCEPT_COMPOUND:
761 lexrc >> spellchecker_accept_compound;
763 case RC_USE_NATIVE_FILEDIALOG:
764 lexrc >> use_native_filedialog;
766 case RC_USE_SYSTEM_COLORS:
767 lexrc >> use_system_colors;
770 lexrc >> use_tooltip;
772 case RC_SPELLCHECKER:
773 lexrc >> spellchecker;
776 lexrc >> spellchecker_alt_lang;
779 lexrc >> spellchecker_esc_chars;
781 case RC_SPELLCHECK_CONTINUOUSLY:
782 lexrc >> spellcheck_continuously;
784 case RC_SPELLCHECK_NOTES:
785 lexrc >> spellcheck_notes;
788 lexrc >> make_backup;
790 case RC_SAVE_COMPRESSED:
791 lexrc >> save_compressed;
794 lexrc >> save_origin;
796 case RC_BACKUPDIR_PATH:
798 backupdir_path = os::internal_path(lexrc.getString());
800 case RC_DEFAULT_DECIMAL_SEP:
801 lexrc >> default_decimal_sep;
803 case RC_DEFAULT_LENGTH_UNIT:
805 default_length_unit = (Length::UNIT) lexrc.getInteger();
807 case RC_LANGUAGE_CUSTOM_PACKAGE:
808 lexrc >> language_custom_package;
810 case RC_LANGUAGE_AUTO_BEGIN:
811 lexrc >> language_auto_begin;
813 case RC_LANGUAGE_AUTO_END:
814 lexrc >> language_auto_end;
816 case RC_LANGUAGE_GLOBAL_OPTIONS:
817 lexrc >> language_global_options;
819 case RC_LANGUAGE_PACKAGE_SELECTION:
821 switch (lexrc.getInteger()) {
823 language_package_selection = LP_AUTO;
826 language_package_selection = LP_BABEL;
829 language_package_selection = LP_CUSTOM;
832 language_package_selection = LP_NONE;
837 case RC_LANGUAGE_COMMAND_BEGIN:
838 lexrc >> language_command_begin;
840 case RC_LANGUAGE_COMMAND_END:
841 lexrc >> language_command_end;
843 case RC_LANGUAGE_COMMAND_LOCAL:
844 lexrc >> language_command_local;
846 case RC_RESPECT_OS_KBD_LANGUAGE:
847 lexrc >> respect_os_kbd_language;
849 case RC_VISUAL_CURSOR:
850 lexrc >> visual_cursor;
852 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
853 lexrc >> close_buffer_with_last_view;
856 lexrc >> auto_number;
858 case RC_MARK_FOREIGN_LANGUAGE:
859 lexrc >> mark_foreign_language;
865 fmt = lexrc.getString();
866 if (lexrc.next(true))
867 command = lexrc.getString();
868 setMover(fmt, command);
873 string from, to, command, flags;
875 from = lexrc.getString();
877 to = lexrc.getString();
878 if (lexrc.next(true))
879 command = lexrc.getString();
881 flags = lexrc.getString();
883 theConverters().erase(from, to);
885 theConverters().add(from, to, command, flags);
888 // compatibility with versions older than 1.4.0 only
890 string format, command;
891 lexrc >> format >> command;
892 theFormats().setViewer(format, command);
895 case RC_FILEFORMAT: {
897 string format, extensions, shortcut;
898 docstring prettyname;
899 if (!(lexrc >> format >> extensions))
901 if (ok && lexrc.next(true))
902 prettyname = lexrc.getDocString();
906 if(!(lexrc >> shortcut))
908 string viewer, editor;
909 if (ok && lexrc.next(true))
910 viewer = lexrc.getString();
913 if (ok && lexrc.next(true))
914 editor = lexrc.getString();
918 if (!(lexrc >> flags >> mime))
920 int flgs = Format::none;
921 while (!flags.empty()) {
923 flags = split(flags, flag, ',');
924 if (flag == "document")
925 flgs |= Format::document;
926 else if (flag == "vector")
927 flgs |= Format::vector;
928 else if (flag == "zipped=native")
929 flgs |= Format::zipped_native;
930 else if (flag == "menu=export")
931 flgs |= Format::export_menu;
932 else if (flag == "menu=none")
933 flgs |= Format::no_menu;
935 LYXERR0("Ignoring unknown flag `"
936 << flag << "' for format `"
940 LYXERR0("Syntax error in format " << format);
941 else if (prettyname.empty()) {
942 if (theConverters().formatIsUsed(format))
943 LYXERR0("Can't delete format " << format);
945 theFormats().erase(format);
947 theFormats().add(format, extensions, prettyname,
948 shortcut, viewer, editor, mime, flgs);
952 case RC_VIEWER_ALTERNATIVES: {
953 string format, command;
954 if ((lexrc >> format) && lexrc.next(true)) {
955 command = lexrc.getString();
956 viewer_alternatives[format].insert(command);
960 case RC_EDITOR_ALTERNATIVES: {
961 string format, command;
962 if ((lexrc >> format) && lexrc.next(true)) {
963 command = lexrc.getString();
964 editor_alternatives[format].insert(command);
969 case RC_DEFAULT_OTF_VIEW_FORMAT:
970 lexrc >> default_otf_view_format;
973 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
974 lexrc >> default_platex_view_format;
977 case RC_DEFAULT_VIEW_FORMAT:
978 lexrc >> default_view_format;
981 case RC_GUI_LANGUAGE:
982 lexrc >> gui_language;
986 lexrc >> show_banner;
991 string const tmp = lexrc.getString();
992 if (tmp == "true" || tmp == "on")
993 preview = PREVIEW_ON;
994 else if (tmp == "no_math")
995 preview = PREVIEW_NO_MATH;
997 preview = PREVIEW_OFF;
998 if (tmp != "false" && tmp != "off")
999 LYXERR0("Unrecognized preview status \""
1005 case RC_PREVIEW_HASHED_LABELS:
1006 lexrc >> preview_hashed_labels;
1009 case RC_PREVIEW_SCALE_FACTOR:
1010 lexrc >> preview_scale_factor;
1017 lexrc >> user_email;
1019 case RC_USER_INITIALS:
1020 lexrc >> user_initials;
1023 case RC_PATH_PREFIX:
1024 lexrc >> path_prefix;
1027 case RC_USE_CONVERTER_CACHE:
1028 lexrc >> use_converter_cache;
1030 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1031 lexrc >> use_converter_needauth_forbidden;
1033 case RC_USE_CONVERTER_NEEDAUTH:
1034 lexrc >> use_converter_needauth;
1036 case RC_CONVERTER_CACHE_MAXAGE:
1037 lexrc >> converter_cache_maxage;
1040 case RC_SORT_LAYOUTS:
1041 lexrc >> sort_layouts;
1043 case RC_GROUP_LAYOUTS:
1044 lexrc >> group_layouts;
1046 case RC_SCREEN_LIMIT:
1047 lexrc >> screen_limit;
1049 case RC_FULL_SCREEN_TOOLBARS:
1050 lexrc >> full_screen_toolbars;
1052 case RC_FULL_SCREEN_SCROLLBAR:
1053 lexrc >> full_screen_scrollbar;
1055 case RC_FULL_SCREEN_STATUSBAR:
1056 lexrc >> full_screen_statusbar;
1058 case RC_FULL_SCREEN_TABBAR:
1059 lexrc >> full_screen_tabbar;
1061 case RC_FULL_SCREEN_MENUBAR:
1062 lexrc >> full_screen_menubar;
1064 case RC_SCREEN_WIDTH:
1065 lexrc >> screen_width;
1067 case RC_OPEN_BUFFERS_IN_TABS:
1068 lexrc >> open_buffers_in_tabs;
1069 #ifdef USE_MACOSX_PACKAGING
1070 if (appleUserTabbingPreferenceAlways())
1071 open_buffers_in_tabs = true;
1074 case RC_SINGLE_CLOSE_TAB_BUTTON:
1075 lexrc >> single_close_tab_button;
1077 case RC_SINGLE_INSTANCE:
1078 lexrc >> single_instance;
1079 if (run_mode == PREFERRED)
1080 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1082 case RC_FORWARD_SEARCH_DVI:
1083 if (lexrc.next(true))
1084 forward_search_dvi = lexrc.getString();
1086 case RC_FORWARD_SEARCH_PDF:
1087 if (lexrc.next(true))
1088 forward_search_pdf = lexrc.getString();
1090 case RC_EXPORT_OVERWRITE:
1092 string const tmp = lexrc.getString();
1093 if (tmp == "all" || tmp == "true")
1094 export_overwrite = ALL_FILES;
1095 else if (tmp == "main")
1096 export_overwrite = MAIN_FILE;
1098 export_overwrite = NO_FILES;
1099 if (tmp != "ask" && tmp != "false")
1100 LYXERR0("Unrecognized export_overwrite status \""
1105 case RC_SCROLL_WHEEL_ZOOM:
1107 string const tmp = lexrc.getString();
1109 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1110 else if (tmp == "shift")
1111 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1112 else if (tmp == "alt")
1113 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1115 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1116 if (tmp != "off" && tmp != "false")
1117 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1123 case RC_MOUSE_MIDDLEBUTTON_PASTE:
1124 lexrc >> mouse_middlebutton_paste;
1127 case RC_BOOKMARKS_VISIBILITY:
1129 string const tmp = lexrc.getString();
1131 bookmarks_visibility = BMK_NONE;
1132 else if (tmp == "margin")
1133 bookmarks_visibility = BMK_MARGIN;
1134 else if (tmp == "inline")
1135 bookmarks_visibility = BMK_INLINE;
1137 bookmarks_visibility = BMK_NONE;
1138 LYXERR0("Unrecognized bookmark visibility " << tmp <<'"');
1143 case RC_DRAW_STRATEGY:
1145 string const tmp = lexrc.getString();
1146 if (tmp == "partial")
1147 draw_strategy = DS_PARTIAL;
1148 else if (tmp == "backingstore")
1149 draw_strategy = DS_BACKINGSTORE;
1151 draw_strategy = DS_PARTIAL;
1152 LYXERR0("Unrecognized draw strategy " << tmp <<'"');
1158 break; // this is just a dummy
1161 // This is triggered the first time through the loop unless
1162 // we hit a format tag.
1163 if (check_format && rc_format != LYXRC_FILEFORMAT)
1164 return FormatMismatch;
1167 /// Update converters data-structures
1168 theConverters().update(theFormats());
1169 theConverters().buildGraph();
1170 theBufferList().invalidateConverterCache();
1176 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1178 ofstream ofs(filename.toFilesystemEncoding().c_str());
1180 write(ofs, ignore_system_lyxrc);
1184 void LyXRC::print() const
1186 if (lyxerr.debugging())
1187 write(lyxerr, false);
1195 typedef pair<string, SpecialisedMover> Data;
1197 SameMover(Data const & comparison)
1198 : comparison_(comparison) {}
1200 bool operator()(Data const & data) const
1202 return data.first == comparison_.first &&
1203 data.second.command() == comparison_.second.command();
1213 // Escape \ and " so that LyXLex can read the string later
1214 string escapeCommand(string const & str) {
1215 return subst(subst(str , "\\", "\\\\"),
1222 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1224 LyXRCTags tag = RC_LAST;
1226 if (!name.empty()) {
1227 for (int i = 0; i != lyxrcCount; ++i)
1228 if ("\\" + name == lyxrcTags[i].tag)
1229 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1233 os << "# LyX " << lyx_version
1234 << " generated this file. If you want to make your own\n"
1235 << "# modifications you should do them from inside LyX and save.\n\n"
1236 << "Format " << LYXRC_FILEFORMAT << "\n\n";
1238 // Why the switch you might ask. It is a trick to ensure that all
1239 // the elements in the LyXRCTags enum are handled. As you can see
1240 // there are no breaks at all. So it is just a huge fall-through.
1241 // The nice thing is that we will get a warning from the compiler
1242 // if we forget an element.
1246 // input/include files are not done here
1247 case RC_LYXRCFORMAT:
1249 if (ignore_system_lyxrc ||
1250 bind_file != system_lyxrc.bind_file) {
1251 string const path = os::external_path(bind_file);
1252 os << "\\bind_file \"" << path << "\"\n";
1258 if (ignore_system_lyxrc ||
1259 def_file != system_lyxrc.def_file) {
1260 string const path = os::external_path(def_file);
1261 os << "\\def_file \"" << path << "\"\n";
1270 << "# MISC SECTION ######################################\n"
1272 // bind files are not done here.
1274 case RC_PATH_PREFIX:
1275 if (ignore_system_lyxrc ||
1276 path_prefix != system_lyxrc.path_prefix) {
1277 os << "\\path_prefix \"" << path_prefix << "\"\n";
1283 if (ignore_system_lyxrc ||
1284 ui_file != system_lyxrc.ui_file) {
1285 string const path = os::external_path(ui_file);
1286 os << "\\ui_file \"" << path << "\"\n";
1291 case RC_AUTOREGIONDELETE:
1292 if (ignore_system_lyxrc ||
1293 auto_region_delete != system_lyxrc.auto_region_delete) {
1294 os << "# Set to false to inhibit automatic replacement of\n"
1295 << "# the current selection.\n"
1296 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1302 case RC_AUTORESET_OPTIONS:
1303 if (ignore_system_lyxrc ||
1304 auto_reset_options != system_lyxrc.auto_reset_options) {
1305 os << "# Set to false to inhibit automatic reset of\n"
1306 << "# the class options to defaults on class change.\n"
1307 << "\\auto_reset_options "
1308 << convert<string>(auto_reset_options)
1315 if (ignore_system_lyxrc ||
1316 autosave != system_lyxrc.autosave) {
1317 os << "# The time interval between auto-saves in seconds.\n"
1318 << "\\autosave " << autosave << '\n';
1323 case RC_DISPLAY_GRAPHICS:
1324 if (ignore_system_lyxrc ||
1325 display_graphics != system_lyxrc.display_graphics) {
1326 os << "# Display graphics within LyX\n"
1328 << "\\display_graphics "
1329 << (display_graphics ? "true" : "false")
1335 case RC_SORT_LAYOUTS:
1336 if (ignore_system_lyxrc ||
1337 sort_layouts != system_lyxrc.sort_layouts) {
1338 os << "# Sort layouts alphabetically.\n"
1339 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1344 case RC_GROUP_LAYOUTS:
1345 if (ignore_system_lyxrc ||
1346 group_layouts != system_lyxrc.group_layouts) {
1347 os << "# Group layouts by their category.\n"
1348 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1353 case RC_VIEWDVI_PAPEROPTION:
1354 if (ignore_system_lyxrc ||
1355 view_dvi_paper_option
1356 != system_lyxrc.view_dvi_paper_option) {
1357 os << "# Options used to specify paper size to the\n"
1358 << "# view_dvi_command (e.g. -paper)\n"
1359 << "\\view_dvi_paper_option \""
1360 << view_dvi_paper_option << "\"\n";
1365 case RC_CHKTEX_COMMAND:
1366 if (ignore_system_lyxrc ||
1367 chktex_command != system_lyxrc.chktex_command) {
1368 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1373 case RC_BIBTEX_ALTERNATIVES: {
1374 CommandSet::const_iterator it = bibtex_alternatives.begin();
1375 CommandSet::const_iterator end = bibtex_alternatives.end();
1376 for ( ; it != end; ++it) {
1377 if (ignore_system_lyxrc
1378 || !system_lyxrc.bibtex_alternatives.count(*it))
1379 os << "\\bibtex_alternatives \""
1386 case RC_BIBTEX_COMMAND:
1387 if (ignore_system_lyxrc ||
1388 bibtex_command != system_lyxrc.bibtex_command) {
1389 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1394 case RC_JBIBTEX_COMMAND:
1395 if (ignore_system_lyxrc ||
1396 jbibtex_command != system_lyxrc.jbibtex_command) {
1397 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1402 case RC_JBIBTEX_ALTERNATIVES: {
1403 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1404 CommandSet::const_iterator end = jbibtex_alternatives.end();
1405 for ( ; it != end; ++it) {
1406 if (ignore_system_lyxrc
1407 || !system_lyxrc.jbibtex_alternatives.count(*it))
1408 os << "\\jbibtex_alternatives \""
1415 case RC_INDEX_ALTERNATIVES: {
1416 CommandSet::const_iterator it = index_alternatives.begin();
1417 CommandSet::const_iterator end = index_alternatives.end();
1418 for ( ; it != end; ++it) {
1419 if (ignore_system_lyxrc
1420 || !system_lyxrc.index_alternatives.count(*it))
1421 os << "\\index_alternatives \""
1428 case RC_INDEX_COMMAND:
1429 if (ignore_system_lyxrc ||
1430 index_command != system_lyxrc.index_command) {
1431 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1436 case RC_JINDEX_COMMAND:
1437 if (ignore_system_lyxrc ||
1438 jindex_command != system_lyxrc.jindex_command) {
1439 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1444 case RC_SPLITINDEX_COMMAND:
1445 if (ignore_system_lyxrc ||
1446 splitindex_command != system_lyxrc.splitindex_command) {
1447 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1452 case RC_NOMENCL_COMMAND:
1453 if (ignore_system_lyxrc ||
1454 nomencl_command != system_lyxrc.nomencl_command) {
1455 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1460 case RC_PYGMENTIZE_COMMAND:
1461 if (ignore_system_lyxrc ||
1462 pygmentize_command != system_lyxrc.pygmentize_command) {
1463 os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1468 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1469 // Don't write this setting to the preferences file,
1470 // but allow temporary changes (bug 7557).
1471 if (ignore_system_lyxrc) {
1472 os << "\\tex_expects_windows_paths "
1473 << convert<string>(windows_style_tex_paths) << '\n';
1478 case RC_TEX_ALLOWS_SPACES:
1479 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1480 os << "\\tex_allows_spaces "
1481 << convert<string>(tex_allows_spaces) << '\n';
1487 if (ignore_system_lyxrc ||
1488 use_kbmap != system_lyxrc.use_kbmap) {
1489 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1494 case RC_KBMAP_PRIMARY:
1495 if (ignore_system_lyxrc ||
1496 primary_kbmap != system_lyxrc.primary_kbmap) {
1497 string const path = os::external_path(primary_kbmap);
1498 os << "\\kbmap_primary \"" << path << "\"\n";
1503 case RC_KBMAP_SECONDARY:
1504 if (ignore_system_lyxrc ||
1505 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1506 string const path = os::external_path(secondary_kbmap);
1507 os << "\\kbmap_secondary \"" << path << "\"\n";
1513 if (ignore_system_lyxrc ||
1514 lyxpipes != system_lyxrc.lyxpipes) {
1515 string const path = os::external_path(lyxpipes);
1516 os << "\\serverpipe \"" << path << "\"\n";
1522 os << "\\user_name \"" << user_name << "\"\n";
1527 os << "\\user_email \"" << user_email << "\"\n";
1531 case RC_USER_INITIALS:
1532 os << "\\user_initials \"" << user_initials << "\"\n";
1536 case RC_SHOW_BANNER:
1537 if (ignore_system_lyxrc ||
1538 show_banner != system_lyxrc.show_banner) {
1539 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1545 if (ignore_system_lyxrc ||
1546 preview != system_lyxrc.preview) {
1552 case PREVIEW_NO_MATH:
1559 os << "\\preview " << status << '\n';
1564 case RC_PREVIEW_HASHED_LABELS:
1565 if (ignore_system_lyxrc ||
1566 preview_hashed_labels !=
1567 system_lyxrc.preview_hashed_labels) {
1568 os << "\\preview_hashed_labels "
1569 << convert<string>(preview_hashed_labels) << '\n';
1574 case RC_PREVIEW_SCALE_FACTOR:
1575 if (ignore_system_lyxrc ||
1576 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1577 os << "\\preview_scale_factor "
1578 << preview_scale_factor << '\n';
1583 case RC_USE_CONVERTER_CACHE:
1584 if (ignore_system_lyxrc ||
1585 use_converter_cache != system_lyxrc.use_converter_cache) {
1586 os << "\\use_converter_cache "
1587 << convert<string>(use_converter_cache) << '\n';
1592 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1593 if (ignore_system_lyxrc ||
1594 use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1595 os << "\\use_converter_needauth_forbidden "
1596 << convert<string>(use_converter_needauth_forbidden) << '\n';
1601 case RC_USE_CONVERTER_NEEDAUTH:
1602 if (ignore_system_lyxrc ||
1603 use_converter_needauth != system_lyxrc.use_converter_needauth) {
1604 os << "\\use_converter_needauth "
1605 << convert<string>(use_converter_needauth) << '\n';
1610 case RC_CONVERTER_CACHE_MAXAGE:
1611 if (ignore_system_lyxrc ||
1612 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1613 os << "\\converter_cache_maxage "
1614 << converter_cache_maxage << '\n';
1620 << "# SCREEN & FONTS SECTION ############################\n"
1624 if (ignore_system_lyxrc ||
1625 icon_set != system_lyxrc.icon_set) {
1626 os << "\\icon_set \"" << icon_set
1633 if (ignore_system_lyxrc ||
1634 ui_style != system_lyxrc.ui_style) {
1635 os << "\\ui_style \"" << ui_style
1641 case RC_USE_SYSTEM_THEME_ICONS:
1642 if (ignore_system_lyxrc ||
1643 use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1644 os << "\\use_system_theme_icons "
1645 << convert<string>(use_system_theme_icons)
1652 if (ignore_system_lyxrc ||
1653 dpi != system_lyxrc.dpi) {
1654 os << "\\screen_dpi " << dpi << '\n';
1659 case RC_SCREEN_ZOOM:
1660 if (ignore_system_lyxrc ||
1661 defaultZoom != system_lyxrc.defaultZoom) {
1662 os << "\\screen_zoom " << defaultZoom << '\n';
1667 case RC_GEOMETRY_SESSION:
1668 if (ignore_system_lyxrc ||
1669 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1670 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1676 case RC_CITATION_SEARCH:
1677 if (ignore_system_lyxrc ||
1678 citation_search != system_lyxrc.citation_search) {
1679 os << "# Set to true to use script to search"
1680 << " local disk for citation targets.\n"
1681 << "\\citation_search "
1682 << convert<string>(citation_search)
1688 case RC_CITATION_SEARCH_VIEW:
1689 if (ignore_system_lyxrc ||
1690 citation_search_view != system_lyxrc.citation_search_view) {
1691 os << "\\citation_search_view \""
1692 << citation_search_view << "\"\n";
1697 case RC_CITATION_SEARCH_PATTERN:
1698 if (ignore_system_lyxrc ||
1699 citation_search_pattern != system_lyxrc.citation_search_pattern) {
1700 os << "\\citation_search_pattern \""
1701 << citation_search_pattern << "\"\n";
1706 case RC_CT_ADDITIONS_UNDERLINED:
1707 if (ignore_system_lyxrc ||
1708 ct_additions_underlined
1709 != system_lyxrc.ct_additions_underlined) {
1710 os << "\\ct_additions_underlined "
1711 << convert<string>(ct_additions_underlined) << '\n';
1716 case RC_CT_MARKUP_COPIED:
1717 if (ignore_system_lyxrc ||
1719 != system_lyxrc.ct_markup_copied) {
1720 os << "\\ct_markup_copied "
1721 << convert<string>(ct_markup_copied) << '\n';
1726 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1727 if (ignore_system_lyxrc ||
1728 cursor_follows_scrollbar
1729 != system_lyxrc.cursor_follows_scrollbar) {
1730 os << "\\cursor_follows_scrollbar "
1731 << convert<string>(cursor_follows_scrollbar) << '\n';
1736 case RC_CURSOR_WIDTH:
1737 if (ignore_system_lyxrc ||
1739 != system_lyxrc.cursor_width) {
1740 os << "\\cursor_width "
1741 << cursor_width << '\n';
1746 case RC_SCROLL_BELOW_DOCUMENT:
1747 if (ignore_system_lyxrc ||
1748 scroll_below_document
1749 != system_lyxrc.scroll_below_document) {
1750 os << "\\scroll_below_document "
1751 << convert<string>(scroll_below_document) << '\n';
1756 case RC_PARAGRAPH_MARKERS:
1757 if (ignore_system_lyxrc ||
1759 != system_lyxrc.paragraph_markers) {
1760 os << "\\paragraph_markers "
1761 << convert<string>(paragraph_markers) << '\n';
1766 case RC_BOOKMARKS_VISIBILITY:
1767 if (ignore_system_lyxrc ||
1768 bookmarks_visibility != system_lyxrc.bookmarks_visibility) {
1770 switch (bookmarks_visibility) {
1781 os << "\\experimental:bookmarks_visibility " << status << '\n';
1786 case RC_MAC_DONTSWAP_CTRL_META:
1787 if (ignore_system_lyxrc ||
1788 mac_dontswap_ctrl_meta
1789 != system_lyxrc.mac_dontswap_ctrl_meta) {
1790 os << "\\mac_dontswap_ctrl_meta "
1791 << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1796 case RC_MAC_LIKE_CURSOR_MOVEMENT:
1797 if (ignore_system_lyxrc ||
1798 mac_like_cursor_movement
1799 != system_lyxrc.mac_like_cursor_movement) {
1800 os << "\\mac_like_cursor_movement "
1801 << convert<string>(mac_like_cursor_movement) << '\n';
1806 case RC_MACRO_EDIT_STYLE:
1807 if (ignore_system_lyxrc ||
1809 != system_lyxrc.macro_edit_style) {
1810 os << "\\macro_edit_style ";
1811 switch (macro_edit_style) {
1812 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1813 case MACRO_EDIT_INLINE: os << "1\n"; break;
1814 case MACRO_EDIT_LIST: os << "2\n"; break;
1820 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1821 if (ignore_system_lyxrc ||
1822 dialogs_iconify_with_main
1823 != system_lyxrc.dialogs_iconify_with_main) {
1824 os << "\\dialogs_iconify_with_main "
1825 << convert<string>(dialogs_iconify_with_main) << '\n';
1830 case RC_SCREEN_FONT_ROMAN:
1831 if (ignore_system_lyxrc ||
1832 roman_font_name != system_lyxrc.roman_font_name) {
1833 os << "\\screen_font_roman \"" << roman_font_name
1839 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1840 if (ignore_system_lyxrc ||
1841 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1842 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1848 case RC_SCREEN_FONT_SANS:
1849 if (ignore_system_lyxrc ||
1850 sans_font_name != system_lyxrc.sans_font_name) {
1851 os << "\\screen_font_sans \"" << sans_font_name
1857 case RC_SCREEN_FONT_SANS_FOUNDRY:
1858 if (ignore_system_lyxrc ||
1859 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1860 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1866 case RC_SCREEN_FONT_TYPEWRITER:
1867 if (ignore_system_lyxrc ||
1868 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1869 os << "\\screen_font_typewriter \""
1870 << typewriter_font_name << "\"\n";
1875 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1876 if (ignore_system_lyxrc ||
1877 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1878 os << "\\screen_font_typewriter_foundry \""
1879 << typewriter_font_foundry << "\"\n";
1884 case RC_SCREEN_FONT_SCALABLE:
1885 if (ignore_system_lyxrc ||
1886 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1887 os << "\\screen_font_scalable "
1888 << convert<string>(use_scalable_fonts)
1894 case RC_SCREEN_FONT_SIZES:
1895 if (ignore_system_lyxrc ||
1896 font_sizes[TINY_SIZE]
1897 != system_lyxrc.font_sizes[TINY_SIZE] ||
1898 font_sizes[SCRIPT_SIZE]
1899 != system_lyxrc.font_sizes[SCRIPT_SIZE] ||
1900 font_sizes[FOOTNOTE_SIZE]
1901 != system_lyxrc.font_sizes[FOOTNOTE_SIZE] ||
1902 font_sizes[SMALL_SIZE]
1903 != system_lyxrc.font_sizes[SMALL_SIZE] ||
1904 font_sizes[NORMAL_SIZE]
1905 != system_lyxrc.font_sizes[NORMAL_SIZE] ||
1906 font_sizes[LARGE_SIZE]
1907 != system_lyxrc.font_sizes[LARGE_SIZE] ||
1908 font_sizes[LARGER_SIZE]
1909 != system_lyxrc.font_sizes[LARGER_SIZE] ||
1910 font_sizes[LARGEST_SIZE]
1911 != system_lyxrc.font_sizes[LARGEST_SIZE] ||
1912 font_sizes[HUGE_SIZE]
1913 != system_lyxrc.font_sizes[HUGE_SIZE] ||
1914 font_sizes[HUGER_SIZE]
1915 != system_lyxrc.font_sizes[HUGER_SIZE]) {
1916 streamsize old_prec = os.precision();
1917 os.setf(ios::fixed);
1919 os << "\\screen_font_sizes"
1920 << ' ' << font_sizes[TINY_SIZE]
1921 << ' ' << font_sizes[SCRIPT_SIZE]
1922 << ' ' << font_sizes[FOOTNOTE_SIZE]
1923 << ' ' << font_sizes[SMALL_SIZE]
1924 << ' ' << font_sizes[NORMAL_SIZE]
1925 << ' ' << font_sizes[LARGE_SIZE]
1926 << ' ' << font_sizes[LARGER_SIZE]
1927 << ' ' << font_sizes[LARGEST_SIZE]
1928 << ' ' << font_sizes[HUGE_SIZE]
1929 << ' ' << font_sizes[HUGER_SIZE]
1931 os.precision(old_prec);
1932 os.unsetf(ios::fixed);
1937 case RC_SCREEN_LIMIT:
1938 if (ignore_system_lyxrc ||
1939 screen_limit != system_lyxrc.screen_limit) {
1940 os << "\\screen_limit "
1941 << convert<string>(screen_limit)
1947 case RC_FULL_SCREEN_TOOLBARS:
1948 if (ignore_system_lyxrc ||
1949 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1950 os << "\\fullscreen_toolbars "
1951 << convert<string>(full_screen_toolbars)
1957 case RC_FULL_SCREEN_SCROLLBAR:
1958 if (ignore_system_lyxrc ||
1959 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1960 os << "\\fullscreen_scrollbar "
1961 << convert<string>(full_screen_scrollbar)
1967 case RC_FULL_SCREEN_STATUSBAR:
1968 if (ignore_system_lyxrc ||
1969 full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1970 os << "\\fullscreen_statusbar "
1971 << convert<string>(full_screen_statusbar)
1977 case RC_FULL_SCREEN_TABBAR:
1978 if (ignore_system_lyxrc ||
1979 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1980 os << "\\fullscreen_tabbar "
1981 << convert<string>(full_screen_tabbar)
1987 case RC_FULL_SCREEN_MENUBAR:
1988 if (ignore_system_lyxrc ||
1989 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1990 os << "\\fullscreen_menubar "
1991 << convert<string>(full_screen_menubar)
1997 case RC_SCREEN_WIDTH:
1998 if (ignore_system_lyxrc ||
1999 screen_width != system_lyxrc.screen_width) {
2000 os << "\\screen_width "
2001 << screen_width.asString()
2007 case RC_OPEN_BUFFERS_IN_TABS:
2008 if (ignore_system_lyxrc ||
2009 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
2010 os << "\\open_buffers_in_tabs "
2011 << convert<string>(open_buffers_in_tabs)
2017 case RC_SINGLE_CLOSE_TAB_BUTTON:
2018 if (ignore_system_lyxrc ||
2019 single_close_tab_button != system_lyxrc.single_close_tab_button) {
2020 os << "\\single_close_tab_button "
2021 << convert<string>(single_close_tab_button)
2027 case RC_SINGLE_INSTANCE:
2028 if (ignore_system_lyxrc ||
2029 single_instance != system_lyxrc.single_instance) {
2030 os << "\\single_instance "
2031 << convert<string>(single_instance)
2037 case RC_FORWARD_SEARCH_DVI:
2038 if (ignore_system_lyxrc ||
2039 forward_search_dvi != system_lyxrc.forward_search_dvi) {
2040 os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2045 case RC_FORWARD_SEARCH_PDF:
2046 if (ignore_system_lyxrc ||
2047 forward_search_pdf != system_lyxrc.forward_search_pdf) {
2048 os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2053 case RC_DRAW_STRATEGY:
2054 if (ignore_system_lyxrc ||
2055 draw_strategy != system_lyxrc.draw_strategy) {
2057 switch (draw_strategy) {
2061 case DS_BACKINGSTORE:
2062 status = "backingstore";
2065 os << "\\draw_strategy " << status << '\n';
2072 << "# COLOR SECTION ###################################\n"
2077 for (int i = 0; i < Color_ignore; ++i) {
2078 ColorCode lc = static_cast<ColorCode>(i);
2079 string const col = lcolor.getAllX11HexNames(lc).first;
2080 string const darkcol = lcolor.getAllX11HexNames(lc).second;
2081 if (ignore_system_lyxrc
2082 || col != system_lcolor.getAllX11HexNames(lc).first
2083 || darkcol != system_lcolor.getAllX11HexNames(lc).second) {
2084 os << "\\set_color \""
2085 << lcolor.getLyXName(lc) << "\" \""
2087 << darkcol << "\"\n";
2094 << "# PRINTER SECTION ###################################\n"
2098 case RC_PRINTLANDSCAPEFLAG:
2099 if (ignore_system_lyxrc ||
2100 print_landscape_flag != system_lyxrc.print_landscape_flag) {
2101 os << "\\print_landscape_flag \"" << print_landscape_flag
2107 case RC_PRINTPAPERFLAG:
2108 if (ignore_system_lyxrc ||
2109 print_paper_flag != system_lyxrc.print_paper_flag) {
2110 os << "\\print_paper_flag \"" << print_paper_flag
2116 case RC_PRINTPAPERDIMENSIONFLAG:
2117 if (ignore_system_lyxrc ||
2118 print_paper_dimension_flag
2119 != system_lyxrc.print_paper_dimension_flag) {
2120 os << "\\print_paper_dimension_flag \""
2121 << print_paper_dimension_flag << "\"\n";
2127 << "# TEX SECTION #######################################\n"
2131 case RC_TEXINPUTS_PREFIX:
2132 if (ignore_system_lyxrc ||
2133 texinputs_prefix != system_lyxrc.texinputs_prefix) {
2134 os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2140 << "# FILE SECTION ######################################\n"
2143 case RC_DOCUMENTPATH:
2144 if (ignore_system_lyxrc ||
2145 document_path != system_lyxrc.document_path) {
2146 string const path = os::external_path(document_path);
2147 os << "\\document_path \"" << path << "\"\n";
2152 case RC_USELASTFILEPOS:
2153 if (ignore_system_lyxrc ||
2154 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2155 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2161 case RC_LOADSESSION:
2162 if (ignore_system_lyxrc ||
2163 load_session != system_lyxrc.load_session) {
2164 os << "\\load_session " << convert<string>(load_session)
2170 case RC_MOUSE_WHEEL_SPEED:
2171 if (ignore_system_lyxrc ||
2172 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2173 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2178 case RC_MOUSE_MIDDLEBUTTON_PASTE:
2179 if (ignore_system_lyxrc ||
2180 mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2181 os << "\\mouse_middlebutton_paste "
2182 << convert<string>(mouse_middlebutton_paste) << '\n';
2187 case RC_COMPLETION_INLINE_DELAY:
2188 if (ignore_system_lyxrc ||
2189 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2190 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2195 case RC_COMPLETION_INLINE_MATH:
2196 if (ignore_system_lyxrc ||
2197 completion_inline_math != system_lyxrc.completion_inline_math) {
2198 os << "\\completion_inline_math "
2199 << convert<string>(completion_inline_math) << '\n';
2204 case RC_COMPLETION_INLINE_TEXT:
2205 if (ignore_system_lyxrc ||
2206 completion_inline_text != system_lyxrc.completion_inline_text) {
2207 os << "\\completion_inline_text "
2208 << convert<string>(completion_inline_text) << '\n';
2213 case RC_COMPLETION_INLINE_DOTS:
2214 if (ignore_system_lyxrc ||
2215 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2216 os << "\\completion_inline_dots "
2217 << convert<string>(completion_inline_dots) << '\n';
2222 case RC_AUTOCORRECTION_MATH:
2223 if (ignore_system_lyxrc ||
2224 autocorrection_math != system_lyxrc.autocorrection_math) {
2225 os << "\\autocorrection_math "
2226 << convert<string>(autocorrection_math) << '\n';
2231 case RC_COMPLETION_POPUP_DELAY:
2232 if (ignore_system_lyxrc ||
2233 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2234 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2239 case RC_COMPLETION_POPUP_MATH:
2240 if (ignore_system_lyxrc ||
2241 completion_popup_math != system_lyxrc.completion_popup_math) {
2242 os << "\\completion_popup_math "
2243 << convert<string>(completion_popup_math) << '\n';
2248 case RC_COMPLETION_POPUP_TEXT:
2249 if (ignore_system_lyxrc ||
2250 completion_popup_text != system_lyxrc.completion_popup_text) {
2251 os << "\\completion_popup_text "
2252 << convert<string>(completion_popup_text) << '\n';
2257 case RC_COMPLETION_CURSOR_TEXT:
2258 if (ignore_system_lyxrc ||
2259 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2260 os << "\\completion_cursor_text "
2261 << convert<string>(completion_cursor_text) << '\n';
2266 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2267 if (ignore_system_lyxrc ||
2268 completion_popup_after_complete
2269 != system_lyxrc.completion_popup_after_complete) {
2270 os << "\\completion_popup_after_complete "
2271 << convert<string>(completion_popup_after_complete) << '\n';
2276 case RC_COMPLETION_MINLENGTH:
2277 if (ignore_system_lyxrc ||
2278 completion_minlength != system_lyxrc.completion_minlength) {
2279 os << "\\completion_minlength " << convert<string>(completion_minlength)
2285 case RC_NUMLASTFILES:
2286 if (ignore_system_lyxrc ||
2287 num_lastfiles != system_lyxrc.num_lastfiles) {
2288 os << "\\num_lastfiles " << num_lastfiles << '\n';
2293 case RC_CHECKLASTFILES:
2294 if (ignore_system_lyxrc ||
2295 check_lastfiles != system_lyxrc.check_lastfiles) {
2296 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2302 case RC_EXAMPLEPATH:
2303 if (ignore_system_lyxrc ||
2304 example_path != system_lyxrc.example_path) {
2305 string const path = os::external_path(example_path);
2306 os << "\\example_path \"" << path << "\"\n";
2311 case RC_TEMPLATEPATH:
2312 if (ignore_system_lyxrc ||
2313 template_path != system_lyxrc.template_path) {
2314 string const path = os::external_path(template_path);
2315 os << "\\template_path \"" << path << "\"\n";
2320 case RC_TEMPDIRPATH:
2321 if (ignore_system_lyxrc ||
2322 tempdir_path != system_lyxrc.tempdir_path) {
2323 string const path = os::external_path(tempdir_path);
2324 os << "\\tempdir_path \"" << path << "\"\n";
2329 case RC_THESAURUSDIRPATH:
2330 if (ignore_system_lyxrc ||
2331 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2332 string const path = os::external_path(thesaurusdir_path);
2333 os << "\\thesaurusdir_path \"" << path << "\"\n";
2338 case RC_HUNSPELLDIR_PATH:
2339 if (ignore_system_lyxrc ||
2340 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2341 string const path = os::external_path(hunspelldir_path);
2342 os << "\\hunspelldir_path \"" << path << "\"\n";
2347 case RC_PLAINTEXT_LINELEN:
2348 if (ignore_system_lyxrc ||
2349 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2350 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2355 case RC_MAKE_BACKUP:
2356 if (ignore_system_lyxrc ||
2357 make_backup != system_lyxrc.make_backup) {
2358 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2363 case RC_SAVE_COMPRESSED:
2364 if (ignore_system_lyxrc ||
2365 save_compressed != system_lyxrc.save_compressed) {
2366 os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2371 case RC_SAVE_ORIGIN:
2372 if (ignore_system_lyxrc ||
2373 save_origin != system_lyxrc.save_origin) {
2374 os << "\\save_origin " << convert<string>(save_origin) << '\n';
2379 case RC_BACKUPDIR_PATH:
2380 if (ignore_system_lyxrc ||
2381 backupdir_path != system_lyxrc.backupdir_path) {
2382 string const path = os::external_path(backupdir_path);
2383 os << "\\backupdir_path \"" << path << "\"\n";
2389 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2393 << "# SPELLCHECKER SECTION ##############################\n"
2397 case RC_ACCEPT_COMPOUND:
2398 if (ignore_system_lyxrc ||
2399 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2400 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2407 if (ignore_system_lyxrc ||
2408 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2409 os << "\\alternate_language \"" << spellchecker_alt_lang
2416 if (ignore_system_lyxrc ||
2417 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2418 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2423 case RC_USE_NATIVE_FILEDIALOG:
2424 if (ignore_system_lyxrc ||
2425 use_native_filedialog != system_lyxrc.use_native_filedialog) {
2426 os << "\\use_native_filedialog "
2427 << convert<string>(use_native_filedialog)
2433 case RC_USE_SYSTEM_COLORS:
2434 if (ignore_system_lyxrc ||
2435 use_system_colors != system_lyxrc.use_system_colors) {
2436 os << "\\use_system_colors "
2437 << convert<string>(use_system_colors)
2443 case RC_USE_TOOLTIP:
2444 if (ignore_system_lyxrc ||
2445 use_tooltip != system_lyxrc.use_tooltip) {
2446 os << "\\use_tooltip "
2447 << convert<string>(use_tooltip)
2455 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2459 case RC_DEFAULT_DECIMAL_SEP:
2460 if (ignore_system_lyxrc ||
2461 default_decimal_sep != system_lyxrc.default_decimal_sep) {
2462 os << "\\default_decimal_point \"" << default_decimal_sep << "\"" << '\n';
2467 case RC_DEFAULT_LENGTH_UNIT:
2468 if (ignore_system_lyxrc ||
2469 default_length_unit != system_lyxrc.default_length_unit) {
2470 os << "\\default_length_unit " << int(default_length_unit) << '\n';
2475 case RC_SPELLCHECKER:
2476 if (ignore_system_lyxrc ||
2477 spellchecker != system_lyxrc.spellchecker) {
2478 os << "\\spellchecker " << spellchecker << '\n';
2483 case RC_SPELLCHECK_CONTINUOUSLY:
2484 if (ignore_system_lyxrc ||
2485 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2486 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2492 case RC_SPELLCHECK_NOTES:
2493 if (ignore_system_lyxrc ||
2494 spellcheck_notes != system_lyxrc.spellcheck_notes) {
2495 os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2501 case RC_VISUAL_CURSOR:
2502 if (ignore_system_lyxrc ||
2503 visual_cursor != system_lyxrc.visual_cursor) {
2504 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2509 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2510 if (ignore_system_lyxrc ||
2511 close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2512 os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2513 os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2518 case RC_LANGUAGE_CUSTOM_PACKAGE:
2519 if (ignore_system_lyxrc ||
2520 language_custom_package != system_lyxrc.language_custom_package) {
2521 os << "\\language_custom_package \"" << language_custom_package
2527 case RC_LANGUAGE_GLOBAL_OPTIONS:
2528 if (ignore_system_lyxrc ||
2529 language_global_options
2530 != system_lyxrc.language_global_options) {
2531 os << "\\language_global_options \""
2532 << convert<string>(language_global_options)
2538 case RC_LANGUAGE_PACKAGE_SELECTION:
2539 if (ignore_system_lyxrc ||
2540 language_package_selection != system_lyxrc.language_package_selection) {
2541 os << "\\language_package_selection ";
2542 switch (language_package_selection) {
2560 case RC_LANGUAGE_COMMAND_BEGIN:
2561 if (ignore_system_lyxrc ||
2562 language_command_begin
2563 != system_lyxrc.language_command_begin) {
2564 os << "\\language_command_begin \""
2565 << language_command_begin
2571 case RC_LANGUAGE_COMMAND_END:
2572 if (ignore_system_lyxrc ||
2573 language_command_end
2574 != system_lyxrc.language_command_end) {
2575 os << "\\language_command_end \"" << language_command_end
2581 case RC_LANGUAGE_COMMAND_LOCAL:
2582 if (ignore_system_lyxrc ||
2583 language_command_local
2584 != system_lyxrc.language_command_local) {
2585 os << "\\language_command_local \""
2586 << language_command_local
2592 case RC_LANGUAGE_AUTO_BEGIN:
2593 if (ignore_system_lyxrc ||
2594 language_auto_begin != system_lyxrc.language_auto_begin) {
2595 os << "\\language_auto_begin "
2596 << convert<string>(language_auto_begin) << '\n';
2601 case RC_LANGUAGE_AUTO_END:
2602 if (ignore_system_lyxrc ||
2603 language_auto_end != system_lyxrc.language_auto_end) {
2604 os << "\\language_auto_end "
2605 << convert<string>(language_auto_end) << '\n';
2610 case RC_MARK_FOREIGN_LANGUAGE:
2611 if (ignore_system_lyxrc ||
2612 mark_foreign_language
2613 != system_lyxrc.mark_foreign_language) {
2614 os << "\\mark_foreign_language " <<
2615 convert<string>(mark_foreign_language) << '\n';
2618 case RC_RESPECT_OS_KBD_LANGUAGE:
2619 if (ignore_system_lyxrc ||
2620 respect_os_kbd_language
2621 != system_lyxrc.respect_os_kbd_language) {
2622 os << "\\respect_os_kbd_language " <<
2623 convert<string>(respect_os_kbd_language) << '\n';
2630 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2634 case RC_AUTO_NUMBER:
2635 if (ignore_system_lyxrc ||
2636 auto_number != system_lyxrc.auto_number) {
2637 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2642 case RC_GUI_LANGUAGE:
2643 if (ignore_system_lyxrc ||
2644 gui_language != system_lyxrc.gui_language) {
2645 os << "\\gui_language " << gui_language << '\n';
2650 case RC_EXPORT_OVERWRITE:
2651 if (ignore_system_lyxrc ||
2652 export_overwrite != system_lyxrc.export_overwrite) {
2654 switch (export_overwrite) {
2665 os << "\\export_overwrite " << status << '\n';
2670 case RC_SCROLL_WHEEL_ZOOM:
2671 if (ignore_system_lyxrc ||
2672 scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2674 switch (scroll_wheel_zoom) {
2675 case SCROLL_WHEEL_ZOOM_OFF:
2678 case SCROLL_WHEEL_ZOOM_CTRL:
2681 case SCROLL_WHEEL_ZOOM_SHIFT:
2684 case SCROLL_WHEEL_ZOOM_ALT:
2688 os << "\\scroll_wheel_zoom " << status << '\n';
2694 << "# FORMATS SECTION ##########################\n"
2699 // New/modified formats
2700 for (Formats::const_iterator cit = theFormats().begin();
2701 cit != theFormats().end(); ++cit) {
2702 Format const * format =
2703 theSystemFormats().getFormat(cit->name());
2705 format->extensions() != cit->extensions() ||
2706 format->prettyname() != cit->prettyname() ||
2707 format->shortcut() != cit->shortcut() ||
2708 format->viewer() != cit->viewer() ||
2709 format->editor() != cit->editor() ||
2710 format->documentFormat() != cit->documentFormat() ||
2711 format->vectorFormat() != cit->vectorFormat() ||
2712 format->inExportMenu() != cit->inExportMenu() ||
2713 format->noMenu() != cit->noMenu() ||
2714 format->mime() != cit->mime()) {
2715 os << "\\format \"" << cit->name() << "\" \""
2716 << cit->extensions() << "\" \""
2717 << to_utf8(cit->prettyname()) << "\" \""
2718 << cit->shortcut() << "\" \""
2719 << escapeCommand(cit->viewer()) << "\" \""
2720 << escapeCommand(cit->editor()) << "\" \"";
2721 vector<string> flags;
2722 if (cit->documentFormat())
2723 flags.push_back("document");
2724 if (cit->vectorFormat())
2725 flags.push_back("vector");
2726 if (cit->zippedNative())
2727 flags.push_back("zipped=native");
2728 if (cit->inExportMenu())
2729 flags.push_back("menu=export");
2731 os << getStringFromVector(flags);
2732 os << "\" \"" << cit->mime() << "\"\n";
2736 // Look for deleted formats
2737 for (Formats::const_iterator cit = theSystemFormats().begin();
2738 cit != theSystemFormats().end(); ++cit)
2739 if (!theFormats().getFormat(cit->name()))
2740 os << "\\format \"" << cit->name()
2741 << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2745 case RC_VIEWER_ALTERNATIVES: {
2746 Alternatives::const_iterator it = viewer_alternatives.begin();
2747 Alternatives::const_iterator const en = viewer_alternatives.end();
2748 Alternatives::const_iterator const sysend =
2749 system_lyxrc.viewer_alternatives.end();
2750 for (; it != en; ++it) {
2751 string const & fmt = it->first;
2752 CommandSet const & cmd = it->second;
2753 CommandSet::const_iterator sit = cmd.begin();
2754 CommandSet::const_iterator const sen = cmd.end();
2755 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2756 system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2757 system_lyxrc.viewer_alternatives.find(fmt);
2758 for (; sit != sen; ++sit) {
2759 string const & cmd = *sit;
2760 if (ignore_system_lyxrc
2761 || sysfmt == sysend // format not found
2762 || sysfmt->second.count(cmd) == 0 // this command not found
2764 os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2771 case RC_EDITOR_ALTERNATIVES: {
2772 Alternatives::const_iterator it = editor_alternatives.begin();
2773 Alternatives::const_iterator const en = editor_alternatives.end();
2774 Alternatives::const_iterator const sysend =
2775 system_lyxrc.editor_alternatives.end();
2776 for (; it != en; ++it) {
2777 string const & fmt = it->first;
2778 CommandSet const & cmd = it->second;
2779 CommandSet::const_iterator sit = cmd.begin();
2780 CommandSet::const_iterator const sen = cmd.end();
2781 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2782 system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2783 system_lyxrc.editor_alternatives.find(fmt);
2784 for (; sit != sen; ++sit) {
2785 string const & cmd = *sit;
2786 if (ignore_system_lyxrc
2787 || sysfmt == sysend // format not found
2788 || sysfmt->second.count(cmd) == 0 // this command not found
2790 os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2797 case RC_DEFAULT_OTF_VIEW_FORMAT:
2798 if ((ignore_system_lyxrc ||
2799 default_otf_view_format != system_lyxrc.default_otf_view_format)
2800 && !default_otf_view_format.empty()) {
2801 os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2806 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2807 if ((ignore_system_lyxrc ||
2808 default_platex_view_format != system_lyxrc.default_platex_view_format)
2809 && !default_platex_view_format.empty()) {
2810 os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2815 case RC_DEFAULT_VIEW_FORMAT:
2816 if ((ignore_system_lyxrc ||
2817 default_view_format != system_lyxrc.default_view_format)
2818 && !default_view_format.empty()) {
2819 os << "\\default_view_format " << default_view_format << '\n';
2830 << "# CONVERTERS SECTION ##########################\n"
2835 // Look for new converters
2836 for (Converters::const_iterator cit = theConverters().begin();
2837 cit != theConverters().end(); ++cit) {
2838 Converter const * converter =
2839 theSystemConverters().getConverter(cit->from(),
2842 converter->command() != cit->command() ||
2843 converter->flags() != cit->flags())
2844 os << "\\converter \"" << cit->from() << "\" \""
2845 << cit->to() << "\" \""
2846 << escapeCommand(cit->command()) << "\" \""
2847 << cit->flags() << "\"\n";
2850 // New/modifed converters
2851 for (Converters::const_iterator cit = theSystemConverters().begin();
2852 cit != theSystemConverters().end(); ++cit)
2853 if (!theConverters().getConverter(cit->from(), cit->to()))
2854 os << "\\converter \"" << cit->from()
2855 << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2862 << "# COPIERS SECTION ##########################\n"
2865 // Look for new movers
2866 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2867 Movers::const_iterator const sysend = theSystemMovers().end();
2868 Movers::const_iterator it = theMovers().begin();
2869 Movers::const_iterator end = theMovers().end();
2871 for (; it != end; ++it) {
2872 Movers::const_iterator const sysit =
2873 find_if(sysbegin, sysend, SameMover(*it));
2874 if (sysit == sysend) {
2875 string const & fmt = it->first;
2876 string const & command =
2877 it->second.command();
2879 os << "\\copier " << fmt
2880 << " \"" << escapeCommand(command) << "\"\n";
2886 // We don't actually delete SpecialisedMover(s) from the
2887 // map, just clear their 'command', so there's no need
2888 // to test for anything else.
2895 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2897 // Why the switch you might ask. It is a trick to ensure that all
2898 // the elements in the LyXRCTags enum is handled. As you can see
2899 // there are no breaks at all. So it is just a huge fall-through.
2900 // The nice thing is that we will get a warning from the compiler
2901 // if we forget an element.
2902 LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2904 case LyXRC::RC_LAST:
2905 case LyXRC::RC_ACCEPT_COMPOUND:
2906 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2907 if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2909 case LyXRC::RC_ALT_LANG:
2910 case LyXRC::RC_PLAINTEXT_LINELEN:
2911 case LyXRC::RC_AUTOCORRECTION_MATH:
2912 case LyXRC::RC_AUTOREGIONDELETE:
2913 case LyXRC::RC_AUTORESET_OPTIONS:
2914 case LyXRC::RC_AUTOSAVE:
2915 case LyXRC::RC_AUTO_NUMBER:
2916 case LyXRC::RC_BACKUPDIR_PATH:
2917 case LyXRC::RC_BIBTEX_ALTERNATIVES:
2918 case LyXRC::RC_BIBTEX_COMMAND:
2919 case LyXRC::RC_BINDFILE:
2920 case LyXRC::RC_BOOKMARKS_VISIBILITY:
2921 case LyXRC::RC_CITATION_SEARCH:
2922 case LyXRC::RC_CITATION_SEARCH_PATTERN:
2923 case LyXRC::RC_CITATION_SEARCH_VIEW:
2924 case LyXRC::RC_CHECKLASTFILES:
2925 case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2926 case LyXRC::RC_COMPLETION_INLINE_DELAY:
2927 case LyXRC::RC_COMPLETION_INLINE_DOTS:
2928 case LyXRC::RC_COMPLETION_INLINE_MATH:
2929 case LyXRC::RC_COMPLETION_INLINE_TEXT:
2930 case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2931 case LyXRC::RC_COMPLETION_POPUP_DELAY:
2932 case LyXRC::RC_COMPLETION_POPUP_MATH:
2933 case LyXRC::RC_COMPLETION_POPUP_TEXT:
2934 case LyXRC::RC_COMPLETION_MINLENGTH:
2935 case LyXRC::RC_USELASTFILEPOS:
2936 case LyXRC::RC_LOADSESSION:
2937 case LyXRC::RC_CHKTEX_COMMAND:
2938 case LyXRC::RC_CONVERTER:
2939 case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2940 case LyXRC::RC_COPIER:
2941 case LyXRC::RC_CT_ADDITIONS_UNDERLINED:
2942 case LyXRC::RC_CT_MARKUP_COPIED:
2943 case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2944 case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2945 case LyXRC::RC_GUI_LANGUAGE:
2946 case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2947 case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2948 case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2949 case LyXRC::RC_DEFFILE:
2950 case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2951 case LyXRC::RC_DISPLAY_GRAPHICS:
2952 case LyXRC::RC_DOCUMENTPATH:
2953 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2954 FileName path(lyxrc_new.document_path);
2955 if (path.exists() && path.isDirectory())
2956 package().document_dir() = FileName(lyxrc.document_path);
2959 case LyXRC::RC_DRAW_STRATEGY:
2960 case LyXRC::RC_EDITOR_ALTERNATIVES:
2961 case LyXRC::RC_ESC_CHARS:
2962 case LyXRC::RC_EXAMPLEPATH:
2963 case LyXRC::RC_FILEFORMAT:
2964 case LyXRC::RC_GROUP_LAYOUTS:
2965 case LyXRC::RC_HUNSPELLDIR_PATH:
2966 case LyXRC::RC_ICON_SET:
2967 case LyXRC::RC_UI_STYLE:
2968 case LyXRC::RC_INDEX_ALTERNATIVES:
2969 case LyXRC::RC_INDEX_COMMAND:
2970 case LyXRC::RC_JBIBTEX_COMMAND:
2971 case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2972 case LyXRC::RC_JINDEX_COMMAND:
2973 case LyXRC::RC_NOMENCL_COMMAND:
2974 case LyXRC::RC_PYGMENTIZE_COMMAND:
2975 case LyXRC::RC_INPUT:
2976 case LyXRC::RC_KBMAP:
2977 case LyXRC::RC_KBMAP_PRIMARY:
2978 case LyXRC::RC_KBMAP_SECONDARY:
2979 case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2980 case LyXRC::RC_LANGUAGE_AUTO_END:
2981 case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2982 case LyXRC::RC_LANGUAGE_COMMAND_END:
2983 case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2984 case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2985 case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2986 case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2987 case LyXRC::RC_LYXRCFORMAT:
2988 case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2989 case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2990 case LyXRC::RC_MACRO_EDIT_STYLE:
2991 case LyXRC::RC_MAKE_BACKUP:
2992 case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2993 case LyXRC::RC_RESPECT_OS_KBD_LANGUAGE:
2994 case LyXRC::RC_MOUSE_WHEEL_SPEED:
2995 case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
2996 case LyXRC::RC_NUMLASTFILES:
2997 case LyXRC::RC_PARAGRAPH_MARKERS:
2998 case LyXRC::RC_PATH_PREFIX:
2999 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
3000 prependEnvPath("PATH", replaceEnvironmentPath(lyxrc_new.path_prefix));
3001 // Resets python path
3002 support::os::python(true);
3005 case LyXRC::RC_PREVIEW:
3006 if (lyxrc_orig.preview != lyxrc_new.preview) {
3007 // Update all previews of all documents.
3008 /* FIXME: this can be very expensive. It would be cheaper
3009 * to kill all existing previews and update visible
3011 theBufferList().updatePreviews();
3014 case LyXRC::RC_PREVIEW_HASHED_LABELS:
3015 case LyXRC::RC_PREVIEW_SCALE_FACTOR:
3016 case LyXRC::RC_PRINTLANDSCAPEFLAG:
3017 case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
3018 case LyXRC::RC_PRINTPAPERFLAG:
3019 case LyXRC::RC_SAVE_COMPRESSED:
3020 case LyXRC::RC_SAVE_ORIGIN:
3021 case LyXRC::RC_SCREEN_DPI:
3023 case LyXRC::RC_SCREEN_FONT_ROMAN:
3024 case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
3025 case LyXRC::RC_SCREEN_FONT_SANS:
3026 case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
3027 case LyXRC::RC_SCREEN_FONT_SCALABLE:
3028 case LyXRC::RC_SCREEN_FONT_SIZES:
3029 case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
3030 case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3031 case LyXRC::RC_SCREEN_ZOOM:
3032 if (lyxrc_orig.roman_font_name != lyxrc_new.roman_font_name
3033 || lyxrc_orig.sans_font_name != lyxrc_new.sans_font_name
3034 || lyxrc_orig.typewriter_font_name != lyxrc_new.typewriter_font_name
3035 || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry
3036 || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry
3037 || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts
3038 || !std::equal(std::begin(lyxrc_orig.font_sizes), std::end(lyxrc_orig.font_sizes),
3039 std::begin(lyxrc_new.font_sizes))
3040 || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry
3041 || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) {
3042 dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
3045 case LyXRC::RC_GEOMETRY_SESSION:
3046 case LyXRC::RC_SERVERPIPE:
3047 case LyXRC::RC_SET_COLOR:
3048 case LyXRC::RC_SHOW_BANNER:
3049 case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
3050 case LyXRC::RC_SPELLCHECKER:
3051 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3054 case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3055 case LyXRC::RC_SPELLCHECK_NOTES:
3056 case LyXRC::RC_SPLITINDEX_COMMAND:
3057 case LyXRC::RC_TEMPDIRPATH:
3058 case LyXRC::RC_TEMPLATEPATH:
3059 case LyXRC::RC_TEX_ALLOWS_SPACES:
3060 case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3061 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3062 os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3065 case LyXRC::RC_TEXINPUTS_PREFIX:
3066 case LyXRC::RC_THESAURUSDIRPATH:
3067 case LyXRC::RC_UIFILE:
3068 case LyXRC::RC_USER_EMAIL:
3069 case LyXRC::RC_USER_INITIALS:
3070 case LyXRC::RC_USER_NAME:
3071 case LyXRC::RC_USE_CONVERTER_CACHE:
3072 case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
3073 case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
3074 case LyXRC::RC_USE_NATIVE_FILEDIALOG:
3075 case LyXRC::RC_USE_SYSTEM_COLORS:
3076 case LyXRC::RC_USE_TOOLTIP:
3077 case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3078 case LyXRC::RC_VIEWDVI_PAPEROPTION:
3079 case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3080 case LyXRC::RC_SINGLE_INSTANCE:
3081 case LyXRC::RC_SORT_LAYOUTS:
3082 case LyXRC::RC_SCREEN_LIMIT:
3083 case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3084 case LyXRC::RC_FULL_SCREEN_MENUBAR:
3085 case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3086 case LyXRC::RC_FULL_SCREEN_TABBAR:
3087 case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3088 case LyXRC::RC_SCREEN_WIDTH:
3089 case LyXRC::RC_VISUAL_CURSOR:
3090 case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3091 case LyXRC::RC_VIEWER:
3092 case LyXRC::RC_VIEWER_ALTERNATIVES:
3093 case LyXRC::RC_FORWARD_SEARCH_DVI:
3094 case LyXRC::RC_FORWARD_SEARCH_PDF:
3095 case LyXRC::RC_EXPORT_OVERWRITE:
3096 case LyXRC::RC_DEFAULT_DECIMAL_SEP:
3097 case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3098 case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3099 case LyXRC::RC_CURSOR_WIDTH:
3105 set<string> LyXRC::getRCs()
3108 for (int i = 0; i != lyxrcCount; ++i)
3109 res.insert(ltrim(lyxrcTags[i].tag, "\\"));
3115 string const LyXRC::getDescription(LyXRCTags tag)
3120 case RC_ACCEPT_COMPOUND:
3121 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3125 str = _("Specify an alternate language. The default is to use the language of the document.");
3128 case RC_PLAINTEXT_LINELEN:
3129 str = _("The maximum line length of exported plain text/LaTeX/SGML files. If set to 0, paragraphs are output in a single line; if the line length is > 0, paragraphs are separated by a blank line.");
3132 case RC_AUTOREGIONDELETE:
3133 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3136 case RC_AUTORESET_OPTIONS:
3137 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3141 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3144 case RC_AUTO_NUMBER:
3147 case RC_BACKUPDIR_PATH:
3148 str = _("The path for storing backup files. If it is an empty string, LyX will store the backup file in the same directory as the original file.");
3151 case RC_BIBTEX_COMMAND:
3152 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3155 case RC_JBIBTEX_COMMAND:
3156 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3160 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3163 case RC_CHECKLASTFILES:
3164 str = _("Select to check whether the lastfiles still exist.");
3167 case RC_CHKTEX_COMMAND:
3168 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3174 case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3175 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3178 case RC_CONVERTER_NEEDAUTH:
3179 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3185 case RC_CURSOR_FOLLOWS_SCROLLBAR:
3186 str = _("LyX normally doesn't update the cursor position if you move the scrollbar. Set to true if you'd prefer to always have the cursor on screen.");
3189 case RC_CURSOR_WIDTH:
3190 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3193 case RC_SCROLL_BELOW_DOCUMENT:
3194 str = _("LyX normally doesn't allow the user to scroll further than the bottom of the document. Set to true if you prefer to scroll the bottom of the document to the top of the screen");
3197 case RC_MAC_DONTSWAP_CTRL_META:
3198 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3201 case RC_MAC_LIKE_CURSOR_MOVEMENT:
3202 str = _("Use the Mac OS X conventions for cursor movement");
3205 case RC_SHOW_MACRO_LABEL:
3206 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3210 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3213 case RC_DEFAULT_OTF_VIEW_FORMAT:
3214 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3217 case RC_DEFAULT_VIEW_FORMAT:
3218 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3221 case RC_DIALOGS_ICONIFY_WITH_MAIN:
3222 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3225 case RC_DISPLAY_GRAPHICS:
3226 str = _("Select how LyX will display any graphics.");
3229 case RC_DOCUMENTPATH:
3230 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3234 str = _("Specify additional chars that can be part of a word.");
3237 case RC_EXAMPLEPATH:
3238 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3244 case RC_INDEX_COMMAND:
3245 str = _("Define the options of makeindex (cf. man makeindex) or select an alternative compiler. E.g., using xindy/make-rules, the command string would be \"makeindex.sh -m $$lang\".");
3248 case RC_JINDEX_COMMAND:
3249 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3252 case RC_NOMENCL_COMMAND:
3253 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3256 case RC_PYGMENTIZE_COMMAND:
3257 str = _("The command to run the python pygments syntax highlighter.");
3264 case RC_KBMAP_PRIMARY:
3265 case RC_KBMAP_SECONDARY:
3266 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.");
3269 case RC_LANGUAGE_AUTO_BEGIN:
3270 str = _("Select if a language switching command is needed at the beginning of the document.");
3273 case RC_LANGUAGE_AUTO_END:
3274 str = _("Select if a language switching command is needed at the end of the document.");
3277 case RC_LANGUAGE_COMMAND_BEGIN:
3278 str = _("The LaTeX command for changing from the language of the document to another language. E.g. \\selectlanguage{$$lang} where $$lang is substituted by the name of the second language.");
3281 case RC_LANGUAGE_COMMAND_END:
3282 str = _("The LaTeX command for changing back to the language of the document.");
3285 case RC_LANGUAGE_COMMAND_LOCAL:
3286 str = _("The LaTeX command for local changing of the language.");
3289 case RC_LANGUAGE_GLOBAL_OPTIONS:
3290 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3293 case RC_LANGUAGE_CUSTOM_PACKAGE:
3294 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3297 case RC_LANGUAGE_PACKAGE_SELECTION:
3298 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3301 case RC_USELASTFILEPOS:
3302 str = _("De-select if you do not want LyX to scroll to saved position.");
3305 case RC_LOADSESSION:
3306 str = _("De-select to prevent loading files opened from the last LyX session.");
3309 case RC_MAKE_BACKUP:
3310 str = _("De-select if you don't want LyX to create backup files.");
3313 case RC_MARK_FOREIGN_LANGUAGE:
3314 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3317 case RC_RESPECT_OS_KBD_LANGUAGE:
3318 str = _("Select to use the current keyboard language, as set from the operating system, as default input language.");
3321 case RC_MOUSE_WHEEL_SPEED:
3322 str = _("The scrolling speed of the mouse wheel.");
3325 case RC_COMPLETION_POPUP_DELAY:
3326 str = _("The completion popup delay.");
3329 case RC_COMPLETION_POPUP_MATH:
3330 str = _("Select to display the completion popup in math mode.");
3333 case RC_COMPLETION_POPUP_TEXT:
3334 str = _("Select to display the completion popup in text mode.");
3337 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3338 str = _("Show the completion popup without delay after non-unique completion attempt.");
3341 case RC_COMPLETION_POPUP_TEXT:
3342 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3345 case RC_COMPLETION_POPUP_DELAY:
3346 str = _("The inline completion delay.");
3349 case RC_COMPLETION_INLINE_MATH:
3350 str = _("Select to display the inline completion in math mode.");
3353 case RC_COMPLETION_INLINE_TEXT:
3354 str = _("Select to display the inline completion in text mode.");
3357 case RC_COMPLETION_INLINE_DOTS:
3358 str = _("Use \"...\" to shorten long completions.");
3361 case RC_AUTOCORRECTION_MATH:
3362 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3365 case RC_NUMLASTFILES:
3366 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3370 case RC_PATH_PREFIX:
3371 str = _("Specify those directories which should be "
3372 "prepended to the PATH environment variable.\n"
3373 "Use the OS native format.");
3377 str = _("Shows a typeset preview of things such as math");
3380 case RC_PREVIEW_HASHED_LABELS:
3381 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3384 case RC_PREVIEW_SCALE_FACTOR:
3385 str = _("Scale the preview size to suit.");
3388 case RC_PRINTLANDSCAPEFLAG:
3389 str = _("The option to print out in landscape.");
3392 case RC_PRINTPAPERDIMENSIONFLAG:
3393 str = _("Option to specify the dimensions of the print paper.");
3396 case RC_PRINTPAPERFLAG:
3397 str = _("The option to specify paper type.");
3400 case RC_VISUAL_CURSOR:
3401 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3404 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3405 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).");
3409 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3412 case RC_SCREEN_FONT_ROMAN:
3413 case RC_SCREEN_FONT_SANS:
3414 case RC_SCREEN_FONT_TYPEWRITER:
3415 str = _("The screen fonts used to display the text while editing.");
3418 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3419 case RC_SCREEN_FONT_SANS_FOUNDRY:
3420 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3423 case RC_SCREEN_FONT_SCALABLE:
3424 str = _("Allow bitmap fonts to be resized. If you are using a bitmap font, selecting this option may make some fonts look blocky in LyX. Deselecting this option makes LyX use the nearest bitmap font size available, instead of scaling.");
3427 case RC_SCREEN_FONT_SIZES:
3428 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3431 case RC_SCREEN_ZOOM:
3432 //xgettext:no-c-format
3433 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3436 case RC_GEOMETRY_SESSION:
3437 str = _("Allow session manager to save and restore windows geometry.");
3441 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3447 case RC_SHOW_BANNER:
3448 str = _("De-select if you don't want the startup banner.");
3451 case RC_TEMPDIRPATH:
3452 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3455 case RC_THESAURUSDIRPATH:
3456 str = _("This is the place where the files of the thesaurus library reside.");
3459 case RC_TEMPLATEPATH:
3460 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3463 case RC_TEX_ALLOWS_SPACES:
3466 case RC_TEX_EXPECTS_WINDOWS_PATHS:
3469 case RC_TEXINPUTS_PREFIX:
3470 str = _("Specify those directories which should be "
3471 "prepended to the TEXINPUTS environment variable.\n"
3472 "A '.' represents the current document directory. "
3473 "Use the OS native format.");
3477 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3486 case RC_USE_USE_SYSTEM_COLORS:
3487 str = _("Enable use the system colors for some things like main window background and selection.");
3490 case RC_USE_TOOLTIP:
3491 str = _("Enable the automatic appearance of tool tips in the work area.");
3494 case RC_VIEWDVI_PAPEROPTION:
3495 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3510 // The global instance
3513 // The global copy of the system lyxrc entries (everything except preferences)