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