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