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