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