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