]> git.lyx.org Git - lyx.git/blob - src/lyxrc.C
* src/frontends/controllers/ControlAboutlyx.[Ch]:
[lyx.git] / src / lyxrc.C
1 /**
2  * \file lyxrc.C
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 <fstream>
20 #include <iostream>
21
22 #include "lyxrc.h"
23
24 #include "debug.h"
25 #include "converter.h"
26 #include "format.h"
27 #include "gettext.h"
28 #include "session.h"
29 #include "LColor.h"
30 #include "lyxlex.h"
31 #include "lyxfont.h"
32 #include "mover.h"
33
34 #include "graphics/GraphicsTypes.h"
35
36 #include "support/convert.h"
37 #include "support/environment.h"
38 #include "support/filetools.h"
39 #include "support/lstrings.h"
40 #include "support/os.h"
41 #include "support/userinfo.h"
42
43
44 namespace lyx {
45
46 namespace os = support::os;
47
48 using support::ascii_lowercase;
49 using support::bformat;
50 using support::expandPath;
51 using support::FileName;
52 using support::getEnv;
53 using support::libFileSearch;
54 using support::token;
55
56 using std::cout;
57 using std::endl;
58
59 using std::ios;
60 using std::ofstream;
61 using std::ostream;
62 using std::string;
63
64
65 namespace {
66
67 // when adding something to this array keep it sorted!
68 keyword_item lyxrcTags[] = {
69         { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
70         { "\\alternate_language", LyXRC::RC_ALT_LANG },
71         { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
72         { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
73         { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
74         { "\\autosave", LyXRC::RC_AUTOSAVE },
75         { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
76         { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
77         { "\\bind_file", LyXRC::RC_BINDFILE },
78         { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
79         { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
80         { "\\converter", LyXRC::RC_CONVERTER },
81         { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
82         { "\\copier", LyXRC::RC_COPIER },
83         { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
84         { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
85         { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
86         { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
87         { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
88         { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
89         { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
90         { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
91         { "\\document_path", LyXRC::RC_DOCUMENTPATH },
92         { "\\escape_chars", LyXRC::RC_ESC_CHARS },
93         { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
94         { "\\format", LyXRC::RC_FORMAT },
95         { "\\index_command", LyXRC::RC_INDEX_COMMAND },
96         { "\\input", LyXRC::RC_INPUT },
97         { "\\kbmap", LyXRC::RC_KBMAP },
98         { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
99         { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
100         { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
101         { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
102         { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
103         { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
104         { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
105         { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
106         { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
107         { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
108         { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
109         { "\\load_session", LyXRC::RC_LOADSESSION },
110         { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
111         { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
112         { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
113         { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
114         { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
115         { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
116         { "\\plaintext_roff_command", LyXRC::RC_PLAINTEXT_ROFF_COMMAND },
117         { "\\preview", LyXRC::RC_PREVIEW },
118         { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
119         { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
120         { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
121         { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
122         { "\\print_command", LyXRC::RC_PRINT_COMMAND },
123         { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
124         { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
125         { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
126         { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
127         { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
128         { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
129         { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
130         { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
131         { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
132         { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
133         { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
134         { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
135         { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
136         { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
137         { "\\printer", LyXRC::RC_PRINTER },
138         { "\\rtl", LyXRC::RC_RTL_SUPPORT },
139         { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
140         { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
141         { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
142         { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
143         { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
144         { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
145         { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
146         { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
147         { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
148         { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
149         { "\\screen_geometry_height", LyXRC::RC_SCREEN_GEOMETRY_HEIGHT },
150         { "\\screen_geometry_width", LyXRC::RC_SCREEN_GEOMETRY_WIDTH },
151         { "\\screen_geometry_xysaved", LyXRC::RC_SCREEN_GEOMETRY_XYSAVED },
152         { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
153         { "\\serverpipe", LyXRC::RC_SERVERPIPE },
154         { "\\set_color", LyXRC::RC_SET_COLOR },
155         { "\\show_banner", LyXRC::RC_SHOW_BANNER },
156         { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
157         { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
158         { "\\template_path", LyXRC::RC_TEMPLATEPATH },
159         { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
160         { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
161         { "\\ui_file", LyXRC::RC_UIFILE },
162         { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
163         { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
164         { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
165         { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
166         { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
167         { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
168         // compatibility with versions older than 1.4.0 only
169         { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
170         { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
171         // compatibility with versions older than 1.4.0 only
172         { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
173         { "\\user_email", LyXRC::RC_USER_EMAIL },
174         { "\\user_name", LyXRC::RC_USER_NAME },
175         { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
176         // compatibility with versions older than 1.4.0 only
177         { "\\viewer" ,LyXRC::RC_VIEWER}
178 };
179
180 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
181
182 } // namespace anon
183
184
185 LyXRC::LyXRC()
186 {
187         setDefaults();
188 }
189
190
191 void LyXRC::setDefaults() {
192         bind_file = "cua";
193         ui_file = "default";
194         // Get printer from the environment. If fail, use default "",
195         // assuming that everything is set up correctly.
196         printer = getEnv("PRINTER");
197         print_adapt_output = false;
198         print_command = "dvips";
199         print_evenpage_flag = "-B";
200         print_oddpage_flag = "-A";
201         print_pagerange_flag = "-pp";
202         print_copies_flag = "-c";
203         print_collcopies_flag = "-C";
204         print_reverse_flag = "-r";
205         print_landscape_flag = "-t landscape";
206         print_to_printer = "-P";
207         print_to_file = "-o ";
208         print_file_extension = ".ps";
209         print_paper_flag = "-t";
210         print_paper_dimension_flag = "-T";
211         document_path.erase();
212         view_dvi_paper_option.erase();
213         default_papersize = PAPER_DEFAULT;
214         custom_export_format = "ps";
215         chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
216         bibtex_command = "bibtex";
217         fontenc = "default";
218         index_command = "makeindex -c -q";
219         dpi = 75;
220         // Because a screen typically is wider than a piece of paper:
221         zoom = 150;
222         geometry_width = 0;
223         geometry_height = 0;
224         geometry_xysaved = true;
225         // Default LaTeX font size:
226         font_sizes[LyXFont::SIZE_TINY] = "5.0";
227         font_sizes[LyXFont::SIZE_SCRIPT] = "7.0";
228         font_sizes[LyXFont::SIZE_FOOTNOTE] = "8.0";
229         font_sizes[LyXFont::SIZE_SMALL] = "9.0";
230         font_sizes[LyXFont::SIZE_NORMAL] = "10.0";
231         font_sizes[LyXFont::SIZE_LARGE] = "12.0";
232         font_sizes[LyXFont::SIZE_LARGER] = "14.4";
233         font_sizes[LyXFont::SIZE_LARGEST] = "17.26";
234         font_sizes[LyXFont::SIZE_HUGE] = "20.74";
235         font_sizes[LyXFont::SIZE_HUGER] = "24.88";
236         use_scalable_fonts = true;
237         roman_font_name = "";
238         sans_font_name = "";
239         typewriter_font_name = "";
240         font_norm = "iso8859-1";
241         autosave = 300;
242         auto_region_delete = true;
243         auto_reset_options = false;
244         plaintext_linelen = 65;
245         num_lastfiles = maxlastfiles;
246         check_lastfiles = true;
247         use_lastfilepos = true;
248         load_session = false;
249         make_backup = true;
250         backupdir_path.erase();
251         display_graphics = graphics::ColorDisplay;
252         // Spellchecker settings:
253         use_spell_lib = true;
254         isp_command = "ispell";
255         isp_accept_compound = false;
256         isp_use_input_encoding = false;
257         isp_use_alt_lang = false;
258         isp_use_pers_dict = false;
259         isp_use_esc_chars = false;
260         use_kbmap = false;
261         rtl_support = false;
262         auto_number = true;
263         mark_foreign_language = true;
264         language_auto_begin = true;
265         language_auto_end = true;
266         language_global_options = true;
267         language_use_babel = true;
268         language_package = "\\usepackage{babel}";
269         language_command_begin = "\\selectlanguage{$$lang}";
270         language_command_local = "\\foreignlanguage{$$lang}{";
271         default_language = "english";
272         show_banner = true;
273         windows_style_tex_paths = false;
274         tex_allows_spaces = false;
275         date_insert_format = "%x";
276         cursor_follows_scrollbar = false;
277         dialogs_iconify_with_main = false;
278         label_init_length = 3;
279         preview = PREVIEW_OFF;
280         preview_hashed_labels  = false;
281         preview_scale_factor = "0.9";
282         use_converter_cache = false;
283         converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
284
285         user_name = to_utf8(support::user_name());
286
287         user_email = to_utf8(support::user_email());
288 }
289
290
291 namespace {
292
293 void oldFontFormat(string & family, string & foundry)
294 {
295         if (family.empty() || family[0] != '-')
296                 return;
297         foundry = token(family, '-', 1);
298         family = token(family, '-', 2);
299         if (foundry == "*")
300                 foundry.erase();
301 }
302
303 } // namespace anon
304
305
306 int LyXRC::read(FileName const & filename)
307 {
308         LyXLex lexrc(lyxrcTags, lyxrcCount);
309         if (lyxerr.debugging(Debug::PARSER))
310                 lexrc.printTable(lyxerr);
311
312         lexrc.setFile(filename);
313         if (!lexrc.isOK()) return -2;
314
315         lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
316
317         return read(lexrc);
318 }
319
320
321 int LyXRC::read(std::istream & is)
322 {
323         LyXLex lexrc(lyxrcTags, lyxrcCount);
324         if (lyxerr.debugging(Debug::PARSER))
325                 lexrc.printTable(lyxerr);
326
327         lexrc.setStream(is);
328         if (!lexrc.isOK()) return -2;
329
330         lyxerr[Debug::LYXRC] << "Reading istream..." << endl;
331
332         return read(lexrc);
333 }
334
335
336 int LyXRC::read(LyXLex & lexrc)
337 {
338         if (!lexrc.isOK()) return -2;
339
340         while (lexrc.isOK()) {
341                 // By using two switches we take advantage of the compiler
342                 // telling us if we have missed a LyXRCTags element in
343                 // the second switch.
344                 // Note that this also shows a problem with LyXLex since it
345                 // helps us avoid taking advantage of the strictness of the
346                 // compiler.
347
348                 int le = lexrc.lex();
349                 switch (le) {
350                 case LyXLex::LEX_UNDEF:
351                         lexrc.printError("Unknown tag `$$Token'");
352                         continue;
353                 case LyXLex::LEX_FEOF:
354                         continue;
355                 default: break;
356                 }
357                 switch (static_cast<LyXRCTags>(le)) {
358                 case RC_INPUT: // Include file
359                         if (lexrc.next()) {
360                                 FileName const tmp =
361                                         libFileSearch(string(),
362                                                       lexrc.getString());
363                                 if (read(tmp)) {
364                                         lexrc.printError("Error reading "
365                                                          "included file: " + tmp.absFilename());
366                                 }
367                         }
368                         break;
369                 case RC_BINDFILE:
370                         if (lexrc.next()) {
371                                 bind_file = os::internal_path(lexrc.getString());
372                         }
373                         break;
374
375                 case RC_UIFILE:
376                         if (lexrc.next()) {
377                                 ui_file = os::internal_path(lexrc.getString());
378                         }
379                         break;
380
381                 case RC_AUTORESET_OPTIONS:
382                         if (lexrc.next()) {
383                                 auto_reset_options = lexrc.getBool();
384                         }
385                         break;
386
387                 case RC_DISPLAY_GRAPHICS:
388                         if (lexrc.next()) {
389                                 display_graphics = graphics::displayTranslator().find(lexrc.getString());
390                         }
391                         break;
392
393                 case RC_TEX_EXPECTS_WINDOWS_PATHS:
394                         if (lexrc.next()) {
395                                 windows_style_tex_paths = lexrc.getBool();
396                         }
397                         break;
398
399                 case RC_TEX_ALLOWS_SPACES:
400                         if (lexrc.next()) {
401                                 tex_allows_spaces = lexrc.getBool();
402                         }
403                         break;
404
405                 case RC_KBMAP:
406                         if (lexrc.next()) {
407                                 use_kbmap = lexrc.getBool();
408                         }
409                         break;
410
411                 case RC_KBMAP_PRIMARY:
412                         if (lexrc.next()) {
413                                 string const kmap(os::internal_path(lexrc.getString()));
414                                 if (kmap.empty()) {
415                                         // nothing
416                                 } else if (!libFileSearch("kbd", kmap,
417                                                           "kmap").empty()) {
418                                         primary_kbmap = kmap;
419                                 } else {
420                                         lexrc.printError("LyX: Keymap `$$Token' not found");
421                                 }
422                         }
423                         break;
424
425                 case RC_KBMAP_SECONDARY:
426                         if (lexrc.next()) {
427                                 string const kmap(os::internal_path(lexrc.getString()));
428                                 if (kmap.empty()) {
429                                         // nothing
430                                 } else if (!libFileSearch("kbd", kmap,
431                                                           "kmap").empty()) {
432                                         secondary_kbmap = kmap;
433                                 } else {
434                                         lexrc.printError("LyX: Keymap `$$Token' not found");
435                                 }
436                         }
437                         break;
438
439                 case RC_FONT_ENCODING:
440                         if (lexrc.next()) {
441                                 fontenc = lexrc.getString();
442                         }
443                         break;
444
445                 case RC_PRINTER:
446                         if (lexrc.next()) {
447                                 printer = lexrc.getString();
448                         }
449                         break;
450
451                 case RC_PRINT_COMMAND:
452                         if (lexrc.next()) {
453                                 print_command = lexrc.getString();
454                         }
455                         break;
456
457                 case RC_PRINTEVENPAGEFLAG:
458                         if (lexrc.next()) {
459                                 print_evenpage_flag = lexrc.getString();
460                         }
461                         break;
462
463                 case RC_PRINTODDPAGEFLAG:
464                         if (lexrc.next()) {
465                                 print_oddpage_flag = lexrc.getString();
466                         }
467                         break;
468
469                 case RC_PRINTPAGERANGEFLAG:
470                         if (lexrc.next()) {
471                                 print_pagerange_flag = lexrc.getString();
472                         }
473                         break;
474
475                 case RC_PRINTCOPIESFLAG:
476                         if (lexrc.next()) {
477                                 print_copies_flag = lexrc.getString();
478                         }
479                         break;
480
481                 case RC_PRINTCOLLCOPIESFLAG:
482                         if (lexrc.next()) {
483                                 print_collcopies_flag = lexrc.getString();
484                         }
485                         break;
486
487                 case RC_PRINTREVERSEFLAG:
488                         if (lexrc.next()) {
489                                 print_reverse_flag = lexrc.getString();
490                         }
491                         break;
492
493                 case RC_PRINTLANDSCAPEFLAG:
494                         if (lexrc.next()) {
495                                 print_landscape_flag = lexrc.getString();
496                         }
497                         break;
498
499                 case RC_PRINTTOPRINTER:
500                         if (lexrc.next()) {
501                                 print_to_printer = lexrc.getString();
502                         }
503                         break;
504
505                 case RC_PRINT_ADAPTOUTPUT:
506                         if (lexrc.next()) {
507                                 print_adapt_output = lexrc.getBool();
508                         }
509                         break;
510
511                 case RC_PRINTTOFILE:
512                         if (lexrc.next()) {
513                                 print_to_file = os::internal_path(lexrc.getString());
514                         }
515                         break;
516
517                 case RC_PRINTFILEEXTENSION:
518                         if (lexrc.next()) {
519                                 print_file_extension = lexrc.getString();
520                         }
521                         break;
522
523                 case RC_PRINTEXSTRAOPTIONS:
524                         if (lexrc.next()) {
525                                 print_extra_options = lexrc.getString();
526                         }
527                         break;
528
529                 case RC_PRINTSPOOL_COMMAND:
530                         if (lexrc.next()) {
531                                 print_spool_command = lexrc.getString();
532                         }
533                         break;
534
535                 case RC_PRINTSPOOL_PRINTERPREFIX:
536                         if (lexrc.next()) {
537                                 print_spool_printerprefix = lexrc.getString();
538                         }
539                         break;
540
541                 case RC_PRINTPAPERDIMENSIONFLAG:
542                         if (lexrc.next()) {
543                                 print_paper_dimension_flag = lexrc.getString();
544                         }
545                         break;
546
547                 case RC_PRINTPAPERFLAG:
548                         if (lexrc.next()) {
549                                 print_paper_flag = lexrc.getString();
550                         }
551                         break;
552
553                 case RC_CUSTOM_EXPORT_COMMAND:
554                         if (lexrc.next()) {
555                                 custom_export_command = lexrc.getString();
556                         }
557                         break;
558
559                 case RC_CUSTOM_EXPORT_FORMAT:
560                         if (lexrc.next()) {
561                                 custom_export_format = lexrc.getString();
562                         }
563                         break;
564
565                 case RC_DEFAULT_PAPERSIZE:
566                         if (lexrc.next()) {
567                                 string const size =
568                                         ascii_lowercase(lexrc.getString());
569                                 if (size == "usletter")
570                                         default_papersize =
571                                                 PAPER_USLETTER;
572                                 else if (size == "legal")
573                                         default_papersize =
574                                                 PAPER_USLEGAL;
575                                 else if (size == "executive")
576                                         default_papersize =
577                                                 PAPER_USEXECUTIVE;
578                                 else if (size == "a3")
579                                         default_papersize =
580                                                 PAPER_A3;
581                                 else if (size == "a4")
582                                         default_papersize =
583                                                 PAPER_A4;
584                                 else if (size == "a5")
585                                         default_papersize =
586                                                 PAPER_A5;
587                                 else if (size == "b5")
588                                         default_papersize =
589                                                 PAPER_B5;
590                                 else if (size == "default")
591                                         default_papersize =
592                                                 PAPER_DEFAULT;
593                         }
594                         break;
595
596                 case RC_VIEWDVI_PAPEROPTION:
597                         if (lexrc.next()) {
598                                 view_dvi_paper_option = lexrc.getString();
599                         } else {
600                                 view_dvi_paper_option.erase();
601                         }
602                         break;
603
604                 case RC_CHKTEX_COMMAND:
605                         if (lexrc.next()) {
606                                 chktex_command = lexrc.getString();
607                         }
608                         break;
609
610                 case RC_BIBTEX_COMMAND:
611                         if (lexrc.next()) {
612                                 bibtex_command = lexrc.getString();
613                         }
614                         break;
615
616                 case RC_INDEX_COMMAND:
617                         if (lexrc.next()) {
618                                 index_command = lexrc.getString();
619                         }
620                         break;
621
622                 case RC_SCREEN_DPI:
623                         if (lexrc.next()) {
624                                 dpi = lexrc.getInteger();
625                         }
626                         break;
627
628                 case RC_SCREEN_ZOOM:
629                         if (lexrc.next()) {
630                                 zoom = lexrc.getInteger();
631                         }
632                         break;
633
634                 case RC_SCREEN_GEOMETRY_HEIGHT:
635                         if (lexrc.next()) {
636                                 geometry_height = lexrc.getInteger();
637                         }
638                         break;
639
640                 case RC_SCREEN_GEOMETRY_WIDTH:
641                         if (lexrc.next()) {
642                                 geometry_width = lexrc.getInteger();
643                         }
644                         break;
645
646                 case RC_SCREEN_GEOMETRY_XYSAVED:
647                         if (lexrc.next()) {
648                                 geometry_xysaved = lexrc.getBool();
649                         }
650                         break;
651
652                 case RC_SCREEN_FONT_SIZES:
653                         if (lexrc.next()) {
654                                 font_sizes[LyXFont::SIZE_TINY] =
655                                         lexrc.getString();
656                         }
657                         if (lexrc.next()) {
658                                 font_sizes[LyXFont::SIZE_SCRIPT] =
659                                         lexrc.getString();
660                         }
661                         if (lexrc.next()) {
662                                 font_sizes[LyXFont::SIZE_FOOTNOTE] =
663                                         lexrc.getString();
664                         }
665                         if (lexrc.next()) {
666                                 font_sizes[LyXFont::SIZE_SMALL] =
667                                         lexrc.getString();
668                         }
669                         if (lexrc.next()) {
670                                 font_sizes[LyXFont::SIZE_NORMAL] =
671                                         lexrc.getString();
672                         }
673                         if (lexrc.next()) {
674                                 font_sizes[LyXFont::SIZE_LARGE] =
675                                         lexrc.getString();
676                         }
677                         if (lexrc.next()) {
678                                 font_sizes[LyXFont::SIZE_LARGER] =
679                                         lexrc.getString();
680                         }
681                         if (lexrc.next()) {
682                                 font_sizes[LyXFont::SIZE_LARGEST] =
683                                         lexrc.getString();
684                         }
685                         if (lexrc.next()) {
686                                 font_sizes[LyXFont::SIZE_HUGE] =
687                                         lexrc.getString();
688                         }
689                         if (lexrc.next()) {
690                                 font_sizes[LyXFont::SIZE_HUGER] =
691                                         lexrc.getString();
692                         }
693                         break;
694
695                 case RC_SCREEN_FONT_SCALABLE:
696                         if (lexrc.next()) {
697                                 use_scalable_fonts = lexrc.getBool();
698                         }
699                         break;
700
701                 case RC_AUTOSAVE:
702                         if (lexrc.next()) {
703                                 autosave = lexrc.getInteger();
704                         }
705                         break;
706
707                 case RC_DOCUMENTPATH:
708                         if (lexrc.next()) {
709                                 document_path = os::internal_path(lexrc.getString());
710                                 document_path = expandPath(document_path);
711                         }
712                         break;
713
714                 case RC_TEMPLATEPATH:
715                         if (lexrc.next()) {
716                                 template_path = os::internal_path(lexrc.getString());
717                                 template_path = expandPath(template_path);
718                         }
719                         break;
720
721                 case RC_TEMPDIRPATH:
722                         if (lexrc.next()) {
723                                 tempdir_path = os::internal_path(lexrc.getString());
724                                 tempdir_path = expandPath(tempdir_path);
725                         }
726                         break;
727
728                 case RC_USETEMPDIR:
729                         if (lexrc.next()) {
730                                 lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
731                         }
732                         break;
733
734                 case RC_USELASTFILEPOS:
735                         if (lexrc.next()) {
736                                 use_lastfilepos = lexrc.getBool();
737                         }
738                         break;
739
740                 case RC_LOADSESSION:
741                         if (lexrc.next()) {
742                                 load_session = lexrc.getBool();
743                         }
744                         break;
745
746                 case RC_NUMLASTFILES:
747                         if (lexrc.next()) {
748                                 num_lastfiles = lexrc.getInteger();
749                         }
750                         break;
751
752                 case RC_CHECKLASTFILES:
753                         if (lexrc.next()) {
754                                 check_lastfiles = lexrc.getBool();
755                         }
756                         break;
757
758                 case RC_SCREEN_FONT_ROMAN:
759                         if (lexrc.next()) {
760                                 roman_font_name = lexrc.getString();
761                                 oldFontFormat(roman_font_name,
762                                               roman_font_foundry);
763                         }
764                         break;
765
766                 case RC_SCREEN_FONT_SANS:
767                         if (lexrc.next()) {
768                                 sans_font_name = lexrc.getString();
769                                 oldFontFormat(sans_font_name, sans_font_foundry);
770                         }
771                         break;
772
773                 case RC_SCREEN_FONT_TYPEWRITER:
774                         if (lexrc.next()) {
775                                 typewriter_font_name = lexrc.getString();
776                                 oldFontFormat(typewriter_font_name,
777                                               typewriter_font_foundry);
778                         }
779                         break;
780
781                 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
782                         if (lexrc.next()) {
783                                 roman_font_foundry = lexrc.getString();
784                         }
785                         break;
786
787                 case RC_SCREEN_FONT_SANS_FOUNDRY:
788                         if (lexrc.next()) {
789                                 sans_font_foundry = lexrc.getString();
790                         }
791                         break;
792
793                 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
794                         if (lexrc.next()) {
795                                 typewriter_font_foundry = lexrc.getString();
796                         }
797                         break;
798
799                 case RC_SCREEN_FONT_ENCODING:
800                         if (lexrc.next()) {
801                                 font_norm = lexrc.getString();
802                         }
803                         break;
804
805                 case RC_SET_COLOR:
806                 {
807                         string lyx_name, x11_name;
808
809                         if (lexrc.next()) {
810                                 lyx_name = lexrc.getString();
811                         } else {
812                                 lexrc.printError("Missing color tag.");
813                                 break;
814                         }
815
816                         if (lexrc.next()) {
817                                 x11_name = lexrc.getString();
818                         } else {
819                                 lexrc.printError("Missing color name for color: `$$Token'");
820                                 break;
821                         }
822
823                         LColor::color const col =
824                                 lcolor.getFromLyXName(lyx_name);
825                         if (col == LColor::none ||
826                             col == LColor::inherit ||
827                             col == LColor::ignore)
828                                 break;
829
830                         if (!lcolor.setColor(col, x11_name)) {
831                                 lyxerr << "Bad lyxrc set_color for "
832                                         << lyx_name << endl;
833
834                         }
835                         break;
836                 }
837                 case RC_AUTOREGIONDELETE:
838                         // Auto region delete defaults to true
839                         if (lexrc.next()) {
840                                 auto_region_delete = lexrc.getBool();
841                         }
842                         break;
843
844                 case RC_SERVERPIPE:
845                         if (lexrc.next()) {
846                                 lyxpipes = os::internal_path(lexrc.getString());
847                                 lyxpipes = expandPath(lyxpipes);
848                         }
849                         break;
850
851                 case RC_CURSOR_FOLLOWS_SCROLLBAR:
852                         if (lexrc.next()) {
853                                 cursor_follows_scrollbar = lexrc.getBool();
854                         }
855                         break;
856
857                 case RC_DIALOGS_ICONIFY_WITH_MAIN:
858                         if (lexrc.next()) {
859                                 dialogs_iconify_with_main = lexrc.getBool();
860                         }
861                         break;
862
863                 case RC_PLAINTEXT_ROFF_COMMAND:
864                         if (lexrc.next()) {
865                                 plaintext_roff_command = lexrc.getString();
866                         }
867                         break;
868                 case RC_PLAINTEXT_LINELEN:
869                         if (lexrc.next()) {
870                                 plaintext_linelen = lexrc.getInteger();
871                         }
872                         break;
873                         // Spellchecker settings:
874                 case RC_USE_SPELL_LIB:
875                         if (lexrc.next()) {
876                                 use_spell_lib = lexrc.getBool();
877                         }
878                         break;
879                 case RC_SPELL_COMMAND:
880                         if (lexrc.next()) {
881                                 isp_command = lexrc.getString();
882                         }
883                         break;
884                 case RC_ACCEPT_COMPOUND:
885                         if (lexrc.next()) {
886                                 isp_accept_compound = lexrc.getBool();
887                         }
888                         break;
889                 case RC_USE_INP_ENC:
890                         if (lexrc.next()) {
891                                 isp_use_input_encoding = lexrc.getBool();
892                         }
893                         break;
894                 case RC_USE_ALT_LANG:
895                         if (lexrc.next()) {
896                                 isp_use_alt_lang = lexrc.getBool();
897                         }
898                         break;
899                 case RC_USE_PERS_DICT:
900                         if (lexrc.next()) {
901                                 isp_use_pers_dict = lexrc.getBool();
902                         }
903                         break;
904                 case RC_USE_ESC_CHARS:
905                         if (lexrc.next()) {
906                                 isp_use_esc_chars = lexrc.getBool();
907                         }
908                         break;
909                 case RC_ALT_LANG:
910                         if (lexrc.next()) {
911                                 isp_alt_lang = lexrc.getString();
912                         }
913                         break;
914                 case RC_PERS_DICT:
915                         if (lexrc.next()) {
916                                 isp_pers_dict = os::internal_path(lexrc.getString());
917                         }
918                         break;
919                 case RC_ESC_CHARS:
920                         if (lexrc.next()) {
921                                 isp_esc_chars = lexrc.getString();
922                         }
923                         break;
924                 case RC_MAKE_BACKUP:
925                         if (lexrc.next()) {
926                                 make_backup = lexrc.getBool();
927                         }
928                         break;
929                 case RC_BACKUPDIR_PATH:
930                         if (lexrc.next()) {
931                                 backupdir_path = os::internal_path(lexrc.getString());
932                                 backupdir_path = expandPath(backupdir_path);
933                         }
934                         break;
935                 case RC_DATE_INSERT_FORMAT:
936                         if (lexrc.next()) {
937                                 date_insert_format = lexrc.getString();
938                         }
939                         break;
940                 case RC_LANGUAGE_PACKAGE:
941                         if (lexrc.next()) {
942                                 language_package = lexrc.getString();
943                         }
944                         break;
945                 case RC_LANGUAGE_AUTO_BEGIN:
946                         if (lexrc.next()) {
947                                 language_auto_begin = lexrc.getBool();
948                         }
949                         break;
950                 case RC_LANGUAGE_AUTO_END:
951                         if (lexrc.next()) {
952                                 language_auto_end = lexrc.getBool();
953                         }
954                         break;
955                 case RC_LANGUAGE_GLOBAL_OPTIONS:
956                         if (lexrc.next()) {
957                                 language_global_options = lexrc.getBool();
958                         }
959                         break;
960                 case RC_LANGUAGE_USE_BABEL:
961                         if (lexrc.next()) {
962                                 language_use_babel = lexrc.getBool();
963                         }
964                         break;
965                 case RC_LANGUAGE_COMMAND_BEGIN:
966                         if (lexrc.next()) {
967                                 language_command_begin = lexrc.getString();
968                         }
969                         break;
970                 case RC_LANGUAGE_COMMAND_END:
971                         if (lexrc.next()) {
972                                 language_command_end = lexrc.getString();
973                         }
974                         break;
975                 case RC_LANGUAGE_COMMAND_LOCAL:
976                         if (lexrc.next()) {
977                                 language_command_local = lexrc.getString();
978                         }
979                         break;
980                 case RC_RTL_SUPPORT:
981                         if (lexrc.next()) {
982                                 rtl_support = lexrc.getBool();
983                         }
984                         break;
985                 case RC_AUTO_NUMBER:
986                         if (lexrc.next()) {
987                                 auto_number = lexrc.getBool();
988                         }
989                         break;
990                 case RC_MARK_FOREIGN_LANGUAGE:
991                         if (lexrc.next()) {
992                                 mark_foreign_language = lexrc.getBool();
993                         }
994                         break;
995
996                 case RC_COPIER: {
997                         string fmt, command;
998                         if (lexrc.next()) {
999                                 fmt = lexrc.getString();
1000                         }
1001                         if (lexrc.next()) {
1002                                 command = lexrc.getString();
1003                         }
1004                         setMover(fmt, command);
1005                         break;
1006                 }
1007
1008                 case RC_CONVERTER: {
1009                         string from, to, command, flags;
1010                         if (lexrc.next()) {
1011                                 from = lexrc.getString();
1012                         }
1013                         if (lexrc.next()) {
1014                                 to = lexrc.getString();
1015                         }
1016                         if (lexrc.next()) {
1017                                 command = lexrc.getString();
1018                         }
1019                         if (lexrc.next()) {
1020                                 flags = lexrc.getString();
1021                         }
1022                         if (command.empty()) {
1023                                 theConverters().erase(from, to);
1024                         } else {
1025                                 theConverters().add(from, to, command, flags);
1026                         }
1027                         break;
1028                 }
1029                 // compatibility with versions older than 1.4.0 only
1030                 case RC_VIEWER: {
1031                         string format, command;
1032                         if (lexrc.next()) {
1033                                 format = lexrc.getString();
1034                         }
1035                         if (lexrc.next()) {
1036                                 command = lexrc.getString();
1037                         }
1038                         formats.setViewer(format, command);
1039                         break;
1040                 }
1041                 case RC_FORMAT: {
1042                         string format, extension, prettyname, shortcut;
1043                         if (lexrc.next()) {
1044                                 format = lexrc.getString();
1045                         }
1046                         if (lexrc.next()) {
1047                                 extension = lexrc.getString();
1048                         }
1049                         if (lexrc.next()) {
1050                                 prettyname = lexrc.getString();
1051                         }
1052                         if (lexrc.next()) {
1053                                 shortcut = lexrc.getString();
1054                         }
1055                         string viewer, editor;
1056                         if (lexrc.next())
1057                                 viewer = lexrc.getString();
1058                         if (lexrc.next())
1059                                 editor = lexrc.getString();
1060                         string flags;
1061                         // Hack to ensure compatibility with versions older
1062                         // than 1.5.0
1063                         int le = lexrc.lex();
1064                         if (le != LyXLex::LEX_FEOF && le != LyXLex::LEX_UNDEF) {
1065                                 flags = lexrc.getString();
1066                                 if (le != LyXLex::LEX_DATA) {
1067                                         // We have got a known token.
1068                                         // Therefore this is an old style
1069                                         // format definition without
1070                                         // flags.
1071                                         lexrc.pushToken(flags);
1072                                         flags.erase();
1073                                 }
1074                         }
1075                         int flgs = Format::none;
1076                         while (!flags.empty()) {
1077                                 string flag;
1078                                 flags = support::split(flags, flag, ',');
1079                                 if (flag == "document")
1080                                         flgs |= Format::document;
1081                                 else if (flag == "vector")
1082                                         flgs |= Format::vector;
1083                                 else
1084                                         lyxerr << "Ignoring unknown flag `"
1085                                                << flag << "' for format `"
1086                                                << format << "'." << endl;
1087                         }
1088                         if (prettyname.empty()) {
1089                                 if (theConverters().formatIsUsed(format)) {
1090                                         lyxerr << "Can't delete format "
1091                                                << format << endl;
1092                                 } else {
1093                                         formats.erase(format);
1094                                 }
1095                         } else {
1096                                 formats.add(format, extension, prettyname,
1097                                             shortcut, viewer, editor, flgs);
1098                         }
1099                         break;
1100                 }
1101                 case RC_DEFAULT_LANGUAGE:
1102                         if (lexrc.next()) {
1103                                 default_language = lexrc.getString();
1104                         }
1105                         break;
1106
1107                 case RC_LABEL_INIT_LENGTH:
1108                         if (lexrc.next()) {
1109                                 label_init_length = lexrc.getInteger();
1110                         }
1111                         break;
1112
1113                 case RC_SHOW_BANNER:
1114                         if (lexrc.next()) {
1115                                 show_banner = lexrc.getBool();
1116                         }
1117                         break;
1118
1119                 case RC_PREVIEW:
1120                         if (lexrc.next()) {
1121                                 string const tmp = lexrc.getString();
1122                                 if (tmp == "true" || tmp == "on")
1123                                         preview = PREVIEW_ON;
1124                                 else if (tmp == "no_math")
1125                                         preview = PREVIEW_NO_MATH;
1126                                 else {
1127                                         preview = PREVIEW_OFF;
1128                                         if (tmp != "false" && tmp != "off")
1129                                                 lyxerr << "Unrecognized "
1130                                                         "preview status \""
1131                                                        << tmp << '\n' << endl;
1132                                 }
1133                         }
1134                         break;
1135
1136                 case RC_PREVIEW_HASHED_LABELS:
1137                         if (lexrc.next()) {
1138                                 preview_hashed_labels = lexrc.getBool();
1139                         }
1140                         break;
1141
1142                 case RC_PREVIEW_SCALE_FACTOR:
1143                         if (lexrc.next()) {
1144                                 preview_scale_factor = lexrc.getString();
1145                         }
1146                         break;
1147
1148                 case RC_USER_NAME:
1149                         if (lexrc.next())
1150                                 user_name = lexrc.getString();
1151                         break;
1152
1153                 case RC_USER_EMAIL:
1154                         if (lexrc.next())
1155                                 user_email = lexrc.getString();
1156                         break;
1157
1158                 case RC_PATH_PREFIX:
1159                         if (lexrc.next())
1160                                 path_prefix = lexrc.getString();
1161                         break;
1162
1163                 case RC_USE_CONVERTER_CACHE:
1164                         if (lexrc.next())
1165                                 use_converter_cache = lexrc.getBool();
1166                         break;
1167
1168                 case RC_CONVERTER_CACHE_MAXAGE:
1169                         if (lexrc.next())
1170                                 converter_cache_maxage =
1171                                         convert<unsigned int>(lexrc.getString());
1172                         break;
1173
1174                 case RC_LAST: break; // this is just a dummy
1175                 }
1176         }
1177
1178         /// Update converters data-structures
1179         theConverters().update(formats);
1180         theConverters().buildGraph();
1181
1182         return 0;
1183 }
1184
1185
1186 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1187 {
1188         ofstream ofs(filename.toFilesystemEncoding().c_str());
1189         if (ofs)
1190                 write(ofs, ignore_system_lyxrc);
1191 }
1192
1193
1194 void LyXRC::print() const
1195 {
1196         if (lyxerr.debugging())
1197                 write(lyxerr, false);
1198         else
1199                 write(cout, false);
1200 }
1201
1202
1203 class SameMover {
1204 public:
1205         typedef std::pair<std::string, SpecialisedMover> Data;
1206
1207         SameMover(Data const & comparison)
1208                 : comparison_(comparison) {}
1209
1210         bool operator()(Data const & data) const
1211         {
1212                 return data.first == comparison_.first &&
1213                         data.second.command() == comparison_.second.command();
1214         }
1215
1216 private:
1217         Data comparison_;
1218 };
1219
1220
1221 void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
1222 {
1223         os << "### This file is part of\n"
1224            << "### ========================================================\n"
1225            << "###          LyX, The Document Processor\n"
1226            << "###\n"
1227            << "###          Copyright 1995 Matthias Ettrich\n"
1228            << "###          Copyright 1995-2001 The LyX Team.\n"
1229            << "###\n"
1230            << "### ========================================================\n"
1231            << "\n"
1232            << "# This file is written by LyX, if you want to make your own\n"
1233            << "# modifications you should do them from inside LyX and save\n"
1234            << "\n";
1235
1236         // Why the switch you might ask. It is a trick to ensure that all
1237         // the elements in the LyXRCTags enum is handled. As you can see
1238         // there are no breaks at all. So it is just a huge fall-through.
1239         // The nice thing is that we will get a warning from the compiler
1240         // if we forget an element.
1241         LyXRCTags tag = RC_LAST;
1242         switch (tag) {
1243         case RC_LAST:
1244         case RC_INPUT:
1245                 // input/include files are not done here
1246         case RC_BINDFILE:
1247                 if (ignore_system_lyxrc ||
1248                     bind_file != system_lyxrc.bind_file) {
1249                         string const path = os::external_path(bind_file);
1250                         os << "\\bind_file \"" << path << "\"\n";
1251                 }
1252                 //
1253                 // Misc Section
1254                 //
1255                 os << "\n#\n"
1256                    << "# MISC SECTION ######################################\n"
1257                    << "#\n\n";
1258
1259                 // bind files are not done here.
1260
1261         case RC_PATH_PREFIX:
1262                 if (ignore_system_lyxrc ||
1263                     path_prefix != system_lyxrc.path_prefix) {
1264                         os << "\\path_prefix \"" << path_prefix << "\"\n";
1265                 }
1266
1267         case RC_UIFILE:
1268                 if (ignore_system_lyxrc ||
1269                     ui_file != system_lyxrc.ui_file) {
1270                         string const path = os::external_path(ui_file);
1271                         os << "\\ui_file \"" << path << "\"\n";
1272                 }
1273         case RC_AUTOREGIONDELETE:
1274                 if (ignore_system_lyxrc ||
1275                     auto_region_delete != system_lyxrc.auto_region_delete) {
1276                         os << "# Set to false to inhibit automatic replacement of\n"
1277                            << "# the current selection.\n"
1278                            << "\\auto_region_delete " << convert<string>(auto_region_delete)
1279                            << '\n';
1280                 }
1281         case RC_AUTORESET_OPTIONS:
1282                 if (ignore_system_lyxrc ||
1283                     auto_reset_options != system_lyxrc.auto_reset_options) {
1284                         os << "# Set to false to inhibit automatic reset of\n"
1285                            << "# the class options to defaults on class change.\n"
1286                            << "\\auto_reset_options "
1287                            << convert<string>(auto_reset_options)
1288                            << '\n';
1289                 }
1290         case RC_AUTOSAVE:
1291                 if (ignore_system_lyxrc ||
1292                     autosave != system_lyxrc.autosave) {
1293                         os << "# The time interval between auto-saves in seconds.\n"
1294                            << "\\autosave " << autosave << '\n';
1295                 }
1296         case RC_DISPLAY_GRAPHICS:
1297                 if (ignore_system_lyxrc ||
1298                     display_graphics != system_lyxrc.display_graphics) {
1299                         os << "# Display graphics within LyX\n"
1300                            << "# monochrome|grayscale|color|none\n"
1301                            << "\\display_graphics "
1302                            << graphics::displayTranslator().find(display_graphics)
1303                            << '\n';
1304                 }
1305
1306         case RC_VIEWDVI_PAPEROPTION:
1307                 if (ignore_system_lyxrc ||
1308                     view_dvi_paper_option
1309                     != system_lyxrc.view_dvi_paper_option) {
1310                         os << "# Options used to specify paper size to the\n"
1311                            << "# view_dvi_command (e.g. -paper)\n"
1312                            << "\\view_dvi_paper_option \""
1313                            << view_dvi_paper_option << "\"\n";
1314                 }
1315         case RC_DEFAULT_PAPERSIZE:
1316                 if (ignore_system_lyxrc ||
1317                     default_papersize != system_lyxrc.default_papersize) {
1318                         os << "# The default papersize to use.\n"
1319                            << "\\default_papersize \"";
1320                         switch (default_papersize) {
1321                         case PAPER_DEFAULT:
1322                                 os << "default"; break;
1323                         case PAPER_USLETTER:
1324                                 os << "usletter"; break;
1325                         case PAPER_USLEGAL:
1326                                 os << "legal"; break;
1327                         case PAPER_USEXECUTIVE:
1328                                 os << "executive"; break;
1329                         case PAPER_A3:
1330                                 os << "a3"; break;
1331                         case PAPER_A4:
1332                                 os << "a4"; break;
1333                         case PAPER_A5:
1334                                 os << "a5"; break;
1335                         case PAPER_B5:
1336                                 os << "b5"; break;
1337                         case PAPER_CUSTOM:
1338                         case PAPER_B3:
1339                         case PAPER_B4: break;
1340                         }
1341                         os << "\"\n";
1342                 }
1343         case RC_CHKTEX_COMMAND:
1344                 if (ignore_system_lyxrc ||
1345                     chktex_command != system_lyxrc.chktex_command) {
1346                         os << "\\chktex_command \"" << chktex_command << "\"\n";
1347                 }
1348         case RC_BIBTEX_COMMAND:
1349                 if (ignore_system_lyxrc ||
1350                     bibtex_command != system_lyxrc.bibtex_command) {
1351                         os << "\\bibtex_command \"" << bibtex_command << "\"\n";
1352                 }
1353         case RC_INDEX_COMMAND:
1354                 if (ignore_system_lyxrc ||
1355                     index_command != system_lyxrc.index_command) {
1356                         os << "\\index_command \"" << index_command << "\"\n";
1357                 }
1358         case RC_TEX_EXPECTS_WINDOWS_PATHS:
1359                 if (ignore_system_lyxrc ||
1360                     windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
1361                         os << "\\tex_expects_windows_paths "
1362                            << convert<string>(windows_style_tex_paths) << '\n';
1363                 }
1364         case RC_TEX_ALLOWS_SPACES:
1365                 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1366                         os << "\\tex_allows_spaces "
1367                            << convert<string>(tex_allows_spaces) << '\n';
1368                 }
1369         case RC_KBMAP:
1370                 if (ignore_system_lyxrc ||
1371                     use_kbmap != system_lyxrc.use_kbmap) {
1372                         os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1373                 }
1374         case RC_KBMAP_PRIMARY:
1375                 if (ignore_system_lyxrc ||
1376                     primary_kbmap != system_lyxrc.primary_kbmap) {
1377                         string const path = os::external_path(primary_kbmap);
1378                         os << "\\kbmap_primary \"" << path << "\"\n";
1379                 }
1380         case RC_KBMAP_SECONDARY:
1381                 if (ignore_system_lyxrc ||
1382                     secondary_kbmap != system_lyxrc.secondary_kbmap) {
1383                         string const path = os::external_path(secondary_kbmap);
1384                         os << "\\kbmap_secondary \"" << path << "\"\n";
1385                 }
1386         case RC_SERVERPIPE:
1387                 if (ignore_system_lyxrc ||
1388                     lyxpipes != system_lyxrc.lyxpipes) {
1389                         string const path = os::external_path(lyxpipes);
1390                         os << "\\serverpipe \"" << path << "\"\n";
1391                 }
1392         case RC_DATE_INSERT_FORMAT:
1393                 if (ignore_system_lyxrc ||
1394                     date_insert_format != system_lyxrc.date_insert_format) {
1395                         os << "\\date_insert_format \"" << date_insert_format
1396                            << "\"\n";
1397                 }
1398         case RC_LABEL_INIT_LENGTH:
1399                 if (ignore_system_lyxrc ||
1400                     label_init_length != system_lyxrc.label_init_length) {
1401                         os << "\\label_init_length " << label_init_length
1402                            << '\n';
1403                 }
1404
1405         case RC_USER_NAME:
1406                 os << "\\user_name \"" << user_name << "\"\n";
1407
1408         case RC_USER_EMAIL:
1409                 os << "\\user_email \"" << user_email << "\"\n";
1410
1411         case RC_SHOW_BANNER:
1412                 if (ignore_system_lyxrc ||
1413                     show_banner != system_lyxrc.show_banner) {
1414                         os << "\\show_banner " << convert<string>(show_banner) << '\n';
1415                 }
1416
1417         case RC_PREVIEW:
1418                 if (ignore_system_lyxrc ||
1419                     preview != system_lyxrc.preview) {
1420                         string status;
1421                         switch (preview) {
1422                         case PREVIEW_ON:
1423                                 status = "on";
1424                                 break;
1425                         case PREVIEW_NO_MATH:
1426                                 status = "no_math";
1427                                 break;
1428                         case PREVIEW_OFF:
1429                                 status = "off";
1430                                 break;
1431                         }
1432                         os << "\\preview " << status << '\n';
1433                 }
1434
1435         case RC_PREVIEW_HASHED_LABELS:
1436                 if (ignore_system_lyxrc ||
1437                     preview_hashed_labels !=
1438                     system_lyxrc.preview_hashed_labels) {
1439                         os << "\\preview_hashed_labels "
1440                            << convert<string>(preview_hashed_labels) << '\n';
1441                 }
1442
1443         case RC_PREVIEW_SCALE_FACTOR:
1444                 if (ignore_system_lyxrc ||
1445                     preview_scale_factor != system_lyxrc.preview_scale_factor) {
1446                         os << "\\preview_scale_factor "
1447                            << preview_scale_factor << '\n';
1448                 }
1449
1450         case RC_USE_CONVERTER_CACHE:
1451                 if (ignore_system_lyxrc ||
1452                     use_converter_cache != system_lyxrc.use_converter_cache) {
1453                         os << "\\use_converter_cache "
1454                            << convert<string>(use_converter_cache) << '\n';
1455                 }
1456
1457         case RC_CONVERTER_CACHE_MAXAGE:
1458                 if (ignore_system_lyxrc ||
1459                     converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1460                         os << "\\converter_cache_maxage "
1461                            << converter_cache_maxage << '\n';
1462                 }
1463
1464                 os << "\n#\n"
1465                    << "# SCREEN & FONTS SECTION ############################\n"
1466                    << "#\n\n";
1467
1468         case RC_SCREEN_DPI:
1469                 if (ignore_system_lyxrc ||
1470                     dpi != system_lyxrc.dpi) {
1471                         os << "\\screen_dpi " << dpi << '\n';
1472                 }
1473         case RC_SCREEN_ZOOM:
1474                 if (ignore_system_lyxrc ||
1475                     zoom != system_lyxrc.zoom) {
1476                         os << "\\screen_zoom " << zoom << '\n';
1477                 }
1478         case RC_SCREEN_GEOMETRY_HEIGHT:
1479                 if (ignore_system_lyxrc ||
1480                     geometry_height != system_lyxrc.geometry_height) {
1481                         os << "\\screen_geometry_height " << geometry_height
1482                            << '\n';
1483                 }
1484         case RC_SCREEN_GEOMETRY_WIDTH:
1485                 if (ignore_system_lyxrc ||
1486                     geometry_width != system_lyxrc.geometry_width) {
1487                         os << "\\screen_geometry_width " << geometry_width
1488                            << '\n';
1489                 }
1490         case RC_SCREEN_GEOMETRY_XYSAVED:
1491                 if (ignore_system_lyxrc ||
1492                     geometry_xysaved != system_lyxrc.geometry_xysaved) {
1493                         os << "\\screen_geometry_xysaved " << convert<string>(geometry_xysaved)
1494                            << '\n';
1495                 }
1496         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1497                 if (ignore_system_lyxrc ||
1498                     cursor_follows_scrollbar
1499                     != system_lyxrc.cursor_follows_scrollbar) {
1500                         os << "\\cursor_follows_scrollbar "
1501                            << convert<string>(cursor_follows_scrollbar) << '\n';
1502                 }
1503         case RC_DIALOGS_ICONIFY_WITH_MAIN:
1504                 if (ignore_system_lyxrc ||
1505                     dialogs_iconify_with_main
1506                    != system_lyxrc.dialogs_iconify_with_main) {
1507                         os << "\\dialogs_iconify_with_main "
1508                           <<  convert<string>(dialogs_iconify_with_main) << '\n';
1509                 }
1510         case RC_SCREEN_FONT_ROMAN:
1511                 if (ignore_system_lyxrc ||
1512                     roman_font_name != system_lyxrc.roman_font_name) {
1513                         os << "\\screen_font_roman \"" << roman_font_name
1514                            << "\"\n";
1515                 }
1516         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1517                 if (ignore_system_lyxrc ||
1518                     roman_font_foundry != system_lyxrc.roman_font_foundry) {
1519                         os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1520                            << "\"\n";
1521                 }
1522         case RC_SCREEN_FONT_SANS:
1523                 if (ignore_system_lyxrc ||
1524                     sans_font_name != system_lyxrc.sans_font_name) {
1525                         os << "\\screen_font_sans \"" << sans_font_name
1526                            << "\"\n";
1527                 }
1528         case RC_SCREEN_FONT_SANS_FOUNDRY:
1529                 if (ignore_system_lyxrc ||
1530                     sans_font_foundry != system_lyxrc.sans_font_foundry) {
1531                         os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1532                            << "\"\n";
1533                 }
1534         case RC_SCREEN_FONT_TYPEWRITER:
1535                 if (ignore_system_lyxrc ||
1536                     typewriter_font_name != system_lyxrc.typewriter_font_name) {
1537                         os << "\\screen_font_typewriter \""
1538                            << typewriter_font_name << "\"\n";
1539                 }
1540         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1541                 if (ignore_system_lyxrc ||
1542                     typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1543                         os << "\\screen_font_typewriter_foundry \""
1544                            << typewriter_font_foundry << "\"\n";
1545                 }
1546
1547         case RC_SCREEN_FONT_SCALABLE:
1548                 if (ignore_system_lyxrc ||
1549                     use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1550                         os << "\\screen_font_scalable "
1551                            << convert<string>(use_scalable_fonts)
1552                            << '\n';
1553                 }
1554         case RC_SCREEN_FONT_ENCODING:
1555                 if (ignore_system_lyxrc ||
1556                     font_norm != system_lyxrc.font_norm) {
1557                         os << "\\screen_font_encoding \"" << font_norm
1558                            << "\"\n";
1559                 }
1560         case RC_SCREEN_FONT_SIZES:
1561                 if (ignore_system_lyxrc ||
1562                     font_sizes[LyXFont::SIZE_TINY]
1563                     != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1564                     font_sizes[LyXFont::SIZE_SCRIPT]
1565                     != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1566                     font_sizes[LyXFont::SIZE_FOOTNOTE]
1567                     != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1568                     font_sizes[LyXFont::SIZE_SMALL]
1569                     != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1570                     font_sizes[LyXFont::SIZE_NORMAL]
1571                     != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1572                     font_sizes[LyXFont::SIZE_LARGE]
1573                     != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1574                     font_sizes[LyXFont::SIZE_LARGER]
1575                     != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1576                     font_sizes[LyXFont::SIZE_LARGEST]
1577                     != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1578                     font_sizes[LyXFont::SIZE_HUGE]
1579                     != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1580                     font_sizes[LyXFont::SIZE_HUGER]
1581                     != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1582                         os.setf(ios::fixed);
1583                         os.precision(2);
1584                         os << "\\screen_font_sizes"
1585                            << ' ' << font_sizes[LyXFont::SIZE_TINY]
1586                            << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1587                            << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1588                            << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1589                            << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1590                            << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1591                            << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1592                            << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1593                            << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1594                            << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1595                            << '\n';
1596                 }
1597
1598                 os << "\n#\n"
1599                    << "# COLOR SECTION ###################################\n"
1600                    << "#\n\n";
1601
1602         case RC_SET_COLOR:
1603                 for (int i = 0; i < LColor::ignore; ++i) {
1604                         LColor::color lc = static_cast<LColor::color>(i);
1605
1606                         string const col(lcolor.getX11Name(lc));
1607                         if (ignore_system_lyxrc ||
1608                             col != system_lcolor.getX11Name(lc)) {
1609                                 os << "\\set_color \""
1610                                    << lcolor.getLyXName(lc) << "\" \""
1611                                    << col << "\"\n";
1612                         }
1613                 }
1614
1615                 os << "\n#\n"
1616                    << "# PRINTER SECTION ###################################\n"
1617                    << "#\n\n";
1618
1619         case RC_PRINTER:
1620                 if (ignore_system_lyxrc ||
1621                     printer != system_lyxrc.printer) {
1622                         os << "\\printer \"" << printer << "\"\n";
1623                 }
1624         case RC_PRINT_ADAPTOUTPUT:
1625                 if (ignore_system_lyxrc ||
1626                     print_adapt_output != system_lyxrc.print_adapt_output) {
1627                         os << "\\print_adapt_output "
1628                            << convert<string>(print_adapt_output)
1629                            << '\n';
1630                 }
1631         case RC_PRINT_COMMAND:
1632                 if (ignore_system_lyxrc ||
1633                     print_command != system_lyxrc.print_command) {
1634                         os << "\\print_command \"" << print_command << "\"\n";
1635                 }
1636         case RC_PRINTEXSTRAOPTIONS:
1637                 if (ignore_system_lyxrc ||
1638                     print_extra_options != system_lyxrc.print_extra_options) {
1639                         os << "\\print_extra_options \"" << print_extra_options
1640                            << "\"\n";
1641                 }
1642         case RC_PRINTSPOOL_COMMAND:
1643                 if (ignore_system_lyxrc ||
1644                     print_spool_command != system_lyxrc.print_spool_command) {
1645                         os << "\\print_spool_command \"" << print_spool_command
1646                            << "\"\n";
1647                 }
1648         case RC_PRINTSPOOL_PRINTERPREFIX:
1649                 if (ignore_system_lyxrc ||
1650                     print_spool_printerprefix
1651                     != system_lyxrc.print_spool_printerprefix) {
1652                         os << "\\print_spool_printerprefix \""
1653                            << print_spool_printerprefix << "\"\n";
1654                 }
1655         case RC_PRINTEVENPAGEFLAG:
1656                 if (ignore_system_lyxrc ||
1657                     print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1658                         os << "\\print_evenpage_flag \"" << print_evenpage_flag
1659                            << "\"\n";
1660                 }
1661         case RC_PRINTODDPAGEFLAG:
1662                 if (ignore_system_lyxrc ||
1663                     print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1664                         os << "\\print_oddpage_flag \"" << print_oddpage_flag
1665                            << "\"\n";
1666                 }
1667         case RC_PRINTREVERSEFLAG:
1668                 if (ignore_system_lyxrc ||
1669                     print_reverse_flag != system_lyxrc.print_reverse_flag) {
1670                         os << "\\print_reverse_flag \"" << print_reverse_flag
1671                            << "\"\n";
1672                 }
1673         case RC_PRINTLANDSCAPEFLAG:
1674                 if (ignore_system_lyxrc ||
1675                     print_landscape_flag != system_lyxrc.print_landscape_flag) {
1676                         os << "\\print_landscape_flag \"" << print_landscape_flag
1677                            << "\"\n";
1678                 }
1679         case RC_PRINTPAGERANGEFLAG:
1680                 if (ignore_system_lyxrc ||
1681                     print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1682                         os << "\\print_pagerange_flag \"" << print_pagerange_flag
1683                            << "\"\n";
1684                 }
1685         case RC_PRINTCOPIESFLAG:
1686                 if (ignore_system_lyxrc ||
1687                     print_copies_flag != system_lyxrc.print_copies_flag) {
1688                         os << "\\print_copies_flag \"" << print_copies_flag
1689                            << "\"\n";
1690                 }
1691         case RC_PRINTCOLLCOPIESFLAG:
1692                 if (ignore_system_lyxrc ||
1693                     print_collcopies_flag
1694                     != system_lyxrc.print_collcopies_flag) {
1695                         os << "\\print_collcopies_flag \""
1696                            << print_collcopies_flag
1697                            << "\"\n";
1698                 }
1699         case RC_PRINTPAPERFLAG:
1700                 if (ignore_system_lyxrc ||
1701                     print_paper_flag != system_lyxrc.print_paper_flag) {
1702                         os << "\\print_paper_flag \"" << print_paper_flag
1703                            << "\"\n";
1704                 }
1705         case RC_PRINTPAPERDIMENSIONFLAG:
1706                 if (ignore_system_lyxrc ||
1707                     print_paper_dimension_flag
1708                     != system_lyxrc.print_paper_dimension_flag) {
1709                         os << "\\print_paper_dimension_flag \""
1710                            << print_paper_dimension_flag << "\"\n";
1711                 }
1712         case RC_PRINTTOPRINTER:
1713                 if (ignore_system_lyxrc ||
1714                     print_to_printer != system_lyxrc.print_to_printer) {
1715                         os << "\\print_to_printer \"" << print_to_printer
1716                            << "\"\n";
1717                 }
1718         case RC_PRINTTOFILE:
1719                 if (ignore_system_lyxrc ||
1720                     print_to_file != system_lyxrc.print_to_file) {
1721                         string const path = os::external_path(print_to_file);
1722                         os << "\\print_to_file \"" << path << "\"\n";
1723                 }
1724         case RC_PRINTFILEEXTENSION:
1725                 if (ignore_system_lyxrc ||
1726                     print_file_extension != system_lyxrc.print_file_extension) {
1727                         os << "\\print_file_extension \""
1728                            << print_file_extension
1729                            << "\"\n";
1730                 }
1731
1732                 os << "\n#\n"
1733                    << "# EXPORT SECTION ####################################\n"
1734                    << "#\n\n";
1735
1736         case RC_CUSTOM_EXPORT_COMMAND:
1737                 if (ignore_system_lyxrc ||
1738                     custom_export_command
1739                     != system_lyxrc.custom_export_command) {
1740                         os << "\\custom_export_command \""
1741                            << custom_export_command
1742                            << "\"\n";
1743                 }
1744         case RC_CUSTOM_EXPORT_FORMAT:
1745                 if (ignore_system_lyxrc ||
1746                     custom_export_format
1747                     != system_lyxrc.custom_export_format) {
1748                         os << "\\custom_export_format \"" << custom_export_format
1749                            << "\"\n";
1750                 }
1751
1752                 os << "\n#\n"
1753                    << "# TEX SECTION #######################################\n"
1754                    << "#\n\n";
1755
1756         case RC_FONT_ENCODING:
1757                 if (ignore_system_lyxrc ||
1758                     fontenc != system_lyxrc.fontenc) {
1759                         os << "\\font_encoding \"" << fontenc << "\"\n";
1760                 }
1761
1762                 os << "\n#\n"
1763                    << "# FILE SECTION ######################################\n"
1764                    << "#\n\n";
1765
1766         case RC_DOCUMENTPATH:
1767                 if (ignore_system_lyxrc ||
1768                     document_path != system_lyxrc.document_path) {
1769                         string const path = os::external_path(document_path);
1770                         os << "\\document_path \"" << path << "\"\n";
1771                 }
1772         case RC_USELASTFILEPOS:
1773                 if (ignore_system_lyxrc ||
1774                     use_lastfilepos != system_lyxrc.use_lastfilepos) {
1775                         os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
1776                            << '\n';
1777                 }
1778         case RC_LOADSESSION:
1779                 if (ignore_system_lyxrc ||
1780                     load_session != system_lyxrc.load_session) {
1781                         os << "\\load_session " << convert<string>(load_session)
1782                            << "\n";
1783                 }
1784         case RC_NUMLASTFILES:
1785                 if (ignore_system_lyxrc ||
1786                     num_lastfiles != system_lyxrc.num_lastfiles) {
1787                         os << "\\num_lastfiles " << num_lastfiles << '\n';
1788                 }
1789         case RC_CHECKLASTFILES:
1790                 if (ignore_system_lyxrc ||
1791                     check_lastfiles != system_lyxrc.check_lastfiles) {
1792                         os << "\\check_lastfiles " << convert<string>(check_lastfiles)
1793                            << '\n';
1794                 }
1795         case RC_TEMPLATEPATH:
1796                 if (ignore_system_lyxrc ||
1797                     template_path != system_lyxrc.template_path) {
1798                         string const path = os::external_path(template_path);
1799                         os << "\\template_path \"" << path << "\"\n";
1800                 }
1801         case RC_TEMPDIRPATH:
1802                 if (ignore_system_lyxrc ||
1803                     tempdir_path != system_lyxrc.tempdir_path) {
1804                         string const path = os::external_path(tempdir_path);
1805                         os << "\\tempdir_path \"" << path << "\"\n";
1806                 }
1807         case RC_USETEMPDIR:
1808                 // Ignore it
1809         case RC_PLAINTEXT_LINELEN:
1810                 if (ignore_system_lyxrc ||
1811                     plaintext_linelen != system_lyxrc.plaintext_linelen) {
1812                         os << "\\plaintext_linelen " << plaintext_linelen << '\n';
1813                 }
1814         case RC_MAKE_BACKUP:
1815                 if (ignore_system_lyxrc ||
1816                     make_backup != system_lyxrc.make_backup) {
1817                         os << "\\make_backup " << convert<string>(make_backup) << '\n';
1818                 }
1819         case RC_BACKUPDIR_PATH:
1820                 if (ignore_system_lyxrc ||
1821                     backupdir_path != system_lyxrc.backupdir_path) {
1822                         string const path = os::external_path(backupdir_path);
1823                         os << "\\backupdir_path \"" << path << "\"\n";
1824                 }
1825
1826                 os << "\n#\n"
1827                    << "# PLAIN TEXT EXPORT SECTION ##############################\n"
1828                    << "#\n\n";
1829
1830         case RC_PLAINTEXT_ROFF_COMMAND:
1831                 if (ignore_system_lyxrc ||
1832                     plaintext_roff_command != system_lyxrc.plaintext_roff_command) {
1833                         os << "\\plaintext_roff_command \"" << plaintext_roff_command
1834                            << "\"\n";
1835                 }
1836
1837                 os << "\n#\n"
1838                    << "# SPELLCHECKER SECTION ##############################\n"
1839                    << "#\n\n";
1840         case RC_USE_SPELL_LIB:
1841                 if (ignore_system_lyxrc ||
1842                     use_spell_lib != system_lyxrc.use_spell_lib) {
1843                         os << "\\use_spell_lib " << convert<string>(use_spell_lib) << '\n';
1844                 }
1845         case RC_SPELL_COMMAND:
1846                 if (ignore_system_lyxrc ||
1847                     isp_command != system_lyxrc.isp_command) {
1848                         os << "\\spell_command \"" << isp_command << "\"\n";
1849                 }
1850         case RC_ACCEPT_COMPOUND:
1851                 if (ignore_system_lyxrc ||
1852                     isp_accept_compound != system_lyxrc.isp_accept_compound) {
1853                         os << "\\accept_compound " << convert<string>(isp_accept_compound)
1854                            << '\n';
1855                 }
1856         case RC_USE_ALT_LANG:
1857                 if (ignore_system_lyxrc ||
1858                     isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1859                         os << "\\use_alt_language " << convert<string>(isp_use_alt_lang)
1860                            << '\n';
1861                 }
1862         case RC_ALT_LANG:
1863                 if (ignore_system_lyxrc ||
1864                     isp_alt_lang != system_lyxrc.isp_alt_lang) {
1865                         os << "\\alternate_language \"" << isp_alt_lang
1866                            << "\"\n";
1867                 }
1868         case RC_USE_ESC_CHARS:
1869                 if (ignore_system_lyxrc ||
1870                     isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1871                         os << "\\use_escape_chars " << convert<string>(isp_use_esc_chars)
1872                            << '\n';
1873                 }
1874         case RC_ESC_CHARS:
1875                 if (ignore_system_lyxrc ||
1876                     isp_esc_chars != system_lyxrc.isp_esc_chars) {
1877                         os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1878                 }
1879         case RC_USE_PERS_DICT:
1880                 if (ignore_system_lyxrc ||
1881                     isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1882                         os << "\\use_personal_dictionary "
1883                            << convert<string>(isp_use_pers_dict)
1884                            << '\n';
1885                 }
1886         case RC_PERS_DICT:
1887                 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1888                         string const path = os::external_path(isp_pers_dict);
1889                         os << "\\personal_dictionary \"" << path << "\"\n";
1890                 }
1891         case RC_USE_INP_ENC:
1892                 if (ignore_system_lyxrc ||
1893                     isp_use_input_encoding
1894                     != system_lyxrc.isp_use_input_encoding) {
1895                         os << "\\use_input_encoding "
1896                            << convert<string>(isp_use_input_encoding)
1897                            << '\n';
1898                 }
1899
1900                 os << "\n#\n"
1901                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
1902                    << "#\n\n";
1903
1904         case RC_RTL_SUPPORT:
1905                 if (ignore_system_lyxrc ||
1906                     rtl_support != system_lyxrc.rtl_support) {
1907                         os << "\\rtl " << convert<string>(rtl_support) << '\n';
1908                 }
1909         case RC_LANGUAGE_PACKAGE:
1910                 if (ignore_system_lyxrc ||
1911                     language_package != system_lyxrc.language_package) {
1912                         os << "\\language_package \"" << language_package
1913                            << "\"\n";
1914                 }
1915         case RC_LANGUAGE_GLOBAL_OPTIONS:
1916                 if (ignore_system_lyxrc ||
1917                     language_global_options
1918                     != system_lyxrc.language_global_options) {
1919                         os << "\\language_global_options \""
1920                            << convert<string>(language_global_options)
1921                            << "\"\n";
1922                 }
1923         case RC_LANGUAGE_USE_BABEL:
1924                 if (ignore_system_lyxrc ||
1925                     language_use_babel != system_lyxrc.language_use_babel) {
1926                         os << "\\language_use_babel \""
1927                            << convert<string>(language_use_babel)
1928                            << "\"\n";
1929                 }
1930         case RC_LANGUAGE_COMMAND_BEGIN:
1931                 if (ignore_system_lyxrc ||
1932                     language_command_begin
1933                     != system_lyxrc.language_command_begin) {
1934                         os << "\\language_command_begin \""
1935                            << language_command_begin
1936                            << "\"\n";
1937                 }
1938         case RC_LANGUAGE_COMMAND_END:
1939                 if (ignore_system_lyxrc ||
1940                     language_command_end
1941                     != system_lyxrc.language_command_end) {
1942                         os << "\\language_command_end \"" << language_command_end
1943                            << "\"\n";
1944                 }
1945         case RC_LANGUAGE_COMMAND_LOCAL:
1946                 if (ignore_system_lyxrc ||
1947                     language_command_local
1948                     != system_lyxrc.language_command_local) {
1949                         os << "\\language_command_local \""
1950                            << language_command_local
1951                            << "\"\n";
1952                 }
1953         case RC_LANGUAGE_AUTO_BEGIN:
1954                 if (ignore_system_lyxrc ||
1955                     language_auto_begin != system_lyxrc.language_auto_begin) {
1956                         os << "\\language_auto_begin "
1957                            << convert<string>(language_auto_begin) << '\n';
1958                 }
1959         case RC_LANGUAGE_AUTO_END:
1960                 if (ignore_system_lyxrc ||
1961                     language_auto_end != system_lyxrc.language_auto_end) {
1962                         os << "\\language_auto_end "
1963                            << convert<string>(language_auto_end) << '\n';
1964                 }
1965         case RC_MARK_FOREIGN_LANGUAGE:
1966                 if (ignore_system_lyxrc ||
1967                     mark_foreign_language
1968                     != system_lyxrc.mark_foreign_language) {
1969                         os << "\\mark_foreign_language " <<
1970                                 convert<string>(mark_foreign_language) << '\n';
1971                 }
1972
1973                 os << "\n#\n"
1974                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
1975                    << "#\n\n";
1976
1977         case RC_AUTO_NUMBER:
1978                 if (ignore_system_lyxrc ||
1979                     auto_number != system_lyxrc.auto_number) {
1980                         os << "\\auto_number " << convert<string>(auto_number) << '\n';
1981                 }
1982         case RC_DEFAULT_LANGUAGE:
1983                 if (ignore_system_lyxrc ||
1984                     default_language != system_lyxrc.default_language) {
1985                         os << "\\default_language " << default_language << '\n';
1986                 }
1987
1988                 os << "\n#\n"
1989                    << "# FORMATS SECTION ##########################\n"
1990                    << "#\n\n";
1991
1992         case RC_FORMAT:
1993                 // New/modified formats
1994                 for (Formats::const_iterator cit = formats.begin();
1995                      cit != formats.end(); ++cit) {
1996                         Format const * format =
1997                                 system_formats.getFormat(cit->name());
1998                         if (!format ||
1999                             format->extension() != cit->extension() ||
2000                             format->prettyname() != cit->prettyname() ||
2001                             format->shortcut() != cit->shortcut() ||
2002                             format->viewer() != cit->viewer() ||
2003                             format->editor() != cit->editor() ||
2004                             format->documentFormat() != cit->documentFormat() ||
2005                             format->vectorFormat() != cit->vectorFormat()) {
2006                                 os << "\\format \"" << cit->name() << "\" \""
2007                                    << cit->extension() << "\" \""
2008                                    << cit->prettyname() << "\" \""
2009                                    << cit->shortcut() << "\" \""
2010                                    << cit->viewer() << "\" \""
2011                                    << cit->editor() << "\" \"";
2012                                 std::vector<string> flags;
2013                                 if (cit->documentFormat())
2014                                         flags.push_back("document");
2015                                 if (cit->vectorFormat())
2016                                         flags.push_back("vector");
2017                                 os << support::getStringFromVector(flags);
2018                                 os << "\"\n";
2019                         }
2020                 }
2021
2022                 // Look for deleted formats
2023                 for (Formats::const_iterator cit = system_formats.begin();
2024                      cit != system_formats.end(); ++cit)
2025                         if (!formats.getFormat(cit->name()))
2026                                 os << "\\format \"" << cit->name()
2027                                    << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2028         case RC_VIEWER:
2029                 // Ignore it
2030
2031                 os << "\n#\n"
2032                    << "# CONVERTERS SECTION ##########################\n"
2033                    << "#\n\n";
2034
2035         case RC_CONVERTER:
2036                 // Look for new converters
2037                 for (Converters::const_iterator cit = theConverters().begin();
2038                      cit != theConverters().end(); ++cit) {
2039                         Converter const * converter =
2040                                 theSystemConverters().getConverter(cit->from,
2041                                                                cit->to);
2042                         if (!converter ||
2043                             converter->command != cit->command ||
2044                             converter->flags != cit->flags)
2045                                 os << "\\converter \"" << cit->from << "\" \""
2046                                    << cit->to << "\" \""
2047                                    << cit->command << "\" \""
2048                                    << cit->flags << "\"\n";
2049                 }
2050
2051                 // New/modifed converters
2052                 for (Converters::const_iterator cit = theSystemConverters().begin();
2053                      cit != theSystemConverters().end(); ++cit)
2054                         if (!theConverters().getConverter(cit->from, cit->to))
2055                                 os << "\\converter \"" << cit->from
2056                                    << "\" \"" << cit->to << "\" \"\" \"\"\n";
2057
2058         case RC_COPIER:
2059                 os << "\n#\n"
2060                    << "# COPIERS SECTION ##########################\n"
2061                    << "#\n\n";
2062
2063                 // Look for new movers
2064                 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2065                 Movers::const_iterator const sysend = theSystemMovers().end();
2066                 Movers::const_iterator it = theMovers().begin();
2067                 Movers::const_iterator end = theMovers().end();
2068
2069                 for (; it != end; ++it) {
2070                         Movers::const_iterator const sysit =
2071                                 std::find_if(sysbegin, sysend, SameMover(*it));
2072                         if (sysit == sysend) {
2073                                 std::string const & fmt = it->first;
2074                                 std::string const & command =
2075                                         it->second.command();
2076
2077                                 os << "\\copier " << fmt
2078                                    << " \"" << command << "\"\n";
2079                         }
2080                 }
2081
2082                 // We don't actually delete SpecialisedMover(s) from the
2083                 // map, just clear their 'command', so there's no need
2084                 // to test for anything else.
2085         }
2086
2087         os.flush();
2088 }
2089
2090
2091 #if 0
2092 string const LyXRC::getDescription(LyXRCTags tag)
2093 {
2094         docstring str;
2095
2096         switch (tag) {
2097         case RC_ACCEPT_COMPOUND:
2098                 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2099                 break;
2100
2101         case RC_ALT_LANG:
2102         case RC_USE_ALT_LANG:
2103                 str = _("Specify an alternate language. The default is to use the language of the document.");
2104                 break;
2105
2106         case RC_PLAINTEXT_ROFF_COMMAND:
2107                 str = _("Use to define an external program to render tables in plain text output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"\" is specified, an internal routine is used.");
2108                 break;
2109
2110         case RC_PLAINTEXT_LINELEN:
2111                 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.");
2112                 break;
2113
2114         case RC_AUTOREGIONDELETE:
2115                 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2116                 break;
2117
2118         case RC_AUTORESET_OPTIONS:
2119                 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2120                 break;
2121
2122         case RC_AUTOSAVE:
2123                 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2124                 break;
2125
2126         case RC_AUTO_NUMBER:
2127                 break;
2128
2129         case RC_BACKUPDIR_PATH:
2130                 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.");
2131                 break;
2132
2133         case RC_BIBTEX_COMMAND:
2134                 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2135                 break;
2136
2137         case RC_BINDFILE:
2138                 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2139                 break;
2140
2141         case RC_CHECKLASTFILES:
2142                 str = _("Select to check whether the lastfiles still exist.");
2143                 break;
2144
2145         case RC_CHKTEX_COMMAND:
2146                 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2147                 break;
2148
2149         case RC_CONVERTER:
2150                 break;
2151
2152         case RC_COPIER:
2153                 break;
2154
2155         case RC_CURSOR_FOLLOWS_SCROLLBAR:
2156                 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.");
2157                 break;
2158
2159         case RC_CUSTOM_EXPORT_COMMAND:
2160                 break;
2161
2162         case RC_CUSTOM_EXPORT_FORMAT:
2163                 break;
2164
2165         case RC_DATE_INSERT_FORMAT:
2166                 //xgettext:no-c-format
2167                 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2168                 break;
2169
2170         case RC_DEFAULT_LANGUAGE:
2171                 str = _("New documents will be assigned this language.");
2172                 break;
2173
2174         case RC_DEFAULT_PAPERSIZE:
2175                 str = _("Specify the default paper size.");
2176                 break;
2177
2178         case RC_DIALOGS_ICONIFY_WITH_MAIN:
2179                 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2180                 break;
2181
2182         case RC_DISPLAY_GRAPHICS:
2183                 str = _("Select how LyX will display any graphics.");
2184                 break;
2185
2186         case RC_DOCUMENTPATH:
2187                 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2188                 break;
2189
2190         case RC_ESC_CHARS:
2191         case RC_USE_ESC_CHARS:
2192                 str = _("Specify additional chars that can be part of a word.");
2193                 break;
2194
2195         case RC_FONT_ENCODING:
2196                 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
2197                 break;
2198
2199         case RC_FORMAT:
2200                 break;
2201
2202         case RC_INDEX_COMMAND:
2203                 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\".");
2204                 break;
2205
2206         case RC_INPUT:
2207                 break;
2208
2209         case RC_KBMAP:
2210         case RC_KBMAP_PRIMARY:
2211         case RC_KBMAP_SECONDARY:
2212                 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.");
2213                 break;
2214
2215         case RC_LABEL_INIT_LENGTH:
2216                 str = _("Maximum number of words in the initialization string for a new label");
2217                 break;
2218
2219         case RC_LANGUAGE_AUTO_BEGIN:
2220                 str = _("Select if a language switching command is needed at the beginning of the document.");
2221                 break;
2222
2223         case RC_LANGUAGE_AUTO_END:
2224                 str = _("Select if a language switching command is needed at the end of the document.");
2225                 break;
2226
2227         case RC_LANGUAGE_COMMAND_BEGIN:
2228                 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.");
2229                 break;
2230
2231         case RC_LANGUAGE_COMMAND_END:
2232                 str = _("The LaTeX command for changing back to the language of the document.");
2233                 break;
2234
2235         case RC_LANGUAGE_COMMAND_LOCAL:
2236                 str = _("The LaTeX command for local changing of the language.");
2237                 break;
2238
2239         case RC_LANGUAGE_GLOBAL_OPTIONS:
2240                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2241                 break;
2242
2243         case RC_LANGUAGE_PACKAGE:
2244                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2245                 break;
2246
2247         case RC_LANGUAGE_USE_BABEL:
2248                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2249                 break;
2250
2251         case RC_USELASTFILEPOS:
2252                 str = _("De-select if you do not want LyX to scroll to saved position.");
2253                 break;
2254
2255         case RC_LOADSESSION:
2256                 str = _("De-select to prevent loading files opened from the last lyx session.");
2257                 break;
2258
2259         case RC_MAKE_BACKUP:
2260                 str = _("De-select if you don't want LyX to create backup files.");
2261                 break;
2262
2263         case RC_MARK_FOREIGN_LANGUAGE:
2264                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2265                 break;
2266
2267         case RC_NUMLASTFILES:
2268                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
2269                         maxlastfiles);
2270                 break;
2271
2272         case RC_PATH_PREFIX:
2273                 str = _("Specify those directories which should be "
2274                          "prepended to the PATH environment variable. "
2275                          "Use the OS native format.");
2276                 break;
2277
2278         case RC_PERS_DICT:
2279         case RC_USE_PERS_DICT:
2280                 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2281                 break;
2282
2283         case RC_PREVIEW:
2284                 str = _("Shows a typeset preview of things such as math");
2285                 break;
2286
2287         case RC_PREVIEW_HASHED_LABELS:
2288                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2289                 break;
2290
2291         case RC_PREVIEW_SCALE_FACTOR:
2292                 str = _("Scale the preview size to suit.");
2293                 break;
2294
2295         case RC_PRINTCOLLCOPIESFLAG:
2296                 str = _("The option for specifying whether the copies should be collated.");
2297                 break;
2298
2299         case RC_PRINTCOPIESFLAG:
2300                 str = _("The option for specifying the number of copies to print.");
2301                 break;
2302
2303         case RC_PRINTER:
2304                 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
2305                 break;
2306
2307         case RC_PRINTEVENPAGEFLAG:
2308                 str = _("The option to print only even pages.");
2309                 break;
2310
2311         case RC_PRINTEXSTRAOPTIONS:
2312                 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2313                 break;
2314
2315         case RC_PRINTFILEEXTENSION:
2316                 str = _("Extension of printer program output file. Usually \".ps\".");
2317                 break;
2318
2319         case RC_PRINTLANDSCAPEFLAG:
2320                 str = _("The option to print out in landscape.");
2321                 break;
2322
2323         case RC_PRINTODDPAGEFLAG:
2324                 str = _("The option to print only odd pages.");
2325                 break;
2326
2327         case RC_PRINTPAGERANGEFLAG:
2328                 str = _("The option for specifying a comma-separated list of pages to print.");
2329                 break;
2330
2331         case RC_PRINTPAPERDIMENSIONFLAG:
2332                                    str = _("Option to specify the dimensions of the print paper.");
2333                 break;
2334
2335         case RC_PRINTPAPERFLAG:
2336                 str = _("The option to specify paper type.");
2337                 break;
2338
2339         case RC_PRINTREVERSEFLAG:
2340                 str = _("The option to reverse the order of the pages printed.");
2341                 break;
2342
2343         case RC_PRINTSPOOL_COMMAND:
2344                 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.");
2345                 break;
2346
2347         case RC_PRINTSPOOL_PRINTERPREFIX:
2348                 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.");
2349                 break;
2350
2351         case RC_PRINTTOFILE:
2352                 str = _("Option to pass to the print program to print to a file.");
2353                 break;
2354
2355         case RC_PRINTTOPRINTER:
2356                 str = _("Option to pass to the print program to print on a specific printer.");
2357                 break;
2358
2359         case RC_PRINT_ADAPTOUTPUT:
2360                 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2361                 break;
2362
2363         case RC_PRINT_COMMAND:
2364                 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
2365                 break;
2366
2367         case RC_RTL_SUPPORT:
2368                 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2369                 break;
2370
2371         case RC_SCREEN_DPI:
2372                 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2373                 break;
2374
2375         case RC_SCREEN_FONT_ENCODING:
2376                 str = _("The encoding for the screen fonts.");
2377                 break;
2378
2379         case RC_SCREEN_FONT_ROMAN:
2380         case RC_SCREEN_FONT_SANS:
2381         case RC_SCREEN_FONT_TYPEWRITER:
2382                 str = _("The screen fonts used to display the text while editing.");
2383                 break;
2384
2385         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
2386         case RC_SCREEN_FONT_SANS_FOUNDRY:
2387         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2388                 break;
2389
2390         case RC_SCREEN_FONT_SCALABLE:
2391                 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.");
2392                 break;
2393
2394         case RC_SCREEN_FONT_SIZES:
2395                 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2396                 break;
2397
2398         case RC_SCREEN_ZOOM:
2399                 //xgettext:no-c-format
2400                 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2401                 break;
2402
2403         case RC_SCREEN_GEOMETRY_HEIGHT:
2404         case RC_SCREEN_GEOMETRY_WIDTH:
2405                 str = _("Specify geometry of the main view in width x height (values from last session will not be used if non-zero values are specified).");
2406                 break;
2407
2408         case RC_SCREEN_GEOMETRY_XYSAVED:
2409                 str = _("Allow session manager to save and restore windows position.");
2410                 break;
2411
2412         case RC_SERVERPIPE:
2413                 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2414                 break;
2415
2416         case RC_SET_COLOR:
2417                 break;
2418
2419         case RC_SHOW_BANNER:
2420                 str = _("De-select if you don't want the startup banner.");
2421                 break;
2422
2423         case RC_SPELL_COMMAND:
2424                 str = _("What command runs the spellchecker?");
2425                 break;
2426
2427         case RC_TEMPDIRPATH:
2428                 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2429                 break;
2430
2431         case RC_TEMPLATEPATH:
2432                 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2433                 break;
2434
2435         case RC_TEX_ALLOWS_SPACES:
2436                 break;
2437
2438         case RC_TEX_EXPECTS_WINDOWS_PATHS:
2439                 break;
2440
2441         case RC_UIFILE:
2442                 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2443                 break;
2444
2445         case RC_USER_EMAIL:
2446                 break;
2447
2448         case RC_USER_NAME:
2449                 break;
2450
2451         case RC_USETEMPDIR:
2452                 break;
2453
2454         case RC_USE_INP_ENC:
2455                 str = _("Specify whether to pass the -T input encoding option to ispell. Enable this if you cannot check the spelling of words containing accented letters. This may not work with all dictionaries.");
2456                 break;
2457
2458         case RC_USE_SPELL_LIB:
2459                 break;
2460
2461         case RC_VIEWDVI_PAPEROPTION:
2462                 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2463                 break;
2464
2465         case RC_VIEWER:
2466                 break;
2467
2468         case RC_LAST:
2469                 break;
2470         }
2471
2472         return str;
2473 }
2474 #endif
2475
2476
2477 // The global instance
2478 LyXRC lyxrc;
2479
2480 // The global copy of the system lyxrc entries (everything except preferences)
2481 LyXRC system_lyxrc;
2482
2483
2484 } // namespace lyx