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