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