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