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