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