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