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