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