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