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