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