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