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