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