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