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