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