]> git.lyx.org Git - lyx.git/blob - src/LyXRC.cpp
Added support for natively zipped file formats that do not need decompression for...
[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 = 3;
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, extensions, prettyname, shortcut;
1092                         lexrc >> format >> extensions >> 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 == "zipped=native")
1122                                         flgs |= Format::zipped_native;
1123                                 else if (flag == "menu=export")
1124                                         flgs |= Format::export_menu;
1125                                 else
1126                                         LYXERR0("Ignoring unknown flag `"
1127                                                << flag << "' for format `"
1128                                                << format << "'.");
1129                         }
1130                         if (prettyname.empty()) {
1131                                 if (theConverters().formatIsUsed(format))
1132                                         LYXERR0("Can't delete format " << format);
1133                                 else
1134                                         formats.erase(format);
1135                         } else {
1136                                 formats.add(format, extensions, prettyname,
1137                                             shortcut, viewer, editor, flgs);
1138                         }
1139                         break;
1140                 }
1141                 case RC_VIEWER_ALTERNATIVES:  {
1142                         string format, command;
1143                         if (lexrc.next())
1144                                 format = lexrc.getString();
1145                         if (lexrc.eatLine())
1146                                 command = lexrc.getString();
1147                         viewer_alternatives[format].insert(command);
1148                         break;
1149                 }
1150                 case RC_EDITOR_ALTERNATIVES:  {
1151                         string format, command;
1152                         if (lexrc.next())
1153                                 format = lexrc.getString();
1154                         if (lexrc.eatLine())
1155                                 command = lexrc.getString();
1156                         editor_alternatives[format].insert(command);
1157                         break;
1158                 }
1159
1160                 case RC_DEFAULT_VIEW_FORMAT:
1161                         lexrc >> default_view_format;
1162                         break;
1163
1164                 case RC_DEFAULT_LANGUAGE:
1165                         lexrc >> default_language;
1166                         break;
1167
1168                 case RC_GUI_LANGUAGE:
1169                         lexrc >> gui_language;
1170                         break;
1171
1172                 case RC_SHOW_BANNER:
1173                         lexrc >> show_banner;
1174                         break;
1175
1176                 case RC_PREVIEW:
1177                         if (lexrc.next()) {
1178                                 string const tmp = lexrc.getString();
1179                                 if (tmp == "true" || tmp == "on")
1180                                         preview = PREVIEW_ON;
1181                                 else if (tmp == "no_math")
1182                                         preview = PREVIEW_NO_MATH;
1183                                 else {
1184                                         preview = PREVIEW_OFF;
1185                                         if (tmp != "false" && tmp != "off")
1186                                                 LYXERR0("Unrecognized preview status \""
1187                                                        << tmp << '\n');
1188                                 }
1189                         }
1190                         break;
1191
1192                 case RC_PREVIEW_HASHED_LABELS:
1193                         lexrc >> preview_hashed_labels;
1194                         break;
1195
1196                 case RC_PREVIEW_SCALE_FACTOR:
1197                         lexrc >> preview_scale_factor;
1198                         break;
1199
1200                 case RC_USER_NAME:
1201                         lexrc >> user_name;
1202                         break;
1203                 case RC_USER_EMAIL:
1204                         lexrc >> user_email;
1205                         break;
1206
1207                 case RC_PATH_PREFIX:
1208                         lexrc >> path_prefix;
1209                         break;
1210
1211                 case RC_USE_CONVERTER_CACHE:
1212                         lexrc >> use_converter_cache;
1213                         break;
1214                 case RC_CONVERTER_CACHE_MAXAGE:
1215                         lexrc >> converter_cache_maxage;
1216                         break;
1217
1218                 case RC_SORT_LAYOUTS:
1219                         lexrc >> sort_layouts;
1220                         break;
1221                 case RC_GROUP_LAYOUTS:
1222                         lexrc >> group_layouts;
1223                         break;
1224                 case RC_FULL_SCREEN_LIMIT:
1225                         lexrc >> full_screen_limit;
1226                         break;
1227                 case RC_FULL_SCREEN_TOOLBARS:
1228                         lexrc >> full_screen_toolbars;
1229                         break;
1230                 case RC_FULL_SCREEN_SCROLLBAR:
1231                         lexrc >> full_screen_scrollbar;
1232                         break;
1233                 case RC_FULL_SCREEN_TABBAR:
1234                         lexrc >> full_screen_tabbar;
1235                         break;
1236                 case RC_FULL_SCREEN_MENUBAR:
1237                         lexrc >> full_screen_menubar;
1238                         break;
1239                 case RC_FULL_SCREEN_WIDTH:
1240                         lexrc >> full_screen_width;
1241                         break;
1242                 case RC_OPEN_BUFFERS_IN_TABS:
1243                         lexrc >> open_buffers_in_tabs;
1244                         break;
1245                 case RC_SINGLE_CLOSE_TAB_BUTTON:
1246                         lexrc >> single_close_tab_button;
1247                         break;
1248                 case RC_SINGLE_INSTANCE:
1249                         lexrc >> single_instance;
1250                         if (run_mode == PREFERRED)
1251                                 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1252                         break;
1253                 case RC_FORWARD_SEARCH_DVI:
1254                         if (lexrc.next(true))
1255                                 forward_search_dvi = lexrc.getString();
1256                         break;
1257                 case RC_FORWARD_SEARCH_PDF:
1258                         if (lexrc.next(true))
1259                                 forward_search_pdf = lexrc.getString();
1260                         break;
1261                 case RC_EXPORT_OVERWRITE:
1262                         if (lexrc.next()) {
1263                                 string const tmp = lexrc.getString();
1264                                 if (tmp == "all" || tmp == "true")
1265                                         export_overwrite = ALL_FILES;
1266                                 else if (tmp == "main")
1267                                         export_overwrite = MAIN_FILE;
1268                                 else {
1269                                         export_overwrite = NO_FILES;
1270                                         if (tmp != "ask" && tmp != "false")
1271                                                 LYXERR0("Unrecognized export_overwrite status \""
1272                                                        << tmp << '"');
1273                                 }
1274                         }
1275                         break;
1276                 case RC_SCROLL_WHEEL_ZOOM:
1277                         if (lexrc.next()) {
1278                                 string const tmp = lexrc.getString();
1279                                 if (tmp == "ctrl")
1280                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1281                                 else if (tmp == "shift")
1282                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1283                                 else if (tmp == "alt")
1284                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1285                                 else {
1286                                         scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1287                                         if (tmp != "off" && tmp != "false")
1288                                                 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1289                                                        << tmp << '"');
1290                                 }
1291                         }
1292                         break;
1293
1294                 case RC_LAST:
1295                         break; // this is just a dummy
1296                 }
1297
1298                 // This is triggered the first time through the loop unless
1299                 // we hit a format tag.
1300                 if (check_format && format != LYXRC_FILEFORMAT)
1301                         return FormatMismatch;
1302         }
1303
1304         /// Update converters data-structures
1305         theConverters().update(formats);
1306         theConverters().buildGraph();
1307
1308         return ReadOK;
1309 }
1310
1311
1312 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1313 {
1314         ofstream ofs(filename.toFilesystemEncoding().c_str());
1315         if (ofs)
1316                 write(ofs, ignore_system_lyxrc);
1317 }
1318
1319
1320 void LyXRC::print() const
1321 {
1322         if (lyxerr.debugging())
1323                 write(lyxerr, false);
1324         else
1325                 write(cout, false);
1326 }
1327
1328
1329 class SameMover {
1330 public:
1331         typedef pair<string, SpecialisedMover> Data;
1332
1333         SameMover(Data const & comparison)
1334                 : comparison_(comparison) {}
1335
1336         bool operator()(Data const & data) const
1337         {
1338                 return data.first == comparison_.first &&
1339                         data.second.command() == comparison_.second.command();
1340         }
1341
1342 private:
1343         Data comparison_;
1344 };
1345
1346
1347 namespace {
1348
1349         // Escape \ and " so that LyXLex can read the string later
1350         string escapeCommand(string const & str) {
1351                 return subst(subst(str , "\\", "\\\\"),
1352                              "\"", "\\\"");
1353         }
1354
1355 }
1356
1357
1358 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1359 {
1360         LyXRCTags tag = RC_LAST;
1361
1362         if (!name.empty()) {
1363                 for (int i = 0; i != lyxrcCount; ++i)
1364                         if ("\\" + name == lyxrcTags[i].tag)
1365                                 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1366         }
1367
1368         if (tag == RC_LAST)
1369                 os << "# LyX " << lyx_version
1370                    << " generated this file. If you want to make your own\n"
1371                    << "# modifications you should do them from inside LyX and save.\n\n"
1372                    << "Format " << LYXRC_FILEFORMAT << "\n\n";
1373
1374         // Why the switch you might ask. It is a trick to ensure that all
1375         // the elements in the LyXRCTags enum are handled. As you can see
1376         // there are no breaks at all. So it is just a huge fall-through.
1377         // The nice thing is that we will get a warning from the compiler
1378         // if we forget an element.
1379         switch (tag) {
1380         case RC_LAST:
1381         case RC_INPUT:
1382                 // input/include files are not done here
1383         case RC_LYXRCFORMAT:
1384         case RC_BINDFILE:
1385                 if (ignore_system_lyxrc ||
1386                     bind_file != system_lyxrc.bind_file) {
1387                         string const path = os::external_path(bind_file);
1388                         os << "\\bind_file \"" << path << "\"\n";
1389                 }
1390                 if (tag != RC_LAST)
1391                         break;
1392
1393         case RC_DEFFILE:
1394                 if (ignore_system_lyxrc ||
1395                     def_file != system_lyxrc.def_file) {
1396                         string const path = os::external_path(def_file);
1397                         os << "\\def_file \"" << path << "\"\n";
1398                 }
1399                 if (tag != RC_LAST)
1400                         break;
1401
1402                 //
1403                 // Misc Section
1404                 //
1405                 os << "\n#\n"
1406                    << "# MISC SECTION ######################################\n"
1407                    << "#\n\n";
1408                 // bind files are not done here.
1409
1410         case RC_PATH_PREFIX:
1411                 if (ignore_system_lyxrc ||
1412                     path_prefix != system_lyxrc.path_prefix) {
1413                         os << "\\path_prefix \"" << path_prefix << "\"\n";
1414                 }
1415                 if (tag != RC_LAST)
1416                         break;
1417         case RC_UIFILE:
1418                 if (ignore_system_lyxrc ||
1419                     ui_file != system_lyxrc.ui_file) {
1420                         string const path = os::external_path(ui_file);
1421                         os << "\\ui_file \"" << path << "\"\n";
1422                 }
1423                 if (tag != RC_LAST)
1424                         break;
1425         case RC_AUTOREGIONDELETE:
1426                 if (ignore_system_lyxrc ||
1427                     auto_region_delete != system_lyxrc.auto_region_delete) {
1428                         os << "# Set to false to inhibit automatic replacement of\n"
1429                            << "# the current selection.\n"
1430                            << "\\auto_region_delete " << convert<string>(auto_region_delete)
1431                            << '\n';
1432                 }
1433                 if (tag != RC_LAST)
1434                         break;
1435         case RC_AUTORESET_OPTIONS:
1436                 if (ignore_system_lyxrc ||
1437                     auto_reset_options != system_lyxrc.auto_reset_options) {
1438                         os << "# Set to false to inhibit automatic reset of\n"
1439                            << "# the class options to defaults on class change.\n"
1440                            << "\\auto_reset_options "
1441                            << convert<string>(auto_reset_options)
1442                            << '\n';
1443                 }
1444                 if (tag != RC_LAST)
1445                         break;
1446         case RC_AUTOSAVE:
1447                 if (ignore_system_lyxrc ||
1448                     autosave != system_lyxrc.autosave) {
1449                         os << "# The time interval between auto-saves in seconds.\n"
1450                            << "\\autosave " << autosave << '\n';
1451                 }
1452                 if (tag != RC_LAST)
1453                         break;
1454         case RC_DISPLAY_GRAPHICS:
1455                 if (ignore_system_lyxrc ||
1456                     display_graphics != system_lyxrc.display_graphics) {
1457                         os << "# Display graphics within LyX\n"
1458                            << "# true|false\n"
1459                            << "\\display_graphics "
1460                            << (display_graphics ? "true" : "false")
1461                            << '\n';
1462                 }
1463                 if (tag != RC_LAST)
1464                         break;
1465         case RC_SORT_LAYOUTS:
1466                 if (ignore_system_lyxrc ||
1467                     sort_layouts != system_lyxrc.sort_layouts) {
1468                         os << "# Sort layouts alphabetically.\n"
1469                            << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1470                 }
1471                 if (tag != RC_LAST)
1472                         break;
1473         case RC_GROUP_LAYOUTS:
1474                 if (ignore_system_lyxrc ||
1475                     group_layouts != system_lyxrc.group_layouts) {
1476                         os << "# Group layouts by their category.\n"
1477                            << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1478                 }
1479                 if (tag != RC_LAST)
1480                         break;
1481         case RC_VIEWDVI_PAPEROPTION:
1482                 if (ignore_system_lyxrc ||
1483                     view_dvi_paper_option
1484                     != system_lyxrc.view_dvi_paper_option) {
1485                         os << "# Options used to specify paper size to the\n"
1486                            << "# view_dvi_command (e.g. -paper)\n"
1487                            << "\\view_dvi_paper_option \""
1488                            << view_dvi_paper_option << "\"\n";
1489                 }
1490                 if (tag != RC_LAST)
1491                         break;
1492         case RC_DEFAULT_PAPERSIZE:
1493                 if (ignore_system_lyxrc ||
1494                     default_papersize != system_lyxrc.default_papersize) {
1495                         os << "# The default papersize to use.\n"
1496                            << "\\default_papersize \"";
1497                         switch (default_papersize) {
1498                         case PAPER_DEFAULT:
1499                                 os << "default"; break;
1500                         case PAPER_USLETTER:
1501                                 os << "usletter"; break;
1502                         case PAPER_USLEGAL:
1503                                 os << "legal"; break;
1504                         case PAPER_USEXECUTIVE:
1505                                 os << "executive"; break;
1506                         case PAPER_A3:
1507                                 os << "a3"; break;
1508                         case PAPER_A4:
1509                                 os << "a4"; break;
1510                         case PAPER_A5:
1511                                 os << "a5"; break;
1512                         case PAPER_B5:
1513                                 os << "b5"; break;
1514                         case PAPER_CUSTOM:
1515                         case PAPER_A0:
1516                         case PAPER_A1:
1517                         case PAPER_A2:
1518                         case PAPER_A6:
1519                         case PAPER_B0:
1520                         case PAPER_B1:
1521                         case PAPER_B2:
1522                         case PAPER_B3:
1523                         case PAPER_B4:
1524                         case PAPER_B6:
1525                         case PAPER_C0:
1526                         case PAPER_C1:
1527                         case PAPER_C2:
1528                         case PAPER_C3:
1529                         case PAPER_C4:
1530                         case PAPER_C5:
1531                         case PAPER_C6:
1532                         case PAPER_JISB0:
1533                         case PAPER_JISB1:
1534                         case PAPER_JISB2:
1535                         case PAPER_JISB3:
1536                         case PAPER_JISB4:
1537                         case PAPER_JISB5:
1538                         case PAPER_JISB6: break;
1539                         }
1540                         os << "\"\n";
1541                 }
1542                 if (tag != RC_LAST)
1543                         break;
1544         case RC_CHKTEX_COMMAND:
1545                 if (ignore_system_lyxrc ||
1546                     chktex_command != system_lyxrc.chktex_command) {
1547                         os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1548                 }
1549                 if (tag != RC_LAST)
1550                         break;
1551         case RC_BIBTEX_ALTERNATIVES: {
1552                 CommandSet::const_iterator it = bibtex_alternatives.begin();
1553                 CommandSet::const_iterator end = bibtex_alternatives.end();
1554                 for ( ; it != end; ++it) {
1555                         if (ignore_system_lyxrc
1556                             || !system_lyxrc.bibtex_alternatives.count(*it))
1557                                 os << "\\bibtex_alternatives \""
1558                                    << *it << "\"\n";
1559                 }
1560                 if (tag != RC_LAST)
1561                         break;
1562         }
1563         case RC_BIBTEX_COMMAND:
1564                 if (ignore_system_lyxrc ||
1565                     bibtex_command != system_lyxrc.bibtex_command) {
1566                         os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1567                 }
1568                 if (tag != RC_LAST)
1569                         break;
1570         case RC_JBIBTEX_COMMAND:
1571                 if (ignore_system_lyxrc ||
1572                     jbibtex_command != system_lyxrc.jbibtex_command) {
1573                         os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1574                 }
1575                 if (tag != RC_LAST)
1576                         break;
1577         case RC_INDEX_ALTERNATIVES: {
1578                 CommandSet::const_iterator it = index_alternatives.begin();
1579                 CommandSet::const_iterator end = index_alternatives.end();
1580                 for ( ; it != end; ++it) {
1581                         if (ignore_system_lyxrc
1582                             || !system_lyxrc.index_alternatives.count(*it))
1583                                 os << "\\index_alternatives \""
1584                                    << *it << "\"\n";
1585                 }
1586                 if (tag != RC_LAST)
1587                         break;
1588         }
1589         case RC_INDEX_COMMAND:
1590                 if (ignore_system_lyxrc ||
1591                     index_command != system_lyxrc.index_command) {
1592                         os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1593                 }
1594                 if (tag != RC_LAST)
1595                         break;
1596         case RC_JINDEX_COMMAND:
1597                 if (ignore_system_lyxrc ||
1598                     jindex_command != system_lyxrc.jindex_command) {
1599                         os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1600                 }
1601                 if (tag != RC_LAST)
1602                         break;
1603         case RC_SPLITINDEX_COMMAND:
1604                 if (ignore_system_lyxrc ||
1605                     splitindex_command != system_lyxrc.splitindex_command) {
1606                         os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1607                 }
1608                 if (tag != RC_LAST)
1609                         break;
1610         case RC_NOMENCL_COMMAND:
1611                 if (ignore_system_lyxrc ||
1612                     nomencl_command != system_lyxrc.nomencl_command) {
1613                         os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1614                 }
1615                 if (tag != RC_LAST)
1616                         break;
1617         case RC_TEX_EXPECTS_WINDOWS_PATHS:
1618                 // Don't write this setting to the preferences file,
1619                 // but allow temporary changes (bug 7557).
1620                 if (ignore_system_lyxrc) {
1621                         os << "\\tex_expects_windows_paths "
1622                            << convert<string>(windows_style_tex_paths) << '\n';
1623                 }
1624                 if (tag != RC_LAST)
1625                         break;
1626         case RC_TEX_ALLOWS_SPACES:
1627                 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1628                         os << "\\tex_allows_spaces "
1629                            << convert<string>(tex_allows_spaces) << '\n';
1630                 }
1631                 if (tag != RC_LAST)
1632                         break;
1633         case RC_KBMAP:
1634                 if (ignore_system_lyxrc ||
1635                     use_kbmap != system_lyxrc.use_kbmap) {
1636                         os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1637                 }
1638                 if (tag != RC_LAST)
1639                         break;
1640         case RC_KBMAP_PRIMARY:
1641                 if (ignore_system_lyxrc ||
1642                     primary_kbmap != system_lyxrc.primary_kbmap) {
1643                         string const path = os::external_path(primary_kbmap);
1644                         os << "\\kbmap_primary \"" << path << "\"\n";
1645                 }
1646                 if (tag != RC_LAST)
1647                         break;
1648         case RC_KBMAP_SECONDARY:
1649                 if (ignore_system_lyxrc ||
1650                     secondary_kbmap != system_lyxrc.secondary_kbmap) {
1651                         string const path = os::external_path(secondary_kbmap);
1652                         os << "\\kbmap_secondary \"" << path << "\"\n";
1653                 }
1654                 if (tag != RC_LAST)
1655                         break;
1656         case RC_SERVERPIPE:
1657                 if (ignore_system_lyxrc ||
1658                     lyxpipes != system_lyxrc.lyxpipes) {
1659                         string const path = os::external_path(lyxpipes);
1660                         os << "\\serverpipe \"" << path << "\"\n";
1661                 }
1662                 if (tag != RC_LAST)
1663                         break;
1664         case RC_DATE_INSERT_FORMAT:
1665                 if (ignore_system_lyxrc ||
1666                     date_insert_format != system_lyxrc.date_insert_format) {
1667                         os << "\\date_insert_format \"" << date_insert_format
1668                            << "\"\n";
1669                 }
1670                 if (tag != RC_LAST)
1671                         break;
1672
1673         case RC_USER_NAME:
1674                 os << "\\user_name \"" << user_name << "\"\n";
1675                 if (tag != RC_LAST)
1676                         break;
1677
1678         case RC_USER_EMAIL:
1679                 os << "\\user_email \"" << user_email << "\"\n";
1680                 if (tag != RC_LAST)
1681                         break;
1682
1683         case RC_SHOW_BANNER:
1684                 if (ignore_system_lyxrc ||
1685                     show_banner != system_lyxrc.show_banner) {
1686                         os << "\\show_banner " << convert<string>(show_banner) << '\n';
1687                 }
1688                 if (tag != RC_LAST)
1689                         break;
1690
1691         case RC_PREVIEW:
1692                 if (ignore_system_lyxrc ||
1693                     preview != system_lyxrc.preview) {
1694                         string status;
1695                         switch (preview) {
1696                         case PREVIEW_ON:
1697                                 status = "on";
1698                                 break;
1699                         case PREVIEW_NO_MATH:
1700                                 status = "no_math";
1701                                 break;
1702                         case PREVIEW_OFF:
1703                                 status = "off";
1704                                 break;
1705                         }
1706                         os << "\\preview " << status << '\n';
1707                 }
1708                 if (tag != RC_LAST)
1709                         break;
1710
1711         case RC_PREVIEW_HASHED_LABELS:
1712                 if (ignore_system_lyxrc ||
1713                     preview_hashed_labels !=
1714                     system_lyxrc.preview_hashed_labels) {
1715                         os << "\\preview_hashed_labels "
1716                            << convert<string>(preview_hashed_labels) << '\n';
1717                 }
1718                 if (tag != RC_LAST)
1719                         break;
1720
1721         case RC_PREVIEW_SCALE_FACTOR:
1722                 if (ignore_system_lyxrc ||
1723                     preview_scale_factor != system_lyxrc.preview_scale_factor) {
1724                         os << "\\preview_scale_factor "
1725                            << preview_scale_factor << '\n';
1726                 }
1727                 if (tag != RC_LAST)
1728                         break;
1729
1730         case RC_USE_CONVERTER_CACHE:
1731                 if (ignore_system_lyxrc ||
1732                     use_converter_cache != system_lyxrc.use_converter_cache) {
1733                         os << "\\use_converter_cache "
1734                            << convert<string>(use_converter_cache) << '\n';
1735                 }
1736                 if (tag != RC_LAST)
1737                         break;
1738
1739         case RC_CONVERTER_CACHE_MAXAGE:
1740                 if (ignore_system_lyxrc ||
1741                     converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1742                         os << "\\converter_cache_maxage "
1743                            << converter_cache_maxage << '\n';
1744                 }
1745                 if (tag != RC_LAST)
1746                         break;
1747
1748                 os << "\n#\n"
1749                    << "# SCREEN & FONTS SECTION ############################\n"
1750                    << "#\n\n";
1751
1752         case RC_ICON_SET:
1753                 if (ignore_system_lyxrc ||
1754                     icon_set != system_lyxrc.icon_set) {
1755                         os << "\\icon_set \"" << icon_set
1756                            << "\"\n";
1757                 }
1758                 if (tag != RC_LAST)
1759                         break;
1760
1761         case RC_SCREEN_DPI:
1762                 if (ignore_system_lyxrc ||
1763                     dpi != system_lyxrc.dpi) {
1764                         os << "\\screen_dpi " << dpi << '\n';
1765                 }
1766                 if (tag != RC_LAST)
1767                         break;
1768         case RC_SCREEN_ZOOM:
1769                 if (ignore_system_lyxrc ||
1770                     zoom != system_lyxrc.zoom) {
1771                         os << "\\screen_zoom " << zoom << '\n';
1772                 }
1773                 if (tag != RC_LAST)
1774                         break;
1775         case RC_GEOMETRY_SESSION:
1776                 if (ignore_system_lyxrc ||
1777                     allow_geometry_session != system_lyxrc.allow_geometry_session) {
1778                         os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1779                            << '\n';
1780                 }
1781                 if (tag != RC_LAST)
1782                         break;
1783         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1784                 if (ignore_system_lyxrc ||
1785                     cursor_follows_scrollbar
1786                     != system_lyxrc.cursor_follows_scrollbar) {
1787                         os << "\\cursor_follows_scrollbar "
1788                            << convert<string>(cursor_follows_scrollbar) << '\n';
1789                 }
1790                 if (tag != RC_LAST)
1791                         break;
1792         case RC_CURSOR_WIDTH:
1793                 if (ignore_system_lyxrc ||
1794                         cursor_width
1795                         != system_lyxrc.cursor_width) {
1796                         os << "\\cursor_width "
1797                         << cursor_width << '\n';
1798                 }
1799                 if (tag != RC_LAST)
1800                         break;
1801         case RC_SCROLL_BELOW_DOCUMENT:
1802                 if (ignore_system_lyxrc ||
1803                     scroll_below_document
1804                     != system_lyxrc.scroll_below_document) {
1805                         os << "\\scroll_below_document "
1806                            << convert<string>(scroll_below_document) << '\n';
1807                 }
1808                 if (tag != RC_LAST)
1809                         break;
1810         case RC_PARAGRAPH_MARKERS:
1811                 if (ignore_system_lyxrc ||
1812                         paragraph_markers
1813                     != system_lyxrc.paragraph_markers) {
1814                         os << "\\paragraph_markers "
1815                            << convert<string>(paragraph_markers) << '\n';
1816                 }
1817                 if (tag != RC_LAST)
1818                         break;
1819         case RC_MAC_DONTSWAP_CTRL_META:
1820                 if (ignore_system_lyxrc ||
1821                     mac_dontswap_ctrl_meta
1822                     != system_lyxrc.mac_dontswap_ctrl_meta) {
1823                         os << "\\mac_dontswap_ctrl_meta "
1824                            << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1825                 }
1826                 if (tag != RC_LAST)
1827                         break;
1828         case RC_MAC_LIKE_WORD_MOVEMENT:
1829                 if (ignore_system_lyxrc ||
1830                     mac_like_word_movement
1831                     != system_lyxrc.mac_like_word_movement) {
1832                         os << "\\mac_like_word_movement "
1833                            << convert<string>(mac_like_word_movement) << '\n';
1834                 }
1835                 if (tag != RC_LAST)
1836                         break;
1837         case RC_MACRO_EDIT_STYLE:
1838                 if (ignore_system_lyxrc ||
1839                     macro_edit_style
1840                     != system_lyxrc.macro_edit_style) {
1841                         os << "\\macro_edit_style ";
1842                         switch (macro_edit_style) {
1843                         case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1844                         case MACRO_EDIT_INLINE: os << "1\n"; break;
1845                         case MACRO_EDIT_LIST: os << "2\n"; break;
1846                         }
1847                 }
1848                 if (tag != RC_LAST)
1849                         break;
1850         case RC_DIALOGS_ICONIFY_WITH_MAIN:
1851                 if (ignore_system_lyxrc ||
1852                     dialogs_iconify_with_main
1853                    != system_lyxrc.dialogs_iconify_with_main) {
1854                         os << "\\dialogs_iconify_with_main "
1855                           <<  convert<string>(dialogs_iconify_with_main) << '\n';
1856                 }
1857                 if (tag != RC_LAST)
1858                         break;
1859         case RC_SCREEN_FONT_ROMAN:
1860                 if (ignore_system_lyxrc ||
1861                     roman_font_name != system_lyxrc.roman_font_name) {
1862                         os << "\\screen_font_roman \"" << roman_font_name
1863                            << "\"\n";
1864                 }
1865                 if (tag != RC_LAST)
1866                         break;
1867         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1868                 if (ignore_system_lyxrc ||
1869                     roman_font_foundry != system_lyxrc.roman_font_foundry) {
1870                         os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1871                            << "\"\n";
1872                 }
1873                 if (tag != RC_LAST)
1874                         break;
1875         case RC_SCREEN_FONT_SANS:
1876                 if (ignore_system_lyxrc ||
1877                     sans_font_name != system_lyxrc.sans_font_name) {
1878                         os << "\\screen_font_sans \"" << sans_font_name
1879                            << "\"\n";
1880                 }
1881                 if (tag != RC_LAST)
1882                         break;
1883         case RC_SCREEN_FONT_SANS_FOUNDRY:
1884                 if (ignore_system_lyxrc ||
1885                     sans_font_foundry != system_lyxrc.sans_font_foundry) {
1886                         os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1887                            << "\"\n";
1888                 }
1889                 if (tag != RC_LAST)
1890                         break;
1891         case RC_SCREEN_FONT_TYPEWRITER:
1892                 if (ignore_system_lyxrc ||
1893                     typewriter_font_name != system_lyxrc.typewriter_font_name) {
1894                         os << "\\screen_font_typewriter \""
1895                            << typewriter_font_name << "\"\n";
1896                 }
1897                 if (tag != RC_LAST)
1898                         break;
1899         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1900                 if (ignore_system_lyxrc ||
1901                     typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1902                         os << "\\screen_font_typewriter_foundry \""
1903                            << typewriter_font_foundry << "\"\n";
1904                 }
1905                 if (tag != RC_LAST)
1906                         break;
1907
1908         case RC_SCREEN_FONT_SCALABLE:
1909                 if (ignore_system_lyxrc ||
1910                     use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1911                         os << "\\screen_font_scalable "
1912                            << convert<string>(use_scalable_fonts)
1913                            << '\n';
1914                 }
1915                 if (tag != RC_LAST)
1916                         break;
1917         case RC_SCREEN_FONT_SIZES:
1918                 if (ignore_system_lyxrc ||
1919                     font_sizes[FONT_SIZE_TINY]
1920                     != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1921                     font_sizes[FONT_SIZE_SCRIPT]
1922                     != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1923                     font_sizes[FONT_SIZE_FOOTNOTE]
1924                     != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1925                     font_sizes[FONT_SIZE_SMALL]
1926                     != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1927                     font_sizes[FONT_SIZE_NORMAL]
1928                     != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1929                     font_sizes[FONT_SIZE_LARGE]
1930                     != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1931                     font_sizes[FONT_SIZE_LARGER]
1932                     != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1933                     font_sizes[FONT_SIZE_LARGEST]
1934                     != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1935                     font_sizes[FONT_SIZE_HUGE]
1936                     != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1937                     font_sizes[FONT_SIZE_HUGER]
1938                     != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1939                         os.setf(ios::fixed);
1940                         os.precision(2);
1941                         os << "\\screen_font_sizes"
1942                            << ' ' << font_sizes[FONT_SIZE_TINY]
1943                            << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1944                            << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1945                            << ' ' << font_sizes[FONT_SIZE_SMALL]
1946                            << ' ' << font_sizes[FONT_SIZE_NORMAL]
1947                            << ' ' << font_sizes[FONT_SIZE_LARGE]
1948                            << ' ' << font_sizes[FONT_SIZE_LARGER]
1949                            << ' ' << font_sizes[FONT_SIZE_LARGEST]
1950                            << ' ' << font_sizes[FONT_SIZE_HUGE]
1951                            << ' ' << font_sizes[FONT_SIZE_HUGER]
1952                            << '\n';
1953                 }
1954                 if (tag != RC_LAST)
1955                         break;
1956         case RC_FULL_SCREEN_LIMIT:
1957                 if (ignore_system_lyxrc ||
1958                     full_screen_limit != system_lyxrc.full_screen_limit) {
1959                         os << "\\fullscreen_limit "
1960                            << convert<string>(full_screen_limit)
1961                            << '\n';
1962                 }
1963                 if (tag != RC_LAST)
1964                         break;
1965         case RC_FULL_SCREEN_TOOLBARS:
1966                 if (ignore_system_lyxrc ||
1967                     full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1968                         os << "\\fullscreen_toolbars "
1969                            << convert<string>(full_screen_toolbars)
1970                            << '\n';
1971                 }
1972                 if (tag != RC_LAST)
1973                         break;
1974         case RC_FULL_SCREEN_SCROLLBAR:
1975                 if (ignore_system_lyxrc ||
1976                     full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1977                         os << "\\fullscreen_scrollbar "
1978                            << convert<string>(full_screen_scrollbar)
1979                            << '\n';
1980                 }
1981                 if (tag != RC_LAST)
1982                         break;
1983         case RC_FULL_SCREEN_TABBAR:
1984                 if (ignore_system_lyxrc ||
1985                     full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1986                         os << "\\fullscreen_tabbar "
1987                            << convert<string>(full_screen_tabbar)
1988                            << '\n';
1989                 }
1990                 if (tag != RC_LAST)
1991                         break;
1992         case RC_FULL_SCREEN_MENUBAR:
1993                 if (ignore_system_lyxrc ||
1994                     full_screen_menubar != system_lyxrc.full_screen_menubar) {
1995                         os << "\\fullscreen_menubar "
1996                            << convert<string>(full_screen_menubar)
1997                            << '\n';
1998                 }
1999                 if (tag != RC_LAST)
2000                         break;
2001         case RC_FULL_SCREEN_WIDTH:
2002                 if (ignore_system_lyxrc ||
2003                     full_screen_width != system_lyxrc.full_screen_width) {
2004                         os << "\\fullscreen_width "
2005                            << convert<string>(full_screen_width)
2006                            << '\n';
2007                 }
2008                 if (tag != RC_LAST)
2009                         break;
2010         case RC_OPEN_BUFFERS_IN_TABS:
2011                 if (ignore_system_lyxrc ||
2012                     open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
2013                         os << "\\open_buffers_in_tabs "
2014                            << convert<string>(open_buffers_in_tabs)
2015                            << '\n';
2016                 }
2017                 if (tag != RC_LAST)
2018                         break;
2019         case RC_SINGLE_CLOSE_TAB_BUTTON:
2020                 if (ignore_system_lyxrc ||
2021                     single_close_tab_button != system_lyxrc.single_close_tab_button) {
2022                         os << "\\single_close_tab_button "
2023                            << convert<string>(single_close_tab_button)
2024                            << '\n';
2025                 }
2026                 if (tag != RC_LAST)
2027                         break;
2028         case RC_SINGLE_INSTANCE:
2029                 if (ignore_system_lyxrc ||
2030                     single_instance != system_lyxrc.single_instance) {
2031                         os << "\\single_instance "
2032                            << convert<string>(single_instance)
2033                            << '\n';
2034                 }
2035                 if (tag != RC_LAST)
2036                         break;
2037         case RC_FORWARD_SEARCH_DVI:
2038                 if (ignore_system_lyxrc ||
2039                     forward_search_dvi != system_lyxrc.forward_search_dvi) {
2040                         os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2041                 }
2042                 if (tag != RC_LAST)
2043                         break;
2044         case RC_FORWARD_SEARCH_PDF:
2045                 if (ignore_system_lyxrc ||
2046                     forward_search_pdf != system_lyxrc.forward_search_pdf) {
2047                         os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2048                 }
2049                 if (tag != RC_LAST)
2050                         break;
2051
2052         os << "\n#\n"
2053                         << "# COLOR SECTION ###################################\n"
2054                         << "#\n\n";
2055
2056         case RC_SET_COLOR:
2057                 for (int i = 0; i < Color_ignore; ++i) {
2058                         ColorCode lc = static_cast<ColorCode>(i);
2059                         string const col = lcolor.getX11Name(lc);
2060                         if (ignore_system_lyxrc
2061                             || col != system_lcolor.getX11Name(lc)) {
2062                                 os << "\\set_color \""
2063                                    << lcolor.getLyXName(lc) << "\" \""
2064                                    << col << "\"\n";
2065                         }
2066                 }
2067                 if (tag != RC_LAST)
2068                         break;
2069
2070                 os << "\n#\n"
2071                    << "# PRINTER SECTION ###################################\n"
2072                    << "#\n\n";
2073
2074         case RC_PRINTER:
2075                 if (ignore_system_lyxrc ||
2076                     printer != system_lyxrc.printer) {
2077                         os << "\\printer \"" << printer << "\"\n";
2078                 }
2079                 if (tag != RC_LAST)
2080                         break;
2081         case RC_PRINT_ADAPTOUTPUT:
2082                 if (ignore_system_lyxrc ||
2083                     print_adapt_output != system_lyxrc.print_adapt_output) {
2084                         os << "\\print_adapt_output "
2085                            << convert<string>(print_adapt_output)
2086                            << '\n';
2087                 }
2088                 if (tag != RC_LAST)
2089                         break;
2090         case RC_PRINT_COMMAND:
2091                 if (ignore_system_lyxrc ||
2092                     print_command != system_lyxrc.print_command) {
2093                         os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
2094                 }
2095                 if (tag != RC_LAST)
2096                         break;
2097         case RC_PRINTEXSTRAOPTIONS:
2098                 if (ignore_system_lyxrc ||
2099                     print_extra_options != system_lyxrc.print_extra_options) {
2100                         os << "\\print_extra_options \"" << print_extra_options
2101                            << "\"\n";
2102                 }
2103                 if (tag != RC_LAST)
2104                         break;
2105         case RC_PRINTSPOOL_COMMAND:
2106                 if (ignore_system_lyxrc ||
2107                     print_spool_command != system_lyxrc.print_spool_command) {
2108                         os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
2109                            << "\"\n";
2110                 }
2111                 if (tag != RC_LAST)
2112                         break;
2113         case RC_PRINTSPOOL_PRINTERPREFIX:
2114                 if (ignore_system_lyxrc ||
2115                     print_spool_printerprefix
2116                     != system_lyxrc.print_spool_printerprefix) {
2117                         os << "\\print_spool_printerprefix \""
2118                            << print_spool_printerprefix << "\"\n";
2119                 }
2120                 if (tag != RC_LAST)
2121                         break;
2122         case RC_PRINTEVENPAGEFLAG:
2123                 if (ignore_system_lyxrc ||
2124                     print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
2125                         os << "\\print_evenpage_flag \"" << print_evenpage_flag
2126                            << "\"\n";
2127                 }
2128                 if (tag != RC_LAST)
2129                         break;
2130         case RC_PRINTODDPAGEFLAG:
2131                 if (ignore_system_lyxrc ||
2132                     print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
2133                         os << "\\print_oddpage_flag \"" << print_oddpage_flag
2134                            << "\"\n";
2135                 }
2136                 if (tag != RC_LAST)
2137                         break;
2138         case RC_PRINTREVERSEFLAG:
2139                 if (ignore_system_lyxrc ||
2140                     print_reverse_flag != system_lyxrc.print_reverse_flag) {
2141                         os << "\\print_reverse_flag \"" << print_reverse_flag
2142                            << "\"\n";
2143                 }
2144                 if (tag != RC_LAST)
2145                         break;
2146         case RC_PRINTLANDSCAPEFLAG:
2147                 if (ignore_system_lyxrc ||
2148                     print_landscape_flag != system_lyxrc.print_landscape_flag) {
2149                         os << "\\print_landscape_flag \"" << print_landscape_flag
2150                            << "\"\n";
2151                 }
2152                 if (tag != RC_LAST)
2153                         break;
2154         case RC_PRINTPAGERANGEFLAG:
2155                 if (ignore_system_lyxrc ||
2156                     print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
2157                         os << "\\print_pagerange_flag \"" << print_pagerange_flag
2158                            << "\"\n";
2159                 }
2160                 if (tag != RC_LAST)
2161                         break;
2162         case RC_PRINTCOPIESFLAG:
2163                 if (ignore_system_lyxrc ||
2164                     print_copies_flag != system_lyxrc.print_copies_flag) {
2165                         os << "\\print_copies_flag \"" << print_copies_flag
2166                            << "\"\n";
2167                 }
2168                 if (tag != RC_LAST)
2169                         break;
2170         case RC_PRINTCOLLCOPIESFLAG:
2171                 if (ignore_system_lyxrc ||
2172                     print_collcopies_flag
2173                     != system_lyxrc.print_collcopies_flag) {
2174                         os << "\\print_collcopies_flag \""
2175                            << print_collcopies_flag
2176                            << "\"\n";
2177                 }
2178                 if (tag != RC_LAST)
2179                         break;
2180         case RC_PRINTPAPERFLAG:
2181                 if (ignore_system_lyxrc ||
2182                     print_paper_flag != system_lyxrc.print_paper_flag) {
2183                         os << "\\print_paper_flag \"" << print_paper_flag
2184                            << "\"\n";
2185                 }
2186                 if (tag != RC_LAST)
2187                         break;
2188         case RC_PRINTPAPERDIMENSIONFLAG:
2189                 if (ignore_system_lyxrc ||
2190                     print_paper_dimension_flag
2191                     != system_lyxrc.print_paper_dimension_flag) {
2192                         os << "\\print_paper_dimension_flag \""
2193                            << print_paper_dimension_flag << "\"\n";
2194                 }
2195                 if (tag != RC_LAST)
2196                         break;
2197         case RC_PRINTTOPRINTER:
2198                 if (ignore_system_lyxrc ||
2199                     print_to_printer != system_lyxrc.print_to_printer) {
2200                         os << "\\print_to_printer \"" << print_to_printer
2201                            << "\"\n";
2202                 }
2203                 if (tag != RC_LAST)
2204                         break;
2205         case RC_PRINTTOFILE:
2206                 if (ignore_system_lyxrc ||
2207                     print_to_file != system_lyxrc.print_to_file) {
2208                         string const path = os::external_path(print_to_file);
2209                         os << "\\print_to_file \"" << path << "\"\n";
2210                 }
2211                 if (tag != RC_LAST)
2212                         break;
2213         case RC_PRINTFILEEXTENSION:
2214                 if (ignore_system_lyxrc ||
2215                     print_file_extension != system_lyxrc.print_file_extension) {
2216                         os << "\\print_file_extension \""
2217                            << print_file_extension
2218                            << "\"\n";
2219                 }
2220                 if (tag != RC_LAST)
2221                         break;
2222
2223                 os << "\n#\n"
2224                    << "# TEX SECTION #######################################\n"
2225                    << "#\n\n";
2226
2227         case RC_TEXINPUTS_PREFIX:
2228                 if (ignore_system_lyxrc ||
2229                     texinputs_prefix != system_lyxrc.texinputs_prefix) {
2230                         os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2231                 }
2232                 if (tag != RC_LAST)
2233                         break;
2234
2235         case RC_FONT_ENCODING:
2236                 if (ignore_system_lyxrc ||
2237                     fontenc != system_lyxrc.fontenc) {
2238                         os << "\\font_encoding \"" << fontenc << "\"\n";
2239                 }
2240                 if (tag != RC_LAST)
2241                         break;
2242
2243         case RC_FORCE_PAINT_SINGLE_CHAR:
2244                 if (ignore_system_lyxrc ||
2245                     force_paint_single_char != system_lyxrc.force_paint_single_char) {
2246                         os << "\\force_paint_single_char \"" << force_paint_single_char << "\"\n";
2247                 }
2248                 if (tag != RC_LAST)
2249                         break;
2250
2251                 os << "\n#\n"
2252                    << "# FILE SECTION ######################################\n"
2253                    << "#\n\n";
2254
2255         case RC_DOCUMENTPATH:
2256                 if (ignore_system_lyxrc ||
2257                     document_path != system_lyxrc.document_path) {
2258                         string const path = os::external_path(document_path);
2259                         os << "\\document_path \"" << path << "\"\n";
2260                 }
2261                 if (tag != RC_LAST)
2262                         break;
2263         case RC_USELASTFILEPOS:
2264                 if (ignore_system_lyxrc ||
2265                     use_lastfilepos != system_lyxrc.use_lastfilepos) {
2266                         os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2267                            << '\n';
2268                 }
2269                 if (tag != RC_LAST)
2270                         break;
2271         case RC_LOADSESSION:
2272                 if (ignore_system_lyxrc ||
2273                     load_session != system_lyxrc.load_session) {
2274                         os << "\\load_session " << convert<string>(load_session)
2275                            << "\n";
2276                 }
2277                 if (tag != RC_LAST)
2278                         break;
2279         case RC_MOUSE_WHEEL_SPEED:
2280                 if (ignore_system_lyxrc ||
2281                     mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2282                         os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2283                 }
2284                 if (tag != RC_LAST)
2285                         break;
2286         case RC_COMPLETION_INLINE_DELAY:
2287                 if (ignore_system_lyxrc ||
2288                     completion_inline_delay != system_lyxrc.completion_inline_delay) {
2289                         os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2290                 }
2291                 if (tag != RC_LAST)
2292                         break;
2293         case RC_COMPLETION_INLINE_MATH:
2294                 if (ignore_system_lyxrc ||
2295                     completion_inline_math != system_lyxrc.completion_inline_math) {
2296                         os << "\\completion_inline_math "
2297                                 << convert<string>(completion_inline_math) << '\n';
2298                 }
2299                 if (tag != RC_LAST)
2300                         break;
2301         case RC_COMPLETION_INLINE_TEXT:
2302                 if (ignore_system_lyxrc ||
2303                     completion_inline_text != system_lyxrc.completion_inline_text) {
2304                         os << "\\completion_inline_text "
2305                                 << convert<string>(completion_inline_text) << '\n';
2306                 }
2307                 if (tag != RC_LAST)
2308                         break;
2309         case RC_COMPLETION_INLINE_DOTS:
2310                 if (ignore_system_lyxrc ||
2311                     completion_inline_dots != system_lyxrc.completion_inline_dots) {
2312                         os << "\\completion_inline_dots "
2313                                 << convert<string>(completion_inline_dots) << '\n';
2314                 }
2315                 if (tag != RC_LAST)
2316                         break;
2317         case RC_AUTOCORRECTION_MATH:
2318                 if (ignore_system_lyxrc ||
2319                     autocorrection_math != system_lyxrc.autocorrection_math) {
2320                         os << "\\autocorrection_math "
2321                                 << convert<string>(autocorrection_math) << '\n';
2322                 }
2323                 if (tag != RC_LAST)
2324                         break;
2325         case RC_COMPLETION_POPUP_DELAY:
2326                 if (ignore_system_lyxrc ||
2327                     completion_popup_delay != system_lyxrc.completion_popup_delay) {
2328                         os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2329                 }
2330                 if (tag != RC_LAST)
2331                         break;
2332         case RC_COMPLETION_POPUP_MATH:
2333                 if (ignore_system_lyxrc ||
2334                     completion_popup_math != system_lyxrc.completion_popup_math) {
2335                         os << "\\completion_popup_math "
2336                                 << convert<string>(completion_popup_math) << '\n';
2337                 }
2338                 if (tag != RC_LAST)
2339                         break;
2340         case RC_COMPLETION_POPUP_TEXT:
2341                 if (ignore_system_lyxrc ||
2342                     completion_popup_text != system_lyxrc.completion_popup_text) {
2343                         os << "\\completion_popup_text "
2344                                 << convert<string>(completion_popup_text) << '\n';
2345                 }
2346                 if (tag != RC_LAST)
2347                         break;
2348         case RC_COMPLETION_CURSOR_TEXT:
2349                 if (ignore_system_lyxrc ||
2350                     completion_cursor_text != system_lyxrc.completion_cursor_text) {
2351                         os << "\\completion_cursor_text "
2352                            << convert<string>(completion_cursor_text) << '\n';
2353                 }
2354                 if (tag != RC_LAST)
2355                         break;
2356         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2357                 if (ignore_system_lyxrc ||
2358                     completion_popup_after_complete
2359                     != system_lyxrc.completion_popup_after_complete) {
2360                         os << "\\completion_popup_after_complete "
2361                                 << convert<string>(completion_popup_after_complete) << '\n';
2362                 }
2363                 if (tag != RC_LAST)
2364                         break;
2365         case RC_NUMLASTFILES:
2366                 if (ignore_system_lyxrc ||
2367                     num_lastfiles != system_lyxrc.num_lastfiles) {
2368                         os << "\\num_lastfiles " << num_lastfiles << '\n';
2369                 }
2370                 if (tag != RC_LAST)
2371                         break;
2372         case RC_CHECKLASTFILES:
2373                 if (ignore_system_lyxrc ||
2374                     check_lastfiles != system_lyxrc.check_lastfiles) {
2375                         os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2376                            << '\n';
2377                 }
2378                 if (tag != RC_LAST)
2379                         break;
2380         case RC_EXAMPLEPATH:
2381                 if (ignore_system_lyxrc ||
2382                     example_path != system_lyxrc.example_path) {
2383                         string const path = os::external_path(example_path);
2384                         os << "\\example_path \"" << path << "\"\n";
2385                 }
2386                 if (tag != RC_LAST)
2387                         break;
2388         case RC_TEMPLATEPATH:
2389                 if (ignore_system_lyxrc ||
2390                     template_path != system_lyxrc.template_path) {
2391                         string const path = os::external_path(template_path);
2392                         os << "\\template_path \"" << path << "\"\n";
2393                 }
2394                 if (tag != RC_LAST)
2395                         break;
2396         case RC_TEMPDIRPATH:
2397                 if (ignore_system_lyxrc ||
2398                     tempdir_path != system_lyxrc.tempdir_path) {
2399                         string const path = os::external_path(tempdir_path);
2400                         os << "\\tempdir_path \"" << path << "\"\n";
2401                 }
2402                 if (tag != RC_LAST)
2403                         break;
2404         case RC_THESAURUSDIRPATH:
2405                 if (ignore_system_lyxrc ||
2406                     thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2407                         string const path = os::external_path(thesaurusdir_path);
2408                         os << "\\thesaurusdir_path \"" << path << "\"\n";
2409                 }
2410                 if (tag != RC_LAST)
2411                         break;
2412         case RC_HUNSPELLDIR_PATH:
2413                 if (ignore_system_lyxrc ||
2414                     hunspelldir_path != system_lyxrc.hunspelldir_path) {
2415                         string const path = os::external_path(hunspelldir_path);
2416                         os << "\\hunspelldir_path \"" << path << "\"\n";
2417                 }
2418                 if (tag != RC_LAST)
2419                         break;
2420         case RC_PLAINTEXT_LINELEN:
2421                 if (ignore_system_lyxrc ||
2422                     plaintext_linelen != system_lyxrc.plaintext_linelen) {
2423                         os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2424                 }
2425                 if (tag != RC_LAST)
2426                         break;
2427         case RC_MAKE_BACKUP:
2428                 if (ignore_system_lyxrc ||
2429                     make_backup != system_lyxrc.make_backup) {
2430                         os << "\\make_backup " << convert<string>(make_backup) << '\n';
2431                 }
2432                 if (tag != RC_LAST)
2433                         break;
2434         case RC_SAVE_COMPRESSED:
2435                 if (ignore_system_lyxrc ||
2436                     save_compressed != system_lyxrc.save_compressed) {
2437                         os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2438                 }
2439                 if (tag != RC_LAST)
2440                         break;
2441         case RC_BACKUPDIR_PATH:
2442                 if (ignore_system_lyxrc ||
2443                     backupdir_path != system_lyxrc.backupdir_path) {
2444                         string const path = os::external_path(backupdir_path);
2445                         os << "\\backupdir_path \"" << path << "\"\n";
2446                 }
2447                 if (tag != RC_LAST)
2448                         break;
2449
2450                 os << "\n#\n"
2451                    << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2452                    << "#\n\n";
2453
2454                 os << "\n#\n"
2455                    << "# SPELLCHECKER SECTION ##############################\n"
2456                    << "#\n\n";
2457
2458         case RC_ACCEPT_COMPOUND:
2459                 if (ignore_system_lyxrc ||
2460                     spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2461                         os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2462                            << '\n';
2463                 }
2464                 if (tag != RC_LAST)
2465                         break;
2466         case RC_ALT_LANG:
2467                 if (ignore_system_lyxrc ||
2468                     spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2469                         os << "\\alternate_language \"" << spellchecker_alt_lang
2470                            << "\"\n";
2471                 }
2472                 if (tag != RC_LAST)
2473                         break;
2474         case RC_ESC_CHARS:
2475                 if (ignore_system_lyxrc ||
2476                     spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2477                         os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2478                 }
2479                 if (tag != RC_LAST)
2480                         break;
2481         case RC_USE_SYSTEM_COLORS:
2482                 if (ignore_system_lyxrc ||
2483                     use_system_colors != system_lyxrc.use_system_colors) {
2484                         os << "\\use_system_colors "
2485                            << convert<string>(use_system_colors)
2486                            << '\n';
2487                 }
2488                 if (tag != RC_LAST)
2489                         break;
2490         case RC_USE_TOOLTIP:
2491                 if (ignore_system_lyxrc ||
2492                     use_tooltip != system_lyxrc.use_tooltip) {
2493                         os << "\\use_tooltip "
2494                            << convert<string>(use_tooltip)
2495                            << '\n';
2496                 }
2497                 if (tag != RC_LAST)
2498                         break;
2499         case RC_USE_PIXMAP_CACHE:
2500                 if (ignore_system_lyxrc ||
2501                     use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2502                         os << "\\use_pixmap_cache "
2503                            << convert<string>(use_pixmap_cache)
2504                            << '\n';
2505                 }
2506                 if (tag != RC_LAST)
2507                         break;
2508
2509                 os << "\n#\n"
2510                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
2511                    << "#\n\n";
2512                 if (tag != RC_LAST)
2513                         break;
2514
2515         case RC_DEFAULT_DECIMAL_POINT:
2516                 if (ignore_system_lyxrc ||
2517                     default_decimal_point != system_lyxrc.default_decimal_point) {
2518                         os << "\\default_decimal_point " << default_decimal_point << '\n';
2519                 }
2520                 if (tag != RC_LAST)
2521                         break;
2522
2523         case RC_SPELLCHECKER:
2524                 if (ignore_system_lyxrc ||
2525                     spellchecker != system_lyxrc.spellchecker) {
2526                         os << "\\spellchecker " << spellchecker << '\n';
2527                 }
2528                 if (tag != RC_LAST)
2529                         break;
2530
2531         case RC_SPELLCHECK_CONTINUOUSLY:
2532                 if (ignore_system_lyxrc ||
2533                     spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2534                         os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2535                            << '\n';
2536                 }
2537                 if (tag != RC_LAST)
2538                         break;
2539
2540         case RC_SPELLCHECK_NOTES:
2541                 if (ignore_system_lyxrc ||
2542                     spellcheck_notes != system_lyxrc.spellcheck_notes) {
2543                         os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2544                            << '\n';
2545                 }
2546                 if (tag != RC_LAST)
2547                         break;
2548
2549         case RC_RTL_SUPPORT:
2550                 if (ignore_system_lyxrc ||
2551                     rtl_support != system_lyxrc.rtl_support) {
2552                         os << "\\rtl " << convert<string>(rtl_support) << '\n';
2553                 }
2554                 if (tag != RC_LAST)
2555                         break;
2556         case RC_VISUAL_CURSOR:
2557                 if (ignore_system_lyxrc ||
2558                         visual_cursor != system_lyxrc.visual_cursor) {
2559                         os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2560                 }
2561                 if (tag != RC_LAST)
2562                         break;
2563         case RC_LANGUAGE_CUSTOM_PACKAGE:
2564                 if (ignore_system_lyxrc ||
2565                     language_custom_package != system_lyxrc.language_custom_package) {
2566                         os << "\\language_custom_package \"" << language_custom_package
2567                            << "\"\n";
2568                 }
2569                 if (tag != RC_LAST)
2570                         break;
2571         case RC_LANGUAGE_GLOBAL_OPTIONS:
2572                 if (ignore_system_lyxrc ||
2573                     language_global_options
2574                     != system_lyxrc.language_global_options) {
2575                         os << "\\language_global_options \""
2576                            << convert<string>(language_global_options)
2577                            << "\"\n";
2578                 }
2579                 if (tag != RC_LAST)
2580                         break;
2581         case RC_LANGUAGE_PACKAGE_SELECTION:
2582                 if (ignore_system_lyxrc ||
2583                     language_package_selection != system_lyxrc.language_package_selection) {
2584                         os << "\\language_package_selection ";
2585                         switch (language_package_selection) {
2586                         case LP_AUTO:
2587                                 os << "0\n";
2588                                 break;
2589                         case LP_BABEL:
2590                                 os << "1\n";
2591                                 break;
2592                         case LP_CUSTOM:
2593                                 os << "2\n";
2594                                 break;
2595                         case LP_NONE:
2596                                 os << "3\n";
2597                                 break;
2598                         }
2599                 }
2600                 if (tag != RC_LAST)
2601                         break;
2602         case RC_LANGUAGE_COMMAND_BEGIN:
2603                 if (ignore_system_lyxrc ||
2604                     language_command_begin
2605                     != system_lyxrc.language_command_begin) {
2606                         os << "\\language_command_begin \""
2607                            << language_command_begin
2608                            << "\"\n";
2609                 }
2610                 if (tag != RC_LAST)
2611                         break;
2612         case RC_LANGUAGE_COMMAND_END:
2613                 if (ignore_system_lyxrc ||
2614                     language_command_end
2615                     != system_lyxrc.language_command_end) {
2616                         os << "\\language_command_end \"" << language_command_end
2617                            << "\"\n";
2618                 }
2619                 if (tag != RC_LAST)
2620                         break;
2621         case RC_LANGUAGE_COMMAND_LOCAL:
2622                 if (ignore_system_lyxrc ||
2623                     language_command_local
2624                     != system_lyxrc.language_command_local) {
2625                         os << "\\language_command_local \""
2626                            << language_command_local
2627                            << "\"\n";
2628                 }
2629                 if (tag != RC_LAST)
2630                         break;
2631         case RC_LANGUAGE_AUTO_BEGIN:
2632                 if (ignore_system_lyxrc ||
2633                     language_auto_begin != system_lyxrc.language_auto_begin) {
2634                         os << "\\language_auto_begin "
2635                            << convert<string>(language_auto_begin) << '\n';
2636                 }
2637                 if (tag != RC_LAST)
2638                         break;
2639         case RC_LANGUAGE_AUTO_END:
2640                 if (ignore_system_lyxrc ||
2641                     language_auto_end != system_lyxrc.language_auto_end) {
2642                         os << "\\language_auto_end "
2643                            << convert<string>(language_auto_end) << '\n';
2644                 }
2645                 if (tag != RC_LAST)
2646                         break;
2647         case RC_MARK_FOREIGN_LANGUAGE:
2648                 if (ignore_system_lyxrc ||
2649                     mark_foreign_language
2650                     != system_lyxrc.mark_foreign_language) {
2651                         os << "\\mark_foreign_language " <<
2652                                 convert<string>(mark_foreign_language) << '\n';
2653                 }
2654                 if (tag != RC_LAST)
2655                         break;
2656
2657                 os << "\n#\n"
2658                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
2659                    << "#\n\n";
2660
2661         case RC_AUTO_NUMBER:
2662                 if (ignore_system_lyxrc ||
2663                     auto_number != system_lyxrc.auto_number) {
2664                         os << "\\auto_number " << convert<string>(auto_number) << '\n';
2665                 }
2666                 if (tag != RC_LAST)
2667                         break;
2668         case RC_DEFAULT_LANGUAGE:
2669                 if (ignore_system_lyxrc ||
2670                     default_language != system_lyxrc.default_language) {
2671                         os << "\\default_language " << default_language << '\n';
2672                 }
2673                 if (tag != RC_LAST)
2674                         break;
2675         case RC_GUI_LANGUAGE:
2676                 if (ignore_system_lyxrc ||
2677                     gui_language != system_lyxrc.gui_language) {
2678                         os << "\\gui_language " << gui_language << '\n';
2679                 }
2680                 if (tag != RC_LAST)
2681                         break;
2682         case RC_EXPORT_OVERWRITE:
2683                 if (ignore_system_lyxrc ||
2684                     export_overwrite != system_lyxrc.export_overwrite) {
2685                         string status;
2686                         switch (export_overwrite) {
2687                         case NO_FILES:
2688                                 status = "ask";
2689                                 break;
2690                         case MAIN_FILE:
2691                                 status = "main";
2692                                 break;
2693                         case ALL_FILES:
2694                                 status = "all";
2695                                 break;
2696                         }
2697                         os << "\\export_overwrite " << status << '\n';
2698                 }
2699                 if (tag != RC_LAST)
2700                         break;
2701
2702         case RC_SCROLL_WHEEL_ZOOM:
2703                 if (ignore_system_lyxrc ||
2704                         scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2705                         string status;
2706                         switch (scroll_wheel_zoom) {
2707                         case SCROLL_WHEEL_ZOOM_OFF:
2708                                 status = "off";
2709                                 break;
2710                         case SCROLL_WHEEL_ZOOM_CTRL:
2711                                 status = "ctrl";
2712                                 break;
2713                         case SCROLL_WHEEL_ZOOM_SHIFT:
2714                                 status = "shift";
2715                                 break;
2716                         case SCROLL_WHEEL_ZOOM_ALT:
2717                                 status = "alt";
2718                                 break;
2719                         }
2720                         os << "\\scroll_wheel_zoom " << status << '\n';
2721                 }
2722                 if (tag != RC_LAST)
2723                         break;
2724
2725                 os << "\n#\n"
2726                    << "# FORMATS SECTION ##########################\n"
2727                    << "#\n\n";
2728
2729         case RC_FILEFORMAT:
2730                 // New/modified formats
2731                 for (Formats::const_iterator cit = formats.begin();
2732                      cit != formats.end(); ++cit) {
2733                         Format const * format =
2734                                 system_formats.getFormat(cit->name());
2735                         if (!format ||
2736                             format->extensions() != cit->extensions() ||
2737                             format->prettyname() != cit->prettyname() ||
2738                             format->shortcut() != cit->shortcut() ||
2739                             format->viewer() != cit->viewer() ||
2740                             format->editor() != cit->editor() ||
2741                             format->documentFormat() != cit->documentFormat() ||
2742                             format->vectorFormat() != cit->vectorFormat() ||
2743                             format->inExportMenu() != cit->inExportMenu()) {
2744                                 os << "\\format \"" << cit->name() << "\" \""
2745                                    << cit->extensions() << "\" \""
2746                                    << cit->prettyname() << "\" \""
2747                                    << cit->shortcut() << "\" \""
2748                                    << escapeCommand(cit->viewer()) << "\" \""
2749                                    << escapeCommand(cit->editor()) << "\" \"";
2750                                 vector<string> flags;
2751                                 if (cit->documentFormat())
2752                                         flags.push_back("document");
2753                                 if (cit->vectorFormat())
2754                                         flags.push_back("vector");
2755                                 if (cit->zippedNative())
2756                                         flags.push_back("zipped=native");
2757                                 if (cit->inExportMenu())
2758                                         flags.push_back("menu=export");
2759
2760                                 os << getStringFromVector(flags);
2761                                 os << "\"\n";
2762                         }
2763                 }
2764
2765                 // Look for deleted formats
2766                 for (Formats::const_iterator cit = system_formats.begin();
2767                      cit != system_formats.end(); ++cit)
2768                         if (!formats.getFormat(cit->name()))
2769                                 os << "\\format \"" << cit->name()
2770                                    << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2771                 if (tag != RC_LAST)
2772                         break;
2773         case RC_VIEWER_ALTERNATIVES: {
2774                 Alternatives::const_iterator it = viewer_alternatives.begin();
2775                 Alternatives::const_iterator const en = viewer_alternatives.end();
2776                 Alternatives::const_iterator const sysend =
2777                                 system_lyxrc.viewer_alternatives.end();
2778                 for (; it != en; ++it) {
2779                         string const & fmt = it->first;
2780                         CommandSet const & cmd = it->second;
2781                         CommandSet::const_iterator sit = cmd.begin();
2782                         CommandSet::const_iterator const sen = cmd.end();
2783                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2784                                         system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2785                                         system_lyxrc.viewer_alternatives.find(fmt);
2786                         for (; sit != sen; ++sit) {
2787                                 string const & cmd = *sit;
2788                                 if (ignore_system_lyxrc
2789                                     || sysfmt == sysend               // format not found
2790                                          || sysfmt->second.count(cmd) == 0 // this command not found
2791                                    )
2792                                         os << "\\viewer_alternatives " << fmt << " " << cmd << "\n";
2793                         }
2794                 }
2795                 if (tag != RC_LAST)
2796                         break;
2797         }
2798         case RC_EDITOR_ALTERNATIVES: {
2799                 Alternatives::const_iterator it = editor_alternatives.begin();
2800                 Alternatives::const_iterator const en = editor_alternatives.end();
2801                 Alternatives::const_iterator const sysend =
2802                                 system_lyxrc.editor_alternatives.end();
2803                 for (; it != en; ++it) {
2804                         string const & fmt = it->first;
2805                         CommandSet const & cmd = it->second;
2806                         CommandSet::const_iterator sit = cmd.begin();
2807                         CommandSet::const_iterator const sen = cmd.end();
2808                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2809                                         system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2810                                         system_lyxrc.editor_alternatives.find(fmt);
2811                         for (; sit != sen; ++sit) {
2812                                 string const & cmd = *sit;
2813                                 if (ignore_system_lyxrc
2814                                     || sysfmt == sysend               // format not found
2815                                     || sysfmt->second.count(cmd) == 0 // this command not found
2816                                    )
2817                                         os << "\\editor_alternatives " << fmt << " " << cmd << "\n";
2818                         }
2819                 }
2820                 if (tag != RC_LAST)
2821                         break;
2822         }
2823         case RC_DEFAULT_VIEW_FORMAT:
2824                 if (ignore_system_lyxrc ||
2825                     default_view_format != system_lyxrc.default_view_format) {
2826                         os << "\\default_view_format " << default_view_format << '\n';
2827                 }
2828                 if (tag != RC_LAST)
2829                         break;
2830         case RC_VIEWER:
2831                 // Ignore it
2832                 if (tag != RC_LAST)
2833                         break;
2834
2835                 os << "\n#\n"
2836                    << "# CONVERTERS SECTION ##########################\n"
2837                    << "#\n\n";
2838
2839         case RC_CONVERTER:
2840                 // Look for new converters
2841                 for (Converters::const_iterator cit = theConverters().begin();
2842                      cit != theConverters().end(); ++cit) {
2843                         Converter const * converter =
2844                                 theSystemConverters().getConverter(cit->from,
2845                                                                cit->to);
2846                         if (!converter ||
2847                             converter->command != cit->command ||
2848                             converter->flags != cit->flags)
2849                                 os << "\\converter \"" << cit->from << "\" \""
2850                                    << cit->to << "\" \""
2851                                    << escapeCommand(cit->command) << "\" \""
2852                                    << cit->flags << "\"\n";
2853                 }
2854
2855                 // New/modifed converters
2856                 for (Converters::const_iterator cit = theSystemConverters().begin();
2857                      cit != theSystemConverters().end(); ++cit)
2858                         if (!theConverters().getConverter(cit->from, cit->to))
2859                                 os << "\\converter \"" << cit->from
2860                                    << "\" \"" << cit->to << "\" \"\" \"\"\n";
2861                 if (tag != RC_LAST)
2862                         break;
2863
2864         case RC_COPIER:
2865                 if (tag == RC_LAST)
2866                         os << "\n#\n"
2867                            << "# COPIERS SECTION ##########################\n"
2868                            << "#\n\n";
2869
2870                 // Look for new movers
2871                 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2872                 Movers::const_iterator const sysend = theSystemMovers().end();
2873                 Movers::const_iterator it = theMovers().begin();
2874                 Movers::const_iterator end = theMovers().end();
2875
2876                 for (; it != end; ++it) {
2877                         Movers::const_iterator const sysit =
2878                                 find_if(sysbegin, sysend, SameMover(*it));
2879                         if (sysit == sysend) {
2880                                 string const & fmt = it->first;
2881                                 string const & command =
2882                                         it->second.command();
2883
2884                                 os << "\\copier " << fmt
2885                                    << " \"" << escapeCommand(command) << "\"\n";
2886                         }
2887                 }
2888                 if (tag != RC_LAST)
2889                         break;
2890
2891                 // We don't actually delete SpecialisedMover(s) from the
2892                 // map, just clear their 'command', so there's no need
2893                 // to test for anything else.
2894         }
2895
2896         os.flush();
2897 }
2898
2899
2900 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2901 {
2902         // Why the switch you might ask. It is a trick to ensure that all
2903         // the elements in the LyXRCTags enum is handled. As you can see
2904         // there are no breaks at all. So it is just a huge fall-through.
2905         // The nice thing is that we will get a warning from the compiler
2906         // if we forget an element.
2907         LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2908         switch (tag) {
2909         case LyXRC::RC_LAST:
2910         case LyXRC::RC_ACCEPT_COMPOUND:
2911                 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2912                         if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2913         case LyXRC::RC_ALT_LANG:
2914         case LyXRC::RC_PLAINTEXT_LINELEN:
2915         case LyXRC::RC_AUTOCORRECTION_MATH:
2916         case LyXRC::RC_AUTOREGIONDELETE:
2917         case LyXRC::RC_AUTORESET_OPTIONS:
2918         case LyXRC::RC_AUTOSAVE:
2919         case LyXRC::RC_AUTO_NUMBER:
2920         case LyXRC::RC_BACKUPDIR_PATH:
2921         case LyXRC::RC_BIBTEX_ALTERNATIVES:
2922         case LyXRC::RC_BIBTEX_COMMAND:
2923         case LyXRC::RC_BINDFILE:
2924         case LyXRC::RC_CHECKLASTFILES:
2925         case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2926         case LyXRC::RC_COMPLETION_INLINE_DELAY:
2927         case LyXRC::RC_COMPLETION_INLINE_DOTS:
2928         case LyXRC::RC_COMPLETION_INLINE_MATH:
2929         case LyXRC::RC_COMPLETION_INLINE_TEXT:
2930         case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2931         case LyXRC::RC_COMPLETION_POPUP_DELAY:
2932         case LyXRC::RC_COMPLETION_POPUP_MATH:
2933         case LyXRC::RC_COMPLETION_POPUP_TEXT:
2934         case LyXRC::RC_USELASTFILEPOS:
2935         case LyXRC::RC_LOADSESSION:
2936         case LyXRC::RC_CHKTEX_COMMAND:
2937         case LyXRC::RC_CONVERTER:
2938         case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2939         case LyXRC::RC_COPIER:
2940         case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2941         case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2942         case LyXRC::RC_DATE_INSERT_FORMAT:
2943         case LyXRC::RC_DEFAULT_LANGUAGE:
2944         case LyXRC::RC_GUI_LANGUAGE:
2945         case LyXRC::RC_DEFAULT_PAPERSIZE:
2946         case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2947         case LyXRC::RC_DEFFILE:
2948         case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2949         case LyXRC::RC_DISPLAY_GRAPHICS:
2950         case LyXRC::RC_DOCUMENTPATH:
2951                 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2952                         FileName path(lyxrc_new.document_path);
2953                         if (path.exists() && path.isDirectory())
2954                                 package().document_dir() = FileName(lyxrc.document_path);
2955                 }
2956         case LyXRC::RC_EDITOR_ALTERNATIVES:
2957         case LyXRC::RC_ESC_CHARS:
2958         case LyXRC::RC_EXAMPLEPATH:
2959         case LyXRC::RC_FONT_ENCODING:
2960         case LyXRC::RC_FORCE_PAINT_SINGLE_CHAR:
2961         case LyXRC::RC_FILEFORMAT:
2962         case LyXRC::RC_GROUP_LAYOUTS:
2963         case LyXRC::RC_HUNSPELLDIR_PATH:
2964         case LyXRC::RC_ICON_SET:
2965         case LyXRC::RC_INDEX_ALTERNATIVES:
2966         case LyXRC::RC_INDEX_COMMAND:
2967         case LyXRC::RC_JBIBTEX_COMMAND:
2968         case LyXRC::RC_JINDEX_COMMAND:
2969         case LyXRC::RC_NOMENCL_COMMAND:
2970         case LyXRC::RC_INPUT:
2971         case LyXRC::RC_KBMAP:
2972         case LyXRC::RC_KBMAP_PRIMARY:
2973         case LyXRC::RC_KBMAP_SECONDARY:
2974         case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2975         case LyXRC::RC_LANGUAGE_AUTO_END:
2976         case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2977         case LyXRC::RC_LANGUAGE_COMMAND_END:
2978         case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2979         case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2980         case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2981         case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2982         case LyXRC::RC_LYXRCFORMAT:
2983         case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2984         case LyXRC::RC_MAC_LIKE_WORD_MOVEMENT:
2985         case LyXRC::RC_MACRO_EDIT_STYLE:
2986         case LyXRC::RC_MAKE_BACKUP:
2987         case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2988         case LyXRC::RC_MOUSE_WHEEL_SPEED:
2989         case LyXRC::RC_NUMLASTFILES:
2990         case LyXRC::RC_PARAGRAPH_MARKERS:
2991         case LyXRC::RC_PATH_PREFIX:
2992                 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2993                         prependEnvPath("PATH", lyxrc_new.path_prefix);
2994                 }
2995         case LyXRC::RC_PREVIEW:
2996         case LyXRC::RC_PREVIEW_HASHED_LABELS:
2997         case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2998         case LyXRC::RC_PRINTCOLLCOPIESFLAG:
2999         case LyXRC::RC_PRINTCOPIESFLAG:
3000         case LyXRC::RC_PRINTER:
3001         case LyXRC::RC_PRINTEVENPAGEFLAG:
3002         case LyXRC::RC_PRINTEXSTRAOPTIONS:
3003         case LyXRC::RC_PRINTFILEEXTENSION:
3004         case LyXRC::RC_PRINTLANDSCAPEFLAG:
3005         case LyXRC::RC_PRINTODDPAGEFLAG:
3006         case LyXRC::RC_PRINTPAGERANGEFLAG:
3007         case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
3008         case LyXRC::RC_PRINTPAPERFLAG:
3009         case LyXRC::RC_PRINTREVERSEFLAG:
3010         case LyXRC::RC_PRINTSPOOL_COMMAND:
3011         case LyXRC::RC_PRINTSPOOL_PRINTERPREFIX:
3012         case LyXRC::RC_PRINTTOFILE:
3013         case LyXRC::RC_PRINTTOPRINTER:
3014         case LyXRC::RC_PRINT_ADAPTOUTPUT:
3015         case LyXRC::RC_PRINT_COMMAND:
3016         case LyXRC::RC_RTL_SUPPORT:
3017         case LyXRC::RC_SAVE_COMPRESSED:
3018         case LyXRC::RC_SCREEN_DPI:
3019         case LyXRC::RC_SCREEN_FONT_ROMAN:
3020         case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
3021         case LyXRC::RC_SCREEN_FONT_SANS:
3022         case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
3023         case LyXRC::RC_SCREEN_FONT_SCALABLE:
3024         case LyXRC::RC_SCREEN_FONT_SIZES:
3025         case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
3026         case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3027         case LyXRC::RC_GEOMETRY_SESSION:
3028         case LyXRC::RC_SCREEN_ZOOM:
3029         case LyXRC::RC_SERVERPIPE:
3030         case LyXRC::RC_SET_COLOR:
3031         case LyXRC::RC_SHOW_BANNER:
3032         case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
3033         case LyXRC::RC_SPELLCHECKER:
3034                 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3035                         setSpellChecker();
3036         case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3037         case LyXRC::RC_SPELLCHECK_NOTES:
3038         case LyXRC::RC_SPLITINDEX_COMMAND:
3039         case LyXRC::RC_TEMPDIRPATH:
3040         case LyXRC::RC_TEMPLATEPATH:
3041         case LyXRC::RC_TEX_ALLOWS_SPACES:
3042         case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3043                 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3044                         os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3045                 }
3046         case LyXRC::RC_TEXINPUTS_PREFIX:
3047         case LyXRC::RC_THESAURUSDIRPATH:
3048         case LyXRC::RC_UIFILE:
3049         case LyXRC::RC_USER_EMAIL:
3050         case LyXRC::RC_USER_NAME:
3051         case LyXRC::RC_USE_CONVERTER_CACHE:
3052         case LyXRC::RC_USE_SYSTEM_COLORS:
3053         case LyXRC::RC_USE_TOOLTIP:
3054         case LyXRC::RC_USE_PIXMAP_CACHE:
3055         case LyXRC::RC_VIEWDVI_PAPEROPTION:
3056         case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3057         case LyXRC::RC_SINGLE_INSTANCE:
3058         case LyXRC::RC_SORT_LAYOUTS:
3059         case LyXRC::RC_FULL_SCREEN_LIMIT:
3060         case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3061         case LyXRC::RC_FULL_SCREEN_MENUBAR:
3062         case LyXRC::RC_FULL_SCREEN_TABBAR:
3063         case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3064         case LyXRC::RC_FULL_SCREEN_WIDTH:
3065         case LyXRC::RC_VISUAL_CURSOR:
3066         case LyXRC::RC_VIEWER:
3067         case LyXRC::RC_VIEWER_ALTERNATIVES:
3068         case LyXRC::RC_FORWARD_SEARCH_DVI:
3069         case LyXRC::RC_FORWARD_SEARCH_PDF:
3070         case LyXRC::RC_EXPORT_OVERWRITE:
3071         case LyXRC::RC_DEFAULT_DECIMAL_POINT:
3072         case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3073         case LyXRC::RC_CURSOR_WIDTH:
3074                 break;
3075         }
3076 }
3077
3078
3079 #if 0
3080 string const LyXRC::getDescription(LyXRCTags tag)
3081 {
3082         docstring str;
3083
3084         switch (tag) {
3085         case RC_ACCEPT_COMPOUND:
3086                 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3087                 break;
3088
3089         case RC_ALT_LANG:
3090                 str = _("Specify an alternate language. The default is to use the language of the document.");
3091                 break;
3092
3093         case RC_PLAINTEXT_LINELEN:
3094                 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.");
3095                 break;
3096
3097         case RC_AUTOREGIONDELETE:
3098                 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3099                 break;
3100
3101         case RC_AUTORESET_OPTIONS:
3102                 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3103                 break;
3104
3105         case RC_AUTOSAVE:
3106                 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3107                 break;
3108
3109         case RC_AUTO_NUMBER:
3110                 break;
3111
3112         case RC_BACKUPDIR_PATH:
3113                 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.");
3114                 break;
3115
3116         case RC_BIBTEX_COMMAND:
3117                 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3118                 break;
3119
3120         case RC_JBIBTEX_COMMAND:
3121                 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3122                 break;
3123
3124         case RC_BINDFILE:
3125                 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3126                 break;
3127
3128         case RC_CHECKLASTFILES:
3129                 str = _("Select to check whether the lastfiles still exist.");
3130                 break;
3131
3132         case RC_CHKTEX_COMMAND:
3133                 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3134                 break;
3135
3136         case RC_CONVERTER:
3137                 break;
3138
3139         case RC_COPIER:
3140                 break;
3141
3142         case RC_CURSOR_FOLLOWS_SCROLLBAR:
3143                 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.");
3144                 break;
3145
3146         case RC_CURSOR_WIDTH:
3147                 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3148                 break;
3149
3150         case RC_SCROLL_BELOW_DOCUMENT:
3151                 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");
3152                 break;
3153
3154         case RC_MAC_DONTSWAP_CTRL_META:
3155                 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3156                 break;
3157
3158         case RC_MAC_LIKE_WORD_MOVEMENT:
3159                 str = _("Use the Mac OS X conventions for the word-level cursor movement");
3160                 break;
3161
3162         case RC_SHOW_MACRO_LABEL:
3163                 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3164                 break;
3165
3166         case RC_DATE_INSERT_FORMAT:
3167                 //xgettext:no-c-format
3168                 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
3169                 break;
3170
3171         case RC_DEFFILE:
3172                 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3173                 break;
3174
3175         case RC_DEFAULT_VIEW_FORMAT:
3176                 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3177                 break;
3178
3179         case RC_DEFAULT_LANGUAGE:
3180                 str = _("New documents will be assigned this language.");
3181                 break;
3182
3183         case RC_DEFAULT_PAPERSIZE:
3184                 str = _("Specify the default paper size.");
3185                 break;
3186
3187         case RC_DIALOGS_ICONIFY_WITH_MAIN:
3188                 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3189                 break;
3190
3191         case RC_DISPLAY_GRAPHICS:
3192                 str = _("Select how LyX will display any graphics.");
3193                 break;
3194
3195         case RC_DOCUMENTPATH:
3196                 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3197                 break;
3198
3199         case RC_ESC_CHARS:
3200                 str = _("Specify additional chars that can be part of a word.");
3201                 break;
3202
3203         case RC_EXAMPLEPATH:
3204                 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3205                 break;
3206
3207         case RC_FONT_ENCODING:
3208                 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
3209                 break;
3210
3211         case RC_FORCE_PAINT_SINGLE_CHAR:
3212                 str = _("Disable any kerning and ligatures for text drawing on screen.");
3213                 break;
3214
3215         case RC_FILEFORMAT:
3216                 break;
3217
3218         case RC_INDEX_COMMAND:
3219                 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\".");
3220                 break;
3221
3222         case RC_JINDEX_COMMAND:
3223                 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3224                 break;
3225
3226         case RC_NOMENCL_COMMAND:
3227                 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3228                 break;
3229
3230         case RC_INPUT:
3231                 break;
3232
3233         case RC_KBMAP:
3234         case RC_KBMAP_PRIMARY:
3235         case RC_KBMAP_SECONDARY:
3236                 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.");
3237                 break;
3238
3239         case RC_LANGUAGE_AUTO_BEGIN:
3240                 str = _("Select if a language switching command is needed at the beginning of the document.");
3241                 break;
3242
3243         case RC_LANGUAGE_AUTO_END:
3244                 str = _("Select if a language switching command is needed at the end of the document.");
3245                 break;
3246
3247         case RC_LANGUAGE_COMMAND_BEGIN:
3248                 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.");
3249                 break;
3250
3251         case RC_LANGUAGE_COMMAND_END:
3252                 str = _("The LaTeX command for changing back to the language of the document.");
3253                 break;
3254
3255         case RC_LANGUAGE_COMMAND_LOCAL:
3256                 str = _("The LaTeX command for local changing of the language.");
3257                 break;
3258
3259         case RC_LANGUAGE_GLOBAL_OPTIONS:
3260                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3261                 break;
3262
3263         case RC_LANGUAGE_CUSTOM_PACKAGE:
3264                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3265                 break;
3266
3267         case RC_LANGUAGE_PACKAGE_SELECTION:
3268                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3269                 break;
3270
3271         case RC_USELASTFILEPOS:
3272                 str = _("De-select if you do not want LyX to scroll to saved position.");
3273                 break;
3274
3275         case RC_LOADSESSION:
3276                 str = _("De-select to prevent loading files opened from the last LyX session.");
3277                 break;
3278
3279         case RC_MAKE_BACKUP:
3280                 str = _("De-select if you don't want LyX to create backup files.");
3281                 break;
3282
3283         case RC_MARK_FOREIGN_LANGUAGE:
3284                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3285                 break;
3286
3287         case RC_MOUSE_WHEEL_SPEED:
3288                 str = bformat(_("The scrolling speed of the mouse wheel."),
3289                       maxlastfiles);
3290                 break;
3291
3292         case RC_COMPLETION_POPUP_DELAY:
3293                 str = _("The completion popup delay.");
3294                 break;
3295
3296         case RC_COMPLETION_POPUP_MATH:
3297                 str = _("Select to display the completion popup in math mode.");
3298                 break;
3299
3300         case RC_COMPLETION_POPUP_TEXT:
3301                 str = _("Select to display the completion popup in text mode.");
3302                 break;
3303
3304         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3305                 str = _("Show the completion popup without delay after non-unique completion attempt.");
3306                 break;
3307
3308         case RC_COMPLETION_POPUP_TEXT:
3309                 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3310                 break;
3311
3312         case RC_COMPLETION_POPUP_DELAY:
3313                 str = _("The inline completion delay.");
3314                 break;
3315
3316         case RC_COMPLETION_INLINE_MATH:
3317                 str = _("Select to display the inline completion in math mode.");
3318                 break;
3319
3320         case RC_COMPLETION_INLINE_TEXT:
3321                 str = _("Select to display the inline completion in text mode.");
3322                 break;
3323
3324         case RC_COMPLETION_INLINE_DOTS:
3325                 str = _("Use \"...\" to shorten long completions.");
3326                 break;
3327
3328         case RC_AUTOCORRECTION_MATH:
3329                 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
3330                 break;
3331
3332         case RC_NUMLASTFILES:
3333                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3334                         maxlastfiles);
3335                 break;
3336
3337         case RC_PATH_PREFIX:
3338                 str = _("Specify those directories which should be "
3339                          "prepended to the PATH environment variable.\n"
3340                          "Use the OS native format.");
3341                 break;
3342
3343         case RC_PREVIEW:
3344                 str = _("Shows a typeset preview of things such as math");
3345                 break;
3346
3347         case RC_PREVIEW_HASHED_LABELS:
3348                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3349                 break;
3350
3351         case RC_PREVIEW_SCALE_FACTOR:
3352                 str = _("Scale the preview size to suit.");
3353                 break;
3354
3355         case RC_PRINTCOLLCOPIESFLAG:
3356                 str = _("The option for specifying whether the copies should be collated.");
3357                 break;
3358
3359         case RC_PRINTCOPIESFLAG:
3360                 str = _("The option for specifying the number of copies to print.");
3361                 break;
3362
3363         case RC_PRINTER:
3364                 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
3365                 break;
3366
3367         case RC_PRINTEVENPAGEFLAG:
3368                 str = _("The option to print only even pages.");
3369                 break;
3370
3371         case RC_PRINTEXSTRAOPTIONS:
3372                 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
3373                 break;
3374
3375         case RC_PRINTFILEEXTENSION:
3376                 str = _("Extension of printer program output file. Usually \".ps\".");
3377                 break;
3378
3379         case RC_PRINTLANDSCAPEFLAG:
3380                 str = _("The option to print out in landscape.");
3381                 break;
3382
3383         case RC_PRINTODDPAGEFLAG:
3384                 str = _("The option to print only odd pages.");
3385                 break;
3386
3387         case RC_PRINTPAGERANGEFLAG:
3388                 str = _("The option for specifying a comma-separated list of pages to print.");
3389                 break;
3390
3391         case RC_PRINTPAPERDIMENSIONFLAG:
3392                                    str = _("Option to specify the dimensions of the print paper.");
3393                 break;
3394
3395         case RC_PRINTPAPERFLAG:
3396                 str = _("The option to specify paper type.");
3397                 break;
3398
3399         case RC_PRINTREVERSEFLAG:
3400                 str = _("The option to reverse the order of the pages printed.");
3401                 break;
3402
3403         case RC_PRINTSPOOL_COMMAND:
3404                 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.");
3405                 break;
3406
3407         case RC_PRINTSPOOL_PRINTERPREFIX:
3408                 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.");
3409                 break;
3410
3411         case RC_PRINTTOFILE:
3412                 str = _("Option to pass to the print program to print to a file.");
3413                 break;
3414
3415         case RC_PRINTTOPRINTER:
3416                 str = _("Option to pass to the print program to print on a specific printer.");
3417                 break;
3418
3419         case RC_PRINT_ADAPTOUTPUT:
3420                 str = _("Select for LyX to pass the name of the destination printer to your print command.");
3421                 break;
3422
3423         case RC_PRINT_COMMAND:
3424                 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
3425                 break;
3426
3427         case RC_RTL_SUPPORT:
3428                 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
3429                 break;
3430
3431         case RC_VISUAL_CURSOR:
3432                 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3433                 break;
3434
3435         case RC_SCREEN_DPI:
3436                 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3437                 break;
3438
3439         case RC_SCREEN_FONT_ROMAN:
3440         case RC_SCREEN_FONT_SANS:
3441         case RC_SCREEN_FONT_TYPEWRITER:
3442                 str = _("The screen fonts used to display the text while editing.");
3443                 break;
3444
3445         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3446         case RC_SCREEN_FONT_SANS_FOUNDRY:
3447         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3448                 break;
3449
3450         case RC_SCREEN_FONT_SCALABLE:
3451                 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.");
3452                 break;
3453
3454         case RC_SCREEN_FONT_SIZES:
3455                 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3456                 break;
3457
3458         case RC_SCREEN_ZOOM:
3459                 //xgettext:no-c-format
3460                 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3461                 break;
3462
3463         case RC_GEOMETRY_SESSION:
3464                 str = _("Allow session manager to save and restore windows geometry.");
3465                 break;
3466
3467         case RC_SERVERPIPE:
3468                 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3469                 break;
3470
3471         case RC_SET_COLOR:
3472                 break;
3473
3474         case RC_SHOW_BANNER:
3475                 str = _("De-select if you don't want the startup banner.");
3476                 break;
3477
3478         case RC_TEMPDIRPATH:
3479                 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3480                 break;
3481
3482         case RC_THESAURUSDIRPATH:
3483                 str = _("This is the place where the files of the thesaurus library reside.");
3484                 break;
3485
3486         case RC_TEMPLATEPATH:
3487                 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3488                 break;
3489
3490         case RC_TEX_ALLOWS_SPACES:
3491                 break;
3492
3493         case RC_TEX_EXPECTS_WINDOWS_PATHS:
3494                 break;
3495
3496         case RC_TEXINPUTS_PREFIX:
3497                 str = _("Specify those directories which should be "
3498                          "prepended to the TEXINPUTS environment variable.\n"
3499                          "A '.' represents the current document directory. "
3500                          "Use the OS native format.");
3501                 break;
3502
3503         case RC_UIFILE:
3504                 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3505                 break;
3506
3507         case RC_USER_EMAIL:
3508                 break;
3509
3510         case RC_USER_NAME:
3511                 break;
3512
3513         case RC_USE_USE_SYSTEM_COLORS:
3514                 str = _("Enable use the system colors for some things like main window background and selection.");
3515                 break;
3516
3517         case RC_USE_TOOLTIP:
3518                 str = _("Enable the automatic appearance of tool tips in the work area.");
3519                 break;
3520
3521         case RC_USE_PIXMAP_CACHE:
3522                 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
3523                 break;
3524
3525         case RC_VIEWDVI_PAPEROPTION:
3526                 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3527                 break;
3528
3529         case RC_VIEWER:
3530                 break;
3531
3532         case RC_LAST:
3533                 break;
3534         }
3535
3536         return str;
3537 }
3538 #endif
3539
3540
3541 // The global instance
3542 LyXRC lyxrc;
3543
3544 // The global copy of the system lyxrc entries (everything except preferences)
3545 LyXRC system_lyxrc;
3546
3547
3548 } // namespace lyx