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