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