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 keyword_item lyxrcTags[] = {
47 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
48 { "\\alternate_language", LyXRC::RC_ALT_LANG },
49 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
50 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
51 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
52 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
53 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
54 { "\\autosave", LyXRC::RC_AUTOSAVE },
55 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
56 { "\\bind", LyXRC::RC_BIND },
57 { "\\bind_file", LyXRC::RC_BINDFILE },
58 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
59 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
60 { "\\converter", LyXRC::RC_CONVERTER },
61 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
62 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
63 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
64 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
65 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
66 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
67 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
68 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
69 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
70 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
71 { "\\exit_confirmation", LyXRC::RC_EXIT_CONFIRMATION },
72 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
73 { "\\format", LyXRC::RC_FORMAT },
74 { "\\input", LyXRC::RC_INPUT },
75 { "\\kbmap", LyXRC::RC_KBMAP },
76 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
77 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
78 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
79 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
80 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
81 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
82 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
83 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
84 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
85 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
86 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
87 { "\\lastfiles", LyXRC::RC_LASTFILES },
88 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
89 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
90 { "\\new_ask_filename", LyXRC::RC_NEW_ASK_FILENAME },
91 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
92 { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS },
93 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
94 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
95 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
96 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
97 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
98 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
99 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
100 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
101 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
102 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
103 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
104 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
105 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
106 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
107 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
108 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
109 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
110 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
111 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
112 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
113 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
114 { "\\printer", LyXRC::RC_PRINTER },
115 { "\\ps_command", LyXRC::RC_PS_COMMAND },
116 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
117 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
118 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
119 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
120 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
121 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
122 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
123 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
124 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
125 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
126 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
127 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
128 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
129 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
130 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
131 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
132 { "\\set_color", LyXRC::RC_SET_COLOR },
133 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
134 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
135 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
136 { "\\ui_file", LyXRC::RC_UIFILE },
137 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
138 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
139 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
140 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
142 { "\\use_pspell", LyXRC::RC_USE_PSPELL },
144 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
145 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
146 { "\\viewer" ,LyXRC::RC_VIEWER},
147 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
150 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
161 void LyXRC::setDefaults() {
165 // Get printer from the environment. If fail, use default "",
166 // assuming that everything is set up correctly.
167 printer = GetEnv("PRINTER");
168 print_adapt_output = false;
169 print_command = "dvips";
170 print_evenpage_flag = "-B";
171 print_oddpage_flag = "-A";
172 print_pagerange_flag = "-pp";
173 print_copies_flag = "-c";
174 print_collcopies_flag = "-C";
175 print_reverse_flag = "-r";
176 print_landscape_flag = "-t landscape";
177 print_to_printer = "-P";
178 print_to_file = "-o ";
179 print_file_extension = ".ps";
180 print_paper_flag = "-t";
181 print_paper_dimension_flag = "-T";
182 document_path.erase();
183 tempdir_path = "/tmp";
186 view_dvi_paper_option.erase();
187 default_papersize = BufferParams::PAPER_USLETTER;
188 custom_export_format = "ps";
189 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
192 // Because a screen typically is wider than a piece of paper:
195 // Default LaTeX font size:
196 font_sizes[LyXFont::SIZE_TINY] = 5.0;
197 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
198 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
199 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
200 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
201 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
202 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
203 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
204 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
205 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
206 use_scalable_fonts = true;
207 roman_font_name = "-*-times";
208 sans_font_name = "-*-helvetica";
209 typewriter_font_name = "-*-courier";
210 popup_bold_font = "-*-helvetica-bold-r";
211 popup_normal_font = "-*-helvetica-medium-r";
212 font_norm = "iso8859-1";
213 font_norm_type = ISO_8859_1;
214 popup_font_encoding.erase();
215 override_x_deadkeys = true;
217 auto_region_delete = true;
218 auto_reset_options = false;
221 check_lastfiles = true;
223 backupdir_path.erase();
224 exit_confirmation = true;
225 display_graphics = "color";
226 // Spellchecker settings:
230 isp_command = "ispell";
231 isp_accept_compound = false;
232 isp_use_input_encoding = false;
233 isp_use_alt_lang = false;
234 isp_use_pers_dict = false;
235 isp_use_esc_chars = false;
239 mark_foreign_language = true;
240 language_auto_begin = true;
241 language_auto_end = true;
242 language_global_options = true;
243 language_use_babel = true;
244 language_package = "\\usepackage{babel}";
245 language_command_begin = "\\selectlanguage{$$lang}";
246 language_command_local = "\\foreignlanguage{$$lang}{";
247 default_language = "english";
249 new_ask_filename = false;
252 date_insert_format = "%A, %e %B %Y";
253 cursor_follows_scrollbar = false;
254 dialogs_iconify_with_main = false;
255 label_init_length = 3;
257 /// These variables are not stored on disk (perhaps they
258 // should be moved from the LyXRC class).
264 int LyXRC::ReadBindFile(string const & name)
267 string const tmp = i18nLibFileSearch("bind", name, "bind");
268 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
269 int const result = read(tmp);
271 lyxerr << "Error reading bind file: " << tmp << endl;
276 void LyXRC::readBindFileIfNeeded()
279 ReadBindFile(bind_file);
283 int LyXRC::read(string const & filename)
285 LyXLex lexrc(lyxrcTags, lyxrcCount);
286 if (lyxerr.debugging(Debug::PARSER))
287 lexrc.printTable(lyxerr);
289 lexrc.setFile(filename);
290 if (!lexrc.isOK()) return -2;
292 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
294 while (lexrc.isOK()) {
295 // By using two switches we take advantage of the compiler
296 // telling us if we have missed a LyXRCTags element in
297 // the second switch.
298 // Note that this also shows a problem with LyXLex since it
299 // helps us avoid taking advantage of the strictness of the
302 int le = lexrc.lex();
304 case LyXLex::LEX_UNDEF:
305 lexrc.printError("Unknown tag `$$Token'");
307 case LyXLex::LEX_FEOF:
311 switch (static_cast<LyXRCTags>(le)) {
312 case RC_INPUT: // Include file
315 LibFileSearch(string(),
318 lexrc.printError("Error reading "
319 "included file: "+tmp);
323 case RC_BINDFILE: // RVDK_PATCH_5
325 string const tmp(lexrc.getString());
327 // We are already in the
328 // "actually read bind file"
332 // We are still in the "just
333 // remember the name of the
341 ui_file = lexrc.getString();
345 case RC_EXIT_CONFIRMATION:
347 exit_confirmation = lexrc.getBool();
350 case RC_AUTORESET_OPTIONS:
352 auto_reset_options = lexrc.getBool();
355 case RC_DISPLAY_GRAPHICS:
357 display_graphics = lexrc.getString();
362 use_kbmap = lexrc.getBool();
365 case RC_KBMAP_PRIMARY:
367 string const kmap(lexrc.getString());
370 } else if (!LibFileSearch("kbd", kmap,
372 primary_kbmap = kmap;
374 lexrc.printError("LyX: Keymap `$$Token' not found");
378 case RC_KBMAP_SECONDARY:
380 string const kmap(lexrc.getString());
383 } else if (!LibFileSearch("kbd", kmap,
385 secondary_kbmap = kmap;
387 lexrc.printError("LyX: Keymap `$$Token' not found");
391 case RC_FONT_ENCODING:
393 fontenc = lexrc.getString();
398 printer = lexrc.getString();
401 case RC_PRINT_COMMAND:
403 print_command = lexrc.getString();
406 case RC_PRINTEVENPAGEFLAG:
408 print_evenpage_flag = lexrc.getString();
411 case RC_PRINTODDPAGEFLAG:
413 print_oddpage_flag = lexrc.getString();
416 case RC_PRINTPAGERANGEFLAG:
418 print_pagerange_flag = lexrc.getString();
421 case RC_PRINTCOPIESFLAG:
423 print_copies_flag = lexrc.getString();
426 case RC_PRINTCOLLCOPIESFLAG:
428 print_collcopies_flag = lexrc.getString();
431 case RC_PRINTREVERSEFLAG:
433 print_reverse_flag = lexrc.getString();
436 case RC_PRINTLANDSCAPEFLAG:
438 print_landscape_flag = lexrc.getString();
441 case RC_PRINTTOPRINTER:
443 print_to_printer = lexrc.getString();
446 case RC_PRINT_ADAPTOUTPUT:
448 print_adapt_output = lexrc.getBool();
453 print_to_file = lexrc.getString();
456 case RC_PRINTFILEEXTENSION:
458 print_file_extension = lexrc.getString();
461 case RC_PRINTEXSTRAOPTIONS:
463 print_extra_options = lexrc.getString();
466 case RC_PRINTSPOOL_COMMAND:
468 print_spool_command = lexrc.getString();
471 case RC_PRINTSPOOL_PRINTERPREFIX:
473 print_spool_printerprefix = lexrc.getString();
476 case RC_PRINTPAPERDIMENSIONFLAG:
478 print_paper_dimension_flag = lexrc.getString();
481 case RC_PRINTPAPERFLAG:
483 print_paper_flag = lexrc.getString();
486 case RC_CUSTOM_EXPORT_COMMAND:
488 custom_export_command = lexrc.getString();
491 case RC_CUSTOM_EXPORT_FORMAT:
493 custom_export_format = lexrc.getString();
496 case RC_DEFAULT_PAPERSIZE:
499 lowercase(lexrc.getString());
500 if (size == "usletter")
502 BufferParams::PAPER_USLETTER;
503 else if (size == "legal")
505 BufferParams::PAPER_LEGALPAPER;
506 else if (size == "executive")
508 BufferParams::PAPER_EXECUTIVEPAPER;
509 else if (size == "a3")
511 BufferParams::PAPER_A3PAPER;
512 else if (size == "a4")
514 BufferParams::PAPER_A4PAPER;
515 else if (size == "a5")
517 BufferParams::PAPER_A5PAPER;
518 else if (size == "b5")
520 BufferParams::PAPER_B5PAPER;
524 case RC_VIEWDVI_PAPEROPTION:
526 view_dvi_paper_option = lexrc.getString();
528 view_dvi_paper_option.erase();
533 ps_command = lexrc.getString();
536 case RC_CHKTEX_COMMAND:
538 chktex_command = lexrc.getString();
543 dpi = lexrc.getInteger();
548 zoom = lexrc.getInteger();
553 wheel_jump = lexrc.getInteger();
556 case RC_SCREEN_FONT_SIZES:
558 font_sizes[LyXFont::SIZE_TINY] =
561 font_sizes[LyXFont::SIZE_SCRIPT] =
564 font_sizes[LyXFont::SIZE_FOOTNOTE] =
567 font_sizes[LyXFont::SIZE_SMALL] =
570 font_sizes[LyXFont::SIZE_NORMAL] =
573 font_sizes[LyXFont::SIZE_LARGE] =
576 font_sizes[LyXFont::SIZE_LARGER] =
579 font_sizes[LyXFont::SIZE_LARGEST] =
582 font_sizes[LyXFont::SIZE_HUGE] =
585 font_sizes[LyXFont::SIZE_HUGER] =
589 case RC_SCREEN_FONT_SCALABLE:
591 use_scalable_fonts = lexrc.getBool();
596 autosave = lexrc.getInteger();
599 case RC_DOCUMENTPATH:
601 document_path = ExpandPath(lexrc.getString());
605 case RC_TEMPLATEPATH:
607 template_path = ExpandPath(lexrc.getString());
612 tempdir_path = ExpandPath(lexrc.getString());
617 use_tempdir = lexrc.getBool();
622 lastfiles = ExpandPath(lexrc.getString());
625 case RC_NUMLASTFILES:
627 num_lastfiles = lexrc.getInteger();
630 case RC_CHECKLASTFILES:
632 check_lastfiles = lexrc.getBool();
635 case RC_SCREEN_FONT_ROMAN:
637 roman_font_name = lexrc.getString();
640 case RC_SCREEN_FONT_SANS:
642 sans_font_name = lexrc.getString();
645 case RC_SCREEN_FONT_TYPEWRITER:
647 typewriter_font_name = lexrc.getString();
650 case RC_SCREEN_FONT_ENCODING:
652 font_norm = lexrc.getString();
653 set_font_norm_type();
657 case RC_POPUP_BOLD_FONT:
659 popup_bold_font = lexrc.getString();
662 case RC_POPUP_NORMAL_FONT:
664 popup_normal_font = lexrc.getString();
667 case RC_POPUP_FONT_ENCODING:
669 popup_font_encoding = lexrc.getString();
674 string lyx_name, x11_name;
677 lyx_name = lexrc.getString();
679 lexrc.printError("Missing color tag.");
684 x11_name = lexrc.getString();
686 lexrc.printError("Missing color name for color : `$$Token'");
690 if (!lcolor.setColor(lyx_name, x11_name))
691 lyxerr << "Bad lyxrc set_color for "
696 case RC_AUTOREGIONDELETE:
697 // Auto region delete defaults to true
699 auto_region_delete = lexrc.getBool();
704 // we should not do an explicit binding before
705 // loading a bind file. So, in this case, load
706 // the default bind file.
707 readBindFileIfNeeded();
709 // !!!chb, dynamic key binding...
711 string::size_type res = 0;
715 seq = lexrc.getString();
717 lexrc.printError("RC_BIND: Missing key sequence");
721 if (lexrc.next(true)) {
722 cmd = lexrc.getString();
724 lexrc.printError("RC_BIND: missing command");
728 if ((action = lyxaction.LookupFunc(cmd))>= 0) {
729 if (lyxerr.debugging(Debug::LYXRC)) {
730 lyxerr << "RC_BIND: Sequence `"
731 << seq << "' Command `"
732 << cmd << "' Action `"
733 << action << '\'' << endl;
735 res = toplevel_keymap->bind(seq, kb_action(action));
736 if (res != string::npos
737 && lyxerr.debugging(Debug::LYXRC)) {
740 "Invalid key sequence `"
743 } else {// cmd is the last token read.
745 "Unknown LyX function `$$Token'");
749 case RC_OVERRIDE_X_DEADKEYS:
751 override_x_deadkeys = lexrc.getBool();
756 lyxpipes = ExpandPath(lexrc.getString());
759 case RC_CURSOR_FOLLOWS_SCROLLBAR:
761 cursor_follows_scrollbar = lexrc.getBool();
764 case RC_DIALOGS_ICONIFY_WITH_MAIN:
766 dialogs_iconify_with_main = lexrc.getBool();
769 case RC_ASCIIROFF_COMMAND:
771 ascii_roff_command = lexrc.getString();
773 case RC_ASCII_LINELEN:
775 ascii_linelen = lexrc.getInteger();
777 // Spellchecker settings:
781 use_pspell = lexrc.getBool();
784 case RC_SPELL_COMMAND:
786 isp_command = lexrc.getString();
788 case RC_ACCEPT_COMPOUND:
790 isp_accept_compound = lexrc.getBool();
794 isp_use_input_encoding = lexrc.getBool();
796 case RC_USE_ALT_LANG:
798 isp_use_alt_lang = lexrc.getBool();
800 case RC_USE_PERS_DICT:
802 isp_use_pers_dict = lexrc.getBool();
804 case RC_USE_ESC_CHARS:
806 isp_use_esc_chars = lexrc.getBool();
810 isp_alt_lang = lexrc.getString();
814 isp_pers_dict = lexrc.getString();
818 isp_esc_chars = lexrc.getString();
822 make_backup = lexrc.getBool();
824 case RC_BACKUPDIR_PATH:
826 backupdir_path = ExpandPath(lexrc.getString());
828 case RC_DATE_INSERT_FORMAT:
830 date_insert_format = lexrc.getString();
832 case RC_LANGUAGE_PACKAGE:
834 language_package = lexrc.getString();
836 case RC_LANGUAGE_AUTO_BEGIN:
838 language_auto_begin = lexrc.getBool();
840 case RC_LANGUAGE_AUTO_END:
842 language_auto_end = lexrc.getBool();
844 case RC_LANGUAGE_GLOBAL_OPTIONS:
846 language_global_options = lexrc.getBool();
848 case RC_LANGUAGE_USE_BABEL:
850 language_use_babel = lexrc.getBool();
852 case RC_LANGUAGE_COMMAND_BEGIN:
854 language_command_begin = lexrc.getString();
856 case RC_LANGUAGE_COMMAND_END:
858 language_command_end = lexrc.getString();
860 case RC_LANGUAGE_COMMAND_LOCAL:
862 language_command_local = lexrc.getString();
866 rtl_support = lexrc.getBool();
870 auto_number = lexrc.getBool();
872 case RC_MARK_FOREIGN_LANGUAGE:
874 mark_foreign_language = lexrc.getBool();
877 case RC_NEW_ASK_FILENAME:
879 new_ask_filename = lexrc.getBool();
882 string from, to, command, flags;
884 from = lexrc.getString();
886 to = lexrc.getString();
888 command = lexrc.getString();
890 flags = lexrc.getString();
891 if (command.empty() || command == "none")
892 converters.erase(from, to);
894 converters.add(from, to, command, flags);
898 string format, command;
900 format = lexrc.getString();
902 command = lexrc.getString();
903 formats.setViewer(format, command);
907 string format, extension, prettyname, shortcut;
909 format = lexrc.getString();
911 extension = lexrc.getString();
913 prettyname = lexrc.getString();
915 shortcut = lexrc.getString();
916 if (prettyname.empty()) {
917 if (converters.formatIsUsed(format))
918 lyxerr << "Can't delete format "
921 formats.erase(format);
924 formats.add(format, extension, prettyname,
928 case RC_DEFAULT_LANGUAGE:
930 default_language = lexrc.getString();
933 case RC_LABEL_INIT_LENGTH:
935 label_init_length = lexrc.getInteger();
938 case RC_LAST: break; // this is just a dummy
942 /// Update converters data-structures
943 converters.update(formats);
944 converters.buildGraph();
950 void LyXRC::write(string const & filename) const
952 ofstream ofs(filename.c_str());
958 void LyXRC::print() const
960 if (lyxerr.debugging())
967 void LyXRC::output(ostream & os) const
969 os << "### This file is part of\n"
970 << "### ========================================================\n"
971 << "### LyX, The Document Processor\n"
973 << "### Copyright 1995 Matthias Ettrich\n"
974 << "### Copyright 1995-2001 The LyX Team.\n"
976 << "### ========================================================\n"
978 << "# This file is written by LyX, if you want to make your own\n"
979 << "# modifications you should do them from inside LyX and save\n"
982 // Why the switch you might ask. It is a trick to ensure that all
983 // the elements in the LyXRCTags enum is handled. As you can see
984 // there are no breaks at all. So it is just a huge fall-through.
985 // The nice thing is that we will get a warning from the compiler
986 // if we forget an element.
987 LyXRCTags tag = RC_LAST;
991 // input/include files are not done here
993 // bindings is not written to the preferences file.
995 if (bind_file != system_lyxrc.bind_file) {
996 os << "\\bind_file " << bind_file << "\n";
1002 << "# MISC SECTION ######################################\n"
1005 // bind files are not done here.
1007 if (ui_file != system_lyxrc.ui_file) {
1008 os << "\\ui_file \"" << ui_file << "\"\n";
1010 case RC_AUTOREGIONDELETE:
1011 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1012 os << "# Set to false to inhibit automatic replacement of\n"
1013 << "# the current selection.\n"
1014 << "\\auto_region_delete " << tostr(auto_region_delete)
1017 case RC_AUTORESET_OPTIONS:
1018 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1019 os << "# Set to false to inhibit automatic reset of\n"
1020 << "# the class options to defaults on class change.\n"
1021 << "\\auto_reset_options " << tostr(auto_reset_options)
1025 if (autosave != system_lyxrc.autosave) {
1026 os << "# The time interval between auto-saves in seconds.\n"
1027 << "\\autosave " << autosave << "\n";
1029 case RC_EXIT_CONFIRMATION:
1030 if (exit_confirmation != system_lyxrc.exit_confirmation) {
1031 os << "# Ask for confirmation before exit if there are\n"
1032 << "# unsaved changed documents.\n"
1033 << "\\exit_confirmation " << tostr(exit_confirmation)
1036 case RC_DISPLAY_GRAPHICS:
1037 if (display_graphics != system_lyxrc.display_graphics) {
1038 os << "# Display graphics within LyX\n"
1039 << "# no|mono|gray|color\n"
1040 << "\\display_graphics " << display_graphics
1044 case RC_VIEWDVI_PAPEROPTION:
1045 if (view_dvi_paper_option
1046 != system_lyxrc.view_dvi_paper_option) {
1047 os << "# Options used to specify paper size to the\n"
1048 << "# view_dvi_command (e.g. -paper)\n"
1049 << "\\view_dvi_paper_option \""
1050 << view_dvi_paper_option << "\"\n";
1052 case RC_DEFAULT_PAPERSIZE:
1053 if (default_papersize != system_lyxrc.default_papersize) {
1054 os << "# The default papersize to use.\n"
1055 << "\\default_papersize \"";
1056 switch (default_papersize) {
1057 case BufferParams::PAPER_USLETTER:
1058 os << "usletter"; break;
1059 case BufferParams::PAPER_LEGALPAPER:
1060 os << "legal"; break;
1061 case BufferParams::PAPER_EXECUTIVEPAPER:
1062 os << "executive"; break;
1063 case BufferParams::PAPER_A3PAPER:
1065 case BufferParams::PAPER_A4PAPER:
1067 case BufferParams::PAPER_A5PAPER:
1069 case BufferParams::PAPER_B5PAPER:
1071 case BufferParams::PAPER_DEFAULT: break;
1076 if (ps_command != system_lyxrc.ps_command) {
1077 os << "# Program used for interpreting postscript.\n"
1078 << "\\ps_command \"" << ps_command << "\"\n";
1080 case RC_CHKTEX_COMMAND:
1081 if (chktex_command != system_lyxrc.chktex_command) {
1082 os << "\\chktex_command \"" << chktex_command << "\"\n";
1085 if (use_kbmap != system_lyxrc.use_kbmap) {
1086 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1088 case RC_KBMAP_PRIMARY:
1089 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1090 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1092 case RC_KBMAP_SECONDARY:
1093 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1094 os << "\\kbmap_secondary \"" << secondary_kbmap
1098 if (lyxpipes != system_lyxrc.lyxpipes) {
1099 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1101 case RC_DATE_INSERT_FORMAT:
1102 if (date_insert_format != system_lyxrc.date_insert_format) {
1103 os << "\\date_insert_format \"" << date_insert_format
1106 case RC_LABEL_INIT_LENGTH:
1107 if (label_init_length != system_lyxrc.label_init_length) {
1108 os << "\\label_init_length " << label_init_length
1113 << "# SCREEN & FONTS SECTION ############################\n"
1116 case RC_POPUP_NORMAL_FONT:
1117 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1118 os << "\\popup_normal_font \"" << popup_normal_font
1121 case RC_POPUP_BOLD_FONT:
1122 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1123 os << "\\popup_bold_font \"" << popup_bold_font
1126 case RC_POPUP_FONT_ENCODING:
1127 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1128 os << "\\popup_font_encoding \"" << popup_font_encoding
1132 if (dpi != system_lyxrc.dpi) {
1133 os << "\\screen_dpi " << dpi << "\n";
1135 case RC_SCREEN_ZOOM:
1136 if (zoom != system_lyxrc.zoom) {
1137 os << "\\screen_zoom " << zoom << "\n";
1140 if (wheel_jump != system_lyxrc.wheel_jump) {
1141 os << "\\wheel_jump " << wheel_jump << "\n";
1143 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1144 if (cursor_follows_scrollbar
1145 != system_lyxrc.cursor_follows_scrollbar) {
1146 os << "\\cursor_follows_scrollbar "
1147 << tostr(cursor_follows_scrollbar) << "\n";
1149 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1150 if (dialogs_iconify_with_main
1151 != system_lyxrc.dialogs_iconify_with_main) {
1152 os << "\\dialogs_iconify_with_main "
1153 << tostr(dialogs_iconify_with_main) << "\n";
1155 case RC_SCREEN_FONT_ROMAN:
1156 if (roman_font_name != system_lyxrc.roman_font_name) {
1157 os << "\\screen_font_roman \"" << roman_font_name
1160 case RC_SCREEN_FONT_SANS:
1161 if (sans_font_name != system_lyxrc.sans_font_name) {
1162 os << "\\screen_font_sans \"" << sans_font_name
1165 case RC_SCREEN_FONT_TYPEWRITER:
1166 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1167 os << "\\screen_font_typewriter \""
1168 << typewriter_font_name << "\"\n";
1170 case RC_SCREEN_FONT_SCALABLE:
1171 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1172 os << "\\screen_font_scalable "
1173 << tostr(use_scalable_fonts)
1176 case RC_SCREEN_FONT_ENCODING:
1177 if (font_norm != system_lyxrc.font_norm) {
1178 os << "\\screen_font_encoding \"" << font_norm
1181 case RC_SCREEN_FONT_SIZES:
1182 if (font_sizes[LyXFont::SIZE_TINY]
1183 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1184 font_sizes[LyXFont::SIZE_SCRIPT]
1185 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1186 font_sizes[LyXFont::SIZE_FOOTNOTE]
1187 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1188 font_sizes[LyXFont::SIZE_SMALL]
1189 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1190 font_sizes[LyXFont::SIZE_NORMAL]
1191 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1192 font_sizes[LyXFont::SIZE_LARGE]
1193 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1194 font_sizes[LyXFont::SIZE_LARGER]
1195 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1196 font_sizes[LyXFont::SIZE_LARGEST]
1197 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1198 font_sizes[LyXFont::SIZE_HUGE]
1199 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1200 font_sizes[LyXFont::SIZE_HUGER]
1201 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1202 os.setf(ios::fixed);
1204 os << "\\screen_font_sizes"
1205 << " " << font_sizes[LyXFont::SIZE_TINY]
1206 << " " << font_sizes[LyXFont::SIZE_SCRIPT]
1207 << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]
1208 << " " << font_sizes[LyXFont::SIZE_SMALL]
1209 << " " << font_sizes[LyXFont::SIZE_NORMAL]
1210 << " " << font_sizes[LyXFont::SIZE_LARGE]
1211 << " " << font_sizes[LyXFont::SIZE_LARGER]
1212 << " " << font_sizes[LyXFont::SIZE_LARGEST]
1213 << " " << font_sizes[LyXFont::SIZE_HUGE]
1214 << " " << font_sizes[LyXFont::SIZE_HUGER]
1219 << "# COLOR SECTION ###################################\n"
1223 for (int i = 0; i < LColor::ignore; ++i) {
1224 LColor::color lc = static_cast<LColor::color>(i);
1226 string const col(lcolor.getX11Name(lc));
1227 if (col != system_lcolor.getX11Name(lc)) {
1228 os << "\\set_color \""
1229 << lcolor.getLyXName(lc) << "\" \""
1235 << "# PRINTER SECTION ###################################\n"
1239 if (printer != system_lyxrc.printer) {
1240 os << "\\printer \"" << printer << "\"\n";
1242 case RC_PRINT_ADAPTOUTPUT:
1243 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1244 os << "\\print_adapt_output "
1245 << tostr(print_adapt_output)
1248 case RC_PRINT_COMMAND:
1249 if (print_command != system_lyxrc.print_command) {
1250 os << "\\print_command \"" << print_command << "\"\n";
1252 case RC_PRINTEXSTRAOPTIONS:
1253 if (print_extra_options != system_lyxrc.print_extra_options) {
1254 os << "\\print_extra_options \"" << print_extra_options
1257 case RC_PRINTSPOOL_COMMAND:
1258 if (print_spool_command != system_lyxrc.print_spool_command) {
1259 os << "\\print_spool_command \"" << print_spool_command
1262 case RC_PRINTSPOOL_PRINTERPREFIX:
1263 if (print_spool_printerprefix
1264 != system_lyxrc.print_spool_printerprefix) {
1265 os << "\\print_spool_printerprefix \""
1266 << print_spool_printerprefix << "\"\n";
1268 case RC_PRINTEVENPAGEFLAG:
1269 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1270 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1273 case RC_PRINTODDPAGEFLAG:
1274 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1275 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1278 case RC_PRINTREVERSEFLAG:
1279 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1280 os << "\\print_reverse_flag \"" << print_reverse_flag
1283 case RC_PRINTLANDSCAPEFLAG:
1284 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1285 os << "\\print_landscape_flag \"" << print_landscape_flag
1288 case RC_PRINTPAGERANGEFLAG:
1289 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1290 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1293 case RC_PRINTCOPIESFLAG:
1294 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1295 os << "\\print_copies_flag \"" << print_copies_flag
1298 case RC_PRINTCOLLCOPIESFLAG:
1299 if (print_collcopies_flag
1300 != system_lyxrc.print_collcopies_flag) {
1301 os << "\\print_collcopies_flag \""
1302 << print_collcopies_flag
1305 case RC_PRINTPAPERFLAG:
1306 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1307 os << "\\print_paper_flag \"" << print_paper_flag
1310 case RC_PRINTPAPERDIMENSIONFLAG:
1311 if (print_paper_dimension_flag
1312 != system_lyxrc.print_paper_dimension_flag) {
1313 os << "\\print_paper_dimension_flag \""
1314 << print_paper_dimension_flag << "\"\n";
1316 case RC_PRINTTOPRINTER:
1317 if (print_to_printer != system_lyxrc.print_to_printer) {
1318 os << "\\print_to_printer \"" << print_to_printer
1321 case RC_PRINTTOFILE:
1322 if (print_to_file != system_lyxrc.print_to_file) {
1323 os << "\\print_to_file \"" << print_to_file << "\"\n";
1325 case RC_PRINTFILEEXTENSION:
1326 if (print_file_extension != system_lyxrc.print_file_extension) {
1327 os << "\\print_file_extension \""
1328 << print_file_extension
1333 << "# EXPORT SECTION ####################################\n"
1336 case RC_CUSTOM_EXPORT_COMMAND:
1337 if (custom_export_command
1338 != system_lyxrc.custom_export_command) {
1339 os << "\\custom_export_command \""
1340 << custom_export_command
1343 case RC_CUSTOM_EXPORT_FORMAT:
1344 if (custom_export_format
1345 != system_lyxrc.custom_export_format) {
1346 os << "\\custom_export_format \"" << custom_export_format
1351 << "# TEX SECTION #######################################\n"
1354 case RC_FONT_ENCODING:
1355 if (fontenc != system_lyxrc.fontenc) {
1356 os << "\\font_encoding \"" << fontenc << "\"\n";
1360 << "# FILE SECTION ######################################\n"
1363 case RC_DOCUMENTPATH:
1364 if (document_path != system_lyxrc.document_path) {
1365 os << "\\document_path \"" << document_path << "\"\n";
1368 if (lastfiles != system_lyxrc.lastfiles) {
1369 os << "\\lastfiles \"" << lastfiles << "\"\n";
1371 case RC_NUMLASTFILES:
1372 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1373 os << "\\num_lastfiles " << num_lastfiles << "\n";
1375 case RC_CHECKLASTFILES:
1376 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1377 os << "\\check_lastfiles " << tostr(check_lastfiles)
1380 case RC_TEMPLATEPATH:
1381 if (template_path != system_lyxrc.template_path) {
1382 os << "\\template_path \"" << template_path << "\"\n";
1384 case RC_TEMPDIRPATH:
1385 if (tempdir_path != system_lyxrc.tempdir_path) {
1386 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1389 if (use_tempdir != system_lyxrc.use_tempdir) {
1390 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1392 case RC_ASCII_LINELEN:
1393 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1394 os << "\\ascii_linelen " << ascii_linelen << "\n";
1396 case RC_MAKE_BACKUP:
1397 if (make_backup != system_lyxrc.make_backup) {
1398 os << "\\make_backup " << tostr(make_backup) << "\n";
1400 case RC_BACKUPDIR_PATH:
1401 if (backupdir_path != system_lyxrc.backupdir_path) {
1402 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1406 << "# ASCII EXPORT SECTION ##############################\n"
1409 case RC_ASCIIROFF_COMMAND:
1410 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1411 os << "\\ascii_roff_command \"" << ascii_roff_command
1416 << "# SPELLCHECKER SECTION ##############################\n"
1420 if (use_pspell != system_lyxrc.use_pspell) {
1421 os << "\\use_pspell " << tostr(use_pspell) << "\n";
1424 case RC_SPELL_COMMAND:
1425 if (isp_command != system_lyxrc.isp_command) {
1426 os << "\\spell_command \"" << isp_command << "\"\n";
1428 case RC_ACCEPT_COMPOUND:
1429 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1430 os << "\\accept_compound " << tostr(isp_accept_compound)
1433 case RC_USE_ALT_LANG:
1434 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1435 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1439 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1440 os << "\\alternate_language \"" << isp_alt_lang
1443 case RC_USE_ESC_CHARS:
1444 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1445 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1449 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1450 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1452 case RC_USE_PERS_DICT:
1453 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1454 os << "\\use_personal_dictionary "
1455 << tostr(isp_use_pers_dict)
1459 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1460 os << "\\personal_dictionary \"" << isp_pers_dict
1463 case RC_USE_INP_ENC:
1464 if (isp_use_input_encoding
1465 != system_lyxrc.isp_use_input_encoding) {
1466 os << "\\use_input_encoding "
1467 << tostr(isp_use_input_encoding)
1472 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1475 case RC_RTL_SUPPORT:
1476 if (rtl_support != system_lyxrc.rtl_support) {
1477 os << "\\rtl " << tostr(rtl_support) << "\n";
1479 case RC_LANGUAGE_PACKAGE:
1480 if (language_package != system_lyxrc.language_package) {
1481 os << "\\language_package \"" << language_package
1484 case RC_LANGUAGE_GLOBAL_OPTIONS:
1485 if (language_global_options
1486 != system_lyxrc.language_global_options) {
1487 os << "\\language_global_options \""
1488 << tostr(language_global_options)
1491 case RC_LANGUAGE_USE_BABEL:
1492 if (language_use_babel != system_lyxrc.language_use_babel) {
1493 os << "\\language_use_babel \""
1494 << tostr(language_use_babel)
1497 case RC_LANGUAGE_COMMAND_BEGIN:
1498 if (language_command_begin
1499 != system_lyxrc.language_command_begin) {
1500 os << "\\language_command_begin \""
1501 << language_command_begin
1504 case RC_LANGUAGE_COMMAND_END:
1505 if (language_command_end
1506 != system_lyxrc.language_command_end) {
1507 os << "\\language_command_end \"" << language_command_end
1510 case RC_LANGUAGE_COMMAND_LOCAL:
1511 if (language_command_local
1512 != system_lyxrc.language_command_local) {
1513 os << "\\language_command_local \""
1514 << language_command_local
1517 case RC_LANGUAGE_AUTO_BEGIN:
1518 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1519 os << "\\language_auto_begin "
1520 << tostr(language_auto_begin) << "\n";
1522 case RC_LANGUAGE_AUTO_END:
1523 if (language_auto_end != system_lyxrc.language_auto_end) {
1524 os << "\\language_auto_end "
1525 << tostr(language_auto_end) << "\n";
1527 case RC_MARK_FOREIGN_LANGUAGE:
1528 if (mark_foreign_language
1529 != system_lyxrc.mark_foreign_language) {
1530 os << "\\mark_foreign_language " <<
1531 tostr(mark_foreign_language) << "\n";
1535 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1538 case RC_OVERRIDE_X_DEADKEYS:
1539 if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) {
1540 os << "\\override_x_deadkeys "
1541 << tostr(override_x_deadkeys) << "\n";
1543 case RC_AUTO_NUMBER:
1544 if (auto_number != system_lyxrc.auto_number) {
1545 os << "\\auto_number " << tostr(auto_number) << "\n";
1547 case RC_NEW_ASK_FILENAME:
1548 if (new_ask_filename != system_lyxrc.new_ask_filename) {
1549 os << "\\new_ask_filename " << tostr(new_ask_filename)
1552 case RC_DEFAULT_LANGUAGE:
1553 if (default_language != system_lyxrc.default_language) {
1554 os << "\\default_language " << default_language << "\n";
1558 << "# FORMATS SECTION ##########################\n"
1562 // Look for deleted formats
1563 for (Formats::const_iterator cit = formats.begin();
1564 cit != formats.end(); ++cit) {
1565 Format const * format =
1566 system_formats.getFormat(cit->name());
1568 format->extension() != cit->extension() ||
1569 format->prettyname() != cit->prettyname() ||
1570 format->shortcut() != cit->shortcut())
1571 os << "\\format \"" << cit->name() << "\" \""
1572 << cit->extension() << "\" \""
1573 << cit->prettyname() << "\" \""
1574 << cit->shortcut() << "\"\n";
1577 // New/modifed formats
1578 for (Formats::const_iterator cit = system_formats.begin();
1579 cit != system_formats.end(); ++cit)
1580 if (!formats.getFormat(cit->name()))
1581 os << "\\format \"" << cit->name()
1582 << "\" \"\" \"\" \"\"\n";
1584 for (Formats::const_iterator cit = formats.begin();
1585 cit != formats.end(); ++cit) {
1586 Format const * format =
1587 system_formats.getFormat(cit->name());
1588 if ((!format || format->viewer() != cit->viewer()) &&
1589 (format || !cit->viewer().empty()))
1590 os << "\\viewer \"" << cit->name() << "\" \""
1591 << cit->viewer() << "\"\n";
1595 << "# CONVERTERS SECTION ##########################\n"
1599 // Look for new converters
1600 for (Converters::const_iterator cit = converters.begin();
1601 cit != converters.end(); ++cit) {
1602 Converter const * converter =
1603 system_converters.getConverter(cit->from,
1606 converter->command != cit->command ||
1607 converter->flags != cit->flags)
1608 os << "\\converter \"" << cit->from << "\" \""
1609 << cit->to << "\" \""
1610 << cit->command << "\" \""
1611 << cit->flags << "\"\n";
1614 // New/modifed converters
1615 for (Converters::const_iterator cit = system_converters.begin();
1616 cit != system_converters.end(); ++cit)
1617 if (!converters.getConverter(cit->from, cit->to))
1618 os << "\\converter \"" << cit->from
1619 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1624 void LyXRC::set_font_norm_type()
1626 if (font_norm == "iso10646-1")
1627 font_norm_type = ISO_10646_1;
1628 else if (font_norm == "iso8859-1")
1629 font_norm_type = ISO_8859_1;
1630 else if (font_norm == "iso8859-3")
1631 font_norm_type = ISO_8859_3;
1632 else if (font_norm == "iso8859-4")
1633 font_norm_type = ISO_8859_4;
1634 else if (font_norm == "iso8859-6.8x")
1635 font_norm_type = ISO_8859_6_8;
1636 else if (font_norm == "iso8859-9")
1637 font_norm_type = ISO_8859_9;
1638 else if (font_norm == "iso8859-15")
1639 font_norm_type = ISO_8859_15;
1641 font_norm_type = OTHER_ENCODING;
1645 string const LyXRC::getDescription(LyXRCTags tag)
1650 case RC_FONT_ENCODING:
1651 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1655 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1658 case RC_PRINT_COMMAND:
1659 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1662 case RC_PRINTEVENPAGEFLAG:
1663 str = _("The option to print only even pages.");
1666 case RC_PRINTODDPAGEFLAG:
1667 str = _("The option to print only odd pages.");
1670 case RC_PRINTPAGERANGEFLAG:
1671 str = _("The option for specifying a comma-separated list of pages to print.");
1674 case RC_PRINTCOPIESFLAG:
1675 str = _("The option for specifying the number of copies to print.");
1678 case RC_PRINTCOLLCOPIESFLAG:
1679 str = _("The option for specifying whether the copies should be collated.");
1682 case RC_PRINTREVERSEFLAG:
1683 str = _("The option to reverse the order of the pages printed.");
1686 case RC_PRINTLANDSCAPEFLAG:
1687 str = _("The option to print out in landscape.");
1690 case RC_PRINTPAPERFLAG:
1691 str = _("The option to specify paper type.");
1694 case RC_PRINTPAPERDIMENSIONFLAG:
1695 str = _("Option to specify the dimensions of the print paper.");
1698 case RC_PRINTTOPRINTER:
1699 str = _("Option to pass to the print program to print on a specific printer.");
1702 case RC_PRINT_ADAPTOUTPUT:
1703 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1706 case RC_PRINTTOFILE:
1707 str = _("Option to pass to the print program to print to a file.");
1710 case RC_PRINTFILEEXTENSION:
1711 str = _("Extension of printer program output file. Usually \".ps\".");
1714 case RC_PRINTEXSTRAOPTIONS:
1715 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1718 case RC_PRINTSPOOL_COMMAND:
1719 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.");
1722 case RC_PRINTSPOOL_PRINTERPREFIX:
1723 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.");
1727 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1730 case RC_SCREEN_ZOOM:
1731 //xgettext:no-c-format
1732 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1735 case RC_SCREEN_FONT_SIZES:
1736 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1739 case RC_SCREEN_FONT_ROMAN:
1740 case RC_SCREEN_FONT_SANS:
1741 case RC_SCREEN_FONT_TYPEWRITER:
1742 str = _("The screen fonts used to display the text while editing.");
1745 case RC_POPUP_BOLD_FONT:
1746 str = _("The bold font in the dialogs.");
1749 case RC_POPUP_NORMAL_FONT:
1750 str = _("The normal font in the dialogs.");
1753 case RC_SCREEN_FONT_ENCODING:
1754 str = _("The encoding for the screen fonts.");
1757 case RC_POPUP_FONT_ENCODING:
1758 str = _("The encoding for the menu/popups fonts.");
1765 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1768 case RC_DOCUMENTPATH:
1769 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1772 case RC_TEMPLATEPATH:
1773 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1776 case RC_TEMPDIRPATH:
1777 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1781 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1785 str = _("The file where the last-files information should be stored.");
1788 case RC_AUTOREGIONDELETE:
1789 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1792 case RC_AUTORESET_OPTIONS:
1793 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1796 case RC_OVERRIDE_X_DEADKEYS:
1797 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.");
1802 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1806 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1810 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1814 case RC_KBMAP_PRIMARY:
1815 case RC_KBMAP_SECONDARY:
1816 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.");
1819 case RC_ASCIIROFF_COMMAND:
1820 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.");
1823 case RC_ASCII_LINELEN:
1824 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1827 case RC_NUMLASTFILES:
1828 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1831 case RC_CHECKLASTFILES:
1832 str = _("Select to check whether the lastfiles still exist.");
1835 case RC_VIEWDVI_PAPEROPTION:
1836 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1839 case RC_DEFAULT_PAPERSIZE:
1840 str = _("Specify the default paper size.");
1846 case RC_ACCEPT_COMPOUND:
1847 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1850 case RC_SPELL_COMMAND:
1851 str = _("What command runs the spell checker?");
1854 case RC_USE_INP_ENC:
1855 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.");
1858 case RC_USE_ALT_LANG:
1860 str = _("Specify an alternate language. The default is to use the language of the document.");
1863 case RC_USE_PERS_DICT:
1865 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1868 case RC_USE_ESC_CHARS:
1870 str = _("Specify additional chars that can be part of a word.");
1873 case RC_SCREEN_FONT_SCALABLE:
1874 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.");
1877 case RC_CHKTEX_COMMAND:
1878 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1881 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1882 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.");
1885 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1886 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
1889 case RC_EXIT_CONFIRMATION:
1890 str = _("Sets whether LyX asks for a second confirmation to exit when you have changed documents. (LyX will still ask to save changed documents.)");
1893 case RC_DISPLAY_GRAPHICS:
1894 str = _("Select how LyX will display any graphics.");
1897 case RC_MAKE_BACKUP:
1898 str = _("De-select if you don't want LyX to create backup files.");
1901 case RC_BACKUPDIR_PATH:
1902 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.");
1905 case RC_RTL_SUPPORT:
1906 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
1909 case RC_MARK_FOREIGN_LANGUAGE:
1910 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
1913 case RC_LANGUAGE_PACKAGE:
1914 str = _("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
1917 case RC_LANGUAGE_GLOBAL_OPTIONS:
1918 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
1921 case RC_LANGUAGE_USE_BABEL:
1922 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
1925 case RC_LANGUAGE_AUTO_BEGIN:
1926 str = _("Select if a language switching command is needed at the beginning of the document.");
1929 case RC_LANGUAGE_AUTO_END:
1930 str = _("Select if a language switching command is needed at the end of the document.");
1933 case RC_LANGUAGE_COMMAND_BEGIN:
1934 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.");
1937 case RC_LANGUAGE_COMMAND_END:
1938 str = _("The latex command for changing back to the language of the document.");
1941 case RC_LANGUAGE_COMMAND_LOCAL:
1942 str = _("The latex command for local changing of the language.");
1945 case RC_DATE_INSERT_FORMAT:
1946 //xgettext:no-c-format
1947 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
1950 case RC_SHOW_BANNER:
1951 str = _("De-select if you don't want the startup banner.");
1955 str = _("The wheel movement factor (for mice with wheels or five button mice).");
1967 case RC_NEW_ASK_FILENAME:
1968 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.");
1971 case RC_DEFAULT_LANGUAGE:
1972 str = _("New documents will be assigned this language.");
1975 case RC_LABEL_INIT_LENGTH:
1976 str = _("Maximum number of words in the initialization string for a new label");
1986 // The global instance
1989 // The global copy of the system lyxrc entries (everything except preferences)