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