]> git.lyx.org Git - lyx.git/blob - src/LyXRC.cpp
96e0dac284e635b774ffcecaaab1857b0c6546bc
[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         { "\\show_macro_label", LyXRC::RC_SHOW_MACRO_LABEL },
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         show_macro_label = true;
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_SHOW_MACRO_LABEL:
843                         if (lexrc.next()) {
844                                 show_macro_label = lexrc.getBool();
845                         }
846                         break;
847
848                 case RC_DIALOGS_ICONIFY_WITH_MAIN:
849                         if (lexrc.next()) {
850                                 dialogs_iconify_with_main = lexrc.getBool();
851                         }
852                         break;
853
854                 case RC_PLAINTEXT_ROFF_COMMAND:
855                         if (lexrc.next()) {
856                                 plaintext_roff_command = lexrc.getString();
857                         }
858                         break;
859                 case RC_PLAINTEXT_LINELEN:
860                         if (lexrc.next()) {
861                                 plaintext_linelen = lexrc.getInteger();
862                         }
863                         break;
864                         // Spellchecker settings:
865                 case RC_USE_SPELL_LIB:
866                         if (lexrc.next()) {
867                                 use_spell_lib = lexrc.getBool();
868                         }
869                         break;
870                 case RC_SPELL_COMMAND:
871                         if (lexrc.next()) {
872                                 isp_command = lexrc.getString();
873                         }
874                         break;
875                 case RC_ACCEPT_COMPOUND:
876                         if (lexrc.next()) {
877                                 isp_accept_compound = lexrc.getBool();
878                         }
879                         break;
880                 case RC_USE_INP_ENC:
881                         if (lexrc.next()) {
882                                 isp_use_input_encoding = lexrc.getBool();
883                         }
884                         break;
885                 case RC_USE_ALT_LANG:
886                         if (lexrc.next()) {
887                                 isp_use_alt_lang = lexrc.getBool();
888                         }
889                         break;
890                 case RC_USE_PERS_DICT:
891                         if (lexrc.next()) {
892                                 isp_use_pers_dict = lexrc.getBool();
893                         }
894                         break;
895                 case RC_USE_TOOLTIP:
896                         if (lexrc.next()) {
897                                 use_tooltip = lexrc.getBool();
898                         }
899                         break;
900                 case RC_USE_PIXMAP_CACHE:
901                         if (lexrc.next()) {
902                                 use_pixmap_cache = lexrc.getBool();
903                         }
904                         break;
905                 case RC_USE_ESC_CHARS:
906                         if (lexrc.next()) {
907                                 isp_use_esc_chars = lexrc.getBool();
908                         }
909                         break;
910                 case RC_ALT_LANG:
911                         if (lexrc.next()) {
912                                 isp_alt_lang = lexrc.getString();
913                         }
914                         break;
915                 case RC_PERS_DICT:
916                         if (lexrc.next()) {
917                                 isp_pers_dict = os::internal_path(lexrc.getString());
918                         }
919                         break;
920                 case RC_ESC_CHARS:
921                         if (lexrc.next()) {
922                                 isp_esc_chars = lexrc.getString();
923                         }
924                         break;
925                 case RC_MAKE_BACKUP:
926                         if (lexrc.next()) {
927                                 make_backup = lexrc.getBool();
928                         }
929                         break;
930                 case RC_BACKUPDIR_PATH:
931                         if (lexrc.next()) {
932                                 backupdir_path = os::internal_path(lexrc.getString());
933                                 backupdir_path = expandPath(backupdir_path);
934                         }
935                         break;
936                 case RC_DATE_INSERT_FORMAT:
937                         if (lexrc.next()) {
938                                 date_insert_format = lexrc.getString();
939                         }
940                         break;
941                 case RC_LANGUAGE_PACKAGE:
942                         if (lexrc.next()) {
943                                 language_package = lexrc.getString();
944                         }
945                         break;
946                 case RC_LANGUAGE_AUTO_BEGIN:
947                         if (lexrc.next()) {
948                                 language_auto_begin = lexrc.getBool();
949                         }
950                         break;
951                 case RC_LANGUAGE_AUTO_END:
952                         if (lexrc.next()) {
953                                 language_auto_end = lexrc.getBool();
954                         }
955                         break;
956                 case RC_LANGUAGE_GLOBAL_OPTIONS:
957                         if (lexrc.next()) {
958                                 language_global_options = lexrc.getBool();
959                         }
960                         break;
961                 case RC_LANGUAGE_USE_BABEL:
962                         if (lexrc.next()) {
963                                 language_use_babel = lexrc.getBool();
964                         }
965                         break;
966                 case RC_LANGUAGE_COMMAND_BEGIN:
967                         if (lexrc.next()) {
968                                 language_command_begin = lexrc.getString();
969                         }
970                         break;
971                 case RC_LANGUAGE_COMMAND_END:
972                         if (lexrc.next()) {
973                                 language_command_end = lexrc.getString();
974                         }
975                         break;
976                 case RC_LANGUAGE_COMMAND_LOCAL:
977                         if (lexrc.next()) {
978                                 language_command_local = lexrc.getString();
979                         }
980                         break;
981                 case RC_RTL_SUPPORT:
982                         if (lexrc.next()) {
983                                 rtl_support = lexrc.getBool();
984                         }
985                         break;
986                 case RC_AUTO_NUMBER:
987                         if (lexrc.next()) {
988                                 auto_number = lexrc.getBool();
989                         }
990                         break;
991                 case RC_MARK_FOREIGN_LANGUAGE:
992                         if (lexrc.next()) {
993                                 mark_foreign_language = lexrc.getBool();
994                         }
995                         break;
996
997                 case RC_COPIER: {
998                         string fmt, command;
999                         if (lexrc.next()) {
1000                                 fmt = lexrc.getString();
1001                         }
1002                         if (lexrc.next()) {
1003                                 command = lexrc.getString();
1004                         }
1005                         setMover(fmt, command);
1006                         break;
1007                 }
1008
1009                 case RC_CONVERTER: {
1010                         string from, to, command, flags;
1011                         if (lexrc.next()) {
1012                                 from = lexrc.getString();
1013                         }
1014                         if (lexrc.next()) {
1015                                 to = lexrc.getString();
1016                         }
1017                         if (lexrc.next()) {
1018                                 command = lexrc.getString();
1019                         }
1020                         if (lexrc.next()) {
1021                                 flags = lexrc.getString();
1022                         }
1023                         if (command.empty()) {
1024                                 theConverters().erase(from, to);
1025                         } else {
1026                                 theConverters().add(from, to, command, flags);
1027                         }
1028                         break;
1029                 }
1030                 // compatibility with versions older than 1.4.0 only
1031                 case RC_VIEWER: {
1032                         string format, command;
1033                         if (lexrc.next()) {
1034                                 format = lexrc.getString();
1035                         }
1036                         if (lexrc.next()) {
1037                                 command = lexrc.getString();
1038                         }
1039                         formats.setViewer(format, command);
1040                         break;
1041                 }
1042                 case RC_FORMAT: {
1043                         string format, extension, prettyname, shortcut;
1044                         if (lexrc.next()) {
1045                                 format = lexrc.getString();
1046                         }
1047                         if (lexrc.next()) {
1048                                 extension = lexrc.getString();
1049                         }
1050                         if (lexrc.next()) {
1051                                 prettyname = lexrc.getString();
1052                         }
1053                         if (lexrc.next()) {
1054                                 shortcut = lexrc.getString();
1055                         }
1056                         string viewer, editor;
1057                         if (lexrc.next())
1058                                 viewer = lexrc.getString();
1059                         if (lexrc.next())
1060                                 editor = lexrc.getString();
1061                         string flags;
1062                         // Hack to ensure compatibility with versions older
1063                         // than 1.5.0
1064                         int le = lexrc.lex();
1065                         if (le != Lexer::LEX_FEOF && le != Lexer::LEX_UNDEF) {
1066                                 flags = lexrc.getString();
1067                                 if (le != Lexer::LEX_DATA) {
1068                                         // We have got a known token.
1069                                         // Therefore this is an old style
1070                                         // format definition without
1071                                         // flags.
1072                                         lexrc.pushToken(flags);
1073                                         flags.erase();
1074                                 }
1075                         }
1076                         int flgs = Format::none;
1077                         while (!flags.empty()) {
1078                                 string flag;
1079                                 flags = split(flags, flag, ',');
1080                                 if (flag == "document")
1081                                         flgs |= Format::document;
1082                                 else if (flag == "vector")
1083                                         flgs |= Format::vector;
1084                                 else
1085                                         lyxerr << "Ignoring unknown flag `"
1086                                                << flag << "' for format `"
1087                                                << format << "'." << endl;
1088                         }
1089                         if (prettyname.empty()) {
1090                                 if (theConverters().formatIsUsed(format)) {
1091                                         lyxerr << "Can't delete format "
1092                                                << format << endl;
1093                                 } else {
1094                                         formats.erase(format);
1095                                 }
1096                         } else {
1097                                 formats.add(format, extension, prettyname,
1098                                             shortcut, viewer, editor, flgs);
1099                         }
1100                         break;
1101                 }
1102                 case RC_DEFAULT_LANGUAGE:
1103                         if (lexrc.next()) {
1104                                 default_language = lexrc.getString();
1105                         }
1106                         break;
1107
1108                 case RC_LABEL_INIT_LENGTH:
1109                         if (lexrc.next()) {
1110                                 label_init_length = lexrc.getInteger();
1111                         }
1112                         break;
1113
1114                 case RC_SHOW_BANNER:
1115                         if (lexrc.next()) {
1116                                 show_banner = lexrc.getBool();
1117                         }
1118                         break;
1119
1120                 case RC_PREVIEW:
1121                         if (lexrc.next()) {
1122                                 string const tmp = lexrc.getString();
1123                                 if (tmp == "true" || tmp == "on")
1124                                         preview = PREVIEW_ON;
1125                                 else if (tmp == "no_math")
1126                                         preview = PREVIEW_NO_MATH;
1127                                 else {
1128                                         preview = PREVIEW_OFF;
1129                                         if (tmp != "false" && tmp != "off")
1130                                                 lyxerr << "Unrecognized "
1131                                                         "preview status \""
1132                                                        << tmp << '\n' << endl;
1133                                 }
1134                         }
1135                         break;
1136
1137                 case RC_PREVIEW_HASHED_LABELS:
1138                         if (lexrc.next()) {
1139                                 preview_hashed_labels = lexrc.getBool();
1140                         }
1141                         break;
1142
1143                 case RC_PREVIEW_SCALE_FACTOR:
1144                         if (lexrc.next()) {
1145                                 preview_scale_factor = lexrc.getString();
1146                         }
1147                         break;
1148
1149                 case RC_USER_NAME:
1150                         if (lexrc.next())
1151                                 user_name = lexrc.getString();
1152                         break;
1153
1154                 case RC_USER_EMAIL:
1155                         if (lexrc.next())
1156                                 user_email = lexrc.getString();
1157                         break;
1158
1159                 case RC_PATH_PREFIX:
1160                         if (lexrc.next())
1161                                 path_prefix = lexrc.getString();
1162                         break;
1163
1164                 case RC_USE_CONVERTER_CACHE:
1165                         if (lexrc.next())
1166                                 use_converter_cache = lexrc.getBool();
1167                         break;
1168
1169                 case RC_CONVERTER_CACHE_MAXAGE:
1170                         if (lexrc.next())
1171                                 converter_cache_maxage =
1172                                         convert<unsigned int>(lexrc.getString());
1173                         break;
1174
1175                 case RC_SORT_LAYOUTS:
1176                         if (lexrc.next())
1177                                 sort_layouts = lexrc.getBool();
1178                         break;
1179
1180                 case RC_LAST: break; // this is just a dummy
1181                 }
1182         }
1183
1184         /// Update converters data-structures
1185         theConverters().update(formats);
1186         theConverters().buildGraph();
1187
1188         return 0;
1189 }
1190
1191
1192 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1193 {
1194         ofstream ofs(filename.toFilesystemEncoding().c_str());
1195         if (ofs)
1196                 write(ofs, ignore_system_lyxrc);
1197 }
1198
1199
1200 void LyXRC::print() const
1201 {
1202         if (lyxerr.debugging())
1203                 write(lyxerr, false);
1204         else
1205                 write(cout, false);
1206 }
1207
1208
1209 class SameMover {
1210 public:
1211         typedef pair<string, SpecialisedMover> Data;
1212
1213         SameMover(Data const & comparison)
1214                 : comparison_(comparison) {}
1215
1216         bool operator()(Data const & data) const
1217         {
1218                 return data.first == comparison_.first &&
1219                         data.second.command() == comparison_.second.command();
1220         }
1221
1222 private:
1223         Data comparison_;
1224 };
1225
1226
1227 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1228 {
1229         LyXRCTags tag = RC_LAST;
1230         
1231         if (!name.empty()) {
1232                 for (int i = 0; i != lyxrcCount; ++i)
1233                         if ("\\" + name == lyxrcTags[i].tag)
1234                                 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1235         }
1236
1237         if (tag == RC_LAST)
1238                 os << "### This file is part of\n"
1239                    << "### ========================================================\n"
1240                    << "###          LyX, The Document Processor\n"
1241                    << "###\n"
1242                    << "###          Copyright 1995 Matthias Ettrich\n"
1243                    << "###          Copyright 1995-2007 The LyX Team.\n"
1244                    << "###\n"
1245                    << "### ========================================================\n"
1246                    << "\n"
1247                    << "# This file is written by LyX, if you want to make your own\n"
1248                    << "# modifications you should do them from inside LyX and save\n"
1249                    << "\n";
1250
1251         // Why the switch you might ask. It is a trick to ensure that all
1252         // the elements in the LyXRCTags enum is handled. As you can see
1253         // there are no breaks at all. So it is just a huge fall-through.
1254         // The nice thing is that we will get a warning from the compiler
1255         // if we forget an element.
1256         switch (tag) {
1257         case RC_LAST:
1258         case RC_INPUT:
1259                 // input/include files are not done here
1260         case RC_BINDFILE:
1261                 if (ignore_system_lyxrc ||
1262                     bind_file != system_lyxrc.bind_file) {
1263                         string const path = os::external_path(bind_file);
1264                         os << "\\bind_file \"" << path << "\"\n";
1265                 }
1266                 if (tag != RC_LAST)
1267                         break;
1268
1269         case RC_DEFFILE:
1270                 if (ignore_system_lyxrc ||
1271                     def_file != system_lyxrc.def_file) {
1272                         string const path = os::external_path(def_file);
1273                         os << "\\def_file \"" << path << "\"\n";
1274                 }
1275                 if (tag != RC_LAST)
1276                         break;
1277
1278                 //
1279                 // Misc Section
1280                 //
1281                 os << "\n#\n"
1282                    << "# MISC SECTION ######################################\n"
1283                    << "#\n\n";
1284                 // bind files are not done here.
1285
1286         case RC_PATH_PREFIX:
1287                 if (ignore_system_lyxrc ||
1288                     path_prefix != system_lyxrc.path_prefix) {
1289                         os << "\\path_prefix \"" << path_prefix << "\"\n";
1290                 }
1291                 if (tag != RC_LAST)
1292                         break;
1293         case RC_UIFILE:
1294                 if (ignore_system_lyxrc ||
1295                     ui_file != system_lyxrc.ui_file) {
1296                         string const path = os::external_path(ui_file);
1297                         os << "\\ui_file \"" << path << "\"\n";
1298                 }
1299                 if (tag != RC_LAST)
1300                         break;
1301         case RC_AUTOREGIONDELETE:
1302                 if (ignore_system_lyxrc ||
1303                     auto_region_delete != system_lyxrc.auto_region_delete) {
1304                         os << "# Set to false to inhibit automatic replacement of\n"
1305                            << "# the current selection.\n"
1306                            << "\\auto_region_delete " << convert<string>(auto_region_delete)
1307                            << '\n';
1308                 }
1309                 if (tag != RC_LAST)
1310                         break;
1311         case RC_AUTORESET_OPTIONS:
1312                 if (ignore_system_lyxrc ||
1313                     auto_reset_options != system_lyxrc.auto_reset_options) {
1314                         os << "# Set to false to inhibit automatic reset of\n"
1315                            << "# the class options to defaults on class change.\n"
1316                            << "\\auto_reset_options "
1317                            << convert<string>(auto_reset_options)
1318                            << '\n';
1319                 }
1320                 if (tag != RC_LAST)
1321                         break;
1322         case RC_AUTOSAVE:
1323                 if (ignore_system_lyxrc ||
1324                     autosave != system_lyxrc.autosave) {
1325                         os << "# The time interval between auto-saves in seconds.\n"
1326                            << "\\autosave " << autosave << '\n';
1327                 }
1328                 if (tag != RC_LAST)
1329                         break;
1330         case RC_DISPLAY_GRAPHICS:
1331                 if (ignore_system_lyxrc ||
1332                     display_graphics != system_lyxrc.display_graphics) {
1333                         os << "# Display graphics within LyX\n"
1334                            << "# monochrome|grayscale|color|none\n"
1335                            << "\\display_graphics "
1336                            << graphics::displayTranslator().find(
1337                                  graphics::DisplayType(display_graphics))
1338                            << '\n';
1339                 }
1340                 if (tag != RC_LAST)
1341                         break;
1342         case RC_SORT_LAYOUTS:
1343                 if (ignore_system_lyxrc ||
1344                     sort_layouts != system_lyxrc.sort_layouts) {
1345                         os << "# Sort layouts alphabetically.\n"
1346                            << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1347                 }
1348                 if (tag != RC_LAST)
1349                         break;
1350         case RC_VIEWDVI_PAPEROPTION:
1351                 if (ignore_system_lyxrc ||
1352                     view_dvi_paper_option
1353                     != system_lyxrc.view_dvi_paper_option) {
1354                         os << "# Options used to specify paper size to the\n"
1355                            << "# view_dvi_command (e.g. -paper)\n"
1356                            << "\\view_dvi_paper_option \""
1357                            << view_dvi_paper_option << "\"\n";
1358                 }
1359                 if (tag != RC_LAST)
1360                         break;
1361         case RC_DEFAULT_PAPERSIZE:
1362                 if (ignore_system_lyxrc ||
1363                     default_papersize != system_lyxrc.default_papersize) {
1364                         os << "# The default papersize to use.\n"
1365                            << "\\default_papersize \"";
1366                         switch (default_papersize) {
1367                         case PAPER_DEFAULT:
1368                                 os << "default"; break;
1369                         case PAPER_USLETTER:
1370                                 os << "usletter"; break;
1371                         case PAPER_USLEGAL:
1372                                 os << "legal"; break;
1373                         case PAPER_USEXECUTIVE:
1374                                 os << "executive"; break;
1375                         case PAPER_A3:
1376                                 os << "a3"; break;
1377                         case PAPER_A4:
1378                                 os << "a4"; break;
1379                         case PAPER_A5:
1380                                 os << "a5"; break;
1381                         case PAPER_B5:
1382                                 os << "b5"; break;
1383                         case PAPER_CUSTOM:
1384                         case PAPER_B3:
1385                         case PAPER_B4: break;
1386                         }
1387                         os << "\"\n";
1388                 }
1389                 if (tag != RC_LAST)
1390                         break;
1391         case RC_CHKTEX_COMMAND:
1392                 if (ignore_system_lyxrc ||
1393                     chktex_command != system_lyxrc.chktex_command) {
1394                         os << "\\chktex_command \"" << chktex_command << "\"\n";
1395                 }
1396                 if (tag != RC_LAST)
1397                         break;
1398         case RC_BIBTEX_COMMAND:
1399                 if (ignore_system_lyxrc ||
1400                     bibtex_command != system_lyxrc.bibtex_command) {
1401                         os << "\\bibtex_command \"" << bibtex_command << "\"\n";
1402                 }
1403                 if (tag != RC_LAST)
1404                         break;
1405         case RC_INDEX_COMMAND:
1406                 if (ignore_system_lyxrc ||
1407                     index_command != system_lyxrc.index_command) {
1408                         os << "\\index_command \"" << index_command << "\"\n";
1409                 }
1410                 if (tag != RC_LAST)
1411                         break;
1412         case RC_TEX_EXPECTS_WINDOWS_PATHS:
1413                 if (ignore_system_lyxrc ||
1414                     windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
1415                         os << "\\tex_expects_windows_paths "
1416                            << convert<string>(windows_style_tex_paths) << '\n';
1417                 }
1418                 if (tag != RC_LAST)
1419                         break;
1420         case RC_TEX_ALLOWS_SPACES:
1421                 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1422                         os << "\\tex_allows_spaces "
1423                            << convert<string>(tex_allows_spaces) << '\n';
1424                 }
1425                 if (tag != RC_LAST)
1426                         break;
1427         case RC_KBMAP:
1428                 if (ignore_system_lyxrc ||
1429                     use_kbmap != system_lyxrc.use_kbmap) {
1430                         os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1431                 }
1432                 if (tag != RC_LAST)
1433                         break;
1434         case RC_KBMAP_PRIMARY:
1435                 if (ignore_system_lyxrc ||
1436                     primary_kbmap != system_lyxrc.primary_kbmap) {
1437                         string const path = os::external_path(primary_kbmap);
1438                         os << "\\kbmap_primary \"" << path << "\"\n";
1439                 }
1440                 if (tag != RC_LAST)
1441                         break;
1442         case RC_KBMAP_SECONDARY:
1443                 if (ignore_system_lyxrc ||
1444                     secondary_kbmap != system_lyxrc.secondary_kbmap) {
1445                         string const path = os::external_path(secondary_kbmap);
1446                         os << "\\kbmap_secondary \"" << path << "\"\n";
1447                 }
1448                 if (tag != RC_LAST)
1449                         break;
1450         case RC_SERVERPIPE:
1451                 if (ignore_system_lyxrc ||
1452                     lyxpipes != system_lyxrc.lyxpipes) {
1453                         string const path = os::external_path(lyxpipes);
1454                         os << "\\serverpipe \"" << path << "\"\n";
1455                 }
1456                 if (tag != RC_LAST)
1457                         break;
1458         case RC_DATE_INSERT_FORMAT:
1459                 if (ignore_system_lyxrc ||
1460                     date_insert_format != system_lyxrc.date_insert_format) {
1461                         os << "\\date_insert_format \"" << date_insert_format
1462                            << "\"\n";
1463                 }
1464                 if (tag != RC_LAST)
1465                         break;
1466         case RC_LABEL_INIT_LENGTH:
1467                 if (ignore_system_lyxrc ||
1468                     label_init_length != system_lyxrc.label_init_length) {
1469                         os << "\\label_init_length " << label_init_length
1470                            << '\n';
1471                 }
1472                 if (tag != RC_LAST)
1473                         break;
1474
1475         case RC_USER_NAME:
1476                 os << "\\user_name \"" << user_name << "\"\n";
1477                 if (tag != RC_LAST)
1478                         break;
1479
1480         case RC_USER_EMAIL:
1481                 os << "\\user_email \"" << user_email << "\"\n";
1482                 if (tag != RC_LAST)
1483                         break;
1484
1485         case RC_SHOW_BANNER:
1486                 if (ignore_system_lyxrc ||
1487                     show_banner != system_lyxrc.show_banner) {
1488                         os << "\\show_banner " << convert<string>(show_banner) << '\n';
1489                 }
1490                 if (tag != RC_LAST)
1491                         break;
1492
1493         case RC_PREVIEW:
1494                 if (ignore_system_lyxrc ||
1495                     preview != system_lyxrc.preview) {
1496                         string status;
1497                         switch (preview) {
1498                         case PREVIEW_ON:
1499                                 status = "on";
1500                                 break;
1501                         case PREVIEW_NO_MATH:
1502                                 status = "no_math";
1503                                 break;
1504                         case PREVIEW_OFF:
1505                                 status = "off";
1506                                 break;
1507                         }
1508                         os << "\\preview " << status << '\n';
1509                 }
1510                 if (tag != RC_LAST)
1511                         break;
1512
1513         case RC_PREVIEW_HASHED_LABELS:
1514                 if (ignore_system_lyxrc ||
1515                     preview_hashed_labels !=
1516                     system_lyxrc.preview_hashed_labels) {
1517                         os << "\\preview_hashed_labels "
1518                            << convert<string>(preview_hashed_labels) << '\n';
1519                 }
1520                 if (tag != RC_LAST)
1521                         break;
1522
1523         case RC_PREVIEW_SCALE_FACTOR:
1524                 if (ignore_system_lyxrc ||
1525                     preview_scale_factor != system_lyxrc.preview_scale_factor) {
1526                         os << "\\preview_scale_factor "
1527                            << preview_scale_factor << '\n';
1528                 }
1529                 if (tag != RC_LAST)
1530                         break;
1531
1532         case RC_USE_CONVERTER_CACHE:
1533                 if (ignore_system_lyxrc ||
1534                     use_converter_cache != system_lyxrc.use_converter_cache) {
1535                         os << "\\use_converter_cache "
1536                            << convert<string>(use_converter_cache) << '\n';
1537                 }
1538                 if (tag != RC_LAST)
1539                         break;
1540
1541         case RC_CONVERTER_CACHE_MAXAGE:
1542                 if (ignore_system_lyxrc ||
1543                     converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1544                         os << "\\converter_cache_maxage "
1545                            << converter_cache_maxage << '\n';
1546                 }
1547                 if (tag != RC_LAST)
1548                         break;
1549
1550                 os << "\n#\n"
1551                    << "# SCREEN & FONTS SECTION ############################\n"
1552                    << "#\n\n";
1553
1554         case RC_SCREEN_DPI:
1555                 if (ignore_system_lyxrc ||
1556                     dpi != system_lyxrc.dpi) {
1557                         os << "\\screen_dpi " << dpi << '\n';
1558                 }
1559                 if (tag != RC_LAST)
1560                         break;
1561         case RC_SCREEN_ZOOM:
1562                 if (ignore_system_lyxrc ||
1563                     zoom != system_lyxrc.zoom) {
1564                         os << "\\screen_zoom " << zoom << '\n';
1565                 }
1566                 if (tag != RC_LAST)
1567                         break;
1568         case RC_GEOMETRY_SESSION:
1569                 if (ignore_system_lyxrc ||
1570                     allow_geometry_session != system_lyxrc.allow_geometry_session) {
1571                         os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1572                            << '\n';
1573                 }
1574                 if (tag != RC_LAST)
1575                         break;
1576         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1577                 if (ignore_system_lyxrc ||
1578                     cursor_follows_scrollbar
1579                     != system_lyxrc.cursor_follows_scrollbar) {
1580                         os << "\\cursor_follows_scrollbar "
1581                            << convert<string>(cursor_follows_scrollbar) << '\n';
1582                 }
1583                 if (tag != RC_LAST)
1584                         break;
1585         case RC_SHOW_MACRO_LABEL:
1586                 if (ignore_system_lyxrc ||
1587                     show_macro_label
1588                     != system_lyxrc.show_macro_label) {
1589                         os << "\\show_macro_label "
1590                            << convert<string>(show_macro_label) << '\n';
1591                 }
1592                 if (tag != RC_LAST)
1593                         break;
1594         case RC_DIALOGS_ICONIFY_WITH_MAIN:
1595                 if (ignore_system_lyxrc ||
1596                     dialogs_iconify_with_main
1597                    != system_lyxrc.dialogs_iconify_with_main) {
1598                         os << "\\dialogs_iconify_with_main "
1599                           <<  convert<string>(dialogs_iconify_with_main) << '\n';
1600                 }
1601                 if (tag != RC_LAST)
1602                         break;
1603         case RC_SCREEN_FONT_ROMAN:
1604                 if (ignore_system_lyxrc ||
1605                     roman_font_name != system_lyxrc.roman_font_name) {
1606                         os << "\\screen_font_roman \"" << roman_font_name
1607                            << "\"\n";
1608                 }
1609                 if (tag != RC_LAST)
1610                         break;
1611         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1612                 if (ignore_system_lyxrc ||
1613                     roman_font_foundry != system_lyxrc.roman_font_foundry) {
1614                         os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1615                            << "\"\n";
1616                 }
1617                 if (tag != RC_LAST)
1618                         break;
1619         case RC_SCREEN_FONT_SANS:
1620                 if (ignore_system_lyxrc ||
1621                     sans_font_name != system_lyxrc.sans_font_name) {
1622                         os << "\\screen_font_sans \"" << sans_font_name
1623                            << "\"\n";
1624                 }
1625                 if (tag != RC_LAST)
1626                         break;
1627         case RC_SCREEN_FONT_SANS_FOUNDRY:
1628                 if (ignore_system_lyxrc ||
1629                     sans_font_foundry != system_lyxrc.sans_font_foundry) {
1630                         os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1631                            << "\"\n";
1632                 }
1633                 if (tag != RC_LAST)
1634                         break;
1635         case RC_SCREEN_FONT_TYPEWRITER:
1636                 if (ignore_system_lyxrc ||
1637                     typewriter_font_name != system_lyxrc.typewriter_font_name) {
1638                         os << "\\screen_font_typewriter \""
1639                            << typewriter_font_name << "\"\n";
1640                 }
1641                 if (tag != RC_LAST)
1642                         break;
1643         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1644                 if (ignore_system_lyxrc ||
1645                     typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1646                         os << "\\screen_font_typewriter_foundry \""
1647                            << typewriter_font_foundry << "\"\n";
1648                 }
1649                 if (tag != RC_LAST)
1650                         break;
1651
1652         case RC_SCREEN_FONT_SCALABLE:
1653                 if (ignore_system_lyxrc ||
1654                     use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1655                         os << "\\screen_font_scalable "
1656                            << convert<string>(use_scalable_fonts)
1657                            << '\n';
1658                 }
1659                 if (tag != RC_LAST)
1660                         break;
1661         case RC_SCREEN_FONT_SIZES:
1662                 if (ignore_system_lyxrc ||
1663                     font_sizes[FONT_SIZE_TINY]
1664                     != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1665                     font_sizes[FONT_SIZE_SCRIPT]
1666                     != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1667                     font_sizes[FONT_SIZE_FOOTNOTE]
1668                     != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1669                     font_sizes[FONT_SIZE_SMALL]
1670                     != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1671                     font_sizes[FONT_SIZE_NORMAL]
1672                     != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1673                     font_sizes[FONT_SIZE_LARGE]
1674                     != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1675                     font_sizes[FONT_SIZE_LARGER]
1676                     != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1677                     font_sizes[FONT_SIZE_LARGEST]
1678                     != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1679                     font_sizes[FONT_SIZE_HUGE]
1680                     != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1681                     font_sizes[FONT_SIZE_HUGER]
1682                     != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1683                         os.setf(ios::fixed);
1684                         os.precision(2);
1685                         os << "\\screen_font_sizes"
1686                            << ' ' << font_sizes[FONT_SIZE_TINY]
1687                            << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1688                            << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1689                            << ' ' << font_sizes[FONT_SIZE_SMALL]
1690                            << ' ' << font_sizes[FONT_SIZE_NORMAL]
1691                            << ' ' << font_sizes[FONT_SIZE_LARGE]
1692                            << ' ' << font_sizes[FONT_SIZE_LARGER]
1693                            << ' ' << font_sizes[FONT_SIZE_LARGEST]
1694                            << ' ' << font_sizes[FONT_SIZE_HUGE]
1695                            << ' ' << font_sizes[FONT_SIZE_HUGER]
1696                            << '\n';
1697                 }
1698                 if (tag != RC_LAST)
1699                         break;
1700
1701                 os << "\n#\n"
1702                    << "# COLOR SECTION ###################################\n"
1703                    << "#\n\n";
1704
1705         case RC_SET_COLOR:
1706                 for (int i = 0; i < Color_ignore; ++i) {
1707                         ColorCode lc = static_cast<ColorCode>(i);
1708
1709                         string const col(lcolor.getX11Name(lc));
1710                         if (ignore_system_lyxrc ||
1711                             col != system_lcolor.getX11Name(lc)) {
1712                                 os << "\\set_color \""
1713                                    << lcolor.getLyXName(lc) << "\" \""
1714                                    << col << "\"\n";
1715                         }
1716                 }
1717                 if (tag != RC_LAST)
1718                         break;
1719
1720                 os << "\n#\n"
1721                    << "# PRINTER SECTION ###################################\n"
1722                    << "#\n\n";
1723
1724         case RC_PRINTER:
1725                 if (ignore_system_lyxrc ||
1726                     printer != system_lyxrc.printer) {
1727                         os << "\\printer \"" << printer << "\"\n";
1728                 }
1729                 if (tag != RC_LAST)
1730                         break;
1731         case RC_PRINT_ADAPTOUTPUT:
1732                 if (ignore_system_lyxrc ||
1733                     print_adapt_output != system_lyxrc.print_adapt_output) {
1734                         os << "\\print_adapt_output "
1735                            << convert<string>(print_adapt_output)
1736                            << '\n';
1737                 }
1738                 if (tag != RC_LAST)
1739                         break;
1740         case RC_PRINT_COMMAND:
1741                 if (ignore_system_lyxrc ||
1742                     print_command != system_lyxrc.print_command) {
1743                         os << "\\print_command \"" << print_command << "\"\n";
1744                 }
1745                 if (tag != RC_LAST)
1746                         break;
1747         case RC_PRINTEXSTRAOPTIONS:
1748                 if (ignore_system_lyxrc ||
1749                     print_extra_options != system_lyxrc.print_extra_options) {
1750                         os << "\\print_extra_options \"" << print_extra_options
1751                            << "\"\n";
1752                 }
1753                 if (tag != RC_LAST)
1754                         break;
1755         case RC_PRINTSPOOL_COMMAND:
1756                 if (ignore_system_lyxrc ||
1757                     print_spool_command != system_lyxrc.print_spool_command) {
1758                         os << "\\print_spool_command \"" << print_spool_command
1759                            << "\"\n";
1760                 }
1761                 if (tag != RC_LAST)
1762                         break;
1763         case RC_PRINTSPOOL_PRINTERPREFIX:
1764                 if (ignore_system_lyxrc ||
1765                     print_spool_printerprefix
1766                     != system_lyxrc.print_spool_printerprefix) {
1767                         os << "\\print_spool_printerprefix \""
1768                            << print_spool_printerprefix << "\"\n";
1769                 }
1770                 if (tag != RC_LAST)
1771                         break;
1772         case RC_PRINTEVENPAGEFLAG:
1773                 if (ignore_system_lyxrc ||
1774                     print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1775                         os << "\\print_evenpage_flag \"" << print_evenpage_flag
1776                            << "\"\n";
1777                 }
1778                 if (tag != RC_LAST)
1779                         break;
1780         case RC_PRINTODDPAGEFLAG:
1781                 if (ignore_system_lyxrc ||
1782                     print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1783                         os << "\\print_oddpage_flag \"" << print_oddpage_flag
1784                            << "\"\n";
1785                 }
1786                 if (tag != RC_LAST)
1787                         break;
1788         case RC_PRINTREVERSEFLAG:
1789                 if (ignore_system_lyxrc ||
1790                     print_reverse_flag != system_lyxrc.print_reverse_flag) {
1791                         os << "\\print_reverse_flag \"" << print_reverse_flag
1792                            << "\"\n";
1793                 }
1794                 if (tag != RC_LAST)
1795                         break;
1796         case RC_PRINTLANDSCAPEFLAG:
1797                 if (ignore_system_lyxrc ||
1798                     print_landscape_flag != system_lyxrc.print_landscape_flag) {
1799                         os << "\\print_landscape_flag \"" << print_landscape_flag
1800                            << "\"\n";
1801                 }
1802                 if (tag != RC_LAST)
1803                         break;
1804         case RC_PRINTPAGERANGEFLAG:
1805                 if (ignore_system_lyxrc ||
1806                     print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1807                         os << "\\print_pagerange_flag \"" << print_pagerange_flag
1808                            << "\"\n";
1809                 }
1810                 if (tag != RC_LAST)
1811                         break;
1812         case RC_PRINTCOPIESFLAG:
1813                 if (ignore_system_lyxrc ||
1814                     print_copies_flag != system_lyxrc.print_copies_flag) {
1815                         os << "\\print_copies_flag \"" << print_copies_flag
1816                            << "\"\n";
1817                 }
1818                 if (tag != RC_LAST)
1819                         break;
1820         case RC_PRINTCOLLCOPIESFLAG:
1821                 if (ignore_system_lyxrc ||
1822                     print_collcopies_flag
1823                     != system_lyxrc.print_collcopies_flag) {
1824                         os << "\\print_collcopies_flag \""
1825                            << print_collcopies_flag
1826                            << "\"\n";
1827                 }
1828                 if (tag != RC_LAST)
1829                         break;
1830         case RC_PRINTPAPERFLAG:
1831                 if (ignore_system_lyxrc ||
1832                     print_paper_flag != system_lyxrc.print_paper_flag) {
1833                         os << "\\print_paper_flag \"" << print_paper_flag
1834                            << "\"\n";
1835                 }
1836                 if (tag != RC_LAST)
1837                         break;
1838         case RC_PRINTPAPERDIMENSIONFLAG:
1839                 if (ignore_system_lyxrc ||
1840                     print_paper_dimension_flag
1841                     != system_lyxrc.print_paper_dimension_flag) {
1842                         os << "\\print_paper_dimension_flag \""
1843                            << print_paper_dimension_flag << "\"\n";
1844                 }
1845                 if (tag != RC_LAST)
1846                         break;
1847         case RC_PRINTTOPRINTER:
1848                 if (ignore_system_lyxrc ||
1849                     print_to_printer != system_lyxrc.print_to_printer) {
1850                         os << "\\print_to_printer \"" << print_to_printer
1851                            << "\"\n";
1852                 }
1853                 if (tag != RC_LAST)
1854                         break;
1855         case RC_PRINTTOFILE:
1856                 if (ignore_system_lyxrc ||
1857                     print_to_file != system_lyxrc.print_to_file) {
1858                         string const path = os::external_path(print_to_file);
1859                         os << "\\print_to_file \"" << path << "\"\n";
1860                 }
1861                 if (tag != RC_LAST)
1862                         break;
1863         case RC_PRINTFILEEXTENSION:
1864                 if (ignore_system_lyxrc ||
1865                     print_file_extension != system_lyxrc.print_file_extension) {
1866                         os << "\\print_file_extension \""
1867                            << print_file_extension
1868                            << "\"\n";
1869                 }
1870                 if (tag != RC_LAST)
1871                         break;
1872
1873                 os << "\n#\n"
1874                    << "# EXPORT SECTION ####################################\n"
1875                    << "#\n\n";
1876
1877         case RC_CUSTOM_EXPORT_COMMAND:
1878                 if (ignore_system_lyxrc ||
1879                     custom_export_command
1880                     != system_lyxrc.custom_export_command) {
1881                         os << "\\custom_export_command \""
1882                            << custom_export_command
1883                            << "\"\n";
1884                 }
1885                 if (tag != RC_LAST)
1886                         break;
1887         case RC_CUSTOM_EXPORT_FORMAT:
1888                 if (ignore_system_lyxrc ||
1889                     custom_export_format
1890                     != system_lyxrc.custom_export_format) {
1891                         os << "\\custom_export_format \"" << custom_export_format
1892                            << "\"\n";
1893                 }
1894                 if (tag != RC_LAST)
1895                         break;
1896
1897                 os << "\n#\n"
1898                    << "# TEX SECTION #######################################\n"
1899                    << "#\n\n";
1900
1901         case RC_FONT_ENCODING:
1902                 if (ignore_system_lyxrc ||
1903                     fontenc != system_lyxrc.fontenc) {
1904                         os << "\\font_encoding \"" << fontenc << "\"\n";
1905                 }
1906                 if (tag != RC_LAST)
1907                         break;
1908
1909                 os << "\n#\n"
1910                    << "# FILE SECTION ######################################\n"
1911                    << "#\n\n";
1912
1913         case RC_DOCUMENTPATH:
1914                 if (ignore_system_lyxrc ||
1915                     document_path != system_lyxrc.document_path) {
1916                         string const path = os::external_path(document_path);
1917                         os << "\\document_path \"" << path << "\"\n";
1918                 }
1919                 if (tag != RC_LAST)
1920                         break;
1921         case RC_USELASTFILEPOS:
1922                 if (ignore_system_lyxrc ||
1923                     use_lastfilepos != system_lyxrc.use_lastfilepos) {
1924                         os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
1925                            << '\n';
1926                 }
1927                 if (tag != RC_LAST)
1928                         break;
1929         case RC_LOADSESSION:
1930                 if (ignore_system_lyxrc ||
1931                     load_session != system_lyxrc.load_session) {
1932                         os << "\\load_session " << convert<string>(load_session)
1933                            << "\n";
1934                 }
1935                 if (tag != RC_LAST)
1936                         break;
1937         case RC_NUMLASTFILES:
1938                 if (ignore_system_lyxrc ||
1939                     num_lastfiles != system_lyxrc.num_lastfiles) {
1940                         os << "\\num_lastfiles " << num_lastfiles << '\n';
1941                 }
1942                 if (tag != RC_LAST)
1943                         break;
1944         case RC_CHECKLASTFILES:
1945                 if (ignore_system_lyxrc ||
1946                     check_lastfiles != system_lyxrc.check_lastfiles) {
1947                         os << "\\check_lastfiles " << convert<string>(check_lastfiles)
1948                            << '\n';
1949                 }
1950                 if (tag != RC_LAST)
1951                         break;
1952         case RC_EXAMPLEPATH:
1953                 if (ignore_system_lyxrc ||
1954                     example_path != system_lyxrc.example_path) {
1955                         string const path = os::external_path(example_path);
1956                         os << "\\example_path \"" << path << "\"\n";
1957                 }
1958                 if (tag != RC_LAST)
1959                         break;
1960         case RC_TEMPLATEPATH:
1961                 if (ignore_system_lyxrc ||
1962                     template_path != system_lyxrc.template_path) {
1963                         string const path = os::external_path(template_path);
1964                         os << "\\template_path \"" << path << "\"\n";
1965                 }
1966                 if (tag != RC_LAST)
1967                         break;
1968         case RC_TEMPDIRPATH:
1969                 if (ignore_system_lyxrc ||
1970                     tempdir_path != system_lyxrc.tempdir_path) {
1971                         string const path = os::external_path(tempdir_path);
1972                         os << "\\tempdir_path \"" << path << "\"\n";
1973                 }
1974                 if (tag != RC_LAST)
1975                         break;
1976         case RC_USETEMPDIR:
1977                 if (tag != RC_LAST)
1978                         break;
1979                 // Ignore it
1980         case RC_PLAINTEXT_LINELEN:
1981                 if (ignore_system_lyxrc ||
1982                     plaintext_linelen != system_lyxrc.plaintext_linelen) {
1983                         os << "\\plaintext_linelen " << plaintext_linelen << '\n';
1984                 }
1985                 if (tag != RC_LAST)
1986                         break;
1987         case RC_MAKE_BACKUP:
1988                 if (ignore_system_lyxrc ||
1989                     make_backup != system_lyxrc.make_backup) {
1990                         os << "\\make_backup " << convert<string>(make_backup) << '\n';
1991                 }
1992                 if (tag != RC_LAST)
1993                         break;
1994         case RC_BACKUPDIR_PATH:
1995                 if (ignore_system_lyxrc ||
1996                     backupdir_path != system_lyxrc.backupdir_path) {
1997                         string const path = os::external_path(backupdir_path);
1998                         os << "\\backupdir_path \"" << path << "\"\n";
1999                 }
2000                 if (tag != RC_LAST)
2001                         break;
2002
2003                 os << "\n#\n"
2004                    << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2005                    << "#\n\n";
2006
2007         case RC_PLAINTEXT_ROFF_COMMAND:
2008                 if (ignore_system_lyxrc ||
2009                     plaintext_roff_command != system_lyxrc.plaintext_roff_command) {
2010                         os << "\\plaintext_roff_command \"" << plaintext_roff_command
2011                            << "\"\n";
2012                 }
2013                 if (tag != RC_LAST)
2014                         break;
2015
2016                 os << "\n#\n"
2017                    << "# SPELLCHECKER SECTION ##############################\n"
2018                    << "#\n\n";
2019         case RC_USE_SPELL_LIB:
2020                 if (ignore_system_lyxrc ||
2021                     use_spell_lib != system_lyxrc.use_spell_lib) {
2022                         os << "\\use_spell_lib " << convert<string>(use_spell_lib) << '\n';
2023                 }
2024                 if (tag != RC_LAST)
2025                         break;
2026         case RC_SPELL_COMMAND:
2027                 if (ignore_system_lyxrc ||
2028                     isp_command != system_lyxrc.isp_command) {
2029                         os << "\\spell_command \"" << isp_command << "\"\n";
2030                 }
2031                 if (tag != RC_LAST)
2032                         break;
2033         case RC_ACCEPT_COMPOUND:
2034                 if (ignore_system_lyxrc ||
2035                     isp_accept_compound != system_lyxrc.isp_accept_compound) {
2036                         os << "\\accept_compound " << convert<string>(isp_accept_compound)
2037                            << '\n';
2038                 }
2039                 if (tag != RC_LAST)
2040                         break;
2041         case RC_USE_ALT_LANG:
2042                 if (ignore_system_lyxrc ||
2043                     isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
2044                         os << "\\use_alt_language " << convert<string>(isp_use_alt_lang)
2045                            << '\n';
2046                 }
2047                 if (tag != RC_LAST)
2048                         break;
2049         case RC_ALT_LANG:
2050                 if (ignore_system_lyxrc ||
2051                     isp_alt_lang != system_lyxrc.isp_alt_lang) {
2052                         os << "\\alternate_language \"" << isp_alt_lang
2053                            << "\"\n";
2054                 }
2055                 if (tag != RC_LAST)
2056                         break;
2057         case RC_USE_ESC_CHARS:
2058                 if (ignore_system_lyxrc ||
2059                     isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
2060                         os << "\\use_escape_chars " << convert<string>(isp_use_esc_chars)
2061                            << '\n';
2062                 }
2063                 if (tag != RC_LAST)
2064                         break;
2065         case RC_ESC_CHARS:
2066                 if (ignore_system_lyxrc ||
2067                     isp_esc_chars != system_lyxrc.isp_esc_chars) {
2068                         os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
2069                 }
2070                 if (tag != RC_LAST)
2071                         break;
2072         case RC_USE_PERS_DICT:
2073                 if (ignore_system_lyxrc ||
2074                     isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
2075                         os << "\\use_personal_dictionary "
2076                            << convert<string>(isp_use_pers_dict)
2077                            << '\n';
2078                 }
2079                 if (tag != RC_LAST)
2080                         break;
2081         case RC_USE_TOOLTIP:
2082                 if (ignore_system_lyxrc ||
2083                     use_tooltip != system_lyxrc.use_tooltip) {
2084                         os << "\\use_tooltip "
2085                            << convert<string>(use_tooltip)
2086                            << '\n';
2087                 }
2088         case RC_USE_PIXMAP_CACHE:
2089                 if (ignore_system_lyxrc ||
2090                     use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2091                         os << "\\use_pixmap_cache "
2092                            << convert<string>(use_pixmap_cache)
2093                            << '\n';
2094                 }
2095         case RC_PERS_DICT:
2096                 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
2097                         string const path = os::external_path(isp_pers_dict);
2098                         os << "\\personal_dictionary \"" << path << "\"\n";
2099                 }
2100                 if (tag != RC_LAST)
2101                         break;
2102         case RC_USE_INP_ENC:
2103                 if (ignore_system_lyxrc ||
2104                     isp_use_input_encoding
2105                     != system_lyxrc.isp_use_input_encoding) {
2106                         os << "\\use_input_encoding "
2107                            << convert<string>(isp_use_input_encoding)
2108                            << '\n';
2109                 }
2110                 if (tag != RC_LAST)
2111                         break;
2112
2113                 os << "\n#\n"
2114                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
2115                    << "#\n\n";
2116
2117         case RC_RTL_SUPPORT:
2118                 if (ignore_system_lyxrc ||
2119                     rtl_support != system_lyxrc.rtl_support) {
2120                         os << "\\rtl " << convert<string>(rtl_support) << '\n';
2121                 }
2122                 if (tag != RC_LAST)
2123                         break;
2124         case RC_LANGUAGE_PACKAGE:
2125                 if (ignore_system_lyxrc ||
2126                     language_package != system_lyxrc.language_package) {
2127                         os << "\\language_package \"" << language_package
2128                            << "\"\n";
2129                 }
2130                 if (tag != RC_LAST)
2131                         break;
2132         case RC_LANGUAGE_GLOBAL_OPTIONS:
2133                 if (ignore_system_lyxrc ||
2134                     language_global_options
2135                     != system_lyxrc.language_global_options) {
2136                         os << "\\language_global_options \""
2137                            << convert<string>(language_global_options)
2138                            << "\"\n";
2139                 }
2140                 if (tag != RC_LAST)
2141                         break;
2142         case RC_LANGUAGE_USE_BABEL:
2143                 if (ignore_system_lyxrc ||
2144                     language_use_babel != system_lyxrc.language_use_babel) {
2145                         os << "\\language_use_babel \""
2146                            << convert<string>(language_use_babel)
2147                            << "\"\n";
2148                 }
2149                 if (tag != RC_LAST)
2150                         break;
2151         case RC_LANGUAGE_COMMAND_BEGIN:
2152                 if (ignore_system_lyxrc ||
2153                     language_command_begin
2154                     != system_lyxrc.language_command_begin) {
2155                         os << "\\language_command_begin \""
2156                            << language_command_begin
2157                            << "\"\n";
2158                 }
2159                 if (tag != RC_LAST)
2160                         break;
2161         case RC_LANGUAGE_COMMAND_END:
2162                 if (ignore_system_lyxrc ||
2163                     language_command_end
2164                     != system_lyxrc.language_command_end) {
2165                         os << "\\language_command_end \"" << language_command_end
2166                            << "\"\n";
2167                 }
2168                 if (tag != RC_LAST)
2169                         break;
2170         case RC_LANGUAGE_COMMAND_LOCAL:
2171                 if (ignore_system_lyxrc ||
2172                     language_command_local
2173                     != system_lyxrc.language_command_local) {
2174                         os << "\\language_command_local \""
2175                            << language_command_local
2176                            << "\"\n";
2177                 }
2178                 if (tag != RC_LAST)
2179                         break;
2180         case RC_LANGUAGE_AUTO_BEGIN:
2181                 if (ignore_system_lyxrc ||
2182                     language_auto_begin != system_lyxrc.language_auto_begin) {
2183                         os << "\\language_auto_begin "
2184                            << convert<string>(language_auto_begin) << '\n';
2185                 }
2186                 if (tag != RC_LAST)
2187                         break;
2188         case RC_LANGUAGE_AUTO_END:
2189                 if (ignore_system_lyxrc ||
2190                     language_auto_end != system_lyxrc.language_auto_end) {
2191                         os << "\\language_auto_end "
2192                            << convert<string>(language_auto_end) << '\n';
2193                 }
2194                 if (tag != RC_LAST)
2195                         break;
2196         case RC_MARK_FOREIGN_LANGUAGE:
2197                 if (ignore_system_lyxrc ||
2198                     mark_foreign_language
2199                     != system_lyxrc.mark_foreign_language) {
2200                         os << "\\mark_foreign_language " <<
2201                                 convert<string>(mark_foreign_language) << '\n';
2202                 }
2203                 if (tag != RC_LAST)
2204                         break;
2205
2206                 os << "\n#\n"
2207                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
2208                    << "#\n\n";
2209
2210         case RC_AUTO_NUMBER:
2211                 if (ignore_system_lyxrc ||
2212                     auto_number != system_lyxrc.auto_number) {
2213                         os << "\\auto_number " << convert<string>(auto_number) << '\n';
2214                 }
2215                 if (tag != RC_LAST)
2216                         break;
2217         case RC_DEFAULT_LANGUAGE:
2218                 if (ignore_system_lyxrc ||
2219                     default_language != system_lyxrc.default_language) {
2220                         os << "\\default_language " << default_language << '\n';
2221                 }
2222                 if (tag != RC_LAST)
2223                         break;
2224
2225                 os << "\n#\n"
2226                    << "# FORMATS SECTION ##########################\n"
2227                    << "#\n\n";
2228
2229         case RC_FORMAT:
2230                 // New/modified formats
2231                 for (Formats::const_iterator cit = formats.begin();
2232                      cit != formats.end(); ++cit) {
2233                         Format const * format =
2234                                 system_formats.getFormat(cit->name());
2235                         if (!format ||
2236                             format->extension() != cit->extension() ||
2237                             format->prettyname() != cit->prettyname() ||
2238                             format->shortcut() != cit->shortcut() ||
2239                             format->viewer() != cit->viewer() ||
2240                             format->editor() != cit->editor() ||
2241                             format->documentFormat() != cit->documentFormat() ||
2242                             format->vectorFormat() != cit->vectorFormat()) {
2243                                 os << "\\format \"" << cit->name() << "\" \""
2244                                    << cit->extension() << "\" \""
2245                                    << cit->prettyname() << "\" \""
2246                                    << cit->shortcut() << "\" \""
2247                                    << cit->viewer() << "\" \""
2248                                    << cit->editor() << "\" \"";
2249                                 vector<string> flags;
2250                                 if (cit->documentFormat())
2251                                         flags.push_back("document");
2252                                 if (cit->vectorFormat())
2253                                         flags.push_back("vector");
2254                                 os << getStringFromVector(flags);
2255                                 os << "\"\n";
2256                         }
2257                 }
2258
2259                 // Look for deleted formats
2260                 for (Formats::const_iterator cit = system_formats.begin();
2261                      cit != system_formats.end(); ++cit)
2262                         if (!formats.getFormat(cit->name()))
2263                                 os << "\\format \"" << cit->name()
2264                                    << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2265                 if (tag != RC_LAST)
2266                         break;
2267         case RC_VIEWER:
2268                 // Ignore it
2269                 if (tag != RC_LAST)
2270                         break;
2271
2272                 os << "\n#\n"
2273                    << "# CONVERTERS SECTION ##########################\n"
2274                    << "#\n\n";
2275
2276         case RC_CONVERTER:
2277                 // Look for new converters
2278                 for (Converters::const_iterator cit = theConverters().begin();
2279                      cit != theConverters().end(); ++cit) {
2280                         Converter const * converter =
2281                                 theSystemConverters().getConverter(cit->from,
2282                                                                cit->to);
2283                         if (!converter ||
2284                             converter->command != cit->command ||
2285                             converter->flags != cit->flags)
2286                                 os << "\\converter \"" << cit->from << "\" \""
2287                                    << cit->to << "\" \""
2288                                    << cit->command << "\" \""
2289                                    << cit->flags << "\"\n";
2290                 }
2291
2292                 // New/modifed converters
2293                 for (Converters::const_iterator cit = theSystemConverters().begin();
2294                      cit != theSystemConverters().end(); ++cit)
2295                         if (!theConverters().getConverter(cit->from, cit->to))
2296                                 os << "\\converter \"" << cit->from
2297                                    << "\" \"" << cit->to << "\" \"\" \"\"\n";
2298                 if (tag != RC_LAST)
2299                         break;
2300
2301         case RC_COPIER:
2302                 if (tag == RC_LAST)
2303                         os << "\n#\n"
2304                            << "# COPIERS SECTION ##########################\n"
2305                            << "#\n\n";
2306
2307                 // Look for new movers
2308                 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2309                 Movers::const_iterator const sysend = theSystemMovers().end();
2310                 Movers::const_iterator it = theMovers().begin();
2311                 Movers::const_iterator end = theMovers().end();
2312
2313                 for (; it != end; ++it) {
2314                         Movers::const_iterator const sysit =
2315                                 find_if(sysbegin, sysend, SameMover(*it));
2316                         if (sysit == sysend) {
2317                                 string const & fmt = it->first;
2318                                 string const & command =
2319                                         it->second.command();
2320
2321                                 os << "\\copier " << fmt
2322                                    << " \"" << command << "\"\n";
2323                         }
2324                 }
2325                 if (tag != RC_LAST)
2326                         break;
2327
2328                 // We don't actually delete SpecialisedMover(s) from the
2329                 // map, just clear their 'command', so there's no need
2330                 // to test for anything else.
2331         }
2332
2333         os.flush();
2334 }
2335
2336
2337 #if 0
2338 string const LyXRC::getDescription(LyXRCTags tag)
2339 {
2340         docstring str;
2341
2342         switch (tag) {
2343         case RC_ACCEPT_COMPOUND:
2344                 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2345                 break;
2346
2347         case RC_ALT_LANG:
2348         case RC_USE_ALT_LANG:
2349                 str = _("Specify an alternate language. The default is to use the language of the document.");
2350                 break;
2351
2352         case RC_PLAINTEXT_ROFF_COMMAND:
2353                 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.");
2354                 break;
2355
2356         case RC_PLAINTEXT_LINELEN:
2357                 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.");
2358                 break;
2359
2360         case RC_AUTOREGIONDELETE:
2361                 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2362                 break;
2363
2364         case RC_AUTORESET_OPTIONS:
2365                 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2366                 break;
2367
2368         case RC_AUTOSAVE:
2369                 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2370                 break;
2371
2372         case RC_AUTO_NUMBER:
2373                 break;
2374
2375         case RC_BACKUPDIR_PATH:
2376                 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.");
2377                 break;
2378
2379         case RC_BIBTEX_COMMAND:
2380                 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2381                 break;
2382
2383         case RC_BINDFILE:
2384                 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2385                 break;
2386
2387         case RC_CHECKLASTFILES:
2388                 str = _("Select to check whether the lastfiles still exist.");
2389                 break;
2390
2391         case RC_CHKTEX_COMMAND:
2392                 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2393                 break;
2394
2395         case RC_CONVERTER:
2396                 break;
2397
2398         case RC_COPIER:
2399                 break;
2400
2401         case RC_CURSOR_FOLLOWS_SCROLLBAR:
2402                 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.");
2403                 break;
2404
2405         case RC_SHOW_MACRO_LABEL:
2406                 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
2407                 break;
2408
2409         case RC_CUSTOM_EXPORT_COMMAND:
2410                 break;
2411
2412         case RC_CUSTOM_EXPORT_FORMAT:
2413                 break;
2414
2415         case RC_DATE_INSERT_FORMAT:
2416                 //xgettext:no-c-format
2417                 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2418                 break;
2419
2420         case RC_DEFFILE:
2421                 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
2422                 break;
2423
2424         case RC_DEFAULT_LANGUAGE:
2425                 str = _("New documents will be assigned this language.");
2426                 break;
2427
2428         case RC_DEFAULT_PAPERSIZE:
2429                 str = _("Specify the default paper size.");
2430                 break;
2431
2432         case RC_DIALOGS_ICONIFY_WITH_MAIN:
2433                 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2434                 break;
2435
2436         case RC_DISPLAY_GRAPHICS:
2437                 str = _("Select how LyX will display any graphics.");
2438                 break;
2439
2440         case RC_DOCUMENTPATH:
2441                 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2442                 break;
2443
2444         case RC_ESC_CHARS:
2445         case RC_USE_ESC_CHARS:
2446                 str = _("Specify additional chars that can be part of a word.");
2447                 break;
2448
2449         case RC_EXAMPLEPATH:
2450                 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
2451                 break;
2452
2453         case RC_FONT_ENCODING:
2454                 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
2455                 break;
2456
2457         case RC_FORMAT:
2458                 break;
2459
2460         case RC_INDEX_COMMAND:
2461                 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\".");
2462                 break;
2463
2464         case RC_INPUT:
2465                 break;
2466
2467         case RC_KBMAP:
2468         case RC_KBMAP_PRIMARY:
2469         case RC_KBMAP_SECONDARY:
2470                 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.");
2471                 break;
2472
2473         case RC_LABEL_INIT_LENGTH:
2474                 str = _("Maximum number of words in the initialization string for a new label");
2475                 break;
2476
2477         case RC_LANGUAGE_AUTO_BEGIN:
2478                 str = _("Select if a language switching command is needed at the beginning of the document.");
2479                 break;
2480
2481         case RC_LANGUAGE_AUTO_END:
2482                 str = _("Select if a language switching command is needed at the end of the document.");
2483                 break;
2484
2485         case RC_LANGUAGE_COMMAND_BEGIN:
2486                 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.");
2487                 break;
2488
2489         case RC_LANGUAGE_COMMAND_END:
2490                 str = _("The LaTeX command for changing back to the language of the document.");
2491                 break;
2492
2493         case RC_LANGUAGE_COMMAND_LOCAL:
2494                 str = _("The LaTeX command for local changing of the language.");
2495                 break;
2496
2497         case RC_LANGUAGE_GLOBAL_OPTIONS:
2498                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2499                 break;
2500
2501         case RC_LANGUAGE_PACKAGE:
2502                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2503                 break;
2504
2505         case RC_LANGUAGE_USE_BABEL:
2506                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2507                 break;
2508
2509         case RC_USELASTFILEPOS:
2510                 str = _("De-select if you do not want LyX to scroll to saved position.");
2511                 break;
2512
2513         case RC_LOADSESSION:
2514                 str = _("De-select to prevent loading files opened from the last LyX session.");
2515                 break;
2516
2517         case RC_MAKE_BACKUP:
2518                 str = _("De-select if you don't want LyX to create backup files.");
2519                 break;
2520
2521         case RC_MARK_FOREIGN_LANGUAGE:
2522                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2523                 break;
2524
2525         case RC_NUMLASTFILES:
2526                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
2527                         maxlastfiles);
2528                 break;
2529
2530         case RC_PATH_PREFIX:
2531                 str = _("Specify those directories which should be "
2532                          "prepended to the PATH environment variable. "
2533                          "Use the OS native format.");
2534                 break;
2535
2536         case RC_PERS_DICT:
2537         case RC_USE_PERS_DICT:
2538                 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2539                 break;
2540
2541         case RC_PREVIEW:
2542                 str = _("Shows a typeset preview of things such as math");
2543                 break;
2544
2545         case RC_PREVIEW_HASHED_LABELS:
2546                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2547                 break;
2548
2549         case RC_PREVIEW_SCALE_FACTOR:
2550                 str = _("Scale the preview size to suit.");
2551                 break;
2552
2553         case RC_PRINTCOLLCOPIESFLAG:
2554                 str = _("The option for specifying whether the copies should be collated.");
2555                 break;
2556
2557         case RC_PRINTCOPIESFLAG:
2558                 str = _("The option for specifying the number of copies to print.");
2559                 break;
2560
2561         case RC_PRINTER:
2562                 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
2563                 break;
2564
2565         case RC_PRINTEVENPAGEFLAG:
2566                 str = _("The option to print only even pages.");
2567                 break;
2568
2569         case RC_PRINTEXSTRAOPTIONS:
2570                 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2571                 break;
2572
2573         case RC_PRINTFILEEXTENSION:
2574                 str = _("Extension of printer program output file. Usually \".ps\".");
2575                 break;
2576
2577         case RC_PRINTLANDSCAPEFLAG:
2578                 str = _("The option to print out in landscape.");
2579                 break;
2580
2581         case RC_PRINTODDPAGEFLAG:
2582                 str = _("The option to print only odd pages.");
2583                 break;
2584
2585         case RC_PRINTPAGERANGEFLAG:
2586                 str = _("The option for specifying a comma-separated list of pages to print.");
2587                 break;
2588
2589         case RC_PRINTPAPERDIMENSIONFLAG:
2590                                    str = _("Option to specify the dimensions of the print paper.");
2591                 break;
2592
2593         case RC_PRINTPAPERFLAG:
2594                 str = _("The option to specify paper type.");
2595                 break;
2596
2597         case RC_PRINTREVERSEFLAG:
2598                 str = _("The option to reverse the order of the pages printed.");
2599                 break;
2600
2601         case RC_PRINTSPOOL_COMMAND:
2602                 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.");
2603                 break;
2604
2605         case RC_PRINTSPOOL_PRINTERPREFIX:
2606                 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.");
2607                 break;
2608
2609         case RC_PRINTTOFILE:
2610                 str = _("Option to pass to the print program to print to a file.");
2611                 break;
2612
2613         case RC_PRINTTOPRINTER:
2614                 str = _("Option to pass to the print program to print on a specific printer.");
2615                 break;
2616
2617         case RC_PRINT_ADAPTOUTPUT:
2618                 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2619                 break;
2620
2621         case RC_PRINT_COMMAND:
2622                 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
2623                 break;
2624
2625         case RC_RTL_SUPPORT:
2626                 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2627                 break;
2628
2629         case RC_SCREEN_DPI:
2630                 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2631                 break;
2632
2633         case RC_SCREEN_FONT_ROMAN:
2634         case RC_SCREEN_FONT_SANS:
2635         case RC_SCREEN_FONT_TYPEWRITER:
2636                 str = _("The screen fonts used to display the text while editing.");
2637                 break;
2638
2639         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
2640         case RC_SCREEN_FONT_SANS_FOUNDRY:
2641         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2642                 break;
2643
2644         case RC_SCREEN_FONT_SCALABLE:
2645                 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.");
2646                 break;
2647
2648         case RC_SCREEN_FONT_SIZES:
2649                 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2650                 break;
2651
2652         case RC_SCREEN_ZOOM:
2653                 //xgettext:no-c-format
2654                 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2655                 break;
2656
2657         case RC_GEOMETRY_SESSION:
2658                 str = _("Allow session manager to save and restore windows geometry.");
2659                 break;
2660
2661         case RC_SERVERPIPE:
2662                 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2663                 break;
2664
2665         case RC_SET_COLOR:
2666                 break;
2667
2668         case RC_SHOW_BANNER:
2669                 str = _("De-select if you don't want the startup banner.");
2670                 break;
2671
2672         case RC_SPELL_COMMAND:
2673                 str = _("What command runs the spellchecker?");
2674                 break;
2675
2676         case RC_TEMPDIRPATH:
2677                 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2678                 break;
2679
2680         case RC_TEMPLATEPATH:
2681                 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2682                 break;
2683
2684         case RC_TEX_ALLOWS_SPACES:
2685                 break;
2686
2687         case RC_TEX_EXPECTS_WINDOWS_PATHS:
2688                 break;
2689
2690         case RC_UIFILE:
2691                 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2692                 break;
2693
2694         case RC_USER_EMAIL:
2695                 break;
2696
2697         case RC_USER_NAME:
2698                 break;
2699
2700         case RC_USETEMPDIR:
2701                 break;
2702
2703         case RC_USE_INP_ENC:
2704                 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.");
2705                 break;
2706
2707         case RC_USE_TOOLTIP:
2708                 str = _("Enable the automatic appearance of tool tips in the work area.");
2709                 break;
2710
2711         case RC_USE_PIXMAP_CACHE:
2712                 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
2713                 break;
2714
2715         case RC_USE_SPELL_LIB:
2716                 break;
2717
2718         case RC_VIEWDVI_PAPEROPTION:
2719                 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2720                 break;
2721
2722         case RC_VIEWER:
2723                 break;
2724
2725         case RC_LAST:
2726                 break;
2727         }
2728
2729         return str;
2730 }
2731 #endif
2732
2733
2734 // The global instance
2735 LyXRC lyxrc;
2736
2737 // The global copy of the system lyxrc entries (everything except preferences)
2738 LyXRC system_lyxrc;
2739
2740
2741 } // namespace lyx