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