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