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