]> git.lyx.org Git - lyx.git/blob - src/LyXRC.cpp
update SCons
[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)
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_C0:
1441                         case PAPER_C1:
1442                         case PAPER_C2:
1443                         case PAPER_C3:
1444                         case PAPER_C4:
1445                         case PAPER_C5:
1446                         case PAPER_C6:
1447                         case PAPER_JISB0:
1448                         case PAPER_JISB1:
1449                         case PAPER_JISB2:
1450                         case PAPER_JISB3:
1451                         case PAPER_JISB4:
1452                         case PAPER_JISB5:
1453                         case PAPER_JISB6: break;
1454                         }
1455                         os << "\"\n";
1456                 }
1457                 if (tag != RC_LAST)
1458                         break;
1459         case RC_CHKTEX_COMMAND:
1460                 if (ignore_system_lyxrc ||
1461                     chktex_command != system_lyxrc.chktex_command) {
1462                         os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1463                 }
1464                 if (tag != RC_LAST)
1465                         break;
1466         case RC_BIBTEX_ALTERNATIVES: {
1467                 CommandSet::const_iterator it = bibtex_alternatives.begin();
1468                 CommandSet::const_iterator end = bibtex_alternatives.end();
1469                 for ( ; it != end; ++it) {
1470                         if (ignore_system_lyxrc
1471                             || !system_lyxrc.bibtex_alternatives.count(*it))
1472                                 os << "\\bibtex_alternatives \""
1473                                    << *it << "\"\n";
1474                 }
1475                 if (tag != RC_LAST)
1476                         break;
1477         }
1478         case RC_BIBTEX_COMMAND:
1479                 if (ignore_system_lyxrc ||
1480                     bibtex_command != system_lyxrc.bibtex_command) {
1481                         os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1482                 }
1483                 if (tag != RC_LAST)
1484                         break;
1485         case RC_JBIBTEX_COMMAND:
1486                 if (ignore_system_lyxrc ||
1487                     jbibtex_command != system_lyxrc.jbibtex_command) {
1488                         os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1489                 }
1490                 if (tag != RC_LAST)
1491                         break;
1492         case RC_INDEX_ALTERNATIVES: {
1493                 CommandSet::const_iterator it = index_alternatives.begin();
1494                 CommandSet::const_iterator end = index_alternatives.end();
1495                 for ( ; it != end; ++it) {
1496                         if (ignore_system_lyxrc
1497                             || !system_lyxrc.index_alternatives.count(*it))
1498                                 os << "\\index_alternatives \""
1499                                    << *it << "\"\n";
1500                 }
1501                 if (tag != RC_LAST)
1502                         break;
1503         }
1504         case RC_INDEX_COMMAND:
1505                 if (ignore_system_lyxrc ||
1506                     index_command != system_lyxrc.index_command) {
1507                         os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1508                 }
1509                 if (tag != RC_LAST)
1510                         break;
1511         case RC_JINDEX_COMMAND:
1512                 if (ignore_system_lyxrc ||
1513                     jindex_command != system_lyxrc.jindex_command) {
1514                         os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1515                 }
1516                 if (tag != RC_LAST)
1517                         break;
1518         case RC_SPLITINDEX_COMMAND:
1519                 if (ignore_system_lyxrc ||
1520                     splitindex_command != system_lyxrc.splitindex_command) {
1521                         os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1522                 }
1523                 if (tag != RC_LAST)
1524                         break;
1525         case RC_NOMENCL_COMMAND:
1526                 if (ignore_system_lyxrc ||
1527                     nomencl_command != system_lyxrc.nomencl_command) {
1528                         os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1529                 }
1530                 if (tag != RC_LAST)
1531                         break;
1532         case RC_TEX_EXPECTS_WINDOWS_PATHS:
1533                 if (ignore_system_lyxrc ||
1534                     windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
1535                         os << "\\tex_expects_windows_paths "
1536                            << convert<string>(windows_style_tex_paths) << '\n';
1537                 }
1538                 if (tag != RC_LAST)
1539                         break;
1540         case RC_TEX_ALLOWS_SPACES:
1541                 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1542                         os << "\\tex_allows_spaces "
1543                            << convert<string>(tex_allows_spaces) << '\n';
1544                 }
1545                 if (tag != RC_LAST)
1546                         break;
1547         case RC_KBMAP:
1548                 if (ignore_system_lyxrc ||
1549                     use_kbmap != system_lyxrc.use_kbmap) {
1550                         os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1551                 }
1552                 if (tag != RC_LAST)
1553                         break;
1554         case RC_KBMAP_PRIMARY:
1555                 if (ignore_system_lyxrc ||
1556                     primary_kbmap != system_lyxrc.primary_kbmap) {
1557                         string const path = os::external_path(primary_kbmap);
1558                         os << "\\kbmap_primary \"" << path << "\"\n";
1559                 }
1560                 if (tag != RC_LAST)
1561                         break;
1562         case RC_KBMAP_SECONDARY:
1563                 if (ignore_system_lyxrc ||
1564                     secondary_kbmap != system_lyxrc.secondary_kbmap) {
1565                         string const path = os::external_path(secondary_kbmap);
1566                         os << "\\kbmap_secondary \"" << path << "\"\n";
1567                 }
1568                 if (tag != RC_LAST)
1569                         break;
1570         case RC_SERVERPIPE:
1571                 if (ignore_system_lyxrc ||
1572                     lyxpipes != system_lyxrc.lyxpipes) {
1573                         string const path = os::external_path(lyxpipes);
1574                         os << "\\serverpipe \"" << path << "\"\n";
1575                 }
1576                 if (tag != RC_LAST)
1577                         break;
1578         case RC_DATE_INSERT_FORMAT:
1579                 if (ignore_system_lyxrc ||
1580                     date_insert_format != system_lyxrc.date_insert_format) {
1581                         os << "\\date_insert_format \"" << date_insert_format
1582                            << "\"\n";
1583                 }
1584                 if (tag != RC_LAST)
1585                         break;
1586
1587         case RC_USER_NAME:
1588                 os << "\\user_name \"" << user_name << "\"\n";
1589                 if (tag != RC_LAST)
1590                         break;
1591
1592         case RC_USER_EMAIL:
1593                 os << "\\user_email \"" << user_email << "\"\n";
1594                 if (tag != RC_LAST)
1595                         break;
1596
1597         case RC_SHOW_BANNER:
1598                 if (ignore_system_lyxrc ||
1599                     show_banner != system_lyxrc.show_banner) {
1600                         os << "\\show_banner " << convert<string>(show_banner) << '\n';
1601                 }
1602                 if (tag != RC_LAST)
1603                         break;
1604
1605         case RC_PREVIEW:
1606                 if (ignore_system_lyxrc ||
1607                     preview != system_lyxrc.preview) {
1608                         string status;
1609                         switch (preview) {
1610                         case PREVIEW_ON:
1611                                 status = "on";
1612                                 break;
1613                         case PREVIEW_NO_MATH:
1614                                 status = "no_math";
1615                                 break;
1616                         case PREVIEW_OFF:
1617                                 status = "off";
1618                                 break;
1619                         }
1620                         os << "\\preview " << status << '\n';
1621                 }
1622                 if (tag != RC_LAST)
1623                         break;
1624
1625         case RC_PREVIEW_HASHED_LABELS:
1626                 if (ignore_system_lyxrc ||
1627                     preview_hashed_labels !=
1628                     system_lyxrc.preview_hashed_labels) {
1629                         os << "\\preview_hashed_labels "
1630                            << convert<string>(preview_hashed_labels) << '\n';
1631                 }
1632                 if (tag != RC_LAST)
1633                         break;
1634
1635         case RC_PREVIEW_SCALE_FACTOR:
1636                 if (ignore_system_lyxrc ||
1637                     preview_scale_factor != system_lyxrc.preview_scale_factor) {
1638                         os << "\\preview_scale_factor "
1639                            << preview_scale_factor << '\n';
1640                 }
1641                 if (tag != RC_LAST)
1642                         break;
1643
1644         case RC_USE_CONVERTER_CACHE:
1645                 if (ignore_system_lyxrc ||
1646                     use_converter_cache != system_lyxrc.use_converter_cache) {
1647                         os << "\\use_converter_cache "
1648                            << convert<string>(use_converter_cache) << '\n';
1649                 }
1650                 if (tag != RC_LAST)
1651                         break;
1652
1653         case RC_CONVERTER_CACHE_MAXAGE:
1654                 if (ignore_system_lyxrc ||
1655                     converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1656                         os << "\\converter_cache_maxage "
1657                            << converter_cache_maxage << '\n';
1658                 }
1659                 if (tag != RC_LAST)
1660                         break;
1661
1662                 os << "\n#\n"
1663                    << "# SCREEN & FONTS SECTION ############################\n"
1664                    << "#\n\n";
1665
1666         case RC_SCREEN_DPI:
1667                 if (ignore_system_lyxrc ||
1668                     dpi != system_lyxrc.dpi) {
1669                         os << "\\screen_dpi " << dpi << '\n';
1670                 }
1671                 if (tag != RC_LAST)
1672                         break;
1673         case RC_SCREEN_ZOOM:
1674                 if (ignore_system_lyxrc ||
1675                     zoom != system_lyxrc.zoom) {
1676                         os << "\\screen_zoom " << zoom << '\n';
1677                 }
1678                 if (tag != RC_LAST)
1679                         break;
1680         case RC_GEOMETRY_SESSION:
1681                 if (ignore_system_lyxrc ||
1682                     allow_geometry_session != system_lyxrc.allow_geometry_session) {
1683                         os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1684                            << '\n';
1685                 }
1686                 if (tag != RC_LAST)
1687                         break;
1688         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1689                 if (ignore_system_lyxrc ||
1690                     cursor_follows_scrollbar
1691                     != system_lyxrc.cursor_follows_scrollbar) {
1692                         os << "\\cursor_follows_scrollbar "
1693                            << convert<string>(cursor_follows_scrollbar) << '\n';
1694                 }
1695                 if (tag != RC_LAST)
1696                         break;
1697         case RC_SCROLL_BELOW_DOCUMENT:
1698                 if (ignore_system_lyxrc ||
1699                     scroll_below_document
1700                     != system_lyxrc.scroll_below_document) {
1701                         os << "\\scroll_below_document "
1702                            << convert<string>(scroll_below_document) << '\n';
1703                 }
1704                 if (tag != RC_LAST)
1705                         break;
1706         case RC_PARAGRAPH_MARKERS:
1707                 if (ignore_system_lyxrc ||
1708                         paragraph_markers
1709                     != system_lyxrc.paragraph_markers) {
1710                         os << "\\paragraph_markers "
1711                            << convert<string>(paragraph_markers) << '\n';
1712                 }
1713                 if (tag != RC_LAST)
1714                         break;
1715         case RC_MAC_LIKE_WORD_MOVEMENT:
1716                 if (ignore_system_lyxrc ||
1717                     mac_like_word_movement
1718                     != system_lyxrc.mac_like_word_movement) {
1719                         os << "\\mac_like_word_movement "
1720                            << convert<string>(mac_like_word_movement) << '\n';
1721                 }
1722                 if (tag != RC_LAST)
1723                         break;
1724         case RC_MACRO_EDIT_STYLE:
1725                 if (ignore_system_lyxrc ||
1726                     macro_edit_style
1727                     != system_lyxrc.macro_edit_style) {
1728                         os << "\\macro_edit_style ";
1729                         switch (macro_edit_style) {
1730                         case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1731                         case MACRO_EDIT_INLINE: os << "1\n"; break;
1732                         case MACRO_EDIT_LIST: os << "2\n"; break;
1733                         }
1734                 }
1735                 if (tag != RC_LAST)
1736                         break;
1737         case RC_DIALOGS_ICONIFY_WITH_MAIN:
1738                 if (ignore_system_lyxrc ||
1739                     dialogs_iconify_with_main
1740                    != system_lyxrc.dialogs_iconify_with_main) {
1741                         os << "\\dialogs_iconify_with_main "
1742                           <<  convert<string>(dialogs_iconify_with_main) << '\n';
1743                 }
1744                 if (tag != RC_LAST)
1745                         break;
1746         case RC_SCREEN_FONT_ROMAN:
1747                 if (ignore_system_lyxrc ||
1748                     roman_font_name != system_lyxrc.roman_font_name) {
1749                         os << "\\screen_font_roman \"" << roman_font_name
1750                            << "\"\n";
1751                 }
1752                 if (tag != RC_LAST)
1753                         break;
1754         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1755                 if (ignore_system_lyxrc ||
1756                     roman_font_foundry != system_lyxrc.roman_font_foundry) {
1757                         os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1758                            << "\"\n";
1759                 }
1760                 if (tag != RC_LAST)
1761                         break;
1762         case RC_SCREEN_FONT_SANS:
1763                 if (ignore_system_lyxrc ||
1764                     sans_font_name != system_lyxrc.sans_font_name) {
1765                         os << "\\screen_font_sans \"" << sans_font_name
1766                            << "\"\n";
1767                 }
1768                 if (tag != RC_LAST)
1769                         break;
1770         case RC_SCREEN_FONT_SANS_FOUNDRY:
1771                 if (ignore_system_lyxrc ||
1772                     sans_font_foundry != system_lyxrc.sans_font_foundry) {
1773                         os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1774                            << "\"\n";
1775                 }
1776                 if (tag != RC_LAST)
1777                         break;
1778         case RC_SCREEN_FONT_TYPEWRITER:
1779                 if (ignore_system_lyxrc ||
1780                     typewriter_font_name != system_lyxrc.typewriter_font_name) {
1781                         os << "\\screen_font_typewriter \""
1782                            << typewriter_font_name << "\"\n";
1783                 }
1784                 if (tag != RC_LAST)
1785                         break;
1786         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1787                 if (ignore_system_lyxrc ||
1788                     typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1789                         os << "\\screen_font_typewriter_foundry \""
1790                            << typewriter_font_foundry << "\"\n";
1791                 }
1792                 if (tag != RC_LAST)
1793                         break;
1794
1795         case RC_SCREEN_FONT_SCALABLE:
1796                 if (ignore_system_lyxrc ||
1797                     use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1798                         os << "\\screen_font_scalable "
1799                            << convert<string>(use_scalable_fonts)
1800                            << '\n';
1801                 }
1802                 if (tag != RC_LAST)
1803                         break;
1804         case RC_SCREEN_FONT_SIZES:
1805                 if (ignore_system_lyxrc ||
1806                     font_sizes[FONT_SIZE_TINY]
1807                     != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1808                     font_sizes[FONT_SIZE_SCRIPT]
1809                     != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1810                     font_sizes[FONT_SIZE_FOOTNOTE]
1811                     != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1812                     font_sizes[FONT_SIZE_SMALL]
1813                     != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1814                     font_sizes[FONT_SIZE_NORMAL]
1815                     != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1816                     font_sizes[FONT_SIZE_LARGE]
1817                     != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1818                     font_sizes[FONT_SIZE_LARGER]
1819                     != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1820                     font_sizes[FONT_SIZE_LARGEST]
1821                     != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1822                     font_sizes[FONT_SIZE_HUGE]
1823                     != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1824                     font_sizes[FONT_SIZE_HUGER]
1825                     != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1826                         os.setf(ios::fixed);
1827                         os.precision(2);
1828                         os << "\\screen_font_sizes"
1829                            << ' ' << font_sizes[FONT_SIZE_TINY]
1830                            << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1831                            << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1832                            << ' ' << font_sizes[FONT_SIZE_SMALL]
1833                            << ' ' << font_sizes[FONT_SIZE_NORMAL]
1834                            << ' ' << font_sizes[FONT_SIZE_LARGE]
1835                            << ' ' << font_sizes[FONT_SIZE_LARGER]
1836                            << ' ' << font_sizes[FONT_SIZE_LARGEST]
1837                            << ' ' << font_sizes[FONT_SIZE_HUGE]
1838                            << ' ' << font_sizes[FONT_SIZE_HUGER]
1839                            << '\n';
1840                 }
1841                 if (tag != RC_LAST)
1842                         break;
1843         case RC_FULL_SCREEN_LIMIT:
1844                 if (ignore_system_lyxrc ||
1845                     full_screen_limit != system_lyxrc.full_screen_limit) {
1846                         os << "\\fullscreen_limit "
1847                            << convert<string>(full_screen_limit)
1848                            << '\n';
1849                 }
1850                 if (tag != RC_LAST)
1851                         break;
1852         case RC_FULL_SCREEN_TOOLBARS:
1853                 if (ignore_system_lyxrc ||
1854                     full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1855                         os << "\\fullscreen_toolbars "
1856                            << convert<string>(full_screen_toolbars)
1857                            << '\n';
1858                 }
1859                 if (tag != RC_LAST)
1860                         break;
1861         case RC_FULL_SCREEN_SCROLLBAR:
1862                 if (ignore_system_lyxrc ||
1863                     full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1864                         os << "\\fullscreen_scrollbar "
1865                            << convert<string>(full_screen_scrollbar)
1866                            << '\n';
1867                 }
1868                 if (tag != RC_LAST)
1869                         break;
1870         case RC_FULL_SCREEN_TABBAR:
1871                 if (ignore_system_lyxrc ||
1872                     full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1873                         os << "\\fullscreen_tabbar "
1874                            << convert<string>(full_screen_tabbar)
1875                            << '\n';
1876                 }
1877                 if (tag != RC_LAST)
1878                         break;
1879         case RC_FULL_SCREEN_MENUBAR:
1880                 if (ignore_system_lyxrc ||
1881                     full_screen_menubar != system_lyxrc.full_screen_menubar) {
1882                         os << "\\fullscreen_menubar "
1883                            << convert<string>(full_screen_menubar)
1884                            << '\n';
1885                 }
1886                 if (tag != RC_LAST)
1887                         break;
1888         case RC_FULL_SCREEN_WIDTH:
1889                 if (ignore_system_lyxrc ||
1890                     full_screen_width != system_lyxrc.full_screen_width) {
1891                         os << "\\fullscreen_width "
1892                            << convert<string>(full_screen_width)
1893                            << '\n';
1894                 }
1895                 if (tag != RC_LAST)
1896                         break;
1897         case RC_OPEN_BUFFERS_IN_TABS:
1898                 if (ignore_system_lyxrc ||
1899                     open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1900                         os << "\\open_buffers_in_tabs "
1901                            << convert<string>(open_buffers_in_tabs)
1902                            << '\n';
1903                 }
1904                 if (tag != RC_LAST)
1905                         break;
1906         case RC_SINGLE_CLOSE_TAB_BUTTON:
1907                 if (ignore_system_lyxrc ||
1908                     single_close_tab_button != system_lyxrc.single_close_tab_button) {
1909                         os << "\\single_close_tab_button "
1910                            << convert<string>(single_close_tab_button)
1911                            << '\n';
1912                 }
1913                 if (tag != RC_LAST)
1914                         break;
1915         case RC_FORWARD_SEARCH_DVI:
1916                 if (ignore_system_lyxrc ||
1917                     forward_search_dvi != system_lyxrc.forward_search_dvi) {
1918                         os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
1919                 }
1920                 if (tag != RC_LAST)
1921                         break;
1922         case RC_FORWARD_SEARCH_PDF:
1923                 if (ignore_system_lyxrc ||
1924                     forward_search_pdf != system_lyxrc.forward_search_pdf) {
1925                         os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
1926                 }
1927                 if (tag != RC_LAST)
1928                         break;
1929
1930         os << "\n#\n"
1931                         << "# COLOR SECTION ###################################\n"
1932                         << "#\n\n";
1933
1934         case RC_SET_COLOR:
1935                 for (int i = 0; i < Color_ignore; ++i) {
1936                         ColorCode lc = static_cast<ColorCode>(i);
1937                         string const col = lcolor.getX11Name(lc);
1938                         if (ignore_system_lyxrc
1939                             || col != system_lcolor.getX11Name(lc)) {
1940                                 os << "\\set_color \""
1941                                    << lcolor.getLyXName(lc) << "\" \""
1942                                    << col << "\"\n";
1943                         }
1944                 }
1945                 if (tag != RC_LAST)
1946                         break;
1947
1948                 os << "\n#\n"
1949                    << "# PRINTER SECTION ###################################\n"
1950                    << "#\n\n";
1951
1952         case RC_PRINTER:
1953                 if (ignore_system_lyxrc ||
1954                     printer != system_lyxrc.printer) {
1955                         os << "\\printer \"" << printer << "\"\n";
1956                 }
1957                 if (tag != RC_LAST)
1958                         break;
1959         case RC_PRINT_ADAPTOUTPUT:
1960                 if (ignore_system_lyxrc ||
1961                     print_adapt_output != system_lyxrc.print_adapt_output) {
1962                         os << "\\print_adapt_output "
1963                            << convert<string>(print_adapt_output)
1964                            << '\n';
1965                 }
1966                 if (tag != RC_LAST)
1967                         break;
1968         case RC_PRINT_COMMAND:
1969                 if (ignore_system_lyxrc ||
1970                     print_command != system_lyxrc.print_command) {
1971                         os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
1972                 }
1973                 if (tag != RC_LAST)
1974                         break;
1975         case RC_PRINTEXSTRAOPTIONS:
1976                 if (ignore_system_lyxrc ||
1977                     print_extra_options != system_lyxrc.print_extra_options) {
1978                         os << "\\print_extra_options \"" << print_extra_options
1979                            << "\"\n";
1980                 }
1981                 if (tag != RC_LAST)
1982                         break;
1983         case RC_PRINTSPOOL_COMMAND:
1984                 if (ignore_system_lyxrc ||
1985                     print_spool_command != system_lyxrc.print_spool_command) {
1986                         os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
1987                            << "\"\n";
1988                 }
1989                 if (tag != RC_LAST)
1990                         break;
1991         case RC_PRINTSPOOL_PRINTERPREFIX:
1992                 if (ignore_system_lyxrc ||
1993                     print_spool_printerprefix
1994                     != system_lyxrc.print_spool_printerprefix) {
1995                         os << "\\print_spool_printerprefix \""
1996                            << print_spool_printerprefix << "\"\n";
1997                 }
1998                 if (tag != RC_LAST)
1999                         break;
2000         case RC_PRINTEVENPAGEFLAG:
2001                 if (ignore_system_lyxrc ||
2002                     print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
2003                         os << "\\print_evenpage_flag \"" << print_evenpage_flag
2004                            << "\"\n";
2005                 }
2006                 if (tag != RC_LAST)
2007                         break;
2008         case RC_PRINTODDPAGEFLAG:
2009                 if (ignore_system_lyxrc ||
2010                     print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
2011                         os << "\\print_oddpage_flag \"" << print_oddpage_flag
2012                            << "\"\n";
2013                 }
2014                 if (tag != RC_LAST)
2015                         break;
2016         case RC_PRINTREVERSEFLAG:
2017                 if (ignore_system_lyxrc ||
2018                     print_reverse_flag != system_lyxrc.print_reverse_flag) {
2019                         os << "\\print_reverse_flag \"" << print_reverse_flag
2020                            << "\"\n";
2021                 }
2022                 if (tag != RC_LAST)
2023                         break;
2024         case RC_PRINTLANDSCAPEFLAG:
2025                 if (ignore_system_lyxrc ||
2026                     print_landscape_flag != system_lyxrc.print_landscape_flag) {
2027                         os << "\\print_landscape_flag \"" << print_landscape_flag
2028                            << "\"\n";
2029                 }
2030                 if (tag != RC_LAST)
2031                         break;
2032         case RC_PRINTPAGERANGEFLAG:
2033                 if (ignore_system_lyxrc ||
2034                     print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
2035                         os << "\\print_pagerange_flag \"" << print_pagerange_flag
2036                            << "\"\n";
2037                 }
2038                 if (tag != RC_LAST)
2039                         break;
2040         case RC_PRINTCOPIESFLAG:
2041                 if (ignore_system_lyxrc ||
2042                     print_copies_flag != system_lyxrc.print_copies_flag) {
2043                         os << "\\print_copies_flag \"" << print_copies_flag
2044                            << "\"\n";
2045                 }
2046                 if (tag != RC_LAST)
2047                         break;
2048         case RC_PRINTCOLLCOPIESFLAG:
2049                 if (ignore_system_lyxrc ||
2050                     print_collcopies_flag
2051                     != system_lyxrc.print_collcopies_flag) {
2052                         os << "\\print_collcopies_flag \""
2053                            << print_collcopies_flag
2054                            << "\"\n";
2055                 }
2056                 if (tag != RC_LAST)
2057                         break;
2058         case RC_PRINTPAPERFLAG:
2059                 if (ignore_system_lyxrc ||
2060                     print_paper_flag != system_lyxrc.print_paper_flag) {
2061                         os << "\\print_paper_flag \"" << print_paper_flag
2062                            << "\"\n";
2063                 }
2064                 if (tag != RC_LAST)
2065                         break;
2066         case RC_PRINTPAPERDIMENSIONFLAG:
2067                 if (ignore_system_lyxrc ||
2068                     print_paper_dimension_flag
2069                     != system_lyxrc.print_paper_dimension_flag) {
2070                         os << "\\print_paper_dimension_flag \""
2071                            << print_paper_dimension_flag << "\"\n";
2072                 }
2073                 if (tag != RC_LAST)
2074                         break;
2075         case RC_PRINTTOPRINTER:
2076                 if (ignore_system_lyxrc ||
2077                     print_to_printer != system_lyxrc.print_to_printer) {
2078                         os << "\\print_to_printer \"" << print_to_printer
2079                            << "\"\n";
2080                 }
2081                 if (tag != RC_LAST)
2082                         break;
2083         case RC_PRINTTOFILE:
2084                 if (ignore_system_lyxrc ||
2085                     print_to_file != system_lyxrc.print_to_file) {
2086                         string const path = os::external_path(print_to_file);
2087                         os << "\\print_to_file \"" << path << "\"\n";
2088                 }
2089                 if (tag != RC_LAST)
2090                         break;
2091         case RC_PRINTFILEEXTENSION:
2092                 if (ignore_system_lyxrc ||
2093                     print_file_extension != system_lyxrc.print_file_extension) {
2094                         os << "\\print_file_extension \""
2095                            << print_file_extension
2096                            << "\"\n";
2097                 }
2098                 if (tag != RC_LAST)
2099                         break;
2100
2101                 os << "\n#\n"
2102                    << "# TEX SECTION #######################################\n"
2103                    << "#\n\n";
2104
2105         case RC_FONT_ENCODING:
2106                 if (ignore_system_lyxrc ||
2107                     fontenc != system_lyxrc.fontenc) {
2108                         os << "\\font_encoding \"" << fontenc << "\"\n";
2109                 }
2110                 if (tag != RC_LAST)
2111                         break;
2112
2113                 os << "\n#\n"
2114                    << "# FILE SECTION ######################################\n"
2115                    << "#\n\n";
2116
2117         case RC_DOCUMENTPATH:
2118                 if (ignore_system_lyxrc ||
2119                     document_path != system_lyxrc.document_path) {
2120                         string const path = os::external_path(document_path);
2121                         os << "\\document_path \"" << path << "\"\n";
2122                 }
2123                 if (tag != RC_LAST)
2124                         break;
2125         case RC_USELASTFILEPOS:
2126                 if (ignore_system_lyxrc ||
2127                     use_lastfilepos != system_lyxrc.use_lastfilepos) {
2128                         os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2129                            << '\n';
2130                 }
2131                 if (tag != RC_LAST)
2132                         break;
2133         case RC_LOADSESSION:
2134                 if (ignore_system_lyxrc ||
2135                     load_session != system_lyxrc.load_session) {
2136                         os << "\\load_session " << convert<string>(load_session)
2137                            << "\n";
2138                 }
2139                 if (tag != RC_LAST)
2140                         break;
2141         case RC_MOUSE_WHEEL_SPEED:
2142                 if (ignore_system_lyxrc ||
2143                     mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2144                         os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2145                 }
2146                 if (tag != RC_LAST)
2147                         break;
2148         case RC_COMPLETION_INLINE_DELAY:
2149                 if (ignore_system_lyxrc ||
2150                     completion_inline_delay != system_lyxrc.completion_inline_delay) {
2151                         os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2152                 }
2153                 if (tag != RC_LAST)
2154                         break;
2155         case RC_COMPLETION_INLINE_MATH:
2156                 if (ignore_system_lyxrc ||
2157                     completion_inline_math != system_lyxrc.completion_inline_math) {
2158                         os << "\\completion_inline_math "
2159                                 << convert<string>(completion_inline_math) << '\n';
2160                 }
2161                 if (tag != RC_LAST)
2162                         break;
2163         case RC_COMPLETION_INLINE_TEXT:
2164                 if (ignore_system_lyxrc ||
2165                     completion_inline_text != system_lyxrc.completion_inline_text) {
2166                         os << "\\completion_inline_text "
2167                                 << convert<string>(completion_inline_text) << '\n';
2168                 }
2169                 if (tag != RC_LAST)
2170                         break;
2171         case RC_COMPLETION_INLINE_DOTS:
2172                 if (ignore_system_lyxrc ||
2173                     completion_inline_dots != system_lyxrc.completion_inline_dots) {
2174                         os << "\\completion_inline_dots "
2175                                 << convert<string>(completion_inline_dots) << '\n';
2176                 }
2177                 if (tag != RC_LAST)
2178                         break;
2179         case RC_AUTOCORRECTION_MATH:
2180                 if (ignore_system_lyxrc ||
2181                     autocorrection_math != system_lyxrc.autocorrection_math) {
2182                         os << "\\autocorrection_math "
2183                                 << convert<string>(autocorrection_math) << '\n';
2184                 }
2185                 if (tag != RC_LAST)
2186                         break;
2187         case RC_COMPLETION_POPUP_DELAY:
2188                 if (ignore_system_lyxrc ||
2189                     completion_popup_delay != system_lyxrc.completion_popup_delay) {
2190                         os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2191                 }
2192                 if (tag != RC_LAST)
2193                         break;
2194         case RC_COMPLETION_POPUP_MATH:
2195                 if (ignore_system_lyxrc ||
2196                     completion_popup_math != system_lyxrc.completion_popup_math) {
2197                         os << "\\completion_popup_math "
2198                                 << convert<string>(completion_popup_math) << '\n';
2199                 }
2200                 if (tag != RC_LAST)
2201                         break;
2202         case RC_COMPLETION_POPUP_TEXT:
2203                 if (ignore_system_lyxrc ||
2204                     completion_popup_text != system_lyxrc.completion_popup_text) {
2205                         os << "\\completion_popup_text "
2206                                 << convert<string>(completion_popup_text) << '\n';
2207                 }
2208                 if (tag != RC_LAST)
2209                         break;
2210         case RC_COMPLETION_CURSOR_TEXT:
2211                 if (ignore_system_lyxrc ||
2212                     completion_cursor_text != system_lyxrc.completion_cursor_text) {
2213                         os << "\\completion_cursor_text "
2214                            << convert<string>(completion_cursor_text) << '\n';
2215                 }
2216                 if (tag != RC_LAST)
2217                         break;
2218         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2219                 if (ignore_system_lyxrc ||
2220                     completion_popup_after_complete
2221                     != system_lyxrc.completion_popup_after_complete) {
2222                         os << "\\completion_popup_after_complete "
2223                                 << convert<string>(completion_popup_after_complete) << '\n';
2224                 }
2225                 if (tag != RC_LAST)
2226                         break;
2227         case RC_NUMLASTFILES:
2228                 if (ignore_system_lyxrc ||
2229                     num_lastfiles != system_lyxrc.num_lastfiles) {
2230                         os << "\\num_lastfiles " << num_lastfiles << '\n';
2231                 }
2232                 if (tag != RC_LAST)
2233                         break;
2234         case RC_CHECKLASTFILES:
2235                 if (ignore_system_lyxrc ||
2236                     check_lastfiles != system_lyxrc.check_lastfiles) {
2237                         os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2238                            << '\n';
2239                 }
2240                 if (tag != RC_LAST)
2241                         break;
2242         case RC_EXAMPLEPATH:
2243                 if (ignore_system_lyxrc ||
2244                     example_path != system_lyxrc.example_path) {
2245                         string const path = os::external_path(example_path);
2246                         os << "\\example_path \"" << path << "\"\n";
2247                 }
2248                 if (tag != RC_LAST)
2249                         break;
2250         case RC_TEMPLATEPATH:
2251                 if (ignore_system_lyxrc ||
2252                     template_path != system_lyxrc.template_path) {
2253                         string const path = os::external_path(template_path);
2254                         os << "\\template_path \"" << path << "\"\n";
2255                 }
2256                 if (tag != RC_LAST)
2257                         break;
2258         case RC_TEMPDIRPATH:
2259                 if (ignore_system_lyxrc ||
2260                     tempdir_path != system_lyxrc.tempdir_path) {
2261                         string const path = os::external_path(tempdir_path);
2262                         os << "\\tempdir_path \"" << path << "\"\n";
2263                 }
2264                 if (tag != RC_LAST)
2265                         break;
2266         case RC_THESAURUSDIRPATH:
2267                 if (ignore_system_lyxrc ||
2268                     thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2269                         string const path = os::external_path(thesaurusdir_path);
2270                         os << "\\thesaurusdir_path \"" << path << "\"\n";
2271                 }
2272                 if (tag != RC_LAST)
2273                         break;
2274         case RC_HUNSPELLDIR_PATH:
2275                 if (ignore_system_lyxrc ||
2276                     hunspelldir_path != system_lyxrc.hunspelldir_path) {
2277                         string const path = os::external_path(hunspelldir_path);
2278                         os << "\\hunspelldir_path \"" << path << "\"\n";
2279                 }
2280                 if (tag != RC_LAST)
2281                         break;
2282         case RC_USETEMPDIR:
2283                 if (tag != RC_LAST)
2284                         break;
2285                 // Ignore it
2286         case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 2.0
2287                 if (tag != RC_LAST)
2288                         break;
2289         case RC_PLAINTEXT_LINELEN:
2290                 if (ignore_system_lyxrc ||
2291                     plaintext_linelen != system_lyxrc.plaintext_linelen) {
2292                         os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2293                 }
2294                 if (tag != RC_LAST)
2295                         break;
2296         case RC_MAKE_BACKUP:
2297                 if (ignore_system_lyxrc ||
2298                     make_backup != system_lyxrc.make_backup) {
2299                         os << "\\make_backup " << convert<string>(make_backup) << '\n';
2300                 }
2301                 if (tag != RC_LAST)
2302                         break;
2303         case RC_SAVE_COMPRESSED:
2304                 if (ignore_system_lyxrc ||
2305                     save_compressed != system_lyxrc.save_compressed) {
2306                         os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2307                 }
2308                 if (tag != RC_LAST)
2309                         break;
2310         case RC_BACKUPDIR_PATH:
2311                 if (ignore_system_lyxrc ||
2312                     backupdir_path != system_lyxrc.backupdir_path) {
2313                         string const path = os::external_path(backupdir_path);
2314                         os << "\\backupdir_path \"" << path << "\"\n";
2315                 }
2316                 if (tag != RC_LAST)
2317                         break;
2318
2319                 os << "\n#\n"
2320                    << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2321                    << "#\n\n";
2322
2323                 os << "\n#\n"
2324                    << "# SPELLCHECKER SECTION ##############################\n"
2325                    << "#\n\n";
2326
2327         case RC_SPELL_COMMAND:
2328         case RC_USE_SPELL_LIB:
2329                 // Obsoleted in 2.0
2330                 if (tag != RC_LAST)
2331                         break;
2332         case RC_ACCEPT_COMPOUND:
2333                 if (ignore_system_lyxrc ||
2334                     spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2335                         os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2336                            << '\n';
2337                 }
2338                 if (tag != RC_LAST)
2339                         break;
2340         case RC_USE_ALT_LANG:
2341                 // Obsoleted in 2.0
2342                 if (tag != RC_LAST)
2343                         break;
2344         case RC_ALT_LANG:
2345                 if (ignore_system_lyxrc ||
2346                     spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2347                         os << "\\alternate_language \"" << spellchecker_alt_lang
2348                            << "\"\n";
2349                 }
2350                 if (tag != RC_LAST)
2351                         break;
2352         case RC_USE_ESC_CHARS:
2353                 if (tag != RC_LAST)
2354                         break;
2355         case RC_ESC_CHARS:
2356                 if (ignore_system_lyxrc ||
2357                     spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2358                         os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2359                 }
2360                 if (tag != RC_LAST)
2361                         break;
2362         case RC_USE_PERS_DICT:
2363                 // obsoleted in 2.0
2364                 if (tag != RC_LAST)
2365                         break;
2366         case RC_USE_TOOLTIP:
2367                 if (ignore_system_lyxrc ||
2368                     use_tooltip != system_lyxrc.use_tooltip) {
2369                         os << "\\use_tooltip "
2370                            << convert<string>(use_tooltip)
2371                            << '\n';
2372                 }
2373                 if (tag != RC_LAST)
2374                         break;
2375         case RC_USE_PIXMAP_CACHE:
2376                 if (ignore_system_lyxrc ||
2377                     use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2378                         os << "\\use_pixmap_cache "
2379                            << convert<string>(use_pixmap_cache)
2380                            << '\n';
2381                 }
2382                 if (tag != RC_LAST)
2383                         break;
2384         case RC_PERS_DICT:
2385                 // obsoleted in 2.0
2386                 if (tag != RC_LAST)
2387                         break;
2388         case RC_USE_INP_ENC:
2389                 // obsoleted in 2.0
2390                 if (tag != RC_LAST)
2391                         break;
2392
2393                 os << "\n#\n"
2394                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
2395                    << "#\n\n";
2396                 if (tag != RC_LAST)
2397                         break;
2398
2399         case RC_DEFAULT_DECIMAL_POINT:
2400                 if (ignore_system_lyxrc ||
2401                     default_decimal_point != system_lyxrc.default_decimal_point) {
2402                         os << "\\default_decimal_point " << default_decimal_point << '\n';
2403                 }
2404                 if (tag != RC_LAST)
2405                         break;
2406
2407         case RC_SPELLCHECKER:
2408                 if (ignore_system_lyxrc ||
2409                     spellchecker != system_lyxrc.spellchecker) {
2410                         os << "\\spellchecker " << spellchecker << '\n';
2411                 }
2412                 if (tag != RC_LAST)
2413                         break;
2414
2415         case RC_SPELLCHECK_CONTINUOUSLY:
2416                 if (ignore_system_lyxrc ||
2417                     spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2418                         os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2419                            << '\n';
2420                 }
2421                 if (tag != RC_LAST)
2422                         break;
2423
2424         case RC_SPELLCHECK_NOTES:
2425                 if (ignore_system_lyxrc ||
2426                     spellcheck_notes != system_lyxrc.spellcheck_notes) {
2427                         os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2428                            << '\n';
2429                 }
2430                 if (tag != RC_LAST)
2431                         break;
2432
2433         case RC_RTL_SUPPORT:
2434                 if (ignore_system_lyxrc ||
2435                     rtl_support != system_lyxrc.rtl_support) {
2436                         os << "\\rtl " << convert<string>(rtl_support) << '\n';
2437                 }
2438                 if (tag != RC_LAST)
2439                         break;
2440         case RC_VISUAL_CURSOR:
2441                 if (ignore_system_lyxrc ||
2442                         visual_cursor != system_lyxrc.visual_cursor) {
2443                         os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2444                 }
2445                 if (tag != RC_LAST)
2446                         break;
2447         case RC_LANGUAGE_PACKAGE:
2448                 if (ignore_system_lyxrc ||
2449                     language_package != system_lyxrc.language_package) {
2450                         os << "\\language_package \"" << language_package
2451                            << "\"\n";
2452                 }
2453                 if (tag != RC_LAST)
2454                         break;
2455         case RC_LANGUAGE_GLOBAL_OPTIONS:
2456                 if (ignore_system_lyxrc ||
2457                     language_global_options
2458                     != system_lyxrc.language_global_options) {
2459                         os << "\\language_global_options \""
2460                            << convert<string>(language_global_options)
2461                            << "\"\n";
2462                 }
2463                 if (tag != RC_LAST)
2464                         break;
2465         case RC_LANGUAGE_USE_BABEL:
2466                 if (ignore_system_lyxrc ||
2467                     language_use_babel != system_lyxrc.language_use_babel) {
2468                         os << "\\language_use_babel \""
2469                            << convert<string>(language_use_babel)
2470                            << "\"\n";
2471                 }
2472                 if (tag != RC_LAST)
2473                         break;
2474         case RC_LANGUAGE_COMMAND_BEGIN:
2475                 if (ignore_system_lyxrc ||
2476                     language_command_begin
2477                     != system_lyxrc.language_command_begin) {
2478                         os << "\\language_command_begin \""
2479                            << language_command_begin
2480                            << "\"\n";
2481                 }
2482                 if (tag != RC_LAST)
2483                         break;
2484         case RC_LANGUAGE_COMMAND_END:
2485                 if (ignore_system_lyxrc ||
2486                     language_command_end
2487                     != system_lyxrc.language_command_end) {
2488                         os << "\\language_command_end \"" << language_command_end
2489                            << "\"\n";
2490                 }
2491                 if (tag != RC_LAST)
2492                         break;
2493         case RC_LANGUAGE_COMMAND_LOCAL:
2494                 if (ignore_system_lyxrc ||
2495                     language_command_local
2496                     != system_lyxrc.language_command_local) {
2497                         os << "\\language_command_local \""
2498                            << language_command_local
2499                            << "\"\n";
2500                 }
2501                 if (tag != RC_LAST)
2502                         break;
2503         case RC_LANGUAGE_AUTO_BEGIN:
2504                 if (ignore_system_lyxrc ||
2505                     language_auto_begin != system_lyxrc.language_auto_begin) {
2506                         os << "\\language_auto_begin "
2507                            << convert<string>(language_auto_begin) << '\n';
2508                 }
2509                 if (tag != RC_LAST)
2510                         break;
2511         case RC_LANGUAGE_AUTO_END:
2512                 if (ignore_system_lyxrc ||
2513                     language_auto_end != system_lyxrc.language_auto_end) {
2514                         os << "\\language_auto_end "
2515                            << convert<string>(language_auto_end) << '\n';
2516                 }
2517                 if (tag != RC_LAST)
2518                         break;
2519         case RC_MARK_FOREIGN_LANGUAGE:
2520                 if (ignore_system_lyxrc ||
2521                     mark_foreign_language
2522                     != system_lyxrc.mark_foreign_language) {
2523                         os << "\\mark_foreign_language " <<
2524                                 convert<string>(mark_foreign_language) << '\n';
2525                 }
2526                 if (tag != RC_LAST)
2527                         break;
2528
2529                 os << "\n#\n"
2530                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
2531                    << "#\n\n";
2532
2533         case RC_AUTO_NUMBER:
2534                 if (ignore_system_lyxrc ||
2535                     auto_number != system_lyxrc.auto_number) {
2536                         os << "\\auto_number " << convert<string>(auto_number) << '\n';
2537                 }
2538                 if (tag != RC_LAST)
2539                         break;
2540         case RC_DEFAULT_LANGUAGE:
2541                 if (ignore_system_lyxrc ||
2542                     default_language != system_lyxrc.default_language) {
2543                         os << "\\default_language " << default_language << '\n';
2544                 }
2545                 if (tag != RC_LAST)
2546                         break;
2547         case RC_GUI_LANGUAGE:
2548                 if (ignore_system_lyxrc ||
2549                     gui_language != system_lyxrc.gui_language) {
2550                         os << "\\gui_language " << gui_language << '\n';
2551                 }
2552                 if (tag != RC_LAST)
2553                         break;
2554         case RC_EXPORT_OVERWRITE:
2555                 if (ignore_system_lyxrc ||
2556                     export_overwrite != system_lyxrc.export_overwrite) {
2557                         string status;
2558                         switch (export_overwrite) {
2559                         case NO_FILES:
2560                                 status = "ask";
2561                                 break;
2562                         case MAIN_FILE:
2563                                 status = "main";
2564                                 break;
2565                         case ALL_FILES:
2566                                 status = "all";
2567                                 break;
2568                         }
2569                         os << "\\export_overwrite " << status << '\n';
2570                 }
2571                 if (tag != RC_LAST)
2572                         break;
2573
2574                 os << "\n#\n"
2575                    << "# FORMATS SECTION ##########################\n"
2576                    << "#\n\n";
2577
2578         case RC_FORMAT:
2579                 // New/modified formats
2580                 for (Formats::const_iterator cit = formats.begin();
2581                      cit != formats.end(); ++cit) {
2582                         Format const * format =
2583                                 system_formats.getFormat(cit->name());
2584                         if (!format ||
2585                             format->extension() != cit->extension() ||
2586                             format->prettyname() != cit->prettyname() ||
2587                             format->shortcut() != cit->shortcut() ||
2588                             format->viewer() != cit->viewer() ||
2589                             format->editor() != cit->editor() ||
2590                             format->documentFormat() != cit->documentFormat() ||
2591                             format->vectorFormat() != cit->vectorFormat()) {
2592                                 os << "\\format \"" << cit->name() << "\" \""
2593                                    << cit->extension() << "\" \""
2594                                    << cit->prettyname() << "\" \""
2595                                    << cit->shortcut() << "\" \""
2596                                    << escapeCommand(cit->viewer()) << "\" \""
2597                                    << escapeCommand(cit->editor()) << "\" \"";
2598                                 vector<string> flags;
2599                                 if (cit->documentFormat())
2600                                         flags.push_back("document");
2601                                 if (cit->vectorFormat())
2602                                         flags.push_back("vector");
2603                                 os << getStringFromVector(flags);
2604                                 os << "\"\n";
2605                         }
2606                 }
2607
2608                 // Look for deleted formats
2609                 for (Formats::const_iterator cit = system_formats.begin();
2610                      cit != system_formats.end(); ++cit)
2611                         if (!formats.getFormat(cit->name()))
2612                                 os << "\\format \"" << cit->name()
2613                                    << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2614                 if (tag != RC_LAST)
2615                         break;
2616         case RC_VIEWER_ALTERNATIVES: {
2617                 Alternatives::const_iterator it = viewer_alternatives.begin();
2618                 Alternatives::const_iterator const en = viewer_alternatives.end();
2619                 Alternatives::const_iterator const sysend = 
2620                                 system_lyxrc.viewer_alternatives.end();
2621                 for (; it != en; ++it) {
2622                         string const & fmt = it->first;
2623                         CommandSet const & cmd = it->second;
2624                         CommandSet::const_iterator sit = cmd.begin();
2625                         CommandSet::const_iterator const sen = cmd.end();
2626                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ? 
2627                                         system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2628                                         system_lyxrc.viewer_alternatives.find(fmt);
2629                         for (; sit != sen; ++sit) {
2630                                 string const & cmd = *sit;
2631                                 if (ignore_system_lyxrc 
2632                                     || sysfmt == sysend               // format not found
2633                                          || sysfmt->second.count(cmd) == 0 // this command not found
2634                                    )
2635                                         os << "\\viewer_alternatives " << fmt << " " << cmd << "\n";
2636                         }
2637                 }
2638                 if (tag != RC_LAST)
2639                         break;
2640         }
2641         case RC_EDITOR_ALTERNATIVES: {
2642                 Alternatives::const_iterator it = editor_alternatives.begin();
2643                 Alternatives::const_iterator const en = editor_alternatives.end();
2644                 Alternatives::const_iterator const sysend = 
2645                                 system_lyxrc.editor_alternatives.end();
2646                 for (; it != en; ++it) {
2647                         string const & fmt = it->first;
2648                         CommandSet const & cmd = it->second;
2649                         CommandSet::const_iterator sit = cmd.begin();
2650                         CommandSet::const_iterator const sen = cmd.end();
2651                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ? 
2652                                         system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2653                                         system_lyxrc.editor_alternatives.find(fmt);
2654                         for (; sit != sen; ++sit) {
2655                                 string const & cmd = *sit;
2656                                 if (ignore_system_lyxrc 
2657                                     || sysfmt == sysend               // format not found
2658                                     || sysfmt->second.count(cmd) == 0 // this command not found
2659                                    )
2660                                         os << "\\editor_alternatives " << fmt << " " << cmd << "\n";
2661                         }
2662                 }
2663                 if (tag != RC_LAST)
2664                         break;
2665         }
2666         case RC_DEFAULT_VIEW_FORMAT:
2667                 if (ignore_system_lyxrc ||
2668                     default_view_format != system_lyxrc.default_view_format) {
2669                         os << "\\default_view_format " << default_view_format << '\n';
2670                 }
2671                 if (tag != RC_LAST)
2672                         break;
2673         case RC_VIEWER:
2674                 // Ignore it
2675                 if (tag != RC_LAST)
2676                         break;
2677
2678                 os << "\n#\n"
2679                    << "# CONVERTERS SECTION ##########################\n"
2680                    << "#\n\n";
2681
2682         case RC_CONVERTER:
2683                 // Look for new converters
2684                 for (Converters::const_iterator cit = theConverters().begin();
2685                      cit != theConverters().end(); ++cit) {
2686                         Converter const * converter =
2687                                 theSystemConverters().getConverter(cit->from,
2688                                                                cit->to);
2689                         if (!converter ||
2690                             converter->command != cit->command ||
2691                             converter->flags != cit->flags)
2692                                 os << "\\converter \"" << cit->from << "\" \""
2693                                    << cit->to << "\" \""
2694                                    << escapeCommand(cit->command) << "\" \""
2695                                    << cit->flags << "\"\n";
2696                 }
2697
2698                 // New/modifed converters
2699                 for (Converters::const_iterator cit = theSystemConverters().begin();
2700                      cit != theSystemConverters().end(); ++cit)
2701                         if (!theConverters().getConverter(cit->from, cit->to))
2702                                 os << "\\converter \"" << cit->from
2703                                    << "\" \"" << cit->to << "\" \"\" \"\"\n";
2704                 if (tag != RC_LAST)
2705                         break;
2706         
2707         case RC_COPIER:
2708                 if (tag == RC_LAST)
2709                         os << "\n#\n"
2710                            << "# COPIERS SECTION ##########################\n"
2711                            << "#\n\n";
2712
2713                 // Look for new movers
2714                 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2715                 Movers::const_iterator const sysend = theSystemMovers().end();
2716                 Movers::const_iterator it = theMovers().begin();
2717                 Movers::const_iterator end = theMovers().end();
2718
2719                 for (; it != end; ++it) {
2720                         Movers::const_iterator const sysit =
2721                                 find_if(sysbegin, sysend, SameMover(*it));
2722                         if (sysit == sysend) {
2723                                 string const & fmt = it->first;
2724                                 string const & command =
2725                                         it->second.command();
2726
2727                                 os << "\\copier " << fmt
2728                                    << " \"" << escapeCommand(command) << "\"\n";
2729                         }
2730                 }
2731                 if (tag != RC_LAST)
2732                         break;
2733
2734                 // We don't actually delete SpecialisedMover(s) from the
2735                 // map, just clear their 'command', so there's no need
2736                 // to test for anything else.
2737         }
2738
2739         os.flush();
2740 }
2741
2742
2743 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2744 {
2745         // Why the switch you might ask. It is a trick to ensure that all
2746         // the elements in the LyXRCTags enum is handled. As you can see
2747         // there are no breaks at all. So it is just a huge fall-through.
2748         // The nice thing is that we will get a warning from the compiler
2749         // if we forget an element.
2750         LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2751         switch (tag) {
2752         case LyXRC::RC_ACCEPT_COMPOUND:
2753         case LyXRC::RC_ALT_LANG:
2754         case LyXRC::RC_PLAINTEXT_LINELEN:
2755         case LyXRC::RC_PLAINTEXT_ROFF_COMMAND:
2756         case LyXRC::RC_AUTOCORRECTION_MATH:
2757         case LyXRC::RC_AUTOREGIONDELETE:
2758         case LyXRC::RC_AUTORESET_OPTIONS:
2759         case LyXRC::RC_AUTOSAVE:
2760         case LyXRC::RC_AUTO_NUMBER:
2761         case LyXRC::RC_BACKUPDIR_PATH:
2762         case LyXRC::RC_BIBTEX_ALTERNATIVES:
2763         case LyXRC::RC_BIBTEX_COMMAND:
2764         case LyXRC::RC_BINDFILE:
2765         case LyXRC::RC_CHECKLASTFILES:
2766         case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2767         case LyXRC::RC_COMPLETION_INLINE_DELAY:
2768         case LyXRC::RC_COMPLETION_INLINE_DOTS:
2769         case LyXRC::RC_COMPLETION_INLINE_MATH:
2770         case LyXRC::RC_COMPLETION_INLINE_TEXT:
2771         case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2772         case LyXRC::RC_COMPLETION_POPUP_DELAY:
2773         case LyXRC::RC_COMPLETION_POPUP_MATH:
2774         case LyXRC::RC_COMPLETION_POPUP_TEXT:
2775         case LyXRC::RC_USELASTFILEPOS:
2776         case LyXRC::RC_LOADSESSION:
2777         case LyXRC::RC_CHKTEX_COMMAND:
2778         case LyXRC::RC_CONVERTER:
2779         case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2780         case LyXRC::RC_COPIER:
2781         case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2782         case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2783         case LyXRC::RC_DATE_INSERT_FORMAT:
2784         case LyXRC::RC_DEFAULT_LANGUAGE:
2785         case LyXRC::RC_GUI_LANGUAGE:
2786         case LyXRC::RC_DEFAULT_PAPERSIZE:
2787         case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2788         case LyXRC::RC_DEFFILE:
2789         case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2790         case LyXRC::RC_DISPLAY_GRAPHICS:
2791         case LyXRC::RC_DOCUMENTPATH:
2792                 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2793                         FileName path(lyxrc_new.document_path);
2794                         if (path.exists() && path.isDirectory())
2795                                 package().document_dir() = FileName(lyxrc.document_path);
2796                 }
2797         case LyXRC::RC_EDITOR_ALTERNATIVES:
2798         case LyXRC::RC_ESC_CHARS:
2799         case LyXRC::RC_EXAMPLEPATH:
2800         case LyXRC::RC_FONT_ENCODING:
2801         case LyXRC::RC_FORMAT:
2802         case LyXRC::RC_GROUP_LAYOUTS:
2803         case LyXRC::RC_HUNSPELLDIR_PATH:
2804         case LyXRC::RC_INDEX_ALTERNATIVES:
2805         case LyXRC::RC_INDEX_COMMAND:
2806         case LyXRC::RC_JBIBTEX_COMMAND:
2807         case LyXRC::RC_JINDEX_COMMAND:
2808         case LyXRC::RC_NOMENCL_COMMAND:
2809         case LyXRC::RC_INPUT:
2810         case LyXRC::RC_KBMAP:
2811         case LyXRC::RC_KBMAP_PRIMARY:
2812         case LyXRC::RC_KBMAP_SECONDARY:
2813         case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2814         case LyXRC::RC_LANGUAGE_AUTO_END:
2815         case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2816         case LyXRC::RC_LANGUAGE_COMMAND_END:
2817         case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2818         case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2819         case LyXRC::RC_LANGUAGE_PACKAGE:
2820         case LyXRC::RC_LANGUAGE_USE_BABEL:
2821         case LyXRC::RC_MAC_LIKE_WORD_MOVEMENT:
2822         case LyXRC::RC_MACRO_EDIT_STYLE:
2823         case LyXRC::RC_MAKE_BACKUP:
2824         case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2825         case LyXRC::RC_MOUSE_WHEEL_SPEED:
2826         case LyXRC::RC_NUMLASTFILES:
2827         case LyXRC::RC_PARAGRAPH_MARKERS:
2828         case LyXRC::RC_PATH_PREFIX:
2829                 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2830                         prependEnvPath("PATH", lyxrc.path_prefix);
2831                 }
2832         case LyXRC::RC_PERS_DICT:
2833         case LyXRC::RC_PREVIEW:
2834         case LyXRC::RC_PREVIEW_HASHED_LABELS:
2835         case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2836         case LyXRC::RC_PRINTCOLLCOPIESFLAG:
2837         case LyXRC::RC_PRINTCOPIESFLAG:
2838         case LyXRC::RC_PRINTER:
2839         case LyXRC::RC_PRINTEVENPAGEFLAG:
2840         case LyXRC::RC_PRINTEXSTRAOPTIONS:
2841         case LyXRC::RC_PRINTFILEEXTENSION:
2842         case LyXRC::RC_PRINTLANDSCAPEFLAG:
2843         case LyXRC::RC_PRINTODDPAGEFLAG:
2844         case LyXRC::RC_PRINTPAGERANGEFLAG:
2845         case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
2846         case LyXRC::RC_PRINTPAPERFLAG:
2847         case LyXRC::RC_PRINTREVERSEFLAG:
2848         case LyXRC::RC_PRINTSPOOL_COMMAND:
2849         case LyXRC::RC_PRINTSPOOL_PRINTERPREFIX:
2850         case LyXRC::RC_PRINTTOFILE:
2851         case LyXRC::RC_PRINTTOPRINTER:
2852         case LyXRC::RC_PRINT_ADAPTOUTPUT:
2853         case LyXRC::RC_PRINT_COMMAND:
2854         case LyXRC::RC_RTL_SUPPORT:
2855         case LyXRC::RC_SAVE_COMPRESSED:
2856         case LyXRC::RC_SCREEN_DPI:
2857         case LyXRC::RC_SCREEN_FONT_ROMAN:
2858         case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
2859         case LyXRC::RC_SCREEN_FONT_SANS:
2860         case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
2861         case LyXRC::RC_SCREEN_FONT_SCALABLE:
2862         case LyXRC::RC_SCREEN_FONT_SIZES:
2863         case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
2864         case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2865         case LyXRC::RC_GEOMETRY_SESSION:
2866         case LyXRC::RC_SCREEN_ZOOM:
2867         case LyXRC::RC_SERVERPIPE:
2868         case LyXRC::RC_SET_COLOR:
2869         case LyXRC::RC_SHOW_BANNER:
2870         case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
2871         case LyXRC::RC_SPELL_COMMAND:
2872         case LyXRC::RC_SPELLCHECKER:
2873         case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
2874         case LyXRC::RC_SPELLCHECK_NOTES:
2875         case LyXRC::RC_SPLITINDEX_COMMAND:
2876         case LyXRC::RC_TEMPDIRPATH:
2877         case LyXRC::RC_TEMPLATEPATH:
2878         case LyXRC::RC_TEX_ALLOWS_SPACES:
2879         case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
2880                 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
2881                         os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
2882                 }
2883         case LyXRC::RC_THESAURUSDIRPATH:
2884         case LyXRC::RC_UIFILE:
2885         case LyXRC::RC_USER_EMAIL:
2886         case LyXRC::RC_USER_NAME:
2887         case LyXRC::RC_USETEMPDIR:
2888         case LyXRC::RC_USE_ALT_LANG:
2889         case LyXRC::RC_USE_CONVERTER_CACHE:
2890         case LyXRC::RC_USE_ESC_CHARS:
2891         case LyXRC::RC_USE_INP_ENC:
2892         case LyXRC::RC_USE_PERS_DICT:
2893         case LyXRC::RC_USE_TOOLTIP:
2894         case LyXRC::RC_USE_PIXMAP_CACHE:
2895         case LyXRC::RC_USE_SPELL_LIB:
2896         case LyXRC::RC_VIEWDVI_PAPEROPTION:
2897         case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
2898         case LyXRC::RC_SORT_LAYOUTS:
2899         case LyXRC::RC_FULL_SCREEN_LIMIT:
2900         case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
2901         case LyXRC::RC_FULL_SCREEN_MENUBAR:
2902         case LyXRC::RC_FULL_SCREEN_TABBAR:
2903         case LyXRC::RC_FULL_SCREEN_TOOLBARS:
2904         case LyXRC::RC_FULL_SCREEN_WIDTH:
2905         case LyXRC::RC_VISUAL_CURSOR:
2906         case LyXRC::RC_VIEWER:
2907         case LyXRC::RC_VIEWER_ALTERNATIVES:
2908         case LyXRC::RC_FORWARD_SEARCH_DVI:
2909         case LyXRC::RC_FORWARD_SEARCH_PDF:
2910         case LyXRC::RC_EXPORT_OVERWRITE:
2911         case LyXRC::RC_DEFAULT_DECIMAL_POINT:
2912         case LyXRC::RC_LAST:
2913                 break;
2914         }
2915 }
2916
2917
2918 #if 0
2919 string const LyXRC::getDescription(LyXRCTags tag)
2920 {
2921         docstring str;
2922
2923         switch (tag) {
2924         case RC_ACCEPT_COMPOUND:
2925                 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2926                 break;
2927
2928         case RC_ALT_LANG:
2929         case RC_USE_ALT_LANG:
2930                 str = _("Specify an alternate language. The default is to use the language of the document.");
2931                 break;
2932
2933         case RC_PLAINTEXT_ROFF_COMMAND:
2934                 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.");
2935                 break;
2936
2937         case RC_PLAINTEXT_LINELEN:
2938                 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.");
2939                 break;
2940
2941         case RC_AUTOREGIONDELETE:
2942                 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2943                 break;
2944
2945         case RC_AUTORESET_OPTIONS:
2946                 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2947                 break;
2948
2949         case RC_AUTOSAVE:
2950                 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2951                 break;
2952
2953         case RC_AUTO_NUMBER:
2954                 break;
2955
2956         case RC_BACKUPDIR_PATH:
2957                 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.");
2958                 break;
2959
2960         case RC_BIBTEX_COMMAND:
2961                 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2962                 break;
2963
2964         case RC_JBIBTEX_COMMAND:
2965                 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
2966                 break;
2967
2968         case RC_BINDFILE:
2969                 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2970                 break;
2971
2972         case RC_CHECKLASTFILES:
2973                 str = _("Select to check whether the lastfiles still exist.");
2974                 break;
2975
2976         case RC_CHKTEX_COMMAND:
2977                 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2978                 break;
2979
2980         case RC_CONVERTER:
2981                 break;
2982
2983         case RC_COPIER:
2984                 break;
2985
2986         case RC_CURSOR_FOLLOWS_SCROLLBAR:
2987                 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.");
2988                 break;
2989
2990         case RC_SCROLL_BELOW_DOCUMENT:
2991                 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");
2992                 break;
2993
2994         case RC_MAC_LIKE_WORD_MOVEMENT:
2995                 str = _("Use the Mac OS X conventions for the word-level cursor movement");
2996                 break;
2997
2998         case RC_SHOW_MACRO_LABEL:
2999                 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3000                 break;
3001
3002         case RC_DATE_INSERT_FORMAT:
3003                 //xgettext:no-c-format
3004                 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
3005                 break;
3006
3007         case RC_DEFFILE:
3008                 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3009                 break;
3010
3011         case RC_DEFAULT_VIEW_FORMAT:
3012                 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3013                 break;
3014
3015         case RC_DEFAULT_LANGUAGE:
3016                 str = _("New documents will be assigned this language.");
3017                 break;
3018
3019         case RC_DEFAULT_PAPERSIZE:
3020                 str = _("Specify the default paper size.");
3021                 break;
3022
3023         case RC_DIALOGS_ICONIFY_WITH_MAIN:
3024                 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3025                 break;
3026
3027         case RC_DISPLAY_GRAPHICS:
3028                 str = _("Select how LyX will display any graphics.");
3029                 break;
3030
3031         case RC_DOCUMENTPATH:
3032                 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3033                 break;
3034
3035         case RC_ESC_CHARS:
3036         case RC_USE_ESC_CHARS:
3037                 str = _("Specify additional chars that can be part of a word.");
3038                 break;
3039
3040         case RC_EXAMPLEPATH:
3041                 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3042                 break;
3043
3044         case RC_FONT_ENCODING:
3045                 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
3046                 break;
3047
3048         case RC_FORMAT:
3049                 break;
3050
3051         case RC_INDEX_COMMAND:
3052                 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\".");
3053                 break;
3054
3055         case RC_JINDEX_COMMAND:
3056                 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3057                 break;
3058
3059         case RC_NOMENCL_COMMAND:
3060                 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3061                 break;
3062
3063         case RC_INPUT:
3064                 break;
3065
3066         case RC_KBMAP:
3067         case RC_KBMAP_PRIMARY:
3068         case RC_KBMAP_SECONDARY:
3069                 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.");
3070                 break;
3071
3072         case RC_LANGUAGE_AUTO_BEGIN:
3073                 str = _("Select if a language switching command is needed at the beginning of the document.");
3074                 break;
3075
3076         case RC_LANGUAGE_AUTO_END:
3077                 str = _("Select if a language switching command is needed at the end of the document.");
3078                 break;
3079
3080         case RC_LANGUAGE_COMMAND_BEGIN:
3081                 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.");
3082                 break;
3083
3084         case RC_LANGUAGE_COMMAND_END:
3085                 str = _("The LaTeX command for changing back to the language of the document.");
3086                 break;
3087
3088         case RC_LANGUAGE_COMMAND_LOCAL:
3089                 str = _("The LaTeX command for local changing of the language.");
3090                 break;
3091
3092         case RC_LANGUAGE_GLOBAL_OPTIONS:
3093                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3094                 break;
3095
3096         case RC_LANGUAGE_PACKAGE:
3097                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3098                 break;
3099
3100         case RC_LANGUAGE_USE_BABEL:
3101                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3102                 break;
3103
3104         case RC_USELASTFILEPOS:
3105                 str = _("De-select if you do not want LyX to scroll to saved position.");
3106                 break;
3107
3108         case RC_LOADSESSION:
3109                 str = _("De-select to prevent loading files opened from the last LyX session.");
3110                 break;
3111
3112         case RC_MAKE_BACKUP:
3113                 str = _("De-select if you don't want LyX to create backup files.");
3114                 break;
3115
3116         case RC_MARK_FOREIGN_LANGUAGE:
3117                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3118                 break;
3119
3120         case RC_MOUSE_WHEEL_SPEED:
3121                 str = bformat(_("The scrolling speed of the mouse wheel."),
3122                       maxlastfiles);
3123                 break;
3124
3125         case RC_COMPLETION_POPUP_DELAY:
3126                 str = _("The completion popup delay.");
3127                 break;
3128
3129         case RC_COMPLETION_POPUP_MATH:
3130                 str = _("Select to display the completion popup in math mode.");
3131                 break;
3132
3133         case RC_COMPLETION_POPUP_TEXT:
3134                 str = _("Select to display the completion popup in text mode.");
3135                 break;
3136
3137         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3138                 str = _("Show the completion popup without delay after non-unique completion attempt.");
3139                 break;
3140
3141         case RC_COMPLETION_POPUP_TEXT:
3142                 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3143                 break;
3144
3145         case RC_COMPLETION_POPUP_DELAY:
3146                 str = _("The inline completion delay.");
3147                 break;
3148
3149         case RC_COMPLETION_INLINE_MATH:
3150                 str = _("Select to display the inline completion in math mode.");
3151                 break;
3152
3153         case RC_COMPLETION_INLINE_TEXT:
3154                 str = _("Select to display the inline completion in text mode.");
3155                 break;
3156
3157         case RC_COMPLETION_INLINE_DOTS:
3158                 str = _("Use \"...\" to shorten long completions.");
3159                 break;
3160
3161         case RC_AUTOCORRECTION_MATH:
3162                 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
3163                 break;
3164
3165         case RC_NUMLASTFILES:
3166                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3167                         maxlastfiles);
3168                 break;
3169
3170         case RC_PATH_PREFIX:
3171                 str = _("Specify those directories which should be "
3172                          "prepended to the PATH environment variable. "
3173                          "Use the OS native format.");
3174                 break;
3175
3176         case RC_PREVIEW:
3177                 str = _("Shows a typeset preview of things such as math");
3178                 break;
3179
3180         case RC_PREVIEW_HASHED_LABELS:
3181                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3182                 break;
3183
3184         case RC_PREVIEW_SCALE_FACTOR:
3185                 str = _("Scale the preview size to suit.");
3186                 break;
3187
3188         case RC_PRINTCOLLCOPIESFLAG:
3189                 str = _("The option for specifying whether the copies should be collated.");
3190                 break;
3191
3192         case RC_PRINTCOPIESFLAG:
3193                 str = _("The option for specifying the number of copies to print.");
3194                 break;
3195
3196         case RC_PRINTER:
3197                 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
3198                 break;
3199
3200         case RC_PRINTEVENPAGEFLAG:
3201                 str = _("The option to print only even pages.");
3202                 break;
3203
3204         case RC_PRINTEXSTRAOPTIONS:
3205                 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
3206                 break;
3207
3208         case RC_PRINTFILEEXTENSION:
3209                 str = _("Extension of printer program output file. Usually \".ps\".");
3210                 break;
3211
3212         case RC_PRINTLANDSCAPEFLAG:
3213                 str = _("The option to print out in landscape.");
3214                 break;
3215
3216         case RC_PRINTODDPAGEFLAG:
3217                 str = _("The option to print only odd pages.");
3218                 break;
3219
3220         case RC_PRINTPAGERANGEFLAG:
3221                 str = _("The option for specifying a comma-separated list of pages to print.");
3222                 break;
3223
3224         case RC_PRINTPAPERDIMENSIONFLAG:
3225                                    str = _("Option to specify the dimensions of the print paper.");
3226                 break;
3227
3228         case RC_PRINTPAPERFLAG:
3229                 str = _("The option to specify paper type.");
3230                 break;
3231
3232         case RC_PRINTREVERSEFLAG:
3233                 str = _("The option to reverse the order of the pages printed.");
3234                 break;
3235
3236         case RC_PRINTSPOOL_COMMAND:
3237                 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.");
3238                 break;
3239
3240         case RC_PRINTSPOOL_PRINTERPREFIX:
3241                 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.");
3242                 break;
3243
3244         case RC_PRINTTOFILE:
3245                 str = _("Option to pass to the print program to print to a file.");
3246                 break;
3247
3248         case RC_PRINTTOPRINTER:
3249                 str = _("Option to pass to the print program to print on a specific printer.");
3250                 break;
3251
3252         case RC_PRINT_ADAPTOUTPUT:
3253                 str = _("Select for LyX to pass the name of the destination printer to your print command.");
3254                 break;
3255
3256         case RC_PRINT_COMMAND:
3257                 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
3258                 break;
3259
3260         case RC_RTL_SUPPORT:
3261                 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
3262                 break;
3263
3264         case RC_VISUAL_CURSOR:
3265                 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3266                 break;
3267
3268         case RC_SCREEN_DPI:
3269                 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3270                 break;
3271
3272         case RC_SCREEN_FONT_ROMAN:
3273         case RC_SCREEN_FONT_SANS:
3274         case RC_SCREEN_FONT_TYPEWRITER:
3275                 str = _("The screen fonts used to display the text while editing.");
3276                 break;
3277
3278         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3279         case RC_SCREEN_FONT_SANS_FOUNDRY:
3280         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3281                 break;
3282
3283         case RC_SCREEN_FONT_SCALABLE:
3284                 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.");
3285                 break;
3286
3287         case RC_SCREEN_FONT_SIZES:
3288                 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3289                 break;
3290
3291         case RC_SCREEN_ZOOM:
3292                 //xgettext:no-c-format
3293                 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3294                 break;
3295
3296         case RC_GEOMETRY_SESSION:
3297                 str = _("Allow session manager to save and restore windows geometry.");
3298                 break;
3299
3300         case RC_SERVERPIPE:
3301                 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3302                 break;
3303
3304         case RC_SET_COLOR:
3305                 break;
3306
3307         case RC_SHOW_BANNER:
3308                 str = _("De-select if you don't want the startup banner.");
3309                 break;
3310
3311         case RC_TEMPDIRPATH:
3312                 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3313                 break;
3314
3315         case RC_THESAURUSDIRPATH:
3316                 str = _("This is the place where the files of the thesaurus library reside.");
3317                 break;
3318
3319         case RC_TEMPLATEPATH:
3320                 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3321                 break;
3322
3323         case RC_TEX_ALLOWS_SPACES:
3324                 break;
3325
3326         case RC_TEX_EXPECTS_WINDOWS_PATHS:
3327                 break;
3328
3329         case RC_UIFILE:
3330                 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3331                 break;
3332
3333         case RC_USER_EMAIL:
3334                 break;
3335
3336         case RC_USER_NAME:
3337                 break;
3338
3339         case RC_USETEMPDIR:
3340                 break;
3341
3342         case RC_USE_TOOLTIP:
3343                 str = _("Enable the automatic appearance of tool tips in the work area.");
3344                 break;
3345
3346         case RC_USE_PIXMAP_CACHE:
3347                 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
3348                 break;
3349
3350         case RC_USE_SPELL_LIB:
3351                 break;
3352
3353         case RC_VIEWDVI_PAPEROPTION:
3354                 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3355                 break;
3356
3357         case RC_VIEWER:
3358                 break;
3359
3360         case RC_LAST:
3361                 break;
3362         }
3363
3364         return str;
3365 }
3366 #endif
3367
3368
3369 // The global instance
3370 LyXRC lyxrc;
3371
3372 // The global copy of the system lyxrc entries (everything except preferences)
3373 LyXRC system_lyxrc;
3374
3375
3376 } // namespace lyx