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