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