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