]> git.lyx.org Git - lyx.git/blob - src/LyXRC.cpp
Provide proper fallback if a bibliography processor is not found
[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 if (flag == "menu=none")
1060                                         flgs |= Format::no_menu;
1061                                 else
1062                                         LYXERR0("Ignoring unknown flag `"
1063                                                << flag << "' for format `"
1064                                                << format << "'.");
1065                         }
1066                         if (!ok)
1067                                 LYXERR0("Syntax error in format " << format);
1068                         else if (prettyname.empty()) {
1069                                 if (theConverters().formatIsUsed(format))
1070                                         LYXERR0("Can't delete format " << format);
1071                                 else
1072                                         theFormats().erase(format);
1073                         } else {
1074                                 theFormats().add(format, extensions, prettyname,
1075                                             shortcut, viewer, editor, mime, flgs);
1076                         }
1077                         break;
1078                 }
1079                 case RC_VIEWER_ALTERNATIVES:  {
1080                         string format, command;
1081                         if ((lexrc >> format) && lexrc.next(true)) {
1082                                 command  = lexrc.getString();
1083                                 viewer_alternatives[format].insert(command);
1084                         }
1085                         break;
1086                 }
1087                 case RC_EDITOR_ALTERNATIVES:  {
1088                         string format, command;
1089                         if ((lexrc >> format) && lexrc.next(true)) {
1090                                 command  = lexrc.getString();
1091                                 editor_alternatives[format].insert(command);
1092                         }
1093                         break;
1094                 }
1095
1096                 case RC_DEFAULT_OTF_VIEW_FORMAT:
1097                         lexrc >> default_otf_view_format;
1098                         break;
1099
1100                 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
1101                         lexrc >> default_platex_view_format;
1102                         break;
1103
1104                 case RC_DEFAULT_VIEW_FORMAT:
1105                         lexrc >> default_view_format;
1106                         break;
1107
1108                 case RC_GUI_LANGUAGE:
1109                         lexrc >> gui_language;
1110                         break;
1111
1112                 case RC_SHOW_BANNER:
1113                         lexrc >> show_banner;
1114                         break;
1115
1116                 case RC_PREVIEW:
1117                         if (lexrc.next()) {
1118                                 string const tmp = lexrc.getString();
1119                                 if (tmp == "true" || tmp == "on")
1120                                         preview = PREVIEW_ON;
1121                                 else if (tmp == "no_math")
1122                                         preview = PREVIEW_NO_MATH;
1123                                 else {
1124                                         preview = PREVIEW_OFF;
1125                                         if (tmp != "false" && tmp != "off")
1126                                                 LYXERR0("Unrecognized preview status \""
1127                                                        << tmp << '\n');
1128                                 }
1129                         }
1130                         break;
1131
1132                 case RC_PREVIEW_HASHED_LABELS:
1133                         lexrc >> preview_hashed_labels;
1134                         break;
1135
1136                 case RC_PREVIEW_SCALE_FACTOR:
1137                         lexrc >> preview_scale_factor;
1138                         break;
1139
1140                 case RC_USER_NAME:
1141                         lexrc >> user_name;
1142                         break;
1143                 case RC_USER_EMAIL:
1144                         lexrc >> user_email;
1145                         break;
1146
1147                 case RC_PATH_PREFIX:
1148                         lexrc >> path_prefix;
1149                         break;
1150
1151                 case RC_USE_CONVERTER_CACHE:
1152                         lexrc >> use_converter_cache;
1153                         break;
1154                 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1155                         lexrc >> use_converter_needauth_forbidden;
1156                         break;
1157                 case RC_USE_CONVERTER_NEEDAUTH:
1158                         lexrc >> use_converter_needauth;
1159                         break;
1160                 case RC_CONVERTER_CACHE_MAXAGE:
1161                         lexrc >> converter_cache_maxage;
1162                         break;
1163
1164                 case RC_SORT_LAYOUTS:
1165                         lexrc >> sort_layouts;
1166                         break;
1167                 case RC_GROUP_LAYOUTS:
1168                         lexrc >> group_layouts;
1169                         break;
1170                 case RC_FULL_SCREEN_LIMIT:
1171                         lexrc >> full_screen_limit;
1172                         break;
1173                 case RC_FULL_SCREEN_TOOLBARS:
1174                         lexrc >> full_screen_toolbars;
1175                         break;
1176                 case RC_FULL_SCREEN_SCROLLBAR:
1177                         lexrc >> full_screen_scrollbar;
1178                         break;
1179                 case RC_FULL_SCREEN_STATUSBAR:
1180                         lexrc >> full_screen_statusbar;
1181                         break;
1182                 case RC_FULL_SCREEN_TABBAR:
1183                         lexrc >> full_screen_tabbar;
1184                         break;
1185                 case RC_FULL_SCREEN_MENUBAR:
1186                         lexrc >> full_screen_menubar;
1187                         break;
1188                 case RC_FULL_SCREEN_WIDTH:
1189                         lexrc >> full_screen_width;
1190                         break;
1191                 case RC_OPEN_BUFFERS_IN_TABS:
1192                         lexrc >> open_buffers_in_tabs;
1193                         break;
1194                 case RC_SINGLE_CLOSE_TAB_BUTTON:
1195                         lexrc >> single_close_tab_button;
1196                         break;
1197                 case RC_SINGLE_INSTANCE:
1198                         lexrc >> single_instance;
1199                         if (run_mode == PREFERRED)
1200                                 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1201                         break;
1202                 case RC_FORWARD_SEARCH_DVI:
1203                         if (lexrc.next(true))
1204                                 forward_search_dvi = lexrc.getString();
1205                         break;
1206                 case RC_FORWARD_SEARCH_PDF:
1207                         if (lexrc.next(true))
1208                                 forward_search_pdf = lexrc.getString();
1209                         break;
1210                 case RC_EXPORT_OVERWRITE:
1211                         if (lexrc.next()) {
1212                                 string const tmp = lexrc.getString();
1213                                 if (tmp == "all" || tmp == "true")
1214                                         export_overwrite = ALL_FILES;
1215                                 else if (tmp == "main")
1216                                         export_overwrite = MAIN_FILE;
1217                                 else {
1218                                         export_overwrite = NO_FILES;
1219                                         if (tmp != "ask" && tmp != "false")
1220                                                 LYXERR0("Unrecognized export_overwrite status \""
1221                                                        << tmp << '"');
1222                                 }
1223                         }
1224                         break;
1225                 case RC_SCROLL_WHEEL_ZOOM:
1226                         if (lexrc.next()) {
1227                                 string const tmp = lexrc.getString();
1228                                 if (tmp == "ctrl")
1229                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1230                                 else if (tmp == "shift")
1231                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1232                                 else if (tmp == "alt")
1233                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1234                                 else {
1235                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1236                                         if (tmp != "off" && tmp != "false")
1237                                                 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1238                                                        << tmp << '"');
1239                                 }
1240                         }
1241                         break;
1242
1243                 case RC_MOUSE_MIDDLEBUTTON_PASTE:
1244                         lexrc >> mouse_middlebutton_paste;
1245                         break;
1246
1247                 case RC_LAST:
1248                         break; // this is just a dummy
1249                 }
1250
1251                 // This is triggered the first time through the loop unless
1252                 // we hit a format tag.
1253                 if (check_format && format != LYXRC_FILEFORMAT)
1254                         return FormatMismatch;
1255         }
1256
1257         /// Update converters data-structures
1258         theConverters().update(theFormats());
1259         theConverters().buildGraph();
1260         theBufferList().invalidateConverterCache();
1261
1262         return ReadOK;
1263 }
1264
1265
1266 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1267 {
1268         ofstream ofs(filename.toFilesystemEncoding().c_str());
1269         if (ofs)
1270                 write(ofs, ignore_system_lyxrc);
1271 }
1272
1273
1274 void LyXRC::print() const
1275 {
1276         if (lyxerr.debugging())
1277                 write(lyxerr, false);
1278         else
1279                 write(cout, false);
1280 }
1281
1282
1283 class SameMover {
1284 public:
1285         typedef pair<string, SpecialisedMover> Data;
1286
1287         SameMover(Data const & comparison)
1288                 : comparison_(comparison) {}
1289
1290         bool operator()(Data const & data) const
1291         {
1292                 return data.first == comparison_.first &&
1293                         data.second.command() == comparison_.second.command();
1294         }
1295
1296 private:
1297         Data comparison_;
1298 };
1299
1300
1301 namespace {
1302
1303         // Escape \ and " so that LyXLex can read the string later
1304         string escapeCommand(string const & str) {
1305                 return subst(subst(str , "\\", "\\\\"),
1306                              "\"", "\\\"");
1307         }
1308
1309 } // namespace
1310
1311
1312 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1313 {
1314         LyXRCTags tag = RC_LAST;
1315
1316         if (!name.empty()) {
1317                 for (int i = 0; i != lyxrcCount; ++i)
1318                         if ("\\" + name == lyxrcTags[i].tag)
1319                                 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1320         }
1321
1322         if (tag == RC_LAST)
1323                 os << "# LyX " << lyx_version
1324                    << " generated this file. If you want to make your own\n"
1325                    << "# modifications you should do them from inside LyX and save.\n\n"
1326                    << "Format " << LYXRC_FILEFORMAT << "\n\n";
1327
1328         // Why the switch you might ask. It is a trick to ensure that all
1329         // the elements in the LyXRCTags enum are handled. As you can see
1330         // there are no breaks at all. So it is just a huge fall-through.
1331         // The nice thing is that we will get a warning from the compiler
1332         // if we forget an element.
1333         switch (tag) {
1334         case RC_LAST:
1335         case RC_INPUT:
1336                 // input/include files are not done here
1337         case RC_LYXRCFORMAT:
1338         case RC_BINDFILE:
1339                 if (ignore_system_lyxrc ||
1340                     bind_file != system_lyxrc.bind_file) {
1341                         string const path = os::external_path(bind_file);
1342                         os << "\\bind_file \"" << path << "\"\n";
1343                 }
1344                 if (tag != RC_LAST)
1345                         break;
1346                 // fall through
1347         case RC_DEFFILE:
1348                 if (ignore_system_lyxrc ||
1349                     def_file != system_lyxrc.def_file) {
1350                         string const path = os::external_path(def_file);
1351                         os << "\\def_file \"" << path << "\"\n";
1352                 }
1353                 if (tag != RC_LAST)
1354                         break;
1355
1356                 //
1357                 // Misc Section
1358                 //
1359                 os << "\n#\n"
1360                    << "# MISC SECTION ######################################\n"
1361                    << "#\n\n";
1362                 // bind files are not done here.
1363                 // fall through
1364         case RC_PATH_PREFIX:
1365                 if (ignore_system_lyxrc ||
1366                     path_prefix != system_lyxrc.path_prefix) {
1367                         os << "\\path_prefix \"" << path_prefix << "\"\n";
1368                 }
1369                 if (tag != RC_LAST)
1370                         break;
1371                 // fall through
1372         case RC_UIFILE:
1373                 if (ignore_system_lyxrc ||
1374                     ui_file != system_lyxrc.ui_file) {
1375                         string const path = os::external_path(ui_file);
1376                         os << "\\ui_file \"" << path << "\"\n";
1377                 }
1378                 if (tag != RC_LAST)
1379                         break;
1380                 // fall through
1381         case RC_AUTOREGIONDELETE:
1382                 if (ignore_system_lyxrc ||
1383                     auto_region_delete != system_lyxrc.auto_region_delete) {
1384                         os << "# Set to false to inhibit automatic replacement of\n"
1385                            << "# the current selection.\n"
1386                            << "\\auto_region_delete " << convert<string>(auto_region_delete)
1387                            << '\n';
1388                 }
1389                 if (tag != RC_LAST)
1390                         break;
1391                 // fall through
1392         case RC_AUTORESET_OPTIONS:
1393                 if (ignore_system_lyxrc ||
1394                     auto_reset_options != system_lyxrc.auto_reset_options) {
1395                         os << "# Set to false to inhibit automatic reset of\n"
1396                            << "# the class options to defaults on class change.\n"
1397                            << "\\auto_reset_options "
1398                            << convert<string>(auto_reset_options)
1399                            << '\n';
1400                 }
1401                 if (tag != RC_LAST)
1402                         break;
1403                 // fall through
1404         case RC_AUTOSAVE:
1405                 if (ignore_system_lyxrc ||
1406                     autosave != system_lyxrc.autosave) {
1407                         os << "# The time interval between auto-saves in seconds.\n"
1408                            << "\\autosave " << autosave << '\n';
1409                 }
1410                 if (tag != RC_LAST)
1411                         break;
1412                 // fall through
1413         case RC_DISPLAY_GRAPHICS:
1414                 if (ignore_system_lyxrc ||
1415                     display_graphics != system_lyxrc.display_graphics) {
1416                         os << "# Display graphics within LyX\n"
1417                            << "# true|false\n"
1418                            << "\\display_graphics "
1419                            << (display_graphics ? "true" : "false")
1420                            << '\n';
1421                 }
1422                 if (tag != RC_LAST)
1423                         break;
1424                 // fall through
1425         case RC_SORT_LAYOUTS:
1426                 if (ignore_system_lyxrc ||
1427                     sort_layouts != system_lyxrc.sort_layouts) {
1428                         os << "# Sort layouts alphabetically.\n"
1429                            << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1430                 }
1431                 if (tag != RC_LAST)
1432                         break;
1433                 // fall through
1434         case RC_GROUP_LAYOUTS:
1435                 if (ignore_system_lyxrc ||
1436                     group_layouts != system_lyxrc.group_layouts) {
1437                         os << "# Group layouts by their category.\n"
1438                            << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1439                 }
1440                 if (tag != RC_LAST)
1441                         break;
1442                 // fall through
1443         case RC_VIEWDVI_PAPEROPTION:
1444                 if (ignore_system_lyxrc ||
1445                     view_dvi_paper_option
1446                     != system_lyxrc.view_dvi_paper_option) {
1447                         os << "# Options used to specify paper size to the\n"
1448                            << "# view_dvi_command (e.g. -paper)\n"
1449                            << "\\view_dvi_paper_option \""
1450                            << view_dvi_paper_option << "\"\n";
1451                 }
1452                 if (tag != RC_LAST)
1453                         break;
1454                 // fall through
1455         case RC_CHKTEX_COMMAND:
1456                 if (ignore_system_lyxrc ||
1457                     chktex_command != system_lyxrc.chktex_command) {
1458                         os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1459                 }
1460                 if (tag != RC_LAST)
1461                         break;
1462                 // fall through
1463         case RC_BIBTEX_ALTERNATIVES: {
1464                 CommandSet::const_iterator it = bibtex_alternatives.begin();
1465                 CommandSet::const_iterator end = bibtex_alternatives.end();
1466                 for ( ; it != end; ++it) {
1467                         if (ignore_system_lyxrc
1468                             || !system_lyxrc.bibtex_alternatives.count(*it))
1469                                 os << "\\bibtex_alternatives \""
1470                                    << *it << "\"\n";
1471                 }
1472                 if (tag != RC_LAST)
1473                         break;
1474         }
1475         // fall through
1476         case RC_BIBTEX_COMMAND:
1477                 if (ignore_system_lyxrc ||
1478                     bibtex_command != system_lyxrc.bibtex_command) {
1479                         os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1480                 }
1481                 if (tag != RC_LAST)
1482                         break;
1483                 // fall through
1484         case RC_JBIBTEX_COMMAND:
1485                 if (ignore_system_lyxrc ||
1486                     jbibtex_command != system_lyxrc.jbibtex_command) {
1487                         os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1488                 }
1489                 if (tag != RC_LAST)
1490                         break;
1491                 // fall through
1492         case RC_JBIBTEX_ALTERNATIVES: {
1493                 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1494                 CommandSet::const_iterator end = jbibtex_alternatives.end();
1495                 for ( ; it != end; ++it) {
1496                         if (ignore_system_lyxrc
1497                             || !system_lyxrc.jbibtex_alternatives.count(*it))
1498                                 os << "\\jbibtex_alternatives \""
1499                                    << *it << "\"\n";
1500                 }
1501                 if (tag != RC_LAST)
1502                         break;
1503         }
1504         // fall through
1505         case RC_INDEX_ALTERNATIVES: {
1506                 CommandSet::const_iterator it = index_alternatives.begin();
1507                 CommandSet::const_iterator end = index_alternatives.end();
1508                 for ( ; it != end; ++it) {
1509                         if (ignore_system_lyxrc
1510                             || !system_lyxrc.index_alternatives.count(*it))
1511                                 os << "\\index_alternatives \""
1512                                    << *it << "\"\n";
1513                 }
1514                 if (tag != RC_LAST)
1515                         break;
1516         }
1517         // fall through
1518         case RC_INDEX_COMMAND:
1519                 if (ignore_system_lyxrc ||
1520                     index_command != system_lyxrc.index_command) {
1521                         os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1522                 }
1523                 if (tag != RC_LAST)
1524                         break;
1525                 // fall through
1526         case RC_JINDEX_COMMAND:
1527                 if (ignore_system_lyxrc ||
1528                     jindex_command != system_lyxrc.jindex_command) {
1529                         os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1530                 }
1531                 if (tag != RC_LAST)
1532                         break;
1533                 // fall through
1534         case RC_SPLITINDEX_COMMAND:
1535                 if (ignore_system_lyxrc ||
1536                     splitindex_command != system_lyxrc.splitindex_command) {
1537                         os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1538                 }
1539                 if (tag != RC_LAST)
1540                         break;
1541                 // fall through
1542         case RC_NOMENCL_COMMAND:
1543                 if (ignore_system_lyxrc ||
1544                     nomencl_command != system_lyxrc.nomencl_command) {
1545                         os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1546                 }
1547                 if (tag != RC_LAST)
1548                         break;
1549                 // fall through
1550         case RC_PYGMENTIZE_COMMAND:
1551                 if (ignore_system_lyxrc ||
1552                     pygmentize_command != system_lyxrc.pygmentize_command) {
1553                         os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1554                 }
1555                 if (tag != RC_LAST)
1556                         break;
1557                 // fall through
1558         case RC_TEX_EXPECTS_WINDOWS_PATHS:
1559                 // Don't write this setting to the preferences file,
1560                 // but allow temporary changes (bug 7557).
1561                 if (ignore_system_lyxrc) {
1562                         os << "\\tex_expects_windows_paths "
1563                            << convert<string>(windows_style_tex_paths) << '\n';
1564                 }
1565                 if (tag != RC_LAST)
1566                         break;
1567                 // fall through
1568         case RC_TEX_ALLOWS_SPACES:
1569                 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1570                         os << "\\tex_allows_spaces "
1571                            << convert<string>(tex_allows_spaces) << '\n';
1572                 }
1573                 if (tag != RC_LAST)
1574                         break;
1575                 // fall through
1576         case RC_KBMAP:
1577                 if (ignore_system_lyxrc ||
1578                     use_kbmap != system_lyxrc.use_kbmap) {
1579                         os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1580                 }
1581                 if (tag != RC_LAST)
1582                         break;
1583                 // fall through
1584         case RC_KBMAP_PRIMARY:
1585                 if (ignore_system_lyxrc ||
1586                     primary_kbmap != system_lyxrc.primary_kbmap) {
1587                         string const path = os::external_path(primary_kbmap);
1588                         os << "\\kbmap_primary \"" << path << "\"\n";
1589                 }
1590                 if (tag != RC_LAST)
1591                         break;
1592                 // fall through
1593         case RC_KBMAP_SECONDARY:
1594                 if (ignore_system_lyxrc ||
1595                     secondary_kbmap != system_lyxrc.secondary_kbmap) {
1596                         string const path = os::external_path(secondary_kbmap);
1597                         os << "\\kbmap_secondary \"" << path << "\"\n";
1598                 }
1599                 if (tag != RC_LAST)
1600                         break;
1601                 // fall through
1602         case RC_SERVERPIPE:
1603                 if (ignore_system_lyxrc ||
1604                     lyxpipes != system_lyxrc.lyxpipes) {
1605                         string const path = os::external_path(lyxpipes);
1606                         os << "\\serverpipe \"" << path << "\"\n";
1607                 }
1608                 if (tag != RC_LAST)
1609                         break;
1610                 // fall through
1611         case RC_DATE_INSERT_FORMAT:
1612                 if (ignore_system_lyxrc ||
1613                     date_insert_format != system_lyxrc.date_insert_format) {
1614                         os << "\\date_insert_format \"" << date_insert_format
1615                            << "\"\n";
1616                 }
1617                 if (tag != RC_LAST)
1618                         break;
1619                 // fall through
1620         case RC_USER_NAME:
1621                 os << "\\user_name \"" << user_name << "\"\n";
1622                 if (tag != RC_LAST)
1623                         break;
1624                 // fall through
1625         case RC_USER_EMAIL:
1626                 os << "\\user_email \"" << user_email << "\"\n";
1627                 if (tag != RC_LAST)
1628                         break;
1629                 // fall through
1630         case RC_SHOW_BANNER:
1631                 if (ignore_system_lyxrc ||
1632                     show_banner != system_lyxrc.show_banner) {
1633                         os << "\\show_banner " << convert<string>(show_banner) << '\n';
1634                 }
1635                 if (tag != RC_LAST)
1636                         break;
1637                 // fall through
1638         case RC_PREVIEW:
1639                 if (ignore_system_lyxrc ||
1640                     preview != system_lyxrc.preview) {
1641                         string status;
1642                         switch (preview) {
1643                         case PREVIEW_ON:
1644                                 status = "on";
1645                                 break;
1646                         case PREVIEW_NO_MATH:
1647                                 status = "no_math";
1648                                 break;
1649                         case PREVIEW_OFF:
1650                                 status = "off";
1651                                 break;
1652                         }
1653                         os << "\\preview " << status << '\n';
1654                 }
1655                 if (tag != RC_LAST)
1656                         break;
1657                 // fall through
1658         case RC_PREVIEW_HASHED_LABELS:
1659                 if (ignore_system_lyxrc ||
1660                     preview_hashed_labels !=
1661                     system_lyxrc.preview_hashed_labels) {
1662                         os << "\\preview_hashed_labels "
1663                            << convert<string>(preview_hashed_labels) << '\n';
1664                 }
1665                 if (tag != RC_LAST)
1666                         break;
1667                 // fall through
1668         case RC_PREVIEW_SCALE_FACTOR:
1669                 if (ignore_system_lyxrc ||
1670                     preview_scale_factor != system_lyxrc.preview_scale_factor) {
1671                         os << "\\preview_scale_factor "
1672                            << preview_scale_factor << '\n';
1673                 }
1674                 if (tag != RC_LAST)
1675                         break;
1676                 // fall through
1677         case RC_USE_CONVERTER_CACHE:
1678                 if (ignore_system_lyxrc ||
1679                     use_converter_cache != system_lyxrc.use_converter_cache) {
1680                         os << "\\use_converter_cache "
1681                            << convert<string>(use_converter_cache) << '\n';
1682                 }
1683                 if (tag != RC_LAST)
1684                         break;
1685                 // fall through
1686         case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1687                 if (ignore_system_lyxrc ||
1688                     use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1689                         os << "\\use_converter_needauth_forbidden "
1690                            << convert<string>(use_converter_needauth_forbidden) << '\n';
1691                 }
1692                 if (tag != RC_LAST)
1693                         break;
1694                 // fall through
1695         case RC_USE_CONVERTER_NEEDAUTH:
1696                 if (ignore_system_lyxrc ||
1697                     use_converter_needauth != system_lyxrc.use_converter_needauth) {
1698                         os << "\\use_converter_needauth "
1699                            << convert<string>(use_converter_needauth) << '\n';
1700                 }
1701                 if (tag != RC_LAST)
1702                         break;
1703                 // fall through
1704         case RC_CONVERTER_CACHE_MAXAGE:
1705                 if (ignore_system_lyxrc ||
1706                     converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1707                         os << "\\converter_cache_maxage "
1708                            << converter_cache_maxage << '\n';
1709                 }
1710                 if (tag != RC_LAST)
1711                         break;
1712
1713                 os << "\n#\n"
1714                    << "# SCREEN & FONTS SECTION ############################\n"
1715                    << "#\n\n";
1716                 // fall through
1717         case RC_ICON_SET:
1718                 if (ignore_system_lyxrc ||
1719                     icon_set != system_lyxrc.icon_set) {
1720                         os << "\\icon_set \"" << icon_set
1721                            << "\"\n";
1722                 }
1723                 if (tag != RC_LAST)
1724                         break;
1725                 // fall through
1726         case RC_USE_SYSTEM_THEME_ICONS:
1727                 if (ignore_system_lyxrc ||
1728                           use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1729                         os << "\\use_system_theme_icons "
1730                                 << convert<string>(use_system_theme_icons)
1731                                 << "\n";
1732                 }
1733                 if (tag != RC_LAST)
1734                         break;
1735                 // fall through
1736         case RC_SCREEN_DPI:
1737                 if (ignore_system_lyxrc ||
1738                     dpi != system_lyxrc.dpi) {
1739                         os << "\\screen_dpi " << dpi << '\n';
1740                 }
1741                 if (tag != RC_LAST)
1742                         break;
1743                 // fall through
1744         case RC_SCREEN_ZOOM:
1745                 if (ignore_system_lyxrc ||
1746                     defaultZoom != system_lyxrc.defaultZoom) {
1747                         os << "\\screen_zoom " << defaultZoom << '\n';
1748                 }
1749                 if (tag != RC_LAST)
1750                         break;
1751                 // fall through
1752         case RC_GEOMETRY_SESSION:
1753                 if (ignore_system_lyxrc ||
1754                     allow_geometry_session != system_lyxrc.allow_geometry_session) {
1755                         os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1756                            << '\n';
1757                 }
1758                 if (tag != RC_LAST)
1759                         break;
1760                 // fall through
1761         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1762                 if (ignore_system_lyxrc ||
1763                     cursor_follows_scrollbar
1764                     != system_lyxrc.cursor_follows_scrollbar) {
1765                         os << "\\cursor_follows_scrollbar "
1766                            << convert<string>(cursor_follows_scrollbar) << '\n';
1767                 }
1768                 if (tag != RC_LAST)
1769                         break;
1770                 // fall through
1771         case RC_CURSOR_WIDTH:
1772                 if (ignore_system_lyxrc ||
1773                         cursor_width
1774                         != system_lyxrc.cursor_width) {
1775                         os << "\\cursor_width "
1776                         << cursor_width << '\n';
1777                 }
1778                 if (tag != RC_LAST)
1779                         break;
1780                 // fall through
1781         case RC_SCROLL_BELOW_DOCUMENT:
1782                 if (ignore_system_lyxrc ||
1783                     scroll_below_document
1784                     != system_lyxrc.scroll_below_document) {
1785                         os << "\\scroll_below_document "
1786                            << convert<string>(scroll_below_document) << '\n';
1787                 }
1788                 if (tag != RC_LAST)
1789                         break;
1790                 // fall through
1791         case RC_PARAGRAPH_MARKERS:
1792                 if (ignore_system_lyxrc ||
1793                         paragraph_markers
1794                     != system_lyxrc.paragraph_markers) {
1795                         os << "\\paragraph_markers "
1796                            << convert<string>(paragraph_markers) << '\n';
1797                 }
1798                 if (tag != RC_LAST)
1799                         break;
1800                 // fall through
1801         case RC_MAC_DONTSWAP_CTRL_META:
1802                 if (ignore_system_lyxrc ||
1803                     mac_dontswap_ctrl_meta
1804                     != system_lyxrc.mac_dontswap_ctrl_meta) {
1805                         os << "\\mac_dontswap_ctrl_meta "
1806                            << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1807                 }
1808                 if (tag != RC_LAST)
1809                         break;
1810                 // fall through
1811         case RC_MAC_LIKE_CURSOR_MOVEMENT:
1812                 if (ignore_system_lyxrc ||
1813                     mac_like_cursor_movement
1814                     != system_lyxrc.mac_like_cursor_movement) {
1815                         os << "\\mac_like_cursor_movement "
1816                            << convert<string>(mac_like_cursor_movement) << '\n';
1817                 }
1818                 if (tag != RC_LAST)
1819                         break;
1820                 // fall through
1821         case RC_MACRO_EDIT_STYLE:
1822                 if (ignore_system_lyxrc ||
1823                     macro_edit_style
1824                     != system_lyxrc.macro_edit_style) {
1825                         os << "\\macro_edit_style ";
1826                         switch (macro_edit_style) {
1827                         case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1828                         case MACRO_EDIT_INLINE: os << "1\n"; break;
1829                         case MACRO_EDIT_LIST: os << "2\n"; break;
1830                         }
1831                 }
1832                 if (tag != RC_LAST)
1833                         break;
1834                 // fall through
1835         case RC_DIALOGS_ICONIFY_WITH_MAIN:
1836                 if (ignore_system_lyxrc ||
1837                     dialogs_iconify_with_main
1838                    != system_lyxrc.dialogs_iconify_with_main) {
1839                         os << "\\dialogs_iconify_with_main "
1840                           <<  convert<string>(dialogs_iconify_with_main) << '\n';
1841                 }
1842                 if (tag != RC_LAST)
1843                         break;
1844                 // fall through
1845         case RC_SCREEN_FONT_ROMAN:
1846                 if (ignore_system_lyxrc ||
1847                     roman_font_name != system_lyxrc.roman_font_name) {
1848                         os << "\\screen_font_roman \"" << roman_font_name
1849                            << "\"\n";
1850                 }
1851                 if (tag != RC_LAST)
1852                         break;
1853                 // fall through
1854         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1855                 if (ignore_system_lyxrc ||
1856                     roman_font_foundry != system_lyxrc.roman_font_foundry) {
1857                         os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1858                            << "\"\n";
1859                 }
1860                 if (tag != RC_LAST)
1861                         break;
1862                 // fall through
1863         case RC_SCREEN_FONT_SANS:
1864                 if (ignore_system_lyxrc ||
1865                     sans_font_name != system_lyxrc.sans_font_name) {
1866                         os << "\\screen_font_sans \"" << sans_font_name
1867                            << "\"\n";
1868                 }
1869                 if (tag != RC_LAST)
1870                         break;
1871                 // fall through
1872         case RC_SCREEN_FONT_SANS_FOUNDRY:
1873                 if (ignore_system_lyxrc ||
1874                     sans_font_foundry != system_lyxrc.sans_font_foundry) {
1875                         os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1876                            << "\"\n";
1877                 }
1878                 if (tag != RC_LAST)
1879                         break;
1880                 // fall through
1881         case RC_SCREEN_FONT_TYPEWRITER:
1882                 if (ignore_system_lyxrc ||
1883                     typewriter_font_name != system_lyxrc.typewriter_font_name) {
1884                         os << "\\screen_font_typewriter \""
1885                            << typewriter_font_name << "\"\n";
1886                 }
1887                 if (tag != RC_LAST)
1888                         break;
1889                 // fall through
1890         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1891                 if (ignore_system_lyxrc ||
1892                     typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1893                         os << "\\screen_font_typewriter_foundry \""
1894                            << typewriter_font_foundry << "\"\n";
1895                 }
1896                 if (tag != RC_LAST)
1897                         break;
1898                 // fall through
1899         case RC_SCREEN_FONT_SCALABLE:
1900                 if (ignore_system_lyxrc ||
1901                     use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1902                         os << "\\screen_font_scalable "
1903                            << convert<string>(use_scalable_fonts)
1904                            << '\n';
1905                 }
1906                 if (tag != RC_LAST)
1907                         break;
1908                 // fall through
1909         case RC_SCREEN_FONT_SIZES:
1910                 if (ignore_system_lyxrc ||
1911                     font_sizes[FONT_SIZE_TINY]
1912                     != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1913                     font_sizes[FONT_SIZE_SCRIPT]
1914                     != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1915                     font_sizes[FONT_SIZE_FOOTNOTE]
1916                     != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1917                     font_sizes[FONT_SIZE_SMALL]
1918                     != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1919                     font_sizes[FONT_SIZE_NORMAL]
1920                     != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1921                     font_sizes[FONT_SIZE_LARGE]
1922                     != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1923                     font_sizes[FONT_SIZE_LARGER]
1924                     != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1925                     font_sizes[FONT_SIZE_LARGEST]
1926                     != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1927                     font_sizes[FONT_SIZE_HUGE]
1928                     != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1929                     font_sizes[FONT_SIZE_HUGER]
1930                     != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1931                         streamsize old_prec = os.precision();
1932                         os.setf(ios::fixed);
1933                         os.precision(2);
1934                         os << "\\screen_font_sizes"
1935                            << ' ' << font_sizes[FONT_SIZE_TINY]
1936                            << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1937                            << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1938                            << ' ' << font_sizes[FONT_SIZE_SMALL]
1939                            << ' ' << font_sizes[FONT_SIZE_NORMAL]
1940                            << ' ' << font_sizes[FONT_SIZE_LARGE]
1941                            << ' ' << font_sizes[FONT_SIZE_LARGER]
1942                            << ' ' << font_sizes[FONT_SIZE_LARGEST]
1943                            << ' ' << font_sizes[FONT_SIZE_HUGE]
1944                            << ' ' << font_sizes[FONT_SIZE_HUGER]
1945                            << '\n';
1946                         os.precision(old_prec);
1947                         os.unsetf(ios::fixed);
1948                 }
1949                 if (tag != RC_LAST)
1950                         break;
1951                 // fall through
1952         case RC_FULL_SCREEN_LIMIT:
1953                 if (ignore_system_lyxrc ||
1954                     full_screen_limit != system_lyxrc.full_screen_limit) {
1955                         os << "\\fullscreen_limit "
1956                            << convert<string>(full_screen_limit)
1957                            << '\n';
1958                 }
1959                 if (tag != RC_LAST)
1960                         break;
1961                 // fall through
1962         case RC_FULL_SCREEN_TOOLBARS:
1963                 if (ignore_system_lyxrc ||
1964                     full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1965                         os << "\\fullscreen_toolbars "
1966                            << convert<string>(full_screen_toolbars)
1967                            << '\n';
1968                 }
1969                 if (tag != RC_LAST)
1970                         break;
1971                 // fall through
1972         case RC_FULL_SCREEN_SCROLLBAR:
1973                 if (ignore_system_lyxrc ||
1974                     full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1975                         os << "\\fullscreen_scrollbar "
1976                            << convert<string>(full_screen_scrollbar)
1977                            << '\n';
1978                 }
1979                 if (tag != RC_LAST)
1980                         break;
1981                 // fall through
1982         case RC_FULL_SCREEN_STATUSBAR:
1983                 if (ignore_system_lyxrc ||
1984                     full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1985                         os << "\\fullscreen_statusbar "
1986                            << convert<string>(full_screen_statusbar)
1987                            << '\n';
1988                 }
1989                 if (tag != RC_LAST)
1990                         break;
1991                 // fall through
1992         case RC_FULL_SCREEN_TABBAR:
1993                 if (ignore_system_lyxrc ||
1994                     full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1995                         os << "\\fullscreen_tabbar "
1996                            << convert<string>(full_screen_tabbar)
1997                            << '\n';
1998                 }
1999                 if (tag != RC_LAST)
2000                         break;
2001                 // fall through
2002         case RC_FULL_SCREEN_MENUBAR:
2003                 if (ignore_system_lyxrc ||
2004                     full_screen_menubar != system_lyxrc.full_screen_menubar) {
2005                         os << "\\fullscreen_menubar "
2006                            << convert<string>(full_screen_menubar)
2007                            << '\n';
2008                 }
2009                 if (tag != RC_LAST)
2010                         break;
2011                 // fall through
2012         case RC_FULL_SCREEN_WIDTH:
2013                 if (ignore_system_lyxrc ||
2014                     full_screen_width != system_lyxrc.full_screen_width) {
2015                         os << "\\fullscreen_width "
2016                            << convert<string>(full_screen_width)
2017                            << '\n';
2018                 }
2019                 if (tag != RC_LAST)
2020                         break;
2021                 // fall through
2022         case RC_OPEN_BUFFERS_IN_TABS:
2023                 if (ignore_system_lyxrc ||
2024                     open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
2025                         os << "\\open_buffers_in_tabs "
2026                            << convert<string>(open_buffers_in_tabs)
2027                            << '\n';
2028                 }
2029                 if (tag != RC_LAST)
2030                         break;
2031                 // fall through
2032         case RC_SINGLE_CLOSE_TAB_BUTTON:
2033                 if (ignore_system_lyxrc ||
2034                     single_close_tab_button != system_lyxrc.single_close_tab_button) {
2035                         os << "\\single_close_tab_button "
2036                            << convert<string>(single_close_tab_button)
2037                            << '\n';
2038                 }
2039                 if (tag != RC_LAST)
2040                         break;
2041                 // fall through
2042         case RC_SINGLE_INSTANCE:
2043                 if (ignore_system_lyxrc ||
2044                     single_instance != system_lyxrc.single_instance) {
2045                         os << "\\single_instance "
2046                            << convert<string>(single_instance)
2047                            << '\n';
2048                 }
2049                 if (tag != RC_LAST)
2050                         break;
2051                 // fall through
2052         case RC_FORWARD_SEARCH_DVI:
2053                 if (ignore_system_lyxrc ||
2054                     forward_search_dvi != system_lyxrc.forward_search_dvi) {
2055                         os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2056                 }
2057                 if (tag != RC_LAST)
2058                         break;
2059                 // fall through
2060         case RC_FORWARD_SEARCH_PDF:
2061                 if (ignore_system_lyxrc ||
2062                     forward_search_pdf != system_lyxrc.forward_search_pdf) {
2063                         os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2064                 }
2065                 if (tag != RC_LAST)
2066                         break;
2067
2068         os << "\n#\n"
2069                         << "# COLOR SECTION ###################################\n"
2070                         << "#\n\n";
2071
2072         // fall through
2073         case RC_SET_COLOR:
2074                 for (int i = 0; i < Color_ignore; ++i) {
2075                         ColorCode lc = static_cast<ColorCode>(i);
2076                         string const col = lcolor.getX11Name(lc);
2077                         if (ignore_system_lyxrc
2078                             || col != system_lcolor.getX11Name(lc)) {
2079                                 os << "\\set_color \""
2080                                    << lcolor.getLyXName(lc) << "\" \""
2081                                    << col << "\"\n";
2082                         }
2083                 }
2084                 if (tag != RC_LAST)
2085                         break;
2086
2087         os << "\n#\n"
2088                  << "# PRINTER SECTION ###################################\n"
2089                  << "#\n\n";
2090
2091         // fall through
2092         case RC_PRINTLANDSCAPEFLAG:
2093                 if (ignore_system_lyxrc ||
2094                     print_landscape_flag != system_lyxrc.print_landscape_flag) {
2095                         os << "\\print_landscape_flag \"" << print_landscape_flag
2096                            << "\"\n";
2097                 }
2098                 if (tag != RC_LAST)
2099                         break;
2100                 // fall through
2101         case RC_PRINTPAPERFLAG:
2102                 if (ignore_system_lyxrc ||
2103                     print_paper_flag != system_lyxrc.print_paper_flag) {
2104                         os << "\\print_paper_flag \"" << print_paper_flag
2105                            << "\"\n";
2106                 }
2107                 if (tag != RC_LAST)
2108                         break;
2109                 // fall through
2110         case RC_PRINTPAPERDIMENSIONFLAG:
2111                 if (ignore_system_lyxrc ||
2112                     print_paper_dimension_flag
2113                     != system_lyxrc.print_paper_dimension_flag) {
2114                         os << "\\print_paper_dimension_flag \""
2115                            << print_paper_dimension_flag << "\"\n";
2116                 }
2117                 if (tag != RC_LAST)
2118                         break;
2119
2120         os << "\n#\n"
2121                  << "# TEX SECTION #######################################\n"
2122                  << "#\n\n";
2123
2124         // fall through
2125         case RC_TEXINPUTS_PREFIX:
2126                 if (ignore_system_lyxrc ||
2127                     texinputs_prefix != system_lyxrc.texinputs_prefix) {
2128                         os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2129                 }
2130                 if (tag != RC_LAST)
2131                         break;
2132                 // fall through
2133         case RC_FONT_ENCODING:
2134                 if (ignore_system_lyxrc ||
2135                     fontenc != system_lyxrc.fontenc) {
2136                         os << "\\font_encoding \"" << fontenc << "\"\n";
2137                 }
2138                 if (tag != RC_LAST)
2139                         break;
2140
2141                 os << "\n#\n"
2142                    << "# FILE SECTION ######################################\n"
2143                    << "#\n\n";
2144
2145         // fall through
2146         case RC_DOCUMENTPATH:
2147                 if (ignore_system_lyxrc ||
2148                     document_path != system_lyxrc.document_path) {
2149                         string const path = os::external_path(document_path);
2150                         os << "\\document_path \"" << path << "\"\n";
2151                 }
2152                 if (tag != RC_LAST)
2153                         break;
2154                 // fall through
2155         case RC_USELASTFILEPOS:
2156                 if (ignore_system_lyxrc ||
2157                     use_lastfilepos != system_lyxrc.use_lastfilepos) {
2158                         os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2159                            << '\n';
2160                 }
2161                 if (tag != RC_LAST)
2162                         break;
2163                 // fall through
2164         case RC_LOADSESSION:
2165                 if (ignore_system_lyxrc ||
2166                     load_session != system_lyxrc.load_session) {
2167                         os << "\\load_session " << convert<string>(load_session)
2168                            << "\n";
2169                 }
2170                 if (tag != RC_LAST)
2171                         break;
2172                 // fall through
2173         case RC_MOUSE_WHEEL_SPEED:
2174                 if (ignore_system_lyxrc ||
2175                     mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2176                         os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2177                 }
2178                 if (tag != RC_LAST)
2179                         break;
2180                 // fall through
2181         case RC_MOUSE_MIDDLEBUTTON_PASTE:
2182                 if (ignore_system_lyxrc ||
2183                     mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2184                         os << "\\mouse_middlebutton_paste "
2185                            << convert<string>(mouse_middlebutton_paste) << '\n';
2186                 }
2187                 if (tag != RC_LAST)
2188                         break;
2189                 // fall through
2190         case RC_COMPLETION_INLINE_DELAY:
2191                 if (ignore_system_lyxrc ||
2192                     completion_inline_delay != system_lyxrc.completion_inline_delay) {
2193                         os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2194                 }
2195                 if (tag != RC_LAST)
2196                         break;
2197                 // fall through
2198         case RC_COMPLETION_INLINE_MATH:
2199                 if (ignore_system_lyxrc ||
2200                     completion_inline_math != system_lyxrc.completion_inline_math) {
2201                         os << "\\completion_inline_math "
2202                                 << convert<string>(completion_inline_math) << '\n';
2203                 }
2204                 if (tag != RC_LAST)
2205                         break;
2206                 // fall through
2207         case RC_COMPLETION_INLINE_TEXT:
2208                 if (ignore_system_lyxrc ||
2209                     completion_inline_text != system_lyxrc.completion_inline_text) {
2210                         os << "\\completion_inline_text "
2211                                 << convert<string>(completion_inline_text) << '\n';
2212                 }
2213                 if (tag != RC_LAST)
2214                         break;
2215                 // fall through
2216         case RC_COMPLETION_INLINE_DOTS:
2217                 if (ignore_system_lyxrc ||
2218                     completion_inline_dots != system_lyxrc.completion_inline_dots) {
2219                         os << "\\completion_inline_dots "
2220                                 << convert<string>(completion_inline_dots) << '\n';
2221                 }
2222                 if (tag != RC_LAST)
2223                         break;
2224                 // fall through
2225         case RC_AUTOCORRECTION_MATH:
2226                 if (ignore_system_lyxrc ||
2227                     autocorrection_math != system_lyxrc.autocorrection_math) {
2228                         os << "\\autocorrection_math "
2229                                 << convert<string>(autocorrection_math) << '\n';
2230                 }
2231                 if (tag != RC_LAST)
2232                         break;
2233                 // fall through
2234         case RC_COMPLETION_POPUP_DELAY:
2235                 if (ignore_system_lyxrc ||
2236                     completion_popup_delay != system_lyxrc.completion_popup_delay) {
2237                         os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2238                 }
2239                 if (tag != RC_LAST)
2240                         break;
2241                 // fall through
2242         case RC_COMPLETION_POPUP_MATH:
2243                 if (ignore_system_lyxrc ||
2244                     completion_popup_math != system_lyxrc.completion_popup_math) {
2245                         os << "\\completion_popup_math "
2246                                 << convert<string>(completion_popup_math) << '\n';
2247                 }
2248                 if (tag != RC_LAST)
2249                         break;
2250                 // fall through
2251         case RC_COMPLETION_POPUP_TEXT:
2252                 if (ignore_system_lyxrc ||
2253                     completion_popup_text != system_lyxrc.completion_popup_text) {
2254                         os << "\\completion_popup_text "
2255                                 << convert<string>(completion_popup_text) << '\n';
2256                 }
2257                 if (tag != RC_LAST)
2258                         break;
2259                 // fall through
2260         case RC_COMPLETION_CURSOR_TEXT:
2261                 if (ignore_system_lyxrc ||
2262                     completion_cursor_text != system_lyxrc.completion_cursor_text) {
2263                         os << "\\completion_cursor_text "
2264                            << convert<string>(completion_cursor_text) << '\n';
2265                 }
2266                 if (tag != RC_LAST)
2267                         break;
2268                 // fall through
2269         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2270                 if (ignore_system_lyxrc ||
2271                     completion_popup_after_complete
2272                     != system_lyxrc.completion_popup_after_complete) {
2273                         os << "\\completion_popup_after_complete "
2274                                 << convert<string>(completion_popup_after_complete) << '\n';
2275                 }
2276                 if (tag != RC_LAST)
2277                         break;
2278                 // fall through
2279         case RC_COMPLETION_MINLENGTH:
2280                 if (ignore_system_lyxrc ||
2281                         completion_minlength != system_lyxrc.completion_minlength) {
2282                         os << "\\completion_minlength " << convert<string>(completion_minlength)
2283                         << '\n';
2284                 }
2285                 if (tag != RC_LAST)
2286                         break;
2287                 // fall through
2288         case RC_NUMLASTFILES:
2289                 if (ignore_system_lyxrc ||
2290                     num_lastfiles != system_lyxrc.num_lastfiles) {
2291                         os << "\\num_lastfiles " << num_lastfiles << '\n';
2292                 }
2293                 if (tag != RC_LAST)
2294                         break;
2295                 // fall through
2296         case RC_CHECKLASTFILES:
2297                 if (ignore_system_lyxrc ||
2298                     check_lastfiles != system_lyxrc.check_lastfiles) {
2299                         os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2300                            << '\n';
2301                 }
2302                 if (tag != RC_LAST)
2303                         break;
2304                 // fall through
2305         case RC_EXAMPLEPATH:
2306                 if (ignore_system_lyxrc ||
2307                     example_path != system_lyxrc.example_path) {
2308                         string const path = os::external_path(example_path);
2309                         os << "\\example_path \"" << path << "\"\n";
2310                 }
2311                 if (tag != RC_LAST)
2312                         break;
2313                 // fall through
2314         case RC_TEMPLATEPATH:
2315                 if (ignore_system_lyxrc ||
2316                     template_path != system_lyxrc.template_path) {
2317                         string const path = os::external_path(template_path);
2318                         os << "\\template_path \"" << path << "\"\n";
2319                 }
2320                 if (tag != RC_LAST)
2321                         break;
2322                 // fall through
2323         case RC_TEMPDIRPATH:
2324                 if (ignore_system_lyxrc ||
2325                     tempdir_path != system_lyxrc.tempdir_path) {
2326                         string const path = os::external_path(tempdir_path);
2327                         os << "\\tempdir_path \"" << path << "\"\n";
2328                 }
2329                 if (tag != RC_LAST)
2330                         break;
2331                 // fall through
2332         case RC_THESAURUSDIRPATH:
2333                 if (ignore_system_lyxrc ||
2334                     thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2335                         string const path = os::external_path(thesaurusdir_path);
2336                         os << "\\thesaurusdir_path \"" << path << "\"\n";
2337                 }
2338                 if (tag != RC_LAST)
2339                         break;
2340                 // fall through
2341         case RC_HUNSPELLDIR_PATH:
2342                 if (ignore_system_lyxrc ||
2343                     hunspelldir_path != system_lyxrc.hunspelldir_path) {
2344                         string const path = os::external_path(hunspelldir_path);
2345                         os << "\\hunspelldir_path \"" << path << "\"\n";
2346                 }
2347                 if (tag != RC_LAST)
2348                         break;
2349                 // fall through
2350         case RC_PLAINTEXT_LINELEN:
2351                 if (ignore_system_lyxrc ||
2352                     plaintext_linelen != system_lyxrc.plaintext_linelen) {
2353                         os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2354                 }
2355                 if (tag != RC_LAST)
2356                         break;
2357                 // fall through
2358         case RC_MAKE_BACKUP:
2359                 if (ignore_system_lyxrc ||
2360                     make_backup != system_lyxrc.make_backup) {
2361                         os << "\\make_backup " << convert<string>(make_backup) << '\n';
2362                 }
2363                 if (tag != RC_LAST)
2364                         break;
2365                 // fall through
2366         case RC_SAVE_COMPRESSED:
2367                 if (ignore_system_lyxrc ||
2368                     save_compressed != system_lyxrc.save_compressed) {
2369                         os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2370                 }
2371                 if (tag != RC_LAST)
2372                         break;
2373                 // fall through
2374         case RC_SAVE_ORIGIN:
2375                 if (ignore_system_lyxrc ||
2376                     save_origin != system_lyxrc.save_origin) {
2377                         os << "\\save_origin " << convert<string>(save_origin) << '\n';
2378                 }
2379                 if (tag != RC_LAST)
2380                         break;
2381                 // fall through
2382         case RC_BACKUPDIR_PATH:
2383                 if (ignore_system_lyxrc ||
2384                     backupdir_path != system_lyxrc.backupdir_path) {
2385                         string const path = os::external_path(backupdir_path);
2386                         os << "\\backupdir_path \"" << path << "\"\n";
2387                 }
2388                 if (tag != RC_LAST)
2389                         break;
2390
2391                 os << "\n#\n"
2392                    << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2393                    << "#\n\n";
2394
2395                 os << "\n#\n"
2396                    << "# SPELLCHECKER SECTION ##############################\n"
2397                    << "#\n\n";
2398
2399         // fall through
2400         case RC_ACCEPT_COMPOUND:
2401                 if (ignore_system_lyxrc ||
2402                     spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2403                         os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2404                            << '\n';
2405                 }
2406                 if (tag != RC_LAST)
2407                         break;
2408                 // fall through
2409         case RC_ALT_LANG:
2410                 if (ignore_system_lyxrc ||
2411                     spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2412                         os << "\\alternate_language \"" << spellchecker_alt_lang
2413                            << "\"\n";
2414                 }
2415                 if (tag != RC_LAST)
2416                         break;
2417                 // fall through
2418         case RC_ESC_CHARS:
2419                 if (ignore_system_lyxrc ||
2420                     spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2421                         os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2422                 }
2423                 if (tag != RC_LAST)
2424                         break;
2425                 // fall through
2426         case RC_USE_NATIVE_FILEDIALOG:
2427                 if (ignore_system_lyxrc ||
2428                     use_native_filedialog != system_lyxrc.use_native_filedialog) {
2429                         os << "\\use_native_filedialog "
2430                            << convert<string>(use_native_filedialog)
2431                            << '\n';
2432                 }
2433                 if (tag != RC_LAST)
2434                         break;
2435                 // fall through
2436         case RC_USE_SYSTEM_COLORS:
2437                 if (ignore_system_lyxrc ||
2438                     use_system_colors != system_lyxrc.use_system_colors) {
2439                         os << "\\use_system_colors "
2440                            << convert<string>(use_system_colors)
2441                            << '\n';
2442                 }
2443                 if (tag != RC_LAST)
2444                         break;
2445                 // fall through
2446         case RC_USE_TOOLTIP:
2447                 if (ignore_system_lyxrc ||
2448                     use_tooltip != system_lyxrc.use_tooltip) {
2449                         os << "\\use_tooltip "
2450                            << convert<string>(use_tooltip)
2451                            << '\n';
2452                 }
2453                 if (tag != RC_LAST)
2454                         break;
2455                 // fall through
2456         case RC_USE_PIXMAP_CACHE:
2457                 if (ignore_system_lyxrc ||
2458                     use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2459                         os << "\\use_pixmap_cache "
2460                            << convert<string>(use_pixmap_cache)
2461                            << '\n';
2462                 }
2463                 if (tag != RC_LAST)
2464                         break;
2465                 // fall through
2466         case RC_USE_QIMAGE:
2467                 if (ignore_system_lyxrc ||
2468                     use_qimage != system_lyxrc.use_qimage) {
2469                         os << "\\use_qimage "
2470                            << convert<string>(use_qimage)
2471                            << '\n';
2472                 }
2473                 if (tag != RC_LAST)
2474                         break;
2475
2476                 os << "\n#\n"
2477                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
2478                    << "#\n\n";
2479
2480         // fall through
2481         case RC_DEFAULT_DECIMAL_POINT:
2482                 if (ignore_system_lyxrc ||
2483                     default_decimal_point != system_lyxrc.default_decimal_point) {
2484                         os << "\\default_decimal_point " << default_decimal_point << '\n';
2485                 }
2486                 if (tag != RC_LAST)
2487                         break;
2488                 // fall through
2489         case RC_DEFAULT_LENGTH_UNIT:
2490                 if (ignore_system_lyxrc ||
2491                     default_length_unit != system_lyxrc.default_length_unit) {
2492                         os << "\\default_length_unit " << int(default_length_unit) << '\n';
2493                 }
2494                 if (tag != RC_LAST)
2495                         break;
2496                 // fall through
2497         case RC_SPELLCHECKER:
2498                 if (ignore_system_lyxrc ||
2499                     spellchecker != system_lyxrc.spellchecker) {
2500                         os << "\\spellchecker " << spellchecker << '\n';
2501                 }
2502                 if (tag != RC_LAST)
2503                         break;
2504                 // fall through
2505         case RC_SPELLCHECK_CONTINUOUSLY:
2506                 if (ignore_system_lyxrc ||
2507                     spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2508                         os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2509                            << '\n';
2510                 }
2511                 if (tag != RC_LAST)
2512                         break;
2513                 // fall through
2514         case RC_SPELLCHECK_NOTES:
2515                 if (ignore_system_lyxrc ||
2516                     spellcheck_notes != system_lyxrc.spellcheck_notes) {
2517                         os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2518                            << '\n';
2519                 }
2520                 if (tag != RC_LAST)
2521                         break;
2522                 // fall through
2523         case RC_VISUAL_CURSOR:
2524                 if (ignore_system_lyxrc ||
2525                         visual_cursor != system_lyxrc.visual_cursor) {
2526                         os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2527                 }
2528                 if (tag != RC_LAST)
2529                         break;
2530                 // fall through
2531         case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2532                 if (ignore_system_lyxrc ||
2533                         close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2534                         os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2535                         os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2536                 }
2537                 if (tag != RC_LAST)
2538                         break;
2539                 // fall through
2540         case RC_LANGUAGE_CUSTOM_PACKAGE:
2541                 if (ignore_system_lyxrc ||
2542                     language_custom_package != system_lyxrc.language_custom_package) {
2543                         os << "\\language_custom_package \"" << language_custom_package
2544                            << "\"\n";
2545                 }
2546                 if (tag != RC_LAST)
2547                         break;
2548                 // fall through
2549         case RC_LANGUAGE_GLOBAL_OPTIONS:
2550                 if (ignore_system_lyxrc ||
2551                     language_global_options
2552                     != system_lyxrc.language_global_options) {
2553                         os << "\\language_global_options \""
2554                            << convert<string>(language_global_options)
2555                            << "\"\n";
2556                 }
2557                 if (tag != RC_LAST)
2558                         break;
2559                 // fall through
2560         case RC_LANGUAGE_PACKAGE_SELECTION:
2561                 if (ignore_system_lyxrc ||
2562                     language_package_selection != system_lyxrc.language_package_selection) {
2563                         os << "\\language_package_selection ";
2564                         switch (language_package_selection) {
2565                         case LP_AUTO:
2566                                 os << "0\n";
2567                                 break;
2568                         case LP_BABEL:
2569                                 os << "1\n";
2570                                 break;
2571                         case LP_CUSTOM:
2572                                 os << "2\n";
2573                                 break;
2574                         case LP_NONE:
2575                                 os << "3\n";
2576                                 break;
2577                         }
2578                 }
2579                 if (tag != RC_LAST)
2580                         break;
2581                 // fall through
2582         case RC_LANGUAGE_COMMAND_BEGIN:
2583                 if (ignore_system_lyxrc ||
2584                     language_command_begin
2585                     != system_lyxrc.language_command_begin) {
2586                         os << "\\language_command_begin \""
2587                            << language_command_begin
2588                            << "\"\n";
2589                 }
2590                 if (tag != RC_LAST)
2591                         break;
2592                 // fall through
2593         case RC_LANGUAGE_COMMAND_END:
2594                 if (ignore_system_lyxrc ||
2595                     language_command_end
2596                     != system_lyxrc.language_command_end) {
2597                         os << "\\language_command_end \"" << language_command_end
2598                            << "\"\n";
2599                 }
2600                 if (tag != RC_LAST)
2601                         break;
2602                 // fall through
2603         case RC_LANGUAGE_COMMAND_LOCAL:
2604                 if (ignore_system_lyxrc ||
2605                     language_command_local
2606                     != system_lyxrc.language_command_local) {
2607                         os << "\\language_command_local \""
2608                            << language_command_local
2609                            << "\"\n";
2610                 }
2611                 if (tag != RC_LAST)
2612                         break;
2613                 // fall through
2614         case RC_LANGUAGE_AUTO_BEGIN:
2615                 if (ignore_system_lyxrc ||
2616                     language_auto_begin != system_lyxrc.language_auto_begin) {
2617                         os << "\\language_auto_begin "
2618                            << convert<string>(language_auto_begin) << '\n';
2619                 }
2620                 if (tag != RC_LAST)
2621                         break;
2622                 // fall through
2623         case RC_LANGUAGE_AUTO_END:
2624                 if (ignore_system_lyxrc ||
2625                     language_auto_end != system_lyxrc.language_auto_end) {
2626                         os << "\\language_auto_end "
2627                            << convert<string>(language_auto_end) << '\n';
2628                 }
2629                 if (tag != RC_LAST)
2630                         break;
2631                 // fall through
2632         case RC_MARK_FOREIGN_LANGUAGE:
2633                 if (ignore_system_lyxrc ||
2634                     mark_foreign_language
2635                     != system_lyxrc.mark_foreign_language) {
2636                         os << "\\mark_foreign_language " <<
2637                                 convert<string>(mark_foreign_language) << '\n';
2638                 }
2639                 if (tag != RC_LAST)
2640                         break;
2641
2642                 os << "\n#\n"
2643                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
2644                    << "#\n\n";
2645
2646         // fall through
2647         case RC_AUTO_NUMBER:
2648                 if (ignore_system_lyxrc ||
2649                     auto_number != system_lyxrc.auto_number) {
2650                         os << "\\auto_number " << convert<string>(auto_number) << '\n';
2651                 }
2652                 if (tag != RC_LAST)
2653                         break;
2654                 // fall through
2655         case RC_GUI_LANGUAGE:
2656                 if (ignore_system_lyxrc ||
2657                     gui_language != system_lyxrc.gui_language) {
2658                         os << "\\gui_language " << gui_language << '\n';
2659                 }
2660                 if (tag != RC_LAST)
2661                         break;
2662                 // fall through
2663         case RC_EXPORT_OVERWRITE:
2664                 if (ignore_system_lyxrc ||
2665                     export_overwrite != system_lyxrc.export_overwrite) {
2666                         string status;
2667                         switch (export_overwrite) {
2668                         case NO_FILES:
2669                                 status = "ask";
2670                                 break;
2671                         case MAIN_FILE:
2672                                 status = "main";
2673                                 break;
2674                         case ALL_FILES:
2675                                 status = "all";
2676                                 break;
2677                         }
2678                         os << "\\export_overwrite " << status << '\n';
2679                 }
2680                 if (tag != RC_LAST)
2681                         break;
2682                 // fall through
2683         case RC_SCROLL_WHEEL_ZOOM:
2684                 if (ignore_system_lyxrc ||
2685                         scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2686                         string status;
2687                         switch (scroll_wheel_zoom) {
2688                         case SCROLL_WHEEL_ZOOM_OFF:
2689                                 status = "off";
2690                                 break;
2691                         case SCROLL_WHEEL_ZOOM_CTRL:
2692                                 status = "ctrl";
2693                                 break;
2694                         case SCROLL_WHEEL_ZOOM_SHIFT:
2695                                 status = "shift";
2696                                 break;
2697                         case SCROLL_WHEEL_ZOOM_ALT:
2698                                 status = "alt";
2699                                 break;
2700                         }
2701                         os << "\\scroll_wheel_zoom " << status << '\n';
2702                 }
2703                 if (tag != RC_LAST)
2704                         break;
2705
2706                 os << "\n#\n"
2707                    << "# FORMATS SECTION ##########################\n"
2708                    << "#\n\n";
2709
2710         // fall through
2711         case RC_FILEFORMAT:
2712                 // New/modified formats
2713                 for (Formats::const_iterator cit = theFormats().begin();
2714                      cit != theFormats().end(); ++cit) {
2715                         Format const * format =
2716                                 theSystemFormats().getFormat(cit->name());
2717                         if (!format ||
2718                             format->extensions() != cit->extensions() ||
2719                             format->prettyname() != cit->prettyname() ||
2720                             format->shortcut() != cit->shortcut() ||
2721                             format->viewer() != cit->viewer() ||
2722                             format->editor() != cit->editor() ||
2723                             format->documentFormat() != cit->documentFormat() ||
2724                             format->vectorFormat() != cit->vectorFormat() ||
2725                             format->inExportMenu() != cit->inExportMenu() ||
2726                             format->noMenu() != cit->noMenu() ||
2727                             format->mime() != cit->mime()) {
2728                                 os << "\\format \"" << cit->name() << "\" \""
2729                                    << cit->extensions() << "\" \""
2730                                    << to_utf8(cit->prettyname()) << "\" \""
2731                                    << cit->shortcut() << "\" \""
2732                                    << escapeCommand(cit->viewer()) << "\" \""
2733                                    << escapeCommand(cit->editor()) << "\" \"";
2734                                 vector<string> flags;
2735                                 if (cit->documentFormat())
2736                                         flags.push_back("document");
2737                                 if (cit->vectorFormat())
2738                                         flags.push_back("vector");
2739                                 if (cit->zippedNative())
2740                                         flags.push_back("zipped=native");
2741                                 if (cit->inExportMenu())
2742                                         flags.push_back("menu=export");
2743
2744                                 os << getStringFromVector(flags);
2745                                 os << "\" \"" << cit->mime() << "\"\n";
2746                         }
2747                 }
2748
2749                 // Look for deleted formats
2750                 for (Formats::const_iterator cit = theSystemFormats().begin();
2751                      cit != theSystemFormats().end(); ++cit)
2752                         if (!theFormats().getFormat(cit->name()))
2753                                 os << "\\format \"" << cit->name()
2754                                    << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2755                 if (tag != RC_LAST)
2756                         break;
2757                 // fall through
2758         case RC_VIEWER_ALTERNATIVES: {
2759                 Alternatives::const_iterator it = viewer_alternatives.begin();
2760                 Alternatives::const_iterator const en = viewer_alternatives.end();
2761                 Alternatives::const_iterator const sysend =
2762                                 system_lyxrc.viewer_alternatives.end();
2763                 for (; it != en; ++it) {
2764                         string const & fmt = it->first;
2765                         CommandSet const & cmd = it->second;
2766                         CommandSet::const_iterator sit = cmd.begin();
2767                         CommandSet::const_iterator const sen = cmd.end();
2768                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2769                                         system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2770                                         system_lyxrc.viewer_alternatives.find(fmt);
2771                         for (; sit != sen; ++sit) {
2772                                 string const & cmd = *sit;
2773                                 if (ignore_system_lyxrc
2774                                     || sysfmt == sysend               // format not found
2775                                          || sysfmt->second.count(cmd) == 0 // this command not found
2776                                    )
2777                                         os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2778                         }
2779                 }
2780                 if (tag != RC_LAST)
2781                         break;
2782         }
2783         // fall through
2784         case RC_EDITOR_ALTERNATIVES: {
2785                 Alternatives::const_iterator it = editor_alternatives.begin();
2786                 Alternatives::const_iterator const en = editor_alternatives.end();
2787                 Alternatives::const_iterator const sysend =
2788                                 system_lyxrc.editor_alternatives.end();
2789                 for (; it != en; ++it) {
2790                         string const & fmt = it->first;
2791                         CommandSet const & cmd = it->second;
2792                         CommandSet::const_iterator sit = cmd.begin();
2793                         CommandSet::const_iterator const sen = cmd.end();
2794                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2795                                         system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2796                                         system_lyxrc.editor_alternatives.find(fmt);
2797                         for (; sit != sen; ++sit) {
2798                                 string const & cmd = *sit;
2799                                 if (ignore_system_lyxrc
2800                                     || sysfmt == sysend               // format not found
2801                                     || sysfmt->second.count(cmd) == 0 // this command not found
2802                                    )
2803                                         os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2804                         }
2805                 }
2806                 if (tag != RC_LAST)
2807                         break;
2808         }
2809         // fall through
2810         case RC_DEFAULT_OTF_VIEW_FORMAT:
2811                 if ((ignore_system_lyxrc ||
2812                      default_otf_view_format != system_lyxrc.default_otf_view_format)
2813                     && !default_otf_view_format.empty()) {
2814                         os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2815                 }
2816                 if (tag != RC_LAST)
2817                         break;
2818                 // fall through
2819         case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2820                 if ((ignore_system_lyxrc ||
2821                      default_platex_view_format != system_lyxrc.default_platex_view_format)
2822                     && !default_platex_view_format.empty()) {
2823                         os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2824                 }
2825                 if (tag != RC_LAST)
2826                         break;
2827                 // fall through
2828         case RC_DEFAULT_VIEW_FORMAT:
2829                 if (ignore_system_lyxrc ||
2830                     default_view_format != system_lyxrc.default_view_format) {
2831                         os << "\\default_view_format " << default_view_format << '\n';
2832                 }
2833                 if (tag != RC_LAST)
2834                         break;
2835                 // fall through
2836         case RC_VIEWER:
2837                 // Ignore it
2838                 if (tag != RC_LAST)
2839                         break;
2840
2841                 os << "\n#\n"
2842                    << "# CONVERTERS SECTION ##########################\n"
2843                    << "#\n\n";
2844
2845         // fall through
2846         case RC_CONVERTER:
2847                 // Look for new converters
2848                 for (Converters::const_iterator cit = theConverters().begin();
2849                      cit != theConverters().end(); ++cit) {
2850                         Converter const * converter =
2851                                 theSystemConverters().getConverter(cit->from(),
2852                                                                    cit->to());
2853                         if (!converter ||
2854                             converter->command() != cit->command() ||
2855                             converter->flags() != cit->flags())
2856                                 os << "\\converter \"" << cit->from() << "\" \""
2857                                    << cit->to() << "\" \""
2858                                    << escapeCommand(cit->command()) << "\" \""
2859                                    << cit->flags() << "\"\n";
2860                 }
2861
2862                 // New/modifed converters
2863                 for (Converters::const_iterator cit = theSystemConverters().begin();
2864                      cit != theSystemConverters().end(); ++cit)
2865                         if (!theConverters().getConverter(cit->from(), cit->to()))
2866                                 os << "\\converter \"" << cit->from()
2867                                    << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2868                 if (tag != RC_LAST)
2869                         break;
2870                 // fall through
2871         case RC_COPIER:
2872                 if (tag == RC_LAST)
2873                         os << "\n#\n"
2874                            << "# COPIERS SECTION ##########################\n"
2875                            << "#\n\n";
2876
2877                 // Look for new movers
2878                 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2879                 Movers::const_iterator const sysend = theSystemMovers().end();
2880                 Movers::const_iterator it = theMovers().begin();
2881                 Movers::const_iterator end = theMovers().end();
2882
2883                 for (; it != end; ++it) {
2884                         Movers::const_iterator const sysit =
2885                                 find_if(sysbegin, sysend, SameMover(*it));
2886                         if (sysit == sysend) {
2887                                 string const & fmt = it->first;
2888                                 string const & command =
2889                                         it->second.command();
2890
2891                                 os << "\\copier " << fmt
2892                                    << " \"" << escapeCommand(command) << "\"\n";
2893                         }
2894                 }
2895                 if (tag != RC_LAST)
2896                         break;
2897
2898                 // We don't actually delete SpecialisedMover(s) from the
2899                 // map, just clear their 'command', so there's no need
2900                 // to test for anything else.
2901         }
2902
2903         os.flush();
2904 }
2905
2906
2907 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2908 {
2909         // Why the switch you might ask. It is a trick to ensure that all
2910         // the elements in the LyXRCTags enum is handled. As you can see
2911         // there are no breaks at all. So it is just a huge fall-through.
2912         // The nice thing is that we will get a warning from the compiler
2913         // if we forget an element.
2914         LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2915         switch (tag) {
2916         case LyXRC::RC_LAST:
2917         case LyXRC::RC_ACCEPT_COMPOUND:
2918                 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2919                         if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2920                 // fall through
2921         case LyXRC::RC_ALT_LANG:
2922         case LyXRC::RC_PLAINTEXT_LINELEN:
2923         case LyXRC::RC_AUTOCORRECTION_MATH:
2924         case LyXRC::RC_AUTOREGIONDELETE:
2925         case LyXRC::RC_AUTORESET_OPTIONS:
2926         case LyXRC::RC_AUTOSAVE:
2927         case LyXRC::RC_AUTO_NUMBER:
2928         case LyXRC::RC_BACKUPDIR_PATH:
2929         case LyXRC::RC_BIBTEX_ALTERNATIVES:
2930         case LyXRC::RC_BIBTEX_COMMAND:
2931         case LyXRC::RC_BINDFILE:
2932         case LyXRC::RC_CHECKLASTFILES:
2933         case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2934         case LyXRC::RC_COMPLETION_INLINE_DELAY:
2935         case LyXRC::RC_COMPLETION_INLINE_DOTS:
2936         case LyXRC::RC_COMPLETION_INLINE_MATH:
2937         case LyXRC::RC_COMPLETION_INLINE_TEXT:
2938         case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2939         case LyXRC::RC_COMPLETION_POPUP_DELAY:
2940         case LyXRC::RC_COMPLETION_POPUP_MATH:
2941         case LyXRC::RC_COMPLETION_POPUP_TEXT:
2942         case LyXRC::RC_COMPLETION_MINLENGTH:
2943         case LyXRC::RC_USELASTFILEPOS:
2944         case LyXRC::RC_LOADSESSION:
2945         case LyXRC::RC_CHKTEX_COMMAND:
2946         case LyXRC::RC_CONVERTER:
2947         case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2948         case LyXRC::RC_COPIER:
2949         case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2950         case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2951         case LyXRC::RC_DATE_INSERT_FORMAT:
2952         case LyXRC::RC_GUI_LANGUAGE:
2953         case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2954         case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2955         case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2956         case LyXRC::RC_DEFFILE:
2957         case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2958         case LyXRC::RC_DISPLAY_GRAPHICS:
2959         case LyXRC::RC_DOCUMENTPATH:
2960                 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2961                         FileName path(lyxrc_new.document_path);
2962                         if (path.exists() && path.isDirectory())
2963                                 package().document_dir() = FileName(lyxrc.document_path);
2964                 }
2965                 // fall through
2966         case LyXRC::RC_EDITOR_ALTERNATIVES:
2967         case LyXRC::RC_ESC_CHARS:
2968         case LyXRC::RC_EXAMPLEPATH:
2969         case LyXRC::RC_FONT_ENCODING:
2970         case LyXRC::RC_FILEFORMAT:
2971         case LyXRC::RC_GROUP_LAYOUTS:
2972         case LyXRC::RC_HUNSPELLDIR_PATH:
2973         case LyXRC::RC_ICON_SET:
2974         case LyXRC::RC_INDEX_ALTERNATIVES:
2975         case LyXRC::RC_INDEX_COMMAND:
2976         case LyXRC::RC_JBIBTEX_COMMAND:
2977         case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2978         case LyXRC::RC_JINDEX_COMMAND:
2979         case LyXRC::RC_NOMENCL_COMMAND:
2980         case LyXRC::RC_PYGMENTIZE_COMMAND:
2981         case LyXRC::RC_INPUT:
2982         case LyXRC::RC_KBMAP:
2983         case LyXRC::RC_KBMAP_PRIMARY:
2984         case LyXRC::RC_KBMAP_SECONDARY:
2985         case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2986         case LyXRC::RC_LANGUAGE_AUTO_END:
2987         case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2988         case LyXRC::RC_LANGUAGE_COMMAND_END:
2989         case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2990         case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2991         case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2992         case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2993         case LyXRC::RC_LYXRCFORMAT:
2994         case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2995         case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2996         case LyXRC::RC_MACRO_EDIT_STYLE:
2997         case LyXRC::RC_MAKE_BACKUP:
2998         case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2999         case LyXRC::RC_MOUSE_WHEEL_SPEED:
3000         case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
3001         case LyXRC::RC_NUMLASTFILES:
3002         case LyXRC::RC_PARAGRAPH_MARKERS:
3003         case LyXRC::RC_PATH_PREFIX:
3004                 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
3005                         prependEnvPath("PATH", replaceEnvironmentPath(lyxrc_new.path_prefix));
3006                         // Resets python path
3007                         support::os::python(true);
3008                 }
3009                 // fall through
3010         case LyXRC::RC_PREVIEW:
3011                 if (lyxrc_orig.preview != lyxrc_new.preview) {
3012                         // Update all previews of all documents.
3013                         /* FIXME: this can be very expensive. It would be cheaper
3014                          * to kill all existing previews and update visible
3015                          * previews.*/
3016                         theBufferList().updatePreviews();
3017                 }
3018                 // fall through
3019         case LyXRC::RC_PREVIEW_HASHED_LABELS:
3020         case LyXRC::RC_PREVIEW_SCALE_FACTOR:
3021         case LyXRC::RC_PRINTLANDSCAPEFLAG:
3022         case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
3023         case LyXRC::RC_PRINTPAPERFLAG:
3024         case LyXRC::RC_SAVE_COMPRESSED:
3025         case LyXRC::RC_SAVE_ORIGIN:
3026         case LyXRC::RC_SCREEN_DPI:
3027
3028         case LyXRC::RC_SCREEN_FONT_ROMAN:
3029         case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
3030         case LyXRC::RC_SCREEN_FONT_SANS:
3031         case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
3032         case LyXRC::RC_SCREEN_FONT_SCALABLE:
3033         case LyXRC::RC_SCREEN_FONT_SIZES:
3034         case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
3035         case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3036         case LyXRC::RC_SCREEN_ZOOM:
3037                 if (lyxrc_orig.roman_font_name != lyxrc_new.roman_font_name
3038                 || lyxrc_orig.sans_font_name != lyxrc_new.sans_font_name
3039                 || lyxrc_orig.typewriter_font_name != lyxrc_new.typewriter_font_name
3040                 || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry
3041                 || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry
3042                 || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts
3043                 || lyxrc_orig.font_sizes != lyxrc_new.font_sizes
3044                 || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry
3045                 || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) {
3046                 dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
3047         }
3048                 // fall through
3049         case LyXRC::RC_GEOMETRY_SESSION:
3050         case LyXRC::RC_SERVERPIPE:
3051         case LyXRC::RC_SET_COLOR:
3052         case LyXRC::RC_SHOW_BANNER:
3053         case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
3054         case LyXRC::RC_SPELLCHECKER:
3055                 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3056                         setSpellChecker();
3057                 // fall through
3058         case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3059         case LyXRC::RC_SPELLCHECK_NOTES:
3060         case LyXRC::RC_SPLITINDEX_COMMAND:
3061         case LyXRC::RC_TEMPDIRPATH:
3062         case LyXRC::RC_TEMPLATEPATH:
3063         case LyXRC::RC_TEX_ALLOWS_SPACES:
3064         case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3065                 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3066                         os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3067                 }
3068                 // fall through
3069         case LyXRC::RC_TEXINPUTS_PREFIX:
3070         case LyXRC::RC_THESAURUSDIRPATH:
3071         case LyXRC::RC_UIFILE:
3072         case LyXRC::RC_USER_EMAIL:
3073         case LyXRC::RC_USER_NAME:
3074         case LyXRC::RC_USE_CONVERTER_CACHE:
3075         case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
3076         case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
3077         case LyXRC::RC_USE_NATIVE_FILEDIALOG:
3078         case LyXRC::RC_USE_SYSTEM_COLORS:
3079         case LyXRC::RC_USE_TOOLTIP:
3080         case LyXRC::RC_USE_PIXMAP_CACHE:
3081         case LyXRC::RC_USE_QIMAGE:
3082         case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3083         case LyXRC::RC_VIEWDVI_PAPEROPTION:
3084         case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3085         case LyXRC::RC_SINGLE_INSTANCE:
3086         case LyXRC::RC_SORT_LAYOUTS:
3087         case LyXRC::RC_FULL_SCREEN_LIMIT:
3088         case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3089         case LyXRC::RC_FULL_SCREEN_MENUBAR:
3090         case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3091         case LyXRC::RC_FULL_SCREEN_TABBAR:
3092         case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3093         case LyXRC::RC_FULL_SCREEN_WIDTH:
3094         case LyXRC::RC_VISUAL_CURSOR:
3095         case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3096         case LyXRC::RC_VIEWER:
3097         case LyXRC::RC_VIEWER_ALTERNATIVES:
3098         case LyXRC::RC_FORWARD_SEARCH_DVI:
3099         case LyXRC::RC_FORWARD_SEARCH_PDF:
3100         case LyXRC::RC_EXPORT_OVERWRITE:
3101         case LyXRC::RC_DEFAULT_DECIMAL_POINT:
3102         case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3103         case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3104         case LyXRC::RC_CURSOR_WIDTH:
3105                 break;
3106         }
3107 }
3108
3109
3110 #if 0
3111 string const LyXRC::getDescription(LyXRCTags tag)
3112 {
3113         docstring str;
3114
3115         switch (tag) {
3116         case RC_ACCEPT_COMPOUND:
3117                 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3118                 break;
3119
3120         case RC_ALT_LANG:
3121                 str = _("Specify an alternate language. The default is to use the language of the document.");
3122                 break;
3123
3124         case RC_PLAINTEXT_LINELEN:
3125                 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.");
3126                 break;
3127
3128         case RC_AUTOREGIONDELETE:
3129                 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3130                 break;
3131
3132         case RC_AUTORESET_OPTIONS:
3133                 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3134                 break;
3135
3136         case RC_AUTOSAVE:
3137                 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3138                 break;
3139
3140         case RC_AUTO_NUMBER:
3141                 break;
3142
3143         case RC_BACKUPDIR_PATH:
3144                 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.");
3145                 break;
3146
3147         case RC_BIBTEX_COMMAND:
3148                 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3149                 break;
3150
3151         case RC_JBIBTEX_COMMAND:
3152                 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3153                 break;
3154
3155         case RC_BINDFILE:
3156                 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3157                 break;
3158
3159         case RC_CHECKLASTFILES:
3160                 str = _("Select to check whether the lastfiles still exist.");
3161                 break;
3162
3163         case RC_CHKTEX_COMMAND:
3164                 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3165                 break;
3166
3167         case RC_CONVERTER:
3168                 break;
3169
3170         case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3171                 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3172                 break;
3173
3174         case RC_CONVERTER_NEEDAUTH:
3175                 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3176                 break;
3177
3178         case RC_COPIER:
3179                 break;
3180
3181         case RC_CURSOR_FOLLOWS_SCROLLBAR:
3182                 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.");
3183                 break;
3184
3185         case RC_CURSOR_WIDTH:
3186                 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3187                 break;
3188
3189         case RC_SCROLL_BELOW_DOCUMENT:
3190                 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");
3191                 break;
3192
3193         case RC_MAC_DONTSWAP_CTRL_META:
3194                 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3195                 break;
3196
3197         case RC_MAC_LIKE_CURSOR_MOVEMENT:
3198                 str = _("Use the Mac OS X conventions for cursor movement");
3199                 break;
3200
3201         case RC_SHOW_MACRO_LABEL:
3202                 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3203                 break;
3204
3205         case RC_DATE_INSERT_FORMAT:
3206                 //xgettext:no-c-format
3207                 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
3208                 break;
3209
3210         case RC_DEFFILE:
3211                 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3212                 break;
3213
3214         case RC_DEFAULT_OTF_VIEW_FORMAT:
3215                 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3216                 break;
3217
3218         case RC_DEFAULT_VIEW_FORMAT:
3219                 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3220                 break;
3221
3222         case RC_DIALOGS_ICONIFY_WITH_MAIN:
3223                 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3224                 break;
3225
3226         case RC_DISPLAY_GRAPHICS:
3227                 str = _("Select how LyX will display any graphics.");
3228                 break;
3229
3230         case RC_DOCUMENTPATH:
3231                 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3232                 break;
3233
3234         case RC_ESC_CHARS:
3235                 str = _("Specify additional chars that can be part of a word.");
3236                 break;
3237
3238         case RC_EXAMPLEPATH:
3239                 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3240                 break;
3241
3242         case RC_FONT_ENCODING:
3243                 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
3244                 break;
3245
3246         case RC_FILEFORMAT:
3247                 break;
3248
3249         case RC_INDEX_COMMAND:
3250                 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\".");
3251                 break;
3252
3253         case RC_JINDEX_COMMAND:
3254                 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3255                 break;
3256
3257         case RC_NOMENCL_COMMAND:
3258                 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3259                 break;
3260
3261         case RC_PYGMENTIZE_COMMAND:
3262                 str = _("The command to run the python pygments syntax highlighter.");
3263                 break;
3264
3265         case RC_INPUT:
3266                 break;
3267
3268         case RC_KBMAP:
3269         case RC_KBMAP_PRIMARY:
3270         case RC_KBMAP_SECONDARY:
3271                 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.");
3272                 break;
3273
3274         case RC_LANGUAGE_AUTO_BEGIN:
3275                 str = _("Select if a language switching command is needed at the beginning of the document.");
3276                 break;
3277
3278         case RC_LANGUAGE_AUTO_END:
3279                 str = _("Select if a language switching command is needed at the end of the document.");
3280                 break;
3281
3282         case RC_LANGUAGE_COMMAND_BEGIN:
3283                 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.");
3284                 break;
3285
3286         case RC_LANGUAGE_COMMAND_END:
3287                 str = _("The LaTeX command for changing back to the language of the document.");
3288                 break;
3289
3290         case RC_LANGUAGE_COMMAND_LOCAL:
3291                 str = _("The LaTeX command for local changing of the language.");
3292                 break;
3293
3294         case RC_LANGUAGE_GLOBAL_OPTIONS:
3295                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3296                 break;
3297
3298         case RC_LANGUAGE_CUSTOM_PACKAGE:
3299                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3300                 break;
3301
3302         case RC_LANGUAGE_PACKAGE_SELECTION:
3303                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3304                 break;
3305
3306         case RC_USELASTFILEPOS:
3307                 str = _("De-select if you do not want LyX to scroll to saved position.");
3308                 break;
3309
3310         case RC_LOADSESSION:
3311                 str = _("De-select to prevent loading files opened from the last LyX session.");
3312                 break;
3313
3314         case RC_MAKE_BACKUP:
3315                 str = _("De-select if you don't want LyX to create backup files.");
3316                 break;
3317
3318         case RC_MARK_FOREIGN_LANGUAGE:
3319                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3320                 break;
3321
3322         case RC_MOUSE_WHEEL_SPEED:
3323                 str = _("The scrolling speed of the mouse wheel.");
3324                 break;
3325
3326         case RC_COMPLETION_POPUP_DELAY:
3327                 str = _("The completion popup delay.");
3328                 break;
3329
3330         case RC_COMPLETION_POPUP_MATH:
3331                 str = _("Select to display the completion popup in math mode.");
3332                 break;
3333
3334         case RC_COMPLETION_POPUP_TEXT:
3335                 str = _("Select to display the completion popup in text mode.");
3336                 break;
3337
3338         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3339                 str = _("Show the completion popup without delay after non-unique completion attempt.");
3340                 break;
3341
3342         case RC_COMPLETION_POPUP_TEXT:
3343                 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3344                 break;
3345
3346         case RC_COMPLETION_POPUP_DELAY:
3347                 str = _("The inline completion delay.");
3348                 break;
3349
3350         case RC_COMPLETION_INLINE_MATH:
3351                 str = _("Select to display the inline completion in math mode.");
3352                 break;
3353
3354         case RC_COMPLETION_INLINE_TEXT:
3355                 str = _("Select to display the inline completion in text mode.");
3356                 break;
3357
3358         case RC_COMPLETION_INLINE_DOTS:
3359                 str = _("Use \"...\" to shorten long completions.");
3360                 break;
3361
3362         case RC_AUTOCORRECTION_MATH:
3363                 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3364                 break;
3365
3366         case RC_NUMLASTFILES:
3367                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3368                         maxlastfiles);
3369                 break;
3370
3371         case RC_PATH_PREFIX:
3372                 str = _("Specify those directories which should be "
3373                          "prepended to the PATH environment variable.\n"
3374                          "Use the OS native format.");
3375                 break;
3376
3377         case RC_PREVIEW:
3378                 str = _("Shows a typeset preview of things such as math");
3379                 break;
3380
3381         case RC_PREVIEW_HASHED_LABELS:
3382                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3383                 break;
3384
3385         case RC_PREVIEW_SCALE_FACTOR:
3386                 str = _("Scale the preview size to suit.");
3387                 break;
3388
3389         case RC_PRINTLANDSCAPEFLAG:
3390                 str = _("The option to print out in landscape.");
3391                 break;
3392
3393         case RC_PRINTPAPERDIMENSIONFLAG:
3394                 str = _("Option to specify the dimensions of the print paper.");
3395                 break;
3396
3397         case RC_PRINTPAPERFLAG:
3398                 str = _("The option to specify paper type.");
3399                 break;
3400
3401         case RC_VISUAL_CURSOR:
3402                 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3403                 break;
3404
3405         case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3406                 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).");
3407                 break;
3408
3409         case RC_SCREEN_DPI:
3410                 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3411                 break;
3412
3413         case RC_SCREEN_FONT_ROMAN:
3414         case RC_SCREEN_FONT_SANS:
3415         case RC_SCREEN_FONT_TYPEWRITER:
3416                 str = _("The screen fonts used to display the text while editing.");
3417                 break;
3418
3419         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3420         case RC_SCREEN_FONT_SANS_FOUNDRY:
3421         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3422                 break;
3423
3424         case RC_SCREEN_FONT_SCALABLE:
3425                 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.");
3426                 break;
3427
3428         case RC_SCREEN_FONT_SIZES:
3429                 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3430                 break;
3431
3432         case RC_SCREEN_ZOOM:
3433                 //xgettext:no-c-format
3434                 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3435                 break;
3436
3437         case RC_GEOMETRY_SESSION:
3438                 str = _("Allow session manager to save and restore windows geometry.");
3439                 break;
3440
3441         case RC_SERVERPIPE:
3442                 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3443                 break;
3444
3445         case RC_SET_COLOR:
3446                 break;
3447
3448         case RC_SHOW_BANNER:
3449                 str = _("De-select if you don't want the startup banner.");
3450                 break;
3451
3452         case RC_TEMPDIRPATH:
3453                 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3454                 break;
3455
3456         case RC_THESAURUSDIRPATH:
3457                 str = _("This is the place where the files of the thesaurus library reside.");
3458                 break;
3459
3460         case RC_TEMPLATEPATH:
3461                 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3462                 break;
3463
3464         case RC_TEX_ALLOWS_SPACES:
3465                 break;
3466
3467         case RC_TEX_EXPECTS_WINDOWS_PATHS:
3468                 break;
3469
3470         case RC_TEXINPUTS_PREFIX:
3471                 str = _("Specify those directories which should be "
3472                          "prepended to the TEXINPUTS environment variable.\n"
3473                          "A '.' represents the current document directory. "
3474                          "Use the OS native format.");
3475                 break;
3476
3477         case RC_UIFILE:
3478                 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3479                 break;
3480
3481         case RC_USER_EMAIL:
3482                 break;
3483
3484         case RC_USER_NAME:
3485                 break;
3486
3487         case RC_USE_USE_SYSTEM_COLORS:
3488                 str = _("Enable use the system colors for some things like main window background and selection.");
3489                 break;
3490
3491         case RC_USE_TOOLTIP:
3492                 str = _("Enable the automatic appearance of tool tips in the work area.");
3493                 break;
3494
3495         case RC_USE_PIXMAP_CACHE:
3496                 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
3497                 break;
3498
3499         case RC_VIEWDVI_PAPEROPTION:
3500                 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3501                 break;
3502
3503         case RC_VIEWER:
3504                 break;
3505
3506         case RC_LAST:
3507                 break;
3508         }
3509
3510         return str;
3511 }
3512 #endif
3513
3514
3515 // The global instance
3516 LyXRC lyxrc;
3517
3518 // The global copy of the system lyxrc entries (everything except preferences)
3519 LyXRC system_lyxrc;
3520
3521
3522 } // namespace lyx