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