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