]> git.lyx.org Git - lyx.git/blob - src/LyXRC.cpp
installer: further preparation
[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/userinfo.h"
44
45 #include <fstream>
46 #include <iostream>
47 #include <algorithm>
48
49 using namespace std;
50 using namespace lyx::support;
51
52 namespace lyx {
53
54 namespace os = support::os;
55
56 namespace {
57
58 static unsigned int const LYXRC_FILEFORMAT = 13; // vfr: System theme's icons
59
60 // when adding something to this array keep it sorted!
61 LexerKeyword lyxrcTags[] = {
62         { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
63         { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION },
64         { "\\alternate_language", LyXRC::RC_ALT_LANG },
65         { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
66         { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
67         { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
68         { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
69         { "\\autosave", LyXRC::RC_AUTOSAVE },
70         { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
71         { "\\bibtex_alternatives", LyXRC::RC_BIBTEX_ALTERNATIVES },
72         { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
73         { "\\bind_file", LyXRC::RC_BINDFILE },
74         { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
75         { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
76         { "\\close_buffer_with_last_view", LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW },
77         { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
78         { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
79         { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
80         { "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
81         { "\\completion_inline_text", LyXRC::RC_COMPLETION_INLINE_TEXT },
82         { "\\completion_minlength", LyXRC::RC_COMPLETION_MINLENGTH },
83         { "\\completion_popup_after_complete", LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE },
84         { "\\completion_popup_delay", LyXRC::RC_COMPLETION_POPUP_DELAY },
85         { "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH },
86         { "\\completion_popup_text", LyXRC::RC_COMPLETION_POPUP_TEXT },
87         { "\\converter", LyXRC::RC_CONVERTER },
88         { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
89         { "\\copier", LyXRC::RC_COPIER },
90         { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
91         { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
92         { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
93         { "\\def_file", LyXRC::RC_DEFFILE },
94         { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
95         { "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
96         { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
97         { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
98         { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
99         { "\\document_path", LyXRC::RC_DOCUMENTPATH },
100         { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
101         { "\\escape_chars", LyXRC::RC_ESC_CHARS },
102         { "\\example_path", LyXRC::RC_EXAMPLEPATH },
103         { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
104         { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
105         { "\\force_paint_single_char", LyXRC::RC_FORCE_PAINT_SINGLE_CHAR },
106         { "\\format", LyXRC::RC_FILEFORMAT },
107         { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
108         { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
109         { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
110         { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
111         { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
112         { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
113         { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
114         { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
115         { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
116         { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
117         { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
118         { "\\icon_set", LyXRC::RC_ICON_SET },
119         { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
120         { "\\index_command", LyXRC::RC_INDEX_COMMAND },
121         { "\\input", LyXRC::RC_INPUT },
122         { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
123         { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
124         { "\\kbmap", LyXRC::RC_KBMAP },
125         { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
126         { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
127         { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
128         { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
129         { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
130         { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
131         { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
132         { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
133         { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
134         { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
135         { "\\load_session", LyXRC::RC_LOADSESSION },
136         { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
137         { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
138         { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
139         { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
140         { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
141         { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
142         { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
143         { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
144         { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
145         { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
146         { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
147         { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
148         { "\\preview", LyXRC::RC_PREVIEW },
149         { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
150         { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
151         { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
152         { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
153         { "\\print_command", LyXRC::RC_PRINT_COMMAND },
154         { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
155         { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
156         { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
157         { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
158         { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
159         { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
160         { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
161         { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
162         { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
163         { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
164         { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
165         { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
166         { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
167         { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
168         { "\\printer", LyXRC::RC_PRINTER },
169         { "\\rtl", LyXRC::RC_RTL_SUPPORT },
170         { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
171         { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
172         { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
173         { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
174         { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
175         { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
176         { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
177         { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
178         { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
179         { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
180         { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
181         { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
182         { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
183         { "\\serverpipe", LyXRC::RC_SERVERPIPE },
184         { "\\set_color", LyXRC::RC_SET_COLOR },
185         { "\\show_banner", LyXRC::RC_SHOW_BANNER },
186         { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
187         { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
188         { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
189         { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
190         { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
191         { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
192         { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
193         { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
194         { "\\template_path", LyXRC::RC_TEMPLATEPATH },
195         { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
196         { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
197         { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
198         { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
199         { "\\ui_file", LyXRC::RC_UIFILE },
200         { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
201         { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
202         { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
203         { "\\use_qimage", LyXRC::RC_USE_QIMAGE },
204         // compatibility with versions older than 1.4.0 only
205         { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
206         { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
207         { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
208         { "\\user_email", LyXRC::RC_USER_EMAIL },
209         { "\\user_name", LyXRC::RC_USER_NAME },
210         { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
211         // compatibility with versions older than 1.4.0 only
212         { "\\viewer", LyXRC::RC_VIEWER},
213         { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
214         { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
215         { "format", LyXRC::RC_LYXRCFORMAT }
216 };
217
218 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
219
220 } // namespace anon
221
222
223 LyXRC::LyXRC()
224 {
225         setDefaults();
226 }
227
228
229 void LyXRC::setDefaults()
230 {
231         icon_set = string();
232         use_system_theme_icons = false;
233         bind_file = "cua";
234         def_file = "default";
235         ui_file = "default";
236         // The current document directory
237         texinputs_prefix = ".";
238         // Get printer from the environment. If fail, use default "",
239         // assuming that everything is set up correctly.
240         printer = getEnv("PRINTER");
241         print_adapt_output = false;
242         print_command = "dvips";
243         print_evenpage_flag = "-B";
244         print_oddpage_flag = "-A";
245         print_pagerange_flag = "-pp";
246         print_copies_flag = "-c";
247         print_collcopies_flag = "-C";
248         print_reverse_flag = "-r";
249         print_landscape_flag = "-t landscape";
250         print_to_printer = "-P";
251         print_to_file = "-o ";
252         print_file_extension = ".ps";
253         print_paper_flag = "-t";
254         print_paper_dimension_flag = "-T";
255         document_path.erase();
256         view_dvi_paper_option.erase();
257         default_view_format = "pdf2";
258         chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
259         bibtex_command = "bibtex";
260         fontenc = "default";
261         index_command = "makeindex -c -q";
262         nomencl_command = "makeindex -s nomencl.ist";
263         dpi = 75;
264         // Because a screen is typically wider than a piece of paper:
265         zoom = 150;
266         allow_geometry_session = true;
267         // Default LaTeX font size:
268         font_sizes[FONT_SIZE_TINY] = "5.0";
269         font_sizes[FONT_SIZE_SCRIPT] = "7.0";
270         font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
271         font_sizes[FONT_SIZE_SMALL] = "9.0";
272         font_sizes[FONT_SIZE_NORMAL] = "10.0";
273         font_sizes[FONT_SIZE_LARGE] = "12.0";
274         font_sizes[FONT_SIZE_LARGER] = "14.4";
275         font_sizes[FONT_SIZE_LARGEST] = "17.26";
276         font_sizes[FONT_SIZE_HUGE] = "20.74";
277         font_sizes[FONT_SIZE_HUGER] = "24.88";
278         use_scalable_fonts = true;
279         roman_font_name = "";
280         sans_font_name = "";
281         typewriter_font_name = "";
282         autosave = 300;
283         auto_region_delete = true;
284         auto_reset_options = false;
285         plaintext_linelen = 65;
286         mouse_wheel_speed = 1.0;
287         num_lastfiles = maxlastfiles;
288         check_lastfiles = true;
289         use_lastfilepos = true;
290         load_session = false;
291         make_backup = true;
292         save_compressed = false;
293         backupdir_path.erase();
294         display_graphics = true;
295         // Spellchecker settings:
296 // FIXME: this check should test the target platform (darwin)
297 #if defined(USE_MACOSX_PACKAGING)
298         spellchecker = "native";
299 #elif defined(USE_ASPELL)
300         spellchecker = "aspell";
301 #elif defined(USE_HUNSPELL)
302         spellchecker = "hunspell";
303 #else
304         spellchecker = "aspell";
305 #endif
306         spellchecker_accept_compound = false;
307         spellcheck_continuously = false;
308         completion_minlength = 6;
309         spellcheck_notes = true;
310         use_kbmap = false;
311         rtl_support = true;
312         visual_cursor = false;
313         auto_number = true;
314         mark_foreign_language = true;
315         language_auto_begin = true;
316         language_auto_end = true;
317         language_global_options = true;
318         language_package_selection = LP_AUTO;
319         language_custom_package = "\\usepackage{babel}";
320         language_command_begin = "\\selectlanguage{$$lang}";
321         language_command_local = "\\foreignlanguage{$$lang}{";
322         sort_layouts = false;
323         group_layouts = true;
324         gui_language = "auto";
325         show_banner = true;
326         windows_style_tex_paths = false;
327         tex_allows_spaces = false;
328         date_insert_format = "%x";
329         cursor_follows_scrollbar = false;
330         scroll_below_document = false;
331         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
332         paragraph_markers = false;
333         mac_dontswap_ctrl_meta = false;
334         mac_like_cursor_movement = false;
335         macro_edit_style = MACRO_EDIT_INLINE_BOX;
336         dialogs_iconify_with_main = false;
337         preview = PREVIEW_OFF;
338         preview_hashed_labels  = false;
339         preview_scale_factor = 1.0;
340         use_converter_cache = true;
341         use_system_colors = false;
342         use_tooltip = true;
343         use_pixmap_cache = false;
344         use_qimage = true;
345         converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
346         user_name = to_utf8(support::user_name());
347         user_email = to_utf8(support::user_email());
348         open_buffers_in_tabs = true;
349         single_close_tab_button = false;
350         single_instance = true;
351         forward_search_dvi = string();
352         forward_search_pdf = string();
353         export_overwrite = NO_FILES;
354
355         // Fullscreen settings
356         full_screen_limit = false;
357         full_screen_toolbars = true;
358         full_screen_tabbar = true;
359         full_screen_menubar = true;
360         full_screen_scrollbar = true;
361         full_screen_width = 700;
362
363         completion_cursor_text = true;
364         completion_popup_math = true;
365         completion_popup_text = false;
366         completion_popup_delay = 2.0;
367         completion_popup_after_complete = true;
368         autocorrection_math = false;
369         completion_inline_math = true;
370         completion_inline_text = false;
371         completion_inline_dots = -1;
372         completion_inline_delay = 0.2;
373         default_decimal_point = ".";
374         default_length_unit = Length::CM;
375         cursor_width = 1;
376         close_buffer_with_last_view = "yes";
377 }
378
379
380 namespace {
381
382 void oldFontFormat(string & family, string & foundry)
383 {
384         if (family.empty() || family[0] != '-')
385                 return;
386         foundry = token(family, '-', 1);
387         family = token(family, '-', 2);
388         if (foundry == "*")
389                 foundry.erase();
390 }
391
392 } // namespace anon
393
394
395 bool LyXRC::read(FileName const & filename, bool check_format)
396 {
397         Lexer lexrc(lyxrcTags);
398         lexrc.setFile(filename);
399         LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
400         ReturnValues retval = read(lexrc, check_format);
401         if (!check_format || retval != FormatMismatch)
402                 return retval == ReadOK;
403
404         LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
405         FileName const tempfile = FileName::tempName("convert_lyxrc");
406         bool const success = prefs2prefs(filename, tempfile, false);
407         if (!success) {
408                 LYXERR0 ("Unable to convert " << filename.absFileName() <<
409                         " to format " << LYXRC_FILEFORMAT);
410                 return false;
411         } else {
412                 // Keep this in the else branch, such that lexrc2 goes out
413                 // of scope and releases the lock on tempfile before we
414                 // attempt to remove it. This matters on Windows.
415                 Lexer lexrc2(lyxrcTags);
416                 lexrc2.setFile(tempfile);
417                 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
418                 retval = read(lexrc2, check_format);
419         }
420         tempfile.removeFile();
421         return retval == ReadOK;
422 }
423
424
425 // don't need to worry about conversion, because this is always
426 // from an internal source
427 bool LyXRC::read(istream & is)
428 {
429         Lexer lexrc(lyxrcTags);
430         lexrc.setStream(is);
431         LYXERR(Debug::LYXRC, "Reading istream...");
432         return read(lexrc, false) == ReadOK;
433 }
434
435
436 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
437 {
438         if (lyxerr.debugging(Debug::PARSER))
439                 lexrc.printTable(lyxerr);
440
441         if (!lexrc.isOK())
442                 return ReadError;
443
444         // default for current rowpainter capabilities
445         force_paint_single_char = true;
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_FORCE_PAINT_SINGLE_CHAR:
553                         lexrc >> force_paint_single_char;
554                         break;
555
556                 case RC_PRINTER:
557                         lexrc >> printer;
558                         break;
559
560                 case RC_PRINT_COMMAND:
561                         if (lexrc.next(true)) {
562                                 print_command = lexrc.getString();
563                         }
564                         break;
565
566                 case RC_PRINTEVENPAGEFLAG:
567                         lexrc >> print_evenpage_flag;
568                         break;
569
570                 case RC_PRINTODDPAGEFLAG:
571                         lexrc >> print_oddpage_flag;
572                         break;
573
574                 case RC_PRINTPAGERANGEFLAG:
575                         lexrc >> print_pagerange_flag;
576                         break;
577
578                 case RC_PRINTCOPIESFLAG:
579                         lexrc >> print_copies_flag;
580                         break;
581
582                 case RC_PRINTCOLLCOPIESFLAG:
583                         lexrc >> print_collcopies_flag;
584                         break;
585
586                 case RC_PRINTREVERSEFLAG:
587                         lexrc >> print_reverse_flag;
588                         break;
589
590                 case RC_PRINTLANDSCAPEFLAG:
591                         lexrc >> print_landscape_flag;
592                         break;
593
594                 case RC_PRINTTOPRINTER:
595                         lexrc >> print_to_printer;
596                         break;
597
598                 case RC_PRINT_ADAPTOUTPUT:
599                         lexrc >> print_adapt_output;
600                         break;
601
602                 case RC_PRINTTOFILE:
603                         if (lexrc.next()) {
604                                 print_to_file = os::internal_path(lexrc.getString());
605                         }
606                         break;
607
608                 case RC_PRINTFILEEXTENSION:
609                         lexrc >> print_file_extension;
610                         break;
611
612                 case RC_PRINTEXSTRAOPTIONS:
613                         lexrc >> print_extra_options;
614                         break;
615
616                 case RC_PRINTSPOOL_COMMAND:
617                         if (lexrc.next(true)) {
618                                 print_spool_command = lexrc.getString();
619                         }
620                         break;
621
622                 case RC_PRINTSPOOL_PRINTERPREFIX:
623                         lexrc >> print_spool_printerprefix;
624                         break;
625
626                 case RC_PRINTPAPERDIMENSIONFLAG:
627                         lexrc >> print_paper_dimension_flag;
628                         break;
629
630                 case RC_PRINTPAPERFLAG:
631                         lexrc >> print_paper_flag;
632                         break;
633
634                 case RC_VIEWDVI_PAPEROPTION:
635                         if (lexrc.next())
636                                 view_dvi_paper_option = lexrc.getString();
637                         else
638                                 view_dvi_paper_option.erase();
639                         break;
640
641                 case RC_CHKTEX_COMMAND:
642                         if (lexrc.next(true)) {
643                                 chktex_command = lexrc.getString();
644                         }
645                         break;
646
647                 case RC_BIBTEX_ALTERNATIVES:
648                         if (lexrc.next(true)) {
649                                 bibtex_alternatives.insert(lexrc.getString());
650                         }
651                         break;
652
653                 case RC_BIBTEX_COMMAND:
654                         if (lexrc.next(true)) {
655                                 bibtex_command = lexrc.getString();
656                         }
657                         break;
658
659                 case RC_JBIBTEX_COMMAND:
660                         if (lexrc.next(true)) {
661                                 jbibtex_command = lexrc.getString();
662                         }
663                         break;
664
665                 case RC_INDEX_ALTERNATIVES:
666                         if (lexrc.next(true)) {
667                                 index_alternatives.insert(lexrc.getString());
668                         }
669                         break;
670
671                 case RC_INDEX_COMMAND:
672                         if (lexrc.next(true)) {
673                                 index_command = lexrc.getString();
674                         }
675                         break;
676
677                 case RC_JINDEX_COMMAND:
678                         if (lexrc.next(true)) {
679                                 jindex_command = lexrc.getString();
680                         }
681                         break;
682
683                 case RC_SPLITINDEX_COMMAND:
684                         if (lexrc.next(true)) {
685                                 splitindex_command = lexrc.getString();
686                         }
687                         break;
688
689                 case RC_NOMENCL_COMMAND:
690                         if (lexrc.next(true)) {
691                                 nomencl_command = lexrc.getString();
692                         }
693                         break;
694
695                 case RC_SCREEN_DPI:
696                         lexrc >> dpi;
697                         break;
698
699                 case RC_SCREEN_ZOOM:
700                         lexrc >> zoom;
701                         break;
702
703                 case RC_GEOMETRY_SESSION:
704                         lexrc >> allow_geometry_session;
705                         break;
706
707                 case RC_SCREEN_FONT_SIZES:
708                         lexrc >> font_sizes[FONT_SIZE_TINY];
709                         lexrc >> font_sizes[FONT_SIZE_SCRIPT];
710                         lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
711                         lexrc >> font_sizes[FONT_SIZE_SMALL];
712                         lexrc >> font_sizes[FONT_SIZE_NORMAL];
713                         lexrc >> font_sizes[FONT_SIZE_LARGE];
714                         lexrc >> font_sizes[FONT_SIZE_LARGER];
715                         lexrc >> font_sizes[FONT_SIZE_LARGEST];
716                         lexrc >> font_sizes[FONT_SIZE_HUGE];
717                         lexrc >> font_sizes[FONT_SIZE_HUGER];
718                         break;
719
720                 case RC_SCREEN_FONT_SCALABLE:
721                         lexrc >> use_scalable_fonts;
722                         break;
723
724                 case RC_AUTOSAVE:
725                         lexrc >> autosave;
726                         break;
727
728                 case RC_DOCUMENTPATH:
729                         if (lexrc.next()) {
730                                 document_path = os::internal_path(lexrc.getString());
731                                 document_path = expandPath(document_path);
732                         }
733                         break;
734
735                 case RC_EXAMPLEPATH:
736                         if (lexrc.next()) {
737                                 example_path = os::internal_path(lexrc.getString());
738                                 example_path = expandPath(example_path);
739                         }
740                         break;
741
742                 case RC_TEMPLATEPATH:
743                         if (lexrc.next()) {
744                                 template_path = os::internal_path(lexrc.getString());
745                                 template_path = expandPath(template_path);
746                         }
747                         break;
748
749                 case RC_TEMPDIRPATH:
750                         if (lexrc.next()) {
751                                 tempdir_path = os::internal_path(lexrc.getString());
752                                 tempdir_path = expandPath(tempdir_path);
753                         }
754                         break;
755
756                 case RC_THESAURUSDIRPATH:
757                         if (lexrc.next()) {
758                                 thesaurusdir_path = os::internal_path(lexrc.getString());
759                                 thesaurusdir_path = expandPath(thesaurusdir_path);
760                         }
761                         break;
762
763                 case RC_HUNSPELLDIR_PATH:
764                         if (lexrc.next()) {
765                                 hunspelldir_path = os::internal_path(lexrc.getString());
766                                 hunspelldir_path = expandPath(hunspelldir_path);
767                         }
768                         break;
769
770                 case RC_USELASTFILEPOS:
771                         lexrc >> use_lastfilepos;
772                         break;
773
774                 case RC_LOADSESSION:
775                         lexrc >> load_session;
776                         break;
777
778                 case RC_MOUSE_WHEEL_SPEED:
779                         lexrc >> mouse_wheel_speed;
780                         break;
781
782                 case RC_COMPLETION_INLINE_DELAY:
783                         lexrc >> completion_inline_delay;
784                         break;
785
786                 case RC_COMPLETION_INLINE_MATH:
787                         lexrc >> completion_inline_math;
788                         break;
789
790                 case RC_COMPLETION_INLINE_TEXT:
791                         lexrc >> completion_inline_text;
792                         break;
793
794                 case RC_COMPLETION_INLINE_DOTS:
795                         lexrc >> completion_inline_dots;
796                         break;
797
798                 case RC_AUTOCORRECTION_MATH:
799                         lexrc >> autocorrection_math;
800                         break;
801
802                 case RC_COMPLETION_POPUP_DELAY:
803                         lexrc >> completion_popup_delay;
804                         break;
805
806                 case RC_COMPLETION_POPUP_MATH:
807                         lexrc >> completion_popup_math;
808                         break;
809
810                 case RC_COMPLETION_POPUP_TEXT:
811                         lexrc >> completion_popup_text;
812                         break;
813
814                 case RC_COMPLETION_CURSOR_TEXT:
815                         lexrc >> completion_cursor_text;
816                         break;
817
818                 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
819                         lexrc >> completion_popup_after_complete;
820                         break;
821
822                 case RC_COMPLETION_MINLENGTH:
823                         lexrc >> completion_minlength;
824                         break;
825
826                 case RC_NUMLASTFILES:
827                         lexrc >> num_lastfiles;
828                         break;
829
830                 case RC_CHECKLASTFILES:
831                         lexrc >> check_lastfiles;
832                         break;
833
834                 case RC_ICON_SET:
835                         lexrc >> icon_set;
836                         break;
837
838                 case RC_USE_SYSTEM_THEME_ICONS:
839                         lexrc >> use_system_theme_icons;
840                         break;
841
842                 case RC_SCREEN_FONT_ROMAN:
843                         if (lexrc.next()) {
844                                 roman_font_name = lexrc.getString();
845                                 oldFontFormat(roman_font_name,
846                                               roman_font_foundry);
847                         }
848                         break;
849
850                 case RC_SCREEN_FONT_SANS:
851                         if (lexrc.next()) {
852                                 sans_font_name = lexrc.getString();
853                                 oldFontFormat(sans_font_name, sans_font_foundry);
854                         }
855                         break;
856
857                 case RC_SCREEN_FONT_TYPEWRITER:
858                         if (lexrc.next()) {
859                                 typewriter_font_name = lexrc.getString();
860                                 oldFontFormat(typewriter_font_name,
861                                               typewriter_font_foundry);
862                         }
863                         break;
864
865                 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
866                         lexrc >> roman_font_foundry;
867                         break;
868
869                 case RC_SCREEN_FONT_SANS_FOUNDRY:
870                         lexrc >> sans_font_foundry;
871                         break;
872
873                 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
874                         lexrc >> typewriter_font_foundry;
875                         break;
876
877                 case RC_SET_COLOR: {
878                         if (!lexrc.next()) {
879                                 lexrc.printError("Missing color tag.");
880                                 break;
881                         }
882                         string lyx_name = lexrc.getString();
883
884                         if (!lexrc.next()) {
885                                 lexrc.printError("Missing color name for color: `$$Token'");
886                                 break;
887                         }
888                         string x11_name = lexrc.getString();
889
890                         ColorCode const col =
891                                 lcolor.getFromLyXName(lyx_name);
892                         if (col == Color_none ||
893                             col == Color_inherit ||
894                             col == Color_ignore)
895                                 break;
896
897                         if (!lcolor.setColor(col, x11_name))
898                                 LYXERR0("Bad lyxrc set_color for " << lyx_name);
899                         break;
900                 }
901
902                 case RC_AUTOREGIONDELETE:
903                         // Auto region delete defaults to true
904                         lexrc >> auto_region_delete;
905                         break;
906
907                 case RC_SERVERPIPE:
908                         if (lexrc.next()) {
909                                 lyxpipes = os::internal_path(lexrc.getString());
910                                 lyxpipes = expandPath(lyxpipes);
911                         }
912                         break;
913
914                 case RC_CURSOR_FOLLOWS_SCROLLBAR:
915                         lexrc >> cursor_follows_scrollbar;
916                         break;
917
918                 case RC_CURSOR_WIDTH:
919                         lexrc >> cursor_width;
920                         break;
921
922                 case RC_SCROLL_BELOW_DOCUMENT:
923                         lexrc >> scroll_below_document;
924                         break;
925
926                 case RC_PARAGRAPH_MARKERS:
927                         lexrc >> paragraph_markers;
928                         break;
929
930                 case RC_MAC_DONTSWAP_CTRL_META:
931                         lexrc >> mac_dontswap_ctrl_meta;
932                         break;
933
934                 case RC_MAC_LIKE_CURSOR_MOVEMENT:
935                         lexrc >> mac_like_cursor_movement;
936                         break;
937
938                 case RC_MACRO_EDIT_STYLE:
939                         if (lexrc.next()) {
940                                 switch (lexrc.getInteger()) {
941                                 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
942                                 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
943                                 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
944                                 }
945                         }
946                         break;
947
948                 case RC_DIALOGS_ICONIFY_WITH_MAIN:
949                         lexrc >> dialogs_iconify_with_main;
950                         break;
951
952                 case RC_PLAINTEXT_LINELEN:
953                         lexrc >> plaintext_linelen;
954                         break;
955                         // Spellchecker settings:
956                 case RC_ACCEPT_COMPOUND:
957                         lexrc >> spellchecker_accept_compound;
958                         break;
959                 case RC_USE_SYSTEM_COLORS:
960                         lexrc >> use_system_colors;
961                         break;
962                 case RC_USE_TOOLTIP:
963                         lexrc >> use_tooltip;
964                         break;
965                 case RC_USE_PIXMAP_CACHE:
966                         lexrc >> use_pixmap_cache;
967                         break;
968                 case RC_USE_QIMAGE:
969                         lexrc >> use_qimage;
970                         break;
971                 case RC_SPELLCHECKER:
972                         lexrc >> spellchecker;
973                         break;
974                 case RC_ALT_LANG:
975                         lexrc >> spellchecker_alt_lang;
976                         break;
977                 case RC_ESC_CHARS:
978                         lexrc >> spellchecker_esc_chars;
979                         break;
980                 case RC_SPELLCHECK_CONTINUOUSLY:
981                         lexrc >> spellcheck_continuously;
982                         break;
983                 case RC_SPELLCHECK_NOTES:
984                         lexrc >> spellcheck_notes;
985                         break;
986                 case RC_MAKE_BACKUP:
987                         lexrc >> make_backup;
988                         break;
989                 case RC_SAVE_COMPRESSED:
990                         lexrc >> save_compressed;
991                         break;
992                 case RC_BACKUPDIR_PATH:
993                         if (lexrc.next()) {
994                                 backupdir_path = os::internal_path(lexrc.getString());
995                                 backupdir_path = expandPath(backupdir_path);
996                         }
997                         break;
998                 case RC_DEFAULT_DECIMAL_POINT:
999                         lexrc >> default_decimal_point;
1000                         break;
1001                 case RC_DEFAULT_LENGTH_UNIT:
1002                         if (lexrc.next())
1003                                 default_length_unit = (Length::UNIT) lexrc.getInteger();
1004                         break;
1005                 case RC_DATE_INSERT_FORMAT:
1006                         lexrc >> date_insert_format;
1007                         break;
1008                 case RC_LANGUAGE_CUSTOM_PACKAGE:
1009                         lexrc >> language_custom_package;
1010                         break;
1011                 case RC_LANGUAGE_AUTO_BEGIN:
1012                         lexrc >> language_auto_begin;
1013                         break;
1014                 case RC_LANGUAGE_AUTO_END:
1015                         lexrc >> language_auto_end;
1016                         break;
1017                 case RC_LANGUAGE_GLOBAL_OPTIONS:
1018                         lexrc >> language_global_options;
1019                         break;
1020                 case RC_LANGUAGE_PACKAGE_SELECTION:
1021                         if (lexrc.next()) {
1022                                 switch (lexrc.getInteger()) {
1023                                 case 0:
1024                                         language_package_selection = LP_AUTO;
1025                                         break;
1026                                 case 1:
1027                                         language_package_selection = LP_BABEL;
1028                                         break;
1029                                 case 2:
1030                                         language_package_selection = LP_CUSTOM;
1031                                         break;
1032                                 case 3:
1033                                         language_package_selection = LP_NONE;
1034                                         break;
1035                                 }
1036                         }
1037                         break;
1038                 case RC_LANGUAGE_COMMAND_BEGIN:
1039                         lexrc >> language_command_begin;
1040                         break;
1041                 case RC_LANGUAGE_COMMAND_END:
1042                         lexrc >> language_command_end;
1043                         break;
1044                 case RC_LANGUAGE_COMMAND_LOCAL:
1045                         lexrc >> language_command_local;
1046                         break;
1047                 case RC_RTL_SUPPORT:
1048                         lexrc >> rtl_support;
1049                         break;
1050                 case RC_VISUAL_CURSOR:
1051                         lexrc >> visual_cursor;
1052                         break;
1053                 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
1054                         lexrc >> close_buffer_with_last_view;
1055                         break;
1056                 case RC_AUTO_NUMBER:
1057                         lexrc >> auto_number;
1058                         break;
1059                 case RC_MARK_FOREIGN_LANGUAGE:
1060                         lexrc >> mark_foreign_language;
1061                         break;
1062
1063                 case RC_COPIER: {
1064                         string fmt, command;
1065                         if (lexrc.next())
1066                                 fmt = lexrc.getString();
1067                         if (lexrc.next(true))
1068                                 command = lexrc.getString();
1069                         setMover(fmt, command);
1070                         break;
1071                 }
1072
1073                 case RC_CONVERTER: {
1074                         string from, to, command, flags;
1075                         if (lexrc.next())
1076                                 from = lexrc.getString();
1077                         if (lexrc.next())
1078                                 to = lexrc.getString();
1079                         if (lexrc.next(true))
1080                                 command = lexrc.getString();
1081                         if (lexrc.next())
1082                                 flags = lexrc.getString();
1083                         if (command.empty())
1084                                 theConverters().erase(from, to);
1085                         else
1086                                 theConverters().add(from, to, command, flags);
1087                         break;
1088                 }
1089                 // compatibility with versions older than 1.4.0 only
1090                 case RC_VIEWER: {
1091                         string format, command;
1092                         lexrc >> format >> command;
1093                         formats.setViewer(format, command);
1094                         break;
1095                 }
1096                 case RC_FILEFORMAT: {
1097                         bool ok = true;
1098                         string format, extensions, prettyname, shortcut;
1099                         if (!(lexrc >> format >> extensions))
1100                                 ok = false;
1101                         if (ok && lexrc.next(true))
1102                                 prettyname  = lexrc.getString();
1103                         else
1104                                 ok = false;
1105                         if (ok)
1106                                 if(!(lexrc >> shortcut))
1107                                         ok = false;
1108                         string viewer, editor;
1109                         if (ok && lexrc.next(true))
1110                                 viewer = lexrc.getString();
1111                         else
1112                                 ok = false;
1113                         if (ok && lexrc.next(true))
1114                                 editor = lexrc.getString();
1115                         else
1116                                 ok = false;
1117                         string flags, mime;
1118                         if (!(lexrc >> flags >> mime))
1119                                 ok = false;
1120                         int flgs = Format::none;
1121                         while (!flags.empty()) {
1122                                 string flag;
1123                                 flags = split(flags, flag, ',');
1124                                 if (flag == "document")
1125                                         flgs |= Format::document;
1126                                 else if (flag == "vector")
1127                                         flgs |= Format::vector;
1128                                 else if (flag == "zipped=native")
1129                                         flgs |= Format::zipped_native;
1130                                 else if (flag == "menu=export")
1131                                         flgs |= Format::export_menu;
1132                                 else
1133                                         LYXERR0("Ignoring unknown flag `"
1134                                                << flag << "' for format `"
1135                                                << format << "'.");
1136                         }
1137                         if (!ok)
1138                                 LYXERR0("Syntax error in format " << format);
1139                         else if (prettyname.empty()) {
1140                                 if (theConverters().formatIsUsed(format))
1141                                         LYXERR0("Can't delete format " << format);
1142                                 else
1143                                         formats.erase(format);
1144                         } else {
1145                                 formats.add(format, extensions, prettyname,
1146                                             shortcut, viewer, editor, mime, flgs);
1147                         }
1148                         break;
1149                 }
1150                 case RC_VIEWER_ALTERNATIVES:  {
1151                         string format, command;
1152                         lexrc >> format;
1153                         lexrc >> command;
1154                         viewer_alternatives[format].insert(command);
1155                         break;
1156                 }
1157                 case RC_EDITOR_ALTERNATIVES:  {
1158                         string format, command;
1159                         lexrc >> format;
1160                         lexrc >> command;
1161                         editor_alternatives[format].insert(command);
1162                         break;
1163                 }
1164
1165                 case RC_DEFAULT_VIEW_FORMAT:
1166                         lexrc >> default_view_format;
1167                         break;
1168
1169                 case RC_GUI_LANGUAGE:
1170                         lexrc >> gui_language;
1171                         break;
1172
1173                 case RC_SHOW_BANNER:
1174                         lexrc >> show_banner;
1175                         break;
1176
1177                 case RC_PREVIEW:
1178                         if (lexrc.next()) {
1179                                 string const tmp = lexrc.getString();
1180                                 if (tmp == "true" || tmp == "on")
1181                                         preview = PREVIEW_ON;
1182                                 else if (tmp == "no_math")
1183                                         preview = PREVIEW_NO_MATH;
1184                                 else {
1185                                         preview = PREVIEW_OFF;
1186                                         if (tmp != "false" && tmp != "off")
1187                                                 LYXERR0("Unrecognized preview status \""
1188                                                        << tmp << '\n');
1189                                 }
1190                         }
1191                         break;
1192
1193                 case RC_PREVIEW_HASHED_LABELS:
1194                         lexrc >> preview_hashed_labels;
1195                         break;
1196
1197                 case RC_PREVIEW_SCALE_FACTOR:
1198                         lexrc >> preview_scale_factor;
1199                         break;
1200
1201                 case RC_USER_NAME:
1202                         lexrc >> user_name;
1203                         break;
1204                 case RC_USER_EMAIL:
1205                         lexrc >> user_email;
1206                         break;
1207
1208                 case RC_PATH_PREFIX:
1209                         lexrc >> path_prefix;
1210                         break;
1211
1212                 case RC_USE_CONVERTER_CACHE:
1213                         lexrc >> use_converter_cache;
1214                         break;
1215                 case RC_CONVERTER_CACHE_MAXAGE:
1216                         lexrc >> converter_cache_maxage;
1217                         break;
1218
1219                 case RC_SORT_LAYOUTS:
1220                         lexrc >> sort_layouts;
1221                         break;
1222                 case RC_GROUP_LAYOUTS:
1223                         lexrc >> group_layouts;
1224                         break;
1225                 case RC_FULL_SCREEN_LIMIT:
1226                         lexrc >> full_screen_limit;
1227                         break;
1228                 case RC_FULL_SCREEN_TOOLBARS:
1229                         lexrc >> full_screen_toolbars;
1230                         break;
1231                 case RC_FULL_SCREEN_SCROLLBAR:
1232                         lexrc >> full_screen_scrollbar;
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_TABBAR:
1943                 if (ignore_system_lyxrc ||
1944                     full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1945                         os << "\\fullscreen_tabbar "
1946                            << convert<string>(full_screen_tabbar)
1947                            << '\n';
1948                 }
1949                 if (tag != RC_LAST)
1950                         break;
1951         case RC_FULL_SCREEN_MENUBAR:
1952                 if (ignore_system_lyxrc ||
1953                     full_screen_menubar != system_lyxrc.full_screen_menubar) {
1954                         os << "\\fullscreen_menubar "
1955                            << convert<string>(full_screen_menubar)
1956                            << '\n';
1957                 }
1958                 if (tag != RC_LAST)
1959                         break;
1960         case RC_FULL_SCREEN_WIDTH:
1961                 if (ignore_system_lyxrc ||
1962                     full_screen_width != system_lyxrc.full_screen_width) {
1963                         os << "\\fullscreen_width "
1964                            << convert<string>(full_screen_width)
1965                            << '\n';
1966                 }
1967                 if (tag != RC_LAST)
1968                         break;
1969         case RC_OPEN_BUFFERS_IN_TABS:
1970                 if (ignore_system_lyxrc ||
1971                     open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1972                         os << "\\open_buffers_in_tabs "
1973                            << convert<string>(open_buffers_in_tabs)
1974                            << '\n';
1975                 }
1976                 if (tag != RC_LAST)
1977                         break;
1978         case RC_SINGLE_CLOSE_TAB_BUTTON:
1979                 if (ignore_system_lyxrc ||
1980                     single_close_tab_button != system_lyxrc.single_close_tab_button) {
1981                         os << "\\single_close_tab_button "
1982                            << convert<string>(single_close_tab_button)
1983                            << '\n';
1984                 }
1985                 if (tag != RC_LAST)
1986                         break;
1987         case RC_SINGLE_INSTANCE:
1988                 if (ignore_system_lyxrc ||
1989                     single_instance != system_lyxrc.single_instance) {
1990                         os << "\\single_instance "
1991                            << convert<string>(single_instance)
1992                            << '\n';
1993                 }
1994                 if (tag != RC_LAST)
1995                         break;
1996         case RC_FORWARD_SEARCH_DVI:
1997                 if (ignore_system_lyxrc ||
1998                     forward_search_dvi != system_lyxrc.forward_search_dvi) {
1999                         os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2000                 }
2001                 if (tag != RC_LAST)
2002                         break;
2003         case RC_FORWARD_SEARCH_PDF:
2004                 if (ignore_system_lyxrc ||
2005                     forward_search_pdf != system_lyxrc.forward_search_pdf) {
2006                         os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2007                 }
2008                 if (tag != RC_LAST)
2009                         break;
2010
2011         os << "\n#\n"
2012                         << "# COLOR SECTION ###################################\n"
2013                         << "#\n\n";
2014
2015         case RC_SET_COLOR:
2016                 for (int i = 0; i < Color_ignore; ++i) {
2017                         ColorCode lc = static_cast<ColorCode>(i);
2018                         string const col = lcolor.getX11Name(lc);
2019                         if (ignore_system_lyxrc
2020                             || col != system_lcolor.getX11Name(lc)) {
2021                                 os << "\\set_color \""
2022                                    << lcolor.getLyXName(lc) << "\" \""
2023                                    << col << "\"\n";
2024                         }
2025                 }
2026                 if (tag != RC_LAST)
2027                         break;
2028
2029                 os << "\n#\n"
2030                    << "# PRINTER SECTION ###################################\n"
2031                    << "#\n\n";
2032
2033         case RC_PRINTER:
2034                 if (ignore_system_lyxrc ||
2035                     printer != system_lyxrc.printer) {
2036                         os << "\\printer \"" << printer << "\"\n";
2037                 }
2038                 if (tag != RC_LAST)
2039                         break;
2040         case RC_PRINT_ADAPTOUTPUT:
2041                 if (ignore_system_lyxrc ||
2042                     print_adapt_output != system_lyxrc.print_adapt_output) {
2043                         os << "\\print_adapt_output "
2044                            << convert<string>(print_adapt_output)
2045                            << '\n';
2046                 }
2047                 if (tag != RC_LAST)
2048                         break;
2049         case RC_PRINT_COMMAND:
2050                 if (ignore_system_lyxrc ||
2051                     print_command != system_lyxrc.print_command) {
2052                         os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
2053                 }
2054                 if (tag != RC_LAST)
2055                         break;
2056         case RC_PRINTEXSTRAOPTIONS:
2057                 if (ignore_system_lyxrc ||
2058                     print_extra_options != system_lyxrc.print_extra_options) {
2059                         os << "\\print_extra_options \"" << print_extra_options
2060                            << "\"\n";
2061                 }
2062                 if (tag != RC_LAST)
2063                         break;
2064         case RC_PRINTSPOOL_COMMAND:
2065                 if (ignore_system_lyxrc ||
2066                     print_spool_command != system_lyxrc.print_spool_command) {
2067                         os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
2068                            << "\"\n";
2069                 }
2070                 if (tag != RC_LAST)
2071                         break;
2072         case RC_PRINTSPOOL_PRINTERPREFIX:
2073                 if (ignore_system_lyxrc ||
2074                     print_spool_printerprefix
2075                     != system_lyxrc.print_spool_printerprefix) {
2076                         os << "\\print_spool_printerprefix \""
2077                            << print_spool_printerprefix << "\"\n";
2078                 }
2079                 if (tag != RC_LAST)
2080                         break;
2081         case RC_PRINTEVENPAGEFLAG:
2082                 if (ignore_system_lyxrc ||
2083                     print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
2084                         os << "\\print_evenpage_flag \"" << print_evenpage_flag
2085                            << "\"\n";
2086                 }
2087                 if (tag != RC_LAST)
2088                         break;
2089         case RC_PRINTODDPAGEFLAG:
2090                 if (ignore_system_lyxrc ||
2091                     print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
2092                         os << "\\print_oddpage_flag \"" << print_oddpage_flag
2093                            << "\"\n";
2094                 }
2095                 if (tag != RC_LAST)
2096                         break;
2097         case RC_PRINTREVERSEFLAG:
2098                 if (ignore_system_lyxrc ||
2099                     print_reverse_flag != system_lyxrc.print_reverse_flag) {
2100                         os << "\\print_reverse_flag \"" << print_reverse_flag
2101                            << "\"\n";
2102                 }
2103                 if (tag != RC_LAST)
2104                         break;
2105         case RC_PRINTLANDSCAPEFLAG:
2106                 if (ignore_system_lyxrc ||
2107                     print_landscape_flag != system_lyxrc.print_landscape_flag) {
2108                         os << "\\print_landscape_flag \"" << print_landscape_flag
2109                            << "\"\n";
2110                 }
2111                 if (tag != RC_LAST)
2112                         break;
2113         case RC_PRINTPAGERANGEFLAG:
2114                 if (ignore_system_lyxrc ||
2115                     print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
2116                         os << "\\print_pagerange_flag \"" << print_pagerange_flag
2117                            << "\"\n";
2118                 }
2119                 if (tag != RC_LAST)
2120                         break;
2121         case RC_PRINTCOPIESFLAG:
2122                 if (ignore_system_lyxrc ||
2123                     print_copies_flag != system_lyxrc.print_copies_flag) {
2124                         os << "\\print_copies_flag \"" << print_copies_flag
2125                            << "\"\n";
2126                 }
2127                 if (tag != RC_LAST)
2128                         break;
2129         case RC_PRINTCOLLCOPIESFLAG:
2130                 if (ignore_system_lyxrc ||
2131                     print_collcopies_flag
2132                     != system_lyxrc.print_collcopies_flag) {
2133                         os << "\\print_collcopies_flag \""
2134                            << print_collcopies_flag
2135                            << "\"\n";
2136                 }
2137                 if (tag != RC_LAST)
2138                         break;
2139         case RC_PRINTPAPERFLAG:
2140                 if (ignore_system_lyxrc ||
2141                     print_paper_flag != system_lyxrc.print_paper_flag) {
2142                         os << "\\print_paper_flag \"" << print_paper_flag
2143                            << "\"\n";
2144                 }
2145                 if (tag != RC_LAST)
2146                         break;
2147         case RC_PRINTPAPERDIMENSIONFLAG:
2148                 if (ignore_system_lyxrc ||
2149                     print_paper_dimension_flag
2150                     != system_lyxrc.print_paper_dimension_flag) {
2151                         os << "\\print_paper_dimension_flag \""
2152                            << print_paper_dimension_flag << "\"\n";
2153                 }
2154                 if (tag != RC_LAST)
2155                         break;
2156         case RC_PRINTTOPRINTER:
2157                 if (ignore_system_lyxrc ||
2158                     print_to_printer != system_lyxrc.print_to_printer) {
2159                         os << "\\print_to_printer \"" << print_to_printer
2160                            << "\"\n";
2161                 }
2162                 if (tag != RC_LAST)
2163                         break;
2164         case RC_PRINTTOFILE:
2165                 if (ignore_system_lyxrc ||
2166                     print_to_file != system_lyxrc.print_to_file) {
2167                         string const path = os::external_path(print_to_file);
2168                         os << "\\print_to_file \"" << path << "\"\n";
2169                 }
2170                 if (tag != RC_LAST)
2171                         break;
2172         case RC_PRINTFILEEXTENSION:
2173                 if (ignore_system_lyxrc ||
2174                     print_file_extension != system_lyxrc.print_file_extension) {
2175                         os << "\\print_file_extension \""
2176                            << print_file_extension
2177                            << "\"\n";
2178                 }
2179                 if (tag != RC_LAST)
2180                         break;
2181
2182                 os << "\n#\n"
2183                    << "# TEX SECTION #######################################\n"
2184                    << "#\n\n";
2185
2186         case RC_TEXINPUTS_PREFIX:
2187                 if (ignore_system_lyxrc ||
2188                     texinputs_prefix != system_lyxrc.texinputs_prefix) {
2189                         os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2190                 }
2191                 if (tag != RC_LAST)
2192                         break;
2193
2194         case RC_FONT_ENCODING:
2195                 if (ignore_system_lyxrc ||
2196                     fontenc != system_lyxrc.fontenc) {
2197                         os << "\\font_encoding \"" << fontenc << "\"\n";
2198                 }
2199                 if (tag != RC_LAST)
2200                         break;
2201
2202         case RC_FORCE_PAINT_SINGLE_CHAR:
2203                 if (ignore_system_lyxrc ||
2204                     force_paint_single_char != system_lyxrc.force_paint_single_char) {
2205                         os << "\\force_paint_single_char \"" << force_paint_single_char << "\"\n";
2206                 }
2207                 if (tag != RC_LAST)
2208                         break;
2209
2210                 os << "\n#\n"
2211                    << "# FILE SECTION ######################################\n"
2212                    << "#\n\n";
2213
2214         case RC_DOCUMENTPATH:
2215                 if (ignore_system_lyxrc ||
2216                     document_path != system_lyxrc.document_path) {
2217                         string const path = os::external_path(document_path);
2218                         os << "\\document_path \"" << path << "\"\n";
2219                 }
2220                 if (tag != RC_LAST)
2221                         break;
2222         case RC_USELASTFILEPOS:
2223                 if (ignore_system_lyxrc ||
2224                     use_lastfilepos != system_lyxrc.use_lastfilepos) {
2225                         os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2226                            << '\n';
2227                 }
2228                 if (tag != RC_LAST)
2229                         break;
2230         case RC_LOADSESSION:
2231                 if (ignore_system_lyxrc ||
2232                     load_session != system_lyxrc.load_session) {
2233                         os << "\\load_session " << convert<string>(load_session)
2234                            << "\n";
2235                 }
2236                 if (tag != RC_LAST)
2237                         break;
2238         case RC_MOUSE_WHEEL_SPEED:
2239                 if (ignore_system_lyxrc ||
2240                     mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2241                         os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2242                 }
2243                 if (tag != RC_LAST)
2244                         break;
2245         case RC_COMPLETION_INLINE_DELAY:
2246                 if (ignore_system_lyxrc ||
2247                     completion_inline_delay != system_lyxrc.completion_inline_delay) {
2248                         os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2249                 }
2250                 if (tag != RC_LAST)
2251                         break;
2252         case RC_COMPLETION_INLINE_MATH:
2253                 if (ignore_system_lyxrc ||
2254                     completion_inline_math != system_lyxrc.completion_inline_math) {
2255                         os << "\\completion_inline_math "
2256                                 << convert<string>(completion_inline_math) << '\n';
2257                 }
2258                 if (tag != RC_LAST)
2259                         break;
2260         case RC_COMPLETION_INLINE_TEXT:
2261                 if (ignore_system_lyxrc ||
2262                     completion_inline_text != system_lyxrc.completion_inline_text) {
2263                         os << "\\completion_inline_text "
2264                                 << convert<string>(completion_inline_text) << '\n';
2265                 }
2266                 if (tag != RC_LAST)
2267                         break;
2268         case RC_COMPLETION_INLINE_DOTS:
2269                 if (ignore_system_lyxrc ||
2270                     completion_inline_dots != system_lyxrc.completion_inline_dots) {
2271                         os << "\\completion_inline_dots "
2272                                 << convert<string>(completion_inline_dots) << '\n';
2273                 }
2274                 if (tag != RC_LAST)
2275                         break;
2276         case RC_AUTOCORRECTION_MATH:
2277                 if (ignore_system_lyxrc ||
2278                     autocorrection_math != system_lyxrc.autocorrection_math) {
2279                         os << "\\autocorrection_math "
2280                                 << convert<string>(autocorrection_math) << '\n';
2281                 }
2282                 if (tag != RC_LAST)
2283                         break;
2284         case RC_COMPLETION_POPUP_DELAY:
2285                 if (ignore_system_lyxrc ||
2286                     completion_popup_delay != system_lyxrc.completion_popup_delay) {
2287                         os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2288                 }
2289                 if (tag != RC_LAST)
2290                         break;
2291         case RC_COMPLETION_POPUP_MATH:
2292                 if (ignore_system_lyxrc ||
2293                     completion_popup_math != system_lyxrc.completion_popup_math) {
2294                         os << "\\completion_popup_math "
2295                                 << convert<string>(completion_popup_math) << '\n';
2296                 }
2297                 if (tag != RC_LAST)
2298                         break;
2299         case RC_COMPLETION_POPUP_TEXT:
2300                 if (ignore_system_lyxrc ||
2301                     completion_popup_text != system_lyxrc.completion_popup_text) {
2302                         os << "\\completion_popup_text "
2303                                 << convert<string>(completion_popup_text) << '\n';
2304                 }
2305                 if (tag != RC_LAST)
2306                         break;
2307         case RC_COMPLETION_CURSOR_TEXT:
2308                 if (ignore_system_lyxrc ||
2309                     completion_cursor_text != system_lyxrc.completion_cursor_text) {
2310                         os << "\\completion_cursor_text "
2311                            << convert<string>(completion_cursor_text) << '\n';
2312                 }
2313                 if (tag != RC_LAST)
2314                         break;
2315         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2316                 if (ignore_system_lyxrc ||
2317                     completion_popup_after_complete
2318                     != system_lyxrc.completion_popup_after_complete) {
2319                         os << "\\completion_popup_after_complete "
2320                                 << convert<string>(completion_popup_after_complete) << '\n';
2321                 }
2322                 if (tag != RC_LAST)
2323                         break;
2324         case RC_COMPLETION_MINLENGTH:
2325                 if (ignore_system_lyxrc ||
2326                         completion_minlength != system_lyxrc.completion_minlength) {
2327                         os << "\\completion_minlength " << convert<string>(completion_minlength)
2328                         << '\n';
2329                 }
2330                 if (tag != RC_LAST)
2331                         break;
2332                         
2333                 case RC_NUMLASTFILES:
2334                 if (ignore_system_lyxrc ||
2335                     num_lastfiles != system_lyxrc.num_lastfiles) {
2336                         os << "\\num_lastfiles " << num_lastfiles << '\n';
2337                 }
2338                 if (tag != RC_LAST)
2339                         break;
2340         case RC_CHECKLASTFILES:
2341                 if (ignore_system_lyxrc ||
2342                     check_lastfiles != system_lyxrc.check_lastfiles) {
2343                         os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2344                            << '\n';
2345                 }
2346                 if (tag != RC_LAST)
2347                         break;
2348         case RC_EXAMPLEPATH:
2349                 if (ignore_system_lyxrc ||
2350                     example_path != system_lyxrc.example_path) {
2351                         string const path = os::external_path(example_path);
2352                         os << "\\example_path \"" << path << "\"\n";
2353                 }
2354                 if (tag != RC_LAST)
2355                         break;
2356         case RC_TEMPLATEPATH:
2357                 if (ignore_system_lyxrc ||
2358                     template_path != system_lyxrc.template_path) {
2359                         string const path = os::external_path(template_path);
2360                         os << "\\template_path \"" << path << "\"\n";
2361                 }
2362                 if (tag != RC_LAST)
2363                         break;
2364         case RC_TEMPDIRPATH:
2365                 if (ignore_system_lyxrc ||
2366                     tempdir_path != system_lyxrc.tempdir_path) {
2367                         string const path = os::external_path(tempdir_path);
2368                         os << "\\tempdir_path \"" << path << "\"\n";
2369                 }
2370                 if (tag != RC_LAST)
2371                         break;
2372         case RC_THESAURUSDIRPATH:
2373                 if (ignore_system_lyxrc ||
2374                     thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2375                         string const path = os::external_path(thesaurusdir_path);
2376                         os << "\\thesaurusdir_path \"" << path << "\"\n";
2377                 }
2378                 if (tag != RC_LAST)
2379                         break;
2380         case RC_HUNSPELLDIR_PATH:
2381                 if (ignore_system_lyxrc ||
2382                     hunspelldir_path != system_lyxrc.hunspelldir_path) {
2383                         string const path = os::external_path(hunspelldir_path);
2384                         os << "\\hunspelldir_path \"" << path << "\"\n";
2385                 }
2386                 if (tag != RC_LAST)
2387                         break;
2388         case RC_PLAINTEXT_LINELEN:
2389                 if (ignore_system_lyxrc ||
2390                     plaintext_linelen != system_lyxrc.plaintext_linelen) {
2391                         os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2392                 }
2393                 if (tag != RC_LAST)
2394                         break;
2395         case RC_MAKE_BACKUP:
2396                 if (ignore_system_lyxrc ||
2397                     make_backup != system_lyxrc.make_backup) {
2398                         os << "\\make_backup " << convert<string>(make_backup) << '\n';
2399                 }
2400                 if (tag != RC_LAST)
2401                         break;
2402         case RC_SAVE_COMPRESSED:
2403                 if (ignore_system_lyxrc ||
2404                     save_compressed != system_lyxrc.save_compressed) {
2405                         os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2406                 }
2407                 if (tag != RC_LAST)
2408                         break;
2409         case RC_BACKUPDIR_PATH:
2410                 if (ignore_system_lyxrc ||
2411                     backupdir_path != system_lyxrc.backupdir_path) {
2412                         string const path = os::external_path(backupdir_path);
2413                         os << "\\backupdir_path \"" << path << "\"\n";
2414                 }
2415                 if (tag != RC_LAST)
2416                         break;
2417
2418                 os << "\n#\n"
2419                    << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2420                    << "#\n\n";
2421
2422                 os << "\n#\n"
2423                    << "# SPELLCHECKER SECTION ##############################\n"
2424                    << "#\n\n";
2425
2426         case RC_ACCEPT_COMPOUND:
2427                 if (ignore_system_lyxrc ||
2428                     spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2429                         os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2430                            << '\n';
2431                 }
2432                 if (tag != RC_LAST)
2433                         break;
2434         case RC_ALT_LANG:
2435                 if (ignore_system_lyxrc ||
2436                     spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2437                         os << "\\alternate_language \"" << spellchecker_alt_lang
2438                            << "\"\n";
2439                 }
2440                 if (tag != RC_LAST)
2441                         break;
2442         case RC_ESC_CHARS:
2443                 if (ignore_system_lyxrc ||
2444                     spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2445                         os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2446                 }
2447                 if (tag != RC_LAST)
2448                         break;
2449         case RC_USE_SYSTEM_COLORS:
2450                 if (ignore_system_lyxrc ||
2451                     use_system_colors != system_lyxrc.use_system_colors) {
2452                         os << "\\use_system_colors "
2453                            << convert<string>(use_system_colors)
2454                            << '\n';
2455                 }
2456                 if (tag != RC_LAST)
2457                         break;
2458         case RC_USE_TOOLTIP:
2459                 if (ignore_system_lyxrc ||
2460                     use_tooltip != system_lyxrc.use_tooltip) {
2461                         os << "\\use_tooltip "
2462                            << convert<string>(use_tooltip)
2463                            << '\n';
2464                 }
2465                 if (tag != RC_LAST)
2466                         break;
2467         case RC_USE_PIXMAP_CACHE:
2468                 if (ignore_system_lyxrc ||
2469                     use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2470                         os << "\\use_pixmap_cache "
2471                            << convert<string>(use_pixmap_cache)
2472                            << '\n';
2473                 }
2474                 if (tag != RC_LAST)
2475                         break;
2476         case RC_USE_QIMAGE:
2477                 if (ignore_system_lyxrc ||
2478                     use_qimage != system_lyxrc.use_qimage) {
2479                         os << "\\use_qimage "
2480                            << convert<string>(use_qimage)
2481                            << '\n';
2482                 }
2483                 if (tag != RC_LAST)
2484                         break;
2485
2486                 os << "\n#\n"
2487                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
2488                    << "#\n\n";
2489                 if (tag != RC_LAST)
2490                         break;
2491
2492         case RC_DEFAULT_DECIMAL_POINT:
2493                 if (ignore_system_lyxrc ||
2494                     default_decimal_point != system_lyxrc.default_decimal_point) {
2495                         os << "\\default_decimal_point " << default_decimal_point << '\n';
2496                 }
2497                 if (tag != RC_LAST)
2498                         break;
2499
2500         case RC_DEFAULT_LENGTH_UNIT:
2501                 if (ignore_system_lyxrc ||
2502                     default_length_unit != system_lyxrc.default_length_unit) {
2503                         os << "\\default_length_unit " << int(default_length_unit) << '\n';
2504                 }
2505                 if (tag != RC_LAST)
2506                         break;
2507
2508         case RC_SPELLCHECKER:
2509                 if (ignore_system_lyxrc ||
2510                     spellchecker != system_lyxrc.spellchecker) {
2511                         os << "\\spellchecker " << spellchecker << '\n';
2512                 }
2513                 if (tag != RC_LAST)
2514                         break;
2515
2516         case RC_SPELLCHECK_CONTINUOUSLY:
2517                 if (ignore_system_lyxrc ||
2518                     spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2519                         os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2520                            << '\n';
2521                 }
2522                 if (tag != RC_LAST)
2523                         break;
2524
2525         case RC_SPELLCHECK_NOTES:
2526                 if (ignore_system_lyxrc ||
2527                     spellcheck_notes != system_lyxrc.spellcheck_notes) {
2528                         os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2529                            << '\n';
2530                 }
2531                 if (tag != RC_LAST)
2532                         break;
2533
2534         case RC_RTL_SUPPORT:
2535                 if (ignore_system_lyxrc ||
2536                     rtl_support != system_lyxrc.rtl_support) {
2537                         os << "\\rtl " << convert<string>(rtl_support) << '\n';
2538                 }
2539                 if (tag != RC_LAST)
2540                         break;
2541         case RC_VISUAL_CURSOR:
2542                 if (ignore_system_lyxrc ||
2543                         visual_cursor != system_lyxrc.visual_cursor) {
2544                         os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2545                 }
2546                 if (tag != RC_LAST)
2547                         break;
2548         case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2549                 if (ignore_system_lyxrc ||
2550                         close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2551                         os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2552                         os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2553                 }
2554                 if (tag != RC_LAST)
2555                         break;
2556         case RC_LANGUAGE_CUSTOM_PACKAGE:
2557                 if (ignore_system_lyxrc ||
2558                     language_custom_package != system_lyxrc.language_custom_package) {
2559                         os << "\\language_custom_package \"" << language_custom_package
2560                            << "\"\n";
2561                 }
2562                 if (tag != RC_LAST)
2563                         break;
2564         case RC_LANGUAGE_GLOBAL_OPTIONS:
2565                 if (ignore_system_lyxrc ||
2566                     language_global_options
2567                     != system_lyxrc.language_global_options) {
2568                         os << "\\language_global_options \""
2569                            << convert<string>(language_global_options)
2570                            << "\"\n";
2571                 }
2572                 if (tag != RC_LAST)
2573                         break;
2574         case RC_LANGUAGE_PACKAGE_SELECTION:
2575                 if (ignore_system_lyxrc ||
2576                     language_package_selection != system_lyxrc.language_package_selection) {
2577                         os << "\\language_package_selection ";
2578                         switch (language_package_selection) {
2579                         case LP_AUTO:
2580                                 os << "0\n";
2581                                 break;
2582                         case LP_BABEL:
2583                                 os << "1\n";
2584                                 break;
2585                         case LP_CUSTOM:
2586                                 os << "2\n";
2587                                 break;
2588                         case LP_NONE:
2589                                 os << "3\n";
2590                                 break;
2591                         }
2592                 }
2593                 if (tag != RC_LAST)
2594                         break;
2595         case RC_LANGUAGE_COMMAND_BEGIN:
2596                 if (ignore_system_lyxrc ||
2597                     language_command_begin
2598                     != system_lyxrc.language_command_begin) {
2599                         os << "\\language_command_begin \""
2600                            << language_command_begin
2601                            << "\"\n";
2602                 }
2603                 if (tag != RC_LAST)
2604                         break;
2605         case RC_LANGUAGE_COMMAND_END:
2606                 if (ignore_system_lyxrc ||
2607                     language_command_end
2608                     != system_lyxrc.language_command_end) {
2609                         os << "\\language_command_end \"" << language_command_end
2610                            << "\"\n";
2611                 }
2612                 if (tag != RC_LAST)
2613                         break;
2614         case RC_LANGUAGE_COMMAND_LOCAL:
2615                 if (ignore_system_lyxrc ||
2616                     language_command_local
2617                     != system_lyxrc.language_command_local) {
2618                         os << "\\language_command_local \""
2619                            << language_command_local
2620                            << "\"\n";
2621                 }
2622                 if (tag != RC_LAST)
2623                         break;
2624         case RC_LANGUAGE_AUTO_BEGIN:
2625                 if (ignore_system_lyxrc ||
2626                     language_auto_begin != system_lyxrc.language_auto_begin) {
2627                         os << "\\language_auto_begin "
2628                            << convert<string>(language_auto_begin) << '\n';
2629                 }
2630                 if (tag != RC_LAST)
2631                         break;
2632         case RC_LANGUAGE_AUTO_END:
2633                 if (ignore_system_lyxrc ||
2634                     language_auto_end != system_lyxrc.language_auto_end) {
2635                         os << "\\language_auto_end "
2636                            << convert<string>(language_auto_end) << '\n';
2637                 }
2638                 if (tag != RC_LAST)
2639                         break;
2640         case RC_MARK_FOREIGN_LANGUAGE:
2641                 if (ignore_system_lyxrc ||
2642                     mark_foreign_language
2643                     != system_lyxrc.mark_foreign_language) {
2644                         os << "\\mark_foreign_language " <<
2645                                 convert<string>(mark_foreign_language) << '\n';
2646                 }
2647                 if (tag != RC_LAST)
2648                         break;
2649
2650                 os << "\n#\n"
2651                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
2652                    << "#\n\n";
2653
2654         case RC_AUTO_NUMBER:
2655                 if (ignore_system_lyxrc ||
2656                     auto_number != system_lyxrc.auto_number) {
2657                         os << "\\auto_number " << convert<string>(auto_number) << '\n';
2658                 }
2659                 if (tag != RC_LAST)
2660                         break;
2661         case RC_GUI_LANGUAGE:
2662                 if (ignore_system_lyxrc ||
2663                     gui_language != system_lyxrc.gui_language) {
2664                         os << "\\gui_language " << gui_language << '\n';
2665                 }
2666                 if (tag != RC_LAST)
2667                         break;
2668         case RC_EXPORT_OVERWRITE:
2669                 if (ignore_system_lyxrc ||
2670                     export_overwrite != system_lyxrc.export_overwrite) {
2671                         string status;
2672                         switch (export_overwrite) {
2673                         case NO_FILES:
2674                                 status = "ask";
2675                                 break;
2676                         case MAIN_FILE:
2677                                 status = "main";
2678                                 break;
2679                         case ALL_FILES:
2680                                 status = "all";
2681                                 break;
2682                         }
2683                         os << "\\export_overwrite " << status << '\n';
2684                 }
2685                 if (tag != RC_LAST)
2686                         break;
2687
2688         case RC_SCROLL_WHEEL_ZOOM:
2689                 if (ignore_system_lyxrc ||
2690                         scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2691                         string status;
2692                         switch (scroll_wheel_zoom) {
2693                         case SCROLL_WHEEL_ZOOM_OFF:
2694                                 status = "off";
2695                                 break;
2696                         case SCROLL_WHEEL_ZOOM_CTRL:
2697                                 status = "ctrl";
2698                                 break;
2699                         case SCROLL_WHEEL_ZOOM_SHIFT:
2700                                 status = "shift";
2701                                 break;
2702                         case SCROLL_WHEEL_ZOOM_ALT:
2703                                 status = "alt";
2704                                 break;
2705                         }
2706                         os << "\\scroll_wheel_zoom " << status << '\n';
2707                 }
2708                 if (tag != RC_LAST)
2709                         break;
2710
2711                 os << "\n#\n"
2712                    << "# FORMATS SECTION ##########################\n"
2713                    << "#\n\n";
2714
2715         case RC_FILEFORMAT:
2716                 // New/modified formats
2717                 for (Formats::const_iterator cit = formats.begin();
2718                      cit != formats.end(); ++cit) {
2719                         Format const * format =
2720                                 system_formats.getFormat(cit->name());
2721                         if (!format ||
2722                             format->extensions() != cit->extensions() ||
2723                             format->prettyname() != cit->prettyname() ||
2724                             format->shortcut() != cit->shortcut() ||
2725                             format->viewer() != cit->viewer() ||
2726                             format->editor() != cit->editor() ||
2727                             format->documentFormat() != cit->documentFormat() ||
2728                             format->vectorFormat() != cit->vectorFormat() ||
2729                             format->inExportMenu() != cit->inExportMenu() ||
2730                             format->mime() != cit->mime()) {
2731                                 os << "\\format \"" << cit->name() << "\" \""
2732                                    << cit->extensions() << "\" \""
2733                                    << cit->prettyname() << "\" \""
2734                                    << cit->shortcut() << "\" \""
2735                                    << escapeCommand(cit->viewer()) << "\" \""
2736                                    << escapeCommand(cit->editor()) << "\" \"";
2737                                 vector<string> flags;
2738                                 if (cit->documentFormat())
2739                                         flags.push_back("document");
2740                                 if (cit->vectorFormat())
2741                                         flags.push_back("vector");
2742                                 if (cit->zippedNative())
2743                                         flags.push_back("zipped=native");
2744                                 if (cit->inExportMenu())
2745                                         flags.push_back("menu=export");
2746
2747                                 os << getStringFromVector(flags);
2748                                 os << "\" \"" << cit->mime() << "\"\n";
2749                         }
2750                 }
2751
2752                 // Look for deleted formats
2753                 for (Formats::const_iterator cit = system_formats.begin();
2754                      cit != system_formats.end(); ++cit)
2755                         if (!formats.getFormat(cit->name()))
2756                                 os << "\\format \"" << cit->name()
2757                                    << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2758                 if (tag != RC_LAST)
2759                         break;
2760         case RC_VIEWER_ALTERNATIVES: {
2761                 Alternatives::const_iterator it = viewer_alternatives.begin();
2762                 Alternatives::const_iterator const en = viewer_alternatives.end();
2763                 Alternatives::const_iterator const sysend =
2764                                 system_lyxrc.viewer_alternatives.end();
2765                 for (; it != en; ++it) {
2766                         string const & fmt = it->first;
2767                         CommandSet const & cmd = it->second;
2768                         CommandSet::const_iterator sit = cmd.begin();
2769                         CommandSet::const_iterator const sen = cmd.end();
2770                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2771                                         system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2772                                         system_lyxrc.viewer_alternatives.find(fmt);
2773                         for (; sit != sen; ++sit) {
2774                                 string const & cmd = *sit;
2775                                 if (ignore_system_lyxrc
2776                                     || sysfmt == sysend               // format not found
2777                                          || sysfmt->second.count(cmd) == 0 // this command not found
2778                                    )
2779                                         os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2780                         }
2781                 }
2782                 if (tag != RC_LAST)
2783                         break;
2784         }
2785         case RC_EDITOR_ALTERNATIVES: {
2786                 Alternatives::const_iterator it = editor_alternatives.begin();
2787                 Alternatives::const_iterator const en = editor_alternatives.end();
2788                 Alternatives::const_iterator const sysend =
2789                                 system_lyxrc.editor_alternatives.end();
2790                 for (; it != en; ++it) {
2791                         string const & fmt = it->first;
2792                         CommandSet const & cmd = it->second;
2793                         CommandSet::const_iterator sit = cmd.begin();
2794                         CommandSet::const_iterator const sen = cmd.end();
2795                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2796                                         system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2797                                         system_lyxrc.editor_alternatives.find(fmt);
2798                         for (; sit != sen; ++sit) {
2799                                 string const & cmd = *sit;
2800                                 if (ignore_system_lyxrc
2801                                     || sysfmt == sysend               // format not found
2802                                     || sysfmt->second.count(cmd) == 0 // this command not found
2803                                    )
2804                                         os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2805                         }
2806                 }
2807                 if (tag != RC_LAST)
2808                         break;
2809         }
2810         case RC_DEFAULT_VIEW_FORMAT:
2811                 if (ignore_system_lyxrc ||
2812                     default_view_format != system_lyxrc.default_view_format) {
2813                         os << "\\default_view_format " << default_view_format << '\n';
2814                 }
2815                 if (tag != RC_LAST)
2816                         break;
2817         case RC_VIEWER:
2818                 // Ignore it
2819                 if (tag != RC_LAST)
2820                         break;
2821
2822                 os << "\n#\n"
2823                    << "# CONVERTERS SECTION ##########################\n"
2824                    << "#\n\n";
2825
2826         case RC_CONVERTER:
2827                 // Look for new converters
2828                 for (Converters::const_iterator cit = theConverters().begin();
2829                      cit != theConverters().end(); ++cit) {
2830                         Converter const * converter =
2831                                 theSystemConverters().getConverter(cit->from,
2832                                                                cit->to);
2833                         if (!converter ||
2834                             converter->command != cit->command ||
2835                             converter->flags != cit->flags)
2836                                 os << "\\converter \"" << cit->from << "\" \""
2837                                    << cit->to << "\" \""
2838                                    << escapeCommand(cit->command) << "\" \""
2839                                    << cit->flags << "\"\n";
2840                 }
2841
2842                 // New/modifed converters
2843                 for (Converters::const_iterator cit = theSystemConverters().begin();
2844                      cit != theSystemConverters().end(); ++cit)
2845                         if (!theConverters().getConverter(cit->from, cit->to))
2846                                 os << "\\converter \"" << cit->from
2847                                    << "\" \"" << cit->to << "\" \"\" \"\"\n";
2848                 if (tag != RC_LAST)
2849                         break;
2850
2851         case RC_COPIER:
2852                 if (tag == RC_LAST)
2853                         os << "\n#\n"
2854                            << "# COPIERS SECTION ##########################\n"
2855                            << "#\n\n";
2856
2857                 // Look for new movers
2858                 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2859                 Movers::const_iterator const sysend = theSystemMovers().end();
2860                 Movers::const_iterator it = theMovers().begin();
2861                 Movers::const_iterator end = theMovers().end();
2862
2863                 for (; it != end; ++it) {
2864                         Movers::const_iterator const sysit =
2865                                 find_if(sysbegin, sysend, SameMover(*it));
2866                         if (sysit == sysend) {
2867                                 string const & fmt = it->first;
2868                                 string const & command =
2869                                         it->second.command();
2870
2871                                 os << "\\copier " << fmt
2872                                    << " \"" << escapeCommand(command) << "\"\n";
2873                         }
2874                 }
2875                 if (tag != RC_LAST)
2876                         break;
2877
2878                 // We don't actually delete SpecialisedMover(s) from the
2879                 // map, just clear their 'command', so there's no need
2880                 // to test for anything else.
2881         }
2882
2883         os.flush();
2884 }
2885
2886
2887 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2888 {
2889         // Why the switch you might ask. It is a trick to ensure that all
2890         // the elements in the LyXRCTags enum is handled. As you can see
2891         // there are no breaks at all. So it is just a huge fall-through.
2892         // The nice thing is that we will get a warning from the compiler
2893         // if we forget an element.
2894         LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2895         switch (tag) {
2896         case LyXRC::RC_LAST:
2897         case LyXRC::RC_ACCEPT_COMPOUND:
2898                 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2899                         if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2900         case LyXRC::RC_ALT_LANG:
2901         case LyXRC::RC_PLAINTEXT_LINELEN:
2902         case LyXRC::RC_AUTOCORRECTION_MATH:
2903         case LyXRC::RC_AUTOREGIONDELETE:
2904         case LyXRC::RC_AUTORESET_OPTIONS:
2905         case LyXRC::RC_AUTOSAVE:
2906         case LyXRC::RC_AUTO_NUMBER:
2907         case LyXRC::RC_BACKUPDIR_PATH:
2908         case LyXRC::RC_BIBTEX_ALTERNATIVES:
2909         case LyXRC::RC_BIBTEX_COMMAND:
2910         case LyXRC::RC_BINDFILE:
2911         case LyXRC::RC_CHECKLASTFILES:
2912         case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2913         case LyXRC::RC_COMPLETION_INLINE_DELAY:
2914         case LyXRC::RC_COMPLETION_INLINE_DOTS:
2915         case LyXRC::RC_COMPLETION_INLINE_MATH:
2916         case LyXRC::RC_COMPLETION_INLINE_TEXT:
2917         case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2918         case LyXRC::RC_COMPLETION_POPUP_DELAY:
2919         case LyXRC::RC_COMPLETION_POPUP_MATH:
2920         case LyXRC::RC_COMPLETION_POPUP_TEXT:
2921         case LyXRC::RC_COMPLETION_MINLENGTH:
2922         case LyXRC::RC_USELASTFILEPOS:
2923         case LyXRC::RC_LOADSESSION:
2924         case LyXRC::RC_CHKTEX_COMMAND:
2925         case LyXRC::RC_CONVERTER:
2926         case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2927         case LyXRC::RC_COPIER:
2928         case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2929         case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2930         case LyXRC::RC_DATE_INSERT_FORMAT:
2931         case LyXRC::RC_GUI_LANGUAGE:
2932         case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2933         case LyXRC::RC_DEFFILE:
2934         case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2935         case LyXRC::RC_DISPLAY_GRAPHICS:
2936         case LyXRC::RC_DOCUMENTPATH:
2937                 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2938                         FileName path(lyxrc_new.document_path);
2939                         if (path.exists() && path.isDirectory())
2940                                 package().document_dir() = FileName(lyxrc.document_path);
2941                 }
2942         case LyXRC::RC_EDITOR_ALTERNATIVES:
2943         case LyXRC::RC_ESC_CHARS:
2944         case LyXRC::RC_EXAMPLEPATH:
2945         case LyXRC::RC_FONT_ENCODING:
2946         case LyXRC::RC_FORCE_PAINT_SINGLE_CHAR:
2947         case LyXRC::RC_FILEFORMAT:
2948         case LyXRC::RC_GROUP_LAYOUTS:
2949         case LyXRC::RC_HUNSPELLDIR_PATH:
2950         case LyXRC::RC_ICON_SET:
2951         case LyXRC::RC_INDEX_ALTERNATIVES:
2952         case LyXRC::RC_INDEX_COMMAND:
2953         case LyXRC::RC_JBIBTEX_COMMAND:
2954         case LyXRC::RC_JINDEX_COMMAND:
2955         case LyXRC::RC_NOMENCL_COMMAND:
2956         case LyXRC::RC_INPUT:
2957         case LyXRC::RC_KBMAP:
2958         case LyXRC::RC_KBMAP_PRIMARY:
2959         case LyXRC::RC_KBMAP_SECONDARY:
2960         case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2961         case LyXRC::RC_LANGUAGE_AUTO_END:
2962         case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2963         case LyXRC::RC_LANGUAGE_COMMAND_END:
2964         case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2965         case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2966         case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2967         case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2968         case LyXRC::RC_LYXRCFORMAT:
2969         case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2970         case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2971         case LyXRC::RC_MACRO_EDIT_STYLE:
2972         case LyXRC::RC_MAKE_BACKUP:
2973         case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2974         case LyXRC::RC_MOUSE_WHEEL_SPEED:
2975         case LyXRC::RC_NUMLASTFILES:
2976         case LyXRC::RC_PARAGRAPH_MARKERS:
2977         case LyXRC::RC_PATH_PREFIX:
2978                 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2979                         prependEnvPath("PATH", lyxrc_new.path_prefix);
2980                 }
2981         case LyXRC::RC_PREVIEW:
2982         case LyXRC::RC_PREVIEW_HASHED_LABELS:
2983         case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2984         case LyXRC::RC_PRINTCOLLCOPIESFLAG:
2985         case LyXRC::RC_PRINTCOPIESFLAG:
2986         case LyXRC::RC_PRINTER:
2987         case LyXRC::RC_PRINTEVENPAGEFLAG:
2988         case LyXRC::RC_PRINTEXSTRAOPTIONS:
2989         case LyXRC::RC_PRINTFILEEXTENSION:
2990         case LyXRC::RC_PRINTLANDSCAPEFLAG:
2991         case LyXRC::RC_PRINTODDPAGEFLAG:
2992         case LyXRC::RC_PRINTPAGERANGEFLAG:
2993         case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
2994         case LyXRC::RC_PRINTPAPERFLAG:
2995         case LyXRC::RC_PRINTREVERSEFLAG:
2996         case LyXRC::RC_PRINTSPOOL_COMMAND:
2997         case LyXRC::RC_PRINTSPOOL_PRINTERPREFIX:
2998         case LyXRC::RC_PRINTTOFILE:
2999         case LyXRC::RC_PRINTTOPRINTER:
3000         case LyXRC::RC_PRINT_ADAPTOUTPUT:
3001         case LyXRC::RC_PRINT_COMMAND:
3002         case LyXRC::RC_RTL_SUPPORT:
3003         case LyXRC::RC_SAVE_COMPRESSED:
3004         case LyXRC::RC_SCREEN_DPI:
3005         case LyXRC::RC_SCREEN_FONT_ROMAN:
3006         case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
3007         case LyXRC::RC_SCREEN_FONT_SANS:
3008         case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
3009         case LyXRC::RC_SCREEN_FONT_SCALABLE:
3010         case LyXRC::RC_SCREEN_FONT_SIZES:
3011         case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
3012         case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3013         case LyXRC::RC_GEOMETRY_SESSION:
3014         case LyXRC::RC_SCREEN_ZOOM:
3015         case LyXRC::RC_SERVERPIPE:
3016         case LyXRC::RC_SET_COLOR:
3017         case LyXRC::RC_SHOW_BANNER:
3018         case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
3019         case LyXRC::RC_SPELLCHECKER:
3020                 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3021                         setSpellChecker();
3022         case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3023         case LyXRC::RC_SPELLCHECK_NOTES:
3024         case LyXRC::RC_SPLITINDEX_COMMAND:
3025         case LyXRC::RC_TEMPDIRPATH:
3026         case LyXRC::RC_TEMPLATEPATH:
3027         case LyXRC::RC_TEX_ALLOWS_SPACES:
3028         case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3029                 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3030                         os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3031                 }
3032         case LyXRC::RC_TEXINPUTS_PREFIX:
3033         case LyXRC::RC_THESAURUSDIRPATH:
3034         case LyXRC::RC_UIFILE:
3035         case LyXRC::RC_USER_EMAIL:
3036         case LyXRC::RC_USER_NAME:
3037         case LyXRC::RC_USE_CONVERTER_CACHE:
3038         case LyXRC::RC_USE_SYSTEM_COLORS:
3039         case LyXRC::RC_USE_TOOLTIP:
3040         case LyXRC::RC_USE_PIXMAP_CACHE:
3041         case LyXRC::RC_USE_QIMAGE:
3042         case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3043         case LyXRC::RC_VIEWDVI_PAPEROPTION:
3044         case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3045         case LyXRC::RC_SINGLE_INSTANCE:
3046         case LyXRC::RC_SORT_LAYOUTS:
3047         case LyXRC::RC_FULL_SCREEN_LIMIT:
3048         case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3049         case LyXRC::RC_FULL_SCREEN_MENUBAR:
3050         case LyXRC::RC_FULL_SCREEN_TABBAR:
3051         case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3052         case LyXRC::RC_FULL_SCREEN_WIDTH:
3053         case LyXRC::RC_VISUAL_CURSOR:
3054         case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3055         case LyXRC::RC_VIEWER:
3056         case LyXRC::RC_VIEWER_ALTERNATIVES:
3057         case LyXRC::RC_FORWARD_SEARCH_DVI:
3058         case LyXRC::RC_FORWARD_SEARCH_PDF:
3059         case LyXRC::RC_EXPORT_OVERWRITE:
3060         case LyXRC::RC_DEFAULT_DECIMAL_POINT:
3061         case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3062         case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3063         case LyXRC::RC_CURSOR_WIDTH:
3064                 break;
3065         }
3066 }
3067
3068
3069 #if 0
3070 string const LyXRC::getDescription(LyXRCTags tag)
3071 {
3072         docstring str;
3073
3074         switch (tag) {
3075         case RC_ACCEPT_COMPOUND:
3076                 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3077                 break;
3078
3079         case RC_ALT_LANG:
3080                 str = _("Specify an alternate language. The default is to use the language of the document.");
3081                 break;
3082
3083         case RC_PLAINTEXT_LINELEN:
3084                 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.");
3085                 break;
3086
3087         case RC_AUTOREGIONDELETE:
3088                 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3089                 break;
3090
3091         case RC_AUTORESET_OPTIONS:
3092                 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3093                 break;
3094
3095         case RC_AUTOSAVE:
3096                 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3097                 break;
3098
3099         case RC_AUTO_NUMBER:
3100                 break;
3101
3102         case RC_BACKUPDIR_PATH:
3103                 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.");
3104                 break;
3105
3106         case RC_BIBTEX_COMMAND:
3107                 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3108                 break;
3109
3110         case RC_JBIBTEX_COMMAND:
3111                 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3112                 break;
3113
3114         case RC_BINDFILE:
3115                 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3116                 break;
3117
3118         case RC_CHECKLASTFILES:
3119                 str = _("Select to check whether the lastfiles still exist.");
3120                 break;
3121
3122         case RC_CHKTEX_COMMAND:
3123                 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3124                 break;
3125
3126         case RC_CONVERTER:
3127                 break;
3128
3129         case RC_COPIER:
3130                 break;
3131
3132         case RC_CURSOR_FOLLOWS_SCROLLBAR:
3133                 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.");
3134                 break;
3135
3136         case RC_CURSOR_WIDTH:
3137                 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3138                 break;
3139
3140         case RC_SCROLL_BELOW_DOCUMENT:
3141                 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");
3142                 break;
3143
3144         case RC_MAC_DONTSWAP_CTRL_META:
3145                 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3146                 break;
3147
3148         case RC_MAC_LIKE_CURSOR_MOVEMENT:
3149                 str = _("Use the Mac OS X conventions for cursor movement");
3150                 break;
3151
3152         case RC_SHOW_MACRO_LABEL:
3153                 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3154                 break;
3155
3156         case RC_DATE_INSERT_FORMAT:
3157                 //xgettext:no-c-format
3158                 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
3159                 break;
3160
3161         case RC_DEFFILE:
3162                 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3163                 break;
3164
3165         case RC_DEFAULT_VIEW_FORMAT:
3166                 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3167                 break;
3168
3169         case RC_DIALOGS_ICONIFY_WITH_MAIN:
3170                 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3171                 break;
3172
3173         case RC_DISPLAY_GRAPHICS:
3174                 str = _("Select how LyX will display any graphics.");
3175                 break;
3176
3177         case RC_DOCUMENTPATH:
3178                 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3179                 break;
3180
3181         case RC_ESC_CHARS:
3182                 str = _("Specify additional chars that can be part of a word.");
3183                 break;
3184
3185         case RC_EXAMPLEPATH:
3186                 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3187                 break;
3188
3189         case RC_FONT_ENCODING:
3190                 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
3191                 break;
3192
3193         case RC_FORCE_PAINT_SINGLE_CHAR:
3194                 str = _("Disable any kerning and ligatures for text drawing on screen.");
3195                 break;
3196
3197         case RC_FILEFORMAT:
3198                 break;
3199
3200         case RC_INDEX_COMMAND:
3201                 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\".");
3202                 break;
3203
3204         case RC_JINDEX_COMMAND:
3205                 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3206                 break;
3207
3208         case RC_NOMENCL_COMMAND:
3209                 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3210                 break;
3211
3212         case RC_INPUT:
3213                 break;
3214
3215         case RC_KBMAP:
3216         case RC_KBMAP_PRIMARY:
3217         case RC_KBMAP_SECONDARY:
3218                 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.");
3219                 break;
3220
3221         case RC_LANGUAGE_AUTO_BEGIN:
3222                 str = _("Select if a language switching command is needed at the beginning of the document.");
3223                 break;
3224
3225         case RC_LANGUAGE_AUTO_END:
3226                 str = _("Select if a language switching command is needed at the end of the document.");
3227                 break;
3228
3229         case RC_LANGUAGE_COMMAND_BEGIN:
3230                 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.");
3231                 break;
3232
3233         case RC_LANGUAGE_COMMAND_END:
3234                 str = _("The LaTeX command for changing back to the language of the document.");
3235                 break;
3236
3237         case RC_LANGUAGE_COMMAND_LOCAL:
3238                 str = _("The LaTeX command for local changing of the language.");
3239                 break;
3240
3241         case RC_LANGUAGE_GLOBAL_OPTIONS:
3242                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3243                 break;
3244
3245         case RC_LANGUAGE_CUSTOM_PACKAGE:
3246                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3247                 break;
3248
3249         case RC_LANGUAGE_PACKAGE_SELECTION:
3250                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3251                 break;
3252
3253         case RC_USELASTFILEPOS:
3254                 str = _("De-select if you do not want LyX to scroll to saved position.");
3255                 break;
3256
3257         case RC_LOADSESSION:
3258                 str = _("De-select to prevent loading files opened from the last LyX session.");
3259                 break;
3260
3261         case RC_MAKE_BACKUP:
3262                 str = _("De-select if you don't want LyX to create backup files.");
3263                 break;
3264
3265         case RC_MARK_FOREIGN_LANGUAGE:
3266                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3267                 break;
3268
3269         case RC_MOUSE_WHEEL_SPEED:
3270                 str = bformat(_("The scrolling speed of the mouse wheel."),
3271                       maxlastfiles);
3272                 break;
3273
3274         case RC_COMPLETION_POPUP_DELAY:
3275                 str = _("The completion popup delay.");
3276                 break;
3277
3278         case RC_COMPLETION_POPUP_MATH:
3279                 str = _("Select to display the completion popup in math mode.");
3280                 break;
3281
3282         case RC_COMPLETION_POPUP_TEXT:
3283                 str = _("Select to display the completion popup in text mode.");
3284                 break;
3285
3286         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3287                 str = _("Show the completion popup without delay after non-unique completion attempt.");
3288                 break;
3289
3290         case RC_COMPLETION_POPUP_TEXT:
3291                 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3292                 break;
3293
3294         case RC_COMPLETION_POPUP_DELAY:
3295                 str = _("The inline completion delay.");
3296                 break;
3297
3298         case RC_COMPLETION_INLINE_MATH:
3299                 str = _("Select to display the inline completion in math mode.");
3300                 break;
3301
3302         case RC_COMPLETION_INLINE_TEXT:
3303                 str = _("Select to display the inline completion in text mode.");
3304                 break;
3305
3306         case RC_COMPLETION_INLINE_DOTS:
3307                 str = _("Use \"...\" to shorten long completions.");
3308                 break;
3309
3310         case RC_AUTOCORRECTION_MATH:
3311                 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
3312                 break;
3313
3314         case RC_NUMLASTFILES:
3315                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3316                         maxlastfiles);
3317                 break;
3318
3319         case RC_PATH_PREFIX:
3320                 str = _("Specify those directories which should be "
3321                          "prepended to the PATH environment variable.\n"
3322                          "Use the OS native format.");
3323                 break;
3324
3325         case RC_PREVIEW:
3326                 str = _("Shows a typeset preview of things such as math");
3327                 break;
3328
3329         case RC_PREVIEW_HASHED_LABELS:
3330                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3331                 break;
3332
3333         case RC_PREVIEW_SCALE_FACTOR:
3334                 str = _("Scale the preview size to suit.");
3335                 break;
3336
3337         case RC_PRINTCOLLCOPIESFLAG:
3338                 str = _("The option for specifying whether the copies should be collated.");
3339                 break;
3340
3341         case RC_PRINTCOPIESFLAG:
3342                 str = _("The option for specifying the number of copies to print.");
3343                 break;
3344
3345         case RC_PRINTER:
3346                 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
3347                 break;
3348
3349         case RC_PRINTEVENPAGEFLAG:
3350                 str = _("The option to print only even pages.");
3351                 break;
3352
3353         case RC_PRINTEXSTRAOPTIONS:
3354                 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
3355                 break;
3356
3357         case RC_PRINTFILEEXTENSION:
3358                 str = _("Extension of printer program output file. Usually \".ps\".");
3359                 break;
3360
3361         case RC_PRINTLANDSCAPEFLAG:
3362                 str = _("The option to print out in landscape.");
3363                 break;
3364
3365         case RC_PRINTODDPAGEFLAG:
3366                 str = _("The option to print only odd pages.");
3367                 break;
3368
3369         case RC_PRINTPAGERANGEFLAG:
3370                 str = _("The option for specifying a comma-separated list of pages to print.");
3371                 break;
3372
3373         case RC_PRINTPAPERDIMENSIONFLAG:
3374                                    str = _("Option to specify the dimensions of the print paper.");
3375                 break;
3376
3377         case RC_PRINTPAPERFLAG:
3378                 str = _("The option to specify paper type.");
3379                 break;
3380
3381         case RC_PRINTREVERSEFLAG:
3382                 str = _("The option to reverse the order of the pages printed.");
3383                 break;
3384
3385         case RC_PRINTSPOOL_COMMAND:
3386                 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.");
3387                 break;
3388
3389         case RC_PRINTSPOOL_PRINTERPREFIX:
3390                 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.");
3391                 break;
3392
3393         case RC_PRINTTOFILE:
3394                 str = _("Option to pass to the print program to print to a file.");
3395                 break;
3396
3397         case RC_PRINTTOPRINTER:
3398                 str = _("Option to pass to the print program to print on a specific printer.");
3399                 break;
3400
3401         case RC_PRINT_ADAPTOUTPUT:
3402                 str = _("Select for LyX to pass the name of the destination printer to your print command.");
3403                 break;
3404
3405         case RC_PRINT_COMMAND:
3406                 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
3407                 break;
3408
3409         case RC_RTL_SUPPORT:
3410                 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
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