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 LyXAction lyxaction;
44 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
48 // when adding something to this array keep it sorted!
49 keyword_item lyxrcTags[] = {
50 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
51 { "\\alternate_language", LyXRC::RC_ALT_LANG },
52 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
53 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
54 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
55 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
56 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
57 { "\\autosave", LyXRC::RC_AUTOSAVE },
58 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
59 { "\\bind", LyXRC::RC_BIND },
60 { "\\bind_file", LyXRC::RC_BINDFILE },
61 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
62 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
63 { "\\converter", LyXRC::RC_CONVERTER },
64 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
65 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
66 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
67 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
68 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
69 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
70 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
71 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
72 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
73 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
74 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
75 { "\\format", LyXRC::RC_FORMAT },
76 { "\\input", LyXRC::RC_INPUT },
77 { "\\kbmap", LyXRC::RC_KBMAP },
78 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
79 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
80 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
81 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
82 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
83 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
84 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
85 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
86 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
87 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
88 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
89 { "\\lastfiles", LyXRC::RC_LASTFILES },
90 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
91 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
92 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
93 { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS },
94 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
95 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
96 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
97 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
98 { "\\preview", LyXRC::RC_PREVIEW },
99 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
100 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
101 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
102 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
103 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
104 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
105 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
106 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
107 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
108 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
109 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
110 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
111 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
112 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
113 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
114 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
115 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
116 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
117 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
118 { "\\printer", LyXRC::RC_PRINTER },
119 { "\\ps_command", LyXRC::RC_PS_COMMAND },
120 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
121 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
122 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
123 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
124 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
125 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
126 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
127 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
128 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
129 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
130 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
131 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
132 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
133 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
134 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
135 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
136 { "\\set_color", LyXRC::RC_SET_COLOR },
137 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
138 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
139 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
140 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
141 { "\\ui_file", LyXRC::RC_UIFILE },
142 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
143 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
144 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
145 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
147 { "\\use_pspell", LyXRC::RC_USE_PSPELL },
149 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
150 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
151 { "\\viewer" ,LyXRC::RC_VIEWER},
152 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
155 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
166 void LyXRC::setDefaults() {
170 // Get printer from the environment. If fail, use default "",
171 // assuming that everything is set up correctly.
172 printer = GetEnv("PRINTER");
173 print_adapt_output = false;
174 print_command = "dvips";
175 print_evenpage_flag = "-B";
176 print_oddpage_flag = "-A";
177 print_pagerange_flag = "-pp";
178 print_copies_flag = "-c";
179 print_collcopies_flag = "-C";
180 print_reverse_flag = "-r";
181 print_landscape_flag = "-t landscape";
182 print_to_printer = "-P";
183 print_to_file = "-o ";
184 print_file_extension = ".ps";
185 print_paper_flag = "-t";
186 print_paper_dimension_flag = "-T";
187 document_path.erase();
188 tempdir_path = "/tmp";
191 view_dvi_paper_option.erase();
192 default_papersize = BufferParams::PAPER_USLETTER;
193 custom_export_format = "ps";
194 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
197 // Because a screen typically is wider than a piece of paper:
200 // Default LaTeX font size:
201 font_sizes[LyXFont::SIZE_TINY] = 5.0;
202 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
203 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
204 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
205 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
206 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
207 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
208 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
209 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
210 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
211 use_scalable_fonts = true;
212 roman_font_name = "-*-times";
213 sans_font_name = "-*-helvetica";
214 typewriter_font_name = "-*-courier";
215 popup_bold_font = "-*-helvetica-bold-r";
216 popup_normal_font = "-*-helvetica-medium-r";
217 font_norm = "iso8859-1";
218 font_norm_type = ISO_8859_1;
219 popup_font_encoding.erase();
220 override_x_deadkeys = true;
222 auto_region_delete = true;
223 auto_reset_options = false;
226 check_lastfiles = true;
228 backupdir_path.erase();
229 display_graphics = "color";
230 // Spellchecker settings:
234 isp_command = "ispell";
235 isp_accept_compound = false;
236 isp_use_input_encoding = false;
237 isp_use_alt_lang = false;
238 isp_use_pers_dict = false;
239 isp_use_esc_chars = false;
243 mark_foreign_language = true;
244 language_auto_begin = true;
245 language_auto_end = true;
246 language_global_options = true;
247 language_use_babel = true;
248 language_package = "\\usepackage{babel}";
249 language_command_begin = "\\selectlanguage{$$lang}";
250 language_command_local = "\\foreignlanguage{$$lang}{";
251 default_language = "english";
255 date_insert_format = "%A, %e %B %Y";
256 cursor_follows_scrollbar = false;
257 dialogs_iconify_with_main = false;
258 label_init_length = 3;
260 preview_hashed_labels = false;
261 preview_scale_factor = 0.9;
263 /// These variables are not stored on disk (perhaps they
264 // should be moved from the LyXRC class).
270 int LyXRC::ReadBindFile(string const & name)
273 string const tmp = i18nLibFileSearch("bind", name, "bind");
274 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
275 int const result = read(tmp);
277 lyxerr << "Error reading bind file: " << tmp << endl;
282 void LyXRC::readBindFileIfNeeded()
285 ReadBindFile(bind_file);
289 int LyXRC::read(string const & filename)
291 LyXLex lexrc(lyxrcTags, lyxrcCount);
292 if (lyxerr.debugging(Debug::PARSER))
293 lexrc.printTable(lyxerr);
295 lexrc.setFile(filename);
296 if (!lexrc.isOK()) return -2;
298 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
300 while (lexrc.isOK()) {
301 // By using two switches we take advantage of the compiler
302 // telling us if we have missed a LyXRCTags element in
303 // the second switch.
304 // Note that this also shows a problem with LyXLex since it
305 // helps us avoid taking advantage of the strictness of the
308 int le = lexrc.lex();
310 case LyXLex::LEX_UNDEF:
311 lexrc.printError("Unknown tag `$$Token'");
313 case LyXLex::LEX_FEOF:
317 switch (static_cast<LyXRCTags>(le)) {
318 case RC_INPUT: // Include file
321 LibFileSearch(string(),
324 lexrc.printError("Error reading "
325 "included file: "+tmp);
329 case RC_BINDFILE: // RVDK_PATCH_5
331 string const tmp(lexrc.getString());
333 // We are already in the
334 // "actually read bind file"
338 // We are still in the "just
339 // remember the name of the
347 ui_file = lexrc.getString();
351 case RC_AUTORESET_OPTIONS:
353 auto_reset_options = lexrc.getBool();
356 case RC_DISPLAY_GRAPHICS:
358 display_graphics = lexrc.getString();
363 use_kbmap = lexrc.getBool();
366 case RC_KBMAP_PRIMARY:
368 string const kmap(lexrc.getString());
371 } else if (!LibFileSearch("kbd", kmap,
373 primary_kbmap = kmap;
375 lexrc.printError("LyX: Keymap `$$Token' not found");
379 case RC_KBMAP_SECONDARY:
381 string const kmap(lexrc.getString());
384 } else if (!LibFileSearch("kbd", kmap,
386 secondary_kbmap = kmap;
388 lexrc.printError("LyX: Keymap `$$Token' not found");
392 case RC_FONT_ENCODING:
394 fontenc = lexrc.getString();
399 printer = lexrc.getString();
402 case RC_PRINT_COMMAND:
404 print_command = lexrc.getString();
407 case RC_PRINTEVENPAGEFLAG:
409 print_evenpage_flag = lexrc.getString();
412 case RC_PRINTODDPAGEFLAG:
414 print_oddpage_flag = lexrc.getString();
417 case RC_PRINTPAGERANGEFLAG:
419 print_pagerange_flag = lexrc.getString();
422 case RC_PRINTCOPIESFLAG:
424 print_copies_flag = lexrc.getString();
427 case RC_PRINTCOLLCOPIESFLAG:
429 print_collcopies_flag = lexrc.getString();
432 case RC_PRINTREVERSEFLAG:
434 print_reverse_flag = lexrc.getString();
437 case RC_PRINTLANDSCAPEFLAG:
439 print_landscape_flag = lexrc.getString();
442 case RC_PRINTTOPRINTER:
444 print_to_printer = lexrc.getString();
447 case RC_PRINT_ADAPTOUTPUT:
449 print_adapt_output = lexrc.getBool();
454 print_to_file = lexrc.getString();
457 case RC_PRINTFILEEXTENSION:
459 print_file_extension = lexrc.getString();
462 case RC_PRINTEXSTRAOPTIONS:
464 print_extra_options = lexrc.getString();
467 case RC_PRINTSPOOL_COMMAND:
469 print_spool_command = lexrc.getString();
472 case RC_PRINTSPOOL_PRINTERPREFIX:
474 print_spool_printerprefix = lexrc.getString();
477 case RC_PRINTPAPERDIMENSIONFLAG:
479 print_paper_dimension_flag = lexrc.getString();
482 case RC_PRINTPAPERFLAG:
484 print_paper_flag = lexrc.getString();
487 case RC_CUSTOM_EXPORT_COMMAND:
489 custom_export_command = lexrc.getString();
492 case RC_CUSTOM_EXPORT_FORMAT:
494 custom_export_format = lexrc.getString();
497 case RC_DEFAULT_PAPERSIZE:
500 ascii_lowercase(lexrc.getString());
501 if (size == "usletter")
503 BufferParams::PAPER_USLETTER;
504 else if (size == "legal")
506 BufferParams::PAPER_LEGALPAPER;
507 else if (size == "executive")
509 BufferParams::PAPER_EXECUTIVEPAPER;
510 else if (size == "a3")
512 BufferParams::PAPER_A3PAPER;
513 else if (size == "a4")
515 BufferParams::PAPER_A4PAPER;
516 else if (size == "a5")
518 BufferParams::PAPER_A5PAPER;
519 else if (size == "b5")
521 BufferParams::PAPER_B5PAPER;
525 case RC_VIEWDVI_PAPEROPTION:
527 view_dvi_paper_option = lexrc.getString();
529 view_dvi_paper_option.erase();
534 ps_command = lexrc.getString();
537 case RC_CHKTEX_COMMAND:
539 chktex_command = lexrc.getString();
544 dpi = lexrc.getInteger();
549 zoom = lexrc.getInteger();
554 wheel_jump = lexrc.getInteger();
557 case RC_SCREEN_FONT_SIZES:
559 font_sizes[LyXFont::SIZE_TINY] =
562 font_sizes[LyXFont::SIZE_SCRIPT] =
565 font_sizes[LyXFont::SIZE_FOOTNOTE] =
568 font_sizes[LyXFont::SIZE_SMALL] =
571 font_sizes[LyXFont::SIZE_NORMAL] =
574 font_sizes[LyXFont::SIZE_LARGE] =
577 font_sizes[LyXFont::SIZE_LARGER] =
580 font_sizes[LyXFont::SIZE_LARGEST] =
583 font_sizes[LyXFont::SIZE_HUGE] =
586 font_sizes[LyXFont::SIZE_HUGER] =
590 case RC_SCREEN_FONT_SCALABLE:
592 use_scalable_fonts = lexrc.getBool();
597 autosave = lexrc.getInteger();
600 case RC_DOCUMENTPATH:
602 document_path = ExpandPath(lexrc.getString());
606 case RC_TEMPLATEPATH:
608 template_path = ExpandPath(lexrc.getString());
613 tempdir_path = ExpandPath(lexrc.getString());
618 use_tempdir = lexrc.getBool();
623 lastfiles = ExpandPath(lexrc.getString());
626 case RC_NUMLASTFILES:
628 num_lastfiles = lexrc.getInteger();
631 case RC_CHECKLASTFILES:
633 check_lastfiles = lexrc.getBool();
636 case RC_SCREEN_FONT_ROMAN:
638 roman_font_name = lexrc.getString();
641 case RC_SCREEN_FONT_SANS:
643 sans_font_name = lexrc.getString();
646 case RC_SCREEN_FONT_TYPEWRITER:
648 typewriter_font_name = lexrc.getString();
651 case RC_SCREEN_FONT_ENCODING:
653 font_norm = lexrc.getString();
654 set_font_norm_type();
658 case RC_POPUP_BOLD_FONT:
660 popup_bold_font = lexrc.getString();
663 case RC_POPUP_NORMAL_FONT:
665 popup_normal_font = lexrc.getString();
668 case RC_POPUP_FONT_ENCODING:
670 popup_font_encoding = lexrc.getString();
675 string lyx_name, x11_name;
678 lyx_name = lexrc.getString();
680 lexrc.printError("Missing color tag.");
685 x11_name = lexrc.getString();
687 lexrc.printError("Missing color name for color : `$$Token'");
691 if (!lcolor.setColor(lyx_name, x11_name))
692 lyxerr << "Bad lyxrc set_color for "
697 case RC_AUTOREGIONDELETE:
698 // Auto region delete defaults to true
700 auto_region_delete = lexrc.getBool();
705 // we should not do an explicit binding before
706 // loading a bind file. So, in this case, load
707 // the default bind file.
708 readBindFileIfNeeded();
710 // !!!chb, dynamic key binding...
712 string::size_type res = 0;
716 seq = lexrc.getString();
718 lexrc.printError("RC_BIND: Missing key sequence");
722 if (lexrc.next(true)) {
723 cmd = lexrc.getString();
725 lexrc.printError("RC_BIND: missing command");
729 if ((action = lyxaction.LookupFunc(cmd))>= 0) {
730 if (lyxerr.debugging(Debug::LYXRC)) {
731 lyxerr << "RC_BIND: Sequence `"
732 << seq << "' Command `"
733 << cmd << "' Action `"
734 << action << '\'' << endl;
736 res = toplevel_keymap->bind(seq, kb_action(action));
737 if (res != string::npos
738 && lyxerr.debugging(Debug::LYXRC)) {
741 "Invalid key sequence `"
744 } else {// cmd is the last token read.
746 "Unknown LyX function `$$Token'");
750 case RC_OVERRIDE_X_DEADKEYS:
752 override_x_deadkeys = lexrc.getBool();
757 lyxpipes = ExpandPath(lexrc.getString());
760 case RC_CURSOR_FOLLOWS_SCROLLBAR:
762 cursor_follows_scrollbar = lexrc.getBool();
765 case RC_DIALOGS_ICONIFY_WITH_MAIN:
767 dialogs_iconify_with_main = lexrc.getBool();
770 case RC_ASCIIROFF_COMMAND:
772 ascii_roff_command = lexrc.getString();
774 case RC_ASCII_LINELEN:
776 ascii_linelen = lexrc.getInteger();
778 // Spellchecker settings:
782 use_pspell = lexrc.getBool();
785 case RC_SPELL_COMMAND:
787 isp_command = lexrc.getString();
789 case RC_ACCEPT_COMPOUND:
791 isp_accept_compound = lexrc.getBool();
795 isp_use_input_encoding = lexrc.getBool();
797 case RC_USE_ALT_LANG:
799 isp_use_alt_lang = lexrc.getBool();
801 case RC_USE_PERS_DICT:
803 isp_use_pers_dict = lexrc.getBool();
805 case RC_USE_ESC_CHARS:
807 isp_use_esc_chars = lexrc.getBool();
811 isp_alt_lang = lexrc.getString();
815 isp_pers_dict = lexrc.getString();
819 isp_esc_chars = lexrc.getString();
823 make_backup = lexrc.getBool();
825 case RC_BACKUPDIR_PATH:
827 backupdir_path = ExpandPath(lexrc.getString());
829 case RC_DATE_INSERT_FORMAT:
831 date_insert_format = lexrc.getString();
833 case RC_LANGUAGE_PACKAGE:
835 language_package = lexrc.getString();
837 case RC_LANGUAGE_AUTO_BEGIN:
839 language_auto_begin = lexrc.getBool();
841 case RC_LANGUAGE_AUTO_END:
843 language_auto_end = lexrc.getBool();
845 case RC_LANGUAGE_GLOBAL_OPTIONS:
847 language_global_options = lexrc.getBool();
849 case RC_LANGUAGE_USE_BABEL:
851 language_use_babel = lexrc.getBool();
853 case RC_LANGUAGE_COMMAND_BEGIN:
855 language_command_begin = lexrc.getString();
857 case RC_LANGUAGE_COMMAND_END:
859 language_command_end = lexrc.getString();
861 case RC_LANGUAGE_COMMAND_LOCAL:
863 language_command_local = lexrc.getString();
867 rtl_support = lexrc.getBool();
871 auto_number = lexrc.getBool();
873 case RC_MARK_FOREIGN_LANGUAGE:
875 mark_foreign_language = lexrc.getBool();
879 string from, to, command, flags;
881 from = lexrc.getString();
883 to = lexrc.getString();
885 command = lexrc.getString();
887 flags = lexrc.getString();
888 if (command.empty() || command == "none")
889 converters.erase(from, to);
891 converters.add(from, to, command, flags);
895 string format, command;
897 format = lexrc.getString();
899 command = lexrc.getString();
900 formats.setViewer(format, command);
904 string format, extension, prettyname, shortcut;
906 format = lexrc.getString();
908 extension = lexrc.getString();
910 prettyname = lexrc.getString();
912 shortcut = lexrc.getString();
913 if (prettyname.empty()) {
914 if (converters.formatIsUsed(format))
915 lyxerr << "Can't delete format "
918 formats.erase(format);
921 formats.add(format, extension, prettyname,
925 case RC_DEFAULT_LANGUAGE:
927 default_language = lexrc.getString();
930 case RC_LABEL_INIT_LENGTH:
932 label_init_length = lexrc.getInteger();
937 show_banner = lexrc.getBool();
942 preview = lexrc.getBool();
945 case RC_PREVIEW_HASHED_LABELS:
947 preview_hashed_labels = lexrc.getBool();
950 case RC_PREVIEW_SCALE_FACTOR:
952 preview_scale_factor = lexrc.getFloat();
955 case RC_LAST: break; // this is just a dummy
959 /// Update converters data-structures
960 converters.update(formats);
961 converters.buildGraph();
967 void LyXRC::write(string const & filename) const
969 ofstream ofs(filename.c_str());
975 void LyXRC::print() const
977 if (lyxerr.debugging())
984 void LyXRC::output(ostream & os) const
986 os << "### This file is part of\n"
987 << "### ========================================================\n"
988 << "### LyX, The Document Processor\n"
990 << "### Copyright 1995 Matthias Ettrich\n"
991 << "### Copyright 1995-2001 The LyX Team.\n"
993 << "### ========================================================\n"
995 << "# This file is written by LyX, if you want to make your own\n"
996 << "# modifications you should do them from inside LyX and save\n"
999 // Why the switch you might ask. It is a trick to ensure that all
1000 // the elements in the LyXRCTags enum is handled. As you can see
1001 // there are no breaks at all. So it is just a huge fall-through.
1002 // The nice thing is that we will get a warning from the compiler
1003 // if we forget an element.
1004 LyXRCTags tag = RC_LAST;
1008 // input/include files are not done here
1010 // bindings is not written to the preferences file.
1012 if (bind_file != system_lyxrc.bind_file) {
1013 os << "\\bind_file " << bind_file << "\n";
1019 << "# MISC SECTION ######################################\n"
1022 // bind files are not done here.
1024 if (ui_file != system_lyxrc.ui_file) {
1025 os << "\\ui_file \"" << ui_file << "\"\n";
1027 case RC_AUTOREGIONDELETE:
1028 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1029 os << "# Set to false to inhibit automatic replacement of\n"
1030 << "# the current selection.\n"
1031 << "\\auto_region_delete " << tostr(auto_region_delete)
1034 case RC_AUTORESET_OPTIONS:
1035 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1036 os << "# Set to false to inhibit automatic reset of\n"
1037 << "# the class options to defaults on class change.\n"
1038 << "\\auto_reset_options " << tostr(auto_reset_options)
1042 if (autosave != system_lyxrc.autosave) {
1043 os << "# The time interval between auto-saves in seconds.\n"
1044 << "\\autosave " << autosave << "\n";
1046 case RC_DISPLAY_GRAPHICS:
1047 if (display_graphics != system_lyxrc.display_graphics) {
1048 os << "# Display graphics within LyX\n"
1049 << "# no|mono|gray|color\n"
1050 << "\\display_graphics " << display_graphics
1054 case RC_VIEWDVI_PAPEROPTION:
1055 if (view_dvi_paper_option
1056 != system_lyxrc.view_dvi_paper_option) {
1057 os << "# Options used to specify paper size to the\n"
1058 << "# view_dvi_command (e.g. -paper)\n"
1059 << "\\view_dvi_paper_option \""
1060 << view_dvi_paper_option << "\"\n";
1062 case RC_DEFAULT_PAPERSIZE:
1063 if (default_papersize != system_lyxrc.default_papersize) {
1064 os << "# The default papersize to use.\n"
1065 << "\\default_papersize \"";
1066 switch (default_papersize) {
1067 case BufferParams::PAPER_USLETTER:
1068 os << "usletter"; break;
1069 case BufferParams::PAPER_LEGALPAPER:
1070 os << "legal"; break;
1071 case BufferParams::PAPER_EXECUTIVEPAPER:
1072 os << "executive"; break;
1073 case BufferParams::PAPER_A3PAPER:
1075 case BufferParams::PAPER_A4PAPER:
1077 case BufferParams::PAPER_A5PAPER:
1079 case BufferParams::PAPER_B5PAPER:
1081 case BufferParams::PAPER_DEFAULT: break;
1086 if (ps_command != system_lyxrc.ps_command) {
1087 os << "# Program used for interpreting postscript.\n"
1088 << "\\ps_command \"" << ps_command << "\"\n";
1090 case RC_CHKTEX_COMMAND:
1091 if (chktex_command != system_lyxrc.chktex_command) {
1092 os << "\\chktex_command \"" << chktex_command << "\"\n";
1095 if (use_kbmap != system_lyxrc.use_kbmap) {
1096 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1098 case RC_KBMAP_PRIMARY:
1099 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1100 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1102 case RC_KBMAP_SECONDARY:
1103 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1104 os << "\\kbmap_secondary \"" << secondary_kbmap
1108 if (lyxpipes != system_lyxrc.lyxpipes) {
1109 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1111 case RC_DATE_INSERT_FORMAT:
1112 if (date_insert_format != system_lyxrc.date_insert_format) {
1113 os << "\\date_insert_format \"" << date_insert_format
1116 case RC_LABEL_INIT_LENGTH:
1117 if (label_init_length != system_lyxrc.label_init_length) {
1118 os << "\\label_init_length " << label_init_length
1122 case RC_SHOW_BANNER:
1123 if (show_banner != system_lyxrc.show_banner) {
1124 os << "\\show_banner " << tostr(show_banner) << "\n";
1128 if (preview != system_lyxrc.preview) {
1129 os << "\\preview " << tostr(preview) << "\n";
1132 case RC_PREVIEW_HASHED_LABELS:
1133 if (preview_hashed_labels !=
1134 system_lyxrc.preview_hashed_labels) {
1135 os << "\\preview_hashed_labels "
1136 << tostr(preview_hashed_labels) << "\n";
1139 case RC_PREVIEW_SCALE_FACTOR:
1140 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1141 os << "\\preview_scale_factor "
1142 << preview_scale_factor << "\n";
1146 << "# SCREEN & FONTS SECTION ############################\n"
1149 case RC_POPUP_NORMAL_FONT:
1150 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1151 os << "\\popup_normal_font \"" << popup_normal_font
1154 case RC_POPUP_BOLD_FONT:
1155 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1156 os << "\\popup_bold_font \"" << popup_bold_font
1159 case RC_POPUP_FONT_ENCODING:
1160 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1161 os << "\\popup_font_encoding \"" << popup_font_encoding
1165 if (dpi != system_lyxrc.dpi) {
1166 os << "\\screen_dpi " << dpi << "\n";
1168 case RC_SCREEN_ZOOM:
1169 if (zoom != system_lyxrc.zoom) {
1170 os << "\\screen_zoom " << zoom << "\n";
1173 if (wheel_jump != system_lyxrc.wheel_jump) {
1174 os << "\\wheel_jump " << wheel_jump << "\n";
1176 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1177 if (cursor_follows_scrollbar
1178 != system_lyxrc.cursor_follows_scrollbar) {
1179 os << "\\cursor_follows_scrollbar "
1180 << tostr(cursor_follows_scrollbar) << "\n";
1182 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1183 if (dialogs_iconify_with_main
1184 != system_lyxrc.dialogs_iconify_with_main) {
1185 os << "\\dialogs_iconify_with_main "
1186 << tostr(dialogs_iconify_with_main) << "\n";
1188 case RC_SCREEN_FONT_ROMAN:
1189 if (roman_font_name != system_lyxrc.roman_font_name) {
1190 os << "\\screen_font_roman \"" << roman_font_name
1193 case RC_SCREEN_FONT_SANS:
1194 if (sans_font_name != system_lyxrc.sans_font_name) {
1195 os << "\\screen_font_sans \"" << sans_font_name
1198 case RC_SCREEN_FONT_TYPEWRITER:
1199 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1200 os << "\\screen_font_typewriter \""
1201 << typewriter_font_name << "\"\n";
1203 case RC_SCREEN_FONT_SCALABLE:
1204 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1205 os << "\\screen_font_scalable "
1206 << tostr(use_scalable_fonts)
1209 case RC_SCREEN_FONT_ENCODING:
1210 if (font_norm != system_lyxrc.font_norm) {
1211 os << "\\screen_font_encoding \"" << font_norm
1214 case RC_SCREEN_FONT_SIZES:
1215 if (font_sizes[LyXFont::SIZE_TINY]
1216 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1217 font_sizes[LyXFont::SIZE_SCRIPT]
1218 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1219 font_sizes[LyXFont::SIZE_FOOTNOTE]
1220 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1221 font_sizes[LyXFont::SIZE_SMALL]
1222 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1223 font_sizes[LyXFont::SIZE_NORMAL]
1224 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1225 font_sizes[LyXFont::SIZE_LARGE]
1226 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1227 font_sizes[LyXFont::SIZE_LARGER]
1228 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1229 font_sizes[LyXFont::SIZE_LARGEST]
1230 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1231 font_sizes[LyXFont::SIZE_HUGE]
1232 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1233 font_sizes[LyXFont::SIZE_HUGER]
1234 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1235 os.setf(ios::fixed);
1237 os << "\\screen_font_sizes"
1238 << " " << font_sizes[LyXFont::SIZE_TINY]
1239 << " " << font_sizes[LyXFont::SIZE_SCRIPT]
1240 << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]
1241 << " " << font_sizes[LyXFont::SIZE_SMALL]
1242 << " " << font_sizes[LyXFont::SIZE_NORMAL]
1243 << " " << font_sizes[LyXFont::SIZE_LARGE]
1244 << " " << font_sizes[LyXFont::SIZE_LARGER]
1245 << " " << font_sizes[LyXFont::SIZE_LARGEST]
1246 << " " << font_sizes[LyXFont::SIZE_HUGE]
1247 << " " << font_sizes[LyXFont::SIZE_HUGER]
1252 << "# COLOR SECTION ###################################\n"
1256 for (int i = 0; i < LColor::ignore; ++i) {
1257 LColor::color lc = static_cast<LColor::color>(i);
1259 string const col(lcolor.getX11Name(lc));
1260 if (col != system_lcolor.getX11Name(lc)) {
1261 os << "\\set_color \""
1262 << lcolor.getLyXName(lc) << "\" \""
1268 << "# PRINTER SECTION ###################################\n"
1272 if (printer != system_lyxrc.printer) {
1273 os << "\\printer \"" << printer << "\"\n";
1275 case RC_PRINT_ADAPTOUTPUT:
1276 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1277 os << "\\print_adapt_output "
1278 << tostr(print_adapt_output)
1281 case RC_PRINT_COMMAND:
1282 if (print_command != system_lyxrc.print_command) {
1283 os << "\\print_command \"" << print_command << "\"\n";
1285 case RC_PRINTEXSTRAOPTIONS:
1286 if (print_extra_options != system_lyxrc.print_extra_options) {
1287 os << "\\print_extra_options \"" << print_extra_options
1290 case RC_PRINTSPOOL_COMMAND:
1291 if (print_spool_command != system_lyxrc.print_spool_command) {
1292 os << "\\print_spool_command \"" << print_spool_command
1295 case RC_PRINTSPOOL_PRINTERPREFIX:
1296 if (print_spool_printerprefix
1297 != system_lyxrc.print_spool_printerprefix) {
1298 os << "\\print_spool_printerprefix \""
1299 << print_spool_printerprefix << "\"\n";
1301 case RC_PRINTEVENPAGEFLAG:
1302 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1303 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1306 case RC_PRINTODDPAGEFLAG:
1307 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1308 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1311 case RC_PRINTREVERSEFLAG:
1312 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1313 os << "\\print_reverse_flag \"" << print_reverse_flag
1316 case RC_PRINTLANDSCAPEFLAG:
1317 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1318 os << "\\print_landscape_flag \"" << print_landscape_flag
1321 case RC_PRINTPAGERANGEFLAG:
1322 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1323 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1326 case RC_PRINTCOPIESFLAG:
1327 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1328 os << "\\print_copies_flag \"" << print_copies_flag
1331 case RC_PRINTCOLLCOPIESFLAG:
1332 if (print_collcopies_flag
1333 != system_lyxrc.print_collcopies_flag) {
1334 os << "\\print_collcopies_flag \""
1335 << print_collcopies_flag
1338 case RC_PRINTPAPERFLAG:
1339 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1340 os << "\\print_paper_flag \"" << print_paper_flag
1343 case RC_PRINTPAPERDIMENSIONFLAG:
1344 if (print_paper_dimension_flag
1345 != system_lyxrc.print_paper_dimension_flag) {
1346 os << "\\print_paper_dimension_flag \""
1347 << print_paper_dimension_flag << "\"\n";
1349 case RC_PRINTTOPRINTER:
1350 if (print_to_printer != system_lyxrc.print_to_printer) {
1351 os << "\\print_to_printer \"" << print_to_printer
1354 case RC_PRINTTOFILE:
1355 if (print_to_file != system_lyxrc.print_to_file) {
1356 os << "\\print_to_file \"" << print_to_file << "\"\n";
1358 case RC_PRINTFILEEXTENSION:
1359 if (print_file_extension != system_lyxrc.print_file_extension) {
1360 os << "\\print_file_extension \""
1361 << print_file_extension
1366 << "# EXPORT SECTION ####################################\n"
1369 case RC_CUSTOM_EXPORT_COMMAND:
1370 if (custom_export_command
1371 != system_lyxrc.custom_export_command) {
1372 os << "\\custom_export_command \""
1373 << custom_export_command
1376 case RC_CUSTOM_EXPORT_FORMAT:
1377 if (custom_export_format
1378 != system_lyxrc.custom_export_format) {
1379 os << "\\custom_export_format \"" << custom_export_format
1384 << "# TEX SECTION #######################################\n"
1387 case RC_FONT_ENCODING:
1388 if (fontenc != system_lyxrc.fontenc) {
1389 os << "\\font_encoding \"" << fontenc << "\"\n";
1393 << "# FILE SECTION ######################################\n"
1396 case RC_DOCUMENTPATH:
1397 if (document_path != system_lyxrc.document_path) {
1398 os << "\\document_path \"" << document_path << "\"\n";
1401 if (lastfiles != system_lyxrc.lastfiles) {
1402 os << "\\lastfiles \"" << lastfiles << "\"\n";
1404 case RC_NUMLASTFILES:
1405 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1406 os << "\\num_lastfiles " << num_lastfiles << "\n";
1408 case RC_CHECKLASTFILES:
1409 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1410 os << "\\check_lastfiles " << tostr(check_lastfiles)
1413 case RC_TEMPLATEPATH:
1414 if (template_path != system_lyxrc.template_path) {
1415 os << "\\template_path \"" << template_path << "\"\n";
1417 case RC_TEMPDIRPATH:
1418 if (tempdir_path != system_lyxrc.tempdir_path) {
1419 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1422 if (use_tempdir != system_lyxrc.use_tempdir) {
1423 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1425 case RC_ASCII_LINELEN:
1426 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1427 os << "\\ascii_linelen " << ascii_linelen << "\n";
1429 case RC_MAKE_BACKUP:
1430 if (make_backup != system_lyxrc.make_backup) {
1431 os << "\\make_backup " << tostr(make_backup) << "\n";
1433 case RC_BACKUPDIR_PATH:
1434 if (backupdir_path != system_lyxrc.backupdir_path) {
1435 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1439 << "# ASCII EXPORT SECTION ##############################\n"
1442 case RC_ASCIIROFF_COMMAND:
1443 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1444 os << "\\ascii_roff_command \"" << ascii_roff_command
1449 << "# SPELLCHECKER SECTION ##############################\n"
1453 if (use_pspell != system_lyxrc.use_pspell) {
1454 os << "\\use_pspell " << tostr(use_pspell) << "\n";
1457 case RC_SPELL_COMMAND:
1458 if (isp_command != system_lyxrc.isp_command) {
1459 os << "\\spell_command \"" << isp_command << "\"\n";
1461 case RC_ACCEPT_COMPOUND:
1462 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1463 os << "\\accept_compound " << tostr(isp_accept_compound)
1466 case RC_USE_ALT_LANG:
1467 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1468 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1472 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1473 os << "\\alternate_language \"" << isp_alt_lang
1476 case RC_USE_ESC_CHARS:
1477 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1478 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1482 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1483 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1485 case RC_USE_PERS_DICT:
1486 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1487 os << "\\use_personal_dictionary "
1488 << tostr(isp_use_pers_dict)
1492 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1493 os << "\\personal_dictionary \"" << isp_pers_dict
1496 case RC_USE_INP_ENC:
1497 if (isp_use_input_encoding
1498 != system_lyxrc.isp_use_input_encoding) {
1499 os << "\\use_input_encoding "
1500 << tostr(isp_use_input_encoding)
1505 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1508 case RC_RTL_SUPPORT:
1509 if (rtl_support != system_lyxrc.rtl_support) {
1510 os << "\\rtl " << tostr(rtl_support) << "\n";
1512 case RC_LANGUAGE_PACKAGE:
1513 if (language_package != system_lyxrc.language_package) {
1514 os << "\\language_package \"" << language_package
1517 case RC_LANGUAGE_GLOBAL_OPTIONS:
1518 if (language_global_options
1519 != system_lyxrc.language_global_options) {
1520 os << "\\language_global_options \""
1521 << tostr(language_global_options)
1524 case RC_LANGUAGE_USE_BABEL:
1525 if (language_use_babel != system_lyxrc.language_use_babel) {
1526 os << "\\language_use_babel \""
1527 << tostr(language_use_babel)
1530 case RC_LANGUAGE_COMMAND_BEGIN:
1531 if (language_command_begin
1532 != system_lyxrc.language_command_begin) {
1533 os << "\\language_command_begin \""
1534 << language_command_begin
1537 case RC_LANGUAGE_COMMAND_END:
1538 if (language_command_end
1539 != system_lyxrc.language_command_end) {
1540 os << "\\language_command_end \"" << language_command_end
1543 case RC_LANGUAGE_COMMAND_LOCAL:
1544 if (language_command_local
1545 != system_lyxrc.language_command_local) {
1546 os << "\\language_command_local \""
1547 << language_command_local
1550 case RC_LANGUAGE_AUTO_BEGIN:
1551 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1552 os << "\\language_auto_begin "
1553 << tostr(language_auto_begin) << "\n";
1555 case RC_LANGUAGE_AUTO_END:
1556 if (language_auto_end != system_lyxrc.language_auto_end) {
1557 os << "\\language_auto_end "
1558 << tostr(language_auto_end) << "\n";
1560 case RC_MARK_FOREIGN_LANGUAGE:
1561 if (mark_foreign_language
1562 != system_lyxrc.mark_foreign_language) {
1563 os << "\\mark_foreign_language " <<
1564 tostr(mark_foreign_language) << "\n";
1568 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1571 case RC_OVERRIDE_X_DEADKEYS:
1572 if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) {
1573 os << "\\override_x_deadkeys "
1574 << tostr(override_x_deadkeys) << "\n";
1576 case RC_AUTO_NUMBER:
1577 if (auto_number != system_lyxrc.auto_number) {
1578 os << "\\auto_number " << tostr(auto_number) << "\n";
1580 case RC_DEFAULT_LANGUAGE:
1581 if (default_language != system_lyxrc.default_language) {
1582 os << "\\default_language " << default_language << "\n";
1586 << "# FORMATS SECTION ##########################\n"
1590 // Look for deleted formats
1591 for (Formats::const_iterator cit = formats.begin();
1592 cit != formats.end(); ++cit) {
1593 Format const * format =
1594 system_formats.getFormat(cit->name());
1596 format->extension() != cit->extension() ||
1597 format->prettyname() != cit->prettyname() ||
1598 format->shortcut() != cit->shortcut())
1599 os << "\\format \"" << cit->name() << "\" \""
1600 << cit->extension() << "\" \""
1601 << cit->prettyname() << "\" \""
1602 << cit->shortcut() << "\"\n";
1605 // New/modifed formats
1606 for (Formats::const_iterator cit = system_formats.begin();
1607 cit != system_formats.end(); ++cit)
1608 if (!formats.getFormat(cit->name()))
1609 os << "\\format \"" << cit->name()
1610 << "\" \"\" \"\" \"\"\n";
1612 for (Formats::const_iterator cit = formats.begin();
1613 cit != formats.end(); ++cit) {
1614 Format const * format =
1615 system_formats.getFormat(cit->name());
1616 if ((!format || format->viewer() != cit->viewer()) &&
1617 (format || !cit->viewer().empty()))
1618 os << "\\viewer \"" << cit->name() << "\" \""
1619 << cit->viewer() << "\"\n";
1623 << "# CONVERTERS SECTION ##########################\n"
1627 // Look for new converters
1628 for (Converters::const_iterator cit = converters.begin();
1629 cit != converters.end(); ++cit) {
1630 Converter const * converter =
1631 system_converters.getConverter(cit->from,
1634 converter->command != cit->command ||
1635 converter->flags != cit->flags)
1636 os << "\\converter \"" << cit->from << "\" \""
1637 << cit->to << "\" \""
1638 << cit->command << "\" \""
1639 << cit->flags << "\"\n";
1642 // New/modifed converters
1643 for (Converters::const_iterator cit = system_converters.begin();
1644 cit != system_converters.end(); ++cit)
1645 if (!converters.getConverter(cit->from, cit->to))
1646 os << "\\converter \"" << cit->from
1647 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1652 void LyXRC::set_font_norm_type()
1654 if (font_norm == "iso10646-1")
1655 font_norm_type = ISO_10646_1;
1656 else if (font_norm == "iso8859-1")
1657 font_norm_type = ISO_8859_1;
1658 else if (font_norm == "iso8859-3")
1659 font_norm_type = ISO_8859_3;
1660 else if (font_norm == "iso8859-4")
1661 font_norm_type = ISO_8859_4;
1662 else if (font_norm == "iso8859-6.8x")
1663 font_norm_type = ISO_8859_6_8;
1664 else if (font_norm == "iso8859-9")
1665 font_norm_type = ISO_8859_9;
1666 else if (font_norm == "iso8859-15")
1667 font_norm_type = ISO_8859_15;
1669 font_norm_type = OTHER_ENCODING;
1673 string const LyXRC::getDescription(LyXRCTags tag)
1678 case RC_FONT_ENCODING:
1679 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1683 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1686 case RC_PRINT_COMMAND:
1687 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1690 case RC_PRINTEVENPAGEFLAG:
1691 str = _("The option to print only even pages.");
1694 case RC_PRINTODDPAGEFLAG:
1695 str = _("The option to print only odd pages.");
1698 case RC_PRINTPAGERANGEFLAG:
1699 str = _("The option for specifying a comma-separated list of pages to print.");
1702 case RC_PRINTCOPIESFLAG:
1703 str = _("The option for specifying the number of copies to print.");
1706 case RC_PRINTCOLLCOPIESFLAG:
1707 str = _("The option for specifying whether the copies should be collated.");
1710 case RC_PRINTREVERSEFLAG:
1711 str = _("The option to reverse the order of the pages printed.");
1714 case RC_PRINTLANDSCAPEFLAG:
1715 str = _("The option to print out in landscape.");
1718 case RC_PRINTPAPERFLAG:
1719 str = _("The option to specify paper type.");
1722 case RC_PRINTPAPERDIMENSIONFLAG:
1723 str = _("Option to specify the dimensions of the print paper.");
1726 case RC_PRINTTOPRINTER:
1727 str = _("Option to pass to the print program to print on a specific printer.");
1730 case RC_PRINT_ADAPTOUTPUT:
1731 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1734 case RC_PRINTTOFILE:
1735 str = _("Option to pass to the print program to print to a file.");
1738 case RC_PRINTFILEEXTENSION:
1739 str = _("Extension of printer program output file. Usually \".ps\".");
1742 case RC_PRINTEXSTRAOPTIONS:
1743 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1746 case RC_PRINTSPOOL_COMMAND:
1747 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.");
1750 case RC_PRINTSPOOL_PRINTERPREFIX:
1751 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.");
1755 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1758 case RC_SCREEN_ZOOM:
1759 //xgettext:no-c-format
1760 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1763 case RC_SCREEN_FONT_SIZES:
1764 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1767 case RC_SCREEN_FONT_ROMAN:
1768 case RC_SCREEN_FONT_SANS:
1769 case RC_SCREEN_FONT_TYPEWRITER:
1770 str = _("The screen fonts used to display the text while editing.");
1773 case RC_POPUP_BOLD_FONT:
1774 str = _("The bold font in the dialogs.");
1777 case RC_POPUP_NORMAL_FONT:
1778 str = _("The normal font in the dialogs.");
1781 case RC_SCREEN_FONT_ENCODING:
1782 str = _("The encoding for the screen fonts.");
1785 case RC_POPUP_FONT_ENCODING:
1786 str = _("The encoding for the menu/popups fonts.");
1793 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1796 case RC_DOCUMENTPATH:
1797 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1800 case RC_TEMPLATEPATH:
1801 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1804 case RC_TEMPDIRPATH:
1805 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1809 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1813 str = _("The file where the last-files information should be stored.");
1816 case RC_AUTOREGIONDELETE:
1817 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1820 case RC_AUTORESET_OPTIONS:
1821 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1824 case RC_OVERRIDE_X_DEADKEYS:
1825 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.");
1830 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1834 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1838 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1842 case RC_KBMAP_PRIMARY:
1843 case RC_KBMAP_SECONDARY:
1844 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.");
1847 case RC_ASCIIROFF_COMMAND:
1848 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.");
1851 case RC_ASCII_LINELEN:
1852 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1855 case RC_NUMLASTFILES:
1856 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1859 case RC_CHECKLASTFILES:
1860 str = _("Select to check whether the lastfiles still exist.");
1863 case RC_VIEWDVI_PAPEROPTION:
1864 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1867 case RC_DEFAULT_PAPERSIZE:
1868 str = _("Specify the default paper size.");
1874 case RC_ACCEPT_COMPOUND:
1875 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1878 case RC_SPELL_COMMAND:
1879 str = _("What command runs the spell checker?");
1882 case RC_USE_INP_ENC:
1883 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.");
1886 case RC_USE_ALT_LANG:
1888 str = _("Specify an alternate language. The default is to use the language of the document.");
1891 case RC_USE_PERS_DICT:
1893 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1896 case RC_USE_ESC_CHARS:
1898 str = _("Specify additional chars that can be part of a word.");
1901 case RC_SCREEN_FONT_SCALABLE:
1902 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.");
1905 case RC_CHKTEX_COMMAND:
1906 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1909 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1910 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.");
1913 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1914 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
1917 case RC_DISPLAY_GRAPHICS:
1918 str = _("Select how LyX will display any graphics.");
1921 case RC_MAKE_BACKUP:
1922 str = _("De-select if you don't want LyX to create backup files.");
1925 case RC_BACKUPDIR_PATH:
1926 str = _("The path for storing backup files. If it is an empty string, LyX will store the backup file in the same directory as the original file.");
1929 case RC_RTL_SUPPORT:
1930 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
1933 case RC_MARK_FOREIGN_LANGUAGE:
1934 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
1937 case RC_LANGUAGE_PACKAGE:
1938 str = _("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
1941 case RC_LANGUAGE_GLOBAL_OPTIONS:
1942 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
1945 case RC_LANGUAGE_USE_BABEL:
1946 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
1949 case RC_LANGUAGE_AUTO_BEGIN:
1950 str = _("Select if a language switching command is needed at the beginning of the document.");
1953 case RC_LANGUAGE_AUTO_END:
1954 str = _("Select if a language switching command is needed at the end of the document.");
1957 case RC_LANGUAGE_COMMAND_BEGIN:
1958 str = _("The latex command for changing from the language of the document to another language. E.g. \\selectlanguage{$$lang} where $$lang is substituted by the name of the second language.");
1961 case RC_LANGUAGE_COMMAND_END:
1962 str = _("The latex command for changing back to the language of the document.");
1965 case RC_LANGUAGE_COMMAND_LOCAL:
1966 str = _("The latex command for local changing of the language.");
1969 case RC_DATE_INSERT_FORMAT:
1970 //xgettext:no-c-format
1971 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
1974 case RC_SHOW_BANNER:
1975 str = _("De-select if you don't want the startup banner.");
1979 str = _("The wheel movement factor (for mice with wheels or five button mice).");
1991 case RC_DEFAULT_LANGUAGE:
1992 str = _("New documents will be assigned this language.");
1995 case RC_LABEL_INIT_LENGTH:
1996 str = _("Maximum number of words in the initialization string for a new label");
2000 str = _("Shows a typeset preview of things such as math");
2003 case RC_PREVIEW_HASHED_LABELS:
2004 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2007 case RC_PREVIEW_SCALE_FACTOR:
2008 str = _("Scale the preview size to suit.");
2018 // The global instance
2021 // The global copy of the system lyxrc entries (everything except preferences)