]> git.lyx.org Git - lyx.git/blob - src/LyXRC.cpp
a4520de545474812293b38f58edfb0fc3b621b73
[lyx.git] / src / LyXRC.cpp
1 /**
2  * \file LyXRC.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author Jean-Marc Lasgouttes
8  * \author Angus Leeming
9  * \author John Levon
10  * \author André Pönitz
11  * \author Allan Rae
12  * \author Dekel Tsur
13  *
14  * Full author contact details are available in file CREDITS.
15  */
16
17 #include <config.h>
18
19 #include <fstream>
20 #include <iostream>
21
22 #include "LyXRC.h"
23
24 #include "support/debug.h"
25 #include "Color.h"
26 #include "Converter.h"
27 #include "Format.h"
28 #include "support/gettext.h"
29 #include "Session.h"
30 #include "Lexer.h"
31 #include "FontEnums.h"
32 #include "Mover.h"
33
34 #include "graphics/GraphicsTypes.h"
35
36 #include "support/convert.h"
37 #include "support/environment.h"
38 #include "support/filetools.h"
39 #include "support/lstrings.h"
40 #include "support/os.h"
41 #include "support/userinfo.h"
42
43 using namespace std;
44 using namespace lyx::support;
45
46 namespace lyx {
47
48 namespace os = support::os;
49
50 namespace {
51
52 // when adding something to this array keep it sorted!
53 keyword_item lyxrcTags[] = {
54         { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
55         { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION },
56         { "\\alternate_language", LyXRC::RC_ALT_LANG },
57         { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
58         { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
59         { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
60         { "\\autosave", LyXRC::RC_AUTOSAVE },
61         { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
62         { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
63         { "\\bind_file", LyXRC::RC_BINDFILE },
64         { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
65         { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
66         { "\\converter", LyXRC::RC_CONVERTER },
67         { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
68         { "\\copier", LyXRC::RC_COPIER },
69         { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
70         { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
71         { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
72         { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
73         { "\\def_file", LyXRC::RC_DEFFILE },
74         { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
75         { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
76         { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
77         { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
78         { "\\document_path", LyXRC::RC_DOCUMENTPATH },
79         { "\\escape_chars", LyXRC::RC_ESC_CHARS },
80         { "\\example_path", LyXRC::RC_EXAMPLEPATH },
81         { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
82         { "\\format", LyXRC::RC_FORMAT },
83         { "\\index_command", LyXRC::RC_INDEX_COMMAND },
84         { "\\input", LyXRC::RC_INPUT },
85         { "\\kbmap", LyXRC::RC_KBMAP },
86         { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
87         { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
88         { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
89         { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
90         { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
91         { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
92         { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
93         { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
94         { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
95         { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
96         { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
97         { "\\load_session", LyXRC::RC_LOADSESSION },
98         { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
99         { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
100         { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
101         { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
102         { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
103         { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
104         { "\\plaintext_roff_command", LyXRC::RC_PLAINTEXT_ROFF_COMMAND },
105         { "\\preview", LyXRC::RC_PREVIEW },
106         { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
107         { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
108         { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
109         { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
110         { "\\print_command", LyXRC::RC_PRINT_COMMAND },
111         { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
112         { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
113         { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
114         { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
115         { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
116         { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
117         { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
118         { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
119         { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
120         { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
121         { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
122         { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
123         { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
124         { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
125         { "\\printer", LyXRC::RC_PRINTER },
126         { "\\rtl", LyXRC::RC_RTL_SUPPORT },
127         { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
128         { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
129         { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
130         { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
131         { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
132         { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
133         { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
134         { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
135         { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
136         { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
137         { "\\serverpipe", LyXRC::RC_SERVERPIPE },
138         { "\\set_color", LyXRC::RC_SET_COLOR },
139         { "\\show_banner", LyXRC::RC_SHOW_BANNER },
140         { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
141         { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
142         { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
143         { "\\template_path", LyXRC::RC_TEMPLATEPATH },
144         { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
145         { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
146         { "\\ui_file", LyXRC::RC_UIFILE },
147         { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
148         { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
149         { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
150         { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
151         { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
152         { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
153         { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
154         // compatibility with versions older than 1.4.0 only
155         { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
156         { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
157         // compatibility with versions older than 1.4.0 only
158         { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
159         { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
160         { "\\user_email", LyXRC::RC_USER_EMAIL },
161         { "\\user_name", LyXRC::RC_USER_NAME },
162         { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
163         // compatibility with versions older than 1.4.0 only
164         { "\\viewer", LyXRC::RC_VIEWER}
165 };
166
167 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
168
169 } // namespace anon
170
171
172 LyXRC::LyXRC()
173 {
174         setDefaults();
175 }
176
177
178 void LyXRC::setDefaults() {
179         bind_file = "cua";
180         def_file = "default";
181         ui_file = "default";
182         // Get printer from the environment. If fail, use default "",
183         // assuming that everything is set up correctly.
184         printer = getEnv("PRINTER");
185         print_adapt_output = false;
186         print_command = "dvips";
187         print_evenpage_flag = "-B";
188         print_oddpage_flag = "-A";
189         print_pagerange_flag = "-pp";
190         print_copies_flag = "-c";
191         print_collcopies_flag = "-C";
192         print_reverse_flag = "-r";
193         print_landscape_flag = "-t landscape";
194         print_to_printer = "-P";
195         print_to_file = "-o ";
196         print_file_extension = ".ps";
197         print_paper_flag = "-t";
198         print_paper_dimension_flag = "-T";
199         document_path.erase();
200         view_dvi_paper_option.erase();
201         default_papersize = PAPER_DEFAULT;
202         custom_export_format = "ps";
203         chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
204         bibtex_command = "bibtex";
205         fontenc = "default";
206         index_command = "makeindex -c -q";
207         dpi = 75;
208         // Because a screen typically is wider than a piece of paper:
209         zoom = 150;
210         allow_geometry_session = true;
211         // Default LaTeX font size:
212         font_sizes[FONT_SIZE_TINY] = "5.0";
213         font_sizes[FONT_SIZE_SCRIPT] = "7.0";
214         font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
215         font_sizes[FONT_SIZE_SMALL] = "9.0";
216         font_sizes[FONT_SIZE_NORMAL] = "10.0";
217         font_sizes[FONT_SIZE_LARGE] = "12.0";
218         font_sizes[FONT_SIZE_LARGER] = "14.4";
219         font_sizes[FONT_SIZE_LARGEST] = "17.26";
220         font_sizes[FONT_SIZE_HUGE] = "20.74";
221         font_sizes[FONT_SIZE_HUGER] = "24.88";
222         use_scalable_fonts = true;
223         roman_font_name = "";
224         sans_font_name = "";
225         typewriter_font_name = "";
226         autosave = 300;
227         auto_region_delete = true;
228         auto_reset_options = false;
229         plaintext_linelen = 65;
230         num_lastfiles = maxlastfiles;
231         check_lastfiles = true;
232         use_lastfilepos = true;
233         load_session = false;
234         make_backup = true;
235         backupdir_path.erase();
236         display_graphics = graphics::ColorDisplay;
237         // Spellchecker settings:
238         use_spell_lib = true;
239         isp_command = "ispell";
240         isp_accept_compound = false;
241         isp_use_input_encoding = false;
242         isp_use_alt_lang = false;
243         isp_use_pers_dict = false;
244         isp_use_esc_chars = false;
245         use_kbmap = false;
246         rtl_support = true;
247         auto_number = true;
248         mark_foreign_language = true;
249         language_auto_begin = true;
250         language_auto_end = true;
251         language_global_options = true;
252         language_use_babel = true;
253         language_package = "\\usepackage{babel}";
254         language_command_begin = "\\selectlanguage{$$lang}";
255         language_command_local = "\\foreignlanguage{$$lang}{";
256         sort_layouts = false;
257         default_language = "english";
258         show_banner = true;
259         windows_style_tex_paths = false;
260         tex_allows_spaces = false;
261         date_insert_format = "%x";
262         cursor_follows_scrollbar = false;
263         dialogs_iconify_with_main = false;
264         label_init_length = 3;
265         preview = PREVIEW_OFF;
266         preview_hashed_labels  = false;
267         preview_scale_factor = "0.9";
268         use_converter_cache = true;
269         use_tooltip = true;
270         use_pixmap_cache = false;
271         converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
272
273         user_name = to_utf8(support::user_name());
274
275         user_email = to_utf8(support::user_email());
276 }
277
278
279 namespace {
280
281 void oldFontFormat(string & family, string & foundry)
282 {
283         if (family.empty() || family[0] != '-')
284                 return;
285         foundry = token(family, '-', 1);
286         family = token(family, '-', 2);
287         if (foundry == "*")
288                 foundry.erase();
289 }
290
291 } // namespace anon
292
293
294 int LyXRC::read(FileName const & filename)
295 {
296         Lexer lexrc(lyxrcTags, lyxrcCount);
297         if (lyxerr.debugging(Debug::PARSER))
298                 lexrc.printTable(lyxerr);
299
300         lexrc.setFile(filename);
301         if (!lexrc.isOK()) return -2;
302
303         LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
304
305         return read(lexrc);
306 }
307
308
309 int LyXRC::read(istream & is)
310 {
311         Lexer lexrc(lyxrcTags, lyxrcCount);
312         if (lyxerr.debugging(Debug::PARSER))
313                 lexrc.printTable(lyxerr);
314
315         lexrc.setStream(is);
316         if (!lexrc.isOK()) return -2;
317
318         LYXERR(Debug::LYXRC, "Reading istream...");
319
320         return read(lexrc);
321 }
322
323
324 int LyXRC::read(Lexer & lexrc)
325 {
326         if (!lexrc.isOK()) return -2;
327
328         while (lexrc.isOK()) {
329                 // By using two switches we take advantage of the compiler
330                 // telling us if we have missed a LyXRCTags element in
331                 // the second switch.
332                 // Note that this also shows a problem with Lexer since it
333                 // helps us avoid taking advantage of the strictness of the
334                 // compiler.
335
336                 int le = lexrc.lex();
337                 switch (le) {
338                 case Lexer::LEX_UNDEF:
339                         lexrc.printError("Unknown tag `$$Token'");
340                         continue;
341                 case Lexer::LEX_FEOF:
342                         continue;
343                 default: break;
344                 }
345                 switch (static_cast<LyXRCTags>(le)) {
346                 case RC_INPUT: // Include file
347                         if (lexrc.next()) {
348                                 FileName const tmp =
349                                         libFileSearch(string(),
350                                                       lexrc.getString());
351                                 if (read(tmp)) {
352                                         lexrc.printError("Error reading "
353                                                          "included file: " + tmp.absFilename());
354                                 }
355                         }
356                         break;
357                 case RC_BINDFILE:
358                         if (lexrc.next()) {
359                                 bind_file = os::internal_path(lexrc.getString());
360                         }
361                         break;
362
363                 case RC_DEFFILE:
364                         if (lexrc.next()) {
365                                 def_file = os::internal_path(lexrc.getString());
366                         }
367                         break;
368
369                 case RC_UIFILE:
370                         if (lexrc.next()) {
371                                 ui_file = os::internal_path(lexrc.getString());
372                         }
373                         break;
374
375                 case RC_AUTORESET_OPTIONS:
376                         if (lexrc.next()) {
377                                 auto_reset_options = lexrc.getBool();
378                         }
379                         break;
380
381                 case RC_DISPLAY_GRAPHICS:
382                         if (lexrc.next()) {
383                                 display_graphics = graphics::displayTranslator().find(lexrc.getString());
384                         }
385                         break;
386
387                 case RC_TEX_EXPECTS_WINDOWS_PATHS:
388                         if (lexrc.next()) {
389                                 windows_style_tex_paths = lexrc.getBool();
390                         }
391                         break;
392
393                 case RC_TEX_ALLOWS_SPACES:
394                         if (lexrc.next()) {
395                                 tex_allows_spaces = lexrc.getBool();
396                         }
397                         break;
398
399                 case RC_KBMAP:
400                         if (lexrc.next()) {
401                                 use_kbmap = lexrc.getBool();
402                         }
403                         break;
404
405                 case RC_KBMAP_PRIMARY:
406                         if (lexrc.next()) {
407                                 string const kmap(os::internal_path(lexrc.getString()));
408                                 if (kmap.empty()) {
409                                         // nothing
410                                 } else if (!libFileSearch("kbd", kmap,
411                                                           "kmap").empty()) {
412                                         primary_kbmap = kmap;
413                                 } else {
414                                         lexrc.printError("LyX: Keymap `$$Token' not found");
415                                 }
416                         }
417                         break;
418
419                 case RC_KBMAP_SECONDARY:
420                         if (lexrc.next()) {
421                                 string const kmap(os::internal_path(lexrc.getString()));
422                                 if (kmap.empty()) {
423                                         // nothing
424                                 } else if (!libFileSearch("kbd", kmap,
425                                                           "kmap").empty()) {
426                                         secondary_kbmap = kmap;
427                                 } else {
428                                         lexrc.printError("LyX: Keymap `$$Token' not found");
429                                 }
430                         }
431                         break;
432
433                 case RC_FONT_ENCODING:
434                         if (lexrc.next()) {
435                                 fontenc = lexrc.getString();
436                         }
437                         break;
438
439                 case RC_PRINTER:
440                         if (lexrc.next()) {
441                                 printer = lexrc.getString();
442                         }
443                         break;
444
445                 case RC_PRINT_COMMAND:
446                         if (lexrc.next()) {
447                                 print_command = lexrc.getString();
448                         }
449                         break;
450
451                 case RC_PRINTEVENPAGEFLAG:
452                         if (lexrc.next()) {
453                                 print_evenpage_flag = lexrc.getString();
454                         }
455                         break;
456
457                 case RC_PRINTODDPAGEFLAG:
458                         if (lexrc.next()) {
459                                 print_oddpage_flag = lexrc.getString();
460                         }
461                         break;
462
463                 case RC_PRINTPAGERANGEFLAG:
464                         if (lexrc.next()) {
465                                 print_pagerange_flag = lexrc.getString();
466                         }
467                         break;
468
469                 case RC_PRINTCOPIESFLAG:
470                         if (lexrc.next()) {
471                                 print_copies_flag = lexrc.getString();
472                         }
473                         break;
474
475                 case RC_PRINTCOLLCOPIESFLAG:
476                         if (lexrc.next()) {
477                                 print_collcopies_flag = lexrc.getString();
478                         }
479                         break;
480
481                 case RC_PRINTREVERSEFLAG:
482                         if (lexrc.next()) {
483                                 print_reverse_flag = lexrc.getString();
484                         }
485                         break;
486
487                 case RC_PRINTLANDSCAPEFLAG:
488                         if (lexrc.next()) {
489                                 print_landscape_flag = lexrc.getString();
490                         }
491                         break;
492
493                 case RC_PRINTTOPRINTER:
494                         if (lexrc.next()) {
495                                 print_to_printer = lexrc.getString();
496                         }
497                         break;
498
499                 case RC_PRINT_ADAPTOUTPUT:
500                         if (lexrc.next()) {
501                                 print_adapt_output = lexrc.getBool();
502                         }
503                         break;
504
505                 case RC_PRINTTOFILE:
506                         if (lexrc.next()) {
507                                 print_to_file = os::internal_path(lexrc.getString());
508                         }
509                         break;
510
511                 case RC_PRINTFILEEXTENSION:
512                         if (lexrc.next()) {
513                                 print_file_extension = lexrc.getString();
514                         }
515                         break;
516
517                 case RC_PRINTEXSTRAOPTIONS:
518                         if (lexrc.next()) {
519                                 print_extra_options = lexrc.getString();
520                         }
521                         break;
522
523                 case RC_PRINTSPOOL_COMMAND:
524                         if (lexrc.next()) {
525                                 print_spool_command = lexrc.getString();
526                         }
527                         break;
528
529                 case RC_PRINTSPOOL_PRINTERPREFIX:
530                         if (lexrc.next()) {
531                                 print_spool_printerprefix = lexrc.getString();
532                         }
533                         break;
534
535                 case RC_PRINTPAPERDIMENSIONFLAG:
536                         if (lexrc.next()) {
537                                 print_paper_dimension_flag = lexrc.getString();
538                         }
539                         break;
540
541                 case RC_PRINTPAPERFLAG:
542                         if (lexrc.next()) {
543                                 print_paper_flag = lexrc.getString();
544                         }
545                         break;
546
547                 case RC_CUSTOM_EXPORT_COMMAND:
548                         if (lexrc.next()) {
549                                 custom_export_command = lexrc.getString();
550                         }
551                         break;
552
553                 case RC_CUSTOM_EXPORT_FORMAT:
554                         if (lexrc.next()) {
555                                 custom_export_format = lexrc.getString();
556                         }
557                         break;
558
559                 case RC_DEFAULT_PAPERSIZE:
560                         if (lexrc.next()) {
561                                 string const size =
562                                         ascii_lowercase(lexrc.getString());
563                                 if (size == "usletter")
564                                         default_papersize =
565                                                 PAPER_USLETTER;
566                                 else if (size == "legal")
567                                         default_papersize =
568                                                 PAPER_USLEGAL;
569                                 else if (size == "executive")
570                                         default_papersize =
571                                                 PAPER_USEXECUTIVE;
572                                 else if (size == "a3")
573                                         default_papersize =
574                                                 PAPER_A3;
575                                 else if (size == "a4")
576                                         default_papersize =
577                                                 PAPER_A4;
578                                 else if (size == "a5")
579                                         default_papersize =
580                                                 PAPER_A5;
581                                 else if (size == "b5")
582                                         default_papersize =
583                                                 PAPER_B5;
584                                 else if (size == "default")
585                                         default_papersize =
586                                                 PAPER_DEFAULT;
587                         }
588                         break;
589
590                 case RC_VIEWDVI_PAPEROPTION:
591                         if (lexrc.next()) {
592                                 view_dvi_paper_option = lexrc.getString();
593                         } else {
594                                 view_dvi_paper_option.erase();
595                         }
596                         break;
597
598                 case RC_CHKTEX_COMMAND:
599                         if (lexrc.next()) {
600                                 chktex_command = lexrc.getString();
601                         }
602                         break;
603
604                 case RC_BIBTEX_COMMAND:
605                         if (lexrc.next()) {
606                                 bibtex_command = lexrc.getString();
607                         }
608                         break;
609
610                 case RC_INDEX_COMMAND:
611                         if (lexrc.next()) {
612                                 index_command = lexrc.getString();
613                         }
614                         break;
615
616                 case RC_SCREEN_DPI:
617                         if (lexrc.next()) {
618                                 dpi = lexrc.getInteger();
619                         }
620                         break;
621
622                 case RC_SCREEN_ZOOM:
623                         if (lexrc.next()) {
624                                 zoom = lexrc.getInteger();
625                         }
626                         break;
627
628                 case RC_GEOMETRY_SESSION:
629                         if (lexrc.next()) {
630                                 allow_geometry_session = lexrc.getBool();
631                         }
632                         break;
633
634                 case RC_SCREEN_FONT_SIZES:
635                         if (lexrc.next()) {
636                                 font_sizes[FONT_SIZE_TINY] =
637                                         lexrc.getString();
638                         }
639                         if (lexrc.next()) {
640                                 font_sizes[FONT_SIZE_SCRIPT] =
641                                         lexrc.getString();
642                         }
643                         if (lexrc.next()) {
644                                 font_sizes[FONT_SIZE_FOOTNOTE] =
645                                         lexrc.getString();
646                         }
647                         if (lexrc.next()) {
648                                 font_sizes[FONT_SIZE_SMALL] =
649                                         lexrc.getString();
650                         }
651                         if (lexrc.next()) {
652                                 font_sizes[FONT_SIZE_NORMAL] =
653                                         lexrc.getString();
654                         }
655                         if (lexrc.next()) {
656                                 font_sizes[FONT_SIZE_LARGE] =
657                                         lexrc.getString();
658                         }
659                         if (lexrc.next()) {
660                                 font_sizes[FONT_SIZE_LARGER] =
661                                         lexrc.getString();
662                         }
663                         if (lexrc.next()) {
664                                 font_sizes[FONT_SIZE_LARGEST] =
665                                         lexrc.getString();
666                         }
667                         if (lexrc.next()) {
668                                 font_sizes[FONT_SIZE_HUGE] =
669                                         lexrc.getString();
670                         }
671                         if (lexrc.next()) {
672                                 font_sizes[FONT_SIZE_HUGER] =
673                                         lexrc.getString();
674                         }
675                         break;
676
677                 case RC_SCREEN_FONT_SCALABLE:
678                         if (lexrc.next()) {
679                                 use_scalable_fonts = lexrc.getBool();
680                         }
681                         break;
682
683                 case RC_AUTOSAVE:
684                         if (lexrc.next()) {
685                                 autosave = lexrc.getInteger();
686                         }
687                         break;
688
689                 case RC_DOCUMENTPATH:
690                         if (lexrc.next()) {
691                                 document_path = os::internal_path(lexrc.getString());
692                                 document_path = expandPath(document_path);
693                         }
694                         break;
695
696                 case RC_EXAMPLEPATH:
697                         if (lexrc.next()) {
698                                 example_path = os::internal_path(lexrc.getString());
699                                 example_path = expandPath(example_path);
700                         }
701                         break;
702
703                 case RC_TEMPLATEPATH:
704                         if (lexrc.next()) {
705                                 template_path = os::internal_path(lexrc.getString());
706                                 template_path = expandPath(template_path);
707                         }
708                         break;
709
710                 case RC_TEMPDIRPATH:
711                         if (lexrc.next()) {
712                                 tempdir_path = os::internal_path(lexrc.getString());
713                                 tempdir_path = expandPath(tempdir_path);
714                         }
715                         break;
716
717                 case RC_USETEMPDIR:
718                         if (lexrc.next()) {
719                                 lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
720                         }
721                         break;
722
723                 case RC_USELASTFILEPOS:
724                         if (lexrc.next()) {
725                                 use_lastfilepos = lexrc.getBool();
726                         }
727                         break;
728
729                 case RC_LOADSESSION:
730                         if (lexrc.next()) {
731                                 load_session = lexrc.getBool();
732                         }
733                         break;
734
735                 case RC_NUMLASTFILES:
736                         if (lexrc.next()) {
737                                 num_lastfiles = lexrc.getInteger();
738                         }
739                         break;
740
741                 case RC_CHECKLASTFILES:
742                         if (lexrc.next()) {
743                                 check_lastfiles = lexrc.getBool();
744                         }
745                         break;
746
747                 case RC_SCREEN_FONT_ROMAN:
748                         if (lexrc.next()) {
749                                 roman_font_name = lexrc.getString();
750                                 oldFontFormat(roman_font_name,
751                                               roman_font_foundry);
752                         }
753                         break;
754
755                 case RC_SCREEN_FONT_SANS:
756                         if (lexrc.next()) {
757                                 sans_font_name = lexrc.getString();
758                                 oldFontFormat(sans_font_name, sans_font_foundry);
759                         }
760                         break;
761
762                 case RC_SCREEN_FONT_TYPEWRITER:
763                         if (lexrc.next()) {
764                                 typewriter_font_name = lexrc.getString();
765                                 oldFontFormat(typewriter_font_name,
766                                               typewriter_font_foundry);
767                         }
768                         break;
769
770                 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
771                         if (lexrc.next()) {
772                                 roman_font_foundry = lexrc.getString();
773                         }
774                         break;
775
776                 case RC_SCREEN_FONT_SANS_FOUNDRY:
777                         if (lexrc.next()) {
778                                 sans_font_foundry = lexrc.getString();
779                         }
780                         break;
781
782                 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
783                         if (lexrc.next()) {
784                                 typewriter_font_foundry = lexrc.getString();
785                         }
786                         break;
787
788                 case RC_SET_COLOR:
789                 {
790                         string lyx_name, x11_name;
791
792                         if (lexrc.next()) {
793                                 lyx_name = lexrc.getString();
794                         } else {
795                                 lexrc.printError("Missing color tag.");
796                                 break;
797                         }
798
799                         if (lexrc.next()) {
800                                 x11_name = lexrc.getString();
801                         } else {
802                                 lexrc.printError("Missing color name for color: `$$Token'");
803                                 break;
804                         }
805
806                         ColorCode const col =
807                                 lcolor.getFromLyXName(lyx_name);
808                         if (col == Color_none ||
809                             col == Color_inherit ||
810                             col == Color_ignore)
811                                 break;
812
813                         if (!lcolor.setColor(col, x11_name)) {
814                                 lyxerr << "Bad lyxrc set_color for "
815                                         << lyx_name << endl;
816
817                         }
818                         break;
819                 }
820                 case RC_AUTOREGIONDELETE:
821                         // Auto region delete defaults to true
822                         if (lexrc.next()) {
823                                 auto_region_delete = lexrc.getBool();
824                         }
825                         break;
826
827                 case RC_SERVERPIPE:
828                         if (lexrc.next()) {
829                                 lyxpipes = os::internal_path(lexrc.getString());
830                                 lyxpipes = expandPath(lyxpipes);
831                         }
832                         break;
833
834                 case RC_CURSOR_FOLLOWS_SCROLLBAR:
835                         if (lexrc.next()) {
836                                 cursor_follows_scrollbar = lexrc.getBool();
837                         }
838                         break;
839
840                 case RC_DIALOGS_ICONIFY_WITH_MAIN:
841                         if (lexrc.next()) {
842                                 dialogs_iconify_with_main = lexrc.getBool();
843                         }
844                         break;
845
846                 case RC_PLAINTEXT_ROFF_COMMAND:
847                         if (lexrc.next()) {
848                                 plaintext_roff_command = lexrc.getString();
849                         }
850                         break;
851                 case RC_PLAINTEXT_LINELEN:
852                         if (lexrc.next()) {
853                                 plaintext_linelen = lexrc.getInteger();
854                         }
855                         break;
856                         // Spellchecker settings:
857                 case RC_USE_SPELL_LIB:
858                         if (lexrc.next()) {
859                                 use_spell_lib = lexrc.getBool();
860                         }
861                         break;
862                 case RC_SPELL_COMMAND:
863                         if (lexrc.next()) {
864                                 isp_command = lexrc.getString();
865                         }
866                         break;
867                 case RC_ACCEPT_COMPOUND:
868                         if (lexrc.next()) {
869                                 isp_accept_compound = lexrc.getBool();
870                         }
871                         break;
872                 case RC_USE_INP_ENC:
873                         if (lexrc.next()) {
874                                 isp_use_input_encoding = lexrc.getBool();
875                         }
876                         break;
877                 case RC_USE_ALT_LANG:
878                         if (lexrc.next()) {
879                                 isp_use_alt_lang = lexrc.getBool();
880                         }
881                         break;
882                 case RC_USE_PERS_DICT:
883                         if (lexrc.next()) {
884                                 isp_use_pers_dict = lexrc.getBool();
885                         }
886                         break;
887                 case RC_USE_TOOLTIP:
888                         if (lexrc.next()) {
889                                 use_tooltip = 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 = 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 pair<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_TOOLTIP:
2065                 if (ignore_system_lyxrc ||
2066                     use_tooltip != system_lyxrc.use_tooltip) {
2067                         os << "\\use_tooltip "
2068                            << convert<string>(use_tooltip)
2069                            << '\n';
2070                 }
2071         case RC_USE_PIXMAP_CACHE:
2072                 if (ignore_system_lyxrc ||
2073                     use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2074                         os << "\\use_pixmap_cache "
2075                            << convert<string>(use_pixmap_cache)
2076                            << '\n';
2077                 }
2078         case RC_PERS_DICT:
2079                 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
2080                         string const path = os::external_path(isp_pers_dict);
2081                         os << "\\personal_dictionary \"" << path << "\"\n";
2082                 }
2083                 if (tag != RC_LAST)
2084                         break;
2085         case RC_USE_INP_ENC:
2086                 if (ignore_system_lyxrc ||
2087                     isp_use_input_encoding
2088                     != system_lyxrc.isp_use_input_encoding) {
2089                         os << "\\use_input_encoding "
2090                            << convert<string>(isp_use_input_encoding)
2091                            << '\n';
2092                 }
2093                 if (tag != RC_LAST)
2094                         break;
2095
2096                 os << "\n#\n"
2097                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
2098                    << "#\n\n";
2099
2100         case RC_RTL_SUPPORT:
2101                 if (ignore_system_lyxrc ||
2102                     rtl_support != system_lyxrc.rtl_support) {
2103                         os << "\\rtl " << convert<string>(rtl_support) << '\n';
2104                 }
2105                 if (tag != RC_LAST)
2106                         break;
2107         case RC_LANGUAGE_PACKAGE:
2108                 if (ignore_system_lyxrc ||
2109                     language_package != system_lyxrc.language_package) {
2110                         os << "\\language_package \"" << language_package
2111                            << "\"\n";
2112                 }
2113                 if (tag != RC_LAST)
2114                         break;
2115         case RC_LANGUAGE_GLOBAL_OPTIONS:
2116                 if (ignore_system_lyxrc ||
2117                     language_global_options
2118                     != system_lyxrc.language_global_options) {
2119                         os << "\\language_global_options \""
2120                            << convert<string>(language_global_options)
2121                            << "\"\n";
2122                 }
2123                 if (tag != RC_LAST)
2124                         break;
2125         case RC_LANGUAGE_USE_BABEL:
2126                 if (ignore_system_lyxrc ||
2127                     language_use_babel != system_lyxrc.language_use_babel) {
2128                         os << "\\language_use_babel \""
2129                            << convert<string>(language_use_babel)
2130                            << "\"\n";
2131                 }
2132                 if (tag != RC_LAST)
2133                         break;
2134         case RC_LANGUAGE_COMMAND_BEGIN:
2135                 if (ignore_system_lyxrc ||
2136                     language_command_begin
2137                     != system_lyxrc.language_command_begin) {
2138                         os << "\\language_command_begin \""
2139                            << language_command_begin
2140                            << "\"\n";
2141                 }
2142                 if (tag != RC_LAST)
2143                         break;
2144         case RC_LANGUAGE_COMMAND_END:
2145                 if (ignore_system_lyxrc ||
2146                     language_command_end
2147                     != system_lyxrc.language_command_end) {
2148                         os << "\\language_command_end \"" << language_command_end
2149                            << "\"\n";
2150                 }
2151                 if (tag != RC_LAST)
2152                         break;
2153         case RC_LANGUAGE_COMMAND_LOCAL:
2154                 if (ignore_system_lyxrc ||
2155                     language_command_local
2156                     != system_lyxrc.language_command_local) {
2157                         os << "\\language_command_local \""
2158                            << language_command_local
2159                            << "\"\n";
2160                 }
2161                 if (tag != RC_LAST)
2162                         break;
2163         case RC_LANGUAGE_AUTO_BEGIN:
2164                 if (ignore_system_lyxrc ||
2165                     language_auto_begin != system_lyxrc.language_auto_begin) {
2166                         os << "\\language_auto_begin "
2167                            << convert<string>(language_auto_begin) << '\n';
2168                 }
2169                 if (tag != RC_LAST)
2170                         break;
2171         case RC_LANGUAGE_AUTO_END:
2172                 if (ignore_system_lyxrc ||
2173                     language_auto_end != system_lyxrc.language_auto_end) {
2174                         os << "\\language_auto_end "
2175                            << convert<string>(language_auto_end) << '\n';
2176                 }
2177                 if (tag != RC_LAST)
2178                         break;
2179         case RC_MARK_FOREIGN_LANGUAGE:
2180                 if (ignore_system_lyxrc ||
2181                     mark_foreign_language
2182                     != system_lyxrc.mark_foreign_language) {
2183                         os << "\\mark_foreign_language " <<
2184                                 convert<string>(mark_foreign_language) << '\n';
2185                 }
2186                 if (tag != RC_LAST)
2187                         break;
2188
2189                 os << "\n#\n"
2190                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
2191                    << "#\n\n";
2192
2193         case RC_AUTO_NUMBER:
2194                 if (ignore_system_lyxrc ||
2195                     auto_number != system_lyxrc.auto_number) {
2196                         os << "\\auto_number " << convert<string>(auto_number) << '\n';
2197                 }
2198                 if (tag != RC_LAST)
2199                         break;
2200         case RC_DEFAULT_LANGUAGE:
2201                 if (ignore_system_lyxrc ||
2202                     default_language != system_lyxrc.default_language) {
2203                         os << "\\default_language " << default_language << '\n';
2204                 }
2205                 if (tag != RC_LAST)
2206                         break;
2207
2208                 os << "\n#\n"
2209                    << "# FORMATS SECTION ##########################\n"
2210                    << "#\n\n";
2211
2212         case RC_FORMAT:
2213                 // New/modified formats
2214                 for (Formats::const_iterator cit = formats.begin();
2215                      cit != formats.end(); ++cit) {
2216                         Format const * format =
2217                                 system_formats.getFormat(cit->name());
2218                         if (!format ||
2219                             format->extension() != cit->extension() ||
2220                             format->prettyname() != cit->prettyname() ||
2221                             format->shortcut() != cit->shortcut() ||
2222                             format->viewer() != cit->viewer() ||
2223                             format->editor() != cit->editor() ||
2224                             format->documentFormat() != cit->documentFormat() ||
2225                             format->vectorFormat() != cit->vectorFormat()) {
2226                                 os << "\\format \"" << cit->name() << "\" \""
2227                                    << cit->extension() << "\" \""
2228                                    << cit->prettyname() << "\" \""
2229                                    << cit->shortcut() << "\" \""
2230                                    << cit->viewer() << "\" \""
2231                                    << cit->editor() << "\" \"";
2232                                 vector<string> flags;
2233                                 if (cit->documentFormat())
2234                                         flags.push_back("document");
2235                                 if (cit->vectorFormat())
2236                                         flags.push_back("vector");
2237                                 os << getStringFromVector(flags);
2238                                 os << "\"\n";
2239                         }
2240                 }
2241
2242                 // Look for deleted formats
2243                 for (Formats::const_iterator cit = system_formats.begin();
2244                      cit != system_formats.end(); ++cit)
2245                         if (!formats.getFormat(cit->name()))
2246                                 os << "\\format \"" << cit->name()
2247                                    << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2248                 if (tag != RC_LAST)
2249                         break;
2250         case RC_VIEWER:
2251                 // Ignore it
2252                 if (tag != RC_LAST)
2253                         break;
2254
2255                 os << "\n#\n"
2256                    << "# CONVERTERS SECTION ##########################\n"
2257                    << "#\n\n";
2258
2259         case RC_CONVERTER:
2260                 // Look for new converters
2261                 for (Converters::const_iterator cit = theConverters().begin();
2262                      cit != theConverters().end(); ++cit) {
2263                         Converter const * converter =
2264                                 theSystemConverters().getConverter(cit->from,
2265                                                                cit->to);
2266                         if (!converter ||
2267                             converter->command != cit->command ||
2268                             converter->flags != cit->flags)
2269                                 os << "\\converter \"" << cit->from << "\" \""
2270                                    << cit->to << "\" \""
2271                                    << cit->command << "\" \""
2272                                    << cit->flags << "\"\n";
2273                 }
2274
2275                 // New/modifed converters
2276                 for (Converters::const_iterator cit = theSystemConverters().begin();
2277                      cit != theSystemConverters().end(); ++cit)
2278                         if (!theConverters().getConverter(cit->from, cit->to))
2279                                 os << "\\converter \"" << cit->from
2280                                    << "\" \"" << cit->to << "\" \"\" \"\"\n";
2281                 if (tag != RC_LAST)
2282                         break;
2283
2284         case RC_COPIER:
2285                 if (tag == RC_LAST)
2286                         os << "\n#\n"
2287                            << "# COPIERS SECTION ##########################\n"
2288                            << "#\n\n";
2289
2290                 // Look for new movers
2291                 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2292                 Movers::const_iterator const sysend = theSystemMovers().end();
2293                 Movers::const_iterator it = theMovers().begin();
2294                 Movers::const_iterator end = theMovers().end();
2295
2296                 for (; it != end; ++it) {
2297                         Movers::const_iterator const sysit =
2298                                 find_if(sysbegin, sysend, SameMover(*it));
2299                         if (sysit == sysend) {
2300                                 string const & fmt = it->first;
2301                                 string const & command =
2302                                         it->second.command();
2303
2304                                 os << "\\copier " << fmt
2305                                    << " \"" << command << "\"\n";
2306                         }
2307                 }
2308                 if (tag != RC_LAST)
2309                         break;
2310
2311                 // We don't actually delete SpecialisedMover(s) from the
2312                 // map, just clear their 'command', so there's no need
2313                 // to test for anything else.
2314         }
2315
2316         os.flush();
2317 }
2318
2319
2320 #if 0
2321 string const LyXRC::getDescription(LyXRCTags tag)
2322 {
2323         docstring str;
2324
2325         switch (tag) {
2326         case RC_ACCEPT_COMPOUND:
2327                 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2328                 break;
2329
2330         case RC_ALT_LANG:
2331         case RC_USE_ALT_LANG:
2332                 str = _("Specify an alternate language. The default is to use the language of the document.");
2333                 break;
2334
2335         case RC_PLAINTEXT_ROFF_COMMAND:
2336                 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.");
2337                 break;
2338
2339         case RC_PLAINTEXT_LINELEN:
2340                 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.");
2341                 break;
2342
2343         case RC_AUTOREGIONDELETE:
2344                 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2345                 break;
2346
2347         case RC_AUTORESET_OPTIONS:
2348                 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2349                 break;
2350
2351         case RC_AUTOSAVE:
2352                 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2353                 break;
2354
2355         case RC_AUTO_NUMBER:
2356                 break;
2357
2358         case RC_BACKUPDIR_PATH:
2359                 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.");
2360                 break;
2361
2362         case RC_BIBTEX_COMMAND:
2363                 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2364                 break;
2365
2366         case RC_BINDFILE:
2367                 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2368                 break;
2369
2370         case RC_CHECKLASTFILES:
2371                 str = _("Select to check whether the lastfiles still exist.");
2372                 break;
2373
2374         case RC_CHKTEX_COMMAND:
2375                 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2376                 break;
2377
2378         case RC_CONVERTER:
2379                 break;
2380
2381         case RC_COPIER:
2382                 break;
2383
2384         case RC_CURSOR_FOLLOWS_SCROLLBAR:
2385                 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.");
2386                 break;
2387
2388         case RC_CUSTOM_EXPORT_COMMAND:
2389                 break;
2390
2391         case RC_CUSTOM_EXPORT_FORMAT:
2392                 break;
2393
2394         case RC_DATE_INSERT_FORMAT:
2395                 //xgettext:no-c-format
2396                 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2397                 break;
2398
2399         case RC_DEFFILE:
2400                 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
2401                 break;
2402
2403         case RC_DEFAULT_LANGUAGE:
2404                 str = _("New documents will be assigned this language.");
2405                 break;
2406
2407         case RC_DEFAULT_PAPERSIZE:
2408                 str = _("Specify the default paper size.");
2409                 break;
2410
2411         case RC_DIALOGS_ICONIFY_WITH_MAIN:
2412                 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2413                 break;
2414
2415         case RC_DISPLAY_GRAPHICS:
2416                 str = _("Select how LyX will display any graphics.");
2417                 break;
2418
2419         case RC_DOCUMENTPATH:
2420                 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2421                 break;
2422
2423         case RC_ESC_CHARS:
2424         case RC_USE_ESC_CHARS:
2425                 str = _("Specify additional chars that can be part of a word.");
2426                 break;
2427
2428         case RC_EXAMPLEPATH:
2429                 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
2430                 break;
2431
2432         case RC_FONT_ENCODING:
2433                 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
2434                 break;
2435
2436         case RC_FORMAT:
2437                 break;
2438
2439         case RC_INDEX_COMMAND:
2440                 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\".");
2441                 break;
2442
2443         case RC_INPUT:
2444                 break;
2445
2446         case RC_KBMAP:
2447         case RC_KBMAP_PRIMARY:
2448         case RC_KBMAP_SECONDARY:
2449                 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.");
2450                 break;
2451
2452         case RC_LABEL_INIT_LENGTH:
2453                 str = _("Maximum number of words in the initialization string for a new label");
2454                 break;
2455
2456         case RC_LANGUAGE_AUTO_BEGIN:
2457                 str = _("Select if a language switching command is needed at the beginning of the document.");
2458                 break;
2459
2460         case RC_LANGUAGE_AUTO_END:
2461                 str = _("Select if a language switching command is needed at the end of the document.");
2462                 break;
2463
2464         case RC_LANGUAGE_COMMAND_BEGIN:
2465                 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.");
2466                 break;
2467
2468         case RC_LANGUAGE_COMMAND_END:
2469                 str = _("The LaTeX command for changing back to the language of the document.");
2470                 break;
2471
2472         case RC_LANGUAGE_COMMAND_LOCAL:
2473                 str = _("The LaTeX command for local changing of the language.");
2474                 break;
2475
2476         case RC_LANGUAGE_GLOBAL_OPTIONS:
2477                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2478                 break;
2479
2480         case RC_LANGUAGE_PACKAGE:
2481                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2482                 break;
2483
2484         case RC_LANGUAGE_USE_BABEL:
2485                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2486                 break;
2487
2488         case RC_USELASTFILEPOS:
2489                 str = _("De-select if you do not want LyX to scroll to saved position.");
2490                 break;
2491
2492         case RC_LOADSESSION:
2493                 str = _("De-select to prevent loading files opened from the last LyX session.");
2494                 break;
2495
2496         case RC_MAKE_BACKUP:
2497                 str = _("De-select if you don't want LyX to create backup files.");
2498                 break;
2499
2500         case RC_MARK_FOREIGN_LANGUAGE:
2501                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2502                 break;
2503
2504         case RC_NUMLASTFILES:
2505                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
2506                         maxlastfiles);
2507                 break;
2508
2509         case RC_PATH_PREFIX:
2510                 str = _("Specify those directories which should be "
2511                          "prepended to the PATH environment variable. "
2512                          "Use the OS native format.");
2513                 break;
2514
2515         case RC_PERS_DICT:
2516         case RC_USE_PERS_DICT:
2517                 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2518                 break;
2519
2520         case RC_PREVIEW:
2521                 str = _("Shows a typeset preview of things such as math");
2522                 break;
2523
2524         case RC_PREVIEW_HASHED_LABELS:
2525                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2526                 break;
2527
2528         case RC_PREVIEW_SCALE_FACTOR:
2529                 str = _("Scale the preview size to suit.");
2530                 break;
2531
2532         case RC_PRINTCOLLCOPIESFLAG:
2533                 str = _("The option for specifying whether the copies should be collated.");
2534                 break;
2535
2536         case RC_PRINTCOPIESFLAG:
2537                 str = _("The option for specifying the number of copies to print.");
2538                 break;
2539
2540         case RC_PRINTER:
2541                 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
2542                 break;
2543
2544         case RC_PRINTEVENPAGEFLAG:
2545                 str = _("The option to print only even pages.");
2546                 break;
2547
2548         case RC_PRINTEXSTRAOPTIONS:
2549                 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2550                 break;
2551
2552         case RC_PRINTFILEEXTENSION:
2553                 str = _("Extension of printer program output file. Usually \".ps\".");
2554                 break;
2555
2556         case RC_PRINTLANDSCAPEFLAG:
2557                 str = _("The option to print out in landscape.");
2558                 break;
2559
2560         case RC_PRINTODDPAGEFLAG:
2561                 str = _("The option to print only odd pages.");
2562                 break;
2563
2564         case RC_PRINTPAGERANGEFLAG:
2565                 str = _("The option for specifying a comma-separated list of pages to print.");
2566                 break;
2567
2568         case RC_PRINTPAPERDIMENSIONFLAG:
2569                                    str = _("Option to specify the dimensions of the print paper.");
2570                 break;
2571
2572         case RC_PRINTPAPERFLAG:
2573                 str = _("The option to specify paper type.");
2574                 break;
2575
2576         case RC_PRINTREVERSEFLAG:
2577                 str = _("The option to reverse the order of the pages printed.");
2578                 break;
2579
2580         case RC_PRINTSPOOL_COMMAND:
2581                 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.");
2582                 break;
2583
2584         case RC_PRINTSPOOL_PRINTERPREFIX:
2585                 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.");
2586                 break;
2587
2588         case RC_PRINTTOFILE:
2589                 str = _("Option to pass to the print program to print to a file.");
2590                 break;
2591
2592         case RC_PRINTTOPRINTER:
2593                 str = _("Option to pass to the print program to print on a specific printer.");
2594                 break;
2595
2596         case RC_PRINT_ADAPTOUTPUT:
2597                 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2598                 break;
2599
2600         case RC_PRINT_COMMAND:
2601                 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
2602                 break;
2603
2604         case RC_RTL_SUPPORT:
2605                 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2606                 break;
2607
2608         case RC_SCREEN_DPI:
2609                 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2610                 break;
2611
2612         case RC_SCREEN_FONT_ROMAN:
2613         case RC_SCREEN_FONT_SANS:
2614         case RC_SCREEN_FONT_TYPEWRITER:
2615                 str = _("The screen fonts used to display the text while editing.");
2616                 break;
2617
2618         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
2619         case RC_SCREEN_FONT_SANS_FOUNDRY:
2620         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2621                 break;
2622
2623         case RC_SCREEN_FONT_SCALABLE:
2624                 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.");
2625                 break;
2626
2627         case RC_SCREEN_FONT_SIZES:
2628                 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2629                 break;
2630
2631         case RC_SCREEN_ZOOM:
2632                 //xgettext:no-c-format
2633                 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2634                 break;
2635
2636         case RC_GEOMETRY_SESSION:
2637                 str = _("Allow session manager to save and restore windows geometry.");
2638                 break;
2639
2640         case RC_SERVERPIPE:
2641                 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2642                 break;
2643
2644         case RC_SET_COLOR:
2645                 break;
2646
2647         case RC_SHOW_BANNER:
2648                 str = _("De-select if you don't want the startup banner.");
2649                 break;
2650
2651         case RC_SPELL_COMMAND:
2652                 str = _("What command runs the spellchecker?");
2653                 break;
2654
2655         case RC_TEMPDIRPATH:
2656                 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2657                 break;
2658
2659         case RC_TEMPLATEPATH:
2660                 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2661                 break;
2662
2663         case RC_TEX_ALLOWS_SPACES:
2664                 break;
2665
2666         case RC_TEX_EXPECTS_WINDOWS_PATHS:
2667                 break;
2668
2669         case RC_UIFILE:
2670                 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2671                 break;
2672
2673         case RC_USER_EMAIL:
2674                 break;
2675
2676         case RC_USER_NAME:
2677                 break;
2678
2679         case RC_USETEMPDIR:
2680                 break;
2681
2682         case RC_USE_INP_ENC:
2683                 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.");
2684                 break;
2685
2686         case RC_USE_TOOLTIP:
2687                 str = _("Enable the automatic appearance of tool tips in the work area.");
2688                 break;
2689
2690         case RC_USE_PIXMAP_CACHE:
2691                 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
2692                 break;
2693
2694         case RC_USE_SPELL_LIB:
2695                 break;
2696
2697         case RC_VIEWDVI_PAPEROPTION:
2698                 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2699                 break;
2700
2701         case RC_VIEWER:
2702                 break;
2703
2704         case RC_LAST:
2705                 break;
2706         }
2707
2708         return str;
2709 }
2710 #endif
2711
2712
2713 // The global instance
2714 LyXRC lyxrc;
2715
2716 // The global copy of the system lyxrc entries (everything except preferences)
2717 LyXRC system_lyxrc;
2718
2719
2720 } // namespace lyx