]> git.lyx.org Git - features.git/blob - src/LyXRC.cpp
Restore correct version check for AA_UseHighDpiPixmaps - amend change ae56fb6171
[features.git] / src / LyXRC.cpp
1 /**
2  * \file LyXRC.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author Jean-Marc Lasgouttes
8  * \author Angus Leeming
9  * \author John Levon
10  * \author André Pönitz
11  * \author Allan Rae
12  * \author Dekel Tsur
13  *
14  * Full author contact details are available in file CREDITS.
15  */
16
17 #include <config.h>
18
19 #include "LyXRC.h"
20
21 #include "BufferList.h"
22 #include "ColorSet.h"
23 #include "Converter.h"
24 #include "FontEnums.h"
25 #include "Format.h"
26 #include "FuncCode.h"
27 #include "FuncRequest.h"
28 #include "Lexer.h"
29 #include "LyX.h"
30 #include "Mover.h"
31 #include "SpellChecker.h"
32 #include "version.h"
33
34 #include "support/convert.h"
35 #include "support/debug.h"
36 #include "support/environment.h"
37 #include "support/FileName.h"
38 #include "support/filetools.h"
39 #include "support/lstrings.h"
40 #include "support/os.h"
41 #include "support/Package.h"
42 #include "support/TempFile.h"
43
44 #ifdef USE_MACOSX_PACKAGING
45 #include "support/AppleSupport.h"
46 #endif
47
48 #include <fstream>
49 #include <iostream>
50 #include <algorithm>
51
52 using namespace std;
53 using namespace lyx::support;
54
55 namespace lyx {
56
57 namespace os = support::os;
58
59 namespace {
60
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 = 36; // rkh: spellcheck_continuously default
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         { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
111         { "\\escape_chars", LyXRC::RC_ESC_CHARS },
112         { "\\example_path", LyXRC::RC_EXAMPLEPATH },
113         { "\\experimental:bookmarks_visibility", LyXRC::RC_BOOKMARKS_VISIBILITY },
114         { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
115         { "\\format", LyXRC::RC_FILEFORMAT },
116         { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
117         { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
118         { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
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         { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
125         { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
126         { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
127         { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
128         { "\\icon_set", LyXRC::RC_ICON_SET },
129         { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
130         { "\\index_command", LyXRC::RC_INDEX_COMMAND },
131         { "\\input", LyXRC::RC_INPUT },
132         { "\\jbibtex_alternatives", LyXRC::RC_JBIBTEX_ALTERNATIVES },
133         { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
134         { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
135         { "\\kbmap", LyXRC::RC_KBMAP },
136         { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
137         { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
138         { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
139         { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
140         { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
141         { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
142         { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
143         { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
144         { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
145         { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
146         { "\\load_session", LyXRC::RC_LOADSESSION },
147         { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
148         { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
149         { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
150         { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
151         { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
152         { "\\mouse_middlebutton_paste", LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE },
153         { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
154         { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
155         { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
156         { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
157         { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
158         { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
159         { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
160         { "\\preview", LyXRC::RC_PREVIEW },
161         { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
162         { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
163         { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
164         { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
165         { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
166         { "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND },
167         { "\\respect_os_kbd_language", LyXRC::RC_RESPECT_OS_KBD_LANGUAGE },
168         { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
169         { "\\save_origin", LyXRC::RC_SAVE_ORIGIN },
170         { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
171         { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
172         { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
173         { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
174         { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
175         { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
176         { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
177         { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
178         { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
179         { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
180         { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
181         { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
182         { "\\serverpipe", LyXRC::RC_SERVERPIPE },
183         { "\\set_color", LyXRC::RC_SET_COLOR },
184         { "\\show_banner", LyXRC::RC_SHOW_BANNER },
185         { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
186         { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
187         { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
188         { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
189         { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
190         { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
191         { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
192         { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
193         { "\\template_path", LyXRC::RC_TEMPLATEPATH },
194         { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
195         { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
196         { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
197         { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
198         { "\\ui_file", LyXRC::RC_UIFILE },
199         { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
200         { "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
201         { "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
202         { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
203         { "\\use_native_filedialog", LyXRC::RC_USE_NATIVE_FILEDIALOG },
204         // compatibility with versions older than 1.4.0 only
205         { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
206         { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
207         { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
208         { "\\user_email", LyXRC::RC_USER_EMAIL },
209         { "\\user_initials", LyXRC::RC_USER_INITIALS },
210         { "\\user_name", LyXRC::RC_USER_NAME },
211         { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
212         // compatibility with versions older than 1.4.0 only
213         { "\\viewer", LyXRC::RC_VIEWER},
214         { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
215         { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
216         { "format", LyXRC::RC_LYXRCFORMAT }
217 };
218
219 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
220
221
222 void oldFontFormat(string & family, string & foundry)
223 {
224         if (family.empty() || family[0] != '-')
225                 return;
226         foundry = token(family, '-', 1);
227         family = token(family, '-', 2);
228         if (foundry == "*")
229                 foundry.erase();
230 }
231
232 } // namespace
233
234
235 bool LyXRC::read(FileName const & filename, bool check_format)
236 {
237         Lexer lexrc(lyxrcTags);
238         lexrc.setFile(filename);
239         LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
240         ReturnValues retval = read(lexrc, check_format);
241         if (!check_format || retval != FormatMismatch)
242                 return retval == ReadOK;
243
244         LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
245         TempFile tmp("convert_lyxrc");
246         FileName const tempfile = tmp.name();
247         bool const success = prefs2prefs(filename, tempfile, false);
248         if (!success) {
249                 LYXERR0 ("Unable to convert " << filename.absFileName() <<
250                         " to format " << LYXRC_FILEFORMAT);
251                 return false;
252         } else {
253                 // Keep this in the else branch, such that lexrc2 goes out
254                 // of scope and releases the lock on tempfile before we
255                 // attempt to remove it. This matters on Windows.
256                 Lexer lexrc2(lyxrcTags);
257                 lexrc2.setFile(tempfile);
258                 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
259                 retval = read(lexrc2, check_format);
260                 if (retval == FormatMismatch)
261                         LYXERR0("Conversion failed for " << filename.absFileName());
262         }
263         return retval == ReadOK;
264 }
265
266
267 // don't need to worry about conversion, because this is always
268 // from an internal source
269 bool LyXRC::read(istream & is)
270 {
271         Lexer lexrc(lyxrcTags);
272         lexrc.setStream(is);
273         LYXERR(Debug::LYXRC, "Reading istream...");
274         return read(lexrc, false) == ReadOK;
275 }
276
277
278 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
279 {
280         if (lyxerr.debugging(Debug::PARSER))
281                 lexrc.printTable(lyxerr);
282
283         if (!lexrc.isOK())
284                 return ReadError;
285
286         // format prior to 2.0 and introduction of format tag
287         unsigned int rc_format = 0;
288
289         while (lexrc.isOK()) {
290                 // By using two switches we take advantage of the compiler
291                 // telling us if we have missed a LyXRCTags element in
292                 // the second switch.
293                 // Note that this also shows a problem with Lexer since it
294                 // helps us avoid taking advantage of the strictness of the
295                 // compiler.
296
297                 int le = lexrc.lex();
298                 switch (le) {
299                 case Lexer::LEX_UNDEF:
300                         lexrc.printError("Unknown tag `$$Token'");
301                         continue;
302                 case Lexer::LEX_FEOF:
303                         continue;
304                 default:
305                         break;
306                 }
307                 switch (static_cast<LyXRCTags>(le)) {
308                 case RC_LYXRCFORMAT:
309                         if (lexrc.next())
310                                 rc_format = lexrc.getInteger();
311                         break;
312                 case RC_INPUT: // Include file
313                         if (lexrc.next()) {
314                                 FileName const tmp =
315                                         libFileSearch(string(),
316                                                       lexrc.getString());
317                                 if (!read(tmp, check_format)) {
318                                         lexrc.printError(
319                                             "Error reading included file: " + tmp.absFileName());
320                                 }
321                         }
322                         break;
323                 case RC_BINDFILE:
324                         if (lexrc.next())
325                                 bind_file = os::internal_path(lexrc.getString());
326                         break;
327
328                 case RC_DEFFILE:
329                         if (lexrc.next())
330                                 def_file = os::internal_path(lexrc.getString());
331                         break;
332
333                 case RC_UIFILE:
334                         if (lexrc.next())
335                                 ui_file = os::internal_path(lexrc.getString());
336                         break;
337
338                 case RC_AUTORESET_OPTIONS:
339                         lexrc >> auto_reset_options;
340                         break;
341
342                 case RC_DISPLAY_GRAPHICS:
343                         if (lexrc.next())
344                                 display_graphics = lexrc.getString() == "true";
345                         break;
346
347                 case RC_TEX_EXPECTS_WINDOWS_PATHS:
348                         lexrc >> windows_style_tex_paths;
349                         break;
350
351                 case RC_TEX_ALLOWS_SPACES:
352                         lexrc >> tex_allows_spaces;
353                         break;
354
355                 case RC_TEXINPUTS_PREFIX:
356                         lexrc >> texinputs_prefix;
357                         break;
358
359                 case RC_KBMAP:
360                         lexrc >> use_kbmap;
361                         break;
362
363                 case RC_KBMAP_PRIMARY:
364                         if (lexrc.next()) {
365                                 string const kmap(os::internal_path(lexrc.getString()));
366                                 if (!libFileSearch("kbd", kmap, "kmap").empty()
367                                           || kmap.empty()) {
368                                         primary_kbmap = kmap;
369                                 } else {
370                                         lexrc.printError("LyX: Keymap `$$Token' not found");
371                                 }
372                         }
373                         break;
374
375                 case RC_KBMAP_SECONDARY:
376                         if (lexrc.next()) {
377                                 string const kmap(os::internal_path(lexrc.getString()));
378                                 if (!libFileSearch("kbd", kmap, "kmap").empty()
379                                           || kmap.empty()) {
380                                         secondary_kbmap = kmap;
381                                 } else {
382                                         lexrc.printError("LyX: Keymap `$$Token' not found");
383                                 }
384                         }
385                         break;
386
387                 case RC_PRINTLANDSCAPEFLAG:
388                         lexrc >> print_landscape_flag;
389                         break;
390
391                 case RC_PRINTPAPERDIMENSIONFLAG:
392                         lexrc >> print_paper_dimension_flag;
393                         break;
394
395                 case RC_PRINTPAPERFLAG:
396                         lexrc >> print_paper_flag;
397                         break;
398
399                 case RC_PYGMENTIZE_COMMAND:
400                         if (lexrc.next(true)) {
401                                 pygmentize_command = lexrc.getString();
402                         }
403                         break;
404
405                 case RC_VIEWDVI_PAPEROPTION:
406                         if (lexrc.next())
407                                 view_dvi_paper_option = lexrc.getString();
408                         else
409                                 view_dvi_paper_option.erase();
410                         break;
411
412                 case RC_CHKTEX_COMMAND:
413                         if (lexrc.next(true)) {
414                                 chktex_command = lexrc.getString();
415                         }
416                         break;
417
418                 case RC_BIBTEX_ALTERNATIVES:
419                         if (lexrc.next(true)) {
420                                 bibtex_alternatives.insert(lexrc.getString());
421                         }
422                         break;
423
424                 case RC_BIBTEX_COMMAND:
425                         if (lexrc.next(true)) {
426                                 bibtex_command = lexrc.getString();
427                         }
428                         break;
429
430                 case RC_JBIBTEX_COMMAND:
431                         if (lexrc.next(true)) {
432                                 jbibtex_command = lexrc.getString();
433                         }
434                         break;
435
436                 case RC_JBIBTEX_ALTERNATIVES:
437                         if (lexrc.next(true)) {
438                                 jbibtex_alternatives.insert(lexrc.getString());
439                         }
440                         break;
441
442                 case RC_INDEX_ALTERNATIVES:
443                         if (lexrc.next(true)) {
444                                 index_alternatives.insert(lexrc.getString());
445                         }
446                         break;
447
448                 case RC_INDEX_COMMAND:
449                         if (lexrc.next(true)) {
450                                 index_command = lexrc.getString();
451                         }
452                         break;
453
454                 case RC_JINDEX_COMMAND:
455                         if (lexrc.next(true)) {
456                                 jindex_command = lexrc.getString();
457                         }
458                         break;
459
460                 case RC_SPLITINDEX_COMMAND:
461                         if (lexrc.next(true)) {
462                                 splitindex_command = lexrc.getString();
463                         }
464                         break;
465
466                 case RC_NOMENCL_COMMAND:
467                         if (lexrc.next(true)) {
468                                 nomencl_command = lexrc.getString();
469                         }
470                         break;
471
472                 case RC_SCREEN_DPI:
473                         lexrc >> dpi;
474                         break;
475
476                 case RC_SCREEN_ZOOM:
477                         lexrc >> defaultZoom;
478                         if (defaultZoom < 10)
479                                 defaultZoom = 10;
480                         break;
481
482                 case RC_GEOMETRY_SESSION:
483                         lexrc >> allow_geometry_session;
484                         break;
485
486                 case RC_SCREEN_FONT_SIZES:
487                         lexrc >> font_sizes[TINY_SIZE];
488                         lexrc >> font_sizes[SCRIPT_SIZE];
489                         lexrc >> font_sizes[FOOTNOTE_SIZE];
490                         lexrc >> font_sizes[SMALL_SIZE];
491                         lexrc >> font_sizes[NORMAL_SIZE];
492                         lexrc >> font_sizes[LARGE_SIZE];
493                         lexrc >> font_sizes[LARGER_SIZE];
494                         lexrc >> font_sizes[LARGEST_SIZE];
495                         lexrc >> font_sizes[HUGE_SIZE];
496                         lexrc >> font_sizes[HUGER_SIZE];
497                         break;
498
499                 case RC_SCREEN_FONT_SCALABLE:
500                         lexrc >> use_scalable_fonts;
501                         break;
502
503                 case RC_AUTOSAVE:
504                         lexrc >> autosave;
505                         break;
506
507                 case RC_DOCUMENTPATH:
508                         if (lexrc.next())
509                                 document_path = os::internal_path(lexrc.getString());
510                         break;
511
512                 case RC_EXAMPLEPATH:
513                         if (lexrc.next())
514                                 example_path = os::internal_path(lexrc.getString());
515                         break;
516
517                 case RC_TEMPLATEPATH:
518                         if (lexrc.next())
519                                 template_path = os::internal_path(lexrc.getString());
520                         break;
521
522                 case RC_TEMPDIRPATH:
523                         if (lexrc.next())
524                                 tempdir_path = os::internal_path(lexrc.getString());
525                         break;
526
527                 case RC_THESAURUSDIRPATH:
528                         if (lexrc.next())
529                                 thesaurusdir_path = os::internal_path(lexrc.getString());
530                         break;
531
532                 case RC_HUNSPELLDIR_PATH:
533                         if (lexrc.next())
534                                 hunspelldir_path = os::internal_path(lexrc.getString());
535                         break;
536
537                 case RC_USELASTFILEPOS:
538                         lexrc >> use_lastfilepos;
539                         break;
540
541                 case RC_LOADSESSION:
542                         lexrc >> load_session;
543                         break;
544
545                 case RC_MOUSE_WHEEL_SPEED:
546                         lexrc >> mouse_wheel_speed;
547                         break;
548
549                 case RC_COMPLETION_INLINE_DELAY:
550                         lexrc >> completion_inline_delay;
551                         break;
552
553                 case RC_COMPLETION_INLINE_MATH:
554                         lexrc >> completion_inline_math;
555                         break;
556
557                 case RC_COMPLETION_INLINE_TEXT:
558                         lexrc >> completion_inline_text;
559                         break;
560
561                 case RC_COMPLETION_INLINE_DOTS:
562                         lexrc >> completion_inline_dots;
563                         break;
564
565                 case RC_AUTOCORRECTION_MATH:
566                         lexrc >> autocorrection_math;
567                         break;
568
569                 case RC_COMPLETION_POPUP_DELAY:
570                         lexrc >> completion_popup_delay;
571                         break;
572
573                 case RC_COMPLETION_POPUP_MATH:
574                         lexrc >> completion_popup_math;
575                         break;
576
577                 case RC_COMPLETION_POPUP_TEXT:
578                         lexrc >> completion_popup_text;
579                         break;
580
581                 case RC_COMPLETION_CURSOR_TEXT:
582                         lexrc >> completion_cursor_text;
583                         break;
584
585                 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
586                         lexrc >> completion_popup_after_complete;
587                         break;
588
589                 case RC_COMPLETION_MINLENGTH:
590                         lexrc >> completion_minlength;
591                         break;
592
593                 case RC_NUMLASTFILES:
594                         lexrc >> num_lastfiles;
595                         break;
596
597                 case RC_CHECKLASTFILES:
598                         lexrc >> check_lastfiles;
599                         break;
600
601                 case RC_ICON_SET:
602                         lexrc >> icon_set;
603                         break;
604
605                 case RC_USE_SYSTEM_THEME_ICONS:
606                         lexrc >> use_system_theme_icons;
607                         break;
608
609                 case RC_SCREEN_FONT_ROMAN:
610                         if (lexrc.next()) {
611                                 roman_font_name = lexrc.getString();
612                                 oldFontFormat(roman_font_name,
613                                               roman_font_foundry);
614                         }
615                         break;
616
617                 case RC_SCREEN_FONT_SANS:
618                         if (lexrc.next()) {
619                                 sans_font_name = lexrc.getString();
620                                 oldFontFormat(sans_font_name, sans_font_foundry);
621                         }
622                         break;
623
624                 case RC_SCREEN_FONT_TYPEWRITER:
625                         if (lexrc.next()) {
626                                 typewriter_font_name = lexrc.getString();
627                                 oldFontFormat(typewriter_font_name,
628                                               typewriter_font_foundry);
629                         }
630                         break;
631
632                 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
633                         lexrc >> roman_font_foundry;
634                         break;
635
636                 case RC_SCREEN_FONT_SANS_FOUNDRY:
637                         lexrc >> sans_font_foundry;
638                         break;
639
640                 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
641                         lexrc >> typewriter_font_foundry;
642                         break;
643
644                 case RC_SET_COLOR: {
645                         if (!lexrc.next()) {
646                                 lexrc.printError("Missing color tag.");
647                                 break;
648                         }
649                         string const lyx_name = lexrc.getString();
650
651                         if (!lexrc.next()) {
652                                 lexrc.printError("Missing color name for color: `$$Token'");
653                                 break;
654                         }
655                         string const x11_name = lexrc.getString();
656
657                         string x11_darkname = x11_name;
658                         if (lexrc.next())
659                                 x11_darkname = lexrc.getString();
660
661                         ColorCode const col =
662                                 lcolor.getFromLyXName(lyx_name);
663                         if (col == Color_none ||
664                             col == Color_inherit ||
665                             col == Color_ignore)
666                                 break;
667
668                         if (!lcolor.setColor(col, x11_name, x11_darkname))
669                                 LYXERR0("Bad lyxrc set_color for " << lyx_name);
670                         LYXERR(Debug::LYXRC, "Set " << lyx_name << "(" << col << ") to "
671                                << x11_name << " and " << x11_darkname);
672                         break;
673                 }
674
675                 case RC_AUTOREGIONDELETE:
676                         // Auto region delete defaults to true
677                         lexrc >> auto_region_delete;
678                         break;
679
680                 case RC_SERVERPIPE:
681                         if (lexrc.next()) {
682                                 string userdir = package().user_support().absFileName();
683                                 if (userdir.back() == '/')
684                                   userdir.pop_back();
685                                 lyxpipes = subst(os::internal_path(lexrc.getString()), "$$UserDir",
686                                         userdir);
687                         }
688                         break;
689
690                 case RC_CITATION_SEARCH:
691                         lexrc >> citation_search;
692                         break;
693
694                 case RC_CITATION_SEARCH_PATTERN:
695                         if (lexrc.next())
696                                 citation_search_pattern = lexrc.getString();
697                         break;
698
699                 case RC_CITATION_SEARCH_VIEW:
700                         if (lexrc.next())
701                                 citation_search_view = lexrc.getString();
702                         break;
703
704                 case RC_CT_ADDITIONS_UNDERLINED:
705                         lexrc >> ct_additions_underlined;
706                         break;
707
708                 case RC_CT_MARKUP_COPIED:
709                         lexrc >> ct_markup_copied;
710                         break;
711
712                 case RC_CURSOR_FOLLOWS_SCROLLBAR:
713                         lexrc >> cursor_follows_scrollbar;
714                         break;
715
716                 case RC_CURSOR_WIDTH:
717                         lexrc >> cursor_width;
718                         break;
719
720                 case RC_SCROLL_BELOW_DOCUMENT:
721                         lexrc >> scroll_below_document;
722                         break;
723
724                 case RC_PARAGRAPH_MARKERS:
725                         lexrc >> paragraph_markers;
726                         break;
727
728                 case RC_MAC_DONTSWAP_CTRL_META:
729                         lexrc >> mac_dontswap_ctrl_meta;
730                         break;
731
732                 case RC_MAC_LIKE_CURSOR_MOVEMENT:
733                         lexrc >> mac_like_cursor_movement;
734                         break;
735
736                 case RC_MACRO_EDIT_STYLE:
737                         if (lexrc.next()) {
738                                 switch (lexrc.getInteger()) {
739                                 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
740                                 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
741                                 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
742                                 }
743                         }
744                         break;
745
746                 case RC_DIALOGS_ICONIFY_WITH_MAIN:
747                         lexrc >> dialogs_iconify_with_main;
748                         break;
749
750                 case RC_PLAINTEXT_LINELEN:
751                         lexrc >> plaintext_linelen;
752                         break;
753                         // Spellchecker settings:
754                 case RC_ACCEPT_COMPOUND:
755                         lexrc >> spellchecker_accept_compound;
756                         break;
757                 case RC_USE_NATIVE_FILEDIALOG:
758                         lexrc >> use_native_filedialog;
759                         break;
760                 case RC_USE_SYSTEM_COLORS:
761                         lexrc >> use_system_colors;
762                         break;
763                 case RC_USE_TOOLTIP:
764                         lexrc >> use_tooltip;
765                         break;
766                 case RC_SPELLCHECKER:
767                         lexrc >> spellchecker;
768                         break;
769                 case RC_ALT_LANG:
770                         lexrc >> spellchecker_alt_lang;
771                         break;
772                 case RC_ESC_CHARS:
773                         lexrc >> spellchecker_esc_chars;
774                         break;
775                 case RC_SPELLCHECK_CONTINUOUSLY:
776                         lexrc >> spellcheck_continuously;
777                         break;
778                 case RC_SPELLCHECK_NOTES:
779                         lexrc >> spellcheck_notes;
780                         break;
781                 case RC_MAKE_BACKUP:
782                         lexrc >> make_backup;
783                         break;
784                 case RC_SAVE_COMPRESSED:
785                         lexrc >> save_compressed;
786                         break;
787                 case RC_SAVE_ORIGIN:
788                         lexrc >> save_origin;
789                         break;
790                 case RC_BACKUPDIR_PATH:
791                         if (lexrc.next())
792                                 backupdir_path = os::internal_path(lexrc.getString());
793                         break;
794                 case RC_DEFAULT_DECIMAL_SEP:
795                         lexrc >> default_decimal_sep;
796                         break;
797                 case RC_DEFAULT_LENGTH_UNIT:
798                         if (lexrc.next())
799                                 default_length_unit = (Length::UNIT) lexrc.getInteger();
800                         break;
801                 case RC_LANGUAGE_CUSTOM_PACKAGE:
802                         lexrc >> language_custom_package;
803                         break;
804                 case RC_LANGUAGE_AUTO_BEGIN:
805                         lexrc >> language_auto_begin;
806                         break;
807                 case RC_LANGUAGE_AUTO_END:
808                         lexrc >> language_auto_end;
809                         break;
810                 case RC_LANGUAGE_GLOBAL_OPTIONS:
811                         lexrc >> language_global_options;
812                         break;
813                 case RC_LANGUAGE_PACKAGE_SELECTION:
814                         if (lexrc.next()) {
815                                 switch (lexrc.getInteger()) {
816                                 case 0:
817                                         language_package_selection = LP_AUTO;
818                                         break;
819                                 case 1:
820                                         language_package_selection = LP_BABEL;
821                                         break;
822                                 case 2:
823                                         language_package_selection = LP_CUSTOM;
824                                         break;
825                                 case 3:
826                                         language_package_selection = LP_NONE;
827                                         break;
828                                 }
829                         }
830                         break;
831                 case RC_LANGUAGE_COMMAND_BEGIN:
832                         lexrc >> language_command_begin;
833                         break;
834                 case RC_LANGUAGE_COMMAND_END:
835                         lexrc >> language_command_end;
836                         break;
837                 case RC_LANGUAGE_COMMAND_LOCAL:
838                         lexrc >> language_command_local;
839                         break;
840                 case RC_RESPECT_OS_KBD_LANGUAGE:
841                         lexrc >> respect_os_kbd_language;
842                         break;
843                 case RC_VISUAL_CURSOR:
844                         lexrc >> visual_cursor;
845                         break;
846                 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
847                         lexrc >> close_buffer_with_last_view;
848                         break;
849                 case RC_AUTO_NUMBER:
850                         lexrc >> auto_number;
851                         break;
852                 case RC_MARK_FOREIGN_LANGUAGE:
853                         lexrc >> mark_foreign_language;
854                         break;
855
856                 case RC_COPIER: {
857                         string fmt, command;
858                         if (lexrc.next())
859                                 fmt = lexrc.getString();
860                         if (lexrc.next(true))
861                                 command = lexrc.getString();
862                         setMover(fmt, command);
863                         break;
864                 }
865
866                 case RC_CONVERTER: {
867                         string from, to, command, flags;
868                         if (lexrc.next())
869                                 from = lexrc.getString();
870                         if (lexrc.next())
871                                 to = lexrc.getString();
872                         if (lexrc.next(true))
873                                 command = lexrc.getString();
874                         if (lexrc.next())
875                                 flags = lexrc.getString();
876                         if (command.empty())
877                                 theConverters().erase(from, to);
878                         else
879                                 theConverters().add(from, to, command, flags);
880                         break;
881                 }
882                 // compatibility with versions older than 1.4.0 only
883                 case RC_VIEWER: {
884                         string format, command;
885                         lexrc >> format >> command;
886                         theFormats().setViewer(format, command);
887                         break;
888                 }
889                 case RC_FILEFORMAT: {
890                         bool ok = true;
891                         string format, extensions, shortcut;
892                         docstring prettyname;
893                         if (!(lexrc >> format >> extensions))
894                                 ok = false;
895                         if (ok && lexrc.next(true))
896                                 prettyname = lexrc.getDocString();
897                         else
898                                 ok = false;
899                         if (ok)
900                                 if(!(lexrc >> shortcut))
901                                         ok = false;
902                         string viewer, editor;
903                         if (ok && lexrc.next(true))
904                                 viewer = lexrc.getString();
905                         else
906                                 ok = false;
907                         if (ok && lexrc.next(true))
908                                 editor = lexrc.getString();
909                         else
910                                 ok = false;
911                         string flags, mime;
912                         if (!(lexrc >> flags >> mime))
913                                 ok = false;
914                         int flgs = Format::none;
915                         while (!flags.empty()) {
916                                 string flag;
917                                 flags = split(flags, flag, ',');
918                                 if (flag == "document")
919                                         flgs |= Format::document;
920                                 else if (flag == "vector")
921                                         flgs |= Format::vector;
922                                 else if (flag == "zipped=native")
923                                         flgs |= Format::zipped_native;
924                                 else if (flag == "menu=export")
925                                         flgs |= Format::export_menu;
926                                 else if (flag == "menu=none")
927                                         flgs |= Format::no_menu;
928                                 else
929                                         LYXERR0("Ignoring unknown flag `"
930                                                << flag << "' for format `"
931                                                << format << "'.");
932                         }
933                         if (!ok)
934                                 LYXERR0("Syntax error in format " << format);
935                         else if (prettyname.empty()) {
936                                 if (theConverters().formatIsUsed(format))
937                                         LYXERR0("Can't delete format " << format);
938                                 else
939                                         theFormats().erase(format);
940                         } else {
941                                 theFormats().add(format, extensions, prettyname,
942                                             shortcut, viewer, editor, mime, flgs);
943                         }
944                         break;
945                 }
946                 case RC_VIEWER_ALTERNATIVES:  {
947                         string format, command;
948                         if ((lexrc >> format) && lexrc.next(true)) {
949                                 command  = lexrc.getString();
950                                 viewer_alternatives[format].insert(command);
951                         }
952                         break;
953                 }
954                 case RC_EDITOR_ALTERNATIVES:  {
955                         string format, command;
956                         if ((lexrc >> format) && lexrc.next(true)) {
957                                 command  = lexrc.getString();
958                                 editor_alternatives[format].insert(command);
959                         }
960                         break;
961                 }
962
963                 case RC_DEFAULT_OTF_VIEW_FORMAT:
964                         lexrc >> default_otf_view_format;
965                         break;
966
967                 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
968                         lexrc >> default_platex_view_format;
969                         break;
970
971                 case RC_DEFAULT_VIEW_FORMAT:
972                         lexrc >> default_view_format;
973                         break;
974
975                 case RC_GUI_LANGUAGE:
976                         lexrc >> gui_language;
977                         break;
978
979                 case RC_SHOW_BANNER:
980                         lexrc >> show_banner;
981                         break;
982
983                 case RC_PREVIEW:
984                         if (lexrc.next()) {
985                                 string const tmp = lexrc.getString();
986                                 if (tmp == "true" || tmp == "on")
987                                         preview = PREVIEW_ON;
988                                 else if (tmp == "no_math")
989                                         preview = PREVIEW_NO_MATH;
990                                 else {
991                                         preview = PREVIEW_OFF;
992                                         if (tmp != "false" && tmp != "off")
993                                                 LYXERR0("Unrecognized preview status \""
994                                                        << tmp << '\n');
995                                 }
996                         }
997                         break;
998
999                 case RC_PREVIEW_HASHED_LABELS:
1000                         lexrc >> preview_hashed_labels;
1001                         break;
1002
1003                 case RC_PREVIEW_SCALE_FACTOR:
1004                         lexrc >> preview_scale_factor;
1005                         break;
1006
1007                 case RC_USER_NAME:
1008                         lexrc >> user_name;
1009                         break;
1010                 case RC_USER_EMAIL:
1011                         lexrc >> user_email;
1012                         break;
1013                 case RC_USER_INITIALS:
1014                         lexrc >> user_initials;
1015                         break;
1016
1017                 case RC_PATH_PREFIX:
1018                         lexrc >> path_prefix;
1019                         break;
1020
1021                 case RC_USE_CONVERTER_CACHE:
1022                         lexrc >> use_converter_cache;
1023                         break;
1024                 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1025                         lexrc >> use_converter_needauth_forbidden;
1026                         break;
1027                 case RC_USE_CONVERTER_NEEDAUTH:
1028                         lexrc >> use_converter_needauth;
1029                         break;
1030                 case RC_CONVERTER_CACHE_MAXAGE:
1031                         lexrc >> converter_cache_maxage;
1032                         break;
1033
1034                 case RC_SORT_LAYOUTS:
1035                         lexrc >> sort_layouts;
1036                         break;
1037                 case RC_GROUP_LAYOUTS:
1038                         lexrc >> group_layouts;
1039                         break;
1040                 case RC_FULL_SCREEN_LIMIT:
1041                         lexrc >> full_screen_limit;
1042                         break;
1043                 case RC_FULL_SCREEN_TOOLBARS:
1044                         lexrc >> full_screen_toolbars;
1045                         break;
1046                 case RC_FULL_SCREEN_SCROLLBAR:
1047                         lexrc >> full_screen_scrollbar;
1048                         break;
1049                 case RC_FULL_SCREEN_STATUSBAR:
1050                         lexrc >> full_screen_statusbar;
1051                         break;
1052                 case RC_FULL_SCREEN_TABBAR:
1053                         lexrc >> full_screen_tabbar;
1054                         break;
1055                 case RC_FULL_SCREEN_MENUBAR:
1056                         lexrc >> full_screen_menubar;
1057                         break;
1058                 case RC_FULL_SCREEN_WIDTH:
1059                         lexrc >> full_screen_width;
1060                         break;
1061                 case RC_OPEN_BUFFERS_IN_TABS:
1062                         lexrc >> open_buffers_in_tabs;
1063 #ifdef USE_MACOSX_PACKAGING
1064                         if (appleUserTabbingPreferenceAlways())
1065                                 open_buffers_in_tabs = true;
1066 #endif
1067                         break;
1068                 case RC_SINGLE_CLOSE_TAB_BUTTON:
1069                         lexrc >> single_close_tab_button;
1070                         break;
1071                 case RC_SINGLE_INSTANCE:
1072                         lexrc >> single_instance;
1073                         if (run_mode == PREFERRED)
1074                                 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1075                         break;
1076                 case RC_FORWARD_SEARCH_DVI:
1077                         if (lexrc.next(true))
1078                                 forward_search_dvi = lexrc.getString();
1079                         break;
1080                 case RC_FORWARD_SEARCH_PDF:
1081                         if (lexrc.next(true))
1082                                 forward_search_pdf = lexrc.getString();
1083                         break;
1084                 case RC_EXPORT_OVERWRITE:
1085                         if (lexrc.next()) {
1086                                 string const tmp = lexrc.getString();
1087                                 if (tmp == "all" || tmp == "true")
1088                                         export_overwrite = ALL_FILES;
1089                                 else if (tmp == "main")
1090                                         export_overwrite = MAIN_FILE;
1091                                 else {
1092                                         export_overwrite = NO_FILES;
1093                                         if (tmp != "ask" && tmp != "false")
1094                                                 LYXERR0("Unrecognized export_overwrite status \""
1095                                                        << tmp << '"');
1096                                 }
1097                         }
1098                         break;
1099                 case RC_SCROLL_WHEEL_ZOOM:
1100                         if (lexrc.next()) {
1101                                 string const tmp = lexrc.getString();
1102                                 if (tmp == "ctrl")
1103                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1104                                 else if (tmp == "shift")
1105                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1106                                 else if (tmp == "alt")
1107                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1108                                 else {
1109                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1110                                         if (tmp != "off" && tmp != "false")
1111                                                 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1112                                                        << tmp << '"');
1113                                 }
1114                         }
1115                         break;
1116
1117                 case RC_MOUSE_MIDDLEBUTTON_PASTE:
1118                         lexrc >> mouse_middlebutton_paste;
1119                         break;
1120
1121                 case RC_BOOKMARKS_VISIBILITY:
1122                         if (lexrc.next()) {
1123                                 string const tmp = lexrc.getString();
1124                                 if (tmp == "none")
1125                                         bookmarks_visibility = BMK_NONE;
1126                                 else if (tmp == "margin")
1127                                         bookmarks_visibility = BMK_MARGIN;
1128                                 else if (tmp == "inline")
1129                                         bookmarks_visibility = BMK_INLINE;
1130                                 else {
1131                                         bookmarks_visibility = BMK_NONE;
1132                                         LYXERR0("Unrecognized bookmark visibility " << tmp <<'"');
1133                                 }
1134                         }
1135                         break;
1136
1137
1138                 case RC_LAST:
1139                         break; // this is just a dummy
1140                 }
1141
1142                 // This is triggered the first time through the loop unless
1143                 // we hit a format tag.
1144                 if (check_format && rc_format != LYXRC_FILEFORMAT)
1145                         return FormatMismatch;
1146         }
1147
1148         /// Update converters data-structures
1149         theConverters().update(theFormats());
1150         theConverters().buildGraph();
1151         theBufferList().invalidateConverterCache();
1152
1153         return ReadOK;
1154 }
1155
1156
1157 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1158 {
1159         ofstream ofs(filename.toFilesystemEncoding().c_str());
1160         if (ofs)
1161                 write(ofs, ignore_system_lyxrc);
1162 }
1163
1164
1165 void LyXRC::print() const
1166 {
1167         if (lyxerr.debugging())
1168                 write(lyxerr, false);
1169         else
1170                 write(cout, false);
1171 }
1172
1173
1174 class SameMover {
1175 public:
1176         typedef pair<string, SpecialisedMover> Data;
1177
1178         SameMover(Data const & comparison)
1179                 : comparison_(comparison) {}
1180
1181         bool operator()(Data const & data) const
1182         {
1183                 return data.first == comparison_.first &&
1184                         data.second.command() == comparison_.second.command();
1185         }
1186
1187 private:
1188         Data comparison_;
1189 };
1190
1191
1192 namespace {
1193
1194         // Escape \ and " so that LyXLex can read the string later
1195         string escapeCommand(string const & str) {
1196                 return subst(subst(str , "\\", "\\\\"),
1197                              "\"", "\\\"");
1198         }
1199
1200 } // namespace
1201
1202
1203 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1204 {
1205         LyXRCTags tag = RC_LAST;
1206
1207         if (!name.empty()) {
1208                 for (int i = 0; i != lyxrcCount; ++i)
1209                         if ("\\" + name == lyxrcTags[i].tag)
1210                                 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1211         }
1212
1213         if (tag == RC_LAST)
1214                 os << "# LyX " << lyx_version
1215                    << " generated this file. If you want to make your own\n"
1216                    << "# modifications you should do them from inside LyX and save.\n\n"
1217                    << "Format " << LYXRC_FILEFORMAT << "\n\n";
1218
1219         // Why the switch you might ask. It is a trick to ensure that all
1220         // the elements in the LyXRCTags enum are handled. As you can see
1221         // there are no breaks at all. So it is just a huge fall-through.
1222         // The nice thing is that we will get a warning from the compiler
1223         // if we forget an element.
1224         switch (tag) {
1225         case RC_LAST:
1226         case RC_INPUT:
1227                 // input/include files are not done here
1228         case RC_LYXRCFORMAT:
1229         case RC_BINDFILE:
1230                 if (ignore_system_lyxrc ||
1231                     bind_file != system_lyxrc.bind_file) {
1232                         string const path = os::external_path(bind_file);
1233                         os << "\\bind_file \"" << path << "\"\n";
1234                 }
1235                 if (tag != RC_LAST)
1236                         break;
1237                 // fall through
1238         case RC_DEFFILE:
1239                 if (ignore_system_lyxrc ||
1240                     def_file != system_lyxrc.def_file) {
1241                         string const path = os::external_path(def_file);
1242                         os << "\\def_file \"" << path << "\"\n";
1243                 }
1244                 if (tag != RC_LAST)
1245                         break;
1246
1247                 //
1248                 // Misc Section
1249                 //
1250                 os << "\n#\n"
1251                    << "# MISC SECTION ######################################\n"
1252                    << "#\n\n";
1253                 // bind files are not done here.
1254                 // fall through
1255         case RC_PATH_PREFIX:
1256                 if (ignore_system_lyxrc ||
1257                     path_prefix != system_lyxrc.path_prefix) {
1258                         os << "\\path_prefix \"" << path_prefix << "\"\n";
1259                 }
1260                 if (tag != RC_LAST)
1261                         break;
1262                 // fall through
1263         case RC_UIFILE:
1264                 if (ignore_system_lyxrc ||
1265                     ui_file != system_lyxrc.ui_file) {
1266                         string const path = os::external_path(ui_file);
1267                         os << "\\ui_file \"" << path << "\"\n";
1268                 }
1269                 if (tag != RC_LAST)
1270                         break;
1271                 // fall through
1272         case RC_AUTOREGIONDELETE:
1273                 if (ignore_system_lyxrc ||
1274                     auto_region_delete != system_lyxrc.auto_region_delete) {
1275                         os << "# Set to false to inhibit automatic replacement of\n"
1276                            << "# the current selection.\n"
1277                            << "\\auto_region_delete " << convert<string>(auto_region_delete)
1278                            << '\n';
1279                 }
1280                 if (tag != RC_LAST)
1281                         break;
1282                 // fall through
1283         case RC_AUTORESET_OPTIONS:
1284                 if (ignore_system_lyxrc ||
1285                     auto_reset_options != system_lyxrc.auto_reset_options) {
1286                         os << "# Set to false to inhibit automatic reset of\n"
1287                            << "# the class options to defaults on class change.\n"
1288                            << "\\auto_reset_options "
1289                            << convert<string>(auto_reset_options)
1290                            << '\n';
1291                 }
1292                 if (tag != RC_LAST)
1293                         break;
1294                 // fall through
1295         case RC_AUTOSAVE:
1296                 if (ignore_system_lyxrc ||
1297                     autosave != system_lyxrc.autosave) {
1298                         os << "# The time interval between auto-saves in seconds.\n"
1299                            << "\\autosave " << autosave << '\n';
1300                 }
1301                 if (tag != RC_LAST)
1302                         break;
1303                 // fall through
1304         case RC_DISPLAY_GRAPHICS:
1305                 if (ignore_system_lyxrc ||
1306                     display_graphics != system_lyxrc.display_graphics) {
1307                         os << "# Display graphics within LyX\n"
1308                            << "# true|false\n"
1309                            << "\\display_graphics "
1310                            << (display_graphics ? "true" : "false")
1311                            << '\n';
1312                 }
1313                 if (tag != RC_LAST)
1314                         break;
1315                 // fall through
1316         case RC_SORT_LAYOUTS:
1317                 if (ignore_system_lyxrc ||
1318                     sort_layouts != system_lyxrc.sort_layouts) {
1319                         os << "# Sort layouts alphabetically.\n"
1320                            << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1321                 }
1322                 if (tag != RC_LAST)
1323                         break;
1324                 // fall through
1325         case RC_GROUP_LAYOUTS:
1326                 if (ignore_system_lyxrc ||
1327                     group_layouts != system_lyxrc.group_layouts) {
1328                         os << "# Group layouts by their category.\n"
1329                            << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1330                 }
1331                 if (tag != RC_LAST)
1332                         break;
1333                 // fall through
1334         case RC_VIEWDVI_PAPEROPTION:
1335                 if (ignore_system_lyxrc ||
1336                     view_dvi_paper_option
1337                     != system_lyxrc.view_dvi_paper_option) {
1338                         os << "# Options used to specify paper size to the\n"
1339                            << "# view_dvi_command (e.g. -paper)\n"
1340                            << "\\view_dvi_paper_option \""
1341                            << view_dvi_paper_option << "\"\n";
1342                 }
1343                 if (tag != RC_LAST)
1344                         break;
1345                 // fall through
1346         case RC_CHKTEX_COMMAND:
1347                 if (ignore_system_lyxrc ||
1348                     chktex_command != system_lyxrc.chktex_command) {
1349                         os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1350                 }
1351                 if (tag != RC_LAST)
1352                         break;
1353                 // fall through
1354         case RC_BIBTEX_ALTERNATIVES: {
1355                 CommandSet::const_iterator it = bibtex_alternatives.begin();
1356                 CommandSet::const_iterator end = bibtex_alternatives.end();
1357                 for ( ; it != end; ++it) {
1358                         if (ignore_system_lyxrc
1359                             || !system_lyxrc.bibtex_alternatives.count(*it))
1360                                 os << "\\bibtex_alternatives \""
1361                                    << *it << "\"\n";
1362                 }
1363                 if (tag != RC_LAST)
1364                         break;
1365         }
1366         // fall through
1367         case RC_BIBTEX_COMMAND:
1368                 if (ignore_system_lyxrc ||
1369                     bibtex_command != system_lyxrc.bibtex_command) {
1370                         os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1371                 }
1372                 if (tag != RC_LAST)
1373                         break;
1374                 // fall through
1375         case RC_JBIBTEX_COMMAND:
1376                 if (ignore_system_lyxrc ||
1377                     jbibtex_command != system_lyxrc.jbibtex_command) {
1378                         os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1379                 }
1380                 if (tag != RC_LAST)
1381                         break;
1382                 // fall through
1383         case RC_JBIBTEX_ALTERNATIVES: {
1384                 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1385                 CommandSet::const_iterator end = jbibtex_alternatives.end();
1386                 for ( ; it != end; ++it) {
1387                         if (ignore_system_lyxrc
1388                             || !system_lyxrc.jbibtex_alternatives.count(*it))
1389                                 os << "\\jbibtex_alternatives \""
1390                                    << *it << "\"\n";
1391                 }
1392                 if (tag != RC_LAST)
1393                         break;
1394         }
1395         // fall through
1396         case RC_INDEX_ALTERNATIVES: {
1397                 CommandSet::const_iterator it = index_alternatives.begin();
1398                 CommandSet::const_iterator end = index_alternatives.end();
1399                 for ( ; it != end; ++it) {
1400                         if (ignore_system_lyxrc
1401                             || !system_lyxrc.index_alternatives.count(*it))
1402                                 os << "\\index_alternatives \""
1403                                    << *it << "\"\n";
1404                 }
1405                 if (tag != RC_LAST)
1406                         break;
1407         }
1408         // fall through
1409         case RC_INDEX_COMMAND:
1410                 if (ignore_system_lyxrc ||
1411                     index_command != system_lyxrc.index_command) {
1412                         os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1413                 }
1414                 if (tag != RC_LAST)
1415                         break;
1416                 // fall through
1417         case RC_JINDEX_COMMAND:
1418                 if (ignore_system_lyxrc ||
1419                     jindex_command != system_lyxrc.jindex_command) {
1420                         os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1421                 }
1422                 if (tag != RC_LAST)
1423                         break;
1424                 // fall through
1425         case RC_SPLITINDEX_COMMAND:
1426                 if (ignore_system_lyxrc ||
1427                     splitindex_command != system_lyxrc.splitindex_command) {
1428                         os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1429                 }
1430                 if (tag != RC_LAST)
1431                         break;
1432                 // fall through
1433         case RC_NOMENCL_COMMAND:
1434                 if (ignore_system_lyxrc ||
1435                     nomencl_command != system_lyxrc.nomencl_command) {
1436                         os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1437                 }
1438                 if (tag != RC_LAST)
1439                         break;
1440                 // fall through
1441         case RC_PYGMENTIZE_COMMAND:
1442                 if (ignore_system_lyxrc ||
1443                     pygmentize_command != system_lyxrc.pygmentize_command) {
1444                         os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1445                 }
1446                 if (tag != RC_LAST)
1447                         break;
1448                 // fall through
1449         case RC_TEX_EXPECTS_WINDOWS_PATHS:
1450                 // Don't write this setting to the preferences file,
1451                 // but allow temporary changes (bug 7557).
1452                 if (ignore_system_lyxrc) {
1453                         os << "\\tex_expects_windows_paths "
1454                            << convert<string>(windows_style_tex_paths) << '\n';
1455                 }
1456                 if (tag != RC_LAST)
1457                         break;
1458                 // fall through
1459         case RC_TEX_ALLOWS_SPACES:
1460                 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1461                         os << "\\tex_allows_spaces "
1462                            << convert<string>(tex_allows_spaces) << '\n';
1463                 }
1464                 if (tag != RC_LAST)
1465                         break;
1466                 // fall through
1467         case RC_KBMAP:
1468                 if (ignore_system_lyxrc ||
1469                     use_kbmap != system_lyxrc.use_kbmap) {
1470                         os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1471                 }
1472                 if (tag != RC_LAST)
1473                         break;
1474                 // fall through
1475         case RC_KBMAP_PRIMARY:
1476                 if (ignore_system_lyxrc ||
1477                     primary_kbmap != system_lyxrc.primary_kbmap) {
1478                         string const path = os::external_path(primary_kbmap);
1479                         os << "\\kbmap_primary \"" << path << "\"\n";
1480                 }
1481                 if (tag != RC_LAST)
1482                         break;
1483                 // fall through
1484         case RC_KBMAP_SECONDARY:
1485                 if (ignore_system_lyxrc ||
1486                     secondary_kbmap != system_lyxrc.secondary_kbmap) {
1487                         string const path = os::external_path(secondary_kbmap);
1488                         os << "\\kbmap_secondary \"" << path << "\"\n";
1489                 }
1490                 if (tag != RC_LAST)
1491                         break;
1492                 // fall through
1493         case RC_SERVERPIPE:
1494                 if (ignore_system_lyxrc ||
1495                     lyxpipes != system_lyxrc.lyxpipes) {
1496                         string const path = os::external_path(lyxpipes);
1497                         os << "\\serverpipe \"" << path << "\"\n";
1498                 }
1499                 if (tag != RC_LAST)
1500                         break;
1501                 // fall through
1502         case RC_USER_NAME:
1503                 os << "\\user_name \"" << user_name << "\"\n";
1504                 if (tag != RC_LAST)
1505                         break;
1506                 // fall through
1507         case RC_USER_EMAIL:
1508                 os << "\\user_email \"" << user_email << "\"\n";
1509                 if (tag != RC_LAST)
1510                         break;
1511                 // fall through
1512         case RC_USER_INITIALS:
1513                 os << "\\user_initials \"" << user_initials << "\"\n";
1514                 if (tag != RC_LAST)
1515                         break;
1516                 // fall through
1517         case RC_SHOW_BANNER:
1518                 if (ignore_system_lyxrc ||
1519                     show_banner != system_lyxrc.show_banner) {
1520                         os << "\\show_banner " << convert<string>(show_banner) << '\n';
1521                 }
1522                 if (tag != RC_LAST)
1523                         break;
1524                 // fall through
1525         case RC_PREVIEW:
1526                 if (ignore_system_lyxrc ||
1527                     preview != system_lyxrc.preview) {
1528                         string status;
1529                         switch (preview) {
1530                         case PREVIEW_ON:
1531                                 status = "on";
1532                                 break;
1533                         case PREVIEW_NO_MATH:
1534                                 status = "no_math";
1535                                 break;
1536                         case PREVIEW_OFF:
1537                                 status = "off";
1538                                 break;
1539                         }
1540                         os << "\\preview " << status << '\n';
1541                 }
1542                 if (tag != RC_LAST)
1543                         break;
1544                 // fall through
1545         case RC_PREVIEW_HASHED_LABELS:
1546                 if (ignore_system_lyxrc ||
1547                     preview_hashed_labels !=
1548                     system_lyxrc.preview_hashed_labels) {
1549                         os << "\\preview_hashed_labels "
1550                            << convert<string>(preview_hashed_labels) << '\n';
1551                 }
1552                 if (tag != RC_LAST)
1553                         break;
1554                 // fall through
1555         case RC_PREVIEW_SCALE_FACTOR:
1556                 if (ignore_system_lyxrc ||
1557                     preview_scale_factor != system_lyxrc.preview_scale_factor) {
1558                         os << "\\preview_scale_factor "
1559                            << preview_scale_factor << '\n';
1560                 }
1561                 if (tag != RC_LAST)
1562                         break;
1563                 // fall through
1564         case RC_USE_CONVERTER_CACHE:
1565                 if (ignore_system_lyxrc ||
1566                     use_converter_cache != system_lyxrc.use_converter_cache) {
1567                         os << "\\use_converter_cache "
1568                            << convert<string>(use_converter_cache) << '\n';
1569                 }
1570                 if (tag != RC_LAST)
1571                         break;
1572                 // fall through
1573         case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1574                 if (ignore_system_lyxrc ||
1575                     use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1576                         os << "\\use_converter_needauth_forbidden "
1577                            << convert<string>(use_converter_needauth_forbidden) << '\n';
1578                 }
1579                 if (tag != RC_LAST)
1580                         break;
1581                 // fall through
1582         case RC_USE_CONVERTER_NEEDAUTH:
1583                 if (ignore_system_lyxrc ||
1584                     use_converter_needauth != system_lyxrc.use_converter_needauth) {
1585                         os << "\\use_converter_needauth "
1586                            << convert<string>(use_converter_needauth) << '\n';
1587                 }
1588                 if (tag != RC_LAST)
1589                         break;
1590                 // fall through
1591         case RC_CONVERTER_CACHE_MAXAGE:
1592                 if (ignore_system_lyxrc ||
1593                     converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1594                         os << "\\converter_cache_maxage "
1595                            << converter_cache_maxage << '\n';
1596                 }
1597                 if (tag != RC_LAST)
1598                         break;
1599
1600                 os << "\n#\n"
1601                    << "# SCREEN & FONTS SECTION ############################\n"
1602                    << "#\n\n";
1603                 // fall through
1604         case RC_ICON_SET:
1605                 if (ignore_system_lyxrc ||
1606                     icon_set != system_lyxrc.icon_set) {
1607                         os << "\\icon_set \"" << icon_set
1608                            << "\"\n";
1609                 }
1610                 if (tag != RC_LAST)
1611                         break;
1612                 // fall through
1613         case RC_USE_SYSTEM_THEME_ICONS:
1614                 if (ignore_system_lyxrc ||
1615                           use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1616                         os << "\\use_system_theme_icons "
1617                                 << convert<string>(use_system_theme_icons)
1618                                 << "\n";
1619                 }
1620                 if (tag != RC_LAST)
1621                         break;
1622                 // fall through
1623         case RC_SCREEN_DPI:
1624                 if (ignore_system_lyxrc ||
1625                     dpi != system_lyxrc.dpi) {
1626                         os << "\\screen_dpi " << dpi << '\n';
1627                 }
1628                 if (tag != RC_LAST)
1629                         break;
1630                 // fall through
1631         case RC_SCREEN_ZOOM:
1632                 if (ignore_system_lyxrc ||
1633                     defaultZoom != system_lyxrc.defaultZoom) {
1634                         os << "\\screen_zoom " << defaultZoom << '\n';
1635                 }
1636                 if (tag != RC_LAST)
1637                         break;
1638                 // fall through
1639         case RC_GEOMETRY_SESSION:
1640                 if (ignore_system_lyxrc ||
1641                     allow_geometry_session != system_lyxrc.allow_geometry_session) {
1642                         os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1643                            << '\n';
1644                 }
1645                 if (tag != RC_LAST)
1646                         break;
1647                 // fall through
1648         case RC_CITATION_SEARCH:
1649                 if (ignore_system_lyxrc ||
1650                     citation_search != system_lyxrc.citation_search) {
1651                         os << "# Set to true to use script to search\n"
1652                            << "# locl disk for citation targets.\n"
1653                            << "\\citation_search "
1654                            << convert<string>(citation_search)
1655                            << '\n';
1656                 }
1657                 if (tag != RC_LAST)
1658                         break;
1659                 // fall through
1660         case RC_CITATION_SEARCH_VIEW:
1661                 if (ignore_system_lyxrc ||
1662                     citation_search_view != system_lyxrc.citation_search_view) {
1663                         os << "\\citation_search_view \""
1664                            << citation_search_view << "\"\n";
1665                 }
1666                 if (tag != RC_LAST)
1667                         break;
1668                 // fall through
1669         case RC_CITATION_SEARCH_PATTERN:
1670                 if (ignore_system_lyxrc ||
1671                     citation_search_pattern != system_lyxrc.citation_search_pattern) {
1672                         os << "\\citation_search_pattern \""
1673                            << citation_search_pattern << "\"\n";
1674                 }
1675                 if (tag != RC_LAST)
1676                         break;
1677                 // fall through
1678         case RC_CT_ADDITIONS_UNDERLINED:
1679                 if (ignore_system_lyxrc ||
1680                     ct_additions_underlined
1681                     != system_lyxrc.ct_additions_underlined) {
1682                         os << "\\ct_additions_underlined "
1683                            << convert<string>(ct_additions_underlined) << '\n';
1684                 }
1685                 if (tag != RC_LAST)
1686                         break;
1687                 // fall through
1688         case RC_CT_MARKUP_COPIED:
1689                 if (ignore_system_lyxrc ||
1690                     ct_markup_copied
1691                     != system_lyxrc.ct_markup_copied) {
1692                         os << "\\ct_markup_copied "
1693                            << convert<string>(ct_markup_copied) << '\n';
1694                 }
1695                 if (tag != RC_LAST)
1696                         break;
1697                 // fall through
1698         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1699                 if (ignore_system_lyxrc ||
1700                     cursor_follows_scrollbar
1701                     != system_lyxrc.cursor_follows_scrollbar) {
1702                         os << "\\cursor_follows_scrollbar "
1703                            << convert<string>(cursor_follows_scrollbar) << '\n';
1704                 }
1705                 if (tag != RC_LAST)
1706                         break;
1707                 // fall through
1708         case RC_CURSOR_WIDTH:
1709                 if (ignore_system_lyxrc ||
1710                         cursor_width
1711                         != system_lyxrc.cursor_width) {
1712                         os << "\\cursor_width "
1713                         << cursor_width << '\n';
1714                 }
1715                 if (tag != RC_LAST)
1716                         break;
1717                 // fall through
1718         case RC_SCROLL_BELOW_DOCUMENT:
1719                 if (ignore_system_lyxrc ||
1720                     scroll_below_document
1721                     != system_lyxrc.scroll_below_document) {
1722                         os << "\\scroll_below_document "
1723                            << convert<string>(scroll_below_document) << '\n';
1724                 }
1725                 if (tag != RC_LAST)
1726                         break;
1727                 // fall through
1728         case RC_PARAGRAPH_MARKERS:
1729                 if (ignore_system_lyxrc ||
1730                         paragraph_markers
1731                     != system_lyxrc.paragraph_markers) {
1732                         os << "\\paragraph_markers "
1733                            << convert<string>(paragraph_markers) << '\n';
1734                 }
1735                 if (tag != RC_LAST)
1736                         break;
1737                 // fall through
1738         case RC_BOOKMARKS_VISIBILITY:
1739                 if (ignore_system_lyxrc ||
1740                         bookmarks_visibility != system_lyxrc.bookmarks_visibility) {
1741                         string status;
1742                         switch (bookmarks_visibility) {
1743                         case BMK_NONE:
1744                                 status = "none";
1745                                 break;
1746                         case BMK_INLINE:
1747                                 status = "inline";
1748                                 break;
1749                         case BMK_MARGIN:
1750                                 status = "margin";
1751                                 break;
1752                         }
1753                         os << "\\experimental:bookmarks_visibility " << status << '\n';
1754                 }
1755                 if (tag != RC_LAST)
1756                         break;
1757                 // fall through
1758         case RC_MAC_DONTSWAP_CTRL_META:
1759                 if (ignore_system_lyxrc ||
1760                     mac_dontswap_ctrl_meta
1761                     != system_lyxrc.mac_dontswap_ctrl_meta) {
1762                         os << "\\mac_dontswap_ctrl_meta "
1763                            << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1764                 }
1765                 if (tag != RC_LAST)
1766                         break;
1767                 // fall through
1768         case RC_MAC_LIKE_CURSOR_MOVEMENT:
1769                 if (ignore_system_lyxrc ||
1770                     mac_like_cursor_movement
1771                     != system_lyxrc.mac_like_cursor_movement) {
1772                         os << "\\mac_like_cursor_movement "
1773                            << convert<string>(mac_like_cursor_movement) << '\n';
1774                 }
1775                 if (tag != RC_LAST)
1776                         break;
1777                 // fall through
1778         case RC_MACRO_EDIT_STYLE:
1779                 if (ignore_system_lyxrc ||
1780                     macro_edit_style
1781                     != system_lyxrc.macro_edit_style) {
1782                         os << "\\macro_edit_style ";
1783                         switch (macro_edit_style) {
1784                         case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1785                         case MACRO_EDIT_INLINE: os << "1\n"; break;
1786                         case MACRO_EDIT_LIST: os << "2\n"; break;
1787                         }
1788                 }
1789                 if (tag != RC_LAST)
1790                         break;
1791                 // fall through
1792         case RC_DIALOGS_ICONIFY_WITH_MAIN:
1793                 if (ignore_system_lyxrc ||
1794                     dialogs_iconify_with_main
1795                    != system_lyxrc.dialogs_iconify_with_main) {
1796                         os << "\\dialogs_iconify_with_main "
1797                           <<  convert<string>(dialogs_iconify_with_main) << '\n';
1798                 }
1799                 if (tag != RC_LAST)
1800                         break;
1801                 // fall through
1802         case RC_SCREEN_FONT_ROMAN:
1803                 if (ignore_system_lyxrc ||
1804                     roman_font_name != system_lyxrc.roman_font_name) {
1805                         os << "\\screen_font_roman \"" << roman_font_name
1806                            << "\"\n";
1807                 }
1808                 if (tag != RC_LAST)
1809                         break;
1810                 // fall through
1811         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1812                 if (ignore_system_lyxrc ||
1813                     roman_font_foundry != system_lyxrc.roman_font_foundry) {
1814                         os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1815                            << "\"\n";
1816                 }
1817                 if (tag != RC_LAST)
1818                         break;
1819                 // fall through
1820         case RC_SCREEN_FONT_SANS:
1821                 if (ignore_system_lyxrc ||
1822                     sans_font_name != system_lyxrc.sans_font_name) {
1823                         os << "\\screen_font_sans \"" << sans_font_name
1824                            << "\"\n";
1825                 }
1826                 if (tag != RC_LAST)
1827                         break;
1828                 // fall through
1829         case RC_SCREEN_FONT_SANS_FOUNDRY:
1830                 if (ignore_system_lyxrc ||
1831                     sans_font_foundry != system_lyxrc.sans_font_foundry) {
1832                         os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1833                            << "\"\n";
1834                 }
1835                 if (tag != RC_LAST)
1836                         break;
1837                 // fall through
1838         case RC_SCREEN_FONT_TYPEWRITER:
1839                 if (ignore_system_lyxrc ||
1840                     typewriter_font_name != system_lyxrc.typewriter_font_name) {
1841                         os << "\\screen_font_typewriter \""
1842                            << typewriter_font_name << "\"\n";
1843                 }
1844                 if (tag != RC_LAST)
1845                         break;
1846                 // fall through
1847         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1848                 if (ignore_system_lyxrc ||
1849                     typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1850                         os << "\\screen_font_typewriter_foundry \""
1851                            << typewriter_font_foundry << "\"\n";
1852                 }
1853                 if (tag != RC_LAST)
1854                         break;
1855                 // fall through
1856         case RC_SCREEN_FONT_SCALABLE:
1857                 if (ignore_system_lyxrc ||
1858                     use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1859                         os << "\\screen_font_scalable "
1860                            << convert<string>(use_scalable_fonts)
1861                            << '\n';
1862                 }
1863                 if (tag != RC_LAST)
1864                         break;
1865                 // fall through
1866         case RC_SCREEN_FONT_SIZES:
1867                 if (ignore_system_lyxrc ||
1868                     font_sizes[TINY_SIZE]
1869                     != system_lyxrc.font_sizes[TINY_SIZE] ||
1870                     font_sizes[SCRIPT_SIZE]
1871                     != system_lyxrc.font_sizes[SCRIPT_SIZE] ||
1872                     font_sizes[FOOTNOTE_SIZE]
1873                     != system_lyxrc.font_sizes[FOOTNOTE_SIZE] ||
1874                     font_sizes[SMALL_SIZE]
1875                     != system_lyxrc.font_sizes[SMALL_SIZE] ||
1876                     font_sizes[NORMAL_SIZE]
1877                     != system_lyxrc.font_sizes[NORMAL_SIZE] ||
1878                     font_sizes[LARGE_SIZE]
1879                     != system_lyxrc.font_sizes[LARGE_SIZE] ||
1880                     font_sizes[LARGER_SIZE]
1881                     != system_lyxrc.font_sizes[LARGER_SIZE] ||
1882                     font_sizes[LARGEST_SIZE]
1883                     != system_lyxrc.font_sizes[LARGEST_SIZE] ||
1884                     font_sizes[HUGE_SIZE]
1885                     != system_lyxrc.font_sizes[HUGE_SIZE] ||
1886                     font_sizes[HUGER_SIZE]
1887                     != system_lyxrc.font_sizes[HUGER_SIZE]) {
1888                         streamsize old_prec = os.precision();
1889                         os.setf(ios::fixed);
1890                         os.precision(2);
1891                         os << "\\screen_font_sizes"
1892                            << ' ' << font_sizes[TINY_SIZE]
1893                            << ' ' << font_sizes[SCRIPT_SIZE]
1894                            << ' ' << font_sizes[FOOTNOTE_SIZE]
1895                            << ' ' << font_sizes[SMALL_SIZE]
1896                            << ' ' << font_sizes[NORMAL_SIZE]
1897                            << ' ' << font_sizes[LARGE_SIZE]
1898                            << ' ' << font_sizes[LARGER_SIZE]
1899                            << ' ' << font_sizes[LARGEST_SIZE]
1900                            << ' ' << font_sizes[HUGE_SIZE]
1901                            << ' ' << font_sizes[HUGER_SIZE]
1902                            << '\n';
1903                         os.precision(old_prec);
1904                         os.unsetf(ios::fixed);
1905                 }
1906                 if (tag != RC_LAST)
1907                         break;
1908                 // fall through
1909         case RC_FULL_SCREEN_LIMIT:
1910                 if (ignore_system_lyxrc ||
1911                     full_screen_limit != system_lyxrc.full_screen_limit) {
1912                         os << "\\fullscreen_limit "
1913                            << convert<string>(full_screen_limit)
1914                            << '\n';
1915                 }
1916                 if (tag != RC_LAST)
1917                         break;
1918                 // fall through
1919         case RC_FULL_SCREEN_TOOLBARS:
1920                 if (ignore_system_lyxrc ||
1921                     full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1922                         os << "\\fullscreen_toolbars "
1923                            << convert<string>(full_screen_toolbars)
1924                            << '\n';
1925                 }
1926                 if (tag != RC_LAST)
1927                         break;
1928                 // fall through
1929         case RC_FULL_SCREEN_SCROLLBAR:
1930                 if (ignore_system_lyxrc ||
1931                     full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1932                         os << "\\fullscreen_scrollbar "
1933                            << convert<string>(full_screen_scrollbar)
1934                            << '\n';
1935                 }
1936                 if (tag != RC_LAST)
1937                         break;
1938                 // fall through
1939         case RC_FULL_SCREEN_STATUSBAR:
1940                 if (ignore_system_lyxrc ||
1941                     full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1942                         os << "\\fullscreen_statusbar "
1943                            << convert<string>(full_screen_statusbar)
1944                            << '\n';
1945                 }
1946                 if (tag != RC_LAST)
1947                         break;
1948                 // fall through
1949         case RC_FULL_SCREEN_TABBAR:
1950                 if (ignore_system_lyxrc ||
1951                     full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1952                         os << "\\fullscreen_tabbar "
1953                            << convert<string>(full_screen_tabbar)
1954                            << '\n';
1955                 }
1956                 if (tag != RC_LAST)
1957                         break;
1958                 // fall through
1959         case RC_FULL_SCREEN_MENUBAR:
1960                 if (ignore_system_lyxrc ||
1961                     full_screen_menubar != system_lyxrc.full_screen_menubar) {
1962                         os << "\\fullscreen_menubar "
1963                            << convert<string>(full_screen_menubar)
1964                            << '\n';
1965                 }
1966                 if (tag != RC_LAST)
1967                         break;
1968                 // fall through
1969         case RC_FULL_SCREEN_WIDTH:
1970                 if (ignore_system_lyxrc ||
1971                     full_screen_width != system_lyxrc.full_screen_width) {
1972                         os << "\\fullscreen_width "
1973                            << convert<string>(full_screen_width)
1974                            << '\n';
1975                 }
1976                 if (tag != RC_LAST)
1977                         break;
1978                 // fall through
1979         case RC_OPEN_BUFFERS_IN_TABS:
1980                 if (ignore_system_lyxrc ||
1981                     open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1982                         os << "\\open_buffers_in_tabs "
1983                            << convert<string>(open_buffers_in_tabs)
1984                            << '\n';
1985                 }
1986                 if (tag != RC_LAST)
1987                         break;
1988                 // fall through
1989         case RC_SINGLE_CLOSE_TAB_BUTTON:
1990                 if (ignore_system_lyxrc ||
1991                     single_close_tab_button != system_lyxrc.single_close_tab_button) {
1992                         os << "\\single_close_tab_button "
1993                            << convert<string>(single_close_tab_button)
1994                            << '\n';
1995                 }
1996                 if (tag != RC_LAST)
1997                         break;
1998                 // fall through
1999         case RC_SINGLE_INSTANCE:
2000                 if (ignore_system_lyxrc ||
2001                     single_instance != system_lyxrc.single_instance) {
2002                         os << "\\single_instance "
2003                            << convert<string>(single_instance)
2004                            << '\n';
2005                 }
2006                 if (tag != RC_LAST)
2007                         break;
2008                 // fall through
2009         case RC_FORWARD_SEARCH_DVI:
2010                 if (ignore_system_lyxrc ||
2011                     forward_search_dvi != system_lyxrc.forward_search_dvi) {
2012                         os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2013                 }
2014                 if (tag != RC_LAST)
2015                         break;
2016                 // fall through
2017         case RC_FORWARD_SEARCH_PDF:
2018                 if (ignore_system_lyxrc ||
2019                     forward_search_pdf != system_lyxrc.forward_search_pdf) {
2020                         os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2021                 }
2022                 if (tag != RC_LAST)
2023                         break;
2024
2025         os << "\n#\n"
2026                         << "# COLOR SECTION ###################################\n"
2027                         << "#\n\n";
2028
2029         // fall through
2030         case RC_SET_COLOR:
2031                 for (int i = 0; i < Color_ignore; ++i) {
2032                         ColorCode lc = static_cast<ColorCode>(i);
2033                         string const col = lcolor.getAllX11HexNames(lc).first;
2034                         string const darkcol = lcolor.getAllX11HexNames(lc).second;
2035                         if (ignore_system_lyxrc
2036                             || col != system_lcolor.getAllX11HexNames(lc).first
2037                             || darkcol != system_lcolor.getAllX11HexNames(lc).second) {
2038                                 os << "\\set_color \""
2039                                    << lcolor.getLyXName(lc) << "\" \""
2040                                    << col << "\" \""
2041                                    << darkcol << "\"\n";
2042                         }
2043                 }
2044                 if (tag != RC_LAST)
2045                         break;
2046
2047         os << "\n#\n"
2048                  << "# PRINTER SECTION ###################################\n"
2049                  << "#\n\n";
2050
2051         // fall through
2052         case RC_PRINTLANDSCAPEFLAG:
2053                 if (ignore_system_lyxrc ||
2054                     print_landscape_flag != system_lyxrc.print_landscape_flag) {
2055                         os << "\\print_landscape_flag \"" << print_landscape_flag
2056                            << "\"\n";
2057                 }
2058                 if (tag != RC_LAST)
2059                         break;
2060                 // fall through
2061         case RC_PRINTPAPERFLAG:
2062                 if (ignore_system_lyxrc ||
2063                     print_paper_flag != system_lyxrc.print_paper_flag) {
2064                         os << "\\print_paper_flag \"" << print_paper_flag
2065                            << "\"\n";
2066                 }
2067                 if (tag != RC_LAST)
2068                         break;
2069                 // fall through
2070         case RC_PRINTPAPERDIMENSIONFLAG:
2071                 if (ignore_system_lyxrc ||
2072                     print_paper_dimension_flag
2073                     != system_lyxrc.print_paper_dimension_flag) {
2074                         os << "\\print_paper_dimension_flag \""
2075                            << print_paper_dimension_flag << "\"\n";
2076                 }
2077                 if (tag != RC_LAST)
2078                         break;
2079
2080         os << "\n#\n"
2081                  << "# TEX SECTION #######################################\n"
2082                  << "#\n\n";
2083
2084         // fall through
2085         case RC_TEXINPUTS_PREFIX:
2086                 if (ignore_system_lyxrc ||
2087                     texinputs_prefix != system_lyxrc.texinputs_prefix) {
2088                         os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2089                 }
2090                 if (tag != RC_LAST)
2091                         break;
2092                 // fall through
2093                 os << "\n#\n"
2094                    << "# FILE SECTION ######################################\n"
2095                    << "#\n\n";
2096         // fall through
2097         case RC_DOCUMENTPATH:
2098                 if (ignore_system_lyxrc ||
2099                     document_path != system_lyxrc.document_path) {
2100                         string const path = os::external_path(document_path);
2101                         os << "\\document_path \"" << path << "\"\n";
2102                 }
2103                 if (tag != RC_LAST)
2104                         break;
2105                 // fall through
2106         case RC_USELASTFILEPOS:
2107                 if (ignore_system_lyxrc ||
2108                     use_lastfilepos != system_lyxrc.use_lastfilepos) {
2109                         os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2110                            << '\n';
2111                 }
2112                 if (tag != RC_LAST)
2113                         break;
2114                 // fall through
2115         case RC_LOADSESSION:
2116                 if (ignore_system_lyxrc ||
2117                     load_session != system_lyxrc.load_session) {
2118                         os << "\\load_session " << convert<string>(load_session)
2119                            << "\n";
2120                 }
2121                 if (tag != RC_LAST)
2122                         break;
2123                 // fall through
2124         case RC_MOUSE_WHEEL_SPEED:
2125                 if (ignore_system_lyxrc ||
2126                     mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2127                         os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2128                 }
2129                 if (tag != RC_LAST)
2130                         break;
2131                 // fall through
2132         case RC_MOUSE_MIDDLEBUTTON_PASTE:
2133                 if (ignore_system_lyxrc ||
2134                     mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2135                         os << "\\mouse_middlebutton_paste "
2136                            << convert<string>(mouse_middlebutton_paste) << '\n';
2137                 }
2138                 if (tag != RC_LAST)
2139                         break;
2140                 // fall through
2141         case RC_COMPLETION_INLINE_DELAY:
2142                 if (ignore_system_lyxrc ||
2143                     completion_inline_delay != system_lyxrc.completion_inline_delay) {
2144                         os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2145                 }
2146                 if (tag != RC_LAST)
2147                         break;
2148                 // fall through
2149         case RC_COMPLETION_INLINE_MATH:
2150                 if (ignore_system_lyxrc ||
2151                     completion_inline_math != system_lyxrc.completion_inline_math) {
2152                         os << "\\completion_inline_math "
2153                                 << convert<string>(completion_inline_math) << '\n';
2154                 }
2155                 if (tag != RC_LAST)
2156                         break;
2157                 // fall through
2158         case RC_COMPLETION_INLINE_TEXT:
2159                 if (ignore_system_lyxrc ||
2160                     completion_inline_text != system_lyxrc.completion_inline_text) {
2161                         os << "\\completion_inline_text "
2162                                 << convert<string>(completion_inline_text) << '\n';
2163                 }
2164                 if (tag != RC_LAST)
2165                         break;
2166                 // fall through
2167         case RC_COMPLETION_INLINE_DOTS:
2168                 if (ignore_system_lyxrc ||
2169                     completion_inline_dots != system_lyxrc.completion_inline_dots) {
2170                         os << "\\completion_inline_dots "
2171                                 << convert<string>(completion_inline_dots) << '\n';
2172                 }
2173                 if (tag != RC_LAST)
2174                         break;
2175                 // fall through
2176         case RC_AUTOCORRECTION_MATH:
2177                 if (ignore_system_lyxrc ||
2178                     autocorrection_math != system_lyxrc.autocorrection_math) {
2179                         os << "\\autocorrection_math "
2180                                 << convert<string>(autocorrection_math) << '\n';
2181                 }
2182                 if (tag != RC_LAST)
2183                         break;
2184                 // fall through
2185         case RC_COMPLETION_POPUP_DELAY:
2186                 if (ignore_system_lyxrc ||
2187                     completion_popup_delay != system_lyxrc.completion_popup_delay) {
2188                         os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2189                 }
2190                 if (tag != RC_LAST)
2191                         break;
2192                 // fall through
2193         case RC_COMPLETION_POPUP_MATH:
2194                 if (ignore_system_lyxrc ||
2195                     completion_popup_math != system_lyxrc.completion_popup_math) {
2196                         os << "\\completion_popup_math "
2197                                 << convert<string>(completion_popup_math) << '\n';
2198                 }
2199                 if (tag != RC_LAST)
2200                         break;
2201                 // fall through
2202         case RC_COMPLETION_POPUP_TEXT:
2203                 if (ignore_system_lyxrc ||
2204                     completion_popup_text != system_lyxrc.completion_popup_text) {
2205                         os << "\\completion_popup_text "
2206                                 << convert<string>(completion_popup_text) << '\n';
2207                 }
2208                 if (tag != RC_LAST)
2209                         break;
2210                 // fall through
2211         case RC_COMPLETION_CURSOR_TEXT:
2212                 if (ignore_system_lyxrc ||
2213                     completion_cursor_text != system_lyxrc.completion_cursor_text) {
2214                         os << "\\completion_cursor_text "
2215                            << convert<string>(completion_cursor_text) << '\n';
2216                 }
2217                 if (tag != RC_LAST)
2218                         break;
2219                 // fall through
2220         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2221                 if (ignore_system_lyxrc ||
2222                     completion_popup_after_complete
2223                     != system_lyxrc.completion_popup_after_complete) {
2224                         os << "\\completion_popup_after_complete "
2225                                 << convert<string>(completion_popup_after_complete) << '\n';
2226                 }
2227                 if (tag != RC_LAST)
2228                         break;
2229                 // fall through
2230         case RC_COMPLETION_MINLENGTH:
2231                 if (ignore_system_lyxrc ||
2232                         completion_minlength != system_lyxrc.completion_minlength) {
2233                         os << "\\completion_minlength " << convert<string>(completion_minlength)
2234                         << '\n';
2235                 }
2236                 if (tag != RC_LAST)
2237                         break;
2238                 // fall through
2239         case RC_NUMLASTFILES:
2240                 if (ignore_system_lyxrc ||
2241                     num_lastfiles != system_lyxrc.num_lastfiles) {
2242                         os << "\\num_lastfiles " << num_lastfiles << '\n';
2243                 }
2244                 if (tag != RC_LAST)
2245                         break;
2246                 // fall through
2247         case RC_CHECKLASTFILES:
2248                 if (ignore_system_lyxrc ||
2249                     check_lastfiles != system_lyxrc.check_lastfiles) {
2250                         os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2251                            << '\n';
2252                 }
2253                 if (tag != RC_LAST)
2254                         break;
2255                 // fall through
2256         case RC_EXAMPLEPATH:
2257                 if (ignore_system_lyxrc ||
2258                     example_path != system_lyxrc.example_path) {
2259                         string const path = os::external_path(example_path);
2260                         os << "\\example_path \"" << path << "\"\n";
2261                 }
2262                 if (tag != RC_LAST)
2263                         break;
2264                 // fall through
2265         case RC_TEMPLATEPATH:
2266                 if (ignore_system_lyxrc ||
2267                     template_path != system_lyxrc.template_path) {
2268                         string const path = os::external_path(template_path);
2269                         os << "\\template_path \"" << path << "\"\n";
2270                 }
2271                 if (tag != RC_LAST)
2272                         break;
2273                 // fall through
2274         case RC_TEMPDIRPATH:
2275                 if (ignore_system_lyxrc ||
2276                     tempdir_path != system_lyxrc.tempdir_path) {
2277                         string const path = os::external_path(tempdir_path);
2278                         os << "\\tempdir_path \"" << path << "\"\n";
2279                 }
2280                 if (tag != RC_LAST)
2281                         break;
2282                 // fall through
2283         case RC_THESAURUSDIRPATH:
2284                 if (ignore_system_lyxrc ||
2285                     thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2286                         string const path = os::external_path(thesaurusdir_path);
2287                         os << "\\thesaurusdir_path \"" << path << "\"\n";
2288                 }
2289                 if (tag != RC_LAST)
2290                         break;
2291                 // fall through
2292         case RC_HUNSPELLDIR_PATH:
2293                 if (ignore_system_lyxrc ||
2294                     hunspelldir_path != system_lyxrc.hunspelldir_path) {
2295                         string const path = os::external_path(hunspelldir_path);
2296                         os << "\\hunspelldir_path \"" << path << "\"\n";
2297                 }
2298                 if (tag != RC_LAST)
2299                         break;
2300                 // fall through
2301         case RC_PLAINTEXT_LINELEN:
2302                 if (ignore_system_lyxrc ||
2303                     plaintext_linelen != system_lyxrc.plaintext_linelen) {
2304                         os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2305                 }
2306                 if (tag != RC_LAST)
2307                         break;
2308                 // fall through
2309         case RC_MAKE_BACKUP:
2310                 if (ignore_system_lyxrc ||
2311                     make_backup != system_lyxrc.make_backup) {
2312                         os << "\\make_backup " << convert<string>(make_backup) << '\n';
2313                 }
2314                 if (tag != RC_LAST)
2315                         break;
2316                 // fall through
2317         case RC_SAVE_COMPRESSED:
2318                 if (ignore_system_lyxrc ||
2319                     save_compressed != system_lyxrc.save_compressed) {
2320                         os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2321                 }
2322                 if (tag != RC_LAST)
2323                         break;
2324                 // fall through
2325         case RC_SAVE_ORIGIN:
2326                 if (ignore_system_lyxrc ||
2327                     save_origin != system_lyxrc.save_origin) {
2328                         os << "\\save_origin " << convert<string>(save_origin) << '\n';
2329                 }
2330                 if (tag != RC_LAST)
2331                         break;
2332                 // fall through
2333         case RC_BACKUPDIR_PATH:
2334                 if (ignore_system_lyxrc ||
2335                     backupdir_path != system_lyxrc.backupdir_path) {
2336                         string const path = os::external_path(backupdir_path);
2337                         os << "\\backupdir_path \"" << path << "\"\n";
2338                 }
2339                 if (tag != RC_LAST)
2340                         break;
2341
2342                 os << "\n#\n"
2343                    << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2344                    << "#\n\n";
2345
2346                 os << "\n#\n"
2347                    << "# SPELLCHECKER SECTION ##############################\n"
2348                    << "#\n\n";
2349
2350         // fall through
2351         case RC_ACCEPT_COMPOUND:
2352                 if (ignore_system_lyxrc ||
2353                     spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2354                         os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2355                            << '\n';
2356                 }
2357                 if (tag != RC_LAST)
2358                         break;
2359                 // fall through
2360         case RC_ALT_LANG:
2361                 if (ignore_system_lyxrc ||
2362                     spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2363                         os << "\\alternate_language \"" << spellchecker_alt_lang
2364                            << "\"\n";
2365                 }
2366                 if (tag != RC_LAST)
2367                         break;
2368                 // fall through
2369         case RC_ESC_CHARS:
2370                 if (ignore_system_lyxrc ||
2371                     spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2372                         os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2373                 }
2374                 if (tag != RC_LAST)
2375                         break;
2376                 // fall through
2377         case RC_USE_NATIVE_FILEDIALOG:
2378                 if (ignore_system_lyxrc ||
2379                     use_native_filedialog != system_lyxrc.use_native_filedialog) {
2380                         os << "\\use_native_filedialog "
2381                            << convert<string>(use_native_filedialog)
2382                            << '\n';
2383                 }
2384                 if (tag != RC_LAST)
2385                         break;
2386                 // fall through
2387         case RC_USE_SYSTEM_COLORS:
2388                 if (ignore_system_lyxrc ||
2389                     use_system_colors != system_lyxrc.use_system_colors) {
2390                         os << "\\use_system_colors "
2391                            << convert<string>(use_system_colors)
2392                            << '\n';
2393                 }
2394                 if (tag != RC_LAST)
2395                         break;
2396                 // fall through
2397         case RC_USE_TOOLTIP:
2398                 if (ignore_system_lyxrc ||
2399                     use_tooltip != system_lyxrc.use_tooltip) {
2400                         os << "\\use_tooltip "
2401                            << convert<string>(use_tooltip)
2402                            << '\n';
2403                 }
2404                 if (tag != RC_LAST)
2405                         break;
2406                 // fall through
2407
2408                 os << "\n#\n"
2409                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
2410                    << "#\n\n";
2411
2412         // fall through
2413         case RC_DEFAULT_DECIMAL_SEP:
2414                 if (ignore_system_lyxrc ||
2415                     default_decimal_sep != system_lyxrc.default_decimal_sep) {
2416                         os << "\\default_decimal_point \"" << default_decimal_sep << "\"" << '\n';
2417                 }
2418                 if (tag != RC_LAST)
2419                         break;
2420                 // fall through
2421         case RC_DEFAULT_LENGTH_UNIT:
2422                 if (ignore_system_lyxrc ||
2423                     default_length_unit != system_lyxrc.default_length_unit) {
2424                         os << "\\default_length_unit " << int(default_length_unit) << '\n';
2425                 }
2426                 if (tag != RC_LAST)
2427                         break;
2428                 // fall through
2429         case RC_SPELLCHECKER:
2430                 if (ignore_system_lyxrc ||
2431                     spellchecker != system_lyxrc.spellchecker) {
2432                         os << "\\spellchecker " << spellchecker << '\n';
2433                 }
2434                 if (tag != RC_LAST)
2435                         break;
2436                 // fall through
2437         case RC_SPELLCHECK_CONTINUOUSLY:
2438                 if (ignore_system_lyxrc ||
2439                     spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2440                         os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2441                            << '\n';
2442                 }
2443                 if (tag != RC_LAST)
2444                         break;
2445                 // fall through
2446         case RC_SPELLCHECK_NOTES:
2447                 if (ignore_system_lyxrc ||
2448                     spellcheck_notes != system_lyxrc.spellcheck_notes) {
2449                         os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2450                            << '\n';
2451                 }
2452                 if (tag != RC_LAST)
2453                         break;
2454                 // fall through
2455         case RC_VISUAL_CURSOR:
2456                 if (ignore_system_lyxrc ||
2457                         visual_cursor != system_lyxrc.visual_cursor) {
2458                         os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2459                 }
2460                 if (tag != RC_LAST)
2461                         break;
2462                 // fall through
2463         case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2464                 if (ignore_system_lyxrc ||
2465                         close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2466                         os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2467                         os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2468                 }
2469                 if (tag != RC_LAST)
2470                         break;
2471                 // fall through
2472         case RC_LANGUAGE_CUSTOM_PACKAGE:
2473                 if (ignore_system_lyxrc ||
2474                     language_custom_package != system_lyxrc.language_custom_package) {
2475                         os << "\\language_custom_package \"" << language_custom_package
2476                            << "\"\n";
2477                 }
2478                 if (tag != RC_LAST)
2479                         break;
2480                 // fall through
2481         case RC_LANGUAGE_GLOBAL_OPTIONS:
2482                 if (ignore_system_lyxrc ||
2483                     language_global_options
2484                     != system_lyxrc.language_global_options) {
2485                         os << "\\language_global_options \""
2486                            << convert<string>(language_global_options)
2487                            << "\"\n";
2488                 }
2489                 if (tag != RC_LAST)
2490                         break;
2491                 // fall through
2492         case RC_LANGUAGE_PACKAGE_SELECTION:
2493                 if (ignore_system_lyxrc ||
2494                     language_package_selection != system_lyxrc.language_package_selection) {
2495                         os << "\\language_package_selection ";
2496                         switch (language_package_selection) {
2497                         case LP_AUTO:
2498                                 os << "0\n";
2499                                 break;
2500                         case LP_BABEL:
2501                                 os << "1\n";
2502                                 break;
2503                         case LP_CUSTOM:
2504                                 os << "2\n";
2505                                 break;
2506                         case LP_NONE:
2507                                 os << "3\n";
2508                                 break;
2509                         }
2510                 }
2511                 if (tag != RC_LAST)
2512                         break;
2513                 // fall through
2514         case RC_LANGUAGE_COMMAND_BEGIN:
2515                 if (ignore_system_lyxrc ||
2516                     language_command_begin
2517                     != system_lyxrc.language_command_begin) {
2518                         os << "\\language_command_begin \""
2519                            << language_command_begin
2520                            << "\"\n";
2521                 }
2522                 if (tag != RC_LAST)
2523                         break;
2524                 // fall through
2525         case RC_LANGUAGE_COMMAND_END:
2526                 if (ignore_system_lyxrc ||
2527                     language_command_end
2528                     != system_lyxrc.language_command_end) {
2529                         os << "\\language_command_end \"" << language_command_end
2530                            << "\"\n";
2531                 }
2532                 if (tag != RC_LAST)
2533                         break;
2534                 // fall through
2535         case RC_LANGUAGE_COMMAND_LOCAL:
2536                 if (ignore_system_lyxrc ||
2537                     language_command_local
2538                     != system_lyxrc.language_command_local) {
2539                         os << "\\language_command_local \""
2540                            << language_command_local
2541                            << "\"\n";
2542                 }
2543                 if (tag != RC_LAST)
2544                         break;
2545                 // fall through
2546         case RC_LANGUAGE_AUTO_BEGIN:
2547                 if (ignore_system_lyxrc ||
2548                     language_auto_begin != system_lyxrc.language_auto_begin) {
2549                         os << "\\language_auto_begin "
2550                            << convert<string>(language_auto_begin) << '\n';
2551                 }
2552                 if (tag != RC_LAST)
2553                         break;
2554                 // fall through
2555         case RC_LANGUAGE_AUTO_END:
2556                 if (ignore_system_lyxrc ||
2557                     language_auto_end != system_lyxrc.language_auto_end) {
2558                         os << "\\language_auto_end "
2559                            << convert<string>(language_auto_end) << '\n';
2560                 }
2561                 if (tag != RC_LAST)
2562                         break;
2563                 // fall through
2564         case RC_MARK_FOREIGN_LANGUAGE:
2565                 if (ignore_system_lyxrc ||
2566                     mark_foreign_language
2567                     != system_lyxrc.mark_foreign_language) {
2568                         os << "\\mark_foreign_language " <<
2569                                 convert<string>(mark_foreign_language) << '\n';
2570                 }
2571                 // fall through
2572         case RC_RESPECT_OS_KBD_LANGUAGE:
2573                 if (ignore_system_lyxrc ||
2574                     respect_os_kbd_language
2575                     != system_lyxrc.respect_os_kbd_language) {
2576                         os << "\\respect_os_kbd_language " <<
2577                                 convert<string>(respect_os_kbd_language) << '\n';
2578                 }
2579                 //fall through
2580                 if (tag != RC_LAST)
2581                         break;
2582
2583                 os << "\n#\n"
2584                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
2585                    << "#\n\n";
2586
2587         // fall through
2588         case RC_AUTO_NUMBER:
2589                 if (ignore_system_lyxrc ||
2590                     auto_number != system_lyxrc.auto_number) {
2591                         os << "\\auto_number " << convert<string>(auto_number) << '\n';
2592                 }
2593                 if (tag != RC_LAST)
2594                         break;
2595                 // fall through
2596         case RC_GUI_LANGUAGE:
2597                 if (ignore_system_lyxrc ||
2598                     gui_language != system_lyxrc.gui_language) {
2599                         os << "\\gui_language " << gui_language << '\n';
2600                 }
2601                 if (tag != RC_LAST)
2602                         break;
2603                 // fall through
2604         case RC_EXPORT_OVERWRITE:
2605                 if (ignore_system_lyxrc ||
2606                     export_overwrite != system_lyxrc.export_overwrite) {
2607                         string status;
2608                         switch (export_overwrite) {
2609                         case NO_FILES:
2610                                 status = "ask";
2611                                 break;
2612                         case MAIN_FILE:
2613                                 status = "main";
2614                                 break;
2615                         case ALL_FILES:
2616                                 status = "all";
2617                                 break;
2618                         }
2619                         os << "\\export_overwrite " << status << '\n';
2620                 }
2621                 if (tag != RC_LAST)
2622                         break;
2623                 // fall through
2624         case RC_SCROLL_WHEEL_ZOOM:
2625                 if (ignore_system_lyxrc ||
2626                         scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2627                         string status;
2628                         switch (scroll_wheel_zoom) {
2629                         case SCROLL_WHEEL_ZOOM_OFF:
2630                                 status = "off";
2631                                 break;
2632                         case SCROLL_WHEEL_ZOOM_CTRL:
2633                                 status = "ctrl";
2634                                 break;
2635                         case SCROLL_WHEEL_ZOOM_SHIFT:
2636                                 status = "shift";
2637                                 break;
2638                         case SCROLL_WHEEL_ZOOM_ALT:
2639                                 status = "alt";
2640                                 break;
2641                         }
2642                         os << "\\scroll_wheel_zoom " << status << '\n';
2643                 }
2644                 if (tag != RC_LAST)
2645                         break;
2646
2647                 os << "\n#\n"
2648                    << "# FORMATS SECTION ##########################\n"
2649                    << "#\n\n";
2650
2651         // fall through
2652         case RC_FILEFORMAT:
2653                 // New/modified formats
2654                 for (Formats::const_iterator cit = theFormats().begin();
2655                      cit != theFormats().end(); ++cit) {
2656                         Format const * format =
2657                                 theSystemFormats().getFormat(cit->name());
2658                         if (!format ||
2659                             format->extensions() != cit->extensions() ||
2660                             format->prettyname() != cit->prettyname() ||
2661                             format->shortcut() != cit->shortcut() ||
2662                             format->viewer() != cit->viewer() ||
2663                             format->editor() != cit->editor() ||
2664                             format->documentFormat() != cit->documentFormat() ||
2665                             format->vectorFormat() != cit->vectorFormat() ||
2666                             format->inExportMenu() != cit->inExportMenu() ||
2667                             format->noMenu() != cit->noMenu() ||
2668                             format->mime() != cit->mime()) {
2669                                 os << "\\format \"" << cit->name() << "\" \""
2670                                    << cit->extensions() << "\" \""
2671                                    << to_utf8(cit->prettyname()) << "\" \""
2672                                    << cit->shortcut() << "\" \""
2673                                    << escapeCommand(cit->viewer()) << "\" \""
2674                                    << escapeCommand(cit->editor()) << "\" \"";
2675                                 vector<string> flags;
2676                                 if (cit->documentFormat())
2677                                         flags.push_back("document");
2678                                 if (cit->vectorFormat())
2679                                         flags.push_back("vector");
2680                                 if (cit->zippedNative())
2681                                         flags.push_back("zipped=native");
2682                                 if (cit->inExportMenu())
2683                                         flags.push_back("menu=export");
2684
2685                                 os << getStringFromVector(flags);
2686                                 os << "\" \"" << cit->mime() << "\"\n";
2687                         }
2688                 }
2689
2690                 // Look for deleted formats
2691                 for (Formats::const_iterator cit = theSystemFormats().begin();
2692                      cit != theSystemFormats().end(); ++cit)
2693                         if (!theFormats().getFormat(cit->name()))
2694                                 os << "\\format \"" << cit->name()
2695                                    << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2696                 if (tag != RC_LAST)
2697                         break;
2698                 // fall through
2699         case RC_VIEWER_ALTERNATIVES: {
2700                 Alternatives::const_iterator it = viewer_alternatives.begin();
2701                 Alternatives::const_iterator const en = viewer_alternatives.end();
2702                 Alternatives::const_iterator const sysend =
2703                                 system_lyxrc.viewer_alternatives.end();
2704                 for (; it != en; ++it) {
2705                         string const & fmt = it->first;
2706                         CommandSet const & cmd = it->second;
2707                         CommandSet::const_iterator sit = cmd.begin();
2708                         CommandSet::const_iterator const sen = cmd.end();
2709                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2710                                         system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2711                                         system_lyxrc.viewer_alternatives.find(fmt);
2712                         for (; sit != sen; ++sit) {
2713                                 string const & cmd = *sit;
2714                                 if (ignore_system_lyxrc
2715                                     || sysfmt == sysend               // format not found
2716                                          || sysfmt->second.count(cmd) == 0 // this command not found
2717                                    )
2718                                         os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2719                         }
2720                 }
2721                 if (tag != RC_LAST)
2722                         break;
2723         }
2724         // fall through
2725         case RC_EDITOR_ALTERNATIVES: {
2726                 Alternatives::const_iterator it = editor_alternatives.begin();
2727                 Alternatives::const_iterator const en = editor_alternatives.end();
2728                 Alternatives::const_iterator const sysend =
2729                                 system_lyxrc.editor_alternatives.end();
2730                 for (; it != en; ++it) {
2731                         string const & fmt = it->first;
2732                         CommandSet const & cmd = it->second;
2733                         CommandSet::const_iterator sit = cmd.begin();
2734                         CommandSet::const_iterator const sen = cmd.end();
2735                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2736                                         system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2737                                         system_lyxrc.editor_alternatives.find(fmt);
2738                         for (; sit != sen; ++sit) {
2739                                 string const & cmd = *sit;
2740                                 if (ignore_system_lyxrc
2741                                     || sysfmt == sysend               // format not found
2742                                     || sysfmt->second.count(cmd) == 0 // this command not found
2743                                    )
2744                                         os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2745                         }
2746                 }
2747                 if (tag != RC_LAST)
2748                         break;
2749         }
2750         // fall through
2751         case RC_DEFAULT_OTF_VIEW_FORMAT:
2752                 if ((ignore_system_lyxrc ||
2753                      default_otf_view_format != system_lyxrc.default_otf_view_format)
2754                     && !default_otf_view_format.empty()) {
2755                         os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2756                 }
2757                 if (tag != RC_LAST)
2758                         break;
2759                 // fall through
2760         case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2761                 if ((ignore_system_lyxrc ||
2762                      default_platex_view_format != system_lyxrc.default_platex_view_format)
2763                     && !default_platex_view_format.empty()) {
2764                         os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2765                 }
2766                 if (tag != RC_LAST)
2767                         break;
2768                 // fall through
2769         case RC_DEFAULT_VIEW_FORMAT:
2770                 if ((ignore_system_lyxrc ||
2771                         default_view_format != system_lyxrc.default_view_format)
2772                         && !default_view_format.empty()) {
2773                         os << "\\default_view_format " << default_view_format << '\n';
2774                 }
2775                 if (tag != RC_LAST)
2776                         break;
2777                 // fall through
2778         case RC_VIEWER:
2779                 // Ignore it
2780                 if (tag != RC_LAST)
2781                         break;
2782
2783                 os << "\n#\n"
2784                    << "# CONVERTERS SECTION ##########################\n"
2785                    << "#\n\n";
2786
2787         // fall through
2788         case RC_CONVERTER:
2789                 // Look for new converters
2790                 for (Converters::const_iterator cit = theConverters().begin();
2791                      cit != theConverters().end(); ++cit) {
2792                         Converter const * converter =
2793                                 theSystemConverters().getConverter(cit->from(),
2794                                                                    cit->to());
2795                         if (!converter ||
2796                             converter->command() != cit->command() ||
2797                             converter->flags() != cit->flags())
2798                                 os << "\\converter \"" << cit->from() << "\" \""
2799                                    << cit->to() << "\" \""
2800                                    << escapeCommand(cit->command()) << "\" \""
2801                                    << cit->flags() << "\"\n";
2802                 }
2803
2804                 // New/modifed converters
2805                 for (Converters::const_iterator cit = theSystemConverters().begin();
2806                      cit != theSystemConverters().end(); ++cit)
2807                         if (!theConverters().getConverter(cit->from(), cit->to()))
2808                                 os << "\\converter \"" << cit->from()
2809                                    << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2810                 if (tag != RC_LAST)
2811                         break;
2812                 // fall through
2813         case RC_COPIER:
2814                 if (tag == RC_LAST)
2815                         os << "\n#\n"
2816                            << "# COPIERS SECTION ##########################\n"
2817                            << "#\n\n";
2818
2819                 // Look for new movers
2820                 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2821                 Movers::const_iterator const sysend = theSystemMovers().end();
2822                 Movers::const_iterator it = theMovers().begin();
2823                 Movers::const_iterator end = theMovers().end();
2824
2825                 for (; it != end; ++it) {
2826                         Movers::const_iterator const sysit =
2827                                 find_if(sysbegin, sysend, SameMover(*it));
2828                         if (sysit == sysend) {
2829                                 string const & fmt = it->first;
2830                                 string const & command =
2831                                         it->second.command();
2832
2833                                 os << "\\copier " << fmt
2834                                    << " \"" << escapeCommand(command) << "\"\n";
2835                         }
2836                 }
2837                 if (tag != RC_LAST)
2838                         break;
2839
2840                 // We don't actually delete SpecialisedMover(s) from the
2841                 // map, just clear their 'command', so there's no need
2842                 // to test for anything else.
2843         }
2844
2845         os.flush();
2846 }
2847
2848
2849 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2850 {
2851         // Why the switch you might ask. It is a trick to ensure that all
2852         // the elements in the LyXRCTags enum is handled. As you can see
2853         // there are no breaks at all. So it is just a huge fall-through.
2854         // The nice thing is that we will get a warning from the compiler
2855         // if we forget an element.
2856         LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2857         switch (tag) {
2858         case LyXRC::RC_LAST:
2859         case LyXRC::RC_ACCEPT_COMPOUND:
2860                 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2861                         if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2862                 // fall through
2863         case LyXRC::RC_ALT_LANG:
2864         case LyXRC::RC_PLAINTEXT_LINELEN:
2865         case LyXRC::RC_AUTOCORRECTION_MATH:
2866         case LyXRC::RC_AUTOREGIONDELETE:
2867         case LyXRC::RC_AUTORESET_OPTIONS:
2868         case LyXRC::RC_AUTOSAVE:
2869         case LyXRC::RC_AUTO_NUMBER:
2870         case LyXRC::RC_BACKUPDIR_PATH:
2871         case LyXRC::RC_BIBTEX_ALTERNATIVES:
2872         case LyXRC::RC_BIBTEX_COMMAND:
2873         case LyXRC::RC_BINDFILE:
2874         case LyXRC::RC_BOOKMARKS_VISIBILITY:
2875         case LyXRC::RC_CITATION_SEARCH:
2876         case LyXRC::RC_CITATION_SEARCH_PATTERN:
2877         case LyXRC::RC_CITATION_SEARCH_VIEW:
2878         case LyXRC::RC_CHECKLASTFILES:
2879         case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2880         case LyXRC::RC_COMPLETION_INLINE_DELAY:
2881         case LyXRC::RC_COMPLETION_INLINE_DOTS:
2882         case LyXRC::RC_COMPLETION_INLINE_MATH:
2883         case LyXRC::RC_COMPLETION_INLINE_TEXT:
2884         case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2885         case LyXRC::RC_COMPLETION_POPUP_DELAY:
2886         case LyXRC::RC_COMPLETION_POPUP_MATH:
2887         case LyXRC::RC_COMPLETION_POPUP_TEXT:
2888         case LyXRC::RC_COMPLETION_MINLENGTH:
2889         case LyXRC::RC_USELASTFILEPOS:
2890         case LyXRC::RC_LOADSESSION:
2891         case LyXRC::RC_CHKTEX_COMMAND:
2892         case LyXRC::RC_CONVERTER:
2893         case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2894         case LyXRC::RC_COPIER:
2895         case LyXRC::RC_CT_ADDITIONS_UNDERLINED:
2896         case LyXRC::RC_CT_MARKUP_COPIED:
2897         case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2898         case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2899         case LyXRC::RC_GUI_LANGUAGE:
2900         case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2901         case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2902         case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2903         case LyXRC::RC_DEFFILE:
2904         case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2905         case LyXRC::RC_DISPLAY_GRAPHICS:
2906         case LyXRC::RC_DOCUMENTPATH:
2907                 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2908                         FileName path(lyxrc_new.document_path);
2909                         if (path.exists() && path.isDirectory())
2910                                 package().document_dir() = FileName(lyxrc.document_path);
2911                 }
2912                 // fall through
2913         case LyXRC::RC_EDITOR_ALTERNATIVES:
2914         case LyXRC::RC_ESC_CHARS:
2915         case LyXRC::RC_EXAMPLEPATH:
2916         case LyXRC::RC_FILEFORMAT:
2917         case LyXRC::RC_GROUP_LAYOUTS:
2918         case LyXRC::RC_HUNSPELLDIR_PATH:
2919         case LyXRC::RC_ICON_SET:
2920         case LyXRC::RC_INDEX_ALTERNATIVES:
2921         case LyXRC::RC_INDEX_COMMAND:
2922         case LyXRC::RC_JBIBTEX_COMMAND:
2923         case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2924         case LyXRC::RC_JINDEX_COMMAND:
2925         case LyXRC::RC_NOMENCL_COMMAND:
2926         case LyXRC::RC_PYGMENTIZE_COMMAND:
2927         case LyXRC::RC_INPUT:
2928         case LyXRC::RC_KBMAP:
2929         case LyXRC::RC_KBMAP_PRIMARY:
2930         case LyXRC::RC_KBMAP_SECONDARY:
2931         case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2932         case LyXRC::RC_LANGUAGE_AUTO_END:
2933         case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2934         case LyXRC::RC_LANGUAGE_COMMAND_END:
2935         case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2936         case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2937         case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2938         case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2939         case LyXRC::RC_LYXRCFORMAT:
2940         case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2941         case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2942         case LyXRC::RC_MACRO_EDIT_STYLE:
2943         case LyXRC::RC_MAKE_BACKUP:
2944         case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2945         case LyXRC::RC_RESPECT_OS_KBD_LANGUAGE:
2946         case LyXRC::RC_MOUSE_WHEEL_SPEED:
2947         case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
2948         case LyXRC::RC_NUMLASTFILES:
2949         case LyXRC::RC_PARAGRAPH_MARKERS:
2950         case LyXRC::RC_PATH_PREFIX:
2951                 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2952                         prependEnvPath("PATH", replaceEnvironmentPath(lyxrc_new.path_prefix));
2953                         // Resets python path
2954                         support::os::python(true);
2955                 }
2956                 // fall through
2957         case LyXRC::RC_PREVIEW:
2958                 if (lyxrc_orig.preview != lyxrc_new.preview) {
2959                         // Update all previews of all documents.
2960                         /* FIXME: this can be very expensive. It would be cheaper
2961                          * to kill all existing previews and update visible
2962                          * previews.*/
2963                         theBufferList().updatePreviews();
2964                 }
2965                 // fall through
2966         case LyXRC::RC_PREVIEW_HASHED_LABELS:
2967         case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2968         case LyXRC::RC_PRINTLANDSCAPEFLAG:
2969         case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
2970         case LyXRC::RC_PRINTPAPERFLAG:
2971         case LyXRC::RC_SAVE_COMPRESSED:
2972         case LyXRC::RC_SAVE_ORIGIN:
2973         case LyXRC::RC_SCREEN_DPI:
2974
2975         case LyXRC::RC_SCREEN_FONT_ROMAN:
2976         case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
2977         case LyXRC::RC_SCREEN_FONT_SANS:
2978         case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
2979         case LyXRC::RC_SCREEN_FONT_SCALABLE:
2980         case LyXRC::RC_SCREEN_FONT_SIZES:
2981         case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
2982         case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2983         case LyXRC::RC_SCREEN_ZOOM:
2984                 if (lyxrc_orig.roman_font_name != lyxrc_new.roman_font_name
2985                 || lyxrc_orig.sans_font_name != lyxrc_new.sans_font_name
2986                 || lyxrc_orig.typewriter_font_name != lyxrc_new.typewriter_font_name
2987                 || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry
2988                 || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry
2989                 || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts
2990                 || !std::equal(std::begin(lyxrc_orig.font_sizes), std::end(lyxrc_orig.font_sizes),
2991                                std::begin(lyxrc_new.font_sizes))
2992                 || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry
2993                 || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) {
2994                         dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
2995                 }
2996                 // fall through
2997         case LyXRC::RC_GEOMETRY_SESSION:
2998         case LyXRC::RC_SERVERPIPE:
2999         case LyXRC::RC_SET_COLOR:
3000         case LyXRC::RC_SHOW_BANNER:
3001         case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
3002         case LyXRC::RC_SPELLCHECKER:
3003                 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3004                         setSpellChecker();
3005                 // fall through
3006         case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3007         case LyXRC::RC_SPELLCHECK_NOTES:
3008         case LyXRC::RC_SPLITINDEX_COMMAND:
3009         case LyXRC::RC_TEMPDIRPATH:
3010         case LyXRC::RC_TEMPLATEPATH:
3011         case LyXRC::RC_TEX_ALLOWS_SPACES:
3012         case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3013                 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3014                         os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3015                 }
3016                 // fall through
3017         case LyXRC::RC_TEXINPUTS_PREFIX:
3018         case LyXRC::RC_THESAURUSDIRPATH:
3019         case LyXRC::RC_UIFILE:
3020         case LyXRC::RC_USER_EMAIL:
3021         case LyXRC::RC_USER_INITIALS:
3022         case LyXRC::RC_USER_NAME:
3023         case LyXRC::RC_USE_CONVERTER_CACHE:
3024         case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
3025         case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
3026         case LyXRC::RC_USE_NATIVE_FILEDIALOG:
3027         case LyXRC::RC_USE_SYSTEM_COLORS:
3028         case LyXRC::RC_USE_TOOLTIP:
3029         case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3030         case LyXRC::RC_VIEWDVI_PAPEROPTION:
3031         case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3032         case LyXRC::RC_SINGLE_INSTANCE:
3033         case LyXRC::RC_SORT_LAYOUTS:
3034         case LyXRC::RC_FULL_SCREEN_LIMIT:
3035         case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3036         case LyXRC::RC_FULL_SCREEN_MENUBAR:
3037         case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3038         case LyXRC::RC_FULL_SCREEN_TABBAR:
3039         case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3040         case LyXRC::RC_FULL_SCREEN_WIDTH:
3041         case LyXRC::RC_VISUAL_CURSOR:
3042         case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3043         case LyXRC::RC_VIEWER:
3044         case LyXRC::RC_VIEWER_ALTERNATIVES:
3045         case LyXRC::RC_FORWARD_SEARCH_DVI:
3046         case LyXRC::RC_FORWARD_SEARCH_PDF:
3047         case LyXRC::RC_EXPORT_OVERWRITE:
3048         case LyXRC::RC_DEFAULT_DECIMAL_SEP:
3049         case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3050         case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3051         case LyXRC::RC_CURSOR_WIDTH:
3052                 break;
3053         }
3054 }
3055
3056
3057 set<string> LyXRC::getRCs()
3058 {
3059         set<string> res;
3060         for (int i = 0; i != lyxrcCount; ++i)
3061                 res.insert(ltrim(lyxrcTags[i].tag, "\\"));
3062         return res;
3063 }
3064
3065
3066 #if 0
3067 string const LyXRC::getDescription(LyXRCTags tag)
3068 {
3069         docstring str;
3070
3071         switch (tag) {
3072         case RC_ACCEPT_COMPOUND:
3073                 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3074                 break;
3075
3076         case RC_ALT_LANG:
3077                 str = _("Specify an alternate language. The default is to use the language of the document.");
3078                 break;
3079
3080         case RC_PLAINTEXT_LINELEN:
3081                 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.");
3082                 break;
3083
3084         case RC_AUTOREGIONDELETE:
3085                 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3086                 break;
3087
3088         case RC_AUTORESET_OPTIONS:
3089                 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3090                 break;
3091
3092         case RC_AUTOSAVE:
3093                 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3094                 break;
3095
3096         case RC_AUTO_NUMBER:
3097                 break;
3098
3099         case RC_BACKUPDIR_PATH:
3100                 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.");
3101                 break;
3102
3103         case RC_BIBTEX_COMMAND:
3104                 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3105                 break;
3106
3107         case RC_JBIBTEX_COMMAND:
3108                 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3109                 break;
3110
3111         case RC_BINDFILE:
3112                 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3113                 break;
3114
3115         case RC_CHECKLASTFILES:
3116                 str = _("Select to check whether the lastfiles still exist.");
3117                 break;
3118
3119         case RC_CHKTEX_COMMAND:
3120                 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3121                 break;
3122
3123         case RC_CONVERTER:
3124                 break;
3125
3126         case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3127                 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3128                 break;
3129
3130         case RC_CONVERTER_NEEDAUTH:
3131                 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3132                 break;
3133
3134         case RC_COPIER:
3135                 break;
3136
3137         case RC_CURSOR_FOLLOWS_SCROLLBAR:
3138                 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.");
3139                 break;
3140
3141         case RC_CURSOR_WIDTH:
3142                 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3143                 break;
3144
3145         case RC_SCROLL_BELOW_DOCUMENT:
3146                 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");
3147                 break;
3148
3149         case RC_MAC_DONTSWAP_CTRL_META:
3150                 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3151                 break;
3152
3153         case RC_MAC_LIKE_CURSOR_MOVEMENT:
3154                 str = _("Use the Mac OS X conventions for cursor movement");
3155                 break;
3156
3157         case RC_SHOW_MACRO_LABEL:
3158                 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3159                 break;
3160
3161         case RC_DEFFILE:
3162                 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3163                 break;
3164
3165         case RC_DEFAULT_OTF_VIEW_FORMAT:
3166                 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3167                 break;
3168
3169         case RC_DEFAULT_VIEW_FORMAT:
3170                 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3171                 break;
3172
3173         case RC_DIALOGS_ICONIFY_WITH_MAIN:
3174                 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3175                 break;
3176
3177         case RC_DISPLAY_GRAPHICS:
3178                 str = _("Select how LyX will display any graphics.");
3179                 break;
3180
3181         case RC_DOCUMENTPATH:
3182                 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3183                 break;
3184
3185         case RC_ESC_CHARS:
3186                 str = _("Specify additional chars that can be part of a word.");
3187                 break;
3188
3189         case RC_EXAMPLEPATH:
3190                 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3191                 break;
3192
3193         case RC_FILEFORMAT:
3194                 break;
3195
3196         case RC_INDEX_COMMAND:
3197                 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\".");
3198                 break;
3199
3200         case RC_JINDEX_COMMAND:
3201                 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3202                 break;
3203
3204         case RC_NOMENCL_COMMAND:
3205                 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3206                 break;
3207
3208         case RC_PYGMENTIZE_COMMAND:
3209                 str = _("The command to run the python pygments syntax highlighter.");
3210                 break;
3211
3212         case RC_INPUT:
3213                 break;
3214
3215         case RC_KBMAP:
3216         case RC_KBMAP_PRIMARY:
3217         case RC_KBMAP_SECONDARY:
3218                 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.");
3219                 break;
3220
3221         case RC_LANGUAGE_AUTO_BEGIN:
3222                 str = _("Select if a language switching command is needed at the beginning of the document.");
3223                 break;
3224
3225         case RC_LANGUAGE_AUTO_END:
3226                 str = _("Select if a language switching command is needed at the end of the document.");
3227                 break;
3228
3229         case RC_LANGUAGE_COMMAND_BEGIN:
3230                 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.");
3231                 break;
3232
3233         case RC_LANGUAGE_COMMAND_END:
3234                 str = _("The LaTeX command for changing back to the language of the document.");
3235                 break;
3236
3237         case RC_LANGUAGE_COMMAND_LOCAL:
3238                 str = _("The LaTeX command for local changing of the language.");
3239                 break;
3240
3241         case RC_LANGUAGE_GLOBAL_OPTIONS:
3242                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3243                 break;
3244
3245         case RC_LANGUAGE_CUSTOM_PACKAGE:
3246                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3247                 break;
3248
3249         case RC_LANGUAGE_PACKAGE_SELECTION:
3250                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3251                 break;
3252
3253         case RC_USELASTFILEPOS:
3254                 str = _("De-select if you do not want LyX to scroll to saved position.");
3255                 break;
3256
3257         case RC_LOADSESSION:
3258                 str = _("De-select to prevent loading files opened from the last LyX session.");
3259                 break;
3260
3261         case RC_MAKE_BACKUP:
3262                 str = _("De-select if you don't want LyX to create backup files.");
3263                 break;
3264
3265         case RC_MARK_FOREIGN_LANGUAGE:
3266                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3267                 break;
3268
3269         case RC_RESPECT_OS_KBD_LANGUAGE:
3270                 str = _("Select to use the current keyboard language, as set from the operating system, as default input language.");
3271                 break;
3272
3273         case RC_MOUSE_WHEEL_SPEED:
3274                 str = _("The scrolling speed of the mouse wheel.");
3275                 break;
3276
3277         case RC_COMPLETION_POPUP_DELAY:
3278                 str = _("The completion popup delay.");
3279                 break;
3280
3281         case RC_COMPLETION_POPUP_MATH:
3282                 str = _("Select to display the completion popup in math mode.");
3283                 break;
3284
3285         case RC_COMPLETION_POPUP_TEXT:
3286                 str = _("Select to display the completion popup in text mode.");
3287                 break;
3288
3289         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3290                 str = _("Show the completion popup without delay after non-unique completion attempt.");
3291                 break;
3292
3293         case RC_COMPLETION_POPUP_TEXT:
3294                 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3295                 break;
3296
3297         case RC_COMPLETION_POPUP_DELAY:
3298                 str = _("The inline completion delay.");
3299                 break;
3300
3301         case RC_COMPLETION_INLINE_MATH:
3302                 str = _("Select to display the inline completion in math mode.");
3303                 break;
3304
3305         case RC_COMPLETION_INLINE_TEXT:
3306                 str = _("Select to display the inline completion in text mode.");
3307                 break;
3308
3309         case RC_COMPLETION_INLINE_DOTS:
3310                 str = _("Use \"...\" to shorten long completions.");
3311                 break;
3312
3313         case RC_AUTOCORRECTION_MATH:
3314                 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3315                 break;
3316
3317         case RC_NUMLASTFILES:
3318                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3319                         maxlastfiles);
3320                 break;
3321
3322         case RC_PATH_PREFIX:
3323                 str = _("Specify those directories which should be "
3324                          "prepended to the PATH environment variable.\n"
3325                          "Use the OS native format.");
3326                 break;
3327
3328         case RC_PREVIEW:
3329                 str = _("Shows a typeset preview of things such as math");
3330                 break;
3331
3332         case RC_PREVIEW_HASHED_LABELS:
3333                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3334                 break;
3335
3336         case RC_PREVIEW_SCALE_FACTOR:
3337                 str = _("Scale the preview size to suit.");
3338                 break;
3339
3340         case RC_PRINTLANDSCAPEFLAG:
3341                 str = _("The option to print out in landscape.");
3342                 break;
3343
3344         case RC_PRINTPAPERDIMENSIONFLAG:
3345                 str = _("Option to specify the dimensions of the print paper.");
3346                 break;
3347
3348         case RC_PRINTPAPERFLAG:
3349                 str = _("The option to specify paper type.");
3350                 break;
3351
3352         case RC_VISUAL_CURSOR:
3353                 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3354                 break;
3355
3356         case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3357                 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).");
3358                 break;
3359
3360         case RC_SCREEN_DPI:
3361                 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3362                 break;
3363
3364         case RC_SCREEN_FONT_ROMAN:
3365         case RC_SCREEN_FONT_SANS:
3366         case RC_SCREEN_FONT_TYPEWRITER:
3367                 str = _("The screen fonts used to display the text while editing.");
3368                 break;
3369
3370         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3371         case RC_SCREEN_FONT_SANS_FOUNDRY:
3372         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3373                 break;
3374
3375         case RC_SCREEN_FONT_SCALABLE:
3376                 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.");
3377                 break;
3378
3379         case RC_SCREEN_FONT_SIZES:
3380                 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3381                 break;
3382
3383         case RC_SCREEN_ZOOM:
3384                 //xgettext:no-c-format
3385                 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3386                 break;
3387
3388         case RC_GEOMETRY_SESSION:
3389                 str = _("Allow session manager to save and restore windows geometry.");
3390                 break;
3391
3392         case RC_SERVERPIPE:
3393                 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3394                 break;
3395
3396         case RC_SET_COLOR:
3397                 break;
3398
3399         case RC_SHOW_BANNER:
3400                 str = _("De-select if you don't want the startup banner.");
3401                 break;
3402
3403         case RC_TEMPDIRPATH:
3404                 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3405                 break;
3406
3407         case RC_THESAURUSDIRPATH:
3408                 str = _("This is the place where the files of the thesaurus library reside.");
3409                 break;
3410
3411         case RC_TEMPLATEPATH:
3412                 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3413                 break;
3414
3415         case RC_TEX_ALLOWS_SPACES:
3416                 break;
3417
3418         case RC_TEX_EXPECTS_WINDOWS_PATHS:
3419                 break;
3420
3421         case RC_TEXINPUTS_PREFIX:
3422                 str = _("Specify those directories which should be "
3423                          "prepended to the TEXINPUTS environment variable.\n"
3424                          "A '.' represents the current document directory. "
3425                          "Use the OS native format.");
3426                 break;
3427
3428         case RC_UIFILE:
3429                 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3430                 break;
3431
3432         case RC_USER_EMAIL:
3433                 break;
3434
3435         case RC_USER_NAME:
3436                 break;
3437
3438         case RC_USE_USE_SYSTEM_COLORS:
3439                 str = _("Enable use the system colors for some things like main window background and selection.");
3440                 break;
3441
3442         case RC_USE_TOOLTIP:
3443                 str = _("Enable the automatic appearance of tool tips in the work area.");
3444                 break;
3445
3446         case RC_VIEWDVI_PAPEROPTION:
3447                 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3448                 break;
3449
3450         case RC_VIEWER:
3451                 break;
3452
3453         case RC_LAST:
3454                 break;
3455         }
3456
3457         return str;
3458 }
3459 #endif
3460
3461
3462 // The global instance
3463 LyXRC lyxrc;
3464
3465 // The global copy of the system lyxrc entries (everything except preferences)
3466 LyXRC system_lyxrc;
3467
3468
3469 } // namespace lyx