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