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