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