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