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