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