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