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