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