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