1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2001 The LyX Team.
9 * ====================================================== */
14 #pragma implementation "lyxrc.h"
25 #include "LyXAction.h"
28 #include "support/path.h"
29 #include "support/filetools.h"
31 #include "converter.h"
41 extern LyXAction lyxaction;
42 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
46 // when adding something to this array keep it sorted!
47 keyword_item lyxrcTags[] = {
48 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
49 { "\\alternate_language", LyXRC::RC_ALT_LANG },
50 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
51 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
52 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
53 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
54 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
55 { "\\autosave", LyXRC::RC_AUTOSAVE },
56 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
57 { "\\bind", LyXRC::RC_BIND },
58 { "\\bind_file", LyXRC::RC_BINDFILE },
59 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
60 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
61 { "\\converter", LyXRC::RC_CONVERTER },
62 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
63 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
64 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
65 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
66 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
67 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
68 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
69 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
70 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
71 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
72 { "\\exit_confirmation", LyXRC::RC_EXIT_CONFIRMATION },
73 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
74 { "\\format", LyXRC::RC_FORMAT },
75 { "\\input", LyXRC::RC_INPUT },
76 { "\\kbmap", LyXRC::RC_KBMAP },
77 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
78 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
79 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
80 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
81 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
82 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
83 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
84 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
85 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
86 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
87 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
88 { "\\lastfiles", LyXRC::RC_LASTFILES },
89 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
90 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
91 { "\\new_ask_filename", LyXRC::RC_NEW_ASK_FILENAME },
92 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
93 { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS },
94 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
95 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
96 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
97 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
98 { "\\preview", LyXRC::RC_PREVIEW },
99 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
100 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
101 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
102 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
103 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
104 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
105 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
106 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
107 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
108 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
109 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
110 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
111 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
112 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
113 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
114 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
115 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
116 { "\\printer", LyXRC::RC_PRINTER },
117 { "\\ps_command", LyXRC::RC_PS_COMMAND },
118 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
119 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
120 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
121 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
122 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
123 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
124 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
125 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
126 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
127 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
128 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
129 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
130 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
131 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
132 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
133 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
134 { "\\set_color", LyXRC::RC_SET_COLOR },
135 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
136 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
137 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
138 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
139 { "\\ui_file", LyXRC::RC_UIFILE },
140 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
141 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
142 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
143 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
145 { "\\use_pspell", LyXRC::RC_USE_PSPELL },
147 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
148 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
149 { "\\viewer" ,LyXRC::RC_VIEWER},
150 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
153 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
164 void LyXRC::setDefaults() {
168 // Get printer from the environment. If fail, use default "",
169 // assuming that everything is set up correctly.
170 printer = GetEnv("PRINTER");
171 print_adapt_output = false;
172 print_command = "dvips";
173 print_evenpage_flag = "-B";
174 print_oddpage_flag = "-A";
175 print_pagerange_flag = "-pp";
176 print_copies_flag = "-c";
177 print_collcopies_flag = "-C";
178 print_reverse_flag = "-r";
179 print_landscape_flag = "-t landscape";
180 print_to_printer = "-P";
181 print_to_file = "-o ";
182 print_file_extension = ".ps";
183 print_paper_flag = "-t";
184 print_paper_dimension_flag = "-T";
185 document_path.erase();
186 tempdir_path = "/tmp";
189 view_dvi_paper_option.erase();
190 default_papersize = BufferParams::PAPER_USLETTER;
191 custom_export_format = "ps";
192 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
195 // Because a screen typically is wider than a piece of paper:
198 // Default LaTeX font size:
199 font_sizes[LyXFont::SIZE_TINY] = 5.0;
200 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
201 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
202 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
203 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
204 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
205 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
206 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
207 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
208 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
209 use_scalable_fonts = true;
210 roman_font_name = "-*-times";
211 sans_font_name = "-*-helvetica";
212 typewriter_font_name = "-*-courier";
213 popup_bold_font = "-*-helvetica-bold-r";
214 popup_normal_font = "-*-helvetica-medium-r";
215 font_norm = "iso8859-1";
216 font_norm_type = ISO_8859_1;
217 popup_font_encoding.erase();
218 override_x_deadkeys = true;
220 auto_region_delete = true;
221 auto_reset_options = false;
224 check_lastfiles = true;
226 backupdir_path.erase();
227 exit_confirmation = true;
228 display_graphics = "color";
229 // Spellchecker settings:
233 isp_command = "ispell";
234 isp_accept_compound = false;
235 isp_use_input_encoding = false;
236 isp_use_alt_lang = false;
237 isp_use_pers_dict = false;
238 isp_use_esc_chars = false;
242 mark_foreign_language = true;
243 language_auto_begin = true;
244 language_auto_end = true;
245 language_global_options = true;
246 language_use_babel = true;
247 language_package = "\\usepackage{babel}";
248 language_command_begin = "\\selectlanguage{$$lang}";
249 language_command_local = "\\foreignlanguage{$$lang}{";
250 default_language = "english";
252 new_ask_filename = false;
255 date_insert_format = "%A, %e %B %Y";
256 cursor_follows_scrollbar = false;
257 dialogs_iconify_with_main = false;
258 label_init_length = 3;
261 /// These variables are not stored on disk (perhaps they
262 // should be moved from the LyXRC class).
268 int LyXRC::ReadBindFile(string const & name)
271 string const tmp = i18nLibFileSearch("bind", name, "bind");
272 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
273 int const result = read(tmp);
275 lyxerr << "Error reading bind file: " << tmp << endl;
280 void LyXRC::readBindFileIfNeeded()
283 ReadBindFile(bind_file);
287 int LyXRC::read(string const & filename)
289 LyXLex lexrc(lyxrcTags, lyxrcCount);
290 if (lyxerr.debugging(Debug::PARSER))
291 lexrc.printTable(lyxerr);
293 lexrc.setFile(filename);
294 if (!lexrc.isOK()) return -2;
296 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
298 while (lexrc.isOK()) {
299 // By using two switches we take advantage of the compiler
300 // telling us if we have missed a LyXRCTags element in
301 // the second switch.
302 // Note that this also shows a problem with LyXLex since it
303 // helps us avoid taking advantage of the strictness of the
306 int le = lexrc.lex();
308 case LyXLex::LEX_UNDEF:
309 lexrc.printError("Unknown tag `$$Token'");
311 case LyXLex::LEX_FEOF:
315 switch (static_cast<LyXRCTags>(le)) {
316 case RC_INPUT: // Include file
319 LibFileSearch(string(),
322 lexrc.printError("Error reading "
323 "included file: "+tmp);
327 case RC_BINDFILE: // RVDK_PATCH_5
329 string const tmp(lexrc.getString());
331 // We are already in the
332 // "actually read bind file"
336 // We are still in the "just
337 // remember the name of the
345 ui_file = lexrc.getString();
349 case RC_EXIT_CONFIRMATION:
351 exit_confirmation = lexrc.getBool();
354 case RC_AUTORESET_OPTIONS:
356 auto_reset_options = lexrc.getBool();
359 case RC_DISPLAY_GRAPHICS:
361 display_graphics = lexrc.getString();
366 use_kbmap = lexrc.getBool();
369 case RC_KBMAP_PRIMARY:
371 string const kmap(lexrc.getString());
374 } else if (!LibFileSearch("kbd", kmap,
376 primary_kbmap = kmap;
378 lexrc.printError("LyX: Keymap `$$Token' not found");
382 case RC_KBMAP_SECONDARY:
384 string const kmap(lexrc.getString());
387 } else if (!LibFileSearch("kbd", kmap,
389 secondary_kbmap = kmap;
391 lexrc.printError("LyX: Keymap `$$Token' not found");
395 case RC_FONT_ENCODING:
397 fontenc = lexrc.getString();
402 printer = lexrc.getString();
405 case RC_PRINT_COMMAND:
407 print_command = lexrc.getString();
410 case RC_PRINTEVENPAGEFLAG:
412 print_evenpage_flag = lexrc.getString();
415 case RC_PRINTODDPAGEFLAG:
417 print_oddpage_flag = lexrc.getString();
420 case RC_PRINTPAGERANGEFLAG:
422 print_pagerange_flag = lexrc.getString();
425 case RC_PRINTCOPIESFLAG:
427 print_copies_flag = lexrc.getString();
430 case RC_PRINTCOLLCOPIESFLAG:
432 print_collcopies_flag = lexrc.getString();
435 case RC_PRINTREVERSEFLAG:
437 print_reverse_flag = lexrc.getString();
440 case RC_PRINTLANDSCAPEFLAG:
442 print_landscape_flag = lexrc.getString();
445 case RC_PRINTTOPRINTER:
447 print_to_printer = lexrc.getString();
450 case RC_PRINT_ADAPTOUTPUT:
452 print_adapt_output = lexrc.getBool();
457 print_to_file = lexrc.getString();
460 case RC_PRINTFILEEXTENSION:
462 print_file_extension = lexrc.getString();
465 case RC_PRINTEXSTRAOPTIONS:
467 print_extra_options = lexrc.getString();
470 case RC_PRINTSPOOL_COMMAND:
472 print_spool_command = lexrc.getString();
475 case RC_PRINTSPOOL_PRINTERPREFIX:
477 print_spool_printerprefix = lexrc.getString();
480 case RC_PRINTPAPERDIMENSIONFLAG:
482 print_paper_dimension_flag = lexrc.getString();
485 case RC_PRINTPAPERFLAG:
487 print_paper_flag = lexrc.getString();
490 case RC_CUSTOM_EXPORT_COMMAND:
492 custom_export_command = lexrc.getString();
495 case RC_CUSTOM_EXPORT_FORMAT:
497 custom_export_format = lexrc.getString();
500 case RC_DEFAULT_PAPERSIZE:
503 lowercase(lexrc.getString());
504 if (size == "usletter")
506 BufferParams::PAPER_USLETTER;
507 else if (size == "legal")
509 BufferParams::PAPER_LEGALPAPER;
510 else if (size == "executive")
512 BufferParams::PAPER_EXECUTIVEPAPER;
513 else if (size == "a3")
515 BufferParams::PAPER_A3PAPER;
516 else if (size == "a4")
518 BufferParams::PAPER_A4PAPER;
519 else if (size == "a5")
521 BufferParams::PAPER_A5PAPER;
522 else if (size == "b5")
524 BufferParams::PAPER_B5PAPER;
528 case RC_VIEWDVI_PAPEROPTION:
530 view_dvi_paper_option = lexrc.getString();
532 view_dvi_paper_option.erase();
537 ps_command = lexrc.getString();
540 case RC_CHKTEX_COMMAND:
542 chktex_command = lexrc.getString();
547 dpi = lexrc.getInteger();
552 zoom = lexrc.getInteger();
557 wheel_jump = lexrc.getInteger();
560 case RC_SCREEN_FONT_SIZES:
562 font_sizes[LyXFont::SIZE_TINY] =
565 font_sizes[LyXFont::SIZE_SCRIPT] =
568 font_sizes[LyXFont::SIZE_FOOTNOTE] =
571 font_sizes[LyXFont::SIZE_SMALL] =
574 font_sizes[LyXFont::SIZE_NORMAL] =
577 font_sizes[LyXFont::SIZE_LARGE] =
580 font_sizes[LyXFont::SIZE_LARGER] =
583 font_sizes[LyXFont::SIZE_LARGEST] =
586 font_sizes[LyXFont::SIZE_HUGE] =
589 font_sizes[LyXFont::SIZE_HUGER] =
593 case RC_SCREEN_FONT_SCALABLE:
595 use_scalable_fonts = lexrc.getBool();
600 autosave = lexrc.getInteger();
603 case RC_DOCUMENTPATH:
605 document_path = ExpandPath(lexrc.getString());
609 case RC_TEMPLATEPATH:
611 template_path = ExpandPath(lexrc.getString());
616 tempdir_path = ExpandPath(lexrc.getString());
621 use_tempdir = lexrc.getBool();
626 lastfiles = ExpandPath(lexrc.getString());
629 case RC_NUMLASTFILES:
631 num_lastfiles = lexrc.getInteger();
634 case RC_CHECKLASTFILES:
636 check_lastfiles = lexrc.getBool();
639 case RC_SCREEN_FONT_ROMAN:
641 roman_font_name = lexrc.getString();
644 case RC_SCREEN_FONT_SANS:
646 sans_font_name = lexrc.getString();
649 case RC_SCREEN_FONT_TYPEWRITER:
651 typewriter_font_name = lexrc.getString();
654 case RC_SCREEN_FONT_ENCODING:
656 font_norm = lexrc.getString();
657 set_font_norm_type();
661 case RC_POPUP_BOLD_FONT:
663 popup_bold_font = lexrc.getString();
666 case RC_POPUP_NORMAL_FONT:
668 popup_normal_font = lexrc.getString();
671 case RC_POPUP_FONT_ENCODING:
673 popup_font_encoding = lexrc.getString();
678 string lyx_name, x11_name;
681 lyx_name = lexrc.getString();
683 lexrc.printError("Missing color tag.");
688 x11_name = lexrc.getString();
690 lexrc.printError("Missing color name for color : `$$Token'");
694 if (!lcolor.setColor(lyx_name, x11_name))
695 lyxerr << "Bad lyxrc set_color for "
700 case RC_AUTOREGIONDELETE:
701 // Auto region delete defaults to true
703 auto_region_delete = lexrc.getBool();
708 // we should not do an explicit binding before
709 // loading a bind file. So, in this case, load
710 // the default bind file.
711 readBindFileIfNeeded();
713 // !!!chb, dynamic key binding...
715 string::size_type res = 0;
719 seq = lexrc.getString();
721 lexrc.printError("RC_BIND: Missing key sequence");
725 if (lexrc.next(true)) {
726 cmd = lexrc.getString();
728 lexrc.printError("RC_BIND: missing command");
732 if ((action = lyxaction.LookupFunc(cmd))>= 0) {
733 if (lyxerr.debugging(Debug::LYXRC)) {
734 lyxerr << "RC_BIND: Sequence `"
735 << seq << "' Command `"
736 << cmd << "' Action `"
737 << action << '\'' << endl;
739 res = toplevel_keymap->bind(seq, kb_action(action));
740 if (res != string::npos
741 && lyxerr.debugging(Debug::LYXRC)) {
744 "Invalid key sequence `"
747 } else {// cmd is the last token read.
749 "Unknown LyX function `$$Token'");
753 case RC_OVERRIDE_X_DEADKEYS:
755 override_x_deadkeys = lexrc.getBool();
760 lyxpipes = ExpandPath(lexrc.getString());
763 case RC_CURSOR_FOLLOWS_SCROLLBAR:
765 cursor_follows_scrollbar = lexrc.getBool();
768 case RC_DIALOGS_ICONIFY_WITH_MAIN:
770 dialogs_iconify_with_main = lexrc.getBool();
773 case RC_ASCIIROFF_COMMAND:
775 ascii_roff_command = lexrc.getString();
777 case RC_ASCII_LINELEN:
779 ascii_linelen = lexrc.getInteger();
781 // Spellchecker settings:
785 use_pspell = lexrc.getBool();
788 case RC_SPELL_COMMAND:
790 isp_command = lexrc.getString();
792 case RC_ACCEPT_COMPOUND:
794 isp_accept_compound = lexrc.getBool();
798 isp_use_input_encoding = lexrc.getBool();
800 case RC_USE_ALT_LANG:
802 isp_use_alt_lang = lexrc.getBool();
804 case RC_USE_PERS_DICT:
806 isp_use_pers_dict = lexrc.getBool();
808 case RC_USE_ESC_CHARS:
810 isp_use_esc_chars = lexrc.getBool();
814 isp_alt_lang = lexrc.getString();
818 isp_pers_dict = lexrc.getString();
822 isp_esc_chars = lexrc.getString();
826 make_backup = lexrc.getBool();
828 case RC_BACKUPDIR_PATH:
830 backupdir_path = ExpandPath(lexrc.getString());
832 case RC_DATE_INSERT_FORMAT:
834 date_insert_format = lexrc.getString();
836 case RC_LANGUAGE_PACKAGE:
838 language_package = lexrc.getString();
840 case RC_LANGUAGE_AUTO_BEGIN:
842 language_auto_begin = lexrc.getBool();
844 case RC_LANGUAGE_AUTO_END:
846 language_auto_end = lexrc.getBool();
848 case RC_LANGUAGE_GLOBAL_OPTIONS:
850 language_global_options = lexrc.getBool();
852 case RC_LANGUAGE_USE_BABEL:
854 language_use_babel = lexrc.getBool();
856 case RC_LANGUAGE_COMMAND_BEGIN:
858 language_command_begin = lexrc.getString();
860 case RC_LANGUAGE_COMMAND_END:
862 language_command_end = lexrc.getString();
864 case RC_LANGUAGE_COMMAND_LOCAL:
866 language_command_local = lexrc.getString();
870 rtl_support = lexrc.getBool();
874 auto_number = lexrc.getBool();
876 case RC_MARK_FOREIGN_LANGUAGE:
878 mark_foreign_language = lexrc.getBool();
881 case RC_NEW_ASK_FILENAME:
883 new_ask_filename = lexrc.getBool();
886 string from, to, command, flags;
888 from = lexrc.getString();
890 to = lexrc.getString();
892 command = lexrc.getString();
894 flags = lexrc.getString();
895 if (command.empty() || command == "none")
896 converters.erase(from, to);
898 converters.add(from, to, command, flags);
902 string format, command;
904 format = lexrc.getString();
906 command = lexrc.getString();
907 formats.setViewer(format, command);
911 string format, extension, prettyname, shortcut;
913 format = lexrc.getString();
915 extension = lexrc.getString();
917 prettyname = lexrc.getString();
919 shortcut = lexrc.getString();
920 if (prettyname.empty()) {
921 if (converters.formatIsUsed(format))
922 lyxerr << "Can't delete format "
925 formats.erase(format);
928 formats.add(format, extension, prettyname,
932 case RC_DEFAULT_LANGUAGE:
934 default_language = lexrc.getString();
937 case RC_LABEL_INIT_LENGTH:
939 label_init_length = lexrc.getInteger();
944 show_banner = lexrc.getBool();
949 preview = lexrc.getBool();
952 case RC_LAST: break; // this is just a dummy
956 /// Update converters data-structures
957 converters.update(formats);
958 converters.buildGraph();
964 void LyXRC::write(string const & filename) const
966 ofstream ofs(filename.c_str());
972 void LyXRC::print() const
974 if (lyxerr.debugging())
981 void LyXRC::output(ostream & os) const
983 os << "### This file is part of\n"
984 << "### ========================================================\n"
985 << "### LyX, The Document Processor\n"
987 << "### Copyright 1995 Matthias Ettrich\n"
988 << "### Copyright 1995-2001 The LyX Team.\n"
990 << "### ========================================================\n"
992 << "# This file is written by LyX, if you want to make your own\n"
993 << "# modifications you should do them from inside LyX and save\n"
996 // Why the switch you might ask. It is a trick to ensure that all
997 // the elements in the LyXRCTags enum is handled. As you can see
998 // there are no breaks at all. So it is just a huge fall-through.
999 // The nice thing is that we will get a warning from the compiler
1000 // if we forget an element.
1001 LyXRCTags tag = RC_LAST;
1005 // input/include files are not done here
1007 // bindings is not written to the preferences file.
1009 if (bind_file != system_lyxrc.bind_file) {
1010 os << "\\bind_file " << bind_file << "\n";
1016 << "# MISC SECTION ######################################\n"
1019 // bind files are not done here.
1021 if (ui_file != system_lyxrc.ui_file) {
1022 os << "\\ui_file \"" << ui_file << "\"\n";
1024 case RC_AUTOREGIONDELETE:
1025 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1026 os << "# Set to false to inhibit automatic replacement of\n"
1027 << "# the current selection.\n"
1028 << "\\auto_region_delete " << tostr(auto_region_delete)
1031 case RC_AUTORESET_OPTIONS:
1032 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1033 os << "# Set to false to inhibit automatic reset of\n"
1034 << "# the class options to defaults on class change.\n"
1035 << "\\auto_reset_options " << tostr(auto_reset_options)
1039 if (autosave != system_lyxrc.autosave) {
1040 os << "# The time interval between auto-saves in seconds.\n"
1041 << "\\autosave " << autosave << "\n";
1043 case RC_EXIT_CONFIRMATION:
1044 if (exit_confirmation != system_lyxrc.exit_confirmation) {
1045 os << "# Ask for confirmation before exit if there are\n"
1046 << "# unsaved changed documents.\n"
1047 << "\\exit_confirmation " << tostr(exit_confirmation)
1050 case RC_DISPLAY_GRAPHICS:
1051 if (display_graphics != system_lyxrc.display_graphics) {
1052 os << "# Display graphics within LyX\n"
1053 << "# no|mono|gray|color\n"
1054 << "\\display_graphics " << display_graphics
1058 case RC_VIEWDVI_PAPEROPTION:
1059 if (view_dvi_paper_option
1060 != system_lyxrc.view_dvi_paper_option) {
1061 os << "# Options used to specify paper size to the\n"
1062 << "# view_dvi_command (e.g. -paper)\n"
1063 << "\\view_dvi_paper_option \""
1064 << view_dvi_paper_option << "\"\n";
1066 case RC_DEFAULT_PAPERSIZE:
1067 if (default_papersize != system_lyxrc.default_papersize) {
1068 os << "# The default papersize to use.\n"
1069 << "\\default_papersize \"";
1070 switch (default_papersize) {
1071 case BufferParams::PAPER_USLETTER:
1072 os << "usletter"; break;
1073 case BufferParams::PAPER_LEGALPAPER:
1074 os << "legal"; break;
1075 case BufferParams::PAPER_EXECUTIVEPAPER:
1076 os << "executive"; break;
1077 case BufferParams::PAPER_A3PAPER:
1079 case BufferParams::PAPER_A4PAPER:
1081 case BufferParams::PAPER_A5PAPER:
1083 case BufferParams::PAPER_B5PAPER:
1085 case BufferParams::PAPER_DEFAULT: break;
1090 if (ps_command != system_lyxrc.ps_command) {
1091 os << "# Program used for interpreting postscript.\n"
1092 << "\\ps_command \"" << ps_command << "\"\n";
1094 case RC_CHKTEX_COMMAND:
1095 if (chktex_command != system_lyxrc.chktex_command) {
1096 os << "\\chktex_command \"" << chktex_command << "\"\n";
1099 if (use_kbmap != system_lyxrc.use_kbmap) {
1100 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1102 case RC_KBMAP_PRIMARY:
1103 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1104 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1106 case RC_KBMAP_SECONDARY:
1107 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1108 os << "\\kbmap_secondary \"" << secondary_kbmap
1112 if (lyxpipes != system_lyxrc.lyxpipes) {
1113 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1115 case RC_DATE_INSERT_FORMAT:
1116 if (date_insert_format != system_lyxrc.date_insert_format) {
1117 os << "\\date_insert_format \"" << date_insert_format
1120 case RC_LABEL_INIT_LENGTH:
1121 if (label_init_length != system_lyxrc.label_init_length) {
1122 os << "\\label_init_length " << label_init_length
1126 case RC_SHOW_BANNER:
1127 if (show_banner != system_lyxrc.show_banner) {
1128 os << "\\show_banner " << tostr(show_banner) << "\n";
1132 if (preview != system_lyxrc.preview) {
1133 os << "\\preview " << tostr(preview) << "\n";
1137 << "# SCREEN & FONTS SECTION ############################\n"
1140 case RC_POPUP_NORMAL_FONT:
1141 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1142 os << "\\popup_normal_font \"" << popup_normal_font
1145 case RC_POPUP_BOLD_FONT:
1146 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1147 os << "\\popup_bold_font \"" << popup_bold_font
1150 case RC_POPUP_FONT_ENCODING:
1151 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1152 os << "\\popup_font_encoding \"" << popup_font_encoding
1156 if (dpi != system_lyxrc.dpi) {
1157 os << "\\screen_dpi " << dpi << "\n";
1159 case RC_SCREEN_ZOOM:
1160 if (zoom != system_lyxrc.zoom) {
1161 os << "\\screen_zoom " << zoom << "\n";
1164 if (wheel_jump != system_lyxrc.wheel_jump) {
1165 os << "\\wheel_jump " << wheel_jump << "\n";
1167 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1168 if (cursor_follows_scrollbar
1169 != system_lyxrc.cursor_follows_scrollbar) {
1170 os << "\\cursor_follows_scrollbar "
1171 << tostr(cursor_follows_scrollbar) << "\n";
1173 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1174 if (dialogs_iconify_with_main
1175 != system_lyxrc.dialogs_iconify_with_main) {
1176 os << "\\dialogs_iconify_with_main "
1177 << tostr(dialogs_iconify_with_main) << "\n";
1179 case RC_SCREEN_FONT_ROMAN:
1180 if (roman_font_name != system_lyxrc.roman_font_name) {
1181 os << "\\screen_font_roman \"" << roman_font_name
1184 case RC_SCREEN_FONT_SANS:
1185 if (sans_font_name != system_lyxrc.sans_font_name) {
1186 os << "\\screen_font_sans \"" << sans_font_name
1189 case RC_SCREEN_FONT_TYPEWRITER:
1190 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1191 os << "\\screen_font_typewriter \""
1192 << typewriter_font_name << "\"\n";
1194 case RC_SCREEN_FONT_SCALABLE:
1195 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1196 os << "\\screen_font_scalable "
1197 << tostr(use_scalable_fonts)
1200 case RC_SCREEN_FONT_ENCODING:
1201 if (font_norm != system_lyxrc.font_norm) {
1202 os << "\\screen_font_encoding \"" << font_norm
1205 case RC_SCREEN_FONT_SIZES:
1206 if (font_sizes[LyXFont::SIZE_TINY]
1207 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1208 font_sizes[LyXFont::SIZE_SCRIPT]
1209 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1210 font_sizes[LyXFont::SIZE_FOOTNOTE]
1211 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1212 font_sizes[LyXFont::SIZE_SMALL]
1213 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1214 font_sizes[LyXFont::SIZE_NORMAL]
1215 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1216 font_sizes[LyXFont::SIZE_LARGE]
1217 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1218 font_sizes[LyXFont::SIZE_LARGER]
1219 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1220 font_sizes[LyXFont::SIZE_LARGEST]
1221 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1222 font_sizes[LyXFont::SIZE_HUGE]
1223 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1224 font_sizes[LyXFont::SIZE_HUGER]
1225 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1226 os.setf(ios::fixed);
1228 os << "\\screen_font_sizes"
1229 << " " << font_sizes[LyXFont::SIZE_TINY]
1230 << " " << font_sizes[LyXFont::SIZE_SCRIPT]
1231 << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]
1232 << " " << font_sizes[LyXFont::SIZE_SMALL]
1233 << " " << font_sizes[LyXFont::SIZE_NORMAL]
1234 << " " << font_sizes[LyXFont::SIZE_LARGE]
1235 << " " << font_sizes[LyXFont::SIZE_LARGER]
1236 << " " << font_sizes[LyXFont::SIZE_LARGEST]
1237 << " " << font_sizes[LyXFont::SIZE_HUGE]
1238 << " " << font_sizes[LyXFont::SIZE_HUGER]
1243 << "# COLOR SECTION ###################################\n"
1247 for (int i = 0; i < LColor::ignore; ++i) {
1248 LColor::color lc = static_cast<LColor::color>(i);
1250 string const col(lcolor.getX11Name(lc));
1251 if (col != system_lcolor.getX11Name(lc)) {
1252 os << "\\set_color \""
1253 << lcolor.getLyXName(lc) << "\" \""
1259 << "# PRINTER SECTION ###################################\n"
1263 if (printer != system_lyxrc.printer) {
1264 os << "\\printer \"" << printer << "\"\n";
1266 case RC_PRINT_ADAPTOUTPUT:
1267 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1268 os << "\\print_adapt_output "
1269 << tostr(print_adapt_output)
1272 case RC_PRINT_COMMAND:
1273 if (print_command != system_lyxrc.print_command) {
1274 os << "\\print_command \"" << print_command << "\"\n";
1276 case RC_PRINTEXSTRAOPTIONS:
1277 if (print_extra_options != system_lyxrc.print_extra_options) {
1278 os << "\\print_extra_options \"" << print_extra_options
1281 case RC_PRINTSPOOL_COMMAND:
1282 if (print_spool_command != system_lyxrc.print_spool_command) {
1283 os << "\\print_spool_command \"" << print_spool_command
1286 case RC_PRINTSPOOL_PRINTERPREFIX:
1287 if (print_spool_printerprefix
1288 != system_lyxrc.print_spool_printerprefix) {
1289 os << "\\print_spool_printerprefix \""
1290 << print_spool_printerprefix << "\"\n";
1292 case RC_PRINTEVENPAGEFLAG:
1293 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1294 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1297 case RC_PRINTODDPAGEFLAG:
1298 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1299 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1302 case RC_PRINTREVERSEFLAG:
1303 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1304 os << "\\print_reverse_flag \"" << print_reverse_flag
1307 case RC_PRINTLANDSCAPEFLAG:
1308 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1309 os << "\\print_landscape_flag \"" << print_landscape_flag
1312 case RC_PRINTPAGERANGEFLAG:
1313 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1314 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1317 case RC_PRINTCOPIESFLAG:
1318 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1319 os << "\\print_copies_flag \"" << print_copies_flag
1322 case RC_PRINTCOLLCOPIESFLAG:
1323 if (print_collcopies_flag
1324 != system_lyxrc.print_collcopies_flag) {
1325 os << "\\print_collcopies_flag \""
1326 << print_collcopies_flag
1329 case RC_PRINTPAPERFLAG:
1330 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1331 os << "\\print_paper_flag \"" << print_paper_flag
1334 case RC_PRINTPAPERDIMENSIONFLAG:
1335 if (print_paper_dimension_flag
1336 != system_lyxrc.print_paper_dimension_flag) {
1337 os << "\\print_paper_dimension_flag \""
1338 << print_paper_dimension_flag << "\"\n";
1340 case RC_PRINTTOPRINTER:
1341 if (print_to_printer != system_lyxrc.print_to_printer) {
1342 os << "\\print_to_printer \"" << print_to_printer
1345 case RC_PRINTTOFILE:
1346 if (print_to_file != system_lyxrc.print_to_file) {
1347 os << "\\print_to_file \"" << print_to_file << "\"\n";
1349 case RC_PRINTFILEEXTENSION:
1350 if (print_file_extension != system_lyxrc.print_file_extension) {
1351 os << "\\print_file_extension \""
1352 << print_file_extension
1357 << "# EXPORT SECTION ####################################\n"
1360 case RC_CUSTOM_EXPORT_COMMAND:
1361 if (custom_export_command
1362 != system_lyxrc.custom_export_command) {
1363 os << "\\custom_export_command \""
1364 << custom_export_command
1367 case RC_CUSTOM_EXPORT_FORMAT:
1368 if (custom_export_format
1369 != system_lyxrc.custom_export_format) {
1370 os << "\\custom_export_format \"" << custom_export_format
1375 << "# TEX SECTION #######################################\n"
1378 case RC_FONT_ENCODING:
1379 if (fontenc != system_lyxrc.fontenc) {
1380 os << "\\font_encoding \"" << fontenc << "\"\n";
1384 << "# FILE SECTION ######################################\n"
1387 case RC_DOCUMENTPATH:
1388 if (document_path != system_lyxrc.document_path) {
1389 os << "\\document_path \"" << document_path << "\"\n";
1392 if (lastfiles != system_lyxrc.lastfiles) {
1393 os << "\\lastfiles \"" << lastfiles << "\"\n";
1395 case RC_NUMLASTFILES:
1396 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1397 os << "\\num_lastfiles " << num_lastfiles << "\n";
1399 case RC_CHECKLASTFILES:
1400 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1401 os << "\\check_lastfiles " << tostr(check_lastfiles)
1404 case RC_TEMPLATEPATH:
1405 if (template_path != system_lyxrc.template_path) {
1406 os << "\\template_path \"" << template_path << "\"\n";
1408 case RC_TEMPDIRPATH:
1409 if (tempdir_path != system_lyxrc.tempdir_path) {
1410 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1413 if (use_tempdir != system_lyxrc.use_tempdir) {
1414 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1416 case RC_ASCII_LINELEN:
1417 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1418 os << "\\ascii_linelen " << ascii_linelen << "\n";
1420 case RC_MAKE_BACKUP:
1421 if (make_backup != system_lyxrc.make_backup) {
1422 os << "\\make_backup " << tostr(make_backup) << "\n";
1424 case RC_BACKUPDIR_PATH:
1425 if (backupdir_path != system_lyxrc.backupdir_path) {
1426 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1430 << "# ASCII EXPORT SECTION ##############################\n"
1433 case RC_ASCIIROFF_COMMAND:
1434 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1435 os << "\\ascii_roff_command \"" << ascii_roff_command
1440 << "# SPELLCHECKER SECTION ##############################\n"
1444 if (use_pspell != system_lyxrc.use_pspell) {
1445 os << "\\use_pspell " << tostr(use_pspell) << "\n";
1448 case RC_SPELL_COMMAND:
1449 if (isp_command != system_lyxrc.isp_command) {
1450 os << "\\spell_command \"" << isp_command << "\"\n";
1452 case RC_ACCEPT_COMPOUND:
1453 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1454 os << "\\accept_compound " << tostr(isp_accept_compound)
1457 case RC_USE_ALT_LANG:
1458 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1459 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1463 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1464 os << "\\alternate_language \"" << isp_alt_lang
1467 case RC_USE_ESC_CHARS:
1468 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1469 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1473 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1474 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1476 case RC_USE_PERS_DICT:
1477 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1478 os << "\\use_personal_dictionary "
1479 << tostr(isp_use_pers_dict)
1483 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1484 os << "\\personal_dictionary \"" << isp_pers_dict
1487 case RC_USE_INP_ENC:
1488 if (isp_use_input_encoding
1489 != system_lyxrc.isp_use_input_encoding) {
1490 os << "\\use_input_encoding "
1491 << tostr(isp_use_input_encoding)
1496 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1499 case RC_RTL_SUPPORT:
1500 if (rtl_support != system_lyxrc.rtl_support) {
1501 os << "\\rtl " << tostr(rtl_support) << "\n";
1503 case RC_LANGUAGE_PACKAGE:
1504 if (language_package != system_lyxrc.language_package) {
1505 os << "\\language_package \"" << language_package
1508 case RC_LANGUAGE_GLOBAL_OPTIONS:
1509 if (language_global_options
1510 != system_lyxrc.language_global_options) {
1511 os << "\\language_global_options \""
1512 << tostr(language_global_options)
1515 case RC_LANGUAGE_USE_BABEL:
1516 if (language_use_babel != system_lyxrc.language_use_babel) {
1517 os << "\\language_use_babel \""
1518 << tostr(language_use_babel)
1521 case RC_LANGUAGE_COMMAND_BEGIN:
1522 if (language_command_begin
1523 != system_lyxrc.language_command_begin) {
1524 os << "\\language_command_begin \""
1525 << language_command_begin
1528 case RC_LANGUAGE_COMMAND_END:
1529 if (language_command_end
1530 != system_lyxrc.language_command_end) {
1531 os << "\\language_command_end \"" << language_command_end
1534 case RC_LANGUAGE_COMMAND_LOCAL:
1535 if (language_command_local
1536 != system_lyxrc.language_command_local) {
1537 os << "\\language_command_local \""
1538 << language_command_local
1541 case RC_LANGUAGE_AUTO_BEGIN:
1542 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1543 os << "\\language_auto_begin "
1544 << tostr(language_auto_begin) << "\n";
1546 case RC_LANGUAGE_AUTO_END:
1547 if (language_auto_end != system_lyxrc.language_auto_end) {
1548 os << "\\language_auto_end "
1549 << tostr(language_auto_end) << "\n";
1551 case RC_MARK_FOREIGN_LANGUAGE:
1552 if (mark_foreign_language
1553 != system_lyxrc.mark_foreign_language) {
1554 os << "\\mark_foreign_language " <<
1555 tostr(mark_foreign_language) << "\n";
1559 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1562 case RC_OVERRIDE_X_DEADKEYS:
1563 if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) {
1564 os << "\\override_x_deadkeys "
1565 << tostr(override_x_deadkeys) << "\n";
1567 case RC_AUTO_NUMBER:
1568 if (auto_number != system_lyxrc.auto_number) {
1569 os << "\\auto_number " << tostr(auto_number) << "\n";
1571 case RC_NEW_ASK_FILENAME:
1572 if (new_ask_filename != system_lyxrc.new_ask_filename) {
1573 os << "\\new_ask_filename " << tostr(new_ask_filename)
1576 case RC_DEFAULT_LANGUAGE:
1577 if (default_language != system_lyxrc.default_language) {
1578 os << "\\default_language " << default_language << "\n";
1582 << "# FORMATS SECTION ##########################\n"
1586 // Look for deleted formats
1587 for (Formats::const_iterator cit = formats.begin();
1588 cit != formats.end(); ++cit) {
1589 Format const * format =
1590 system_formats.getFormat(cit->name());
1592 format->extension() != cit->extension() ||
1593 format->prettyname() != cit->prettyname() ||
1594 format->shortcut() != cit->shortcut())
1595 os << "\\format \"" << cit->name() << "\" \""
1596 << cit->extension() << "\" \""
1597 << cit->prettyname() << "\" \""
1598 << cit->shortcut() << "\"\n";
1601 // New/modifed formats
1602 for (Formats::const_iterator cit = system_formats.begin();
1603 cit != system_formats.end(); ++cit)
1604 if (!formats.getFormat(cit->name()))
1605 os << "\\format \"" << cit->name()
1606 << "\" \"\" \"\" \"\"\n";
1608 for (Formats::const_iterator cit = formats.begin();
1609 cit != formats.end(); ++cit) {
1610 Format const * format =
1611 system_formats.getFormat(cit->name());
1612 if ((!format || format->viewer() != cit->viewer()) &&
1613 (format || !cit->viewer().empty()))
1614 os << "\\viewer \"" << cit->name() << "\" \""
1615 << cit->viewer() << "\"\n";
1619 << "# CONVERTERS SECTION ##########################\n"
1623 // Look for new converters
1624 for (Converters::const_iterator cit = converters.begin();
1625 cit != converters.end(); ++cit) {
1626 Converter const * converter =
1627 system_converters.getConverter(cit->from,
1630 converter->command != cit->command ||
1631 converter->flags != cit->flags)
1632 os << "\\converter \"" << cit->from << "\" \""
1633 << cit->to << "\" \""
1634 << cit->command << "\" \""
1635 << cit->flags << "\"\n";
1638 // New/modifed converters
1639 for (Converters::const_iterator cit = system_converters.begin();
1640 cit != system_converters.end(); ++cit)
1641 if (!converters.getConverter(cit->from, cit->to))
1642 os << "\\converter \"" << cit->from
1643 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1648 void LyXRC::set_font_norm_type()
1650 if (font_norm == "iso10646-1")
1651 font_norm_type = ISO_10646_1;
1652 else if (font_norm == "iso8859-1")
1653 font_norm_type = ISO_8859_1;
1654 else if (font_norm == "iso8859-3")
1655 font_norm_type = ISO_8859_3;
1656 else if (font_norm == "iso8859-4")
1657 font_norm_type = ISO_8859_4;
1658 else if (font_norm == "iso8859-6.8x")
1659 font_norm_type = ISO_8859_6_8;
1660 else if (font_norm == "iso8859-9")
1661 font_norm_type = ISO_8859_9;
1662 else if (font_norm == "iso8859-15")
1663 font_norm_type = ISO_8859_15;
1665 font_norm_type = OTHER_ENCODING;
1669 string const LyXRC::getDescription(LyXRCTags tag)
1674 case RC_FONT_ENCODING:
1675 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1679 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1682 case RC_PRINT_COMMAND:
1683 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1686 case RC_PRINTEVENPAGEFLAG:
1687 str = _("The option to print only even pages.");
1690 case RC_PRINTODDPAGEFLAG:
1691 str = _("The option to print only odd pages.");
1694 case RC_PRINTPAGERANGEFLAG:
1695 str = _("The option for specifying a comma-separated list of pages to print.");
1698 case RC_PRINTCOPIESFLAG:
1699 str = _("The option for specifying the number of copies to print.");
1702 case RC_PRINTCOLLCOPIESFLAG:
1703 str = _("The option for specifying whether the copies should be collated.");
1706 case RC_PRINTREVERSEFLAG:
1707 str = _("The option to reverse the order of the pages printed.");
1710 case RC_PRINTLANDSCAPEFLAG:
1711 str = _("The option to print out in landscape.");
1714 case RC_PRINTPAPERFLAG:
1715 str = _("The option to specify paper type.");
1718 case RC_PRINTPAPERDIMENSIONFLAG:
1719 str = _("Option to specify the dimensions of the print paper.");
1722 case RC_PRINTTOPRINTER:
1723 str = _("Option to pass to the print program to print on a specific printer.");
1726 case RC_PRINT_ADAPTOUTPUT:
1727 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1730 case RC_PRINTTOFILE:
1731 str = _("Option to pass to the print program to print to a file.");
1734 case RC_PRINTFILEEXTENSION:
1735 str = _("Extension of printer program output file. Usually \".ps\".");
1738 case RC_PRINTEXSTRAOPTIONS:
1739 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1742 case RC_PRINTSPOOL_COMMAND:
1743 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.");
1746 case RC_PRINTSPOOL_PRINTERPREFIX:
1747 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.");
1751 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1754 case RC_SCREEN_ZOOM:
1755 //xgettext:no-c-format
1756 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1759 case RC_SCREEN_FONT_SIZES:
1760 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1763 case RC_SCREEN_FONT_ROMAN:
1764 case RC_SCREEN_FONT_SANS:
1765 case RC_SCREEN_FONT_TYPEWRITER:
1766 str = _("The screen fonts used to display the text while editing.");
1769 case RC_POPUP_BOLD_FONT:
1770 str = _("The bold font in the dialogs.");
1773 case RC_POPUP_NORMAL_FONT:
1774 str = _("The normal font in the dialogs.");
1777 case RC_SCREEN_FONT_ENCODING:
1778 str = _("The encoding for the screen fonts.");
1781 case RC_POPUP_FONT_ENCODING:
1782 str = _("The encoding for the menu/popups fonts.");
1789 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1792 case RC_DOCUMENTPATH:
1793 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1796 case RC_TEMPLATEPATH:
1797 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1800 case RC_TEMPDIRPATH:
1801 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1805 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1809 str = _("The file where the last-files information should be stored.");
1812 case RC_AUTOREGIONDELETE:
1813 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1816 case RC_AUTORESET_OPTIONS:
1817 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1820 case RC_OVERRIDE_X_DEADKEYS:
1821 str = _("Select if LyX is to take over the handling of the dead keys (a.k.a. accent keys) that may be defined for your keyboard.");
1826 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1830 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1834 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1838 case RC_KBMAP_PRIMARY:
1839 case RC_KBMAP_SECONDARY:
1840 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.");
1843 case RC_ASCIIROFF_COMMAND:
1844 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.");
1847 case RC_ASCII_LINELEN:
1848 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1851 case RC_NUMLASTFILES:
1852 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1855 case RC_CHECKLASTFILES:
1856 str = _("Select to check whether the lastfiles still exist.");
1859 case RC_VIEWDVI_PAPEROPTION:
1860 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1863 case RC_DEFAULT_PAPERSIZE:
1864 str = _("Specify the default paper size.");
1870 case RC_ACCEPT_COMPOUND:
1871 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1874 case RC_SPELL_COMMAND:
1875 str = _("What command runs the spell checker?");
1878 case RC_USE_INP_ENC:
1879 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.");
1882 case RC_USE_ALT_LANG:
1884 str = _("Specify an alternate language. The default is to use the language of the document.");
1887 case RC_USE_PERS_DICT:
1889 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1892 case RC_USE_ESC_CHARS:
1894 str = _("Specify additional chars that can be part of a word.");
1897 case RC_SCREEN_FONT_SCALABLE:
1898 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.");
1901 case RC_CHKTEX_COMMAND:
1902 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1905 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1906 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.");
1909 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1910 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
1913 case RC_EXIT_CONFIRMATION:
1914 str = _("Sets whether LyX asks for a second confirmation to exit when you have changed documents. (LyX will still ask to save changed documents.)");
1917 case RC_DISPLAY_GRAPHICS:
1918 str = _("Select how LyX will display any graphics.");
1921 case RC_MAKE_BACKUP:
1922 str = _("De-select if you don't want LyX to create backup files.");
1925 case RC_BACKUPDIR_PATH:
1926 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.");
1929 case RC_RTL_SUPPORT:
1930 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
1933 case RC_MARK_FOREIGN_LANGUAGE:
1934 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
1937 case RC_LANGUAGE_PACKAGE:
1938 str = _("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
1941 case RC_LANGUAGE_GLOBAL_OPTIONS:
1942 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
1945 case RC_LANGUAGE_USE_BABEL:
1946 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
1949 case RC_LANGUAGE_AUTO_BEGIN:
1950 str = _("Select if a language switching command is needed at the beginning of the document.");
1953 case RC_LANGUAGE_AUTO_END:
1954 str = _("Select if a language switching command is needed at the end of the document.");
1957 case RC_LANGUAGE_COMMAND_BEGIN:
1958 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.");
1961 case RC_LANGUAGE_COMMAND_END:
1962 str = _("The latex command for changing back to the language of the document.");
1965 case RC_LANGUAGE_COMMAND_LOCAL:
1966 str = _("The latex command for local changing of the language.");
1969 case RC_DATE_INSERT_FORMAT:
1970 //xgettext:no-c-format
1971 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
1974 case RC_SHOW_BANNER:
1975 str = _("De-select if you don't want the startup banner.");
1979 str = _("The wheel movement factor (for mice with wheels or five button mice).");
1991 case RC_NEW_ASK_FILENAME:
1992 str = _("This sets the behaviour if you want to be asked for a filename when creating a new document or wait until you save it and be asked then.");
1995 case RC_DEFAULT_LANGUAGE:
1996 str = _("New documents will be assigned this language.");
1999 case RC_LABEL_INIT_LENGTH:
2000 str = _("Maximum number of words in the initialization string for a new label");
2004 str = _("Shows a typeset preview besides formulas");
2014 // The global instance
2017 // The global copy of the system lyxrc entries (everything except preferences)