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