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