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