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