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