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