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