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