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