]> git.lyx.org Git - lyx.git/blob - src/LyXRC.cpp
Whitespace.
[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         { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
115         { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
116         { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
117         { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
118         { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
119         { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
120         { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
121         { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
122         { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
123         { "\\load_session", LyXRC::RC_LOADSESSION },
124         { "\\mac_like_word_movement", LyXRC::RC_MAC_LIKE_WORD_MOVEMENT },
125         { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
126         { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
127         { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
128         { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
129         { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
130         { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
131         { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
132         { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
133         { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
134         { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
135         { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
136         { "\\plaintext_roff_command", LyXRC::RC_PLAINTEXT_ROFF_COMMAND },
137         { "\\preview", LyXRC::RC_PREVIEW },
138         { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
139         { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
140         { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
141         { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
142         { "\\print_command", LyXRC::RC_PRINT_COMMAND },
143         { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
144         { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
145         { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
146         { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
147         { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
148         { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
149         { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
150         { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
151         { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
152         { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
153         { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
154         { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
155         { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
156         { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
157         { "\\printer", LyXRC::RC_PRINTER },
158         { "\\rtl", LyXRC::RC_RTL_SUPPORT },
159         { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
160         { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
161         { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
162         { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
163         { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
164         { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
165         { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
166         { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
167         { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
168         { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
169         { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
170         { "\\serverpipe", LyXRC::RC_SERVERPIPE },
171         { "\\set_color", LyXRC::RC_SET_COLOR },
172         { "\\show_banner", LyXRC::RC_SHOW_BANNER },
173         { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
174         { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
175         { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
176         { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
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         use_kbmap = false;
290         rtl_support = true;
291         visual_cursor = false;
292         auto_number = true;
293         mark_foreign_language = true;
294         language_auto_begin = true;
295         language_auto_end = true;
296         language_global_options = true;
297         language_use_babel = true;
298         language_package = "\\usepackage{babel}";
299         language_command_begin = "\\selectlanguage{$$lang}";
300         language_command_local = "\\foreignlanguage{$$lang}{";
301         sort_layouts = false;
302         group_layouts = true;
303         default_language = "english";
304         gui_language = "auto";
305         show_banner = true;
306         windows_style_tex_paths = false;
307         tex_allows_spaces = false;
308         date_insert_format = "%x";
309         cursor_follows_scrollbar = false;
310         scroll_below_document = false;
311         paragraph_markers = false;
312         mac_like_word_movement = false;
313         macro_edit_style = MACRO_EDIT_INLINE_BOX;
314         dialogs_iconify_with_main = false;
315         label_init_length = 3;
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_MAKE_BACKUP:
919                         lexrc >> make_backup;
920                         break;
921                 case RC_BACKUPDIR_PATH:
922                         if (lexrc.next()) {
923                                 backupdir_path = os::internal_path(lexrc.getString());
924                                 backupdir_path = expandPath(backupdir_path);
925                         }
926                         break;
927                 case RC_DATE_INSERT_FORMAT:
928                         lexrc >> date_insert_format;
929                         break;
930                 case RC_LANGUAGE_PACKAGE:
931                         lexrc >> language_package;
932                         break;
933                 case RC_LANGUAGE_AUTO_BEGIN:
934                         lexrc >> language_auto_begin;
935                         break;
936                 case RC_LANGUAGE_AUTO_END:
937                         lexrc >> language_auto_end;
938                         break;
939                 case RC_LANGUAGE_GLOBAL_OPTIONS:
940                         lexrc >> language_global_options;
941                         break;
942                 case RC_LANGUAGE_USE_BABEL:
943                         lexrc >> language_use_babel;
944                         break;
945                 case RC_LANGUAGE_COMMAND_BEGIN:
946                         lexrc >> language_command_begin;
947                         break;
948                 case RC_LANGUAGE_COMMAND_END:
949                         lexrc >> language_command_end;
950                         break;
951                 case RC_LANGUAGE_COMMAND_LOCAL:
952                         lexrc >> language_command_local;
953                         break;
954                 case RC_RTL_SUPPORT:
955                         lexrc >> rtl_support;
956                         break;
957                 case RC_VISUAL_CURSOR:
958                         lexrc >> visual_cursor;
959                         break;
960                 case RC_AUTO_NUMBER:
961                         lexrc >> auto_number;
962                         break;
963                 case RC_MARK_FOREIGN_LANGUAGE:
964                         lexrc >> mark_foreign_language;
965                         break;
966
967                 case RC_COPIER: {
968                         string fmt, command;
969                         if (lexrc.next())
970                                 fmt = lexrc.getString();
971                         if (lexrc.next(true))
972                                 command = lexrc.getString();
973                         setMover(fmt, command);
974                         break;
975                 }
976
977                 case RC_CONVERTER: {
978                         string from, to, command, flags;
979                         if (lexrc.next())
980                                 from = lexrc.getString();
981                         if (lexrc.next())
982                                 to = lexrc.getString();
983                         if (lexrc.next(true))
984                                 command = lexrc.getString();
985                         if (lexrc.next())
986                                 flags = lexrc.getString();
987                         if (command.empty())
988                                 theConverters().erase(from, to);
989                         else
990                                 theConverters().add(from, to, command, flags);
991                         break;
992                 }
993                 // compatibility with versions older than 1.4.0 only
994                 case RC_VIEWER: {
995                         string format, command;
996                         lexrc >> format >> command;
997                         formats.setViewer(format, command);
998                         break;
999                 }
1000                 case RC_FORMAT: {
1001                         string format, extension, prettyname, shortcut;
1002                         lexrc >> format >> extension >> prettyname >> shortcut;
1003                         string viewer, editor;
1004                         if (lexrc.next(true))
1005                                 viewer = lexrc.getString();
1006                         if (lexrc.next(true))
1007                                 editor = lexrc.getString();
1008                         string flags;
1009                         // Hack to ensure compatibility with versions older
1010                         // than 1.5.0
1011                         int le = lexrc.lex();
1012                         if (le != Lexer::LEX_FEOF && le != Lexer::LEX_UNDEF) {
1013                                 flags = lexrc.getString();
1014                                 if (le != Lexer::LEX_DATA) {
1015                                         // We have got a known token.
1016                                         // Therefore this is an old style
1017                                         // format definition without
1018                                         // flags.
1019                                         lexrc.pushToken(flags);
1020                                         flags.erase();
1021                                 }
1022                         }
1023                         int flgs = Format::none;
1024                         while (!flags.empty()) {
1025                                 string flag;
1026                                 flags = split(flags, flag, ',');
1027                                 if (flag == "document")
1028                                         flgs |= Format::document;
1029                                 else if (flag == "vector")
1030                                         flgs |= Format::vector;
1031                                 else
1032                                         LYXERR0("Ignoring unknown flag `"
1033                                                << flag << "' for format `"
1034                                                << format << "'.");
1035                         }
1036                         if (prettyname.empty()) {
1037                                 if (theConverters().formatIsUsed(format))
1038                                         LYXERR0("Can't delete format " << format);
1039                                 else
1040                                         formats.erase(format);
1041                         } else {
1042                                 formats.add(format, extension, prettyname,
1043                                             shortcut, viewer, editor, flgs);
1044                         }
1045                         break;
1046                 }
1047                 case RC_VIEWER_ALTERNATIVES:  {
1048                         string format, command;
1049                         if (lexrc.next())
1050                                 format = lexrc.getString();
1051                         if (lexrc.eatLine())
1052                                 command = lexrc.getString();
1053                         viewer_alternatives[format].insert(command);
1054                         break;
1055                 }
1056                 case RC_EDITOR_ALTERNATIVES:  {
1057                         string format, command;
1058                         lexrc >> format >> command;
1059                         editor_alternatives[format].insert(command);
1060                         break;
1061                 }
1062
1063                 case RC_DEFAULT_VIEW_FORMAT:
1064                         lexrc >> default_view_format;
1065                         break;
1066                         
1067                 case RC_DEFAULT_LANGUAGE:
1068                         lexrc >> default_language;
1069                         break;
1070
1071                 case RC_GUI_LANGUAGE:
1072                         lexrc >> gui_language;
1073                         break;
1074
1075                 case RC_LABEL_INIT_LENGTH:
1076                         lexrc >> label_init_length;
1077                         break;
1078
1079                 case RC_SHOW_BANNER:
1080                         lexrc >> show_banner;
1081                         break;
1082
1083                 case RC_PREVIEW:
1084                         if (lexrc.next()) {
1085                                 string const tmp = lexrc.getString();
1086                                 if (tmp == "true" || tmp == "on")
1087                                         preview = PREVIEW_ON;
1088                                 else if (tmp == "no_math")
1089                                         preview = PREVIEW_NO_MATH;
1090                                 else {
1091                                         preview = PREVIEW_OFF;
1092                                         if (tmp != "false" && tmp != "off")
1093                                                 LYXERR0("Unrecognized preview status \""
1094                                                        << tmp << '\n');
1095                                 }
1096                         }
1097                         break;
1098
1099                 case RC_PREVIEW_HASHED_LABELS:
1100                         lexrc >> preview_hashed_labels;
1101                         break;
1102
1103                 case RC_PREVIEW_SCALE_FACTOR:
1104                         lexrc >> preview_scale_factor;
1105                         break;
1106
1107                 case RC_USER_NAME:
1108                         lexrc >> user_name;
1109                         break;
1110                 case RC_USER_EMAIL:
1111                         lexrc >> user_email;
1112                         break;
1113
1114                 case RC_PATH_PREFIX:
1115                         lexrc >> path_prefix;
1116                         break;
1117
1118                 case RC_USE_CONVERTER_CACHE:
1119                         lexrc >> use_converter_cache;
1120                         break;
1121                 case RC_CONVERTER_CACHE_MAXAGE:
1122                         lexrc >> converter_cache_maxage;
1123                         break;
1124
1125                 case RC_SORT_LAYOUTS:
1126                         lexrc >> sort_layouts;
1127                         break;
1128                 case RC_GROUP_LAYOUTS:
1129                         lexrc >> group_layouts;
1130                         break;
1131                 case RC_FULL_SCREEN_LIMIT:
1132                         lexrc >> full_screen_limit;
1133                         break;
1134                 case RC_FULL_SCREEN_TOOLBARS:
1135                         lexrc >> full_screen_toolbars;
1136                         break;
1137                 case RC_FULL_SCREEN_SCROLLBAR:
1138                         lexrc >> full_screen_scrollbar;
1139                         break;
1140                 case RC_FULL_SCREEN_TABBAR:
1141                         lexrc >> full_screen_tabbar;
1142                         break;
1143                 case RC_FULL_SCREEN_MENUBAR:
1144                         lexrc >> full_screen_menubar;
1145                         break;
1146                 case RC_FULL_SCREEN_WIDTH:
1147                         lexrc >> full_screen_width;
1148                         break;
1149                 case RC_OPEN_BUFFERS_IN_TABS:
1150                         lexrc >> open_buffers_in_tabs;
1151                         break;
1152                 case RC_SINGLE_CLOSE_TAB_BUTTON:
1153                         lexrc >> single_close_tab_button;
1154                         break;
1155
1156                 // Obsoteted in 1.4.0
1157                 case RC_USETEMPDIR:
1158                 // Obsoleted in 2.0
1159                 case RC_SPELL_COMMAND:
1160                 case RC_PERS_DICT:
1161                 case RC_PLAINTEXT_ROFF_COMMAND: 
1162                 case RC_USE_ALT_LANG:
1163                 case RC_USE_ESC_CHARS:
1164                 case RC_USE_INP_ENC:
1165                 case RC_USE_PERS_DICT:
1166                 case RC_USE_SPELL_LIB:
1167                         LYXERR(Debug::LYXRC, "Skipping obsolete tag `" 
1168                                << lexrc.getString() << "'.");
1169                         lexrc.next(true);
1170                         break;
1171
1172                 case RC_LAST:
1173                         break; // this is just a dummy
1174                 }
1175         }
1176
1177         /// Update converters data-structures
1178         theConverters().update(formats);
1179         theConverters().buildGraph();
1180
1181         return 0;
1182 }
1183
1184
1185 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1186 {
1187         ofstream ofs(filename.toFilesystemEncoding().c_str());
1188         if (ofs)
1189                 write(ofs, ignore_system_lyxrc);
1190 }
1191
1192
1193 void LyXRC::print() const
1194 {
1195         if (lyxerr.debugging())
1196                 write(lyxerr, false);
1197         else
1198                 write(cout, false);
1199 }
1200
1201
1202 class SameMover {
1203 public:
1204         typedef pair<string, SpecialisedMover> Data;
1205
1206         SameMover(Data const & comparison)
1207                 : comparison_(comparison) {}
1208
1209         bool operator()(Data const & data) const
1210         {
1211                 return data.first == comparison_.first &&
1212                         data.second.command() == comparison_.second.command();
1213         }
1214
1215 private:
1216         Data comparison_;
1217 };
1218
1219
1220 namespace {
1221
1222         // Escape \ and " so that LyXLex can read the string later
1223         string escapeCommand(string const & str) {
1224                 return subst(subst(str , "\\", "\\\\"), 
1225                              "\"", "\\\"");
1226         }
1227
1228 }
1229
1230
1231 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1232 {
1233         LyXRCTags tag = RC_LAST;
1234         
1235         if (!name.empty()) {
1236                 for (int i = 0; i != lyxrcCount; ++i)
1237                         if ("\\" + name == lyxrcTags[i].tag)
1238                                 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1239         }
1240
1241         if (tag == RC_LAST)
1242                 os << "# LyX " << lyx_version
1243                    << " generated this file. If you want to make your own\n"
1244                    << "# modifications you should do them from inside LyX and save.\n"
1245                    << "\n";
1246
1247         // Why the switch you might ask. It is a trick to ensure that all
1248         // the elements in the LyXRCTags enum are handled. As you can see
1249         // there are no breaks at all. So it is just a huge fall-through.
1250         // The nice thing is that we will get a warning from the compiler
1251         // if we forget an element.
1252         switch (tag) {
1253         case RC_LAST:
1254         case RC_INPUT:
1255                 // input/include files are not done here
1256         case RC_BINDFILE:
1257                 if (ignore_system_lyxrc ||
1258                     bind_file != system_lyxrc.bind_file) {
1259                         string const path = os::external_path(bind_file);
1260                         os << "\\bind_file \"" << path << "\"\n";
1261                 }
1262                 if (tag != RC_LAST)
1263                         break;
1264
1265         case RC_DEFFILE:
1266                 if (ignore_system_lyxrc ||
1267                     def_file != system_lyxrc.def_file) {
1268                         string const path = os::external_path(def_file);
1269                         os << "\\def_file \"" << path << "\"\n";
1270                 }
1271                 if (tag != RC_LAST)
1272                         break;
1273
1274                 //
1275                 // Misc Section
1276                 //
1277                 os << "\n#\n"
1278                    << "# MISC SECTION ######################################\n"
1279                    << "#\n\n";
1280                 // bind files are not done here.
1281
1282         case RC_PATH_PREFIX:
1283                 if (ignore_system_lyxrc ||
1284                     path_prefix != system_lyxrc.path_prefix) {
1285                         os << "\\path_prefix \"" << path_prefix << "\"\n";
1286                 }
1287                 if (tag != RC_LAST)
1288                         break;
1289         case RC_UIFILE:
1290                 if (ignore_system_lyxrc ||
1291                     ui_file != system_lyxrc.ui_file) {
1292                         string const path = os::external_path(ui_file);
1293                         os << "\\ui_file \"" << path << "\"\n";
1294                 }
1295                 if (tag != RC_LAST)
1296                         break;
1297         case RC_AUTOREGIONDELETE:
1298                 if (ignore_system_lyxrc ||
1299                     auto_region_delete != system_lyxrc.auto_region_delete) {
1300                         os << "# Set to false to inhibit automatic replacement of\n"
1301                            << "# the current selection.\n"
1302                            << "\\auto_region_delete " << convert<string>(auto_region_delete)
1303                            << '\n';
1304                 }
1305                 if (tag != RC_LAST)
1306                         break;
1307         case RC_AUTORESET_OPTIONS:
1308                 if (ignore_system_lyxrc ||
1309                     auto_reset_options != system_lyxrc.auto_reset_options) {
1310                         os << "# Set to false to inhibit automatic reset of\n"
1311                            << "# the class options to defaults on class change.\n"
1312                            << "\\auto_reset_options "
1313                            << convert<string>(auto_reset_options)
1314                            << '\n';
1315                 }
1316                 if (tag != RC_LAST)
1317                         break;
1318         case RC_AUTOSAVE:
1319                 if (ignore_system_lyxrc ||
1320                     autosave != system_lyxrc.autosave) {
1321                         os << "# The time interval between auto-saves in seconds.\n"
1322                            << "\\autosave " << autosave << '\n';
1323                 }
1324                 if (tag != RC_LAST)
1325                         break;
1326         case RC_DISPLAY_GRAPHICS:
1327                 if (ignore_system_lyxrc ||
1328                     display_graphics != system_lyxrc.display_graphics) {
1329                         os << "# Display graphics within LyX\n"
1330                            << "# true|false\n"
1331                            << "\\display_graphics "
1332                            << (display_graphics ? "true" : "false")
1333                            << '\n';
1334                 }
1335                 if (tag != RC_LAST)
1336                         break;
1337         case RC_SORT_LAYOUTS:
1338                 if (ignore_system_lyxrc ||
1339                     sort_layouts != system_lyxrc.sort_layouts) {
1340                         os << "# Sort layouts alphabetically.\n"
1341                            << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1342                 }
1343                 if (tag != RC_LAST)
1344                         break;
1345         case RC_GROUP_LAYOUTS:
1346                 if (ignore_system_lyxrc ||
1347                     group_layouts != system_lyxrc.group_layouts) {
1348                         os << "# Group layouts by their category.\n"
1349                            << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1350                 }
1351                 if (tag != RC_LAST)
1352                         break;
1353         case RC_VIEWDVI_PAPEROPTION:
1354                 if (ignore_system_lyxrc ||
1355                     view_dvi_paper_option
1356                     != system_lyxrc.view_dvi_paper_option) {
1357                         os << "# Options used to specify paper size to the\n"
1358                            << "# view_dvi_command (e.g. -paper)\n"
1359                            << "\\view_dvi_paper_option \""
1360                            << view_dvi_paper_option << "\"\n";
1361                 }
1362                 if (tag != RC_LAST)
1363                         break;
1364         case RC_DEFAULT_PAPERSIZE:
1365                 if (ignore_system_lyxrc ||
1366                     default_papersize != system_lyxrc.default_papersize) {
1367                         os << "# The default papersize to use.\n"
1368                            << "\\default_papersize \"";
1369                         switch (default_papersize) {
1370                         case PAPER_DEFAULT:
1371                                 os << "default"; break;
1372                         case PAPER_USLETTER:
1373                                 os << "usletter"; break;
1374                         case PAPER_USLEGAL:
1375                                 os << "legal"; break;
1376                         case PAPER_USEXECUTIVE:
1377                                 os << "executive"; break;
1378                         case PAPER_A3:
1379                                 os << "a3"; break;
1380                         case PAPER_A4:
1381                                 os << "a4"; break;
1382                         case PAPER_A5:
1383                                 os << "a5"; break;
1384                         case PAPER_B5:
1385                                 os << "b5"; break;
1386                         case PAPER_CUSTOM:
1387                         case PAPER_B3:
1388                         case PAPER_B4: break;
1389                         }
1390                         os << "\"\n";
1391                 }
1392                 if (tag != RC_LAST)
1393                         break;
1394         case RC_CHKTEX_COMMAND:
1395                 if (ignore_system_lyxrc ||
1396                     chktex_command != system_lyxrc.chktex_command) {
1397                         os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1398                 }
1399                 if (tag != RC_LAST)
1400                         break;
1401         case RC_BIBTEX_ALTERNATIVES: {
1402                 CommandSet::const_iterator it = bibtex_alternatives.begin();
1403                 CommandSet::const_iterator end = bibtex_alternatives.end();
1404                 for ( ; it != end; ++it) {
1405                         if (ignore_system_lyxrc
1406                             || !system_lyxrc.bibtex_alternatives.count(*it))
1407                                 os << "\\bibtex_alternatives \""
1408                                    << *it << "\"\n";
1409                 }
1410                 if (tag != RC_LAST)
1411                         break;
1412         }
1413         case RC_BIBTEX_COMMAND:
1414                 if (ignore_system_lyxrc ||
1415                     bibtex_command != system_lyxrc.bibtex_command) {
1416                         os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1417                 }
1418                 if (tag != RC_LAST)
1419                         break;
1420         case RC_JBIBTEX_COMMAND:
1421                 if (ignore_system_lyxrc ||
1422                     jbibtex_command != system_lyxrc.jbibtex_command) {
1423                         os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1424                 }
1425                 if (tag != RC_LAST)
1426                         break;
1427         case RC_INDEX_ALTERNATIVES: {
1428                 CommandSet::const_iterator it = index_alternatives.begin();
1429                 CommandSet::const_iterator end = index_alternatives.end();
1430                 for ( ; it != end; ++it) {
1431                         if (ignore_system_lyxrc
1432                             || !system_lyxrc.index_alternatives.count(*it))
1433                                 os << "\\index_alternatives \""
1434                                    << *it << "\"\n";
1435                 }
1436                 if (tag != RC_LAST)
1437                         break;
1438         }
1439         case RC_INDEX_COMMAND:
1440                 if (ignore_system_lyxrc ||
1441                     index_command != system_lyxrc.index_command) {
1442                         os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1443                 }
1444                 if (tag != RC_LAST)
1445                         break;
1446         case RC_JINDEX_COMMAND:
1447                 if (ignore_system_lyxrc ||
1448                     jindex_command != system_lyxrc.jindex_command) {
1449                         os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1450                 }
1451                 if (tag != RC_LAST)
1452                         break;
1453         case RC_SPLITINDEX_COMMAND:
1454                 if (ignore_system_lyxrc ||
1455                     splitindex_command != system_lyxrc.splitindex_command) {
1456                         os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1457                 }
1458                 if (tag != RC_LAST)
1459                         break;
1460         case RC_NOMENCL_COMMAND:
1461                 if (ignore_system_lyxrc ||
1462                     nomencl_command != system_lyxrc.nomencl_command) {
1463                         os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1464                 }
1465                 if (tag != RC_LAST)
1466                         break;
1467         case RC_TEX_EXPECTS_WINDOWS_PATHS:
1468                 if (ignore_system_lyxrc ||
1469                     windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
1470                         os << "\\tex_expects_windows_paths "
1471                            << convert<string>(windows_style_tex_paths) << '\n';
1472                 }
1473                 if (tag != RC_LAST)
1474                         break;
1475         case RC_TEX_ALLOWS_SPACES:
1476                 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1477                         os << "\\tex_allows_spaces "
1478                            << convert<string>(tex_allows_spaces) << '\n';
1479                 }
1480                 if (tag != RC_LAST)
1481                         break;
1482         case RC_KBMAP:
1483                 if (ignore_system_lyxrc ||
1484                     use_kbmap != system_lyxrc.use_kbmap) {
1485                         os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1486                 }
1487                 if (tag != RC_LAST)
1488                         break;
1489         case RC_KBMAP_PRIMARY:
1490                 if (ignore_system_lyxrc ||
1491                     primary_kbmap != system_lyxrc.primary_kbmap) {
1492                         string const path = os::external_path(primary_kbmap);
1493                         os << "\\kbmap_primary \"" << path << "\"\n";
1494                 }
1495                 if (tag != RC_LAST)
1496                         break;
1497         case RC_KBMAP_SECONDARY:
1498                 if (ignore_system_lyxrc ||
1499                     secondary_kbmap != system_lyxrc.secondary_kbmap) {
1500                         string const path = os::external_path(secondary_kbmap);
1501                         os << "\\kbmap_secondary \"" << path << "\"\n";
1502                 }
1503                 if (tag != RC_LAST)
1504                         break;
1505         case RC_SERVERPIPE:
1506                 if (ignore_system_lyxrc ||
1507                     lyxpipes != system_lyxrc.lyxpipes) {
1508                         string const path = os::external_path(lyxpipes);
1509                         os << "\\serverpipe \"" << path << "\"\n";
1510                 }
1511                 if (tag != RC_LAST)
1512                         break;
1513         case RC_DATE_INSERT_FORMAT:
1514                 if (ignore_system_lyxrc ||
1515                     date_insert_format != system_lyxrc.date_insert_format) {
1516                         os << "\\date_insert_format \"" << date_insert_format
1517                            << "\"\n";
1518                 }
1519                 if (tag != RC_LAST)
1520                         break;
1521         case RC_LABEL_INIT_LENGTH:
1522                 if (ignore_system_lyxrc ||
1523                     label_init_length != system_lyxrc.label_init_length) {
1524                         os << "\\label_init_length " << label_init_length
1525                            << '\n';
1526                 }
1527                 if (tag != RC_LAST)
1528                         break;
1529
1530         case RC_USER_NAME:
1531                 os << "\\user_name \"" << user_name << "\"\n";
1532                 if (tag != RC_LAST)
1533                         break;
1534
1535         case RC_USER_EMAIL:
1536                 os << "\\user_email \"" << user_email << "\"\n";
1537                 if (tag != RC_LAST)
1538                         break;
1539
1540         case RC_SHOW_BANNER:
1541                 if (ignore_system_lyxrc ||
1542                     show_banner != system_lyxrc.show_banner) {
1543                         os << "\\show_banner " << convert<string>(show_banner) << '\n';
1544                 }
1545                 if (tag != RC_LAST)
1546                         break;
1547
1548         case RC_PREVIEW:
1549                 if (ignore_system_lyxrc ||
1550                     preview != system_lyxrc.preview) {
1551                         string status;
1552                         switch (preview) {
1553                         case PREVIEW_ON:
1554                                 status = "on";
1555                                 break;
1556                         case PREVIEW_NO_MATH:
1557                                 status = "no_math";
1558                                 break;
1559                         case PREVIEW_OFF:
1560                                 status = "off";
1561                                 break;
1562                         }
1563                         os << "\\preview " << status << '\n';
1564                 }
1565                 if (tag != RC_LAST)
1566                         break;
1567
1568         case RC_PREVIEW_HASHED_LABELS:
1569                 if (ignore_system_lyxrc ||
1570                     preview_hashed_labels !=
1571                     system_lyxrc.preview_hashed_labels) {
1572                         os << "\\preview_hashed_labels "
1573                            << convert<string>(preview_hashed_labels) << '\n';
1574                 }
1575                 if (tag != RC_LAST)
1576                         break;
1577
1578         case RC_PREVIEW_SCALE_FACTOR:
1579                 if (ignore_system_lyxrc ||
1580                     preview_scale_factor != system_lyxrc.preview_scale_factor) {
1581                         os << "\\preview_scale_factor "
1582                            << preview_scale_factor << '\n';
1583                 }
1584                 if (tag != RC_LAST)
1585                         break;
1586
1587         case RC_USE_CONVERTER_CACHE:
1588                 if (ignore_system_lyxrc ||
1589                     use_converter_cache != system_lyxrc.use_converter_cache) {
1590                         os << "\\use_converter_cache "
1591                            << convert<string>(use_converter_cache) << '\n';
1592                 }
1593                 if (tag != RC_LAST)
1594                         break;
1595
1596         case RC_CONVERTER_CACHE_MAXAGE:
1597                 if (ignore_system_lyxrc ||
1598                     converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1599                         os << "\\converter_cache_maxage "
1600                            << converter_cache_maxage << '\n';
1601                 }
1602                 if (tag != RC_LAST)
1603                         break;
1604
1605                 os << "\n#\n"
1606                    << "# SCREEN & FONTS SECTION ############################\n"
1607                    << "#\n\n";
1608
1609         case RC_SCREEN_DPI:
1610                 if (ignore_system_lyxrc ||
1611                     dpi != system_lyxrc.dpi) {
1612                         os << "\\screen_dpi " << dpi << '\n';
1613                 }
1614                 if (tag != RC_LAST)
1615                         break;
1616         case RC_SCREEN_ZOOM:
1617                 if (ignore_system_lyxrc ||
1618                     zoom != system_lyxrc.zoom) {
1619                         os << "\\screen_zoom " << zoom << '\n';
1620                 }
1621                 if (tag != RC_LAST)
1622                         break;
1623         case RC_GEOMETRY_SESSION:
1624                 if (ignore_system_lyxrc ||
1625                     allow_geometry_session != system_lyxrc.allow_geometry_session) {
1626                         os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1627                            << '\n';
1628                 }
1629                 if (tag != RC_LAST)
1630                         break;
1631         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1632                 if (ignore_system_lyxrc ||
1633                     cursor_follows_scrollbar
1634                     != system_lyxrc.cursor_follows_scrollbar) {
1635                         os << "\\cursor_follows_scrollbar "
1636                            << convert<string>(cursor_follows_scrollbar) << '\n';
1637                 }
1638                 if (tag != RC_LAST)
1639                         break;
1640         case RC_SCROLL_BELOW_DOCUMENT:
1641                 if (ignore_system_lyxrc ||
1642                     scroll_below_document
1643                     != system_lyxrc.scroll_below_document) {
1644                         os << "\\scroll_below_document "
1645                            << convert<string>(scroll_below_document) << '\n';
1646                 }
1647                 if (tag != RC_LAST)
1648                         break;
1649         case RC_PARAGRAPH_MARKERS:
1650                 if (ignore_system_lyxrc ||
1651                         paragraph_markers
1652                     != system_lyxrc.paragraph_markers) {
1653                         os << "\\paragraph_markers "
1654                            << convert<string>(paragraph_markers) << '\n';
1655                 }
1656                 if (tag != RC_LAST)
1657                         break;
1658         case RC_MAC_LIKE_WORD_MOVEMENT:
1659                 if (ignore_system_lyxrc ||
1660                     mac_like_word_movement
1661                     != system_lyxrc.mac_like_word_movement) {
1662                         os << "\\mac_like_word_movement "
1663                            << convert<string>(mac_like_word_movement) << '\n';
1664                 }
1665                 if (tag != RC_LAST)
1666                         break;
1667         case RC_MACRO_EDIT_STYLE:
1668                 if (ignore_system_lyxrc ||
1669                     macro_edit_style
1670                     != system_lyxrc.macro_edit_style) {
1671                         os << "\\macro_edit_style ";
1672                         switch (macro_edit_style) {
1673                         case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1674                         case MACRO_EDIT_INLINE: os << "1\n"; break;
1675                         case MACRO_EDIT_LIST: os << "2\n"; break;
1676                         }
1677                 }
1678                 if (tag != RC_LAST)
1679                         break;
1680         case RC_DIALOGS_ICONIFY_WITH_MAIN:
1681                 if (ignore_system_lyxrc ||
1682                     dialogs_iconify_with_main
1683                    != system_lyxrc.dialogs_iconify_with_main) {
1684                         os << "\\dialogs_iconify_with_main "
1685                           <<  convert<string>(dialogs_iconify_with_main) << '\n';
1686                 }
1687                 if (tag != RC_LAST)
1688                         break;
1689         case RC_SCREEN_FONT_ROMAN:
1690                 if (ignore_system_lyxrc ||
1691                     roman_font_name != system_lyxrc.roman_font_name) {
1692                         os << "\\screen_font_roman \"" << roman_font_name
1693                            << "\"\n";
1694                 }
1695                 if (tag != RC_LAST)
1696                         break;
1697         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1698                 if (ignore_system_lyxrc ||
1699                     roman_font_foundry != system_lyxrc.roman_font_foundry) {
1700                         os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1701                            << "\"\n";
1702                 }
1703                 if (tag != RC_LAST)
1704                         break;
1705         case RC_SCREEN_FONT_SANS:
1706                 if (ignore_system_lyxrc ||
1707                     sans_font_name != system_lyxrc.sans_font_name) {
1708                         os << "\\screen_font_sans \"" << sans_font_name
1709                            << "\"\n";
1710                 }
1711                 if (tag != RC_LAST)
1712                         break;
1713         case RC_SCREEN_FONT_SANS_FOUNDRY:
1714                 if (ignore_system_lyxrc ||
1715                     sans_font_foundry != system_lyxrc.sans_font_foundry) {
1716                         os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1717                            << "\"\n";
1718                 }
1719                 if (tag != RC_LAST)
1720                         break;
1721         case RC_SCREEN_FONT_TYPEWRITER:
1722                 if (ignore_system_lyxrc ||
1723                     typewriter_font_name != system_lyxrc.typewriter_font_name) {
1724                         os << "\\screen_font_typewriter \""
1725                            << typewriter_font_name << "\"\n";
1726                 }
1727                 if (tag != RC_LAST)
1728                         break;
1729         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1730                 if (ignore_system_lyxrc ||
1731                     typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1732                         os << "\\screen_font_typewriter_foundry \""
1733                            << typewriter_font_foundry << "\"\n";
1734                 }
1735                 if (tag != RC_LAST)
1736                         break;
1737
1738         case RC_SCREEN_FONT_SCALABLE:
1739                 if (ignore_system_lyxrc ||
1740                     use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1741                         os << "\\screen_font_scalable "
1742                            << convert<string>(use_scalable_fonts)
1743                            << '\n';
1744                 }
1745                 if (tag != RC_LAST)
1746                         break;
1747         case RC_SCREEN_FONT_SIZES:
1748                 if (ignore_system_lyxrc ||
1749                     font_sizes[FONT_SIZE_TINY]
1750                     != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1751                     font_sizes[FONT_SIZE_SCRIPT]
1752                     != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1753                     font_sizes[FONT_SIZE_FOOTNOTE]
1754                     != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1755                     font_sizes[FONT_SIZE_SMALL]
1756                     != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1757                     font_sizes[FONT_SIZE_NORMAL]
1758                     != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1759                     font_sizes[FONT_SIZE_LARGE]
1760                     != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1761                     font_sizes[FONT_SIZE_LARGER]
1762                     != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1763                     font_sizes[FONT_SIZE_LARGEST]
1764                     != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1765                     font_sizes[FONT_SIZE_HUGE]
1766                     != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1767                     font_sizes[FONT_SIZE_HUGER]
1768                     != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1769                         os.setf(ios::fixed);
1770                         os.precision(2);
1771                         os << "\\screen_font_sizes"
1772                            << ' ' << font_sizes[FONT_SIZE_TINY]
1773                            << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1774                            << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1775                            << ' ' << font_sizes[FONT_SIZE_SMALL]
1776                            << ' ' << font_sizes[FONT_SIZE_NORMAL]
1777                            << ' ' << font_sizes[FONT_SIZE_LARGE]
1778                            << ' ' << font_sizes[FONT_SIZE_LARGER]
1779                            << ' ' << font_sizes[FONT_SIZE_LARGEST]
1780                            << ' ' << font_sizes[FONT_SIZE_HUGE]
1781                            << ' ' << font_sizes[FONT_SIZE_HUGER]
1782                            << '\n';
1783                 }
1784                 if (tag != RC_LAST)
1785                         break;
1786         case RC_FULL_SCREEN_LIMIT:
1787                 if (ignore_system_lyxrc ||
1788                     full_screen_limit != system_lyxrc.full_screen_limit) {
1789                         os << "\\fullscreen_limit "
1790                            << convert<string>(full_screen_limit)
1791                            << '\n';
1792                 }
1793                 if (tag != RC_LAST)
1794                         break;
1795         case RC_FULL_SCREEN_TOOLBARS:
1796                 if (ignore_system_lyxrc ||
1797                     full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1798                         os << "\\fullscreen_toolbars "
1799                            << convert<string>(full_screen_toolbars)
1800                            << '\n';
1801                 }
1802                 if (tag != RC_LAST)
1803                         break;
1804         case RC_FULL_SCREEN_SCROLLBAR:
1805                 if (ignore_system_lyxrc ||
1806                     full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1807                         os << "\\fullscreen_scrollbar "
1808                            << convert<string>(full_screen_scrollbar)
1809                            << '\n';
1810                 }
1811                 if (tag != RC_LAST)
1812                         break;
1813         case RC_FULL_SCREEN_TABBAR:
1814                 if (ignore_system_lyxrc ||
1815                     full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1816                         os << "\\fullscreen_tabbar "
1817                            << convert<string>(full_screen_tabbar)
1818                            << '\n';
1819                 }
1820                 if (tag != RC_LAST)
1821                         break;
1822         case RC_FULL_SCREEN_MENUBAR:
1823                 if (ignore_system_lyxrc ||
1824                     full_screen_menubar != system_lyxrc.full_screen_menubar) {
1825                         os << "\\fullscreen_menubar "
1826                            << convert<string>(full_screen_menubar)
1827                            << '\n';
1828                 }
1829                 if (tag != RC_LAST)
1830                         break;
1831         case RC_FULL_SCREEN_WIDTH:
1832                 if (ignore_system_lyxrc ||
1833                     full_screen_width != system_lyxrc.full_screen_width) {
1834                         os << "\\fullscreen_width "
1835                            << convert<string>(full_screen_width)
1836                            << '\n';
1837                 }
1838                 if (tag != RC_LAST)
1839                         break;
1840         case RC_OPEN_BUFFERS_IN_TABS:
1841                 if (ignore_system_lyxrc ||
1842                     open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1843                         os << "\\open_buffers_in_tabs "
1844                            << convert<string>(open_buffers_in_tabs)
1845                            << '\n';
1846                 }
1847         case RC_SINGLE_CLOSE_TAB_BUTTON:
1848                 if (ignore_system_lyxrc ||
1849                     single_close_tab_button != system_lyxrc.single_close_tab_button) {
1850                         os << "\\single_close_tab_button "
1851                            << convert<string>(single_close_tab_button)
1852                            << '\n';
1853                 }
1854                 if (tag != RC_LAST)
1855                         break;
1856
1857         os << "\n#\n"
1858                         << "# COLOR SECTION ###################################\n"
1859                         << "#\n\n";
1860
1861         case RC_SET_COLOR:
1862                 for (int i = 0; i < Color_ignore; ++i) {
1863                         ColorCode lc = static_cast<ColorCode>(i);
1864                         string const col = lcolor.getX11Name(lc);
1865                         if (ignore_system_lyxrc
1866                             || col != system_lcolor.getX11Name(lc)) {
1867                                 os << "\\set_color \""
1868                                    << lcolor.getLyXName(lc) << "\" \""
1869                                    << col << "\"\n";
1870                         }
1871                 }
1872                 if (tag != RC_LAST)
1873                         break;
1874
1875                 os << "\n#\n"
1876                    << "# PRINTER SECTION ###################################\n"
1877                    << "#\n\n";
1878
1879         case RC_PRINTER:
1880                 if (ignore_system_lyxrc ||
1881                     printer != system_lyxrc.printer) {
1882                         os << "\\printer \"" << printer << "\"\n";
1883                 }
1884                 if (tag != RC_LAST)
1885                         break;
1886         case RC_PRINT_ADAPTOUTPUT:
1887                 if (ignore_system_lyxrc ||
1888                     print_adapt_output != system_lyxrc.print_adapt_output) {
1889                         os << "\\print_adapt_output "
1890                            << convert<string>(print_adapt_output)
1891                            << '\n';
1892                 }
1893                 if (tag != RC_LAST)
1894                         break;
1895         case RC_PRINT_COMMAND:
1896                 if (ignore_system_lyxrc ||
1897                     print_command != system_lyxrc.print_command) {
1898                         os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
1899                 }
1900                 if (tag != RC_LAST)
1901                         break;
1902         case RC_PRINTEXSTRAOPTIONS:
1903                 if (ignore_system_lyxrc ||
1904                     print_extra_options != system_lyxrc.print_extra_options) {
1905                         os << "\\print_extra_options \"" << print_extra_options
1906                            << "\"\n";
1907                 }
1908                 if (tag != RC_LAST)
1909                         break;
1910         case RC_PRINTSPOOL_COMMAND:
1911                 if (ignore_system_lyxrc ||
1912                     print_spool_command != system_lyxrc.print_spool_command) {
1913                         os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
1914                            << "\"\n";
1915                 }
1916                 if (tag != RC_LAST)
1917                         break;
1918         case RC_PRINTSPOOL_PRINTERPREFIX:
1919                 if (ignore_system_lyxrc ||
1920                     print_spool_printerprefix
1921                     != system_lyxrc.print_spool_printerprefix) {
1922                         os << "\\print_spool_printerprefix \""
1923                            << print_spool_printerprefix << "\"\n";
1924                 }
1925                 if (tag != RC_LAST)
1926                         break;
1927         case RC_PRINTEVENPAGEFLAG:
1928                 if (ignore_system_lyxrc ||
1929                     print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1930                         os << "\\print_evenpage_flag \"" << print_evenpage_flag
1931                            << "\"\n";
1932                 }
1933                 if (tag != RC_LAST)
1934                         break;
1935         case RC_PRINTODDPAGEFLAG:
1936                 if (ignore_system_lyxrc ||
1937                     print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1938                         os << "\\print_oddpage_flag \"" << print_oddpage_flag
1939                            << "\"\n";
1940                 }
1941                 if (tag != RC_LAST)
1942                         break;
1943         case RC_PRINTREVERSEFLAG:
1944                 if (ignore_system_lyxrc ||
1945                     print_reverse_flag != system_lyxrc.print_reverse_flag) {
1946                         os << "\\print_reverse_flag \"" << print_reverse_flag
1947                            << "\"\n";
1948                 }
1949                 if (tag != RC_LAST)
1950                         break;
1951         case RC_PRINTLANDSCAPEFLAG:
1952                 if (ignore_system_lyxrc ||
1953                     print_landscape_flag != system_lyxrc.print_landscape_flag) {
1954                         os << "\\print_landscape_flag \"" << print_landscape_flag
1955                            << "\"\n";
1956                 }
1957                 if (tag != RC_LAST)
1958                         break;
1959         case RC_PRINTPAGERANGEFLAG:
1960                 if (ignore_system_lyxrc ||
1961                     print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1962                         os << "\\print_pagerange_flag \"" << print_pagerange_flag
1963                            << "\"\n";
1964                 }
1965                 if (tag != RC_LAST)
1966                         break;
1967         case RC_PRINTCOPIESFLAG:
1968                 if (ignore_system_lyxrc ||
1969                     print_copies_flag != system_lyxrc.print_copies_flag) {
1970                         os << "\\print_copies_flag \"" << print_copies_flag
1971                            << "\"\n";
1972                 }
1973                 if (tag != RC_LAST)
1974                         break;
1975         case RC_PRINTCOLLCOPIESFLAG:
1976                 if (ignore_system_lyxrc ||
1977                     print_collcopies_flag
1978                     != system_lyxrc.print_collcopies_flag) {
1979                         os << "\\print_collcopies_flag \""
1980                            << print_collcopies_flag
1981                            << "\"\n";
1982                 }
1983                 if (tag != RC_LAST)
1984                         break;
1985         case RC_PRINTPAPERFLAG:
1986                 if (ignore_system_lyxrc ||
1987                     print_paper_flag != system_lyxrc.print_paper_flag) {
1988                         os << "\\print_paper_flag \"" << print_paper_flag
1989                            << "\"\n";
1990                 }
1991                 if (tag != RC_LAST)
1992                         break;
1993         case RC_PRINTPAPERDIMENSIONFLAG:
1994                 if (ignore_system_lyxrc ||
1995                     print_paper_dimension_flag
1996                     != system_lyxrc.print_paper_dimension_flag) {
1997                         os << "\\print_paper_dimension_flag \""
1998                            << print_paper_dimension_flag << "\"\n";
1999                 }
2000                 if (tag != RC_LAST)
2001                         break;
2002         case RC_PRINTTOPRINTER:
2003                 if (ignore_system_lyxrc ||
2004                     print_to_printer != system_lyxrc.print_to_printer) {
2005                         os << "\\print_to_printer \"" << print_to_printer
2006                            << "\"\n";
2007                 }
2008                 if (tag != RC_LAST)
2009                         break;
2010         case RC_PRINTTOFILE:
2011                 if (ignore_system_lyxrc ||
2012                     print_to_file != system_lyxrc.print_to_file) {
2013                         string const path = os::external_path(print_to_file);
2014                         os << "\\print_to_file \"" << path << "\"\n";
2015                 }
2016                 if (tag != RC_LAST)
2017                         break;
2018         case RC_PRINTFILEEXTENSION:
2019                 if (ignore_system_lyxrc ||
2020                     print_file_extension != system_lyxrc.print_file_extension) {
2021                         os << "\\print_file_extension \""
2022                            << print_file_extension
2023                            << "\"\n";
2024                 }
2025                 if (tag != RC_LAST)
2026                         break;
2027
2028                 os << "\n#\n"
2029                    << "# TEX SECTION #######################################\n"
2030                    << "#\n\n";
2031
2032         case RC_FONT_ENCODING:
2033                 if (ignore_system_lyxrc ||
2034                     fontenc != system_lyxrc.fontenc) {
2035                         os << "\\font_encoding \"" << fontenc << "\"\n";
2036                 }
2037                 if (tag != RC_LAST)
2038                         break;
2039
2040                 os << "\n#\n"
2041                    << "# FILE SECTION ######################################\n"
2042                    << "#\n\n";
2043
2044         case RC_DOCUMENTPATH:
2045                 if (ignore_system_lyxrc ||
2046                     document_path != system_lyxrc.document_path) {
2047                         string const path = os::external_path(document_path);
2048                         os << "\\document_path \"" << path << "\"\n";
2049                 }
2050                 if (tag != RC_LAST)
2051                         break;
2052         case RC_USELASTFILEPOS:
2053                 if (ignore_system_lyxrc ||
2054                     use_lastfilepos != system_lyxrc.use_lastfilepos) {
2055                         os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2056                            << '\n';
2057                 }
2058                 if (tag != RC_LAST)
2059                         break;
2060         case RC_LOADSESSION:
2061                 if (ignore_system_lyxrc ||
2062                     load_session != system_lyxrc.load_session) {
2063                         os << "\\load_session " << convert<string>(load_session)
2064                            << "\n";
2065                 }
2066                 if (tag != RC_LAST)
2067                         break;
2068         case RC_MOUSE_WHEEL_SPEED:
2069                 if (ignore_system_lyxrc ||
2070                     mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2071                         os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2072                 }
2073                 if (tag != RC_LAST)
2074                         break;
2075         case RC_COMPLETION_INLINE_DELAY:
2076                 if (ignore_system_lyxrc ||
2077                     completion_inline_delay != system_lyxrc.completion_inline_delay) {
2078                         os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2079                 }
2080                 if (tag != RC_LAST)
2081                         break;
2082         case RC_COMPLETION_INLINE_MATH:
2083                 if (ignore_system_lyxrc ||
2084                     completion_inline_math != system_lyxrc.completion_inline_math) {
2085                         os << "\\completion_inline_math "
2086                                 << convert<string>(completion_inline_math) << '\n';
2087                 }
2088                 if (tag != RC_LAST)
2089                         break;
2090         case RC_COMPLETION_INLINE_TEXT:
2091                 if (ignore_system_lyxrc ||
2092                     completion_inline_text != system_lyxrc.completion_inline_text) {
2093                         os << "\\completion_inline_text "
2094                                 << convert<string>(completion_inline_text) << '\n';
2095                 }
2096                 if (tag != RC_LAST)
2097                         break;
2098         case RC_COMPLETION_INLINE_DOTS:
2099                 if (ignore_system_lyxrc ||
2100                     completion_inline_dots != system_lyxrc.completion_inline_dots) {
2101                         os << "\\completion_inline_dots "
2102                                 << convert<string>(completion_inline_dots) << '\n';
2103                 }
2104                 if (tag != RC_LAST)
2105                         break;
2106         case RC_AUTOCORRECTION_MATH:
2107                 if (ignore_system_lyxrc ||
2108                     autocorrection_math != system_lyxrc.autocorrection_math) {
2109                         os << "\\autocorrection_math "
2110                                 << convert<string>(autocorrection_math) << '\n';
2111                 }
2112                 if (tag != RC_LAST)
2113                         break;
2114         case RC_COMPLETION_POPUP_DELAY:
2115                 if (ignore_system_lyxrc ||
2116                     completion_popup_delay != system_lyxrc.completion_popup_delay) {
2117                         os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2118                 }
2119                 if (tag != RC_LAST)
2120                         break;
2121         case RC_COMPLETION_POPUP_MATH:
2122                 if (ignore_system_lyxrc ||
2123                     completion_popup_math != system_lyxrc.completion_popup_math) {
2124                         os << "\\completion_popup_math "
2125                                 << convert<string>(completion_popup_math) << '\n';
2126                 }
2127                 if (tag != RC_LAST)
2128                         break;
2129         case RC_COMPLETION_POPUP_TEXT:
2130                 if (ignore_system_lyxrc ||
2131                     completion_popup_text != system_lyxrc.completion_popup_text) {
2132                         os << "\\completion_popup_text "
2133                                 << convert<string>(completion_popup_text) << '\n';
2134                 }
2135                 if (tag != RC_LAST)
2136                         break;
2137         case RC_COMPLETION_CURSOR_TEXT:
2138                 if (ignore_system_lyxrc ||
2139                     completion_cursor_text != system_lyxrc.completion_cursor_text) {
2140                         os << "\\completion_cursor_text "
2141                            << convert<string>(completion_cursor_text) << '\n';
2142                 }
2143                 if (tag != RC_LAST)
2144                         break;
2145         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2146                 if (ignore_system_lyxrc ||
2147                     completion_popup_after_complete
2148                     != system_lyxrc.completion_popup_after_complete) {
2149                         os << "\\completion_popup_after_complete "
2150                                 << convert<string>(completion_popup_after_complete) << '\n';
2151                 }
2152                 if (tag != RC_LAST)
2153                         break;
2154         case RC_NUMLASTFILES:
2155                 if (ignore_system_lyxrc ||
2156                     num_lastfiles != system_lyxrc.num_lastfiles) {
2157                         os << "\\num_lastfiles " << num_lastfiles << '\n';
2158                 }
2159                 if (tag != RC_LAST)
2160                         break;
2161         case RC_CHECKLASTFILES:
2162                 if (ignore_system_lyxrc ||
2163                     check_lastfiles != system_lyxrc.check_lastfiles) {
2164                         os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2165                            << '\n';
2166                 }
2167                 if (tag != RC_LAST)
2168                         break;
2169         case RC_EXAMPLEPATH:
2170                 if (ignore_system_lyxrc ||
2171                     example_path != system_lyxrc.example_path) {
2172                         string const path = os::external_path(example_path);
2173                         os << "\\example_path \"" << path << "\"\n";
2174                 }
2175                 if (tag != RC_LAST)
2176                         break;
2177         case RC_TEMPLATEPATH:
2178                 if (ignore_system_lyxrc ||
2179                     template_path != system_lyxrc.template_path) {
2180                         string const path = os::external_path(template_path);
2181                         os << "\\template_path \"" << path << "\"\n";
2182                 }
2183                 if (tag != RC_LAST)
2184                         break;
2185         case RC_TEMPDIRPATH:
2186                 if (ignore_system_lyxrc ||
2187                     tempdir_path != system_lyxrc.tempdir_path) {
2188                         string const path = os::external_path(tempdir_path);
2189                         os << "\\tempdir_path \"" << path << "\"\n";
2190                 }
2191                 if (tag != RC_LAST)
2192                         break;
2193         case RC_THESAURUSDIRPATH:
2194                 if (ignore_system_lyxrc ||
2195                     thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2196                         string const path = os::external_path(thesaurusdir_path);
2197                         os << "\\thesaurusdir_path \"" << path << "\"\n";
2198                 }
2199                 if (tag != RC_LAST)
2200                         break;
2201         case RC_HUNSPELLDIR_PATH:
2202                 if (ignore_system_lyxrc ||
2203                     hunspelldir_path != system_lyxrc.hunspelldir_path) {
2204                         string const path = os::external_path(hunspelldir_path);
2205                         os << "\\hunspelldir_path \"" << path << "\"\n";
2206                 }
2207                 if (tag != RC_LAST)
2208                         break;
2209         case RC_USETEMPDIR:
2210                 if (tag != RC_LAST)
2211                         break;
2212                 // Ignore it
2213         case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 2.0
2214                 if (tag != RC_LAST)
2215                         break;
2216         case RC_PLAINTEXT_LINELEN:
2217                 if (ignore_system_lyxrc ||
2218                     plaintext_linelen != system_lyxrc.plaintext_linelen) {
2219                         os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2220                 }
2221                 if (tag != RC_LAST)
2222                         break;
2223         case RC_MAKE_BACKUP:
2224                 if (ignore_system_lyxrc ||
2225                     make_backup != system_lyxrc.make_backup) {
2226                         os << "\\make_backup " << convert<string>(make_backup) << '\n';
2227                 }
2228                 if (tag != RC_LAST)
2229                         break;
2230         case RC_BACKUPDIR_PATH:
2231                 if (ignore_system_lyxrc ||
2232                     backupdir_path != system_lyxrc.backupdir_path) {
2233                         string const path = os::external_path(backupdir_path);
2234                         os << "\\backupdir_path \"" << path << "\"\n";
2235                 }
2236                 if (tag != RC_LAST)
2237                         break;
2238
2239                 os << "\n#\n"
2240                    << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2241                    << "#\n\n";
2242
2243                 os << "\n#\n"
2244                    << "# SPELLCHECKER SECTION ##############################\n"
2245                    << "#\n\n";
2246
2247         case RC_SPELL_COMMAND:
2248         case RC_USE_SPELL_LIB:
2249                 // Obsoleted in 2.0
2250                 if (tag != RC_LAST)
2251                         break;
2252         case RC_ACCEPT_COMPOUND:
2253                 if (ignore_system_lyxrc ||
2254                     spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2255                         os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2256                            << '\n';
2257                 }
2258                 if (tag != RC_LAST)
2259                         break;
2260         case RC_USE_ALT_LANG:
2261                 // Obsoleted in 2.0
2262                 if (tag != RC_LAST)
2263                         break;
2264         case RC_ALT_LANG:
2265                 if (ignore_system_lyxrc ||
2266                     spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2267                         os << "\\alternate_language \"" << spellchecker_alt_lang
2268                            << "\"\n";
2269                 }
2270                 if (tag != RC_LAST)
2271                         break;
2272         case RC_USE_ESC_CHARS:
2273                 if (tag != RC_LAST)
2274                         break;
2275         case RC_ESC_CHARS:
2276                 if (ignore_system_lyxrc ||
2277                     spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2278                         os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2279                 }
2280                 if (tag != RC_LAST)
2281                         break;
2282         case RC_USE_PERS_DICT:
2283                 // obsoleted in 2.0
2284                 if (tag != RC_LAST)
2285                         break;
2286         case RC_USE_TOOLTIP:
2287                 if (ignore_system_lyxrc ||
2288                     use_tooltip != system_lyxrc.use_tooltip) {
2289                         os << "\\use_tooltip "
2290                            << convert<string>(use_tooltip)
2291                            << '\n';
2292                 }
2293                 if (tag != RC_LAST)
2294                         break;
2295         case RC_USE_PIXMAP_CACHE:
2296                 if (ignore_system_lyxrc ||
2297                     use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2298                         os << "\\use_pixmap_cache "
2299                            << convert<string>(use_pixmap_cache)
2300                            << '\n';
2301                 }
2302                 if (tag != RC_LAST)
2303                         break;
2304         case RC_PERS_DICT:
2305                 // obsoleted in 2.0
2306                 if (tag != RC_LAST)
2307                         break;
2308         case RC_USE_INP_ENC:
2309                 // obsoleted in 2.0
2310                 if (tag != RC_LAST)
2311                         break;
2312
2313                 os << "\n#\n"
2314                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
2315                    << "#\n\n";
2316                 if (tag != RC_LAST)
2317                         break;
2318
2319         case RC_SPELLCHECKER:
2320                 if (ignore_system_lyxrc ||
2321                     spellchecker != system_lyxrc.spellchecker) {
2322                         os << "\\spellchecker " << spellchecker << '\n';
2323                 }
2324                 if (tag != RC_LAST)
2325                         break;
2326
2327         case RC_SPELLCHECK_CONTINUOUSLY:
2328                 if (ignore_system_lyxrc ||
2329                     spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2330                         os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
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_LABEL_INIT_LENGTH:
2698         case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2699         case LyXRC::RC_LANGUAGE_AUTO_END:
2700         case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2701         case LyXRC::RC_LANGUAGE_COMMAND_END:
2702         case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2703         case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2704         case LyXRC::RC_LANGUAGE_PACKAGE:
2705         case LyXRC::RC_LANGUAGE_USE_BABEL:
2706         case LyXRC::RC_MAC_LIKE_WORD_MOVEMENT:
2707         case LyXRC::RC_MACRO_EDIT_STYLE:
2708         case LyXRC::RC_MAKE_BACKUP:
2709         case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2710         case LyXRC::RC_MOUSE_WHEEL_SPEED:
2711         case LyXRC::RC_NUMLASTFILES:
2712         case LyXRC::RC_PARAGRAPH_MARKERS:
2713         case LyXRC::RC_PATH_PREFIX:
2714                 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2715                         prependEnvPath("PATH", lyxrc.path_prefix);
2716                 }
2717         case LyXRC::RC_PERS_DICT:
2718         case LyXRC::RC_PREVIEW:
2719         case LyXRC::RC_PREVIEW_HASHED_LABELS:
2720         case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2721         case LyXRC::RC_PRINTCOLLCOPIESFLAG:
2722         case LyXRC::RC_PRINTCOPIESFLAG:
2723         case LyXRC::RC_PRINTER:
2724         case LyXRC::RC_PRINTEVENPAGEFLAG:
2725         case LyXRC::RC_PRINTEXSTRAOPTIONS:
2726         case LyXRC::RC_PRINTFILEEXTENSION:
2727         case LyXRC::RC_PRINTLANDSCAPEFLAG:
2728         case LyXRC::RC_PRINTODDPAGEFLAG:
2729         case LyXRC::RC_PRINTPAGERANGEFLAG:
2730         case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
2731         case LyXRC::RC_PRINTPAPERFLAG:
2732         case LyXRC::RC_PRINTREVERSEFLAG:
2733         case LyXRC::RC_PRINTSPOOL_COMMAND:
2734         case LyXRC::RC_PRINTSPOOL_PRINTERPREFIX:
2735         case LyXRC::RC_PRINTTOFILE:
2736         case LyXRC::RC_PRINTTOPRINTER:
2737         case LyXRC::RC_PRINT_ADAPTOUTPUT:
2738         case LyXRC::RC_PRINT_COMMAND:
2739         case LyXRC::RC_RTL_SUPPORT:
2740         case LyXRC::RC_SCREEN_DPI:
2741         case LyXRC::RC_SCREEN_FONT_ROMAN:
2742         case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
2743         case LyXRC::RC_SCREEN_FONT_SANS:
2744         case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
2745         case LyXRC::RC_SCREEN_FONT_SCALABLE:
2746         case LyXRC::RC_SCREEN_FONT_SIZES:
2747         case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
2748         case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2749         case LyXRC::RC_GEOMETRY_SESSION:
2750         case LyXRC::RC_SCREEN_ZOOM:
2751         case LyXRC::RC_SERVERPIPE:
2752         case LyXRC::RC_SET_COLOR:
2753         case LyXRC::RC_SHOW_BANNER:
2754         case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
2755         case LyXRC::RC_SPELL_COMMAND:
2756         case LyXRC::RC_SPELLCHECKER:
2757         case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
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_LABEL_INIT_LENGTH:
2952                 str = _("Maximum number of words in the initialization string for a new label");
2953                 break;
2954
2955         case RC_LANGUAGE_AUTO_BEGIN:
2956                 str = _("Select if a language switching command is needed at the beginning of the document.");
2957                 break;
2958
2959         case RC_LANGUAGE_AUTO_END:
2960                 str = _("Select if a language switching command is needed at the end of the document.");
2961                 break;
2962
2963         case RC_LANGUAGE_COMMAND_BEGIN:
2964                 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.");
2965                 break;
2966
2967         case RC_LANGUAGE_COMMAND_END:
2968                 str = _("The LaTeX command for changing back to the language of the document.");
2969                 break;
2970
2971         case RC_LANGUAGE_COMMAND_LOCAL:
2972                 str = _("The LaTeX command for local changing of the language.");
2973                 break;
2974
2975         case RC_LANGUAGE_GLOBAL_OPTIONS:
2976                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2977                 break;
2978
2979         case RC_LANGUAGE_PACKAGE:
2980                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2981                 break;
2982
2983         case RC_LANGUAGE_USE_BABEL:
2984                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2985                 break;
2986
2987         case RC_USELASTFILEPOS:
2988                 str = _("De-select if you do not want LyX to scroll to saved position.");
2989                 break;
2990
2991         case RC_LOADSESSION:
2992                 str = _("De-select to prevent loading files opened from the last LyX session.");
2993                 break;
2994
2995         case RC_MAKE_BACKUP:
2996                 str = _("De-select if you don't want LyX to create backup files.");
2997                 break;
2998
2999         case RC_MARK_FOREIGN_LANGUAGE:
3000                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3001                 break;
3002
3003         case RC_MOUSE_WHEEL_SPEED:
3004                 str = bformat(_("The scrolling speed of the mouse wheel."),
3005                       maxlastfiles);
3006                 break;
3007
3008         case RC_COMPLETION_POPUP_DELAY:
3009                 str = _("The completion popup delay.");
3010                 break;
3011
3012         case RC_COMPLETION_POPUP_MATH:
3013                 str = _("Select to display the completion popup in math mode.");
3014                 break;
3015
3016         case RC_COMPLETION_POPUP_TEXT:
3017                 str = _("Select to display the completion popup in text mode.");
3018                 break;
3019
3020         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3021                 str = _("Show the completion popup without delay after non-unique completion attempt.");
3022                 break;
3023
3024         case RC_COMPLETION_POPUP_TEXT:
3025                 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3026                 break;
3027
3028         case RC_COMPLETION_POPUP_DELAY:
3029                 str = _("The inline completion delay.");
3030                 break;
3031
3032         case RC_COMPLETION_INLINE_MATH:
3033                 str = _("Select to display the inline completion in math mode.");
3034                 break;
3035
3036         case RC_COMPLETION_INLINE_TEXT:
3037                 str = _("Select to display the inline completion in text mode.");
3038                 break;
3039
3040         case RC_COMPLETION_INLINE_DOTS:
3041                 str = _("Use \"...\" to shorten long completions.");
3042                 break;
3043
3044         case RC_AUTOCORRECTION_MATH:
3045                 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
3046                 break;
3047
3048         case RC_NUMLASTFILES:
3049                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3050                         maxlastfiles);
3051                 break;
3052
3053         case RC_PATH_PREFIX:
3054                 str = _("Specify those directories which should be "
3055                          "prepended to the PATH environment variable. "
3056                          "Use the OS native format.");
3057                 break;
3058
3059         case RC_PREVIEW:
3060                 str = _("Shows a typeset preview of things such as math");
3061                 break;
3062
3063         case RC_PREVIEW_HASHED_LABELS:
3064                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3065                 break;
3066
3067         case RC_PREVIEW_SCALE_FACTOR:
3068                 str = _("Scale the preview size to suit.");
3069                 break;
3070
3071         case RC_PRINTCOLLCOPIESFLAG:
3072                 str = _("The option for specifying whether the copies should be collated.");
3073                 break;
3074
3075         case RC_PRINTCOPIESFLAG:
3076                 str = _("The option for specifying the number of copies to print.");
3077                 break;
3078
3079         case RC_PRINTER:
3080                 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
3081                 break;
3082
3083         case RC_PRINTEVENPAGEFLAG:
3084                 str = _("The option to print only even pages.");
3085                 break;
3086
3087         case RC_PRINTEXSTRAOPTIONS:
3088                 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
3089                 break;
3090
3091         case RC_PRINTFILEEXTENSION:
3092                 str = _("Extension of printer program output file. Usually \".ps\".");
3093                 break;
3094
3095         case RC_PRINTLANDSCAPEFLAG:
3096                 str = _("The option to print out in landscape.");
3097                 break;
3098
3099         case RC_PRINTODDPAGEFLAG:
3100                 str = _("The option to print only odd pages.");
3101                 break;
3102
3103         case RC_PRINTPAGERANGEFLAG:
3104                 str = _("The option for specifying a comma-separated list of pages to print.");
3105                 break;
3106
3107         case RC_PRINTPAPERDIMENSIONFLAG:
3108                                    str = _("Option to specify the dimensions of the print paper.");
3109                 break;
3110
3111         case RC_PRINTPAPERFLAG:
3112                 str = _("The option to specify paper type.");
3113                 break;
3114
3115         case RC_PRINTREVERSEFLAG:
3116                 str = _("The option to reverse the order of the pages printed.");
3117                 break;
3118
3119         case RC_PRINTSPOOL_COMMAND:
3120                 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.");
3121                 break;
3122
3123         case RC_PRINTSPOOL_PRINTERPREFIX:
3124                 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.");
3125                 break;
3126
3127         case RC_PRINTTOFILE:
3128                 str = _("Option to pass to the print program to print to a file.");
3129                 break;
3130
3131         case RC_PRINTTOPRINTER:
3132                 str = _("Option to pass to the print program to print on a specific printer.");
3133                 break;
3134
3135         case RC_PRINT_ADAPTOUTPUT:
3136                 str = _("Select for LyX to pass the name of the destination printer to your print command.");
3137                 break;
3138
3139         case RC_PRINT_COMMAND:
3140                 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
3141                 break;
3142
3143         case RC_RTL_SUPPORT:
3144                 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
3145                 break;
3146
3147         case RC_VISUAL_CURSOR:
3148                 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3149                 break;
3150
3151         case RC_SCREEN_DPI:
3152                 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3153                 break;
3154
3155         case RC_SCREEN_FONT_ROMAN:
3156         case RC_SCREEN_FONT_SANS:
3157         case RC_SCREEN_FONT_TYPEWRITER:
3158                 str = _("The screen fonts used to display the text while editing.");
3159                 break;
3160
3161         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3162         case RC_SCREEN_FONT_SANS_FOUNDRY:
3163         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3164                 break;
3165
3166         case RC_SCREEN_FONT_SCALABLE:
3167                 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.");
3168                 break;
3169
3170         case RC_SCREEN_FONT_SIZES:
3171                 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3172                 break;
3173
3174         case RC_SCREEN_ZOOM:
3175                 //xgettext:no-c-format
3176                 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3177                 break;
3178
3179         case RC_GEOMETRY_SESSION:
3180                 str = _("Allow session manager to save and restore windows geometry.");
3181                 break;
3182
3183         case RC_SERVERPIPE:
3184                 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3185                 break;
3186
3187         case RC_SET_COLOR:
3188                 break;
3189
3190         case RC_SHOW_BANNER:
3191                 str = _("De-select if you don't want the startup banner.");
3192                 break;
3193
3194         case RC_TEMPDIRPATH:
3195                 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3196                 break;
3197
3198         case RC_THESAURUSDIRPATH:
3199                 str = _("This is the place where the files of the thesaurus library reside.");
3200                 break;
3201
3202         case RC_TEMPLATEPATH:
3203                 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3204                 break;
3205
3206         case RC_TEX_ALLOWS_SPACES:
3207                 break;
3208
3209         case RC_TEX_EXPECTS_WINDOWS_PATHS:
3210                 break;
3211
3212         case RC_UIFILE:
3213                 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3214                 break;
3215
3216         case RC_USER_EMAIL:
3217                 break;
3218
3219         case RC_USER_NAME:
3220                 break;
3221
3222         case RC_USETEMPDIR:
3223                 break;
3224
3225         case RC_USE_TOOLTIP:
3226                 str = _("Enable the automatic appearance of tool tips in the work area.");
3227                 break;
3228
3229         case RC_USE_PIXMAP_CACHE:
3230                 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
3231                 break;
3232
3233         case RC_USE_SPELL_LIB:
3234                 break;
3235
3236         case RC_VIEWDVI_PAPEROPTION:
3237                 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3238                 break;
3239
3240         case RC_VIEWER:
3241                 break;
3242
3243         case RC_LAST:
3244                 break;
3245         }
3246
3247         return str;
3248 }
3249 #endif
3250
3251
3252 // The global instance
3253 LyXRC lyxrc;
3254
3255 // The global copy of the system lyxrc entries (everything except preferences)
3256 LyXRC system_lyxrc;
3257
3258
3259 } // namespace lyx