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