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