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