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