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