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