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