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