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