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