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