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