]> git.lyx.org Git - lyx.git/blob - src/lyxrc.C
3b7a3d408a305822c658941f65d856eabaee6d72
[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                             || token(command, ' ', 0) == "none") {
1057                                 converters.erase(from, to);
1058                         } else {
1059                                 converters.add(from, to, command, flags);
1060                         }
1061                         break;
1062                 }
1063                 // compatibility with versions older than 1.4.0 only
1064                 case RC_VIEWER: {
1065                         string format, command;
1066                         if (lexrc.next()) {
1067                                 format = lexrc.getString();
1068                         }
1069                         if (lexrc.next()) {
1070                                 command = lexrc.getString();
1071                         }
1072                         formats.setViewer(format, command);
1073                         break;
1074                 }
1075                 case RC_FORMAT: {
1076                         string format, extension, prettyname, shortcut;
1077                         if (lexrc.next()) {
1078                                 format = lexrc.getString();
1079                         }
1080                         if (lexrc.next()) {
1081                                 extension = lexrc.getString();
1082                         }
1083                         if (lexrc.next()) {
1084                                 prettyname = lexrc.getString();
1085                         }
1086                         if (lexrc.next()) {
1087                                 shortcut = lexrc.getString();
1088                         }
1089                         string viewer, editor;
1090                         if (lexrc.next())
1091                                 viewer = lexrc.getString();
1092                         if (lexrc.next())
1093                                 editor = lexrc.getString();
1094                         // The only supported flag for now is "document".
1095                         // More flags could be added in the future.
1096                         // Therefore we use tokenPos below to read the flag.
1097                         string flags;
1098                         // Hack to ensure compatibility with versions older
1099                         // than 1.5.0
1100                         int le = lexrc.lex();
1101                         if (le != LyXLex::LEX_FEOF && le != LyXLex::LEX_UNDEF) {
1102                                 flags = lexrc.getString();
1103                                 if (le != LyXLex::LEX_DATA) {
1104                                         // We have got a known token.
1105                                         // Therefore this is an old style
1106                                         // format definition without
1107                                         // flags.
1108                                         lexrc.pushToken(flags);
1109                                         flags.erase();
1110                                 }
1111                         }
1112                         bool const document =
1113                                 (tokenPos(flags, ',', "document") >= 0);
1114                         if (!flags.empty() && flags != "document")
1115                                 lyxerr << "Ignoring flags other than "
1116                                           "`document' in `" << flags
1117                                        << "' for format `" << format << "'."
1118                                        << endl;
1119                         if (prettyname.empty()) {
1120                                 if (converters.formatIsUsed(format)) {
1121                                         lyxerr << "Can't delete format "
1122                                                << format << endl;
1123                                 } else {
1124                                         formats.erase(format);
1125                                 }
1126                         } else {
1127                                 formats.add(format, extension, prettyname,
1128                                             shortcut, viewer, editor, document);
1129                         }
1130                         break;
1131                 }
1132                 case RC_DEFAULT_LANGUAGE:
1133                         if (lexrc.next()) {
1134                                 default_language = lexrc.getString();
1135                         }
1136                         break;
1137
1138                 case RC_LABEL_INIT_LENGTH:
1139                         if (lexrc.next()) {
1140                                 label_init_length = lexrc.getInteger();
1141                         }
1142                         break;
1143
1144                 case RC_SHOW_BANNER:
1145                         if (lexrc.next()) {
1146                                 show_banner = lexrc.getBool();
1147                         }
1148                         break;
1149
1150                 case RC_PREVIEW:
1151                         if (lexrc.next()) {
1152                                 string const tmp = lexrc.getString();
1153                                 if (tmp == "true" || tmp == "on")
1154                                         preview = PREVIEW_ON;
1155                                 else if (tmp == "no_math")
1156                                         preview = PREVIEW_NO_MATH;
1157                                 else {
1158                                         preview = PREVIEW_OFF;
1159                                         if (tmp != "false" && tmp != "off")
1160                                                 lyxerr << "Unrecognized "
1161                                                         "preview status \""
1162                                                        << tmp << '\n' << endl;
1163                                 }
1164                         }
1165                         break;
1166
1167                 case RC_PREVIEW_HASHED_LABELS:
1168                         if (lexrc.next()) {
1169                                 preview_hashed_labels = lexrc.getBool();
1170                         }
1171                         break;
1172
1173                 case RC_PREVIEW_SCALE_FACTOR:
1174                         if (lexrc.next()) {
1175                                 preview_scale_factor = lexrc.getString();
1176                         }
1177                         break;
1178
1179                 case RC_USER_NAME:
1180                         if (lexrc.next())
1181                                 user_name = lexrc.getString();
1182                         break;
1183
1184                 case RC_USER_EMAIL:
1185                         if (lexrc.next())
1186                                 user_email = lexrc.getString();
1187                         break;
1188
1189                 case RC_PATH_PREFIX:
1190                         if (lexrc.next())
1191                                 path_prefix = lexrc.getString();
1192                         break;
1193
1194                 case RC_LAST: break; // this is just a dummy
1195                 }
1196         }
1197
1198         /// Update converters data-structures
1199         converters.update(formats);
1200         converters.buildGraph();
1201
1202         return 0;
1203 }
1204
1205
1206 void LyXRC::write(string const & filename, bool ignore_system_lyxrc) const
1207 {
1208         ofstream ofs(filename.c_str());
1209         if (ofs)
1210                 write(ofs, ignore_system_lyxrc);
1211 }
1212
1213
1214 void LyXRC::print() const
1215 {
1216         if (lyxerr.debugging())
1217                 write(lyxerr, false);
1218         else
1219                 write(cout, false);
1220 }
1221
1222
1223 class SameMover {
1224 public:
1225         typedef std::pair<std::string, SpecialisedMover> Data;
1226
1227         SameMover(Data const & comparison)
1228                 : comparison_(comparison) {}
1229
1230         bool operator()(Data const & data) const
1231         {
1232                 return data.first == comparison_.first &&
1233                         data.second.command() == comparison_.second.command();
1234         }
1235
1236 private:
1237         Data comparison_;
1238 };
1239
1240
1241 void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
1242 {
1243         os << "### This file is part of\n"
1244            << "### ========================================================\n"
1245            << "###          LyX, The Document Processor\n"
1246            << "###\n"
1247            << "###          Copyright 1995 Matthias Ettrich\n"
1248            << "###          Copyright 1995-2001 The LyX Team.\n"
1249            << "###\n"
1250            << "### ========================================================\n"
1251            << "\n"
1252            << "# This file is written by LyX, if you want to make your own\n"
1253            << "# modifications you should do them from inside LyX and save\n"
1254            << "\n";
1255
1256         // Why the switch you might ask. It is a trick to ensure that all
1257         // the elements in the LyXRCTags enum is handled. As you can see
1258         // there are no breaks at all. So it is just a huge fall-through.
1259         // The nice thing is that we will get a warning from the compiler
1260         // if we forget an element.
1261         LyXRCTags tag = RC_LAST;
1262         switch (tag) {
1263         case RC_LAST:
1264         case RC_INPUT:
1265                 // input/include files are not done here
1266         case RC_BINDFILE:
1267                 if (ignore_system_lyxrc ||
1268                     bind_file != system_lyxrc.bind_file) {
1269                         string const path = os::external_path(bind_file);
1270                         os << "\\bind_file \"" << path << "\"\n";
1271                 }
1272                 //
1273                 // Misc Section
1274                 //
1275                 os << "\n#\n"
1276                    << "# MISC SECTION ######################################\n"
1277                    << "#\n\n";
1278
1279                 // bind files are not done here.
1280
1281         case RC_PATH_PREFIX:
1282                 if (ignore_system_lyxrc ||
1283                     path_prefix != system_lyxrc.path_prefix) {
1284                         os << "\\path_prefix \"" << path_prefix << "\"\n";
1285                 }
1286
1287         case RC_UIFILE:
1288                 if (ignore_system_lyxrc ||
1289                     ui_file != system_lyxrc.ui_file) {
1290                         string const path = os::external_path(ui_file);
1291                         os << "\\ui_file \"" << path << "\"\n";
1292                 }
1293         case RC_AUTOREGIONDELETE:
1294                 if (ignore_system_lyxrc ||
1295                     auto_region_delete != system_lyxrc.auto_region_delete) {
1296                         os << "# Set to false to inhibit automatic replacement of\n"
1297                            << "# the current selection.\n"
1298                            << "\\auto_region_delete " << convert<string>(auto_region_delete)
1299                            << '\n';
1300                 }
1301         case RC_AUTORESET_OPTIONS:
1302                 if (ignore_system_lyxrc ||
1303                     auto_reset_options != system_lyxrc.auto_reset_options) {
1304                         os << "# Set to false to inhibit automatic reset of\n"
1305                            << "# the class options to defaults on class change.\n"
1306                            << "\\auto_reset_options "
1307                            << convert<string>(auto_reset_options)
1308                            << '\n';
1309                 }
1310         case RC_AUTOSAVE:
1311                 if (ignore_system_lyxrc ||
1312                     autosave != system_lyxrc.autosave) {
1313                         os << "# The time interval between auto-saves in seconds.\n"
1314                            << "\\autosave " << autosave << '\n';
1315                 }
1316         case RC_DISPLAY_GRAPHICS:
1317                 if (ignore_system_lyxrc ||
1318                     display_graphics != system_lyxrc.display_graphics) {
1319                         os << "# Display graphics within LyX\n"
1320                            << "# monochrome|grayscale|color|none\n"
1321                            << "\\display_graphics "
1322                            << lyx::graphics::displayTranslator().find(display_graphics)
1323                            << '\n';
1324                 }
1325
1326         case RC_VIEWDVI_PAPEROPTION:
1327                 if (ignore_system_lyxrc ||
1328                     view_dvi_paper_option
1329                     != system_lyxrc.view_dvi_paper_option) {
1330                         os << "# Options used to specify paper size to the\n"
1331                            << "# view_dvi_command (e.g. -paper)\n"
1332                            << "\\view_dvi_paper_option \""
1333                            << view_dvi_paper_option << "\"\n";
1334                 }
1335         case RC_DEFAULT_PAPERSIZE:
1336                 if (ignore_system_lyxrc ||
1337                     default_papersize != system_lyxrc.default_papersize) {
1338                         os << "# The default papersize to use.\n"
1339                            << "\\default_papersize \"";
1340                         switch (default_papersize) {
1341                         case PAPER_DEFAULT:
1342                                 os << "default"; break;
1343                         case PAPER_USLETTER:
1344                                 os << "usletter"; break;
1345                         case PAPER_USLEGAL:
1346                                 os << "legal"; break;
1347                         case PAPER_USEXECUTIVE:
1348                                 os << "executive"; break;
1349                         case PAPER_A3:
1350                                 os << "a3"; break;
1351                         case PAPER_A4:
1352                                 os << "a4"; break;
1353                         case PAPER_A5:
1354                                 os << "a5"; break;
1355                         case PAPER_B5:
1356                                 os << "b5"; break;
1357                         case PAPER_CUSTOM:
1358                         case PAPER_B3:
1359                         case PAPER_B4: break;
1360                         }
1361                         os << "\"\n";
1362                 }
1363         case RC_CHKTEX_COMMAND:
1364                 if (ignore_system_lyxrc ||
1365                     chktex_command != system_lyxrc.chktex_command) {
1366                         os << "\\chktex_command \"" << chktex_command << "\"\n";
1367                 }
1368         case RC_BIBTEX_COMMAND:
1369                 if (ignore_system_lyxrc ||
1370                     bibtex_command != system_lyxrc.bibtex_command) {
1371                         os << "\\bibtex_command \"" << bibtex_command << "\"\n";
1372                 }
1373         case RC_INDEX_COMMAND:
1374                 if (ignore_system_lyxrc ||
1375                     index_command != system_lyxrc.index_command) {
1376                         os << "\\index_command \"" << index_command << "\"\n";
1377                 }
1378         case RC_CYGWIN_PATH_FIX:
1379                 if (ignore_system_lyxrc ||
1380                     cygwin_path_fix != system_lyxrc.cygwin_path_fix) {
1381                         os << "\\cygwin_path_fix_needed "
1382                            << convert<string>(cygwin_path_fix) << '\n';
1383                 }
1384         case RC_TEX_ALLOWS_SPACES:
1385                 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1386                         os << "\\tex_allows_spaces "
1387                            << convert<string>(tex_allows_spaces) << '\n';
1388                 }
1389         case RC_KBMAP:
1390                 if (ignore_system_lyxrc ||
1391                     use_kbmap != system_lyxrc.use_kbmap) {
1392                         os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1393                 }
1394         case RC_KBMAP_PRIMARY:
1395                 if (ignore_system_lyxrc ||
1396                     primary_kbmap != system_lyxrc.primary_kbmap) {
1397                         string const path = os::external_path(primary_kbmap);
1398                         os << "\\kbmap_primary \"" << path << "\"\n";
1399                 }
1400         case RC_KBMAP_SECONDARY:
1401                 if (ignore_system_lyxrc ||
1402                     secondary_kbmap != system_lyxrc.secondary_kbmap) {
1403                         string const path = os::external_path(secondary_kbmap);
1404                         os << "\\kbmap_secondary \"" << path << "\"\n";
1405                 }
1406         case RC_SERVERPIPE:
1407                 if (ignore_system_lyxrc ||
1408                     lyxpipes != system_lyxrc.lyxpipes) {
1409                         string const path = os::external_path(lyxpipes);
1410                         os << "\\serverpipe \"" << path << "\"\n";
1411                 }
1412         case RC_DATE_INSERT_FORMAT:
1413                 if (ignore_system_lyxrc ||
1414                     date_insert_format != system_lyxrc.date_insert_format) {
1415                         os << "\\date_insert_format \"" << date_insert_format
1416                            << "\"\n";
1417                 }
1418         case RC_LABEL_INIT_LENGTH:
1419                 if (ignore_system_lyxrc ||
1420                     label_init_length != system_lyxrc.label_init_length) {
1421                         os << "\\label_init_length " << label_init_length
1422                            << '\n';
1423                 }
1424
1425         case RC_USER_NAME:
1426                 os << "\\user_name \"" << user_name << "\"\n";
1427
1428         case RC_USER_EMAIL:
1429                 os << "\\user_email \"" << user_email << "\"\n";
1430
1431         case RC_SHOW_BANNER:
1432                 if (ignore_system_lyxrc ||
1433                     show_banner != system_lyxrc.show_banner) {
1434                         os << "\\show_banner " << convert<string>(show_banner) << '\n';
1435                 }
1436
1437         case RC_PREVIEW:
1438                 if (ignore_system_lyxrc ||
1439                     preview != system_lyxrc.preview) {
1440                         string status;
1441                         switch (preview) {
1442                         case PREVIEW_ON:
1443                                 status = "on";
1444                                 break;
1445                         case PREVIEW_NO_MATH:
1446                                 status = "no_math";
1447                                 break;
1448                         case PREVIEW_OFF:
1449                                 status = "off";
1450                                 break;
1451                         }
1452                         os << "\\preview " << status << '\n';
1453                 }
1454
1455         case RC_PREVIEW_HASHED_LABELS:
1456                 if (ignore_system_lyxrc ||
1457                     preview_hashed_labels !=
1458                     system_lyxrc.preview_hashed_labels) {
1459                         os << "\\preview_hashed_labels "
1460                            << convert<string>(preview_hashed_labels) << '\n';
1461                 }
1462
1463         case RC_PREVIEW_SCALE_FACTOR:
1464                 if (ignore_system_lyxrc ||
1465                     preview_scale_factor != system_lyxrc.preview_scale_factor) {
1466                         os << "\\preview_scale_factor "
1467                            << preview_scale_factor << '\n';
1468                 }
1469
1470                 os << "\n#\n"
1471                    << "# SCREEN & FONTS SECTION ############################\n"
1472                    << "#\n\n";
1473
1474         case RC_POPUP_NORMAL_FONT:
1475                 if (ignore_system_lyxrc ||
1476                     popup_normal_font != system_lyxrc.popup_normal_font) {
1477                         os << "\\popup_normal_font \"" << popup_normal_font
1478                            << "\"\n";
1479                 }
1480         case RC_POPUP_BOLD_FONT:
1481                 if (ignore_system_lyxrc ||
1482                     popup_bold_font != system_lyxrc.popup_bold_font) {
1483                         os << "\\popup_bold_font \"" << popup_bold_font
1484                            << "\"\n";
1485                 }
1486         case RC_POPUP_FONT_ENCODING:
1487                 if (ignore_system_lyxrc ||
1488                     popup_font_encoding != system_lyxrc.popup_font_encoding) {
1489                         os << "\\popup_font_encoding \"" << popup_font_encoding
1490                            << "\"\n";
1491                 }
1492         case RC_SCREEN_DPI:
1493                 if (ignore_system_lyxrc ||
1494                     dpi != system_lyxrc.dpi) {
1495                         os << "\\screen_dpi " << dpi << '\n';
1496                 }
1497         case RC_SCREEN_ZOOM:
1498                 if (ignore_system_lyxrc ||
1499                     zoom != system_lyxrc.zoom) {
1500                         os << "\\screen_zoom " << zoom << '\n';
1501                 }
1502         case RC_SCREEN_GEOMETRY_HEIGHT:
1503                 if (ignore_system_lyxrc ||
1504                     geometry_height != system_lyxrc.geometry_height) {
1505                         os << "\\screen_geometry_height " << geometry_height
1506                            << '\n';
1507                 }
1508         case RC_SCREEN_GEOMETRY_WIDTH:
1509                 if (ignore_system_lyxrc ||
1510                     geometry_width != system_lyxrc.geometry_width) {
1511                         os << "\\screen_geometry_width " << geometry_width
1512                            << '\n';
1513                 }
1514         case RC_SCREEN_GEOMETRY_XYSAVED:
1515                 if (ignore_system_lyxrc ||
1516                     geometry_xysaved != system_lyxrc.geometry_xysaved) {
1517                         os << "\\screen_geometry_xysaved " << convert<string>(geometry_xysaved)
1518                            << '\n';
1519                 }
1520         case RC_WHEEL_JUMP:
1521                 if (ignore_system_lyxrc ||
1522                     wheel_jump != system_lyxrc.wheel_jump) {
1523                         os << "\\wheel_jump " << wheel_jump << '\n';
1524                 }
1525         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1526                 if (ignore_system_lyxrc ||
1527                     cursor_follows_scrollbar
1528                     != system_lyxrc.cursor_follows_scrollbar) {
1529                         os << "\\cursor_follows_scrollbar "
1530                            << convert<string>(cursor_follows_scrollbar) << '\n';
1531                 }
1532         case RC_DIALOGS_ICONIFY_WITH_MAIN:
1533                 if (ignore_system_lyxrc ||
1534                     dialogs_iconify_with_main
1535                    != system_lyxrc.dialogs_iconify_with_main) {
1536                         os << "\\dialogs_iconify_with_main "
1537                           <<  convert<string>(dialogs_iconify_with_main) << '\n';
1538                 }
1539         case RC_SCREEN_FONT_ROMAN:
1540                 if (ignore_system_lyxrc ||
1541                     roman_font_name != system_lyxrc.roman_font_name) {
1542                         os << "\\screen_font_roman \"" << roman_font_name
1543                            << "\"\n";
1544                 }
1545         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1546                 if (ignore_system_lyxrc ||
1547                     roman_font_foundry != system_lyxrc.roman_font_foundry) {
1548                         os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1549                            << "\"\n";
1550                 }
1551         case RC_SCREEN_FONT_SANS:
1552                 if (ignore_system_lyxrc ||
1553                     sans_font_name != system_lyxrc.sans_font_name) {
1554                         os << "\\screen_font_sans \"" << sans_font_name
1555                            << "\"\n";
1556                 }
1557         case RC_SCREEN_FONT_SANS_FOUNDRY:
1558                 if (ignore_system_lyxrc ||
1559                     sans_font_foundry != system_lyxrc.sans_font_foundry) {
1560                         os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1561                            << "\"\n";
1562                 }
1563         case RC_SCREEN_FONT_TYPEWRITER:
1564                 if (ignore_system_lyxrc ||
1565                     typewriter_font_name != system_lyxrc.typewriter_font_name) {
1566                         os << "\\screen_font_typewriter \""
1567                            << typewriter_font_name << "\"\n";
1568                 }
1569         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1570                 if (ignore_system_lyxrc ||
1571                     typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1572                         os << "\\screen_font_typewriter_foundry \""
1573                            << typewriter_font_foundry << "\"\n";
1574                 }
1575
1576         case RC_SCREEN_FONT_SCALABLE:
1577                 if (ignore_system_lyxrc ||
1578                     use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1579                         os << "\\screen_font_scalable "
1580                            << convert<string>(use_scalable_fonts)
1581                            << '\n';
1582                 }
1583         case RC_SCREEN_FONT_ENCODING:
1584                 if (ignore_system_lyxrc ||
1585                     font_norm != system_lyxrc.font_norm) {
1586                         os << "\\screen_font_encoding \"" << font_norm
1587                            << "\"\n";
1588                 }
1589         case RC_SCREEN_FONT_SIZES:
1590                 if (ignore_system_lyxrc ||
1591                     font_sizes[LyXFont::SIZE_TINY]
1592                     != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1593                     font_sizes[LyXFont::SIZE_SCRIPT]
1594                     != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1595                     font_sizes[LyXFont::SIZE_FOOTNOTE]
1596                     != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1597                     font_sizes[LyXFont::SIZE_SMALL]
1598                     != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1599                     font_sizes[LyXFont::SIZE_NORMAL]
1600                     != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1601                     font_sizes[LyXFont::SIZE_LARGE]
1602                     != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1603                     font_sizes[LyXFont::SIZE_LARGER]
1604                     != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1605                     font_sizes[LyXFont::SIZE_LARGEST]
1606                     != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1607                     font_sizes[LyXFont::SIZE_HUGE]
1608                     != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1609                     font_sizes[LyXFont::SIZE_HUGER]
1610                     != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1611                         os.setf(ios::fixed);
1612                         os.precision(2);
1613                         os << "\\screen_font_sizes"
1614                            << ' ' << font_sizes[LyXFont::SIZE_TINY]
1615                            << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1616                            << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1617                            << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1618                            << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1619                            << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1620                            << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1621                            << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1622                            << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1623                            << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1624                            << '\n';
1625                 }
1626
1627                 os << "\n#\n"
1628                    << "# COLOR SECTION ###################################\n"
1629                    << "#\n\n";
1630
1631         case RC_SET_COLOR:
1632                 for (int i = 0; i < LColor::ignore; ++i) {
1633                         LColor::color lc = static_cast<LColor::color>(i);
1634
1635                         string const col(lcolor.getX11Name(lc));
1636                         if (ignore_system_lyxrc ||
1637                             col != system_lcolor.getX11Name(lc)) {
1638                                 os << "\\set_color \""
1639                                    << lcolor.getLyXName(lc) << "\" \""
1640                                    << col << "\"\n";
1641                         }
1642                 }
1643
1644                 os << "\n#\n"
1645                    << "# PRINTER SECTION ###################################\n"
1646                    << "#\n\n";
1647
1648         case RC_PRINTER:
1649                 if (ignore_system_lyxrc ||
1650                     printer != system_lyxrc.printer) {
1651                         os << "\\printer \"" << printer << "\"\n";
1652                 }
1653         case RC_PRINT_ADAPTOUTPUT:
1654                 if (ignore_system_lyxrc ||
1655                     print_adapt_output != system_lyxrc.print_adapt_output) {
1656                         os << "\\print_adapt_output "
1657                            << convert<string>(print_adapt_output)
1658                            << '\n';
1659                 }
1660         case RC_PRINT_COMMAND:
1661                 if (ignore_system_lyxrc ||
1662                     print_command != system_lyxrc.print_command) {
1663                         os << "\\print_command \"" << print_command << "\"\n";
1664                 }
1665         case RC_PRINTEXSTRAOPTIONS:
1666                 if (ignore_system_lyxrc ||
1667                     print_extra_options != system_lyxrc.print_extra_options) {
1668                         os << "\\print_extra_options \"" << print_extra_options
1669                            << "\"\n";
1670                 }
1671         case RC_PRINTSPOOL_COMMAND:
1672                 if (ignore_system_lyxrc ||
1673                     print_spool_command != system_lyxrc.print_spool_command) {
1674                         os << "\\print_spool_command \"" << print_spool_command
1675                            << "\"\n";
1676                 }
1677         case RC_PRINTSPOOL_PRINTERPREFIX:
1678                 if (ignore_system_lyxrc ||
1679                     print_spool_printerprefix
1680                     != system_lyxrc.print_spool_printerprefix) {
1681                         os << "\\print_spool_printerprefix \""
1682                            << print_spool_printerprefix << "\"\n";
1683                 }
1684         case RC_PRINTEVENPAGEFLAG:
1685                 if (ignore_system_lyxrc ||
1686                     print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1687                         os << "\\print_evenpage_flag \"" << print_evenpage_flag
1688                            << "\"\n";
1689                 }
1690         case RC_PRINTODDPAGEFLAG:
1691                 if (ignore_system_lyxrc ||
1692                     print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1693                         os << "\\print_oddpage_flag \"" << print_oddpage_flag
1694                            << "\"\n";
1695                 }
1696         case RC_PRINTREVERSEFLAG:
1697                 if (ignore_system_lyxrc ||
1698                     print_reverse_flag != system_lyxrc.print_reverse_flag) {
1699                         os << "\\print_reverse_flag \"" << print_reverse_flag
1700                            << "\"\n";
1701                 }
1702         case RC_PRINTLANDSCAPEFLAG:
1703                 if (ignore_system_lyxrc ||
1704                     print_landscape_flag != system_lyxrc.print_landscape_flag) {
1705                         os << "\\print_landscape_flag \"" << print_landscape_flag
1706                            << "\"\n";
1707                 }
1708         case RC_PRINTPAGERANGEFLAG:
1709                 if (ignore_system_lyxrc ||
1710                     print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1711                         os << "\\print_pagerange_flag \"" << print_pagerange_flag
1712                            << "\"\n";
1713                 }
1714         case RC_PRINTCOPIESFLAG:
1715                 if (ignore_system_lyxrc ||
1716                     print_copies_flag != system_lyxrc.print_copies_flag) {
1717                         os << "\\print_copies_flag \"" << print_copies_flag
1718                            << "\"\n";
1719                 }
1720         case RC_PRINTCOLLCOPIESFLAG:
1721                 if (ignore_system_lyxrc ||
1722                     print_collcopies_flag
1723                     != system_lyxrc.print_collcopies_flag) {
1724                         os << "\\print_collcopies_flag \""
1725                            << print_collcopies_flag
1726                            << "\"\n";
1727                 }
1728         case RC_PRINTPAPERFLAG:
1729                 if (ignore_system_lyxrc ||
1730                     print_paper_flag != system_lyxrc.print_paper_flag) {
1731                         os << "\\print_paper_flag \"" << print_paper_flag
1732                            << "\"\n";
1733                 }
1734         case RC_PRINTPAPERDIMENSIONFLAG:
1735                 if (ignore_system_lyxrc ||
1736                     print_paper_dimension_flag
1737                     != system_lyxrc.print_paper_dimension_flag) {
1738                         os << "\\print_paper_dimension_flag \""
1739                            << print_paper_dimension_flag << "\"\n";
1740                 }
1741         case RC_PRINTTOPRINTER:
1742                 if (ignore_system_lyxrc ||
1743                     print_to_printer != system_lyxrc.print_to_printer) {
1744                         os << "\\print_to_printer \"" << print_to_printer
1745                            << "\"\n";
1746                 }
1747         case RC_PRINTTOFILE:
1748                 if (ignore_system_lyxrc ||
1749                     print_to_file != system_lyxrc.print_to_file) {
1750                         string const path = os::external_path(print_to_file);
1751                         os << "\\print_to_file \"" << path << "\"\n";
1752                 }
1753         case RC_PRINTFILEEXTENSION:
1754                 if (ignore_system_lyxrc ||
1755                     print_file_extension != system_lyxrc.print_file_extension) {
1756                         os << "\\print_file_extension \""
1757                            << print_file_extension
1758                            << "\"\n";
1759                 }
1760
1761                 os << "\n#\n"
1762                    << "# EXPORT SECTION ####################################\n"
1763                    << "#\n\n";
1764
1765         case RC_CUSTOM_EXPORT_COMMAND:
1766                 if (ignore_system_lyxrc ||
1767                     custom_export_command
1768                     != system_lyxrc.custom_export_command) {
1769                         os << "\\custom_export_command \""
1770                            << custom_export_command
1771                            << "\"\n";
1772                 }
1773         case RC_CUSTOM_EXPORT_FORMAT:
1774                 if (ignore_system_lyxrc ||
1775                     custom_export_format
1776                     != system_lyxrc.custom_export_format) {
1777                         os << "\\custom_export_format \"" << custom_export_format
1778                            << "\"\n";
1779                 }
1780
1781                 os << "\n#\n"
1782                    << "# TEX SECTION #######################################\n"
1783                    << "#\n\n";
1784
1785         case RC_FONT_ENCODING:
1786                 if (ignore_system_lyxrc ||
1787                     fontenc != system_lyxrc.fontenc) {
1788                         os << "\\font_encoding \"" << fontenc << "\"\n";
1789                 }
1790
1791                 os << "\n#\n"
1792                    << "# FILE SECTION ######################################\n"
1793                    << "#\n\n";
1794
1795         case RC_DOCUMENTPATH:
1796                 if (ignore_system_lyxrc ||
1797                     document_path != system_lyxrc.document_path) {
1798                         string const path = os::external_path(document_path);
1799                         os << "\\document_path \"" << path << "\"\n";
1800                 }
1801         case RC_USELASTFILEPOS:
1802                 if (ignore_system_lyxrc ||
1803                     use_lastfilepos != system_lyxrc.use_lastfilepos) {
1804                         os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
1805                            << '\n';
1806                 }
1807         case RC_LOADSESSION:
1808                 if (ignore_system_lyxrc ||
1809                     load_session != system_lyxrc.load_session) {
1810                         os << "\\load_session " << convert<string>(load_session)
1811                            << "\n";
1812                 }
1813         case RC_NUMLASTFILES:
1814                 if (ignore_system_lyxrc ||
1815                     num_lastfiles != system_lyxrc.num_lastfiles) {
1816                         os << "\\num_lastfiles " << num_lastfiles << '\n';
1817                 }
1818         case RC_CHECKLASTFILES:
1819                 if (ignore_system_lyxrc ||
1820                     check_lastfiles != system_lyxrc.check_lastfiles) {
1821                         os << "\\check_lastfiles " << convert<string>(check_lastfiles)
1822                            << '\n';
1823                 }
1824         case RC_TEMPLATEPATH:
1825                 if (ignore_system_lyxrc ||
1826                     template_path != system_lyxrc.template_path) {
1827                         string const path = os::external_path(template_path);
1828                         os << "\\template_path \"" << path << "\"\n";
1829                 }
1830         case RC_TEMPDIRPATH:
1831                 if (ignore_system_lyxrc ||
1832                     tempdir_path != system_lyxrc.tempdir_path) {
1833                         string const path = os::external_path(tempdir_path);
1834                         os << "\\tempdir_path \"" << path << "\"\n";
1835                 }
1836         case RC_USETEMPDIR:
1837                 // Ignore it
1838         case RC_ASCII_LINELEN:
1839                 if (ignore_system_lyxrc ||
1840                     ascii_linelen != system_lyxrc.ascii_linelen) {
1841                         os << "\\ascii_linelen " << ascii_linelen << '\n';
1842                 }
1843         case RC_MAKE_BACKUP:
1844                 if (ignore_system_lyxrc ||
1845                     make_backup != system_lyxrc.make_backup) {
1846                         os << "\\make_backup " << convert<string>(make_backup) << '\n';
1847                 }
1848         case RC_BACKUPDIR_PATH:
1849                 if (ignore_system_lyxrc ||
1850                     backupdir_path != system_lyxrc.backupdir_path) {
1851                         string const path = os::external_path(backupdir_path);
1852                         os << "\\backupdir_path \"" << path << "\"\n";
1853                 }
1854
1855                 os << "\n#\n"
1856                    << "# ASCII EXPORT SECTION ##############################\n"
1857                    << "#\n\n";
1858
1859         case RC_ASCIIROFF_COMMAND:
1860                 if (ignore_system_lyxrc ||
1861                     ascii_roff_command != system_lyxrc.ascii_roff_command) {
1862                         os << "\\ascii_roff_command \"" << ascii_roff_command
1863                            << "\"\n";
1864                 }
1865
1866                 os << "\n#\n"
1867                    << "# SPELLCHECKER SECTION ##############################\n"
1868                    << "#\n\n";
1869         case RC_USE_SPELL_LIB:
1870                 if (ignore_system_lyxrc ||
1871                     use_spell_lib != system_lyxrc.use_spell_lib) {
1872                         os << "\\use_spell_lib " << convert<string>(use_spell_lib) << '\n';
1873                 }
1874         case RC_SPELL_COMMAND:
1875                 if (ignore_system_lyxrc ||
1876                     isp_command != system_lyxrc.isp_command) {
1877                         os << "\\spell_command \"" << isp_command << "\"\n";
1878                 }
1879         case RC_ACCEPT_COMPOUND:
1880                 if (ignore_system_lyxrc ||
1881                     isp_accept_compound != system_lyxrc.isp_accept_compound) {
1882                         os << "\\accept_compound " << convert<string>(isp_accept_compound)
1883                            << '\n';
1884                 }
1885         case RC_USE_ALT_LANG:
1886                 if (ignore_system_lyxrc ||
1887                     isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1888                         os << "\\use_alt_language " << convert<string>(isp_use_alt_lang)
1889                            << '\n';
1890                 }
1891         case RC_ALT_LANG:
1892                 if (ignore_system_lyxrc ||
1893                     isp_alt_lang != system_lyxrc.isp_alt_lang) {
1894                         os << "\\alternate_language \"" << isp_alt_lang
1895                            << "\"\n";
1896                 }
1897         case RC_USE_ESC_CHARS:
1898                 if (ignore_system_lyxrc ||
1899                     isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1900                         os << "\\use_escape_chars " << convert<string>(isp_use_esc_chars)
1901                            << '\n';
1902                 }
1903         case RC_ESC_CHARS:
1904                 if (ignore_system_lyxrc ||
1905                     isp_esc_chars != system_lyxrc.isp_esc_chars) {
1906                         os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1907                 }
1908         case RC_USE_PERS_DICT:
1909                 if (ignore_system_lyxrc ||
1910                     isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1911                         os << "\\use_personal_dictionary "
1912                            << convert<string>(isp_use_pers_dict)
1913                            << '\n';
1914                 }
1915         case RC_PERS_DICT:
1916                 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1917                         string const path = os::external_path(isp_pers_dict);
1918                         os << "\\personal_dictionary \"" << path << "\"\n";
1919                 }
1920         case RC_USE_INP_ENC:
1921                 if (ignore_system_lyxrc ||
1922                     isp_use_input_encoding
1923                     != system_lyxrc.isp_use_input_encoding) {
1924                         os << "\\use_input_encoding "
1925                            << convert<string>(isp_use_input_encoding)
1926                            << '\n';
1927                 }
1928
1929                 os << "\n#\n"
1930                    << "# LANGUAGE SUPPORT SECTION ##########################\n"
1931                    << "#\n\n";
1932
1933         case RC_RTL_SUPPORT:
1934                 if (ignore_system_lyxrc ||
1935                     rtl_support != system_lyxrc.rtl_support) {
1936                         os << "\\rtl " << convert<string>(rtl_support) << '\n';
1937                 }
1938         case RC_LANGUAGE_PACKAGE:
1939                 if (ignore_system_lyxrc ||
1940                     language_package != system_lyxrc.language_package) {
1941                         os << "\\language_package \"" << language_package
1942                            << "\"\n";
1943                 }
1944         case RC_LANGUAGE_GLOBAL_OPTIONS:
1945                 if (ignore_system_lyxrc ||
1946                     language_global_options
1947                     != system_lyxrc.language_global_options) {
1948                         os << "\\language_global_options \""
1949                            << convert<string>(language_global_options)
1950                            << "\"\n";
1951                 }
1952         case RC_LANGUAGE_USE_BABEL:
1953                 if (ignore_system_lyxrc ||
1954                     language_use_babel != system_lyxrc.language_use_babel) {
1955                         os << "\\language_use_babel \""
1956                            << convert<string>(language_use_babel)
1957                            << "\"\n";
1958                 }
1959         case RC_LANGUAGE_COMMAND_BEGIN:
1960                 if (ignore_system_lyxrc ||
1961                     language_command_begin
1962                     != system_lyxrc.language_command_begin) {
1963                         os << "\\language_command_begin \""
1964                            << language_command_begin
1965                            << "\"\n";
1966                 }
1967         case RC_LANGUAGE_COMMAND_END:
1968                 if (ignore_system_lyxrc ||
1969                     language_command_end
1970                     != system_lyxrc.language_command_end) {
1971                         os << "\\language_command_end \"" << language_command_end
1972                            << "\"\n";
1973                 }
1974         case RC_LANGUAGE_COMMAND_LOCAL:
1975                 if (ignore_system_lyxrc ||
1976                     language_command_local
1977                     != system_lyxrc.language_command_local) {
1978                         os << "\\language_command_local \""
1979                            << language_command_local
1980                            << "\"\n";
1981                 }
1982         case RC_LANGUAGE_AUTO_BEGIN:
1983                 if (ignore_system_lyxrc ||
1984                     language_auto_begin != system_lyxrc.language_auto_begin) {
1985                         os << "\\language_auto_begin "
1986                            << convert<string>(language_auto_begin) << '\n';
1987                 }
1988         case RC_LANGUAGE_AUTO_END:
1989                 if (ignore_system_lyxrc ||
1990                     language_auto_end != system_lyxrc.language_auto_end) {
1991                         os << "\\language_auto_end "
1992                            << convert<string>(language_auto_end) << '\n';
1993                 }
1994         case RC_MARK_FOREIGN_LANGUAGE:
1995                 if (ignore_system_lyxrc ||
1996                     mark_foreign_language
1997                     != system_lyxrc.mark_foreign_language) {
1998                         os << "\\mark_foreign_language " <<
1999                                 convert<string>(mark_foreign_language) << '\n';
2000                 }
2001
2002                 os << "\n#\n"
2003                    << "# 2nd MISC SUPPORT SECTION ##########################\n"
2004                    << "#\n\n";
2005
2006         case RC_AUTO_NUMBER:
2007                 if (ignore_system_lyxrc ||
2008                     auto_number != system_lyxrc.auto_number) {
2009                         os << "\\auto_number " << convert<string>(auto_number) << '\n';
2010                 }
2011         case RC_DEFAULT_LANGUAGE:
2012                 if (ignore_system_lyxrc ||
2013                     default_language != system_lyxrc.default_language) {
2014                         os << "\\default_language " << default_language << '\n';
2015                 }
2016
2017                 os << "\n#\n"
2018                    << "# FORMATS SECTION ##########################\n"
2019                    << "#\n\n";
2020
2021         case RC_FORMAT:
2022                 // New/modified formats
2023                 for (Formats::const_iterator cit = formats.begin();
2024                      cit != formats.end(); ++cit) {
2025                         Format const * format =
2026                                 system_formats.getFormat(cit->name());
2027                         if (!format ||
2028                             format->extension() != cit->extension() ||
2029                             format->prettyname() != cit->prettyname() ||
2030                             format->shortcut() != cit->shortcut() ||
2031                             format->viewer() != cit->viewer() ||
2032                             format->editor() != cit->editor() ||
2033                             format->documentFormat() != cit->documentFormat()) {
2034                                 os << "\\format \"" << cit->name() << "\" \""
2035                                    << cit->extension() << "\" \""
2036                                    << cit->prettyname() << "\" \""
2037                                    << cit->shortcut() << "\" \""
2038                                    << cit->viewer() << "\" \""
2039                                    << cit->editor() << "\" \"";
2040                                 if (cit->documentFormat())
2041                                         os << "document";
2042                                 os << "\"\n";
2043                         }
2044                 }
2045
2046                 // Look for deleted formats
2047                 for (Formats::const_iterator cit = system_formats.begin();
2048                      cit != system_formats.end(); ++cit)
2049                         if (!formats.getFormat(cit->name()))
2050                                 os << "\\format \"" << cit->name()
2051                                    << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2052         case RC_VIEWER:
2053                 // Ignore it
2054
2055                 os << "\n#\n"
2056                    << "# CONVERTERS SECTION ##########################\n"
2057                    << "#\n\n";
2058
2059         case RC_CONVERTER:
2060                 // Look for new converters
2061                 for (Converters::const_iterator cit = converters.begin();
2062                      cit != converters.end(); ++cit) {
2063                         Converter const * converter =
2064                                 system_converters.getConverter(cit->from,
2065                                                                cit->to);
2066                         if (!converter ||
2067                             converter->command != cit->command ||
2068                             converter->flags != cit->flags)
2069                                 os << "\\converter \"" << cit->from << "\" \""
2070                                    << cit->to << "\" \""
2071                                    << cit->command << "\" \""
2072                                    << cit->flags << "\"\n";
2073                 }
2074
2075                 // New/modifed converters
2076                 for (Converters::const_iterator cit = system_converters.begin();
2077                      cit != system_converters.end(); ++cit)
2078                         if (!converters.getConverter(cit->from, cit->to))
2079                                 os << "\\converter \"" << cit->from
2080                                    << "\" \"" << cit->to << "\" \"\" \"\"\n";
2081
2082         case RC_COPIER:
2083                 os << "\n#\n"
2084                    << "# COPIERS SECTION ##########################\n"
2085                    << "#\n\n";
2086
2087                 // Look for new movers
2088                 Movers::iterator const sysbegin = system_movers.begin();
2089                 Movers::iterator const sysend = system_movers.end();
2090
2091                 for (Movers::iterator it = movers.begin(), end = movers.end();
2092                      it != end; ++it) {
2093                         Movers::iterator const sysit =
2094                                 std::find_if(sysbegin, sysend, SameMover(*it));
2095                         if (sysit == sysend) {
2096                                 std::string const & fmt = it->first;
2097                                 std::string const & command =
2098                                         it->second.command();
2099
2100                                 os << "\\copier " << fmt
2101                                    << " \"" << command << "\"\n";
2102                         }
2103                 }
2104
2105                 // We don't actually delete SpecialisedMover(s) from the
2106                 // map, just clear their 'command', so there's no need
2107                 // to test for anything else.
2108         }
2109
2110         os.flush();
2111 }
2112
2113 void LyXRC::set_font_norm_type()
2114 {
2115         if (font_norm == "iso10646-1")
2116                 font_norm_type = ISO_10646_1;
2117         else if (font_norm == "iso8859-1")
2118                 font_norm_type = ISO_8859_1;
2119         else if (font_norm == "iso8859-3")
2120                 font_norm_type = ISO_8859_3;
2121         else if (font_norm == "iso8859-4")
2122                 font_norm_type = ISO_8859_4;
2123         else if (font_norm == "iso8859-6.8x")
2124                 font_norm_type = ISO_8859_6_8;
2125         else if (font_norm == "iso8859-9")
2126                 font_norm_type = ISO_8859_9;
2127         else if (font_norm == "iso8859-15")
2128                 font_norm_type = ISO_8859_15;
2129         else
2130                 font_norm_type = OTHER_ENCODING;
2131 }
2132
2133
2134 string const LyXRC::getDescription(LyXRCTags tag)
2135 {
2136         string str;
2137
2138         switch (tag) {
2139         case RC_ACCEPT_COMPOUND:
2140                 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2141                 break;
2142
2143         case RC_ALT_LANG:
2144         case RC_USE_ALT_LANG:
2145                 str = _("Specify an alternate language. The default is to use the language of the document.");
2146                 break;
2147
2148         case RC_ASCIIROFF_COMMAND:
2149                 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 \"none\" is specified, an internal routine is used.");
2150                 break;
2151
2152         case RC_ASCII_LINELEN:
2153                 str = _("This is the maximum line length of an exported text file (LaTeX, SGML or plain text).");
2154                 break;
2155
2156         case RC_AUTOREGIONDELETE:
2157                 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2158                 break;
2159
2160         case RC_AUTORESET_OPTIONS:
2161                 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2162                 break;
2163
2164         case RC_AUTOSAVE:
2165                 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2166                 break;
2167
2168         case RC_AUTO_NUMBER:
2169                 break;
2170
2171         case RC_BACKUPDIR_PATH:
2172                 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.");
2173                 break;
2174
2175         case RC_BIBTEX_COMMAND:
2176                 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2177                 break;
2178
2179         case RC_BINDFILE:
2180                 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2181                 break;
2182
2183         case RC_CHECKLASTFILES:
2184                 str = _("Select to check whether the lastfiles still exist.");
2185                 break;
2186
2187         case RC_CHKTEX_COMMAND:
2188                 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2189                 break;
2190
2191         case RC_CONVERTER:
2192                 break;
2193
2194         case RC_COPIER:
2195                 break;
2196
2197         case RC_CURSOR_FOLLOWS_SCROLLBAR:
2198                 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.");
2199                 break;
2200
2201         case RC_CUSTOM_EXPORT_COMMAND:
2202                 break;
2203
2204         case RC_CUSTOM_EXPORT_FORMAT:
2205                 break;
2206
2207         case RC_CYGWIN_PATH_FIX:
2208                 break;
2209
2210         case RC_DATE_INSERT_FORMAT:
2211                 //xgettext:no-c-format
2212                 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2213                 break;
2214
2215         case RC_DEFAULT_LANGUAGE:
2216                 str = _("New documents will be assigned this language.");
2217                 break;
2218
2219         case RC_DEFAULT_PAPERSIZE:
2220                 str = _("Specify the default paper size.");
2221                 break;
2222
2223         case RC_DIALOGS_ICONIFY_WITH_MAIN:
2224                 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2225                 break;
2226
2227         case RC_DISPLAY_GRAPHICS:
2228                 str = _("Select how LyX will display any graphics.");
2229                 break;
2230
2231         case RC_DOCUMENTPATH:
2232                 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2233                 break;
2234
2235         case RC_ESC_CHARS:
2236         case RC_USE_ESC_CHARS:
2237                 str = _("Specify additional chars that can be part of a word.");
2238                 break;
2239
2240         case RC_FONT_ENCODING:
2241                 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
2242                 break;
2243
2244         case RC_FORMAT:
2245                 break;
2246
2247         case RC_INDEX_COMMAND:
2248                 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\".");
2249                 break;
2250
2251         case RC_INPUT:
2252                 break;
2253
2254         case RC_KBMAP:
2255         case RC_KBMAP_PRIMARY:
2256         case RC_KBMAP_SECONDARY:
2257                 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.");
2258                 break;
2259
2260         case RC_LABEL_INIT_LENGTH:
2261                 str = _("Maximum number of words in the initialization string for a new label");
2262                 break;
2263
2264         case RC_LANGUAGE_AUTO_BEGIN:
2265                 str = _("Select if a language switching command is needed at the beginning of the document.");
2266                 break;
2267
2268         case RC_LANGUAGE_AUTO_END:
2269                 str = _("Select if a language switching command is needed at the end of the document.");
2270                 break;
2271
2272         case RC_LANGUAGE_COMMAND_BEGIN:
2273                 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.");
2274                 break;
2275
2276         case RC_LANGUAGE_COMMAND_END:
2277                 str = _("The LaTeX command for changing back to the language of the document.");
2278                 break;
2279
2280         case RC_LANGUAGE_COMMAND_LOCAL:
2281                 str = _("The LaTeX command for local changing of the language.");
2282                 break;
2283
2284         case RC_LANGUAGE_GLOBAL_OPTIONS:
2285                 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2286                 break;
2287
2288         case RC_LANGUAGE_PACKAGE:
2289                 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2290                 break;
2291
2292         case RC_LANGUAGE_USE_BABEL:
2293                 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2294                 break;
2295
2296         case RC_USELASTFILEPOS:
2297                 str = _("De-select if you do not want LyX to scroll to saved position.");
2298                 break;
2299
2300         case RC_LOADSESSION:
2301                 str = _("De-select to prevent loading files opened from the last lyx session.");
2302                 break;
2303
2304         case RC_MAKE_BACKUP:
2305                 str = _("De-select if you don't want LyX to create backup files.");
2306                 break;
2307
2308         case RC_MARK_FOREIGN_LANGUAGE:
2309                 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2310                 break;
2311
2312         case RC_NUMLASTFILES:
2313                 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."), maxlastfiles);
2314                 break;
2315
2316         case RC_PATH_PREFIX:
2317                 str = _("Specify those directories which should be "
2318                          "prepended to the PATH environment variable. "
2319                          "Use the OS native format.");
2320                 break;
2321
2322         case RC_PERS_DICT:
2323         case RC_USE_PERS_DICT:
2324                 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2325                 break;
2326
2327         case RC_POPUP_BOLD_FONT:
2328                 str = _("The bold font in the dialogs.");
2329                 break;
2330
2331         case RC_POPUP_FONT_ENCODING:
2332                 str = _("The encoding for the menu/popups fonts.");
2333                 break;
2334
2335         case RC_POPUP_NORMAL_FONT:
2336                 str = _("The normal font in the dialogs.");
2337                 break;
2338
2339         case RC_PREVIEW:
2340                 str = _("Shows a typeset preview of things such as math");
2341                 break;
2342
2343         case RC_PREVIEW_HASHED_LABELS:
2344                 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2345                 break;
2346
2347         case RC_PREVIEW_SCALE_FACTOR:
2348                 str = _("Scale the preview size to suit.");
2349                 break;
2350
2351         case RC_PRINTCOLLCOPIESFLAG:
2352                 str = _("The option for specifying whether the copies should be collated.");
2353                 break;
2354
2355         case RC_PRINTCOPIESFLAG:
2356                 str = _("The option for specifying the number of copies to print.");
2357                 break;
2358
2359         case RC_PRINTER:
2360                 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
2361                 break;
2362
2363         case RC_PRINTEVENPAGEFLAG:
2364                 str = _("The option to print only even pages.");
2365                 break;
2366
2367         case RC_PRINTEXSTRAOPTIONS:
2368                 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2369                 break;
2370
2371         case RC_PRINTFILEEXTENSION:
2372                 str = _("Extension of printer program output file. Usually \".ps\".");
2373                 break;
2374
2375         case RC_PRINTLANDSCAPEFLAG:
2376                 str = _("The option to print out in landscape.");
2377                 break;
2378
2379         case RC_PRINTODDPAGEFLAG:
2380                 str = _("The option to print only odd pages.");
2381                 break;
2382
2383         case RC_PRINTPAGERANGEFLAG:
2384                 str = _("The option for specifying a comma-separated list of pages to print.");
2385                 break;
2386
2387         case RC_PRINTPAPERDIMENSIONFLAG:
2388                 str = _("Option to specify the dimensions of the print paper.");
2389                 break;
2390
2391         case RC_PRINTPAPERFLAG:
2392                 str = _("The option to specify paper type.");
2393                 break;
2394
2395         case RC_PRINTREVERSEFLAG:
2396                 str = _("The option to reverse the order of the pages printed.");
2397                 break;
2398
2399         case RC_PRINTSPOOL_COMMAND:
2400                 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.");
2401                 break;
2402
2403         case RC_PRINTSPOOL_PRINTERPREFIX:
2404                 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.");
2405                 break;
2406
2407         case RC_PRINTTOFILE:
2408                 str = _("Option to pass to the print program to print to a file.");
2409                 break;
2410
2411         case RC_PRINTTOPRINTER:
2412                 str = _("Option to pass to the print program to print on a specific printer.");
2413                 break;
2414
2415         case RC_PRINT_ADAPTOUTPUT:
2416                 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2417                 break;
2418
2419         case RC_PRINT_COMMAND:
2420                 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
2421                 break;
2422
2423         case RC_RTL_SUPPORT:
2424                 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2425                 break;
2426
2427         case RC_SCREEN_DPI:
2428                 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2429                 break;
2430
2431         case RC_SCREEN_FONT_ENCODING:
2432                 str = _("The encoding for the screen fonts.");
2433                 break;
2434
2435         case RC_SCREEN_FONT_ROMAN:
2436         case RC_SCREEN_FONT_SANS:
2437         case RC_SCREEN_FONT_TYPEWRITER:
2438                 str = _("The screen fonts used to display the text while editing.");
2439                 break;
2440
2441         case RC_SCREEN_FONT_ROMAN_FOUNDRY:
2442         case RC_SCREEN_FONT_SANS_FOUNDRY:
2443         case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2444                 break;
2445
2446         case RC_SCREEN_FONT_SCALABLE:
2447                 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.");
2448                 break;
2449
2450         case RC_SCREEN_FONT_SIZES:
2451                 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2452                 break;
2453
2454         case RC_SCREEN_ZOOM:
2455                 //xgettext:no-c-format
2456                 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2457                 break;
2458
2459         case RC_SCREEN_GEOMETRY_HEIGHT:
2460         case RC_SCREEN_GEOMETRY_WIDTH:
2461                 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).");
2462                 break;
2463
2464         case RC_SCREEN_GEOMETRY_XYSAVED:
2465                 str = _("Allow session manager to save and restore windows position.");
2466                 break;
2467
2468         case RC_SERVERPIPE:
2469                 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2470                 break;
2471
2472         case RC_SET_COLOR:
2473                 break;
2474
2475         case RC_SHOW_BANNER:
2476                 str = _("De-select if you don't want the startup banner.");
2477                 break;
2478
2479         case RC_SPELL_COMMAND:
2480                 str = _("What command runs the spellchecker?");
2481                 break;
2482
2483         case RC_TEMPDIRPATH:
2484                 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2485                 break;
2486
2487         case RC_TEMPLATEPATH:
2488                 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2489                 break;
2490
2491         case RC_TEX_ALLOWS_SPACES:
2492                 break;
2493
2494         case RC_UIFILE:
2495                 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2496                 break;
2497
2498         case RC_USER_EMAIL:
2499                 break;
2500
2501         case RC_USER_NAME:
2502                 break;
2503
2504         case RC_USETEMPDIR:
2505                 break;
2506
2507         case RC_USE_INP_ENC:
2508                 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.");
2509                 break;
2510
2511         case RC_USE_SPELL_LIB:
2512                 break;
2513
2514         case RC_VIEWDVI_PAPEROPTION:
2515                 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2516                 break;
2517
2518         case RC_VIEWER:
2519                 break;
2520
2521         case RC_WHEEL_JUMP:
2522                 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2523                 break;
2524
2525         case RC_LAST:
2526                 break;
2527         }
2528
2529         return str;
2530 }
2531
2532 // The global instance
2533 LyXRC lyxrc;
2534
2535 // The global copy of the system lyxrc entries (everything except preferences)
2536 LyXRC system_lyxrc;