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