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