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