]> git.lyx.org Git - lyx.git/blob - src/LyXRC.cpp
Move Lexer to support/ directory (and lyx::support namespace)
[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 {
1151                                         draw_strategy = DS_PARTIAL;
1152                                         LYXERR0("Unrecognized draw strategy " << tmp <<'"');
1153                                 }
1154                         }
1155                         break;
1156
1157                 case RC_LAST:
1158                         break; // this is just a dummy
1159                 }
1160
1161                 // This is triggered the first time through the loop unless
1162                 // we hit a format tag.
1163                 if (check_format && rc_format != LYXRC_FILEFORMAT)
1164                         return FormatMismatch;
1165         }
1166
1167         /// Update converters data-structures
1168         theConverters().update(theFormats());
1169         theConverters().buildGraph();
1170         theBufferList().invalidateConverterCache();
1171
1172         return ReadOK;
1173 }
1174
1175
1176 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1177 {
1178         ofstream ofs(filename.toFilesystemEncoding().c_str());
1179         if (ofs)
1180                 write(ofs, ignore_system_lyxrc);
1181 }
1182
1183
1184 void LyXRC::print() const
1185 {
1186         if (lyxerr.debugging())
1187                 write(lyxerr, false);
1188         else
1189                 write(cout, false);
1190 }
1191
1192
1193 class SameMover {
1194 public:
1195         typedef pair<string, SpecialisedMover> Data;
1196
1197         SameMover(Data const & comparison)
1198                 : comparison_(comparison) {}
1199
1200         bool operator()(Data const & data) const
1201         {
1202                 return data.first == comparison_.first &&
1203                         data.second.command() == comparison_.second.command();
1204         }
1205
1206 private:
1207         Data comparison_;
1208 };
1209
1210
1211 namespace {
1212
1213         // Escape \ and " so that LyXLex can read the string later
1214         string escapeCommand(string const & str) {
1215                 return subst(subst(str , "\\", "\\\\"),
1216                              "\"", "\\\"");
1217         }
1218
1219 } // namespace
1220
1221
1222 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1223 {
1224         LyXRCTags tag = RC_LAST;
1225
1226         if (!name.empty()) {
1227                 for (int i = 0; i != lyxrcCount; ++i)
1228                         if ("\\" + name == lyxrcTags[i].tag)
1229                                 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1230         }
1231
1232         if (tag == RC_LAST)
1233                 os << "# LyX " << lyx_version
1234                    << " generated this file. If you want to make your own\n"
1235                    << "# modifications you should do them from inside LyX and save.\n\n"
1236                    << "Format " << LYXRC_FILEFORMAT << "\n\n";
1237
1238         // Why the switch you might ask. It is a trick to ensure that all
1239         // the elements in the LyXRCTags enum are handled. As you can see
1240         // there are no breaks at all. So it is just a huge fall-through.
1241         // The nice thing is that we will get a warning from the compiler
1242         // if we forget an element.
1243         switch (tag) {
1244         case RC_LAST:
1245         case RC_INPUT:
1246                 // input/include files are not done here
1247         case RC_LYXRCFORMAT:
1248         case RC_BINDFILE:
1249                 if (ignore_system_lyxrc ||
1250                     bind_file != system_lyxrc.bind_file) {
1251                         string const path = os::external_path(bind_file);
1252                         os << "\\bind_file \"" << path << "\"\n";
1253                 }
1254                 if (tag != RC_LAST)
1255                         break;
1256                 // fall through
1257         case RC_DEFFILE:
1258                 if (ignore_system_lyxrc ||
1259                     def_file != system_lyxrc.def_file) {
1260                         string const path = os::external_path(def_file);
1261                         os << "\\def_file \"" << path << "\"\n";
1262                 }
1263                 if (tag != RC_LAST)
1264                         break;
1265
1266                 //
1267                 // Misc Section
1268                 //
1269                 os << "\n#\n"
1270                    << "# MISC SECTION ######################################\n"
1271                    << "#\n\n";
1272                 // bind files are not done here.
1273                 // fall through
1274         case RC_PATH_PREFIX:
1275                 if (ignore_system_lyxrc ||
1276                     path_prefix != system_lyxrc.path_prefix) {
1277                         os << "\\path_prefix \"" << path_prefix << "\"\n";
1278                 }
1279                 if (tag != RC_LAST)
1280                         break;
1281                 // fall through
1282         case RC_UIFILE:
1283                 if (ignore_system_lyxrc ||
1284                     ui_file != system_lyxrc.ui_file) {
1285                         string const path = os::external_path(ui_file);
1286                         os << "\\ui_file \"" << path << "\"\n";
1287                 }
1288                 if (tag != RC_LAST)
1289                         break;
1290                 // fall through
1291         case RC_AUTOREGIONDELETE:
1292                 if (ignore_system_lyxrc ||
1293                     auto_region_delete != system_lyxrc.auto_region_delete) {
1294                         os << "# Set to false to inhibit automatic replacement of\n"
1295                            << "# the current selection.\n"
1296                            << "\\auto_region_delete " << convert<string>(auto_region_delete)
1297                            << '\n';
1298                 }
1299                 if (tag != RC_LAST)
1300                         break;
1301                 // fall through
1302         case RC_AUTORESET_OPTIONS:
1303                 if (ignore_system_lyxrc ||
1304                     auto_reset_options != system_lyxrc.auto_reset_options) {
1305                         os << "# Set to false to inhibit automatic reset of\n"
1306                            << "# the class options to defaults on class change.\n"
1307                            << "\\auto_reset_options "
1308                            << convert<string>(auto_reset_options)
1309                            << '\n';
1310                 }
1311                 if (tag != RC_LAST)
1312                         break;
1313                 // fall through
1314         case RC_AUTOSAVE:
1315                 if (ignore_system_lyxrc ||
1316                     autosave != system_lyxrc.autosave) {
1317                         os << "# The time interval between auto-saves in seconds.\n"
1318                            << "\\autosave " << autosave << '\n';
1319                 }
1320                 if (tag != RC_LAST)
1321                         break;
1322                 // fall through
1323         case RC_DISPLAY_GRAPHICS:
1324                 if (ignore_system_lyxrc ||
1325                     display_graphics != system_lyxrc.display_graphics) {
1326                         os << "# Display graphics within LyX\n"
1327                            << "# true|false\n"
1328                            << "\\display_graphics "
1329                            << (display_graphics ? "true" : "false")
1330                            << '\n';
1331                 }
1332                 if (tag != RC_LAST)
1333                         break;
1334                 // fall through
1335         case RC_SORT_LAYOUTS:
1336                 if (ignore_system_lyxrc ||
1337                     sort_layouts != system_lyxrc.sort_layouts) {
1338                         os << "# Sort layouts alphabetically.\n"
1339                            << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1340                 }
1341                 if (tag != RC_LAST)
1342                         break;
1343                 // fall through
1344         case RC_GROUP_LAYOUTS:
1345                 if (ignore_system_lyxrc ||
1346                     group_layouts != system_lyxrc.group_layouts) {
1347                         os << "# Group layouts by their category.\n"
1348                            << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1349                 }
1350                 if (tag != RC_LAST)
1351                         break;
1352                 // fall through
1353         case RC_VIEWDVI_PAPEROPTION:
1354                 if (ignore_system_lyxrc ||
1355                     view_dvi_paper_option
1356                     != system_lyxrc.view_dvi_paper_option) {
1357                         os << "# Options used to specify paper size to the\n"
1358                            << "# view_dvi_command (e.g. -paper)\n"
1359                            << "\\view_dvi_paper_option \""
1360                            << view_dvi_paper_option << "\"\n";
1361                 }
1362                 if (tag != RC_LAST)
1363                         break;
1364                 // fall through
1365         case RC_CHKTEX_COMMAND:
1366                 if (ignore_system_lyxrc ||
1367                     chktex_command != system_lyxrc.chktex_command) {
1368                         os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1369                 }
1370                 if (tag != RC_LAST)
1371                         break;
1372                 // fall through
1373         case RC_BIBTEX_ALTERNATIVES: {
1374                 CommandSet::const_iterator it = bibtex_alternatives.begin();
1375                 CommandSet::const_iterator end = bibtex_alternatives.end();
1376                 for ( ; it != end; ++it) {
1377                         if (ignore_system_lyxrc
1378                             || !system_lyxrc.bibtex_alternatives.count(*it))
1379                                 os << "\\bibtex_alternatives \""
1380                                    << *it << "\"\n";
1381                 }
1382                 if (tag != RC_LAST)
1383                         break;
1384         }
1385         // fall through
1386         case RC_BIBTEX_COMMAND:
1387                 if (ignore_system_lyxrc ||
1388                     bibtex_command != system_lyxrc.bibtex_command) {
1389                         os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1390                 }
1391                 if (tag != RC_LAST)
1392                         break;
1393                 // fall through
1394         case RC_JBIBTEX_COMMAND:
1395                 if (ignore_system_lyxrc ||
1396                     jbibtex_command != system_lyxrc.jbibtex_command) {
1397                         os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1398                 }
1399                 if (tag != RC_LAST)
1400                         break;
1401                 // fall through
1402         case RC_JBIBTEX_ALTERNATIVES: {
1403                 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1404                 CommandSet::const_iterator end = jbibtex_alternatives.end();
1405                 for ( ; it != end; ++it) {
1406                         if (ignore_system_lyxrc
1407                             || !system_lyxrc.jbibtex_alternatives.count(*it))
1408                                 os << "\\jbibtex_alternatives \""
1409                                    << *it << "\"\n";
1410                 }
1411                 if (tag != RC_LAST)
1412                         break;
1413         }
1414         // fall through
1415         case RC_INDEX_ALTERNATIVES: {
1416                 CommandSet::const_iterator it = index_alternatives.begin();
1417                 CommandSet::const_iterator end = index_alternatives.end();
1418                 for ( ; it != end; ++it) {
1419                         if (ignore_system_lyxrc
1420                             || !system_lyxrc.index_alternatives.count(*it))
1421                                 os << "\\index_alternatives \""
1422                                    << *it << "\"\n";
1423                 }
1424                 if (tag != RC_LAST)
1425                         break;
1426         }
1427         // fall through
1428         case RC_INDEX_COMMAND:
1429                 if (ignore_system_lyxrc ||
1430                     index_command != system_lyxrc.index_command) {
1431                         os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1432                 }
1433                 if (tag != RC_LAST)
1434                         break;
1435                 // fall through
1436         case RC_JINDEX_COMMAND:
1437                 if (ignore_system_lyxrc ||
1438                     jindex_command != system_lyxrc.jindex_command) {
1439                         os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1440                 }
1441                 if (tag != RC_LAST)
1442                         break;
1443                 // fall through
1444         case RC_SPLITINDEX_COMMAND:
1445                 if (ignore_system_lyxrc ||
1446                     splitindex_command != system_lyxrc.splitindex_command) {
1447                         os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1448                 }
1449                 if (tag != RC_LAST)
1450                         break;
1451                 // fall through
1452         case RC_NOMENCL_COMMAND:
1453                 if (ignore_system_lyxrc ||
1454                     nomencl_command != system_lyxrc.nomencl_command) {
1455                         os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1456                 }
1457                 if (tag != RC_LAST)
1458                         break;
1459                 // fall through
1460         case RC_PYGMENTIZE_COMMAND:
1461                 if (ignore_system_lyxrc ||
1462                     pygmentize_command != system_lyxrc.pygmentize_command) {
1463                         os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1464                 }
1465                 if (tag != RC_LAST)
1466                         break;
1467                 // fall through
1468         case RC_TEX_EXPECTS_WINDOWS_PATHS:
1469                 // Don't write this setting to the preferences file,
1470                 // but allow temporary changes (bug 7557).
1471                 if (ignore_system_lyxrc) {
1472                         os << "\\tex_expects_windows_paths "
1473                            << convert<string>(windows_style_tex_paths) << '\n';
1474                 }
1475                 if (tag != RC_LAST)
1476                         break;
1477                 // fall through
1478         case RC_TEX_ALLOWS_SPACES:
1479                 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1480                         os << "\\tex_allows_spaces "
1481                            << convert<string>(tex_allows_spaces) << '\n';
1482                 }
1483                 if (tag != RC_LAST)
1484                         break;
1485                 // fall through
1486         case RC_KBMAP:
1487                 if (ignore_system_lyxrc ||
1488                     use_kbmap != system_lyxrc.use_kbmap) {
1489                         os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1490                 }
1491                 if (tag != RC_LAST)
1492                         break;
1493                 // fall through
1494         case RC_KBMAP_PRIMARY:
1495                 if (ignore_system_lyxrc ||
1496                     primary_kbmap != system_lyxrc.primary_kbmap) {
1497                         string const path = os::external_path(primary_kbmap);
1498                         os << "\\kbmap_primary \"" << path << "\"\n";
1499                 }
1500                 if (tag != RC_LAST)
1501                         break;
1502                 // fall through
1503         case RC_KBMAP_SECONDARY:
1504                 if (ignore_system_lyxrc ||
1505                     secondary_kbmap != system_lyxrc.secondary_kbmap) {
1506                         string const path = os::external_path(secondary_kbmap);
1507                         os << "\\kbmap_secondary \"" << path << "\"\n";
1508                 }
1509                 if (tag != RC_LAST)
1510                         break;
1511                 // fall through
1512         case RC_SERVERPIPE:
1513                 if (ignore_system_lyxrc ||
1514                     lyxpipes != system_lyxrc.lyxpipes) {
1515                         string const path = os::external_path(lyxpipes);
1516                         os << "\\serverpipe \"" << path << "\"\n";
1517                 }
1518                 if (tag != RC_LAST)
1519                         break;
1520                 // fall through
1521         case RC_USER_NAME:
1522                 os << "\\user_name \"" << user_name << "\"\n";
1523                 if (tag != RC_LAST)
1524                         break;
1525                 // fall through
1526         case RC_USER_EMAIL:
1527                 os << "\\user_email \"" << user_email << "\"\n";
1528                 if (tag != RC_LAST)
1529                         break;
1530                 // fall through
1531         case RC_USER_INITIALS:
1532                 os << "\\user_initials \"" << user_initials << "\"\n";
1533                 if (tag != RC_LAST)
1534                         break;
1535                 // fall through
1536         case RC_SHOW_BANNER:
1537                 if (ignore_system_lyxrc ||
1538                     show_banner != system_lyxrc.show_banner) {
1539                         os << "\\show_banner " << convert<string>(show_banner) << '\n';
1540                 }
1541                 if (tag != RC_LAST)
1542                         break;
1543                 // fall through
1544         case RC_PREVIEW:
1545                 if (ignore_system_lyxrc ||
1546                     preview != system_lyxrc.preview) {
1547                         string status;
1548                         switch (preview) {
1549                         case PREVIEW_ON:
1550                                 status = "on";
1551                                 break;
1552                         case PREVIEW_NO_MATH:
1553                                 status = "no_math";
1554                                 break;
1555                         case PREVIEW_OFF:
1556                                 status = "off";
1557                                 break;
1558                         }
1559                         os << "\\preview " << status << '\n';
1560                 }
1561                 if (tag != RC_LAST)
1562                         break;
1563                 // fall through
1564         case RC_PREVIEW_HASHED_LABELS:
1565                 if (ignore_system_lyxrc ||
1566                     preview_hashed_labels !=
1567                     system_lyxrc.preview_hashed_labels) {
1568                         os << "\\preview_hashed_labels "
1569                            << convert<string>(preview_hashed_labels) << '\n';
1570                 }
1571                 if (tag != RC_LAST)
1572                         break;
1573                 // fall through
1574         case RC_PREVIEW_SCALE_FACTOR:
1575                 if (ignore_system_lyxrc ||
1576                     preview_scale_factor != system_lyxrc.preview_scale_factor) {
1577                         os << "\\preview_scale_factor "
1578                            << preview_scale_factor << '\n';
1579                 }
1580                 if (tag != RC_LAST)
1581                         break;
1582                 // fall through
1583         case RC_USE_CONVERTER_CACHE:
1584                 if (ignore_system_lyxrc ||
1585                     use_converter_cache != system_lyxrc.use_converter_cache) {
1586                         os << "\\use_converter_cache "
1587                            << convert<string>(use_converter_cache) << '\n';
1588                 }
1589                 if (tag != RC_LAST)
1590                         break;
1591                 // fall through
1592         case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1593                 if (ignore_system_lyxrc ||
1594                     use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1595                         os << "\\use_converter_needauth_forbidden "
1596                            << convert<string>(use_converter_needauth_forbidden) << '\n';
1597                 }
1598                 if (tag != RC_LAST)
1599                         break;
1600                 // fall through
1601         case RC_USE_CONVERTER_NEEDAUTH:
1602                 if (ignore_system_lyxrc ||
1603                     use_converter_needauth != system_lyxrc.use_converter_needauth) {
1604                         os << "\\use_converter_needauth "
1605                            << convert<string>(use_converter_needauth) << '\n';
1606                 }
1607                 if (tag != RC_LAST)
1608                         break;
1609                 // fall through
1610         case RC_CONVERTER_CACHE_MAXAGE:
1611                 if (ignore_system_lyxrc ||
1612                     converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1613                         os << "\\converter_cache_maxage "
1614                            << converter_cache_maxage << '\n';
1615                 }
1616                 if (tag != RC_LAST)
1617                         break;
1618
1619                 os << "\n#\n"
1620                    << "# SCREEN & FONTS SECTION ############################\n"
1621                    << "#\n\n";
1622                 // fall through
1623         case RC_ICON_SET:
1624                 if (ignore_system_lyxrc ||
1625                     icon_set != system_lyxrc.icon_set) {
1626                         os << "\\icon_set \"" << icon_set
1627                            << "\"\n";
1628                 }
1629                 if (tag != RC_LAST)
1630                         break;
1631                 // fall through
1632         case RC_UI_STYLE:
1633                 if (ignore_system_lyxrc ||
1634                         ui_style != system_lyxrc.ui_style) {
1635                         os << "\\ui_style \"" << ui_style
1636                                 << "\"\n";
1637                 }
1638                 if (tag != RC_LAST)
1639                         break;
1640                 // fall through
1641         case RC_USE_SYSTEM_THEME_ICONS:
1642                 if (ignore_system_lyxrc ||
1643                           use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1644                         os << "\\use_system_theme_icons "
1645                                 << convert<string>(use_system_theme_icons)
1646                                 << "\n";
1647                 }
1648                 if (tag != RC_LAST)
1649                         break;
1650                 // fall through
1651         case RC_SCREEN_DPI:
1652                 if (ignore_system_lyxrc ||
1653                     dpi != system_lyxrc.dpi) {
1654                         os << "\\screen_dpi " << dpi << '\n';
1655                 }
1656                 if (tag != RC_LAST)
1657                         break;
1658                 // fall through
1659         case RC_SCREEN_ZOOM:
1660                 if (ignore_system_lyxrc ||
1661                     defaultZoom != system_lyxrc.defaultZoom) {
1662                         os << "\\screen_zoom " << defaultZoom << '\n';
1663                 }
1664                 if (tag != RC_LAST)
1665                         break;
1666                 // fall through
1667         case RC_GEOMETRY_SESSION:
1668                 if (ignore_system_lyxrc ||
1669                     allow_geometry_session != system_lyxrc.allow_geometry_session) {
1670                         os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1671                            << '\n';
1672                 }
1673                 if (tag != RC_LAST)
1674                         break;
1675                 // fall through
1676         case RC_CITATION_SEARCH:
1677                 if (ignore_system_lyxrc ||
1678                     citation_search != system_lyxrc.citation_search) {
1679                         os << "# Set to true to use script to search"
1680                            << " local disk for citation targets.\n"
1681                            << "\\citation_search "
1682                            << convert<string>(citation_search)
1683                            << '\n';
1684                 }
1685                 if (tag != RC_LAST)
1686                         break;
1687                 // fall through
1688         case RC_CITATION_SEARCH_VIEW:
1689                 if (ignore_system_lyxrc ||
1690                     citation_search_view != system_lyxrc.citation_search_view) {
1691                         os << "\\citation_search_view \""
1692                            << citation_search_view << "\"\n";
1693                 }
1694                 if (tag != RC_LAST)
1695                         break;
1696                 // fall through
1697         case RC_CITATION_SEARCH_PATTERN:
1698                 if (ignore_system_lyxrc ||
1699                     citation_search_pattern != system_lyxrc.citation_search_pattern) {
1700                         os << "\\citation_search_pattern \""
1701                            << citation_search_pattern << "\"\n";
1702                 }
1703                 if (tag != RC_LAST)
1704                         break;
1705                 // fall through
1706         case RC_CT_ADDITIONS_UNDERLINED:
1707                 if (ignore_system_lyxrc ||
1708                     ct_additions_underlined
1709                     != system_lyxrc.ct_additions_underlined) {
1710                         os << "\\ct_additions_underlined "
1711                            << convert<string>(ct_additions_underlined) << '\n';
1712                 }
1713                 if (tag != RC_LAST)
1714                         break;
1715                 // fall through
1716         case RC_CT_MARKUP_COPIED:
1717                 if (ignore_system_lyxrc ||
1718                     ct_markup_copied
1719                     != system_lyxrc.ct_markup_copied) {
1720                         os << "\\ct_markup_copied "
1721                            << convert<string>(ct_markup_copied) << '\n';
1722                 }
1723                 if (tag != RC_LAST)
1724                         break;
1725                 // fall through
1726         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1727                 if (ignore_system_lyxrc ||
1728                     cursor_follows_scrollbar
1729                     != system_lyxrc.cursor_follows_scrollbar) {
1730                         os << "\\cursor_follows_scrollbar "
1731                            << convert<string>(cursor_follows_scrollbar) << '\n';
1732                 }
1733                 if (tag != RC_LAST)
1734                         break;
1735                 // fall through
1736         case RC_CURSOR_WIDTH:
1737                 if (ignore_system_lyxrc ||
1738                         cursor_width
1739                         != system_lyxrc.cursor_width) {
1740                         os << "\\cursor_width "
1741                         << cursor_width << '\n';
1742                 }
1743                 if (tag != RC_LAST)
1744                         break;
1745                 // fall through
1746         case RC_SCROLL_BELOW_DOCUMENT:
1747                 if (ignore_system_lyxrc ||
1748                     scroll_below_document
1749                     != system_lyxrc.scroll_below_document) {
1750                         os << "\\scroll_below_document "
1751                            << convert<string>(scroll_below_document) << '\n';
1752                 }
1753                 if (tag != RC_LAST)
1754                         break;
1755                 // fall through
1756         case RC_PARAGRAPH_MARKERS:
1757                 if (ignore_system_lyxrc ||
1758                         paragraph_markers
1759                     != system_lyxrc.paragraph_markers) {
1760                         os << "\\paragraph_markers "
1761                            << convert<string>(paragraph_markers) << '\n';
1762                 }
1763                 if (tag != RC_LAST)
1764                         break;
1765                 // fall through
1766         case RC_BOOKMARKS_VISIBILITY:
1767                 if (ignore_system_lyxrc ||
1768                         bookmarks_visibility != system_lyxrc.bookmarks_visibility) {
1769                         string status;
1770                         switch (bookmarks_visibility) {
1771                         case BMK_NONE:
1772                                 status = "none";
1773                                 break;
1774                         case BMK_INLINE:
1775                                 status = "inline";
1776                                 break;
1777                         case BMK_MARGIN:
1778                                 status = "margin";
1779                                 break;
1780                         }
1781                         os << "\\experimental:bookmarks_visibility " << status << '\n';
1782                 }
1783                 if (tag != RC_LAST)
1784                         break;
1785                 // fall through
1786         case RC_MAC_DONTSWAP_CTRL_META:
1787                 if (ignore_system_lyxrc ||
1788                     mac_dontswap_ctrl_meta
1789                     != system_lyxrc.mac_dontswap_ctrl_meta) {
1790                         os << "\\mac_dontswap_ctrl_meta "
1791                            << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1792                 }
1793                 if (tag != RC_LAST)
1794                         break;
1795                 // fall through
1796         case RC_MAC_LIKE_CURSOR_MOVEMENT:
1797                 if (ignore_system_lyxrc ||
1798                     mac_like_cursor_movement
1799                     != system_lyxrc.mac_like_cursor_movement) {
1800                         os << "\\mac_like_cursor_movement "
1801                            << convert<string>(mac_like_cursor_movement) << '\n';
1802                 }
1803                 if (tag != RC_LAST)
1804                         break;
1805                 // fall through
1806         case RC_MACRO_EDIT_STYLE:
1807                 if (ignore_system_lyxrc ||
1808                     macro_edit_style
1809                     != system_lyxrc.macro_edit_style) {
1810                         os << "\\macro_edit_style ";
1811                         switch (macro_edit_style) {
1812                         case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1813                         case MACRO_EDIT_INLINE: os << "1\n"; break;
1814                         case MACRO_EDIT_LIST: os << "2\n"; break;
1815                         }
1816                 }
1817                 if (tag != RC_LAST)
1818                         break;
1819                 // fall through
1820         case RC_DIALOGS_ICONIFY_WITH_MAIN:
1821                 if (ignore_system_lyxrc ||
1822                     dialogs_iconify_with_main
1823                    != system_lyxrc.dialogs_iconify_with_main) {
1824                         os << "\\dialogs_iconify_with_main "
1825                           <<  convert<string>(dialogs_iconify_with_main) << '\n';
1826                 }
1827                 if (tag != RC_LAST)
1828                         break;
1829                 // fall through
1830         case RC_SCREEN_FONT_ROMAN:
1831                 if (ignore_system_lyxrc ||
1832                     roman_font_name != system_lyxrc.roman_font_name) {
1833                         os << "\\screen_font_roman \"" << roman_font_name
1834                            << "\"\n";
1835                 }
1836                 if (tag != RC_LAST)
1837                         break;
1838                 // fall through
1839         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1840                 if (ignore_system_lyxrc ||
1841                     roman_font_foundry != system_lyxrc.roman_font_foundry) {
1842                         os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1843                            << "\"\n";
1844                 }
1845                 if (tag != RC_LAST)
1846                         break;
1847                 // fall through
1848         case RC_SCREEN_FONT_SANS:
1849                 if (ignore_system_lyxrc ||
1850                     sans_font_name != system_lyxrc.sans_font_name) {
1851                         os << "\\screen_font_sans \"" << sans_font_name
1852                            << "\"\n";
1853                 }
1854                 if (tag != RC_LAST)
1855                         break;
1856                 // fall through
1857         case RC_SCREEN_FONT_SANS_FOUNDRY:
1858                 if (ignore_system_lyxrc ||
1859                     sans_font_foundry != system_lyxrc.sans_font_foundry) {
1860                         os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1861                            << "\"\n";
1862                 }
1863                 if (tag != RC_LAST)
1864                         break;
1865                 // fall through
1866         case RC_SCREEN_FONT_TYPEWRITER:
1867                 if (ignore_system_lyxrc ||
1868                     typewriter_font_name != system_lyxrc.typewriter_font_name) {
1869                         os << "\\screen_font_typewriter \""
1870                            << typewriter_font_name << "\"\n";
1871                 }
1872                 if (tag != RC_LAST)
1873                         break;
1874                 // fall through
1875         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1876                 if (ignore_system_lyxrc ||
1877                     typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1878                         os << "\\screen_font_typewriter_foundry \""
1879                            << typewriter_font_foundry << "\"\n";
1880                 }
1881                 if (tag != RC_LAST)
1882                         break;
1883                 // fall through
1884         case RC_SCREEN_FONT_SCALABLE:
1885                 if (ignore_system_lyxrc ||
1886                     use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1887                         os << "\\screen_font_scalable "
1888                            << convert<string>(use_scalable_fonts)
1889                            << '\n';
1890                 }
1891                 if (tag != RC_LAST)
1892                         break;
1893                 // fall through
1894         case RC_SCREEN_FONT_SIZES:
1895                 if (ignore_system_lyxrc ||
1896                     font_sizes[TINY_SIZE]
1897                     != system_lyxrc.font_sizes[TINY_SIZE] ||
1898                     font_sizes[SCRIPT_SIZE]
1899                     != system_lyxrc.font_sizes[SCRIPT_SIZE] ||
1900                     font_sizes[FOOTNOTE_SIZE]
1901                     != system_lyxrc.font_sizes[FOOTNOTE_SIZE] ||
1902                     font_sizes[SMALL_SIZE]
1903                     != system_lyxrc.font_sizes[SMALL_SIZE] ||
1904                     font_sizes[NORMAL_SIZE]
1905                     != system_lyxrc.font_sizes[NORMAL_SIZE] ||
1906                     font_sizes[LARGE_SIZE]
1907                     != system_lyxrc.font_sizes[LARGE_SIZE] ||
1908                     font_sizes[LARGER_SIZE]
1909                     != system_lyxrc.font_sizes[LARGER_SIZE] ||
1910                     font_sizes[LARGEST_SIZE]
1911                     != system_lyxrc.font_sizes[LARGEST_SIZE] ||
1912                     font_sizes[HUGE_SIZE]
1913                     != system_lyxrc.font_sizes[HUGE_SIZE] ||
1914                     font_sizes[HUGER_SIZE]
1915                     != system_lyxrc.font_sizes[HUGER_SIZE]) {
1916                         streamsize old_prec = os.precision();
1917                         os.setf(ios::fixed);
1918                         os.precision(2);
1919                         os << "\\screen_font_sizes"
1920                            << ' ' << font_sizes[TINY_SIZE]
1921                            << ' ' << font_sizes[SCRIPT_SIZE]
1922                            << ' ' << font_sizes[FOOTNOTE_SIZE]
1923                            << ' ' << font_sizes[SMALL_SIZE]
1924                            << ' ' << font_sizes[NORMAL_SIZE]
1925                            << ' ' << font_sizes[LARGE_SIZE]
1926                            << ' ' << font_sizes[LARGER_SIZE]
1927                            << ' ' << font_sizes[LARGEST_SIZE]
1928                            << ' ' << font_sizes[HUGE_SIZE]
1929                            << ' ' << font_sizes[HUGER_SIZE]
1930                            << '\n';
1931                         os.precision(old_prec);
1932                         os.unsetf(ios::fixed);
1933                 }
1934                 if (tag != RC_LAST)
1935                         break;
1936                 // fall through
1937         case RC_SCREEN_LIMIT:
1938                 if (ignore_system_lyxrc ||
1939                     screen_limit != system_lyxrc.screen_limit) {
1940                         os << "\\screen_limit "
1941                            << convert<string>(screen_limit)
1942                            << '\n';
1943                 }
1944                 if (tag != RC_LAST)
1945                         break;
1946                 // fall through
1947         case RC_FULL_SCREEN_TOOLBARS:
1948                 if (ignore_system_lyxrc ||
1949                     full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1950                         os << "\\fullscreen_toolbars "
1951                            << convert<string>(full_screen_toolbars)
1952                            << '\n';
1953                 }
1954                 if (tag != RC_LAST)
1955                         break;
1956                 // fall through
1957         case RC_FULL_SCREEN_SCROLLBAR:
1958                 if (ignore_system_lyxrc ||
1959                     full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1960                         os << "\\fullscreen_scrollbar "
1961                            << convert<string>(full_screen_scrollbar)
1962                            << '\n';
1963                 }
1964                 if (tag != RC_LAST)
1965                         break;
1966                 // fall through
1967         case RC_FULL_SCREEN_STATUSBAR:
1968                 if (ignore_system_lyxrc ||
1969                     full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1970                         os << "\\fullscreen_statusbar "
1971                            << convert<string>(full_screen_statusbar)
1972                            << '\n';
1973                 }
1974                 if (tag != RC_LAST)
1975                         break;
1976                 // fall through
1977         case RC_FULL_SCREEN_TABBAR:
1978                 if (ignore_system_lyxrc ||
1979                     full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1980                         os << "\\fullscreen_tabbar "
1981                            << convert<string>(full_screen_tabbar)
1982                            << '\n';
1983                 }
1984                 if (tag != RC_LAST)
1985                         break;
1986                 // fall through
1987         case RC_FULL_SCREEN_MENUBAR:
1988                 if (ignore_system_lyxrc ||
1989                     full_screen_menubar != system_lyxrc.full_screen_menubar) {
1990                         os << "\\fullscreen_menubar "
1991                            << convert<string>(full_screen_menubar)
1992                            << '\n';
1993                 }
1994                 if (tag != RC_LAST)
1995                         break;
1996                 // fall through
1997         case RC_SCREEN_WIDTH:
1998                 if (ignore_system_lyxrc ||
1999                     screen_width != system_lyxrc.screen_width) {
2000                         os << "\\screen_width "
2001                            << screen_width.asString()
2002                            << '\n';
2003                 }
2004                 if (tag != RC_LAST)
2005                         break;
2006                 // fall through
2007         case RC_OPEN_BUFFERS_IN_TABS:
2008                 if (ignore_system_lyxrc ||
2009                     open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
2010                         os << "\\open_buffers_in_tabs "
2011                            << convert<string>(open_buffers_in_tabs)
2012                            << '\n';
2013                 }
2014                 if (tag != RC_LAST)
2015                         break;
2016                 // fall through
2017         case RC_SINGLE_CLOSE_TAB_BUTTON:
2018                 if (ignore_system_lyxrc ||
2019                     single_close_tab_button != system_lyxrc.single_close_tab_button) {
2020                         os << "\\single_close_tab_button "
2021                            << convert<string>(single_close_tab_button)
2022                            << '\n';
2023                 }
2024                 if (tag != RC_LAST)
2025                         break;
2026                 // fall through
2027         case RC_SINGLE_INSTANCE:
2028                 if (ignore_system_lyxrc ||
2029                     single_instance != system_lyxrc.single_instance) {
2030                         os << "\\single_instance "
2031                            << convert<string>(single_instance)
2032                            << '\n';
2033                 }
2034                 if (tag != RC_LAST)
2035                         break;
2036                 // fall through
2037         case RC_FORWARD_SEARCH_DVI:
2038                 if (ignore_system_lyxrc ||
2039                     forward_search_dvi != system_lyxrc.forward_search_dvi) {
2040                         os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2041                 }
2042                 if (tag != RC_LAST)
2043                         break;
2044                 // fall through
2045         case RC_FORWARD_SEARCH_PDF:
2046                 if (ignore_system_lyxrc ||
2047                     forward_search_pdf != system_lyxrc.forward_search_pdf) {
2048                         os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2049                 }
2050                 if (tag != RC_LAST)
2051                         break;
2052                 // fall through
2053         case RC_DRAW_STRATEGY:
2054                 if (ignore_system_lyxrc ||
2055                         draw_strategy != system_lyxrc.draw_strategy) {
2056                         string status;
2057                         switch (draw_strategy) {
2058                         case DS_PARTIAL:
2059                                 status = "partial";
2060                                 break;
2061                         case DS_BACKINGSTORE:
2062                                 status = "backingstore";
2063                                 break;
2064                         }
2065                         os << "\\draw_strategy " << status << '\n';
2066                 }
2067                 if (tag != RC_LAST)
2068                         break;
2069                 // fall through
2070
2071         os << "\n#\n"
2072                 << "# COLOR SECTION ###################################\n"
2073                 << "#\n\n";
2074
2075         // fall through
2076         case RC_SET_COLOR:
2077                 for (int i = 0; i < Color_ignore; ++i) {
2078                         ColorCode lc = static_cast<ColorCode>(i);
2079                         string const col = lcolor.getAllX11HexNames(lc).first;
2080                         string const darkcol = lcolor.getAllX11HexNames(lc).second;
2081                         if (ignore_system_lyxrc
2082                             || col != system_lcolor.getAllX11HexNames(lc).first
2083                             || darkcol != system_lcolor.getAllX11HexNames(lc).second) {
2084                                 os << "\\set_color \""
2085                                    << lcolor.getLyXName(lc) << "\" \""
2086                                    << col << "\" \""
2087                                    << darkcol << "\"\n";
2088                         }
2089                 }
2090                 if (tag != RC_LAST)
2091                         break;
2092
2093         os << "\n#\n"
2094                  << "# PRINTER SECTION ###################################\n"
2095                  << "#\n\n";
2096
2097         // fall through
2098         case RC_PRINTLANDSCAPEFLAG:
2099                 if (ignore_system_lyxrc ||
2100                     print_landscape_flag != system_lyxrc.print_landscape_flag) {
2101                         os << "\\print_landscape_flag \"" << print_landscape_flag
2102                            << "\"\n";
2103                 }
2104                 if (tag != RC_LAST)
2105                         break;
2106                 // fall through
2107         case RC_PRINTPAPERFLAG:
2108                 if (ignore_system_lyxrc ||
2109                     print_paper_flag != system_lyxrc.print_paper_flag) {
2110                         os << "\\print_paper_flag \"" << print_paper_flag
2111                            << "\"\n";
2112                 }
2113                 if (tag != RC_LAST)
2114                         break;
2115                 // fall through
2116         case RC_PRINTPAPERDIMENSIONFLAG:
2117                 if (ignore_system_lyxrc ||
2118                     print_paper_dimension_flag
2119                     != system_lyxrc.print_paper_dimension_flag) {
2120                         os << "\\print_paper_dimension_flag \""
2121                            << print_paper_dimension_flag << "\"\n";
2122                 }
2123                 if (tag != RC_LAST)
2124                         break;
2125
2126         os << "\n#\n"
2127                  << "# TEX SECTION #######################################\n"
2128                  << "#\n\n";
2129
2130         // fall through
2131         case RC_TEXINPUTS_PREFIX:
2132                 if (ignore_system_lyxrc ||
2133                     texinputs_prefix != system_lyxrc.texinputs_prefix) {
2134                         os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2135                 }
2136                 if (tag != RC_LAST)
2137                         break;
2138                 // fall through
2139                 os << "\n#\n"
2140                    << "# FILE SECTION ######################################\n"
2141                    << "#\n\n";
2142         // fall through
2143         case RC_DOCUMENTPATH:
2144                 if (ignore_system_lyxrc ||
2145                     document_path != system_lyxrc.document_path) {
2146                         string const path = os::external_path(document_path);
2147                         os << "\\document_path \"" << path << "\"\n";
2148                 }
2149                 if (tag != RC_LAST)
2150                         break;
2151                 // fall through
2152         case RC_USELASTFILEPOS:
2153                 if (ignore_system_lyxrc ||
2154                     use_lastfilepos != system_lyxrc.use_lastfilepos) {
2155                         os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2156                            << '\n';
2157                 }
2158                 if (tag != RC_LAST)
2159                         break;
2160                 // fall through
2161         case RC_LOADSESSION:
2162                 if (ignore_system_lyxrc ||
2163                     load_session != system_lyxrc.load_session) {
2164                         os << "\\load_session " << convert<string>(load_session)
2165                            << "\n";
2166                 }
2167                 if (tag != RC_LAST)
2168                         break;
2169                 // fall through
2170         case RC_MOUSE_WHEEL_SPEED:
2171                 if (ignore_system_lyxrc ||
2172                     mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2173                         os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2174                 }
2175                 if (tag != RC_LAST)
2176                         break;
2177                 // fall through
2178         case RC_MOUSE_MIDDLEBUTTON_PASTE:
2179                 if (ignore_system_lyxrc ||
2180                     mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2181                         os << "\\mouse_middlebutton_paste "
2182                            << convert<string>(mouse_middlebutton_paste) << '\n';
2183                 }
2184                 if (tag != RC_LAST)
2185                         break;
2186                 // fall through
2187         case RC_COMPLETION_INLINE_DELAY:
2188                 if (ignore_system_lyxrc ||
2189                     completion_inline_delay != system_lyxrc.completion_inline_delay) {
2190                         os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2191                 }
2192                 if (tag != RC_LAST)
2193                         break;
2194                 // fall through
2195         case RC_COMPLETION_INLINE_MATH:
2196                 if (ignore_system_lyxrc ||
2197                     completion_inline_math != system_lyxrc.completion_inline_math) {
2198                         os << "\\completion_inline_math "
2199                                 << convert<string>(completion_inline_math) << '\n';
2200                 }
2201                 if (tag != RC_LAST)
2202                         break;
2203                 // fall through
2204         case RC_COMPLETION_INLINE_TEXT:
2205                 if (ignore_system_lyxrc ||
2206                     completion_inline_text != system_lyxrc.completion_inline_text) {
2207                         os << "\\completion_inline_text "
2208                                 << convert<string>(completion_inline_text) << '\n';
2209                 }
2210                 if (tag != RC_LAST)
2211                         break;
2212                 // fall through
2213         case RC_COMPLETION_INLINE_DOTS:
2214                 if (ignore_system_lyxrc ||
2215                     completion_inline_dots != system_lyxrc.completion_inline_dots) {
2216                         os << "\\completion_inline_dots "
2217                                 << convert<string>(completion_inline_dots) << '\n';
2218                 }
2219                 if (tag != RC_LAST)
2220                         break;
2221                 // fall through
2222         case RC_AUTOCORRECTION_MATH:
2223                 if (ignore_system_lyxrc ||
2224                     autocorrection_math != system_lyxrc.autocorrection_math) {
2225                         os << "\\autocorrection_math "
2226                                 << convert<string>(autocorrection_math) << '\n';
2227                 }
2228                 if (tag != RC_LAST)
2229                         break;
2230                 // fall through
2231         case RC_COMPLETION_POPUP_DELAY:
2232                 if (ignore_system_lyxrc ||
2233                     completion_popup_delay != system_lyxrc.completion_popup_delay) {
2234                         os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2235                 }
2236                 if (tag != RC_LAST)
2237                         break;
2238                 // fall through
2239         case RC_COMPLETION_POPUP_MATH:
2240                 if (ignore_system_lyxrc ||
2241                     completion_popup_math != system_lyxrc.completion_popup_math) {
2242                         os << "\\completion_popup_math "
2243                                 << convert<string>(completion_popup_math) << '\n';
2244                 }
2245                 if (tag != RC_LAST)
2246                         break;
2247                 // fall through
2248         case RC_COMPLETION_POPUP_TEXT:
2249                 if (ignore_system_lyxrc ||
2250                     completion_popup_text != system_lyxrc.completion_popup_text) {
2251                         os << "\\completion_popup_text "
2252                                 << convert<string>(completion_popup_text) << '\n';
2253                 }
2254                 if (tag != RC_LAST)
2255                         break;
2256                 // fall through
2257         case RC_COMPLETION_CURSOR_TEXT:
2258                 if (ignore_system_lyxrc ||
2259                     completion_cursor_text != system_lyxrc.completion_cursor_text) {
2260                         os << "\\completion_cursor_text "
2261                            << convert<string>(completion_cursor_text) << '\n';
2262                 }
2263                 if (tag != RC_LAST)
2264                         break;
2265                 // fall through
2266         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2267                 if (ignore_system_lyxrc ||
2268                     completion_popup_after_complete
2269                     != system_lyxrc.completion_popup_after_complete) {
2270                         os << "\\completion_popup_after_complete "
2271                                 << convert<string>(completion_popup_after_complete) << '\n';
2272                 }
2273                 if (tag != RC_LAST)
2274                         break;
2275                 // fall through
2276         case RC_COMPLETION_MINLENGTH:
2277                 if (ignore_system_lyxrc ||
2278                         completion_minlength != system_lyxrc.completion_minlength) {
2279                         os << "\\completion_minlength " << convert<string>(completion_minlength)
2280                         << '\n';
2281                 }
2282                 if (tag != RC_LAST)
2283                         break;
2284                 // fall through
2285         case RC_NUMLASTFILES:
2286                 if (ignore_system_lyxrc ||
2287                     num_lastfiles != system_lyxrc.num_lastfiles) {
2288                         os << "\\num_lastfiles " << num_lastfiles << '\n';
2289                 }
2290                 if (tag != RC_LAST)
2291                         break;
2292                 // fall through
2293         case RC_CHECKLASTFILES:
2294                 if (ignore_system_lyxrc ||
2295                     check_lastfiles != system_lyxrc.check_lastfiles) {
2296                         os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2297                            << '\n';
2298                 }
2299                 if (tag != RC_LAST)
2300                         break;
2301                 // fall through
2302         case RC_EXAMPLEPATH:
2303                 if (ignore_system_lyxrc ||
2304                     example_path != system_lyxrc.example_path) {
2305                         string const path = os::external_path(example_path);
2306                         os << "\\example_path \"" << path << "\"\n";
2307                 }
2308                 if (tag != RC_LAST)
2309                         break;
2310                 // fall through
2311         case RC_TEMPLATEPATH:
2312                 if (ignore_system_lyxrc ||
2313                     template_path != system_lyxrc.template_path) {
2314                         string const path = os::external_path(template_path);
2315                         os << "\\template_path \"" << path << "\"\n";
2316                 }
2317                 if (tag != RC_LAST)
2318                         break;
2319                 // fall through
2320         case RC_TEMPDIRPATH:
2321                 if (ignore_system_lyxrc ||
2322                     tempdir_path != system_lyxrc.tempdir_path) {
2323                         string const path = os::external_path(tempdir_path);
2324                         os << "\\tempdir_path \"" << path << "\"\n";
2325                 }
2326                 if (tag != RC_LAST)
2327                         break;
2328                 // fall through
2329         case RC_THESAURUSDIRPATH:
2330                 if (ignore_system_lyxrc ||
2331                     thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2332                         string const path = os::external_path(thesaurusdir_path);
2333                         os << "\\thesaurusdir_path \"" << path << "\"\n";
2334                 }
2335                 if (tag != RC_LAST)
2336                         break;
2337                 // fall through
2338         case RC_HUNSPELLDIR_PATH:
2339                 if (ignore_system_lyxrc ||
2340                     hunspelldir_path != system_lyxrc.hunspelldir_path) {
2341                         string const path = os::external_path(hunspelldir_path);
2342                         os << "\\hunspelldir_path \"" << path << "\"\n";
2343                 }
2344                 if (tag != RC_LAST)
2345                         break;
2346                 // fall through
2347         case RC_PLAINTEXT_LINELEN:
2348                 if (ignore_system_lyxrc ||
2349                     plaintext_linelen != system_lyxrc.plaintext_linelen) {
2350                         os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2351                 }
2352                 if (tag != RC_LAST)
2353                         break;
2354                 // fall through
2355         case RC_MAKE_BACKUP:
2356                 if (ignore_system_lyxrc ||
2357                     make_backup != system_lyxrc.make_backup) {
2358                         os << "\\make_backup " << convert<string>(make_backup) << '\n';
2359                 }
2360                 if (tag != RC_LAST)
2361                         break;
2362                 // fall through
2363         case RC_SAVE_COMPRESSED:
2364                 if (ignore_system_lyxrc ||
2365                     save_compressed != system_lyxrc.save_compressed) {
2366                         os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2367                 }
2368                 if (tag != RC_LAST)
2369                         break;
2370                 // fall through
2371         case RC_SAVE_ORIGIN:
2372                 if (ignore_system_lyxrc ||
2373                     save_origin != system_lyxrc.save_origin) {
2374                         os << "\\save_origin " << convert<string>(save_origin) << '\n';
2375                 }
2376                 if (tag != RC_LAST)
2377                         break;
2378                 // fall through
2379         case RC_BACKUPDIR_PATH:
2380                 if (ignore_system_lyxrc ||
2381                     backupdir_path != system_lyxrc.backupdir_path) {
2382                         string const path = os::external_path(backupdir_path);
2383                         os << "\\backupdir_path \"" << path << "\"\n";
2384                 }
2385                 if (tag != RC_LAST)
2386                         break;
2387
2388                 os << "\n#\n"
2389                    << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2390                    << "#\n\n";
2391
2392                 os << "\n#\n"
2393                    << "# SPELLCHECKER SECTION ##############################\n"
2394                    << "#\n\n";
2395
2396         // fall through
2397         case RC_ACCEPT_COMPOUND:
2398                 if (ignore_system_lyxrc ||
2399                     spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2400                         os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2401                            << '\n';
2402                 }
2403                 if (tag != RC_LAST)
2404                         break;
2405                 // fall through
2406         case RC_ALT_LANG:
2407                 if (ignore_system_lyxrc ||
2408                     spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2409                         os << "\\alternate_language \"" << spellchecker_alt_lang
2410                            << "\"\n";
2411                 }
2412                 if (tag != RC_LAST)
2413                         break;
2414                 // fall through
2415         case RC_ESC_CHARS:
2416                 if (ignore_system_lyxrc ||
2417                     spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2418                         os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2419                 }
2420                 if (tag != RC_LAST)
2421                         break;
2422                 // fall through
2423         case RC_USE_NATIVE_FILEDIALOG:
2424                 if (ignore_system_lyxrc ||
2425                     use_native_filedialog != system_lyxrc.use_native_filedialog) {
2426                         os << "\\use_native_filedialog "
2427                            << convert<string>(use_native_filedialog)
2428                            << '\n';
2429                 }
2430                 if (tag != RC_LAST)
2431                         break;
2432                 // fall through
2433         case RC_USE_SYSTEM_COLORS:
2434                 if (ignore_system_lyxrc ||
2435                     use_system_colors != system_lyxrc.use_system_colors) {
2436                         os << "\\use_system_colors "
2437                            << convert<string>(use_system_colors)
2438                            << '\n';
2439                 }
2440                 if (tag != RC_LAST)
2441                         break;
2442                 // fall through
2443         case RC_USE_TOOLTIP:
2444                 if (ignore_system_lyxrc ||
2445                     use_tooltip != system_lyxrc.use_tooltip) {
2446                         os << "\\use_tooltip "
2447                            << convert<string>(use_tooltip)
2448                            << '\n';
2449                 }
2450                 if (tag != RC_LAST)
2451                         break;
2452                 // fall through
2453
2454                 os << "\n#\n"
2455                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
2456                    << "#\n\n";
2457
2458         // fall through
2459         case RC_DEFAULT_DECIMAL_SEP:
2460                 if (ignore_system_lyxrc ||
2461                     default_decimal_sep != system_lyxrc.default_decimal_sep) {
2462                         os << "\\default_decimal_point \"" << default_decimal_sep << "\"" << '\n';
2463                 }
2464                 if (tag != RC_LAST)
2465                         break;
2466                 // fall through
2467         case RC_DEFAULT_LENGTH_UNIT:
2468                 if (ignore_system_lyxrc ||
2469                     default_length_unit != system_lyxrc.default_length_unit) {
2470                         os << "\\default_length_unit " << int(default_length_unit) << '\n';
2471                 }
2472                 if (tag != RC_LAST)
2473                         break;
2474                 // fall through
2475         case RC_SPELLCHECKER:
2476                 if (ignore_system_lyxrc ||
2477                     spellchecker != system_lyxrc.spellchecker) {
2478                         os << "\\spellchecker " << spellchecker << '\n';
2479                 }
2480                 if (tag != RC_LAST)
2481                         break;
2482                 // fall through
2483         case RC_SPELLCHECK_CONTINUOUSLY:
2484                 if (ignore_system_lyxrc ||
2485                     spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2486                         os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2487                            << '\n';
2488                 }
2489                 if (tag != RC_LAST)
2490                         break;
2491                 // fall through
2492         case RC_SPELLCHECK_NOTES:
2493                 if (ignore_system_lyxrc ||
2494                     spellcheck_notes != system_lyxrc.spellcheck_notes) {
2495                         os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2496                            << '\n';
2497                 }
2498                 if (tag != RC_LAST)
2499                         break;
2500                 // fall through
2501         case RC_VISUAL_CURSOR:
2502                 if (ignore_system_lyxrc ||
2503                         visual_cursor != system_lyxrc.visual_cursor) {
2504                         os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2505                 }
2506                 if (tag != RC_LAST)
2507                         break;
2508                 // fall through
2509         case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2510                 if (ignore_system_lyxrc ||
2511                         close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2512                         os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2513                         os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2514                 }
2515                 if (tag != RC_LAST)
2516                         break;
2517                 // fall through
2518         case RC_LANGUAGE_CUSTOM_PACKAGE:
2519                 if (ignore_system_lyxrc ||
2520                     language_custom_package != system_lyxrc.language_custom_package) {
2521                         os << "\\language_custom_package \"" << language_custom_package
2522                            << "\"\n";
2523                 }
2524                 if (tag != RC_LAST)
2525                         break;
2526                 // fall through
2527         case RC_LANGUAGE_GLOBAL_OPTIONS:
2528                 if (ignore_system_lyxrc ||
2529                     language_global_options
2530                     != system_lyxrc.language_global_options) {
2531                         os << "\\language_global_options \""
2532                            << convert<string>(language_global_options)
2533                            << "\"\n";
2534                 }
2535                 if (tag != RC_LAST)
2536                         break;
2537                 // fall through
2538         case RC_LANGUAGE_PACKAGE_SELECTION:
2539                 if (ignore_system_lyxrc ||
2540                     language_package_selection != system_lyxrc.language_package_selection) {
2541                         os << "\\language_package_selection ";
2542                         switch (language_package_selection) {
2543                         case LP_AUTO:
2544                                 os << "0\n";
2545                                 break;
2546                         case LP_BABEL:
2547                                 os << "1\n";
2548                                 break;
2549                         case LP_CUSTOM:
2550                                 os << "2\n";
2551                                 break;
2552                         case LP_NONE:
2553                                 os << "3\n";
2554                                 break;
2555                         }
2556                 }
2557                 if (tag != RC_LAST)
2558                         break;
2559                 // fall through
2560         case RC_LANGUAGE_COMMAND_BEGIN:
2561                 if (ignore_system_lyxrc ||
2562                     language_command_begin
2563                     != system_lyxrc.language_command_begin) {
2564                         os << "\\language_command_begin \""
2565                            << language_command_begin
2566                            << "\"\n";
2567                 }
2568                 if (tag != RC_LAST)
2569                         break;
2570                 // fall through
2571         case RC_LANGUAGE_COMMAND_END:
2572                 if (ignore_system_lyxrc ||
2573                     language_command_end
2574                     != system_lyxrc.language_command_end) {
2575                         os << "\\language_command_end \"" << language_command_end
2576                            << "\"\n";
2577                 }
2578                 if (tag != RC_LAST)
2579                         break;
2580                 // fall through
2581         case RC_LANGUAGE_COMMAND_LOCAL:
2582                 if (ignore_system_lyxrc ||
2583                     language_command_local
2584                     != system_lyxrc.language_command_local) {
2585                         os << "\\language_command_local \""
2586                            << language_command_local
2587                            << "\"\n";
2588                 }
2589                 if (tag != RC_LAST)
2590                         break;
2591                 // fall through
2592         case RC_LANGUAGE_AUTO_BEGIN:
2593                 if (ignore_system_lyxrc ||
2594                     language_auto_begin != system_lyxrc.language_auto_begin) {
2595                         os << "\\language_auto_begin "
2596                            << convert<string>(language_auto_begin) << '\n';
2597                 }
2598                 if (tag != RC_LAST)
2599                         break;
2600                 // fall through
2601         case RC_LANGUAGE_AUTO_END:
2602                 if (ignore_system_lyxrc ||
2603                     language_auto_end != system_lyxrc.language_auto_end) {
2604                         os << "\\language_auto_end "
2605                            << convert<string>(language_auto_end) << '\n';
2606                 }
2607                 if (tag != RC_LAST)
2608                         break;
2609                 // fall through
2610         case RC_MARK_FOREIGN_LANGUAGE:
2611                 if (ignore_system_lyxrc ||
2612                     mark_foreign_language
2613                     != system_lyxrc.mark_foreign_language) {
2614                         os << "\\mark_foreign_language " <<
2615                                 convert<string>(mark_foreign_language) << '\n';
2616                 }
2617                 // fall through
2618         case RC_RESPECT_OS_KBD_LANGUAGE:
2619                 if (ignore_system_lyxrc ||
2620                     respect_os_kbd_language
2621                     != system_lyxrc.respect_os_kbd_language) {
2622                         os << "\\respect_os_kbd_language " <<
2623                                 convert<string>(respect_os_kbd_language) << '\n';
2624                 }
2625                 //fall through
2626                 if (tag != RC_LAST)
2627                         break;
2628
2629                 os << "\n#\n"
2630                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
2631                    << "#\n\n";
2632
2633         // fall through
2634         case RC_AUTO_NUMBER:
2635                 if (ignore_system_lyxrc ||
2636                     auto_number != system_lyxrc.auto_number) {
2637                         os << "\\auto_number " << convert<string>(auto_number) << '\n';
2638                 }
2639                 if (tag != RC_LAST)
2640                         break;
2641                 // fall through
2642         case RC_GUI_LANGUAGE:
2643                 if (ignore_system_lyxrc ||
2644                     gui_language != system_lyxrc.gui_language) {
2645                         os << "\\gui_language " << gui_language << '\n';
2646                 }
2647                 if (tag != RC_LAST)
2648                         break;
2649                 // fall through
2650         case RC_EXPORT_OVERWRITE:
2651                 if (ignore_system_lyxrc ||
2652                     export_overwrite != system_lyxrc.export_overwrite) {
2653                         string status;
2654                         switch (export_overwrite) {
2655                         case NO_FILES:
2656                                 status = "ask";
2657                                 break;
2658                         case MAIN_FILE:
2659                                 status = "main";
2660                                 break;
2661                         case ALL_FILES:
2662                                 status = "all";
2663                                 break;
2664                         }
2665                         os << "\\export_overwrite " << status << '\n';
2666                 }
2667                 if (tag != RC_LAST)
2668                         break;
2669                 // fall through
2670         case RC_SCROLL_WHEEL_ZOOM:
2671                 if (ignore_system_lyxrc ||
2672                         scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2673                         string status;
2674                         switch (scroll_wheel_zoom) {
2675                         case SCROLL_WHEEL_ZOOM_OFF:
2676                                 status = "off";
2677                                 break;
2678                         case SCROLL_WHEEL_ZOOM_CTRL:
2679                                 status = "ctrl";
2680                                 break;
2681                         case SCROLL_WHEEL_ZOOM_SHIFT:
2682                                 status = "shift";
2683                                 break;
2684                         case SCROLL_WHEEL_ZOOM_ALT:
2685                                 status = "alt";
2686                                 break;
2687                         }
2688                         os << "\\scroll_wheel_zoom " << status << '\n';
2689                 }
2690                 if (tag != RC_LAST)
2691                         break;
2692
2693                 os << "\n#\n"
2694                    << "# FORMATS SECTION ##########################\n"
2695                    << "#\n\n";
2696
2697         // fall through
2698         case RC_FILEFORMAT:
2699                 // New/modified formats
2700                 for (Formats::const_iterator cit = theFormats().begin();
2701                      cit != theFormats().end(); ++cit) {
2702                         Format const * format =
2703                                 theSystemFormats().getFormat(cit->name());
2704                         if (!format ||
2705                             format->extensions() != cit->extensions() ||
2706                             format->prettyname() != cit->prettyname() ||
2707                             format->shortcut() != cit->shortcut() ||
2708                             format->viewer() != cit->viewer() ||
2709                             format->editor() != cit->editor() ||
2710                             format->documentFormat() != cit->documentFormat() ||
2711                             format->vectorFormat() != cit->vectorFormat() ||
2712                             format->inExportMenu() != cit->inExportMenu() ||
2713                             format->noMenu() != cit->noMenu() ||
2714                             format->mime() != cit->mime()) {
2715                                 os << "\\format \"" << cit->name() << "\" \""
2716                                    << cit->extensions() << "\" \""
2717                                    << to_utf8(cit->prettyname()) << "\" \""
2718                                    << cit->shortcut() << "\" \""
2719                                    << escapeCommand(cit->viewer()) << "\" \""
2720                                    << escapeCommand(cit->editor()) << "\" \"";
2721                                 vector<string> flags;
2722                                 if (cit->documentFormat())
2723                                         flags.push_back("document");
2724                                 if (cit->vectorFormat())
2725                                         flags.push_back("vector");
2726                                 if (cit->zippedNative())
2727                                         flags.push_back("zipped=native");
2728                                 if (cit->inExportMenu())
2729                                         flags.push_back("menu=export");
2730
2731                                 os << getStringFromVector(flags);
2732                                 os << "\" \"" << cit->mime() << "\"\n";
2733                         }
2734                 }
2735
2736                 // Look for deleted formats
2737                 for (Formats::const_iterator cit = theSystemFormats().begin();
2738                      cit != theSystemFormats().end(); ++cit)
2739                         if (!theFormats().getFormat(cit->name()))
2740                                 os << "\\format \"" << cit->name()
2741                                    << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2742                 if (tag != RC_LAST)
2743                         break;
2744                 // fall through
2745         case RC_VIEWER_ALTERNATIVES: {
2746                 Alternatives::const_iterator it = viewer_alternatives.begin();
2747                 Alternatives::const_iterator const en = viewer_alternatives.end();
2748                 Alternatives::const_iterator const sysend =
2749                                 system_lyxrc.viewer_alternatives.end();
2750                 for (; it != en; ++it) {
2751                         string const & fmt = it->first;
2752                         CommandSet const & cmd = it->second;
2753                         CommandSet::const_iterator sit = cmd.begin();
2754                         CommandSet::const_iterator const sen = cmd.end();
2755                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2756                                         system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2757                                         system_lyxrc.viewer_alternatives.find(fmt);
2758                         for (; sit != sen; ++sit) {
2759                                 string const & cmd = *sit;
2760                                 if (ignore_system_lyxrc
2761                                     || sysfmt == sysend               // format not found
2762                                          || sysfmt->second.count(cmd) == 0 // this command not found
2763                                    )
2764                                         os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2765                         }
2766                 }
2767                 if (tag != RC_LAST)
2768                         break;
2769         }
2770         // fall through
2771         case RC_EDITOR_ALTERNATIVES: {
2772                 Alternatives::const_iterator it = editor_alternatives.begin();
2773                 Alternatives::const_iterator const en = editor_alternatives.end();
2774                 Alternatives::const_iterator const sysend =
2775                                 system_lyxrc.editor_alternatives.end();
2776                 for (; it != en; ++it) {
2777                         string const & fmt = it->first;
2778                         CommandSet const & cmd = it->second;
2779                         CommandSet::const_iterator sit = cmd.begin();
2780                         CommandSet::const_iterator const sen = cmd.end();
2781                         Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2782                                         system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2783                                         system_lyxrc.editor_alternatives.find(fmt);
2784                         for (; sit != sen; ++sit) {
2785                                 string const & cmd = *sit;
2786                                 if (ignore_system_lyxrc
2787                                     || sysfmt == sysend               // format not found
2788                                     || sysfmt->second.count(cmd) == 0 // this command not found
2789                                    )
2790                                         os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2791                         }
2792                 }
2793                 if (tag != RC_LAST)
2794                         break;
2795         }
2796         // fall through
2797         case RC_DEFAULT_OTF_VIEW_FORMAT:
2798                 if ((ignore_system_lyxrc ||
2799                      default_otf_view_format != system_lyxrc.default_otf_view_format)
2800                     && !default_otf_view_format.empty()) {
2801                         os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2802                 }
2803                 if (tag != RC_LAST)
2804                         break;
2805                 // fall through
2806         case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2807                 if ((ignore_system_lyxrc ||
2808                      default_platex_view_format != system_lyxrc.default_platex_view_format)
2809                     && !default_platex_view_format.empty()) {
2810                         os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2811                 }
2812                 if (tag != RC_LAST)
2813                         break;
2814                 // fall through
2815         case RC_DEFAULT_VIEW_FORMAT:
2816                 if ((ignore_system_lyxrc ||
2817                         default_view_format != system_lyxrc.default_view_format)
2818                         && !default_view_format.empty()) {
2819                         os << "\\default_view_format " << default_view_format << '\n';
2820                 }
2821                 if (tag != RC_LAST)
2822                         break;
2823                 // fall through
2824         case RC_VIEWER:
2825                 // Ignore it
2826                 if (tag != RC_LAST)
2827                         break;
2828
2829                 os << "\n#\n"
2830                    << "# CONVERTERS SECTION ##########################\n"
2831                    << "#\n\n";
2832
2833         // fall through
2834         case RC_CONVERTER:
2835                 // Look for new converters
2836                 for (Converters::const_iterator cit = theConverters().begin();
2837                      cit != theConverters().end(); ++cit) {
2838                         Converter const * converter =
2839                                 theSystemConverters().getConverter(cit->from(),
2840                                                                    cit->to());
2841                         if (!converter ||
2842                             converter->command() != cit->command() ||
2843                             converter->flags() != cit->flags())
2844                                 os << "\\converter \"" << cit->from() << "\" \""
2845                                    << cit->to() << "\" \""
2846                                    << escapeCommand(cit->command()) << "\" \""
2847                                    << cit->flags() << "\"\n";
2848                 }
2849
2850                 // New/modifed converters
2851                 for (Converters::const_iterator cit = theSystemConverters().begin();
2852                      cit != theSystemConverters().end(); ++cit)
2853                         if (!theConverters().getConverter(cit->from(), cit->to()))
2854                                 os << "\\converter \"" << cit->from()
2855                                    << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2856                 if (tag != RC_LAST)
2857                         break;
2858                 // fall through
2859         case RC_COPIER:
2860                 if (tag == RC_LAST)
2861                         os << "\n#\n"
2862                            << "# COPIERS SECTION ##########################\n"
2863                            << "#\n\n";
2864
2865                 // Look for new movers
2866                 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2867                 Movers::const_iterator const sysend = theSystemMovers().end();
2868                 Movers::const_iterator it = theMovers().begin();
2869                 Movers::const_iterator end = theMovers().end();
2870
2871                 for (; it != end; ++it) {
2872                         Movers::const_iterator const sysit =
2873                                 find_if(sysbegin, sysend, SameMover(*it));
2874                         if (sysit == sysend) {
2875                                 string const & fmt = it->first;
2876                                 string const & command =
2877                                         it->second.command();
2878
2879                                 os << "\\copier " << fmt
2880                                    << " \"" << escapeCommand(command) << "\"\n";
2881                         }
2882                 }
2883                 if (tag != RC_LAST)
2884                         break;
2885
2886                 // We don't actually delete SpecialisedMover(s) from the
2887                 // map, just clear their 'command', so there's no need
2888                 // to test for anything else.
2889         }
2890
2891         os.flush();
2892 }
2893
2894
2895 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2896 {
2897         // Why the switch you might ask. It is a trick to ensure that all
2898         // the elements in the LyXRCTags enum is handled. As you can see
2899         // there are no breaks at all. So it is just a huge fall-through.
2900         // The nice thing is that we will get a warning from the compiler
2901         // if we forget an element.
2902         LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2903         switch (tag) {
2904         case LyXRC::RC_LAST:
2905         case LyXRC::RC_ACCEPT_COMPOUND:
2906                 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2907                         if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2908                 // fall through
2909         case LyXRC::RC_ALT_LANG:
2910         case LyXRC::RC_PLAINTEXT_LINELEN:
2911         case LyXRC::RC_AUTOCORRECTION_MATH:
2912         case LyXRC::RC_AUTOREGIONDELETE:
2913         case LyXRC::RC_AUTORESET_OPTIONS:
2914         case LyXRC::RC_AUTOSAVE:
2915         case LyXRC::RC_AUTO_NUMBER:
2916         case LyXRC::RC_BACKUPDIR_PATH:
2917         case LyXRC::RC_BIBTEX_ALTERNATIVES:
2918         case LyXRC::RC_BIBTEX_COMMAND:
2919         case LyXRC::RC_BINDFILE:
2920         case LyXRC::RC_BOOKMARKS_VISIBILITY:
2921         case LyXRC::RC_CITATION_SEARCH:
2922         case LyXRC::RC_CITATION_SEARCH_PATTERN:
2923         case LyXRC::RC_CITATION_SEARCH_VIEW:
2924         case LyXRC::RC_CHECKLASTFILES:
2925         case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2926         case LyXRC::RC_COMPLETION_INLINE_DELAY:
2927         case LyXRC::RC_COMPLETION_INLINE_DOTS:
2928         case LyXRC::RC_COMPLETION_INLINE_MATH:
2929         case LyXRC::RC_COMPLETION_INLINE_TEXT:
2930         case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2931         case LyXRC::RC_COMPLETION_POPUP_DELAY:
2932         case LyXRC::RC_COMPLETION_POPUP_MATH:
2933         case LyXRC::RC_COMPLETION_POPUP_TEXT:
2934         case LyXRC::RC_COMPLETION_MINLENGTH:
2935         case LyXRC::RC_USELASTFILEPOS:
2936         case LyXRC::RC_LOADSESSION:
2937         case LyXRC::RC_CHKTEX_COMMAND:
2938         case LyXRC::RC_CONVERTER:
2939         case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2940         case LyXRC::RC_COPIER:
2941         case LyXRC::RC_CT_ADDITIONS_UNDERLINED:
2942         case LyXRC::RC_CT_MARKUP_COPIED:
2943         case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2944         case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2945         case LyXRC::RC_GUI_LANGUAGE:
2946         case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2947         case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2948         case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2949         case LyXRC::RC_DEFFILE:
2950         case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2951         case LyXRC::RC_DISPLAY_GRAPHICS:
2952         case LyXRC::RC_DOCUMENTPATH:
2953                 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2954                         FileName path(lyxrc_new.document_path);
2955                         if (path.exists() && path.isDirectory())
2956                                 package().document_dir() = FileName(lyxrc.document_path);
2957                 }
2958                 // fall through
2959         case LyXRC::RC_DRAW_STRATEGY:
2960         case LyXRC::RC_EDITOR_ALTERNATIVES:
2961         case LyXRC::RC_ESC_CHARS:
2962         case LyXRC::RC_EXAMPLEPATH:
2963         case LyXRC::RC_FILEFORMAT:
2964         case LyXRC::RC_GROUP_LAYOUTS:
2965         case LyXRC::RC_HUNSPELLDIR_PATH:
2966         case LyXRC::RC_ICON_SET:
2967         case LyXRC::RC_UI_STYLE:
2968         case LyXRC::RC_INDEX_ALTERNATIVES:
2969         case LyXRC::RC_INDEX_COMMAND:
2970         case LyXRC::RC_JBIBTEX_COMMAND:
2971         case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2972         case LyXRC::RC_JINDEX_COMMAND:
2973         case LyXRC::RC_NOMENCL_COMMAND:
2974         case LyXRC::RC_PYGMENTIZE_COMMAND:
2975         case LyXRC::RC_INPUT:
2976         case LyXRC::RC_KBMAP:
2977         case LyXRC::RC_KBMAP_PRIMARY:
2978         case LyXRC::RC_KBMAP_SECONDARY:
2979         case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2980         case LyXRC::RC_LANGUAGE_AUTO_END:
2981         case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2982         case LyXRC::RC_LANGUAGE_COMMAND_END:
2983         case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2984         case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2985         case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2986         case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2987         case LyXRC::RC_LYXRCFORMAT:
2988         case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2989         case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2990         case LyXRC::RC_MACRO_EDIT_STYLE:
2991         case LyXRC::RC_MAKE_BACKUP:
2992         case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2993         case LyXRC::RC_RESPECT_OS_KBD_LANGUAGE:
2994         case LyXRC::RC_MOUSE_WHEEL_SPEED:
2995         case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
2996         case LyXRC::RC_NUMLASTFILES:
2997         case LyXRC::RC_PARAGRAPH_MARKERS:
2998         case LyXRC::RC_PATH_PREFIX:
2999                 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
3000                         prependEnvPath("PATH", replaceEnvironmentPath(lyxrc_new.path_prefix));
3001                         // Resets python path
3002                         support::os::python(true);
3003                 }
3004                 // fall through
3005         case LyXRC::RC_PREVIEW:
3006                 if (lyxrc_orig.preview != lyxrc_new.preview) {
3007                         // Update all previews of all documents.
3008                         /* FIXME: this can be very expensive. It would be cheaper
3009                          * to kill all existing previews and update visible
3010                          * previews.*/
3011                         theBufferList().updatePreviews();
3012                 }
3013                 // fall through
3014         case LyXRC::RC_PREVIEW_HASHED_LABELS:
3015         case LyXRC::RC_PREVIEW_SCALE_FACTOR:
3016         case LyXRC::RC_PRINTLANDSCAPEFLAG:
3017         case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
3018         case LyXRC::RC_PRINTPAPERFLAG:
3019         case LyXRC::RC_SAVE_COMPRESSED:
3020         case LyXRC::RC_SAVE_ORIGIN:
3021         case LyXRC::RC_SCREEN_DPI:
3022
3023         case LyXRC::RC_SCREEN_FONT_ROMAN:
3024         case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
3025         case LyXRC::RC_SCREEN_FONT_SANS:
3026         case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
3027         case LyXRC::RC_SCREEN_FONT_SCALABLE:
3028         case LyXRC::RC_SCREEN_FONT_SIZES:
3029         case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
3030         case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3031         case LyXRC::RC_SCREEN_ZOOM:
3032                 if (lyxrc_orig.roman_font_name != lyxrc_new.roman_font_name
3033                 || lyxrc_orig.sans_font_name != lyxrc_new.sans_font_name
3034                 || lyxrc_orig.typewriter_font_name != lyxrc_new.typewriter_font_name
3035                 || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry
3036                 || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry
3037                 || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts
3038                 || !std::equal(std::begin(lyxrc_orig.font_sizes), std::end(lyxrc_orig.font_sizes),
3039                                std::begin(lyxrc_new.font_sizes))
3040                 || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry
3041                 || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) {
3042                         dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
3043                 }
3044                 // fall through
3045         case LyXRC::RC_GEOMETRY_SESSION:
3046         case LyXRC::RC_SERVERPIPE:
3047         case LyXRC::RC_SET_COLOR:
3048         case LyXRC::RC_SHOW_BANNER:
3049         case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
3050         case LyXRC::RC_SPELLCHECKER:
3051                 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3052                         setSpellChecker();
3053                 // fall through
3054         case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3055         case LyXRC::RC_SPELLCHECK_NOTES:
3056         case LyXRC::RC_SPLITINDEX_COMMAND:
3057         case LyXRC::RC_TEMPDIRPATH:
3058         case LyXRC::RC_TEMPLATEPATH:
3059         case LyXRC::RC_TEX_ALLOWS_SPACES:
3060         case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3061                 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3062                         os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3063                 }
3064                 // fall through
3065         case LyXRC::RC_TEXINPUTS_PREFIX:
3066         case LyXRC::RC_THESAURUSDIRPATH:
3067         case LyXRC::RC_UIFILE:
3068         case LyXRC::RC_USER_EMAIL:
3069         case LyXRC::RC_USER_INITIALS:
3070         case LyXRC::RC_USER_NAME:
3071         case LyXRC::RC_USE_CONVERTER_CACHE:
3072         case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
3073         case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
3074         case LyXRC::RC_USE_NATIVE_FILEDIALOG:
3075         case LyXRC::RC_USE_SYSTEM_COLORS:
3076         case LyXRC::RC_USE_TOOLTIP:
3077         case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3078         case LyXRC::RC_VIEWDVI_PAPEROPTION:
3079         case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3080         case LyXRC::RC_SINGLE_INSTANCE:
3081         case LyXRC::RC_SORT_LAYOUTS:
3082         case LyXRC::RC_SCREEN_LIMIT:
3083         case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3084         case LyXRC::RC_FULL_SCREEN_MENUBAR:
3085         case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3086         case LyXRC::RC_FULL_SCREEN_TABBAR:
3087         case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3088         case LyXRC::RC_SCREEN_WIDTH:
3089         case LyXRC::RC_VISUAL_CURSOR:
3090         case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3091         case LyXRC::RC_VIEWER:
3092         case LyXRC::RC_VIEWER_ALTERNATIVES:
3093         case LyXRC::RC_FORWARD_SEARCH_DVI:
3094         case LyXRC::RC_FORWARD_SEARCH_PDF:
3095         case LyXRC::RC_EXPORT_OVERWRITE:
3096         case LyXRC::RC_DEFAULT_DECIMAL_SEP:
3097         case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3098         case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3099         case LyXRC::RC_CURSOR_WIDTH:
3100                 break;
3101         }
3102 }
3103
3104
3105 set<string> LyXRC::getRCs()
3106 {
3107         set<string> res;
3108         for (int i = 0; i != lyxrcCount; ++i)
3109                 res.insert(ltrim(lyxrcTags[i].tag, "\\"));
3110         return res;
3111 }
3112
3113
3114 #if 0
3115 string const LyXRC::getDescription(LyXRCTags tag)
3116 {
3117         docstring str;
3118
3119         switch (tag) {
3120         case RC_ACCEPT_COMPOUND:
3121                 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3122                 break;
3123
3124         case RC_ALT_LANG:
3125                 str = _("Specify an alternate language. The default is to use the language of the document.");
3126                 break;
3127
3128         case RC_PLAINTEXT_LINELEN:
3129                 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.");
3130                 break;
3131
3132         case RC_AUTOREGIONDELETE:
3133                 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3134                 break;
3135
3136         case RC_AUTORESET_OPTIONS:
3137                 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3138                 break;
3139
3140         case RC_AUTOSAVE:
3141                 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3142                 break;
3143
3144         case RC_AUTO_NUMBER:
3145                 break;
3146
3147         case RC_BACKUPDIR_PATH:
3148                 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.");
3149                 break;
3150
3151         case RC_BIBTEX_COMMAND:
3152                 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3153                 break;
3154
3155         case RC_JBIBTEX_COMMAND:
3156                 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3157                 break;
3158
3159         case RC_BINDFILE:
3160                 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3161                 break;
3162
3163         case RC_CHECKLASTFILES:
3164                 str = _("Select to check whether the lastfiles still exist.");
3165                 break;
3166
3167         case RC_CHKTEX_COMMAND:
3168                 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3169                 break;
3170
3171         case RC_CONVERTER:
3172                 break;
3173
3174         case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3175                 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3176                 break;
3177
3178         case RC_CONVERTER_NEEDAUTH:
3179                 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3180                 break;
3181
3182         case RC_COPIER:
3183                 break;
3184
3185         case RC_CURSOR_FOLLOWS_SCROLLBAR:
3186                 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.");
3187                 break;
3188
3189         case RC_CURSOR_WIDTH:
3190                 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3191                 break;
3192
3193         case RC_SCROLL_BELOW_DOCUMENT:
3194                 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");
3195                 break;
3196
3197         case RC_MAC_DONTSWAP_CTRL_META:
3198                 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3199                 break;
3200
3201         case RC_MAC_LIKE_CURSOR_MOVEMENT:
3202                 str = _("Use the Mac OS X conventions for cursor movement");
3203                 break;
3204
3205         case RC_SHOW_MACRO_LABEL:
3206                 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3207                 break;
3208
3209         case RC_DEFFILE:
3210                 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3211                 break;
3212
3213         case RC_DEFAULT_OTF_VIEW_FORMAT:
3214                 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3215                 break;
3216
3217         case RC_DEFAULT_VIEW_FORMAT:
3218                 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3219                 break;
3220
3221         case RC_DIALOGS_ICONIFY_WITH_MAIN:
3222                 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3223                 break;
3224
3225         case RC_DISPLAY_GRAPHICS:
3226                 str = _("Select how LyX will display any graphics.");
3227                 break;
3228
3229         case RC_DOCUMENTPATH:
3230                 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3231                 break;
3232
3233         case RC_ESC_CHARS:
3234                 str = _("Specify additional chars that can be part of a word.");
3235                 break;
3236
3237         case RC_EXAMPLEPATH:
3238                 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3239                 break;
3240
3241         case RC_FILEFORMAT:
3242                 break;
3243
3244         case RC_INDEX_COMMAND:
3245                 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\".");
3246                 break;
3247
3248         case RC_JINDEX_COMMAND:
3249                 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3250                 break;
3251
3252         case RC_NOMENCL_COMMAND:
3253                 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3254                 break;
3255
3256         case RC_PYGMENTIZE_COMMAND:
3257                 str = _("The command to run the python pygments syntax highlighter.");
3258                 break;
3259
3260         case RC_INPUT:
3261                 break;
3262
3263         case RC_KBMAP:
3264         case RC_KBMAP_PRIMARY:
3265         case RC_KBMAP_SECONDARY:
3266                 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.");
3267                 break;
3268
3269         case RC_LANGUAGE_AUTO_BEGIN:
3270                 str = _("Select if a language switching command is needed at the beginning of the document.");
3271                 break;
3272
3273         case RC_LANGUAGE_AUTO_END:
3274                 str = _("Select if a language switching command is needed at the end of the document.");
3275                 break;
3276
3277         case RC_LANGUAGE_COMMAND_BEGIN:
3278                 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.");
3279                 break;
3280
3281         case RC_LANGUAGE_COMMAND_END:
3282                 str = _("The LaTeX command for changing back to the language of the document.");
3283                 break;
3284
3285         case RC_LANGUAGE_COMMAND_LOCAL:
3286                 str = _("The LaTeX command for local changing of the language.");
3287                 break;
3288
3289         case RC_LANGUAGE_GLOBAL_OPTIONS:
3290                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3291                 break;
3292
3293         case RC_LANGUAGE_CUSTOM_PACKAGE:
3294                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3295                 break;
3296
3297         case RC_LANGUAGE_PACKAGE_SELECTION:
3298                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3299                 break;
3300
3301         case RC_USELASTFILEPOS:
3302                 str = _("De-select if you do not want LyX to scroll to saved position.");
3303                 break;
3304
3305         case RC_LOADSESSION:
3306                 str = _("De-select to prevent loading files opened from the last LyX session.");
3307                 break;
3308
3309         case RC_MAKE_BACKUP:
3310                 str = _("De-select if you don't want LyX to create backup files.");
3311                 break;
3312
3313         case RC_MARK_FOREIGN_LANGUAGE:
3314                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3315                 break;
3316
3317         case RC_RESPECT_OS_KBD_LANGUAGE:
3318                 str = _("Select to use the current keyboard language, as set from the operating system, as default input language.");
3319                 break;
3320
3321         case RC_MOUSE_WHEEL_SPEED:
3322                 str = _("The scrolling speed of the mouse wheel.");
3323                 break;
3324
3325         case RC_COMPLETION_POPUP_DELAY:
3326                 str = _("The completion popup delay.");
3327                 break;
3328
3329         case RC_COMPLETION_POPUP_MATH:
3330                 str = _("Select to display the completion popup in math mode.");
3331                 break;
3332
3333         case RC_COMPLETION_POPUP_TEXT:
3334                 str = _("Select to display the completion popup in text mode.");
3335                 break;
3336
3337         case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3338                 str = _("Show the completion popup without delay after non-unique completion attempt.");
3339                 break;
3340
3341         case RC_COMPLETION_POPUP_TEXT:
3342                 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3343                 break;
3344
3345         case RC_COMPLETION_POPUP_DELAY:
3346                 str = _("The inline completion delay.");
3347                 break;
3348
3349         case RC_COMPLETION_INLINE_MATH:
3350                 str = _("Select to display the inline completion in math mode.");
3351                 break;
3352
3353         case RC_COMPLETION_INLINE_TEXT:
3354                 str = _("Select to display the inline completion in text mode.");
3355                 break;
3356
3357         case RC_COMPLETION_INLINE_DOTS:
3358                 str = _("Use \"...\" to shorten long completions.");
3359                 break;
3360
3361         case RC_AUTOCORRECTION_MATH:
3362                 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3363                 break;
3364
3365         case RC_NUMLASTFILES:
3366                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3367                         maxlastfiles);
3368                 break;
3369
3370         case RC_PATH_PREFIX:
3371                 str = _("Specify those directories which should be "
3372                          "prepended to the PATH environment variable.\n"
3373                          "Use the OS native format.");
3374                 break;
3375
3376         case RC_PREVIEW:
3377                 str = _("Shows a typeset preview of things such as math");
3378                 break;
3379
3380         case RC_PREVIEW_HASHED_LABELS:
3381                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3382                 break;
3383
3384         case RC_PREVIEW_SCALE_FACTOR:
3385                 str = _("Scale the preview size to suit.");
3386                 break;
3387
3388         case RC_PRINTLANDSCAPEFLAG:
3389                 str = _("The option to print out in landscape.");
3390                 break;
3391
3392         case RC_PRINTPAPERDIMENSIONFLAG:
3393                 str = _("Option to specify the dimensions of the print paper.");
3394                 break;
3395
3396         case RC_PRINTPAPERFLAG:
3397                 str = _("The option to specify paper type.");
3398                 break;
3399
3400         case RC_VISUAL_CURSOR:
3401                 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3402                 break;
3403
3404         case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3405                 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).");
3406                 break;
3407
3408         case RC_SCREEN_DPI:
3409                 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3410                 break;
3411
3412         case RC_SCREEN_FONT_ROMAN:
3413         case RC_SCREEN_FONT_SANS:
3414         case RC_SCREEN_FONT_TYPEWRITER:
3415                 str = _("The screen fonts used to display the text while editing.");
3416                 break;
3417
3418         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3419         case RC_SCREEN_FONT_SANS_FOUNDRY:
3420         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3421                 break;
3422
3423         case RC_SCREEN_FONT_SCALABLE:
3424                 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.");
3425                 break;
3426
3427         case RC_SCREEN_FONT_SIZES:
3428                 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3429                 break;
3430
3431         case RC_SCREEN_ZOOM:
3432                 //xgettext:no-c-format
3433                 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3434                 break;
3435
3436         case RC_GEOMETRY_SESSION:
3437                 str = _("Allow session manager to save and restore windows geometry.");
3438                 break;
3439
3440         case RC_SERVERPIPE:
3441                 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3442                 break;
3443
3444         case RC_SET_COLOR:
3445                 break;
3446
3447         case RC_SHOW_BANNER:
3448                 str = _("De-select if you don't want the startup banner.");
3449                 break;
3450
3451         case RC_TEMPDIRPATH:
3452                 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3453                 break;
3454
3455         case RC_THESAURUSDIRPATH:
3456                 str = _("This is the place where the files of the thesaurus library reside.");
3457                 break;
3458
3459         case RC_TEMPLATEPATH:
3460                 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3461                 break;
3462
3463         case RC_TEX_ALLOWS_SPACES:
3464                 break;
3465
3466         case RC_TEX_EXPECTS_WINDOWS_PATHS:
3467                 break;
3468
3469         case RC_TEXINPUTS_PREFIX:
3470                 str = _("Specify those directories which should be "
3471                          "prepended to the TEXINPUTS environment variable.\n"
3472                          "A '.' represents the current document directory. "
3473                          "Use the OS native format.");
3474                 break;
3475
3476         case RC_UIFILE:
3477                 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3478                 break;
3479
3480         case RC_USER_EMAIL:
3481                 break;
3482
3483         case RC_USER_NAME:
3484                 break;
3485
3486         case RC_USE_USE_SYSTEM_COLORS:
3487                 str = _("Enable use the system colors for some things like main window background and selection.");
3488                 break;
3489
3490         case RC_USE_TOOLTIP:
3491                 str = _("Enable the automatic appearance of tool tips in the work area.");
3492                 break;
3493
3494         case RC_VIEWDVI_PAPEROPTION:
3495                 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3496                 break;
3497
3498         case RC_VIEWER:
3499                 break;
3500
3501         case RC_LAST:
3502                 break;
3503         }
3504
3505         return str;
3506 }
3507 #endif
3508
3509
3510 // The global instance
3511 LyXRC lyxrc;
3512
3513 // The global copy of the system lyxrc entries (everything except preferences)
3514 LyXRC system_lyxrc;
3515
3516
3517 } // namespace lyx