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