]> git.lyx.org Git - lyx.git/blob - src/lyxrc.C
Rename screen, and don't re-construct it on a buffer change (that is far too
[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 keyword_item lyxrcTags[] = {
47         { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
48         { "\\alternate_language", LyXRC::RC_ALT_LANG },
49         { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
50         { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
51         { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
52         { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
53         { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
54         { "\\autosave", LyXRC::RC_AUTOSAVE },
55         { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
56         { "\\bind", LyXRC::RC_BIND },
57         { "\\bind_file", LyXRC::RC_BINDFILE },
58         { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
59         { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
60         { "\\converter", LyXRC::RC_CONVERTER },
61         { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
62         { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
63         { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
64         { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
65         { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
66         { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
67         { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
68         { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
69         { "\\display_shortcuts", LyXRC::RC_DISPLAY_SHORTCUTS },
70         { "\\document_path", LyXRC::RC_DOCUMENTPATH },
71         { "\\escape_chars", LyXRC::RC_ESC_CHARS },
72         { "\\exit_confirmation", LyXRC::RC_EXIT_CONFIRMATION },
73         { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
74         { "\\format", LyXRC::RC_FORMAT },
75         { "\\input", LyXRC::RC_INPUT },
76         { "\\kbmap", LyXRC::RC_KBMAP },
77         { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
78         { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
79         { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
80         { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
81         { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
82         { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
83         { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
84         { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
85         { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
86         { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
87         { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
88         { "\\lastfiles", LyXRC::RC_LASTFILES },
89         { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
90         { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
91         { "\\new_ask_filename", LyXRC::RC_NEW_ASK_FILENAME },
92         { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
93         { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS },
94         { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
95         { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
96         { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
97         { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
98         { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
99         { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
100         { "\\print_command", LyXRC::RC_PRINT_COMMAND },
101         { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
102         { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
103         { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
104         { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
105         { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
106         { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
107         { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
108         { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
109         { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
110         { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
111         { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
112         { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
113         { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
114         { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
115         { "\\printer", LyXRC::RC_PRINTER },
116         { "\\ps_command", LyXRC::RC_PS_COMMAND },
117         { "\\rtl", LyXRC::RC_RTL_SUPPORT },
118         { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
119         { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
120         // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
121         { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
122         // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
123         { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
124         // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
125         { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
126         { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
127         { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
128         { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
129         { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
130         { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
131         { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
132         { "\\serverpipe", LyXRC::RC_SERVERPIPE },
133         { "\\set_color", LyXRC::RC_SET_COLOR },
134         { "\\show_banner", LyXRC::RC_SHOW_BANNER },
135         { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
136         { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
137         { "\\template_path", LyXRC::RC_TEMPLATEPATH },
138         { "\\ui_file", LyXRC::RC_UIFILE },
139         { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
140         { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
141         { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
142         { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
143 #ifdef USE_PSPELL
144         { "\\use_pspell", LyXRC::RC_USE_PSPELL },
145 #endif
146         { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
147         { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
148         { "\\viewer" ,LyXRC::RC_VIEWER},
149         { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
150 };
151
152 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
153
154 } // namespace anon
155
156
157 LyXRC::LyXRC()
158 {
159         setDefaults();
160 }
161
162
163 void LyXRC::setDefaults() {
164         bind_file = "cua";
165         hasBindFile = false;
166         ui_file = "default";
167         // Get printer from the environment. If fail, use default "",
168         // assuming that everything is set up correctly.
169         printer = GetEnv("PRINTER");
170         print_adapt_output = false;
171         print_command = "dvips";
172         print_evenpage_flag = "-B";
173         print_oddpage_flag = "-A";
174         print_pagerange_flag = "-pp";
175         print_copies_flag = "-c";
176         print_collcopies_flag = "-C";
177         print_reverse_flag = "-r";
178         print_landscape_flag = "-t landscape";
179         print_to_printer = "-P";
180         print_to_file = "-o ";
181         print_file_extension = ".ps";
182         print_paper_flag = "-t";
183         print_paper_dimension_flag = "-T";
184         document_path.erase();
185         tempdir_path = "/tmp";
186         use_tempdir = true;
187         ps_command = "gs";
188         view_dvi_paper_option.erase();
189         default_papersize = BufferParams::PAPER_USLETTER;
190         custom_export_format = "ps";
191         chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
192         fontenc = "default";
193         dpi = 75;
194         // Because a screen typically is wider than a piece of paper:
195         zoom = 150;
196         wheel_jump = 100;
197         // Default LaTeX font size:
198         font_sizes[LyXFont::SIZE_TINY] = 5.0;
199         font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
200         font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
201         font_sizes[LyXFont::SIZE_SMALL] = 9.0;
202         font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
203         font_sizes[LyXFont::SIZE_LARGE] = 12.0;
204         font_sizes[LyXFont::SIZE_LARGER] = 14.4;
205         font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
206         font_sizes[LyXFont::SIZE_HUGE] = 20.74;
207         font_sizes[LyXFont::SIZE_HUGER] = 24.88;
208         use_scalable_fonts = true;
209         roman_font_name = "-*-times";
210         sans_font_name = "-*-helvetica";
211         typewriter_font_name = "-*-courier";
212         popup_bold_font = "-*-helvetica-bold-r";
213         popup_normal_font = "-*-helvetica-medium-r";
214         font_norm = "iso8859-1";
215         font_norm_type = ISO_8859_1;
216         popup_font_encoding.erase();
217         override_x_deadkeys = true;
218         autosave = 300;
219         auto_region_delete = true;
220         auto_reset_options = false;
221         ascii_linelen = 65;
222         num_lastfiles = 4;
223         check_lastfiles = true;
224         make_backup = true;
225         backupdir_path.erase();
226         exit_confirmation = true;
227         display_graphics = "color";
228         display_shortcuts = true;
229         // Spellchecker settings:
230 #ifdef USE_PSPELL
231         use_pspell = true;
232 #endif
233         isp_command = "ispell";
234         isp_accept_compound = false;
235         isp_use_input_encoding = false;
236         isp_use_alt_lang = false;
237         isp_use_pers_dict = false;
238         isp_use_esc_chars = false;
239         use_kbmap = false;
240         rtl_support = false;
241         auto_number = true;
242         mark_foreign_language = true;
243         language_auto_begin = true;
244         language_auto_end = true;
245         language_global_options = true;
246         language_use_babel = true;
247         language_package = "\\usepackage{babel}";
248         language_command_begin = "\\selectlanguage{$$lang}";
249         language_command_local = "\\foreignlanguage{$$lang}{";
250         default_language = "english";
251         //
252         new_ask_filename = false;
253
254         //
255         date_insert_format = "%A, %e %B %Y";
256         show_banner = true;
257         cursor_follows_scrollbar = false;
258         dialogs_iconify_with_main = false;
259         label_init_length = 3;
260
261         /// These variables are not stored on disk (perhaps they
262         // should be moved from the LyXRC class).
263         use_gui = true;
264         pdf_mode = false;
265 }
266
267
268 int LyXRC::ReadBindFile(string const & name)
269 {
270         hasBindFile = true;
271         string const tmp = i18nLibFileSearch("bind", name, "bind");
272         lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
273         int const result = read(tmp);
274         if (result) {
275                 lyxerr << "Error reading bind file: " << tmp << endl;
276         }
277         return result;
278 }
279
280 void LyXRC::readBindFileIfNeeded()
281 {
282         if (!hasBindFile)
283                 ReadBindFile(bind_file);
284 }
285
286
287 int LyXRC::read(string const & filename)
288 {
289         LyXLex lexrc(lyxrcTags, lyxrcCount);
290         if (lyxerr.debugging(Debug::PARSER))
291                 lexrc.printTable(lyxerr);
292
293         lexrc.setFile(filename);
294         if (!lexrc.isOK()) return -2;
295
296         lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
297
298         while (lexrc.isOK()) {
299                 // By using two switches we take advantage of the compiler
300                 // telling us if we have missed a LyXRCTags element in
301                 // the second switch.
302                 // Note that this also shows a problem with LyXLex since it
303                 // helps us avoid taking advantage of the strictness of the
304                 // compiler.
305
306                 int le = lexrc.lex();
307                 switch (le) {
308                 case LyXLex::LEX_UNDEF:
309                         lexrc.printError("Unknown tag `$$Token'");
310                         continue;
311                 case LyXLex::LEX_FEOF:
312                         continue;
313                 default: break;
314                 }
315                 switch (static_cast<LyXRCTags>(le)) {
316                 case RC_INPUT: // Include file
317                         if (lexrc.next()) {
318                                 string const tmp =
319                                         LibFileSearch(string(),
320                                                       lexrc.getString());
321                                 if (read(tmp)) {
322                                         lexrc.printError("Error reading "
323                                                          "included file: "+tmp);
324                                 }
325                         }
326                         break;
327                 case RC_BINDFILE:                     // RVDK_PATCH_5
328                         if (lexrc.next()) {
329                                 string const tmp(lexrc.getString());
330                                 if (hasBindFile)
331                                         // We are already in the
332                                         // "actually read bind file"
333                                         // mode.
334                                         ReadBindFile(tmp);
335                                 else
336                                         // We are still in the "just
337                                         // remember the name of the
338                                         // bind file" mode.
339                                         bind_file = tmp;
340                         }
341                         break;
342
343                 case RC_UIFILE:
344                         if (lexrc.next()) {
345                                 ui_file = lexrc.getString();
346                         }
347                         break;
348
349                 case RC_EXIT_CONFIRMATION:
350                         if (lexrc.next())
351                                 exit_confirmation = lexrc.getBool();
352                         break;
353
354                 case RC_AUTORESET_OPTIONS:
355                         if (lexrc.next())
356                                 auto_reset_options = lexrc.getBool();
357                         break;
358
359                 case RC_DISPLAY_GRAPHICS:
360                         if (lexrc.next())
361                                 display_graphics = lexrc.getString();
362                         break;
363
364                 case RC_DISPLAY_SHORTCUTS:
365                         if (lexrc.next())
366                                 display_shortcuts = lexrc.getBool();
367                         break;
368
369                 case RC_KBMAP:
370                         if (lexrc.next())
371                                 use_kbmap = lexrc.getBool();
372                         break;
373
374                 case RC_KBMAP_PRIMARY:
375                         if (lexrc.next()) {
376                                 string const kmap(lexrc.getString());
377                                 if (kmap.empty()) {
378                                         // nothing
379                                 } else if (!LibFileSearch("kbd", kmap,
380                                                           "kmap").empty())
381                                         primary_kbmap = kmap;
382                                 else
383                                         lexrc.printError("LyX: Keymap `$$Token' not found");
384                         }
385                         break;
386
387                 case RC_KBMAP_SECONDARY:
388                         if (lexrc.next()) {
389                                 string const kmap(lexrc.getString());
390                                 if (kmap.empty()) {
391                                         // nothing
392                                 } else if (!LibFileSearch("kbd", kmap,
393                                                           "kmap").empty())
394                                         secondary_kbmap = kmap;
395                                 else
396                                         lexrc.printError("LyX: Keymap `$$Token' not found");
397                         }
398                         break;
399
400                 case RC_FONT_ENCODING:
401                         if (lexrc.next())
402                                 fontenc = lexrc.getString();
403                         break;
404
405                 case RC_PRINTER:
406                         if (lexrc.next())
407                                 printer = lexrc.getString();
408                         break;
409
410                 case RC_PRINT_COMMAND:
411                         if (lexrc.next())
412                                 print_command = lexrc.getString();
413                         break;
414
415                 case RC_PRINTEVENPAGEFLAG:
416                         if (lexrc.next())
417                                 print_evenpage_flag = lexrc.getString();
418                         break;
419
420                 case RC_PRINTODDPAGEFLAG:
421                         if (lexrc.next())
422                                 print_oddpage_flag = lexrc.getString();
423                         break;
424
425                 case RC_PRINTPAGERANGEFLAG:
426                         if (lexrc.next())
427                                 print_pagerange_flag = lexrc.getString();
428                         break;
429
430                 case RC_PRINTCOPIESFLAG:
431                         if (lexrc.next())
432                                 print_copies_flag = lexrc.getString();
433                         break;
434
435                 case RC_PRINTCOLLCOPIESFLAG:
436                         if (lexrc.next())
437                                 print_collcopies_flag = lexrc.getString();
438                         break;
439
440                 case RC_PRINTREVERSEFLAG:
441                         if (lexrc.next())
442                                 print_reverse_flag = lexrc.getString();
443                         break;
444
445                 case RC_PRINTLANDSCAPEFLAG:
446                         if (lexrc.next())
447                                 print_landscape_flag = lexrc.getString();
448                         break;
449
450                 case RC_PRINTTOPRINTER:
451                         if (lexrc.next())
452                                 print_to_printer = lexrc.getString();
453                         break;
454
455                 case RC_PRINT_ADAPTOUTPUT:
456                         if (lexrc.next())
457                                 print_adapt_output = lexrc.getBool();
458                         break;
459
460                 case RC_PRINTTOFILE:
461                         if (lexrc.next())
462                                 print_to_file = lexrc.getString();
463                         break;
464
465                 case RC_PRINTFILEEXTENSION:
466                         if (lexrc.next())
467                                 print_file_extension = lexrc.getString();
468                         break;
469
470                 case RC_PRINTEXSTRAOPTIONS:
471                         if (lexrc.next())
472                                 print_extra_options = lexrc.getString();
473                         break;
474
475                 case RC_PRINTSPOOL_COMMAND:
476                         if (lexrc.next())
477                                 print_spool_command = lexrc.getString();
478                         break;
479
480                 case RC_PRINTSPOOL_PRINTERPREFIX:
481                         if (lexrc.next())
482                                 print_spool_printerprefix = lexrc.getString();
483                         break;
484
485                 case RC_PRINTPAPERDIMENSIONFLAG:
486                         if (lexrc.next())
487                                 print_paper_dimension_flag = lexrc.getString();
488                         break;
489
490                 case RC_PRINTPAPERFLAG:
491                         if (lexrc.next())
492                                 print_paper_flag = lexrc.getString();
493                         break;
494
495                 case RC_CUSTOM_EXPORT_COMMAND:
496                         if (lexrc.next())
497                                 custom_export_command = lexrc.getString();
498                         break;
499
500                 case RC_CUSTOM_EXPORT_FORMAT:
501                         if (lexrc.next())
502                                 custom_export_format = lexrc.getString();
503                         break;
504
505                 case RC_DEFAULT_PAPERSIZE:
506                         if (lexrc.next()) {
507                                 string const size =
508                                         lowercase(lexrc.getString());
509                                 if (size == "usletter")
510                                         default_papersize =
511                                                 BufferParams::PAPER_USLETTER;
512                                 else if (size == "legal")
513                                         default_papersize =
514                                                 BufferParams::PAPER_LEGALPAPER;
515                                 else if (size == "executive")
516                                         default_papersize =
517                                                 BufferParams::PAPER_EXECUTIVEPAPER;
518                                 else if (size == "a3")
519                                         default_papersize =
520                                                 BufferParams::PAPER_A3PAPER;
521                                 else if (size == "a4")
522                                         default_papersize =
523                                                 BufferParams::PAPER_A4PAPER;
524                                 else if (size == "a5")
525                                         default_papersize =
526                                                 BufferParams::PAPER_A5PAPER;
527                                 else if (size == "b5")
528                                         default_papersize =
529                                                 BufferParams::PAPER_B5PAPER;
530                         }
531                         break;
532
533                 case RC_VIEWDVI_PAPEROPTION:
534                         if (lexrc.next())
535                                 view_dvi_paper_option = lexrc.getString();
536                         else
537                                 view_dvi_paper_option.erase();
538                         break;
539
540                 case RC_PS_COMMAND:
541                         if (lexrc.next())
542                                 ps_command = lexrc.getString();
543                         break;
544
545                 case RC_CHKTEX_COMMAND:
546                         if (lexrc.next())
547                                 chktex_command = lexrc.getString();
548                         break;
549
550                 case RC_SCREEN_DPI:
551                         if (lexrc.next())
552                                 dpi = lexrc.getInteger();
553                         break;
554
555                 case RC_SCREEN_ZOOM:
556                         if (lexrc.next())
557                                 zoom = lexrc.getInteger();
558                         break;
559
560                 case RC_WHEEL_JUMP:
561                         if (lexrc.next())
562                                 wheel_jump = lexrc.getInteger();
563                         break;
564
565                 case RC_SCREEN_FONT_SIZES:
566                         if (lexrc.next())
567                                 font_sizes[LyXFont::SIZE_TINY] =
568                                         lexrc.getFloat();
569                         if (lexrc.next())
570                                 font_sizes[LyXFont::SIZE_SCRIPT] =
571                                         lexrc.getFloat();
572                         if (lexrc.next())
573                                 font_sizes[LyXFont::SIZE_FOOTNOTE] =
574                                         lexrc.getFloat();
575                         if (lexrc.next())
576                                 font_sizes[LyXFont::SIZE_SMALL] =
577                                         lexrc.getFloat();
578                         if (lexrc.next())
579                                 font_sizes[LyXFont::SIZE_NORMAL] =
580                                         lexrc.getFloat();
581                         if (lexrc.next())
582                                 font_sizes[LyXFont::SIZE_LARGE] =
583                                         lexrc.getFloat();
584                         if (lexrc.next())
585                                 font_sizes[LyXFont::SIZE_LARGER] =
586                                         lexrc.getFloat();
587                         if (lexrc.next())
588                                 font_sizes[LyXFont::SIZE_LARGEST] =
589                                         lexrc.getFloat();
590                         if (lexrc.next())
591                                 font_sizes[LyXFont::SIZE_HUGE] =
592                                         lexrc.getFloat();
593                         if (lexrc.next())
594                                 font_sizes[LyXFont::SIZE_HUGER] =
595                                         lexrc.getFloat();
596                         break;
597
598                 case RC_SCREEN_FONT_SCALABLE:
599                         if (lexrc.next())
600                                 use_scalable_fonts = lexrc.getBool();
601                         break;
602
603                 case RC_AUTOSAVE:
604                         if (lexrc.next())
605                                 autosave = lexrc.getInteger();
606                         break;
607
608                 case RC_DOCUMENTPATH:
609                         if (lexrc.next()) {
610                                 document_path = ExpandPath(lexrc.getString());
611                         }
612                         break;
613
614                 case RC_TEMPLATEPATH:
615                         if (lexrc.next())
616                                 template_path = ExpandPath(lexrc.getString());
617                         break;
618
619                 case RC_TEMPDIRPATH:
620                         if (lexrc.next())
621                                 tempdir_path = ExpandPath(lexrc.getString());
622                         break;
623
624                 case RC_USETEMPDIR:
625                         if (lexrc.next())
626                                 use_tempdir = lexrc.getBool();
627                         break;
628
629                 case RC_LASTFILES:
630                         if (lexrc.next())
631                                 lastfiles = ExpandPath(lexrc.getString());
632                         break;
633
634                 case RC_NUMLASTFILES:
635                         if (lexrc.next())
636                                 num_lastfiles = lexrc.getInteger();
637                         break;
638
639                 case RC_CHECKLASTFILES:
640                         if (lexrc.next())
641                                 check_lastfiles = lexrc.getBool();
642                         break;
643
644                 case RC_SCREEN_FONT_ROMAN:
645                         if (lexrc.next())
646                                 roman_font_name = lexrc.getString();
647                         break;
648
649                 case RC_SCREEN_FONT_SANS:
650                         if (lexrc.next())
651                                 sans_font_name = lexrc.getString();
652                         break;
653
654                 case RC_SCREEN_FONT_TYPEWRITER:
655                         if (lexrc.next())
656                                 typewriter_font_name = lexrc.getString();
657                         break;
658
659                 case RC_SCREEN_FONT_ENCODING:
660                         if (lexrc.next()) {
661                                 font_norm = lexrc.getString();
662                                 set_font_norm_type();
663                         }
664                         break;
665
666                 case RC_POPUP_BOLD_FONT:
667                         if (lexrc.next())
668                                 popup_bold_font = lexrc.getString();
669                         break;
670
671                 case RC_POPUP_NORMAL_FONT:
672                         if (lexrc.next())
673                                 popup_normal_font = lexrc.getString();
674                         break;
675
676                 case RC_POPUP_FONT_ENCODING:
677                         if (lexrc.next())
678                                 popup_font_encoding = lexrc.getString();
679                         break;
680
681                 case RC_SET_COLOR:
682                 {
683                         string lyx_name, x11_name;
684
685                         if (lexrc.next())  {
686                                 lyx_name = lexrc.getString();
687                         } else {
688                                 lexrc.printError("Missing color tag.");
689                                 break;
690                         }
691
692                         if (lexrc.next()) {
693                                 x11_name = lexrc.getString();
694                         } else {
695                                 lexrc.printError("Missing color name for color : `$$Token'");
696                                 break;
697                         }
698
699                         if (!lcolor.setColor(lyx_name, x11_name))
700                                 lyxerr << "Bad lyxrc set_color for "
701                                         << lyx_name << endl;
702
703                         break;
704                 }
705                 case RC_AUTOREGIONDELETE:
706                         // Auto region delete defaults to true
707                         if (lexrc.next())
708                                 auto_region_delete = lexrc.getBool();
709                         break;
710
711                 case RC_BIND:
712                 {
713                         // we should not do an explicit binding before
714                         // loading a bind file. So, in this case, load
715                         // the default bind file.
716                         readBindFileIfNeeded();
717
718                         // !!!chb, dynamic key binding...
719                         int action = 0;
720                         string::size_type res = 0;
721                         string seq, cmd;
722
723                         if (lexrc.next()) {
724                                 seq = lexrc.getString();
725                         } else {
726                                 lexrc.printError("RC_BIND: Missing key sequence");
727                                 break;
728                         }
729
730                         if (lexrc.next(true)) {
731                                 cmd = lexrc.getString();
732                         } else {
733                                 lexrc.printError("RC_BIND: missing command");
734                                 break;
735                         }
736
737                         if ((action = lyxaction.LookupFunc(cmd))>= 0) {
738                                 if (lyxerr.debugging(Debug::LYXRC)) {
739                                         lyxerr << "RC_BIND: Sequence `"
740                                                << seq << "' Command `"
741                                                << cmd << "' Action `"
742                                                << action << '\'' << endl;
743                                 }
744                                 res = toplevel_keymap->bind(seq, kb_action(action));
745                                 if (res != string::npos
746                                     && lyxerr.debugging(Debug::LYXRC)) {
747                                         lexrc.printError(
748                                                 "RC_BIND: "
749                                                 "Invalid key sequence `"
750                                                 + seq + '\'');
751                                 }
752                         } else {// cmd is the last token read.
753                                 lexrc.printError(
754                                         "Unknown LyX function `$$Token'");
755                         }
756                         break;
757                 }
758                 case RC_OVERRIDE_X_DEADKEYS:
759                         if (lexrc.next())
760                                 override_x_deadkeys = lexrc.getBool();
761                         break;
762
763                 case RC_SERVERPIPE:
764                         if (lexrc.next())
765                                 lyxpipes = ExpandPath(lexrc.getString());
766                         break;
767
768                 case RC_CURSOR_FOLLOWS_SCROLLBAR:
769                         if (lexrc.next())
770                                 cursor_follows_scrollbar = lexrc.getBool();
771                         break;
772
773                 case RC_DIALOGS_ICONIFY_WITH_MAIN:
774                         if (lexrc.next())
775                                 dialogs_iconify_with_main = lexrc.getBool();
776                         break;
777
778                 case RC_ASCIIROFF_COMMAND:
779                         if (lexrc.next())
780                                 ascii_roff_command = lexrc.getString();
781                         break;
782                 case RC_ASCII_LINELEN:
783                         if (lexrc.next())
784                                 ascii_linelen = lexrc.getInteger();
785                         break;
786                         // Spellchecker settings:
787 #ifdef USE_PSPELL
788                 case RC_USE_PSPELL:
789                         if (lexrc.next())
790                                 use_pspell = lexrc.getBool();
791                         break;
792 #endif
793                 case RC_SPELL_COMMAND:
794                         if (lexrc.next())
795                                 isp_command = lexrc.getString();
796                         break;
797                 case RC_ACCEPT_COMPOUND:
798                         if (lexrc.next())
799                                 isp_accept_compound = lexrc.getBool();
800                         break;
801                 case RC_USE_INP_ENC:
802                         if (lexrc.next())
803                                 isp_use_input_encoding = lexrc.getBool();
804                         break;
805                 case RC_USE_ALT_LANG:
806                         if (lexrc.next())
807                                 isp_use_alt_lang = lexrc.getBool();
808                         break;
809                 case RC_USE_PERS_DICT:
810                         if (lexrc.next())
811                                 isp_use_pers_dict = lexrc.getBool();
812                         break;
813                 case RC_USE_ESC_CHARS:
814                         if (lexrc.next())
815                                 isp_use_esc_chars = lexrc.getBool();
816                         break;
817                 case RC_ALT_LANG:
818                         if (lexrc.next())
819                                 isp_alt_lang = lexrc.getString();
820                         break;
821                 case RC_PERS_DICT:
822                         if (lexrc.next())
823                                 isp_pers_dict = lexrc.getString();
824                         break;
825                 case RC_ESC_CHARS:
826                         if (lexrc.next())
827                                 isp_esc_chars = lexrc.getString();
828                         break;
829                 case RC_MAKE_BACKUP:
830                         if (lexrc.next())
831                                 make_backup = lexrc.getBool();
832                         break;
833                 case RC_BACKUPDIR_PATH:
834                         if (lexrc.next())
835                                 backupdir_path = ExpandPath(lexrc.getString());
836                         break;
837                 case RC_DATE_INSERT_FORMAT:
838                         if (lexrc.next())
839                                 date_insert_format = lexrc.getString();
840                         break;
841                 case RC_LANGUAGE_PACKAGE:
842                         if (lexrc.next())
843                                 language_package = lexrc.getString();
844                         break;
845                 case RC_LANGUAGE_AUTO_BEGIN:
846                         if (lexrc.next())
847                                 language_auto_begin = lexrc.getBool();
848                         break;
849                 case RC_LANGUAGE_AUTO_END:
850                         if (lexrc.next())
851                                 language_auto_end = lexrc.getBool();
852                         break;
853                 case RC_LANGUAGE_GLOBAL_OPTIONS:
854                         if (lexrc.next())
855                                 language_global_options = lexrc.getBool();
856                         break;
857                 case RC_LANGUAGE_USE_BABEL:
858                         if (lexrc.next())
859                                 language_use_babel = lexrc.getBool();
860                         break;
861                 case RC_LANGUAGE_COMMAND_BEGIN:
862                         if (lexrc.next())
863                                 language_command_begin = lexrc.getString();
864                         break;
865                 case RC_LANGUAGE_COMMAND_END:
866                         if (lexrc.next())
867                                 language_command_end = lexrc.getString();
868                         break;
869                 case RC_LANGUAGE_COMMAND_LOCAL:
870                         if (lexrc.next())
871                                 language_command_local = lexrc.getString();
872                         break;
873                 case RC_RTL_SUPPORT:
874                         if (lexrc.next())
875                                 rtl_support = lexrc.getBool();
876                         break;
877                 case RC_AUTO_NUMBER:
878                         if (lexrc.next())
879                                 auto_number = lexrc.getBool();
880                         break;
881                 case RC_MARK_FOREIGN_LANGUAGE:
882                         if (lexrc.next())
883                                 mark_foreign_language = lexrc.getBool();
884                         break;
885                 case RC_SHOW_BANNER:
886                         if (lexrc.next())
887                                 show_banner = lexrc.getBool();
888                         break;
889
890                 case RC_NEW_ASK_FILENAME:
891                         if (lexrc.next())
892                                 new_ask_filename = lexrc.getBool();
893                         break;
894                 case RC_CONVERTER: {
895                         string from, to, command, flags;
896                         if (lexrc.next())
897                                 from = lexrc.getString();
898                         if (lexrc.next())
899                                 to = lexrc.getString();
900                         if (lexrc.next())
901                                 command = lexrc.getString();
902                         if (lexrc.next())
903                                 flags = lexrc.getString();
904                         if (command.empty() || command == "none")
905                                 converters.erase(from, to);
906                         else
907                                 converters.add(from, to, command, flags);
908                         break;
909                 }
910                 case RC_VIEWER: {
911                         string format, command;
912                         if (lexrc.next())
913                                 format = lexrc.getString();
914                         if (lexrc.next())
915                                 command = lexrc.getString();
916                         formats.setViewer(format, command);
917                         break;
918                 }
919                 case RC_FORMAT: {
920                         string format, extension, prettyname, shortcut;
921                         if (lexrc.next())
922                                 format = lexrc.getString();
923                         if (lexrc.next())
924                                 extension = lexrc.getString();
925                         if (lexrc.next())
926                                 prettyname = lexrc.getString();
927                         if (lexrc.next())
928                                 shortcut = lexrc.getString();
929                         if (prettyname.empty()) {
930                                 if (converters.formatIsUsed(format))
931                                         lyxerr << "Can't delete format "
932                                                << format << endl;
933                                 else
934                                         formats.erase(format);
935
936                         } else
937                                 formats.add(format, extension, prettyname,
938                                             shortcut);
939                         break;
940                 }
941                 case RC_DEFAULT_LANGUAGE:
942                         if (lexrc.next())
943                                 default_language = lexrc.getString();
944                         break;
945
946                 case RC_LABEL_INIT_LENGTH:
947                         if (lexrc.next())
948                                 label_init_length = lexrc.getInteger();
949                         break;
950
951                 case RC_LAST: break; // this is just a dummy
952                 }
953         }
954
955         /// Update converters data-structures
956         converters.update(formats);
957         converters.buildGraph();
958
959         return 0;
960 }
961
962
963 void LyXRC::write(string const & filename) const
964 {
965         ofstream ofs(filename.c_str());
966         if (ofs)
967                 output(ofs);
968 }
969
970
971 void LyXRC::print() const
972 {
973         if (lyxerr.debugging())
974                 output(lyxerr);
975         else
976                 output(cout);
977 }
978
979
980 void LyXRC::output(ostream & os) const
981 {
982         os << "### This file is part of\n"
983            << "### ========================================================\n"
984            << "###          LyX, The Document Processor\n"
985            << "###\n"
986            << "###          Copyright 1995 Matthias Ettrich\n"
987            << "###          Copyright 1995-2001 The LyX Team.\n"
988            << "###\n"
989            << "### ========================================================\n"
990            << "\n"
991            << "# This file is written by LyX, if you want to make your own\n"
992            << "# modifications you should do them from inside LyX and save\n"
993            << "\n";
994
995         // Why the switch you might ask. It is a trick to ensure that all
996         // the elements in the LyXRCTags enum is handled. As you can see
997         // there are no breaks at all. So it is just a huge fall-through.
998         // The nice thing is that we will get a warning from the compiler
999         // if we forget an element.
1000         LyXRCTags tag = RC_LAST;
1001         switch (tag) {
1002         case RC_LAST:
1003         case RC_INPUT:
1004                 // input/include files are not done here
1005         case RC_BIND:
1006                 // bindings is not written to the preferences file.
1007         case RC_BINDFILE:
1008                 if (bind_file != system_lyxrc.bind_file) {
1009                         os << "\\bind_file " << bind_file << "\n";
1010                 }
1011                 //
1012                 // Misc Section
1013                 //
1014                 os << "\n#\n"
1015                    << "# MISC SECTION ######################################\n"
1016                    << "#\n\n";
1017
1018         case RC_SHOW_BANNER:
1019                 if (show_banner != system_lyxrc.show_banner) {
1020                         os << "# Set to false to inhibit the startup banner.\n"
1021                            << "\\show_banner " << tostr(show_banner) << "\n";
1022                 }
1023                 // bind files are not done here.
1024         case RC_UIFILE:
1025                 if (ui_file != system_lyxrc.ui_file) {
1026                         os << "\\ui_file \"" << ui_file << "\"\n";
1027                 }
1028         case RC_AUTOREGIONDELETE:
1029                 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1030                         os << "# Set to false to inhibit automatic replacement of\n"
1031                            << "# the current selection.\n"
1032                            << "\\auto_region_delete " << tostr(auto_region_delete)
1033                            << "\n";
1034                 }
1035         case RC_AUTORESET_OPTIONS:
1036                 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1037                         os << "# Set to false to inhibit automatic reset of\n"
1038                            << "# the class options to defaults on class change.\n"
1039                            << "\\auto_reset_options " << tostr(auto_reset_options)
1040                            << "\n";
1041                 }
1042         case RC_AUTOSAVE:
1043                 if (autosave != system_lyxrc.autosave) {
1044                         os << "# The time interval between auto-saves in seconds.\n"
1045                            << "\\autosave " << autosave << "\n";
1046                 }
1047         case RC_EXIT_CONFIRMATION:
1048                 if (exit_confirmation != system_lyxrc.exit_confirmation) {
1049                         os << "# Ask for confirmation before exit if there are\n"
1050                            << "# unsaved changed documents.\n"
1051                            << "\\exit_confirmation " << tostr(exit_confirmation)
1052                            << "\n";
1053                 }
1054         case RC_DISPLAY_GRAPHICS:
1055                 if (display_graphics != system_lyxrc.display_graphics) {
1056                         os << "# Display graphics within LyX\n"
1057                            << "# no|mono|gray|color\n"
1058                            << "\\display_graphics " << display_graphics
1059                            << "\n";
1060                 }
1061
1062         case RC_DISPLAY_SHORTCUTS:
1063                 if (display_shortcuts != system_lyxrc.display_shortcuts) {
1064                         os << "# Display name of the last command executed,\n"
1065                            << "# with a list of short-cuts in the minibuffer.\n"
1066                            << "\\display_shortcuts " << tostr(display_shortcuts)
1067                            << "\n";
1068                 }
1069         case RC_VIEWDVI_PAPEROPTION:
1070                 if (view_dvi_paper_option
1071                     != system_lyxrc.view_dvi_paper_option) {
1072                         os << "# Options used to specify paper size to the\n"
1073                            << "# view_dvi_command (e.g. -paper)\n"
1074                            << "\\view_dvi_paper_option \""
1075                            << view_dvi_paper_option << "\"\n";
1076                 }
1077         case RC_DEFAULT_PAPERSIZE:
1078                 if (default_papersize != system_lyxrc.default_papersize) {
1079                         os << "# The default papersize to use.\n"
1080                            << "\\default_papersize \"";
1081                         switch (default_papersize) {
1082                         case BufferParams::PAPER_USLETTER:
1083                                 os << "usletter"; break;
1084                         case BufferParams::PAPER_LEGALPAPER:
1085                                 os << "legal"; break;
1086                         case BufferParams::PAPER_EXECUTIVEPAPER:
1087                                 os << "executive"; break;
1088                         case BufferParams::PAPER_A3PAPER:
1089                                 os << "a3"; break;
1090                         case BufferParams::PAPER_A4PAPER:
1091                                 os << "a4"; break;
1092                         case BufferParams::PAPER_A5PAPER:
1093                                 os << "a5"; break;
1094                         case BufferParams::PAPER_B5PAPER:
1095                                 os << "b5"; break;
1096                         case BufferParams::PAPER_DEFAULT: break;
1097                         }
1098                         os << "\"\n";
1099                 }
1100         case RC_PS_COMMAND:
1101                 if (ps_command != system_lyxrc.ps_command) {
1102                         os << "# Program used for interpreting postscript.\n"
1103                            << "\\ps_command \"" << ps_command << "\"\n";
1104                 }
1105         case RC_CHKTEX_COMMAND:
1106                 if (chktex_command != system_lyxrc.chktex_command) {
1107                         os << "\\chktex_command \"" << chktex_command << "\"\n";
1108                 }
1109         case RC_KBMAP:
1110                 if (use_kbmap != system_lyxrc.use_kbmap) {
1111                         os << "\\kbmap " << tostr(use_kbmap) << "\n";
1112                 }
1113         case RC_KBMAP_PRIMARY:
1114                 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1115                         os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1116                 }
1117         case RC_KBMAP_SECONDARY:
1118                 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1119                         os << "\\kbmap_secondary \"" << secondary_kbmap
1120                            << "\"\n";
1121                 }
1122         case RC_SERVERPIPE:
1123                 if (lyxpipes != system_lyxrc.lyxpipes) {
1124                         os << "\\serverpipe \"" << lyxpipes << "\"\n";
1125                 }
1126         case RC_DATE_INSERT_FORMAT:
1127                 if (date_insert_format != system_lyxrc.date_insert_format) {
1128                         os << "\\date_insert_format \"" << date_insert_format
1129                            << "\"\n";
1130                 }
1131         case RC_LABEL_INIT_LENGTH:
1132                 if (label_init_length != system_lyxrc.label_init_length) {
1133                         os << "\\label_init_length " << label_init_length
1134                            << "\n";
1135                 }
1136
1137                 os << "\n#\n"
1138                    << "# SCREEN & FONTS SECTION ############################\n"
1139                    << "#\n\n";
1140
1141         case RC_POPUP_NORMAL_FONT:
1142                 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1143                         os << "\\popup_normal_font \"" << popup_normal_font
1144                            << "\"\n";
1145                 }
1146         case RC_POPUP_BOLD_FONT:
1147                 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1148                         os << "\\popup_bold_font \"" << popup_bold_font
1149                            << "\"\n";
1150                 }
1151         case RC_POPUP_FONT_ENCODING:
1152                 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1153                         os << "\\popup_font_encoding \"" << popup_font_encoding
1154                            << "\"\n";
1155                 }
1156         case RC_SCREEN_DPI:
1157                 if (dpi != system_lyxrc.dpi) {
1158                         os << "\\screen_dpi " << dpi << "\n";
1159                 }
1160         case RC_SCREEN_ZOOM:
1161                 if (zoom != system_lyxrc.zoom) {
1162                         os << "\\screen_zoom " << zoom << "\n";
1163                 }
1164         case RC_WHEEL_JUMP:
1165                 if (wheel_jump != system_lyxrc.wheel_jump) {
1166                         os << "\\wheel_jump " << wheel_jump << "\n";
1167                 }
1168         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1169                 if (cursor_follows_scrollbar
1170                     != system_lyxrc.cursor_follows_scrollbar) {
1171                         os << "\\cursor_follows_scrollbar "
1172                            << tostr(cursor_follows_scrollbar) << "\n";
1173                 }
1174         case RC_DIALOGS_ICONIFY_WITH_MAIN:
1175                 if (dialogs_iconify_with_main
1176                    != system_lyxrc.dialogs_iconify_with_main) {
1177                         os << "\\dialogs_iconify_with_main "
1178                           <<  tostr(dialogs_iconify_with_main) << "\n";
1179                 }
1180         case RC_SCREEN_FONT_ROMAN:
1181                 if (roman_font_name != system_lyxrc.roman_font_name) {
1182                         os << "\\screen_font_roman \"" << roman_font_name
1183                            << "\"\n";
1184                 }
1185         case RC_SCREEN_FONT_SANS:
1186                 if (sans_font_name != system_lyxrc.sans_font_name) {
1187                         os << "\\screen_font_sans \"" << sans_font_name
1188                            << "\"\n";
1189                 }
1190         case RC_SCREEN_FONT_TYPEWRITER:
1191                 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1192                         os << "\\screen_font_typewriter \""
1193                            << typewriter_font_name << "\"\n";
1194                 }
1195         case RC_SCREEN_FONT_SCALABLE:
1196                 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1197                         os << "\\screen_font_scalable "
1198                            << tostr(use_scalable_fonts)
1199                            << "\n";
1200                 }
1201         case RC_SCREEN_FONT_ENCODING:
1202                 if (font_norm != system_lyxrc.font_norm) {
1203                         os << "\\screen_font_encoding \"" << font_norm
1204                            << "\"\n";
1205                 }
1206         case RC_SCREEN_FONT_SIZES:
1207                 if (font_sizes[LyXFont::SIZE_TINY]
1208                     != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1209                     font_sizes[LyXFont::SIZE_SCRIPT]
1210                     != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1211                     font_sizes[LyXFont::SIZE_FOOTNOTE]
1212                     != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1213                     font_sizes[LyXFont::SIZE_SMALL]
1214                     != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1215                     font_sizes[LyXFont::SIZE_NORMAL]
1216                     != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1217                     font_sizes[LyXFont::SIZE_LARGE]
1218                     != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1219                     font_sizes[LyXFont::SIZE_LARGER]
1220                     != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1221                     font_sizes[LyXFont::SIZE_LARGEST]
1222                     != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1223                     font_sizes[LyXFont::SIZE_HUGE]
1224                     != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1225                     font_sizes[LyXFont::SIZE_HUGER]
1226                     != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1227                         os.setf(ios::fixed);
1228                         os.precision(2);
1229                         os << "\\screen_font_sizes"
1230                            << " " << font_sizes[LyXFont::SIZE_TINY]
1231                            << " " << font_sizes[LyXFont::SIZE_SCRIPT]
1232                            << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]
1233                            << " " << font_sizes[LyXFont::SIZE_SMALL]
1234                            << " " << font_sizes[LyXFont::SIZE_NORMAL]
1235                            << " " << font_sizes[LyXFont::SIZE_LARGE]
1236                            << " " << font_sizes[LyXFont::SIZE_LARGER]
1237                            << " " << font_sizes[LyXFont::SIZE_LARGEST]
1238                            << " " << font_sizes[LyXFont::SIZE_HUGE]
1239                            << " " << font_sizes[LyXFont::SIZE_HUGER]
1240                            << "\n";
1241                 }
1242
1243                 os << "\n#\n"
1244                    << "# COLOR SECTION ###################################\n"
1245                    << "#\n\n";
1246
1247         case RC_SET_COLOR:
1248                 for (int i = 0; i < LColor::ignore; ++i) {
1249                         LColor::color lc = static_cast<LColor::color>(i);
1250
1251                         string const col(lcolor.getX11Name(lc));
1252                         if (col != system_lcolor.getX11Name(lc)) {
1253                                 os << "\\set_color \""
1254                                    << lcolor.getLyXName(lc) << "\" \""
1255                                    << col << "\"\n";
1256                         }
1257                 }
1258
1259                 os << "\n#\n"
1260                    << "# PRINTER SECTION ###################################\n"
1261                    << "#\n\n";
1262
1263         case RC_PRINTER:
1264                 if (printer != system_lyxrc.printer) {
1265                         os << "\\printer \"" << printer << "\"\n";
1266                 }
1267         case RC_PRINT_ADAPTOUTPUT:
1268                 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1269                         os << "\\print_adapt_output "
1270                            << tostr(print_adapt_output)
1271                            << "\n";
1272                 }
1273         case RC_PRINT_COMMAND:
1274                 if (print_command != system_lyxrc.print_command) {
1275                         os << "\\print_command \"" << print_command << "\"\n";
1276                 }
1277         case RC_PRINTEXSTRAOPTIONS:
1278                 if (print_extra_options != system_lyxrc.print_extra_options) {
1279                         os << "\\print_extra_options \"" << print_extra_options
1280                            << "\"\n";
1281                 }
1282         case RC_PRINTSPOOL_COMMAND:
1283                 if (print_spool_command != system_lyxrc.print_spool_command) {
1284                         os << "\\print_spool_command \"" << print_spool_command
1285                            << "\"\n";
1286                 }
1287         case RC_PRINTSPOOL_PRINTERPREFIX:
1288                 if (print_spool_printerprefix
1289                     != system_lyxrc.print_spool_printerprefix) {
1290                         os << "\\print_spool_printerprefix \""
1291                            << print_spool_printerprefix << "\"\n";
1292                 }
1293         case RC_PRINTEVENPAGEFLAG:
1294                 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1295                         os << "\\print_evenpage_flag \"" << print_evenpage_flag
1296                            << "\"\n";
1297                 }
1298         case RC_PRINTODDPAGEFLAG:
1299                 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1300                         os << "\\print_oddpage_flag \"" << print_oddpage_flag
1301                            << "\"\n";
1302                 }
1303         case RC_PRINTREVERSEFLAG:
1304                 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1305                         os << "\\print_reverse_flag \"" << print_reverse_flag
1306                            << "\"\n";
1307                 }
1308         case RC_PRINTLANDSCAPEFLAG:
1309                 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1310                         os << "\\print_landscape_flag \"" << print_landscape_flag
1311                            << "\"\n";
1312                 }
1313         case RC_PRINTPAGERANGEFLAG:
1314                 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1315                         os << "\\print_pagerange_flag \"" << print_pagerange_flag
1316                            << "\"\n";
1317                 }
1318         case RC_PRINTCOPIESFLAG:
1319                 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1320                         os << "\\print_copies_flag \"" << print_copies_flag
1321                            << "\"\n";
1322                 }
1323         case RC_PRINTCOLLCOPIESFLAG:
1324                 if (print_collcopies_flag
1325                     != system_lyxrc.print_collcopies_flag) {
1326                         os << "\\print_collcopies_flag \""
1327                            << print_collcopies_flag
1328                            << "\"\n";
1329                 }
1330         case RC_PRINTPAPERFLAG:
1331                 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1332                         os << "\\print_paper_flag \"" << print_paper_flag
1333                            << "\"\n";
1334                 }
1335         case RC_PRINTPAPERDIMENSIONFLAG:
1336                 if (print_paper_dimension_flag
1337                     != system_lyxrc.print_paper_dimension_flag) {
1338                         os << "\\print_paper_dimension_flag \""
1339                            << print_paper_dimension_flag << "\"\n";
1340                 }
1341         case RC_PRINTTOPRINTER:
1342                 if (print_to_printer != system_lyxrc.print_to_printer) {
1343                         os << "\\print_to_printer \"" << print_to_printer
1344                            << "\"\n";
1345                 }
1346         case RC_PRINTTOFILE:
1347                 if (print_to_file != system_lyxrc.print_to_file) {
1348                         os << "\\print_to_file \"" << print_to_file << "\"\n";
1349                 }
1350         case RC_PRINTFILEEXTENSION:
1351                 if (print_file_extension != system_lyxrc.print_file_extension) {
1352                         os << "\\print_file_extension \""
1353                            << print_file_extension
1354                            << "\"\n";
1355                 }
1356
1357                 os << "\n#\n"
1358                    << "# EXPORT SECTION ####################################\n"
1359                    << "#\n\n";
1360
1361         case RC_CUSTOM_EXPORT_COMMAND:
1362                 if (custom_export_command
1363                     != system_lyxrc.custom_export_command) {
1364                         os << "\\custom_export_command \""
1365                            << custom_export_command
1366                            << "\"\n";
1367                 }
1368         case RC_CUSTOM_EXPORT_FORMAT:
1369                 if (custom_export_format
1370                     != system_lyxrc.custom_export_format) {
1371                         os << "\\custom_export_format \"" << custom_export_format
1372                            << "\"\n";
1373                 }
1374
1375                 os << "\n#\n"
1376                    << "# TEX SECTION #######################################\n"
1377                    << "#\n\n";
1378
1379         case RC_FONT_ENCODING:
1380                 if (fontenc != system_lyxrc.fontenc) {
1381                         os << "\\font_encoding \"" << fontenc << "\"\n";
1382                 }
1383
1384                 os << "\n#\n"
1385                    << "# FILE SECTION ######################################\n"
1386                    << "#\n\n";
1387
1388         case RC_DOCUMENTPATH:
1389                 if (document_path != system_lyxrc.document_path) {
1390                         os << "\\document_path \"" << document_path << "\"\n";
1391                 }
1392         case RC_LASTFILES:
1393                 if (lastfiles != system_lyxrc.lastfiles) {
1394                         os << "\\lastfiles \"" << lastfiles << "\"\n";
1395                 }
1396         case RC_NUMLASTFILES:
1397                 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1398                         os << "\\num_lastfiles " << num_lastfiles << "\n";
1399                 }
1400         case RC_CHECKLASTFILES:
1401                 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1402                         os << "\\check_lastfiles " << tostr(check_lastfiles)
1403                            << "\n";
1404                 }
1405         case RC_TEMPLATEPATH:
1406                 if (template_path != system_lyxrc.template_path) {
1407                         os << "\\template_path \"" << template_path << "\"\n";
1408                 }
1409         case RC_TEMPDIRPATH:
1410                 if (tempdir_path != system_lyxrc.tempdir_path) {
1411                         os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1412                 }
1413         case RC_USETEMPDIR:
1414                 if (use_tempdir != system_lyxrc.use_tempdir) {
1415                         os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1416                 }
1417         case RC_ASCII_LINELEN:
1418                 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1419                         os << "\\ascii_linelen " << ascii_linelen << "\n";
1420                 }
1421         case RC_MAKE_BACKUP:
1422                 if (make_backup != system_lyxrc.make_backup) {
1423                         os << "\\make_backup " << tostr(make_backup) << "\n";
1424                 }
1425         case RC_BACKUPDIR_PATH:
1426                 if (backupdir_path != system_lyxrc.backupdir_path) {
1427                         os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1428                 }
1429
1430                 os << "\n#\n"
1431                    << "# ASCII EXPORT SECTION ##############################\n"
1432                    << "#\n\n";
1433
1434         case RC_ASCIIROFF_COMMAND:
1435                 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1436                         os << "\\ascii_roff_command \"" << ascii_roff_command
1437                            << "\"\n";
1438                 }
1439
1440                 os << "\n#\n"
1441                    << "# SPELLCHECKER SECTION ##############################\n"
1442                    << "#\n\n";
1443 #ifdef USE_PSPELL
1444         case RC_USE_PSPELL:
1445                 if (use_pspell != system_lyxrc.use_pspell) {
1446                         os << "\\use_pspell " << tostr(use_pspell) << "\n";
1447                 }
1448 #endif
1449         case RC_SPELL_COMMAND:
1450                 if (isp_command != system_lyxrc.isp_command) {
1451                         os << "\\spell_command \"" << isp_command << "\"\n";
1452                 }
1453         case RC_ACCEPT_COMPOUND:
1454                 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1455                         os << "\\accept_compound " << tostr(isp_accept_compound)
1456                            << "\n";
1457                 }
1458         case RC_USE_ALT_LANG:
1459                 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1460                         os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1461                            << "\n";
1462                 }
1463         case RC_ALT_LANG:
1464                 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1465                         os << "\\alternate_language \"" << isp_alt_lang
1466                            << "\"\n";
1467                 }
1468         case RC_USE_ESC_CHARS:
1469                 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1470                         os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1471                            << "\n";
1472                 }
1473         case RC_ESC_CHARS:
1474                 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1475                         os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1476                 }
1477         case RC_USE_PERS_DICT:
1478                 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1479                         os << "\\use_personal_dictionary "
1480                            << tostr(isp_use_pers_dict)
1481                            << "\n";
1482                 }
1483         case RC_PERS_DICT:
1484                 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1485                         os << "\\personal_dictionary \"" << isp_pers_dict
1486                            << "\"\n";
1487                 }
1488         case RC_USE_INP_ENC:
1489                 if (isp_use_input_encoding
1490                     != system_lyxrc.isp_use_input_encoding) {
1491                         os << "\\use_input_encoding "
1492                            << tostr(isp_use_input_encoding)
1493                            << "\n";
1494                 }
1495
1496                 os << "\n#\n"
1497                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
1498                    << "#\n\n";
1499
1500         case RC_RTL_SUPPORT:
1501                 if (rtl_support != system_lyxrc.rtl_support) {
1502                         os << "\\rtl " << tostr(rtl_support) << "\n";
1503                 }
1504         case RC_LANGUAGE_PACKAGE:
1505                 if (language_package != system_lyxrc.language_package) {
1506                         os << "\\language_package \"" << language_package
1507                            << "\"\n";
1508                 }
1509         case RC_LANGUAGE_GLOBAL_OPTIONS:
1510                 if (language_global_options
1511                     != system_lyxrc.language_global_options) {
1512                         os << "\\language_global_options \""
1513                            << tostr(language_global_options)
1514                            << "\"\n";
1515                 }
1516         case RC_LANGUAGE_USE_BABEL:
1517                 if (language_use_babel != system_lyxrc.language_use_babel) {
1518                         os << "\\language_use_babel \""
1519                            << tostr(language_use_babel)
1520                            << "\"\n";
1521                 }
1522         case RC_LANGUAGE_COMMAND_BEGIN:
1523                 if (language_command_begin
1524                     != system_lyxrc.language_command_begin) {
1525                         os << "\\language_command_begin \""
1526                            << language_command_begin
1527                            << "\"\n";
1528                 }
1529         case RC_LANGUAGE_COMMAND_END:
1530                 if (language_command_end
1531                     != system_lyxrc.language_command_end) {
1532                         os << "\\language_command_end \"" << language_command_end
1533                            << "\"\n";
1534                 }
1535         case RC_LANGUAGE_COMMAND_LOCAL:
1536                 if (language_command_local
1537                     != system_lyxrc.language_command_local) {
1538                         os << "\\language_command_local \""
1539                            << language_command_local
1540                            << "\"\n";
1541                 }
1542         case RC_LANGUAGE_AUTO_BEGIN:
1543                 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1544                         os << "\\language_auto_begin "
1545                            << tostr(language_auto_begin) << "\n";
1546                 }
1547         case RC_LANGUAGE_AUTO_END:
1548                 if (language_auto_end != system_lyxrc.language_auto_end) {
1549                         os << "\\language_auto_end "
1550                            << tostr(language_auto_end) << "\n";
1551                 }
1552         case RC_MARK_FOREIGN_LANGUAGE:
1553                 if (mark_foreign_language
1554                     != system_lyxrc.mark_foreign_language) {
1555                         os << "\\mark_foreign_language " <<
1556                                 tostr(mark_foreign_language) << "\n";
1557                 }
1558
1559                 os << "\n#\n"
1560                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
1561                    << "#\n\n";
1562
1563         case RC_OVERRIDE_X_DEADKEYS:
1564                 if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) {
1565                         os << "\\override_x_deadkeys "
1566                            << tostr(override_x_deadkeys) << "\n";
1567                 }
1568         case RC_AUTO_NUMBER:
1569                 if (auto_number != system_lyxrc.auto_number) {
1570                         os << "\\auto_number " << tostr(auto_number) << "\n";
1571                 }
1572         case RC_NEW_ASK_FILENAME:
1573                 if (new_ask_filename != system_lyxrc.new_ask_filename) {
1574                         os << "\\new_ask_filename " << tostr(new_ask_filename)
1575                            << "\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_EXIT_CONFIRMATION:
1915                 str = _("Sets whether LyX asks for a second confirmation to exit when you have changed documents. (LyX will still ask to save changed documents.)");
1916                 break;
1917
1918         case RC_DISPLAY_GRAPHICS:
1919                 str = _("Select how LyX will display any graphics.");
1920                 break;
1921
1922         case RC_DISPLAY_SHORTCUTS:
1923                 str = _("LyX continously displays names of last command executed, along with a list of defined short-cuts for it in the minibuffer. Set to false if LyX seems slow.");
1924                 break;
1925
1926         case RC_MAKE_BACKUP:
1927                 str = _("De-select if you don't want LyX to create backup files.");
1928                 break;
1929
1930         case RC_BACKUPDIR_PATH:
1931                 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.");
1932                 break;
1933
1934         case RC_RTL_SUPPORT:
1935                 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
1936                 break;
1937
1938         case RC_MARK_FOREIGN_LANGUAGE:
1939                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
1940                 break;
1941
1942         case RC_LANGUAGE_PACKAGE:
1943                 str = _("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
1944                 break;
1945
1946         case RC_LANGUAGE_GLOBAL_OPTIONS:
1947                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
1948                 break;
1949
1950         case RC_LANGUAGE_USE_BABEL:
1951                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
1952                 break;
1953
1954         case RC_LANGUAGE_AUTO_BEGIN:
1955                 str = _("Select if a language switching command is needed at the beginning of the document.");
1956                 break;
1957
1958         case RC_LANGUAGE_AUTO_END:
1959                 str = _("Select if a language switching command is needed at the end of the document.");
1960                 break;
1961
1962         case RC_LANGUAGE_COMMAND_BEGIN:
1963                 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.");
1964                 break;
1965
1966         case RC_LANGUAGE_COMMAND_END:
1967                 str = _("The latex command for changing back to the language of the document.");
1968                 break;
1969
1970         case RC_LANGUAGE_COMMAND_LOCAL:
1971                 str = _("The latex command for local changing of the language.");
1972                 break;
1973
1974         case RC_DATE_INSERT_FORMAT:
1975                 //xgettext:no-c-format
1976                 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
1977                 break;
1978
1979         case RC_SHOW_BANNER:
1980                 str = _("De-select if you don't want the startup banner.");
1981                 break;
1982
1983         case RC_WHEEL_JUMP:
1984                 str = _("The wheel movement factor (for mice with wheels or five button mice).");
1985                 break;
1986
1987         case RC_CONVERTER:
1988                 break;
1989
1990         case RC_VIEWER:
1991                 break;
1992
1993         case RC_FORMAT:
1994                 break;
1995
1996         case RC_NEW_ASK_FILENAME:
1997                 str = _("This sets the behaviour if you want to be asked for a filename when creating a new document or wait until you save it and be asked then.");
1998                 break;
1999
2000         case RC_DEFAULT_LANGUAGE:
2001                 str = _("New documents will be assigned this language.");
2002                 break;
2003
2004         case RC_LABEL_INIT_LENGTH:
2005                 str = _("Maximum number of words in the initialization string for a new label");
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;