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