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