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