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