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