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