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