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