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