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