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