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