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