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