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