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