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