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"
20 #include <boost/scoped_ptr.hpp>
26 #include "LyXAction.h"
28 #include "support/path.h"
29 #include "support/filetools.h"
30 #include "converter.h"
43 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
47 // when adding something to this array keep it sorted!
48 keyword_item lyxrcTags[] = {
49 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
50 { "\\alternate_language", LyXRC::RC_ALT_LANG },
51 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
52 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
53 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
54 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
55 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
56 { "\\autosave", LyXRC::RC_AUTOSAVE },
57 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
58 { "\\bind", LyXRC::RC_BIND },
59 { "\\bind_file", LyXRC::RC_BINDFILE },
60 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
61 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
62 { "\\converter", LyXRC::RC_CONVERTER },
63 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
64 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
65 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
66 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
67 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
68 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
69 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
70 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
71 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
72 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
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 { "\\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 { "\\preview", LyXRC::RC_PREVIEW },
98 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
99 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
100 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
101 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
102 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
103 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
104 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
105 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
106 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
107 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
108 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
109 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
110 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
111 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
112 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
113 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
114 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
115 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
116 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
117 { "\\printer", LyXRC::RC_PRINTER },
118 { "\\ps_command", LyXRC::RC_PS_COMMAND },
119 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
120 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
121 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
122 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
123 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
124 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
125 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
126 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
127 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
128 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
129 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
130 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
131 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
132 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
133 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
134 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
135 { "\\set_color", LyXRC::RC_SET_COLOR },
136 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
137 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
138 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
139 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
140 { "\\ui_file", LyXRC::RC_UIFILE },
141 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
142 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
143 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
144 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
146 { "\\use_pspell", LyXRC::RC_USE_PSPELL },
148 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
149 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
150 { "\\viewer" ,LyXRC::RC_VIEWER},
151 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
154 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
165 void LyXRC::setDefaults() {
169 // Get printer from the environment. If fail, use default "",
170 // assuming that everything is set up correctly.
171 printer = GetEnv("PRINTER");
172 print_adapt_output = false;
173 print_command = "dvips";
174 print_evenpage_flag = "-B";
175 print_oddpage_flag = "-A";
176 print_pagerange_flag = "-pp";
177 print_copies_flag = "-c";
178 print_collcopies_flag = "-C";
179 print_reverse_flag = "-r";
180 print_landscape_flag = "-t landscape";
181 print_to_printer = "-P";
182 print_to_file = "-o ";
183 print_file_extension = ".ps";
184 print_paper_flag = "-t";
185 print_paper_dimension_flag = "-T";
186 document_path.erase();
187 tempdir_path = "/tmp";
190 view_dvi_paper_option.erase();
191 default_papersize = BufferParams::PAPER_USLETTER;
192 custom_export_format = "ps";
193 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
196 // Because a screen typically is wider than a piece of paper:
199 // Default LaTeX font size:
200 font_sizes[LyXFont::SIZE_TINY] = 5.0;
201 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
202 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
203 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
204 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
205 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
206 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
207 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
208 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
209 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
210 use_scalable_fonts = true;
211 roman_font_name = "-*-times";
212 sans_font_name = "-*-helvetica";
213 typewriter_font_name = "-*-courier";
214 popup_bold_font = "-*-helvetica-bold-r";
215 popup_normal_font = "-*-helvetica-medium-r";
216 font_norm = "iso8859-1";
217 font_norm_type = ISO_8859_1;
218 popup_font_encoding.erase();
219 override_x_deadkeys = true;
221 auto_region_delete = true;
222 auto_reset_options = false;
225 check_lastfiles = true;
227 backupdir_path.erase();
228 display_graphics = grfx::ColorDisplay;
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";
254 date_insert_format = "%A, %e %B %Y";
255 cursor_follows_scrollbar = false;
256 dialogs_iconify_with_main = false;
257 label_init_length = 3;
259 preview_hashed_labels = false;
260 preview_scale_factor = 0.9;
262 /// These variables are not stored on disk (perhaps they
263 // should be moved from the LyXRC class).
269 int LyXRC::ReadBindFile(string const & name)
272 string const tmp = i18nLibFileSearch("bind", name, "bind");
273 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
274 int const result = read(tmp);
276 lyxerr << "Error reading bind file: " << tmp << endl;
281 void LyXRC::readBindFileIfNeeded()
284 ReadBindFile(bind_file);
288 int LyXRC::read(string const & filename)
290 LyXLex lexrc(lyxrcTags, lyxrcCount);
291 if (lyxerr.debugging(Debug::PARSER))
292 lexrc.printTable(lyxerr);
294 lexrc.setFile(filename);
295 if (!lexrc.isOK()) return -2;
297 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
299 while (lexrc.isOK()) {
300 // By using two switches we take advantage of the compiler
301 // telling us if we have missed a LyXRCTags element in
302 // the second switch.
303 // Note that this also shows a problem with LyXLex since it
304 // helps us avoid taking advantage of the strictness of the
307 int le = lexrc.lex();
309 case LyXLex::LEX_UNDEF:
310 lexrc.printError("Unknown tag `$$Token'");
312 case LyXLex::LEX_FEOF:
316 switch (static_cast<LyXRCTags>(le)) {
317 case RC_INPUT: // Include file
320 LibFileSearch(string(),
323 lexrc.printError("Error reading "
324 "included file: "+tmp);
328 case RC_BINDFILE: // RVDK_PATCH_5
330 string const tmp(lexrc.getString());
332 // We are already in the
333 // "actually read bind file"
337 // We are still in the "just
338 // remember the name of the
347 ui_file = lexrc.getString();
351 case RC_AUTORESET_OPTIONS:
353 auto_reset_options = lexrc.getBool();
357 case RC_DISPLAY_GRAPHICS:
359 display_graphics = grfx::displayTranslator.find(lexrc.getString());
365 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");
383 case RC_KBMAP_SECONDARY:
385 string const kmap(lexrc.getString());
388 } else if (!LibFileSearch("kbd", kmap,
390 secondary_kbmap = kmap;
392 lexrc.printError("LyX: Keymap `$$Token' not found");
397 case RC_FONT_ENCODING:
399 fontenc = lexrc.getString();
405 printer = lexrc.getString();
409 case RC_PRINT_COMMAND:
411 print_command = lexrc.getString();
415 case RC_PRINTEVENPAGEFLAG:
417 print_evenpage_flag = lexrc.getString();
421 case RC_PRINTODDPAGEFLAG:
423 print_oddpage_flag = lexrc.getString();
427 case RC_PRINTPAGERANGEFLAG:
429 print_pagerange_flag = lexrc.getString();
433 case RC_PRINTCOPIESFLAG:
435 print_copies_flag = lexrc.getString();
439 case RC_PRINTCOLLCOPIESFLAG:
441 print_collcopies_flag = lexrc.getString();
445 case RC_PRINTREVERSEFLAG:
447 print_reverse_flag = lexrc.getString();
451 case RC_PRINTLANDSCAPEFLAG:
453 print_landscape_flag = lexrc.getString();
457 case RC_PRINTTOPRINTER:
459 print_to_printer = lexrc.getString();
463 case RC_PRINT_ADAPTOUTPUT:
465 print_adapt_output = lexrc.getBool();
471 print_to_file = lexrc.getString();
475 case RC_PRINTFILEEXTENSION:
477 print_file_extension = lexrc.getString();
481 case RC_PRINTEXSTRAOPTIONS:
483 print_extra_options = lexrc.getString();
487 case RC_PRINTSPOOL_COMMAND:
489 print_spool_command = lexrc.getString();
493 case RC_PRINTSPOOL_PRINTERPREFIX:
495 print_spool_printerprefix = lexrc.getString();
499 case RC_PRINTPAPERDIMENSIONFLAG:
501 print_paper_dimension_flag = lexrc.getString();
505 case RC_PRINTPAPERFLAG:
507 print_paper_flag = lexrc.getString();
511 case RC_CUSTOM_EXPORT_COMMAND:
513 custom_export_command = lexrc.getString();
517 case RC_CUSTOM_EXPORT_FORMAT:
519 custom_export_format = lexrc.getString();
523 case RC_DEFAULT_PAPERSIZE:
526 ascii_lowercase(lexrc.getString());
527 if (size == "usletter")
529 BufferParams::PAPER_USLETTER;
530 else if (size == "legal")
532 BufferParams::PAPER_LEGALPAPER;
533 else if (size == "executive")
535 BufferParams::PAPER_EXECUTIVEPAPER;
536 else if (size == "a3")
538 BufferParams::PAPER_A3PAPER;
539 else if (size == "a4")
541 BufferParams::PAPER_A4PAPER;
542 else if (size == "a5")
544 BufferParams::PAPER_A5PAPER;
545 else if (size == "b5")
547 BufferParams::PAPER_B5PAPER;
551 case RC_VIEWDVI_PAPEROPTION:
553 view_dvi_paper_option = lexrc.getString();
555 view_dvi_paper_option.erase();
561 ps_command = lexrc.getString();
565 case RC_CHKTEX_COMMAND:
567 chktex_command = lexrc.getString();
573 dpi = lexrc.getInteger();
579 zoom = lexrc.getInteger();
585 wheel_jump = lexrc.getInteger();
589 case RC_SCREEN_FONT_SIZES:
591 font_sizes[LyXFont::SIZE_TINY] =
595 font_sizes[LyXFont::SIZE_SCRIPT] =
599 font_sizes[LyXFont::SIZE_FOOTNOTE] =
603 font_sizes[LyXFont::SIZE_SMALL] =
607 font_sizes[LyXFont::SIZE_NORMAL] =
611 font_sizes[LyXFont::SIZE_LARGE] =
615 font_sizes[LyXFont::SIZE_LARGER] =
619 font_sizes[LyXFont::SIZE_LARGEST] =
623 font_sizes[LyXFont::SIZE_HUGE] =
627 font_sizes[LyXFont::SIZE_HUGER] =
632 case RC_SCREEN_FONT_SCALABLE:
634 use_scalable_fonts = lexrc.getBool();
640 autosave = lexrc.getInteger();
644 case RC_DOCUMENTPATH:
646 document_path = ExpandPath(lexrc.getString());
650 case RC_TEMPLATEPATH:
652 template_path = ExpandPath(lexrc.getString());
658 tempdir_path = ExpandPath(lexrc.getString());
664 use_tempdir = lexrc.getBool();
670 lastfiles = ExpandPath(lexrc.getString());
674 case RC_NUMLASTFILES:
676 num_lastfiles = lexrc.getInteger();
680 case RC_CHECKLASTFILES:
682 check_lastfiles = lexrc.getBool();
686 case RC_SCREEN_FONT_ROMAN:
688 roman_font_name = lexrc.getString();
692 case RC_SCREEN_FONT_SANS:
694 sans_font_name = lexrc.getString();
698 case RC_SCREEN_FONT_TYPEWRITER:
700 typewriter_font_name = lexrc.getString();
704 case RC_SCREEN_FONT_ENCODING:
706 font_norm = lexrc.getString();
707 set_font_norm_type();
711 case RC_POPUP_BOLD_FONT:
713 popup_bold_font = lexrc.getString();
717 case RC_POPUP_NORMAL_FONT:
719 popup_normal_font = lexrc.getString();
723 case RC_POPUP_FONT_ENCODING:
725 popup_font_encoding = lexrc.getString();
731 string lyx_name, x11_name;
734 lyx_name = lexrc.getString();
736 lexrc.printError("Missing color tag.");
741 x11_name = lexrc.getString();
743 lexrc.printError("Missing color name for color : `$$Token'");
747 if (!lcolor.setColor(lyx_name, x11_name)) {
748 lyxerr << "Bad lyxrc set_color for "
754 case RC_AUTOREGIONDELETE:
755 // Auto region delete defaults to true
757 auto_region_delete = lexrc.getBool();
763 // we should not do an explicit binding before
764 // loading a bind file. So, in this case, load
765 // the default bind file.
766 readBindFileIfNeeded();
768 // !!!chb, dynamic key binding...
770 string::size_type res = 0;
774 seq = lexrc.getString();
776 lexrc.printError("RC_BIND: Missing key sequence");
780 if (lexrc.next(true)) {
781 cmd = lexrc.getString();
783 lexrc.printError("RC_BIND: missing command");
787 if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
788 if (lyxerr.debugging(Debug::LYXRC)) {
789 lyxerr << "RC_BIND: Sequence `"
790 << seq << "' Command `"
791 << cmd << "' Action `"
792 << action << '\'' << endl;
794 res = toplevel_keymap->bind(seq, kb_action(action));
795 if (res != string::npos
796 && lyxerr.debugging(Debug::LYXRC)) {
799 "Invalid key sequence `"
802 } else {// cmd is the last token read.
804 "Unknown LyX function `$$Token'");
808 case RC_OVERRIDE_X_DEADKEYS:
810 override_x_deadkeys = lexrc.getBool();
816 lyxpipes = ExpandPath(lexrc.getString());
820 case RC_CURSOR_FOLLOWS_SCROLLBAR:
822 cursor_follows_scrollbar = lexrc.getBool();
826 case RC_DIALOGS_ICONIFY_WITH_MAIN:
828 dialogs_iconify_with_main = lexrc.getBool();
832 case RC_ASCIIROFF_COMMAND:
834 ascii_roff_command = lexrc.getString();
837 case RC_ASCII_LINELEN:
839 ascii_linelen = lexrc.getInteger();
842 // Spellchecker settings:
846 use_pspell = lexrc.getBool();
850 case RC_SPELL_COMMAND:
852 isp_command = lexrc.getString();
855 case RC_ACCEPT_COMPOUND:
857 isp_accept_compound = lexrc.getBool();
862 isp_use_input_encoding = lexrc.getBool();
865 case RC_USE_ALT_LANG:
867 isp_use_alt_lang = lexrc.getBool();
870 case RC_USE_PERS_DICT:
872 isp_use_pers_dict = lexrc.getBool();
875 case RC_USE_ESC_CHARS:
877 isp_use_esc_chars = lexrc.getBool();
882 isp_alt_lang = lexrc.getString();
887 isp_pers_dict = lexrc.getString();
892 isp_esc_chars = lexrc.getString();
897 make_backup = lexrc.getBool();
900 case RC_BACKUPDIR_PATH:
902 backupdir_path = ExpandPath(lexrc.getString());
905 case RC_DATE_INSERT_FORMAT:
907 date_insert_format = lexrc.getString();
910 case RC_LANGUAGE_PACKAGE:
912 language_package = lexrc.getString();
915 case RC_LANGUAGE_AUTO_BEGIN:
917 language_auto_begin = lexrc.getBool();
920 case RC_LANGUAGE_AUTO_END:
922 language_auto_end = lexrc.getBool();
925 case RC_LANGUAGE_GLOBAL_OPTIONS:
927 language_global_options = lexrc.getBool();
930 case RC_LANGUAGE_USE_BABEL:
932 language_use_babel = lexrc.getBool();
935 case RC_LANGUAGE_COMMAND_BEGIN:
937 language_command_begin = lexrc.getString();
940 case RC_LANGUAGE_COMMAND_END:
942 language_command_end = lexrc.getString();
945 case RC_LANGUAGE_COMMAND_LOCAL:
947 language_command_local = lexrc.getString();
952 rtl_support = lexrc.getBool();
957 auto_number = lexrc.getBool();
960 case RC_MARK_FOREIGN_LANGUAGE:
962 mark_foreign_language = lexrc.getBool();
967 string from, to, command, flags;
969 from = lexrc.getString();
972 to = lexrc.getString();
975 command = lexrc.getString();
978 flags = lexrc.getString();
980 if (command.empty() || command == "none") {
981 converters.erase(from, to);
983 converters.add(from, to, command, flags);
988 string format, command;
990 format = lexrc.getString();
993 command = lexrc.getString();
995 formats.setViewer(format, command);
999 string format, extension, prettyname, shortcut;
1001 format = lexrc.getString();
1004 extension = lexrc.getString();
1007 prettyname = lexrc.getString();
1010 shortcut = lexrc.getString();
1012 if (prettyname.empty()) {
1013 if (converters.formatIsUsed(format)) {
1014 lyxerr << "Can't delete format "
1017 formats.erase(format);
1020 formats.add(format, extension, prettyname,
1025 case RC_DEFAULT_LANGUAGE:
1027 default_language = lexrc.getString();
1031 case RC_LABEL_INIT_LENGTH:
1033 label_init_length = lexrc.getInteger();
1037 case RC_SHOW_BANNER:
1039 show_banner = lexrc.getBool();
1045 preview = lexrc.getBool();
1049 case RC_PREVIEW_HASHED_LABELS:
1051 preview_hashed_labels = lexrc.getBool();
1055 case RC_PREVIEW_SCALE_FACTOR:
1057 preview_scale_factor = lexrc.getFloat();
1061 case RC_LAST: break; // this is just a dummy
1065 /// Update converters data-structures
1066 converters.update(formats);
1067 converters.buildGraph();
1073 void LyXRC::write(string const & filename) const
1075 ofstream ofs(filename.c_str());
1081 void LyXRC::print() const
1083 if (lyxerr.debugging())
1090 void LyXRC::output(ostream & os) const
1092 os << "### This file is part of\n"
1093 << "### ========================================================\n"
1094 << "### LyX, The Document Processor\n"
1096 << "### Copyright 1995 Matthias Ettrich\n"
1097 << "### Copyright 1995-2001 The LyX Team.\n"
1099 << "### ========================================================\n"
1101 << "# This file is written by LyX, if you want to make your own\n"
1102 << "# modifications you should do them from inside LyX and save\n"
1105 // Why the switch you might ask. It is a trick to ensure that all
1106 // the elements in the LyXRCTags enum is handled. As you can see
1107 // there are no breaks at all. So it is just a huge fall-through.
1108 // The nice thing is that we will get a warning from the compiler
1109 // if we forget an element.
1110 LyXRCTags tag = RC_LAST;
1114 // input/include files are not done here
1116 // bindings is not written to the preferences file.
1118 if (bind_file != system_lyxrc.bind_file) {
1119 os << "\\bind_file " << bind_file << "\n";
1125 << "# MISC SECTION ######################################\n"
1128 // bind files are not done here.
1130 if (ui_file != system_lyxrc.ui_file) {
1131 os << "\\ui_file \"" << ui_file << "\"\n";
1133 case RC_AUTOREGIONDELETE:
1134 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1135 os << "# Set to false to inhibit automatic replacement of\n"
1136 << "# the current selection.\n"
1137 << "\\auto_region_delete " << tostr(auto_region_delete)
1140 case RC_AUTORESET_OPTIONS:
1141 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1142 os << "# Set to false to inhibit automatic reset of\n"
1143 << "# the class options to defaults on class change.\n"
1144 << "\\auto_reset_options " << tostr(auto_reset_options)
1148 if (autosave != system_lyxrc.autosave) {
1149 os << "# The time interval between auto-saves in seconds.\n"
1150 << "\\autosave " << autosave << "\n";
1152 case RC_DISPLAY_GRAPHICS:
1153 if (display_graphics != system_lyxrc.display_graphics) {
1154 os << "# Display graphics within LyX\n"
1155 << "# monochrome|grayscale|color|none\n"
1156 << "\\display_graphics " << grfx::displayTranslator.find(display_graphics)
1160 case RC_VIEWDVI_PAPEROPTION:
1161 if (view_dvi_paper_option
1162 != system_lyxrc.view_dvi_paper_option) {
1163 os << "# Options used to specify paper size to the\n"
1164 << "# view_dvi_command (e.g. -paper)\n"
1165 << "\\view_dvi_paper_option \""
1166 << view_dvi_paper_option << "\"\n";
1168 case RC_DEFAULT_PAPERSIZE:
1169 if (default_papersize != system_lyxrc.default_papersize) {
1170 os << "# The default papersize to use.\n"
1171 << "\\default_papersize \"";
1172 switch (default_papersize) {
1173 case BufferParams::PAPER_USLETTER:
1174 os << "usletter"; break;
1175 case BufferParams::PAPER_LEGALPAPER:
1176 os << "legal"; break;
1177 case BufferParams::PAPER_EXECUTIVEPAPER:
1178 os << "executive"; break;
1179 case BufferParams::PAPER_A3PAPER:
1181 case BufferParams::PAPER_A4PAPER:
1183 case BufferParams::PAPER_A5PAPER:
1185 case BufferParams::PAPER_B5PAPER:
1187 case BufferParams::PAPER_DEFAULT: break;
1192 if (ps_command != system_lyxrc.ps_command) {
1193 os << "# Program used for interpreting postscript.\n"
1194 << "\\ps_command \"" << ps_command << "\"\n";
1196 case RC_CHKTEX_COMMAND:
1197 if (chktex_command != system_lyxrc.chktex_command) {
1198 os << "\\chktex_command \"" << chktex_command << "\"\n";
1201 if (use_kbmap != system_lyxrc.use_kbmap) {
1202 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1204 case RC_KBMAP_PRIMARY:
1205 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1206 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1208 case RC_KBMAP_SECONDARY:
1209 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1210 os << "\\kbmap_secondary \"" << secondary_kbmap
1214 if (lyxpipes != system_lyxrc.lyxpipes) {
1215 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1217 case RC_DATE_INSERT_FORMAT:
1218 if (date_insert_format != system_lyxrc.date_insert_format) {
1219 os << "\\date_insert_format \"" << date_insert_format
1222 case RC_LABEL_INIT_LENGTH:
1223 if (label_init_length != system_lyxrc.label_init_length) {
1224 os << "\\label_init_length " << label_init_length
1228 case RC_SHOW_BANNER:
1229 if (show_banner != system_lyxrc.show_banner) {
1230 os << "\\show_banner " << tostr(show_banner) << "\n";
1234 if (preview != system_lyxrc.preview) {
1235 os << "\\preview " << tostr(preview) << "\n";
1238 case RC_PREVIEW_HASHED_LABELS:
1239 if (preview_hashed_labels !=
1240 system_lyxrc.preview_hashed_labels) {
1241 os << "\\preview_hashed_labels "
1242 << tostr(preview_hashed_labels) << "\n";
1245 case RC_PREVIEW_SCALE_FACTOR:
1246 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1247 os << "\\preview_scale_factor "
1248 << preview_scale_factor << "\n";
1252 << "# SCREEN & FONTS SECTION ############################\n"
1255 case RC_POPUP_NORMAL_FONT:
1256 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1257 os << "\\popup_normal_font \"" << popup_normal_font
1260 case RC_POPUP_BOLD_FONT:
1261 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1262 os << "\\popup_bold_font \"" << popup_bold_font
1265 case RC_POPUP_FONT_ENCODING:
1266 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1267 os << "\\popup_font_encoding \"" << popup_font_encoding
1271 if (dpi != system_lyxrc.dpi) {
1272 os << "\\screen_dpi " << dpi << "\n";
1274 case RC_SCREEN_ZOOM:
1275 if (zoom != system_lyxrc.zoom) {
1276 os << "\\screen_zoom " << zoom << "\n";
1279 if (wheel_jump != system_lyxrc.wheel_jump) {
1280 os << "\\wheel_jump " << wheel_jump << "\n";
1282 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1283 if (cursor_follows_scrollbar
1284 != system_lyxrc.cursor_follows_scrollbar) {
1285 os << "\\cursor_follows_scrollbar "
1286 << tostr(cursor_follows_scrollbar) << "\n";
1288 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1289 if (dialogs_iconify_with_main
1290 != system_lyxrc.dialogs_iconify_with_main) {
1291 os << "\\dialogs_iconify_with_main "
1292 << tostr(dialogs_iconify_with_main) << "\n";
1294 case RC_SCREEN_FONT_ROMAN:
1295 if (roman_font_name != system_lyxrc.roman_font_name) {
1296 os << "\\screen_font_roman \"" << roman_font_name
1299 case RC_SCREEN_FONT_SANS:
1300 if (sans_font_name != system_lyxrc.sans_font_name) {
1301 os << "\\screen_font_sans \"" << sans_font_name
1304 case RC_SCREEN_FONT_TYPEWRITER:
1305 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1306 os << "\\screen_font_typewriter \""
1307 << typewriter_font_name << "\"\n";
1309 case RC_SCREEN_FONT_SCALABLE:
1310 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1311 os << "\\screen_font_scalable "
1312 << tostr(use_scalable_fonts)
1315 case RC_SCREEN_FONT_ENCODING:
1316 if (font_norm != system_lyxrc.font_norm) {
1317 os << "\\screen_font_encoding \"" << font_norm
1320 case RC_SCREEN_FONT_SIZES:
1321 if (font_sizes[LyXFont::SIZE_TINY]
1322 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1323 font_sizes[LyXFont::SIZE_SCRIPT]
1324 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1325 font_sizes[LyXFont::SIZE_FOOTNOTE]
1326 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1327 font_sizes[LyXFont::SIZE_SMALL]
1328 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1329 font_sizes[LyXFont::SIZE_NORMAL]
1330 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1331 font_sizes[LyXFont::SIZE_LARGE]
1332 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1333 font_sizes[LyXFont::SIZE_LARGER]
1334 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1335 font_sizes[LyXFont::SIZE_LARGEST]
1336 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1337 font_sizes[LyXFont::SIZE_HUGE]
1338 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1339 font_sizes[LyXFont::SIZE_HUGER]
1340 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1341 os.setf(ios::fixed);
1343 os << "\\screen_font_sizes"
1344 << " " << font_sizes[LyXFont::SIZE_TINY]
1345 << " " << font_sizes[LyXFont::SIZE_SCRIPT]
1346 << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]
1347 << " " << font_sizes[LyXFont::SIZE_SMALL]
1348 << " " << font_sizes[LyXFont::SIZE_NORMAL]
1349 << " " << font_sizes[LyXFont::SIZE_LARGE]
1350 << " " << font_sizes[LyXFont::SIZE_LARGER]
1351 << " " << font_sizes[LyXFont::SIZE_LARGEST]
1352 << " " << font_sizes[LyXFont::SIZE_HUGE]
1353 << " " << font_sizes[LyXFont::SIZE_HUGER]
1358 << "# COLOR SECTION ###################################\n"
1362 for (int i = 0; i < LColor::ignore; ++i) {
1363 LColor::color lc = static_cast<LColor::color>(i);
1365 string const col(lcolor.getX11Name(lc));
1366 if (col != system_lcolor.getX11Name(lc)) {
1367 os << "\\set_color \""
1368 << lcolor.getLyXName(lc) << "\" \""
1374 << "# PRINTER SECTION ###################################\n"
1378 if (printer != system_lyxrc.printer) {
1379 os << "\\printer \"" << printer << "\"\n";
1381 case RC_PRINT_ADAPTOUTPUT:
1382 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1383 os << "\\print_adapt_output "
1384 << tostr(print_adapt_output)
1387 case RC_PRINT_COMMAND:
1388 if (print_command != system_lyxrc.print_command) {
1389 os << "\\print_command \"" << print_command << "\"\n";
1391 case RC_PRINTEXSTRAOPTIONS:
1392 if (print_extra_options != system_lyxrc.print_extra_options) {
1393 os << "\\print_extra_options \"" << print_extra_options
1396 case RC_PRINTSPOOL_COMMAND:
1397 if (print_spool_command != system_lyxrc.print_spool_command) {
1398 os << "\\print_spool_command \"" << print_spool_command
1401 case RC_PRINTSPOOL_PRINTERPREFIX:
1402 if (print_spool_printerprefix
1403 != system_lyxrc.print_spool_printerprefix) {
1404 os << "\\print_spool_printerprefix \""
1405 << print_spool_printerprefix << "\"\n";
1407 case RC_PRINTEVENPAGEFLAG:
1408 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1409 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1412 case RC_PRINTODDPAGEFLAG:
1413 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1414 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1417 case RC_PRINTREVERSEFLAG:
1418 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1419 os << "\\print_reverse_flag \"" << print_reverse_flag
1422 case RC_PRINTLANDSCAPEFLAG:
1423 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1424 os << "\\print_landscape_flag \"" << print_landscape_flag
1427 case RC_PRINTPAGERANGEFLAG:
1428 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1429 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1432 case RC_PRINTCOPIESFLAG:
1433 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1434 os << "\\print_copies_flag \"" << print_copies_flag
1437 case RC_PRINTCOLLCOPIESFLAG:
1438 if (print_collcopies_flag
1439 != system_lyxrc.print_collcopies_flag) {
1440 os << "\\print_collcopies_flag \""
1441 << print_collcopies_flag
1444 case RC_PRINTPAPERFLAG:
1445 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1446 os << "\\print_paper_flag \"" << print_paper_flag
1449 case RC_PRINTPAPERDIMENSIONFLAG:
1450 if (print_paper_dimension_flag
1451 != system_lyxrc.print_paper_dimension_flag) {
1452 os << "\\print_paper_dimension_flag \""
1453 << print_paper_dimension_flag << "\"\n";
1455 case RC_PRINTTOPRINTER:
1456 if (print_to_printer != system_lyxrc.print_to_printer) {
1457 os << "\\print_to_printer \"" << print_to_printer
1460 case RC_PRINTTOFILE:
1461 if (print_to_file != system_lyxrc.print_to_file) {
1462 os << "\\print_to_file \"" << print_to_file << "\"\n";
1464 case RC_PRINTFILEEXTENSION:
1465 if (print_file_extension != system_lyxrc.print_file_extension) {
1466 os << "\\print_file_extension \""
1467 << print_file_extension
1472 << "# EXPORT SECTION ####################################\n"
1475 case RC_CUSTOM_EXPORT_COMMAND:
1476 if (custom_export_command
1477 != system_lyxrc.custom_export_command) {
1478 os << "\\custom_export_command \""
1479 << custom_export_command
1482 case RC_CUSTOM_EXPORT_FORMAT:
1483 if (custom_export_format
1484 != system_lyxrc.custom_export_format) {
1485 os << "\\custom_export_format \"" << custom_export_format
1490 << "# TEX SECTION #######################################\n"
1493 case RC_FONT_ENCODING:
1494 if (fontenc != system_lyxrc.fontenc) {
1495 os << "\\font_encoding \"" << fontenc << "\"\n";
1499 << "# FILE SECTION ######################################\n"
1502 case RC_DOCUMENTPATH:
1503 if (document_path != system_lyxrc.document_path) {
1504 os << "\\document_path \"" << document_path << "\"\n";
1507 if (lastfiles != system_lyxrc.lastfiles) {
1508 os << "\\lastfiles \"" << lastfiles << "\"\n";
1510 case RC_NUMLASTFILES:
1511 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1512 os << "\\num_lastfiles " << num_lastfiles << "\n";
1514 case RC_CHECKLASTFILES:
1515 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1516 os << "\\check_lastfiles " << tostr(check_lastfiles)
1519 case RC_TEMPLATEPATH:
1520 if (template_path != system_lyxrc.template_path) {
1521 os << "\\template_path \"" << template_path << "\"\n";
1523 case RC_TEMPDIRPATH:
1524 if (tempdir_path != system_lyxrc.tempdir_path) {
1525 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1528 if (use_tempdir != system_lyxrc.use_tempdir) {
1529 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1531 case RC_ASCII_LINELEN:
1532 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1533 os << "\\ascii_linelen " << ascii_linelen << "\n";
1535 case RC_MAKE_BACKUP:
1536 if (make_backup != system_lyxrc.make_backup) {
1537 os << "\\make_backup " << tostr(make_backup) << "\n";
1539 case RC_BACKUPDIR_PATH:
1540 if (backupdir_path != system_lyxrc.backupdir_path) {
1541 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1545 << "# ASCII EXPORT SECTION ##############################\n"
1548 case RC_ASCIIROFF_COMMAND:
1549 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1550 os << "\\ascii_roff_command \"" << ascii_roff_command
1555 << "# SPELLCHECKER SECTION ##############################\n"
1559 if (use_pspell != system_lyxrc.use_pspell) {
1560 os << "\\use_pspell " << tostr(use_pspell) << "\n";
1563 case RC_SPELL_COMMAND:
1564 if (isp_command != system_lyxrc.isp_command) {
1565 os << "\\spell_command \"" << isp_command << "\"\n";
1567 case RC_ACCEPT_COMPOUND:
1568 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1569 os << "\\accept_compound " << tostr(isp_accept_compound)
1572 case RC_USE_ALT_LANG:
1573 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1574 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1578 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1579 os << "\\alternate_language \"" << isp_alt_lang
1582 case RC_USE_ESC_CHARS:
1583 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1584 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1588 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1589 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1591 case RC_USE_PERS_DICT:
1592 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1593 os << "\\use_personal_dictionary "
1594 << tostr(isp_use_pers_dict)
1598 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1599 os << "\\personal_dictionary \"" << isp_pers_dict
1602 case RC_USE_INP_ENC:
1603 if (isp_use_input_encoding
1604 != system_lyxrc.isp_use_input_encoding) {
1605 os << "\\use_input_encoding "
1606 << tostr(isp_use_input_encoding)
1611 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1614 case RC_RTL_SUPPORT:
1615 if (rtl_support != system_lyxrc.rtl_support) {
1616 os << "\\rtl " << tostr(rtl_support) << "\n";
1618 case RC_LANGUAGE_PACKAGE:
1619 if (language_package != system_lyxrc.language_package) {
1620 os << "\\language_package \"" << language_package
1623 case RC_LANGUAGE_GLOBAL_OPTIONS:
1624 if (language_global_options
1625 != system_lyxrc.language_global_options) {
1626 os << "\\language_global_options \""
1627 << tostr(language_global_options)
1630 case RC_LANGUAGE_USE_BABEL:
1631 if (language_use_babel != system_lyxrc.language_use_babel) {
1632 os << "\\language_use_babel \""
1633 << tostr(language_use_babel)
1636 case RC_LANGUAGE_COMMAND_BEGIN:
1637 if (language_command_begin
1638 != system_lyxrc.language_command_begin) {
1639 os << "\\language_command_begin \""
1640 << language_command_begin
1643 case RC_LANGUAGE_COMMAND_END:
1644 if (language_command_end
1645 != system_lyxrc.language_command_end) {
1646 os << "\\language_command_end \"" << language_command_end
1649 case RC_LANGUAGE_COMMAND_LOCAL:
1650 if (language_command_local
1651 != system_lyxrc.language_command_local) {
1652 os << "\\language_command_local \""
1653 << language_command_local
1656 case RC_LANGUAGE_AUTO_BEGIN:
1657 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1658 os << "\\language_auto_begin "
1659 << tostr(language_auto_begin) << "\n";
1661 case RC_LANGUAGE_AUTO_END:
1662 if (language_auto_end != system_lyxrc.language_auto_end) {
1663 os << "\\language_auto_end "
1664 << tostr(language_auto_end) << "\n";
1666 case RC_MARK_FOREIGN_LANGUAGE:
1667 if (mark_foreign_language
1668 != system_lyxrc.mark_foreign_language) {
1669 os << "\\mark_foreign_language " <<
1670 tostr(mark_foreign_language) << "\n";
1674 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1677 case RC_OVERRIDE_X_DEADKEYS:
1678 if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) {
1679 os << "\\override_x_deadkeys "
1680 << tostr(override_x_deadkeys) << "\n";
1682 case RC_AUTO_NUMBER:
1683 if (auto_number != system_lyxrc.auto_number) {
1684 os << "\\auto_number " << tostr(auto_number) << "\n";
1686 case RC_DEFAULT_LANGUAGE:
1687 if (default_language != system_lyxrc.default_language) {
1688 os << "\\default_language " << default_language << "\n";
1692 << "# FORMATS SECTION ##########################\n"
1696 // Look for deleted formats
1697 for (Formats::const_iterator cit = formats.begin();
1698 cit != formats.end(); ++cit) {
1699 Format const * format =
1700 system_formats.getFormat(cit->name());
1702 format->extension() != cit->extension() ||
1703 format->prettyname() != cit->prettyname() ||
1704 format->shortcut() != cit->shortcut())
1705 os << "\\format \"" << cit->name() << "\" \""
1706 << cit->extension() << "\" \""
1707 << cit->prettyname() << "\" \""
1708 << cit->shortcut() << "\"\n";
1711 // New/modifed formats
1712 for (Formats::const_iterator cit = system_formats.begin();
1713 cit != system_formats.end(); ++cit)
1714 if (!formats.getFormat(cit->name()))
1715 os << "\\format \"" << cit->name()
1716 << "\" \"\" \"\" \"\"\n";
1718 for (Formats::const_iterator cit = formats.begin();
1719 cit != formats.end(); ++cit) {
1720 Format const * format =
1721 system_formats.getFormat(cit->name());
1722 if ((!format || format->viewer() != cit->viewer()) &&
1723 (format || !cit->viewer().empty()))
1724 os << "\\viewer \"" << cit->name() << "\" \""
1725 << cit->viewer() << "\"\n";
1729 << "# CONVERTERS SECTION ##########################\n"
1733 // Look for new converters
1734 for (Converters::const_iterator cit = converters.begin();
1735 cit != converters.end(); ++cit) {
1736 Converter const * converter =
1737 system_converters.getConverter(cit->from,
1740 converter->command != cit->command ||
1741 converter->flags != cit->flags)
1742 os << "\\converter \"" << cit->from << "\" \""
1743 << cit->to << "\" \""
1744 << cit->command << "\" \""
1745 << cit->flags << "\"\n";
1748 // New/modifed converters
1749 for (Converters::const_iterator cit = system_converters.begin();
1750 cit != system_converters.end(); ++cit)
1751 if (!converters.getConverter(cit->from, cit->to))
1752 os << "\\converter \"" << cit->from
1753 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1758 void LyXRC::set_font_norm_type()
1760 if (font_norm == "iso10646-1")
1761 font_norm_type = ISO_10646_1;
1762 else if (font_norm == "iso8859-1")
1763 font_norm_type = ISO_8859_1;
1764 else if (font_norm == "iso8859-3")
1765 font_norm_type = ISO_8859_3;
1766 else if (font_norm == "iso8859-4")
1767 font_norm_type = ISO_8859_4;
1768 else if (font_norm == "iso8859-6.8x")
1769 font_norm_type = ISO_8859_6_8;
1770 else if (font_norm == "iso8859-9")
1771 font_norm_type = ISO_8859_9;
1772 else if (font_norm == "iso8859-15")
1773 font_norm_type = ISO_8859_15;
1775 font_norm_type = OTHER_ENCODING;
1779 string const LyXRC::getDescription(LyXRCTags tag)
1784 case RC_FONT_ENCODING:
1785 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1789 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1792 case RC_PRINT_COMMAND:
1793 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1796 case RC_PRINTEVENPAGEFLAG:
1797 str = _("The option to print only even pages.");
1800 case RC_PRINTODDPAGEFLAG:
1801 str = _("The option to print only odd pages.");
1804 case RC_PRINTPAGERANGEFLAG:
1805 str = _("The option for specifying a comma-separated list of pages to print.");
1808 case RC_PRINTCOPIESFLAG:
1809 str = _("The option for specifying the number of copies to print.");
1812 case RC_PRINTCOLLCOPIESFLAG:
1813 str = _("The option for specifying whether the copies should be collated.");
1816 case RC_PRINTREVERSEFLAG:
1817 str = _("The option to reverse the order of the pages printed.");
1820 case RC_PRINTLANDSCAPEFLAG:
1821 str = _("The option to print out in landscape.");
1824 case RC_PRINTPAPERFLAG:
1825 str = _("The option to specify paper type.");
1828 case RC_PRINTPAPERDIMENSIONFLAG:
1829 str = _("Option to specify the dimensions of the print paper.");
1832 case RC_PRINTTOPRINTER:
1833 str = _("Option to pass to the print program to print on a specific printer.");
1836 case RC_PRINT_ADAPTOUTPUT:
1837 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1840 case RC_PRINTTOFILE:
1841 str = _("Option to pass to the print program to print to a file.");
1844 case RC_PRINTFILEEXTENSION:
1845 str = _("Extension of printer program output file. Usually \".ps\".");
1848 case RC_PRINTEXSTRAOPTIONS:
1849 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1852 case RC_PRINTSPOOL_COMMAND:
1853 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.");
1856 case RC_PRINTSPOOL_PRINTERPREFIX:
1857 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.");
1861 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1864 case RC_SCREEN_ZOOM:
1865 //xgettext:no-c-format
1866 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1869 case RC_SCREEN_FONT_SIZES:
1870 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1873 case RC_SCREEN_FONT_ROMAN:
1874 case RC_SCREEN_FONT_SANS:
1875 case RC_SCREEN_FONT_TYPEWRITER:
1876 str = _("The screen fonts used to display the text while editing.");
1879 case RC_POPUP_BOLD_FONT:
1880 str = _("The bold font in the dialogs.");
1883 case RC_POPUP_NORMAL_FONT:
1884 str = _("The normal font in the dialogs.");
1887 case RC_SCREEN_FONT_ENCODING:
1888 str = _("The encoding for the screen fonts.");
1891 case RC_POPUP_FONT_ENCODING:
1892 str = _("The encoding for the menu/popups fonts.");
1899 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1902 case RC_DOCUMENTPATH:
1903 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1906 case RC_TEMPLATEPATH:
1907 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1910 case RC_TEMPDIRPATH:
1911 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1915 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1919 str = _("The file where the last-files information should be stored.");
1922 case RC_AUTOREGIONDELETE:
1923 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1926 case RC_AUTORESET_OPTIONS:
1927 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1930 case RC_OVERRIDE_X_DEADKEYS:
1931 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.");
1936 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1940 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1944 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1948 case RC_KBMAP_PRIMARY:
1949 case RC_KBMAP_SECONDARY:
1950 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.");
1953 case RC_ASCIIROFF_COMMAND:
1954 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.");
1957 case RC_ASCII_LINELEN:
1958 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1961 case RC_NUMLASTFILES:
1962 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1965 case RC_CHECKLASTFILES:
1966 str = _("Select to check whether the lastfiles still exist.");
1969 case RC_VIEWDVI_PAPEROPTION:
1970 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1973 case RC_DEFAULT_PAPERSIZE:
1974 str = _("Specify the default paper size.");
1980 case RC_ACCEPT_COMPOUND:
1981 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1984 case RC_SPELL_COMMAND:
1985 str = _("What command runs the spell checker?");
1988 case RC_USE_INP_ENC:
1989 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.");
1992 case RC_USE_ALT_LANG:
1994 str = _("Specify an alternate language. The default is to use the language of the document.");
1997 case RC_USE_PERS_DICT:
1999 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2002 case RC_USE_ESC_CHARS:
2004 str = _("Specify additional chars that can be part of a word.");
2007 case RC_SCREEN_FONT_SCALABLE:
2008 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.");
2011 case RC_CHKTEX_COMMAND:
2012 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2015 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2016 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.");
2019 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2020 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2023 case RC_DISPLAY_GRAPHICS:
2024 str = _("Select how LyX will display any graphics.");
2027 case RC_MAKE_BACKUP:
2028 str = _("De-select if you don't want LyX to create backup files.");
2031 case RC_BACKUPDIR_PATH:
2032 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.");
2035 case RC_RTL_SUPPORT:
2036 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2039 case RC_MARK_FOREIGN_LANGUAGE:
2040 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2043 case RC_LANGUAGE_PACKAGE:
2044 str = _("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2047 case RC_LANGUAGE_GLOBAL_OPTIONS:
2048 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2051 case RC_LANGUAGE_USE_BABEL:
2052 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2055 case RC_LANGUAGE_AUTO_BEGIN:
2056 str = _("Select if a language switching command is needed at the beginning of the document.");
2059 case RC_LANGUAGE_AUTO_END:
2060 str = _("Select if a language switching command is needed at the end of the document.");
2063 case RC_LANGUAGE_COMMAND_BEGIN:
2064 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.");
2067 case RC_LANGUAGE_COMMAND_END:
2068 str = _("The latex command for changing back to the language of the document.");
2071 case RC_LANGUAGE_COMMAND_LOCAL:
2072 str = _("The latex command for local changing of the language.");
2075 case RC_DATE_INSERT_FORMAT:
2076 //xgettext:no-c-format
2077 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2080 case RC_SHOW_BANNER:
2081 str = _("De-select if you don't want the startup banner.");
2085 str = _("The wheel movement factor (for mice with wheels or five button mice).");
2097 case RC_DEFAULT_LANGUAGE:
2098 str = _("New documents will be assigned this language.");
2101 case RC_LABEL_INIT_LENGTH:
2102 str = _("Maximum number of words in the initialization string for a new label");
2106 str = _("Shows a typeset preview of things such as math");
2109 case RC_PREVIEW_HASHED_LABELS:
2110 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2113 case RC_PREVIEW_SCALE_FACTOR:
2114 str = _("Scale the preview size to suit.");
2124 // The global instance
2127 // The global copy of the system lyxrc entries (everything except preferences)