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