1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2001 The LyX Team.
9 * ====================================================== */
14 #pragma implementation "lyxrc.h"
25 #include "LyXAction.h"
26 #include "lyxserver.h"
29 #include "tex-strings.h"
30 #include "support/path.h"
31 #include "support/filetools.h"
33 #include "converter.h"
43 extern LyXAction lyxaction;
44 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
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 { "\\display_shortcuts", LyXRC::RC_DISPLAY_SHORTCUTS },
72 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
73 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
74 { "\\exit_confirmation", LyXRC::RC_EXIT_CONFIRMATION },
75 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
76 { "\\format", LyXRC::RC_FORMAT },
77 { "\\input", LyXRC::RC_INPUT },
78 { "\\kbmap", LyXRC::RC_KBMAP },
79 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
80 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
81 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
82 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
83 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
84 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
85 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
86 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
87 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
88 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
89 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
90 { "\\lastfiles", LyXRC::RC_LASTFILES },
91 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
92 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
93 { "\\new_ask_filename", LyXRC::RC_NEW_ASK_FILENAME },
94 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
95 { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS },
96 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
97 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
98 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
99 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
100 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
101 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
102 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
103 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
104 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
105 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
106 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
107 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
108 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
109 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
110 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
111 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
112 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
113 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
114 { "\\printer", LyXRC::RC_PRINTER },
115 { "\\ps_command", LyXRC::RC_PS_COMMAND },
116 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
117 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
118 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
119 { "\\screen_font_encoding_menu", LyXRC::RC_SCREEN_FONT_ENCODING_MENU },
120 { "\\screen_font_menu", LyXRC::RC_SCREEN_FONT_MENU },
121 { "\\screen_font_popup", LyXRC::RC_SCREEN_FONT_POPUP },
122 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
123 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
124 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
125 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
126 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
127 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
128 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
129 { "\\set_color", LyXRC::RC_SET_COLOR },
130 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
131 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
132 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
133 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
134 { "\\ui_file", LyXRC::RC_UIFILE },
135 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
136 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
137 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
138 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
140 { "\\use_pspell", LyXRC::RC_USE_PSPELL },
142 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
143 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
144 { "\\viewer" ,LyXRC::RC_VIEWER},
145 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
148 /* Let the range depend of the size of lyxrcTags. Alejandro 240596 */
149 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
160 void LyXRC::setDefaults() {
164 // Get printer from the environment. If fail, use default "",
165 // assuming that everything is set up correctly.
166 printer = GetEnv("PRINTER");
167 print_adapt_output = false;
168 print_command = "dvips";
169 print_evenpage_flag = "-B";
170 print_oddpage_flag = "-A";
171 print_pagerange_flag = "-pp";
172 print_copies_flag = "-c";
173 print_collcopies_flag = "-C";
174 print_reverse_flag = "-r";
175 print_landscape_flag = "-t landscape";
176 print_to_printer = "-P";
177 print_to_file = "-o ";
178 print_file_extension = ".ps";
179 print_paper_flag = "-t";
180 print_paper_dimension_flag = "-T";
181 document_path = GetEnvPath("HOME");
182 tempdir_path = "/tmp";
185 view_dvi_paper_option = "";
186 default_papersize = BufferParams::PAPER_USLETTER;
187 custom_export_format = "ps";
188 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
191 // Because a screen typically is wider than a piece of paper:
194 // Default LaTeX font size:
195 font_sizes[LyXFont::SIZE_TINY] = 5.0;
196 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
197 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
198 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
199 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
200 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
201 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
202 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
203 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
204 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
205 use_scalable_fonts = true;
206 roman_font_name = "-*-times";
207 sans_font_name = "-*-helvetica";
208 typewriter_font_name = "-*-courier";
209 menu_font_name = "-*-helvetica-bold-r";
210 popup_font_name = "-*-helvetica-medium-r";
211 font_norm = "iso8859-1";
212 font_norm_type = ISO_8859_1;
214 override_x_deadkeys = true;
216 auto_region_delete = true;
217 auto_reset_options = false;
220 check_lastfiles = true;
223 exit_confirmation = true;
224 display_graphics = "mono";
225 display_shortcuts = true;
226 // Spellchecker settings:
230 isp_command = "ispell";
231 isp_accept_compound = false;
232 isp_use_input_encoding = false;
233 isp_use_alt_lang = false;
234 isp_use_pers_dict = false;
235 isp_use_esc_chars = false;
239 mark_foreign_language = true;
240 language_auto_begin = true;
241 language_auto_end = true;
242 language_global_options = true;
243 language_use_babel = true;
244 language_package = "\\usepackage{babel}";
245 language_command_begin = "\\selectlanguage{$$lang}";
246 language_command_local = "\\foreignlanguage{$$lang}{";
247 default_language = "english";
249 new_ask_filename = false;
252 date_insert_format = "%A, %e %B %Y";
254 cursor_follows_scrollbar = false;
255 dialogs_iconify_with_main = false;
256 label_init_length = 3;
258 /// These variables are not stored on disk (perhaps they
259 // should be moved from the LyXRC class).
265 int LyXRC::ReadBindFile(string const & name)
268 string const tmp = i18nLibFileSearch("bind", name, "bind");
269 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
270 int const result = read(tmp);
272 lyxerr << "Error reading bind file: " << tmp << endl;
277 void LyXRC::readBindFileIfNeeded()
280 ReadBindFile(bind_file);
284 int LyXRC::read(string const & filename)
286 LyXLex lexrc(lyxrcTags, lyxrcCount);
287 if (lyxerr.debugging(Debug::PARSER))
288 lexrc.printTable(lyxerr);
290 lexrc.setFile(filename);
291 if (!lexrc.isOK()) return -2;
293 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
295 while (lexrc.isOK()) {
296 // By using two switches we take advantage of the compiler
297 // telling us if we have missed a LyXRCTags element in
298 // the second switch.
299 // Note that this also shows a problem with LyXLex since it
300 // helps us avoid taking advantage of the strictness of the
303 int le = lexrc.lex();
305 case LyXLex::LEX_UNDEF:
306 lexrc.printError("Unknown tag `$$Token'");
308 case LyXLex::LEX_FEOF:
312 switch (static_cast<LyXRCTags>(le)) {
313 case RC_INPUT: // Include file
316 LibFileSearch(string(),
319 lexrc.printError("Error reading "
320 "included file: "+tmp);
324 case RC_BINDFILE: // RVDK_PATCH_5
326 string const tmp(lexrc.getString());
328 // We are already in the
329 // "actually read bind file"
333 // We are still in the "just
334 // remember the name of the
342 ui_file = lexrc.getString();
346 case RC_EXIT_CONFIRMATION:
348 exit_confirmation = lexrc.getBool();
351 case RC_AUTORESET_OPTIONS:
353 auto_reset_options = lexrc.getBool();
356 case RC_DISPLAY_GRAPHICS:
358 display_graphics = lexrc.getString();
361 case RC_DISPLAY_SHORTCUTS:
363 display_shortcuts = lexrc.getBool();
368 use_kbmap = lexrc.getBool();
371 case RC_KBMAP_PRIMARY:
373 string const kmap(lexrc.getString());
376 } else if (!LibFileSearch("kbd", kmap,
378 primary_kbmap = kmap;
380 lexrc.printError("LyX: Keymap `$$Token' not found");
384 case RC_KBMAP_SECONDARY:
386 string const kmap(lexrc.getString());
389 } else if (!LibFileSearch("kbd", kmap,
391 secondary_kbmap = kmap;
393 lexrc.printError("LyX: Keymap `$$Token' not found");
397 case RC_FONT_ENCODING:
399 fontenc = lexrc.getString();
404 printer = lexrc.getString();
407 case RC_PRINT_COMMAND:
409 print_command = lexrc.getString();
412 case RC_PRINTEVENPAGEFLAG:
414 print_evenpage_flag = lexrc.getString();
417 case RC_PRINTODDPAGEFLAG:
419 print_oddpage_flag = lexrc.getString();
422 case RC_PRINTPAGERANGEFLAG:
424 print_pagerange_flag = lexrc.getString();
427 case RC_PRINTCOPIESFLAG:
429 print_copies_flag = lexrc.getString();
432 case RC_PRINTCOLLCOPIESFLAG:
434 print_collcopies_flag = lexrc.getString();
437 case RC_PRINTREVERSEFLAG:
439 print_reverse_flag = lexrc.getString();
442 case RC_PRINTLANDSCAPEFLAG:
444 print_landscape_flag = lexrc.getString();
447 case RC_PRINTTOPRINTER:
449 print_to_printer = lexrc.getString();
452 case RC_PRINT_ADAPTOUTPUT:
454 print_adapt_output = lexrc.getBool();
459 print_to_file = lexrc.getString();
462 case RC_PRINTFILEEXTENSION:
464 print_file_extension = lexrc.getString();
467 case RC_PRINTEXSTRAOPTIONS:
469 print_extra_options = lexrc.getString();
472 case RC_PRINTSPOOL_COMMAND:
474 print_spool_command = lexrc.getString();
477 case RC_PRINTSPOOL_PRINTERPREFIX:
479 print_spool_printerprefix = lexrc.getString();
482 case RC_PRINTPAPERDIMENSIONFLAG:
484 print_paper_dimension_flag = lexrc.getString();
487 case RC_PRINTPAPERFLAG:
489 print_paper_flag = lexrc.getString();
492 case RC_CUSTOM_EXPORT_COMMAND:
494 custom_export_command = lexrc.getString();
497 case RC_CUSTOM_EXPORT_FORMAT:
499 custom_export_format = lexrc.getString();
502 case RC_DEFAULT_PAPERSIZE:
505 lowercase(lexrc.getString());
506 if (size == "usletter")
508 BufferParams::PAPER_USLETTER;
509 else if (size == "legal")
511 BufferParams::PAPER_LEGALPAPER;
512 else if (size == "executive")
514 BufferParams::PAPER_EXECUTIVEPAPER;
515 else if (size == "a3")
517 BufferParams::PAPER_A3PAPER;
518 else if (size == "a4")
520 BufferParams::PAPER_A4PAPER;
521 else if (size == "a5")
523 BufferParams::PAPER_A5PAPER;
524 else if (size == "b5")
526 BufferParams::PAPER_B5PAPER;
530 case RC_VIEWDVI_PAPEROPTION:
532 view_dvi_paper_option = lexrc.getString();
534 view_dvi_paper_option = "";
539 ps_command = lexrc.getString();
542 case RC_CHKTEX_COMMAND:
544 chktex_command = lexrc.getString();
549 dpi = lexrc.getInteger();
554 zoom = lexrc.getInteger();
559 wheel_jump = lexrc.getInteger();
562 case RC_SCREEN_FONT_SIZES:
564 font_sizes[LyXFont::SIZE_TINY] =
567 font_sizes[LyXFont::SIZE_SCRIPT] =
570 font_sizes[LyXFont::SIZE_FOOTNOTE] =
573 font_sizes[LyXFont::SIZE_SMALL] =
576 font_sizes[LyXFont::SIZE_NORMAL] =
579 font_sizes[LyXFont::SIZE_LARGE] =
582 font_sizes[LyXFont::SIZE_LARGER] =
585 font_sizes[LyXFont::SIZE_LARGEST] =
588 font_sizes[LyXFont::SIZE_HUGE] =
591 font_sizes[LyXFont::SIZE_HUGER] =
595 case RC_SCREEN_FONT_SCALABLE:
597 use_scalable_fonts = lexrc.getBool();
602 autosave = lexrc.getInteger();
605 case RC_DOCUMENTPATH:
607 document_path = ExpandPath(lexrc.getString());
611 case RC_TEMPLATEPATH:
613 template_path = ExpandPath(lexrc.getString());
618 tempdir_path = ExpandPath(lexrc.getString());
623 use_tempdir = lexrc.getBool();
628 lastfiles = ExpandPath(lexrc.getString());
631 case RC_NUMLASTFILES:
633 num_lastfiles = lexrc.getInteger();
636 case RC_CHECKLASTFILES:
638 check_lastfiles = lexrc.getBool();
641 case RC_SCREEN_FONT_ROMAN:
643 roman_font_name = lexrc.getString();
646 case RC_SCREEN_FONT_SANS:
648 sans_font_name = lexrc.getString();
651 case RC_SCREEN_FONT_TYPEWRITER:
653 typewriter_font_name = lexrc.getString();
656 case RC_SCREEN_FONT_MENU:
658 menu_font_name = lexrc.getString();
661 case RC_SCREEN_FONT_POPUP:
663 popup_font_name = lexrc.getString();
666 case RC_SCREEN_FONT_ENCODING:
668 font_norm = lexrc.getString();
669 set_font_norm_type();
673 case RC_SCREEN_FONT_ENCODING_MENU:
675 font_norm_menu = lexrc.getString();
680 string lyx_name, x11_name;
683 lyx_name = lexrc.getString();
685 lexrc.printError("Missing color tag.");
690 x11_name = lexrc.getString();
692 lexrc.printError("Missing color name for color : `$$Token'");
696 if (!lcolor.setColor(lyx_name, x11_name))
697 lyxerr << "Bad lyxrc set_color for "
702 case RC_AUTOREGIONDELETE:
703 // Auto region delete defaults to true
705 auto_region_delete = lexrc.getBool();
710 // we should not do an explicit binding before
711 // loading a bind file. So, in this case, load
712 // the default bind file.
713 readBindFileIfNeeded();
715 // !!!chb, dynamic key binding...
717 string::size_type res = 0;
721 seq = lexrc.getString();
723 lexrc.printError("RC_BIND: Missing key sequence");
727 if (lexrc.next(true)) {
728 cmd = lexrc.getString();
730 lexrc.printError("RC_BIND: missing command");
734 if ((action = lyxaction.LookupFunc(cmd))>= 0) {
735 if (lyxerr.debugging(Debug::LYXRC)) {
736 lyxerr << "RC_BIND: Sequence `"
737 << seq << "' Command `"
738 << cmd << "' Action `"
739 << action << '\'' << endl;
741 res = toplevel_keymap->bind(seq, action);
743 && lyxerr.debugging(Debug::LYXRC)) {
746 "Invalid key sequence `"
749 } else {// cmd is the last token read.
751 "Unknown LyX function `$$Token'");
755 case RC_OVERRIDE_X_DEADKEYS:
757 override_x_deadkeys = lexrc.getBool();
762 lyxpipes = ExpandPath(lexrc.getString());
765 case RC_CURSOR_FOLLOWS_SCROLLBAR:
767 cursor_follows_scrollbar = lexrc.getBool();
770 case RC_DIALOGS_ICONIFY_WITH_MAIN:
772 dialogs_iconify_with_main = lexrc.getBool();
775 case RC_ASCIIROFF_COMMAND:
777 ascii_roff_command = lexrc.getString();
779 case RC_ASCII_LINELEN:
781 ascii_linelen = lexrc.getInteger();
783 // Spellchecker settings:
787 use_pspell = lexrc.getBool();
790 case RC_SPELL_COMMAND:
792 isp_command = lexrc.getString();
794 case RC_ACCEPT_COMPOUND:
796 isp_accept_compound = lexrc.getBool();
800 isp_use_input_encoding = lexrc.getBool();
802 case RC_USE_ALT_LANG:
804 isp_use_alt_lang = lexrc.getBool();
806 case RC_USE_PERS_DICT:
808 isp_use_pers_dict = lexrc.getBool();
810 case RC_USE_ESC_CHARS:
812 isp_use_esc_chars = lexrc.getBool();
816 isp_alt_lang = lexrc.getString();
820 isp_pers_dict = lexrc.getString();
824 isp_esc_chars = lexrc.getString();
828 make_backup = lexrc.getBool();
830 case RC_BACKUPDIR_PATH:
832 backupdir_path = ExpandPath(lexrc.getString());
834 case RC_DATE_INSERT_FORMAT:
836 date_insert_format = lexrc.getString();
838 case RC_LANGUAGE_PACKAGE:
840 language_package = lexrc.getString();
842 case RC_LANGUAGE_AUTO_BEGIN:
844 language_auto_begin = lexrc.getBool();
846 case RC_LANGUAGE_AUTO_END:
848 language_auto_end = lexrc.getBool();
850 case RC_LANGUAGE_GLOBAL_OPTIONS:
852 language_global_options = lexrc.getBool();
854 case RC_LANGUAGE_USE_BABEL:
856 language_use_babel = lexrc.getBool();
858 case RC_LANGUAGE_COMMAND_BEGIN:
860 language_command_begin = lexrc.getString();
862 case RC_LANGUAGE_COMMAND_END:
864 language_command_end = lexrc.getString();
866 case RC_LANGUAGE_COMMAND_LOCAL:
868 language_command_local = lexrc.getString();
872 rtl_support = lexrc.getBool();
876 auto_number = lexrc.getBool();
878 case RC_MARK_FOREIGN_LANGUAGE:
880 mark_foreign_language = lexrc.getBool();
884 show_banner = lexrc.getBool();
887 case RC_NEW_ASK_FILENAME:
889 new_ask_filename = lexrc.getBool();
892 string from, to, command, flags;
894 from = lexrc.getString();
896 to = lexrc.getString();
898 command = lexrc.getString();
900 flags = lexrc.getString();
901 if (command.empty() || command == "none")
902 converters.erase(from, to);
904 converters.add(from, to, command, flags);
908 string format, command;
910 format = lexrc.getString();
912 command = lexrc.getString();
913 formats.setViewer(format, command);
917 string format, extension, prettyname, shortcut;
919 format = lexrc.getString();
921 extension = lexrc.getString();
923 prettyname = lexrc.getString();
925 shortcut = lexrc.getString();
926 if (prettyname.empty()) {
927 if (converters.formatIsUsed(format))
928 lyxerr << "Can't delete format "
931 formats.erase(format);
934 formats.add(format, extension, prettyname,
938 case RC_DEFAULT_LANGUAGE:
940 default_language = lexrc.getString();
943 case RC_LABEL_INIT_LENGTH:
945 label_init_length = lexrc.getInteger();
948 case RC_LAST: break; // this is just a dummy
952 /// Update converters data-structures
953 converters.update(formats);
954 converters.buildGraph();
960 void LyXRC::write(string const & filename) const
962 ofstream ofs(filename.c_str());
968 void LyXRC::print() const
970 if (lyxerr.debugging())
977 void LyXRC::output(ostream & os) const
979 os << "### This file is part of\n"
980 << "### ========================================================\n"
981 << "### LyX, The Document Processor\n"
983 << "### Copyright 1995 Matthias Ettrich\n"
984 << "### Copyright 1995-2001 The LyX Team.\n"
986 << "### ========================================================\n"
988 << "# This file is written by LyX, if you want to make your own\n"
989 << "# modifications you should do them from inside LyX and save\n"
992 // Why the switch you might ask. It is a trick to ensure that all
993 // the elements in the LyXRCTags enum is handled. As you can see
994 // there are no breaks at all. So it is just a huge fall-through.
995 // The nice thing is that we will get a warning from the compiler
996 // if we forget an element.
997 LyXRCTags tag = RC_LAST;
1001 // input/include files are not done here
1003 // bindings is not written to the preferences file.
1005 if (bind_file != system_lyxrc.bind_file) {
1006 os << "\\bind_file " << bind_file << "\n";
1012 << "# MISC SECTION ######################################\n"
1015 case RC_SHOW_BANNER:
1016 if (show_banner != system_lyxrc.show_banner) {
1017 os << "# Set to false to inhibit the startup banner.\n"
1018 << "\\show_banner " << tostr(show_banner) << "\n";
1020 // bind files are not done here.
1022 if (ui_file != system_lyxrc.ui_file) {
1023 os << "\\ui_file \"" << ui_file << "\"\n";
1025 case RC_AUTOREGIONDELETE:
1026 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1027 os << "# Set to false to inhibit automatic replacement of\n"
1028 << "# the current selection.\n"
1029 << "\\auto_region_delete " << tostr(auto_region_delete)
1032 case RC_AUTORESET_OPTIONS:
1033 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1034 os << "# Set to false to inhibit automatic reset of\n"
1035 << "# the class options to defaults on class change.\n"
1036 << "\\auto_reset_options " << tostr(auto_reset_options)
1040 if (autosave != system_lyxrc.autosave) {
1041 os << "# The time interval between auto-saves in seconds.\n"
1042 << "\\autosave " << autosave << "\n";
1044 case RC_EXIT_CONFIRMATION:
1045 if (exit_confirmation != system_lyxrc.exit_confirmation) {
1046 os << "# Ask for confirmation before exit if there are\n"
1047 << "# unsaved changed documents.\n"
1048 << "\\exit_confirmation " << tostr(exit_confirmation)
1051 case RC_DISPLAY_GRAPHICS:
1052 if (display_graphics != system_lyxrc.display_graphics) {
1053 os << "# Display graphics within LyX\n"
1054 << "# no|mono|gray|color\n"
1055 << "\\display_graphics " << display_graphics
1059 case RC_DISPLAY_SHORTCUTS:
1060 if (display_shortcuts != system_lyxrc.display_shortcuts) {
1061 os << "# Display name of the last command executed,\n"
1062 << "# with a list of short-cuts in the minibuffer.\n"
1063 << "\\display_shortcuts " << tostr(display_shortcuts)
1066 case RC_VIEWDVI_PAPEROPTION:
1067 if (view_dvi_paper_option
1068 != system_lyxrc.view_dvi_paper_option) {
1069 os << "# Options used to specify paper size to the\n"
1070 << "# view_dvi_command (e.g. -paper)\n"
1071 << "\\view_dvi_paper_option \""
1072 << view_dvi_paper_option << "\"\n";
1074 case RC_DEFAULT_PAPERSIZE:
1075 if (default_papersize != system_lyxrc.default_papersize) {
1076 os << "# The default papersize to use.\n"
1077 << "\\default_papersize \"";
1078 switch (default_papersize) {
1079 case BufferParams::PAPER_USLETTER:
1080 os << "usletter"; break;
1081 case BufferParams::PAPER_LEGALPAPER:
1082 os << "legal"; break;
1083 case BufferParams::PAPER_EXECUTIVEPAPER:
1084 os << "executive"; break;
1085 case BufferParams::PAPER_A3PAPER:
1087 case BufferParams::PAPER_A4PAPER:
1089 case BufferParams::PAPER_A5PAPER:
1091 case BufferParams::PAPER_B5PAPER:
1093 case BufferParams::PAPER_DEFAULT: break;
1098 if (ps_command != system_lyxrc.ps_command) {
1099 os << "# Program used for interpreting postscript.\n"
1100 << "\\ps_command \"" << ps_command << "\"\n";
1102 case RC_CHKTEX_COMMAND:
1103 if (chktex_command != system_lyxrc.chktex_command) {
1104 os << "\\chktex_command \"" << chktex_command << "\"\n";
1107 if (use_kbmap != system_lyxrc.use_kbmap) {
1108 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1110 case RC_KBMAP_PRIMARY:
1111 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1112 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1114 case RC_KBMAP_SECONDARY:
1115 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1116 os << "\\kbmap_secondary \"" << secondary_kbmap
1120 if (lyxpipes != system_lyxrc.lyxpipes) {
1121 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1123 case RC_DATE_INSERT_FORMAT:
1124 if (date_insert_format != system_lyxrc.date_insert_format) {
1125 os << "\\date_insert_format \"" << date_insert_format
1128 case RC_LABEL_INIT_LENGTH:
1129 if (label_init_length != system_lyxrc.label_init_length) {
1130 os << "\\label_init_length " << label_init_length
1135 << "# SCREEN & FONTS SECTION ############################\n"
1139 if (dpi != system_lyxrc.dpi) {
1140 os << "\\screen_dpi " << dpi << "\n";
1142 case RC_SCREEN_ZOOM:
1143 if (zoom != system_lyxrc.zoom) {
1144 os << "\\screen_zoom " << zoom << "\n";
1147 if (wheel_jump != system_lyxrc.wheel_jump) {
1148 os << "\\wheel_jump " << wheel_jump << "\n";
1150 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1151 if (cursor_follows_scrollbar
1152 != system_lyxrc.cursor_follows_scrollbar) {
1153 os << "\\cursor_follows_scrollbar "
1154 << tostr(cursor_follows_scrollbar) << "\n";
1156 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1157 if (dialogs_iconify_with_main
1158 != system_lyxrc.dialogs_iconify_with_main) {
1159 os << "\\dialogs_iconify_with_main "
1160 << tostr(dialogs_iconify_with_main) << "\n";
1162 case RC_SCREEN_FONT_ROMAN:
1163 if (roman_font_name != system_lyxrc.roman_font_name) {
1164 os << "\\screen_font_roman \"" << roman_font_name
1167 case RC_SCREEN_FONT_SANS:
1168 if (sans_font_name != system_lyxrc.sans_font_name) {
1169 os << "\\screen_font_sans \"" << sans_font_name
1172 case RC_SCREEN_FONT_TYPEWRITER:
1173 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1174 os << "\\screen_font_typewriter \""
1175 << typewriter_font_name << "\"\n";
1177 case RC_SCREEN_FONT_SCALABLE:
1178 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1179 os << "\\screen_font_scalable "
1180 << tostr(use_scalable_fonts)
1183 case RC_SCREEN_FONT_ENCODING:
1184 if (font_norm != system_lyxrc.font_norm) {
1185 os << "\\screen_font_encoding \"" << font_norm
1188 case RC_SCREEN_FONT_POPUP:
1189 if (popup_font_name != system_lyxrc.popup_font_name) {
1190 os << "\\screen_font_popup \"" << popup_font_name
1193 case RC_SCREEN_FONT_MENU:
1194 if (menu_font_name != system_lyxrc.menu_font_name) {
1195 os << "\\screen_font_menu \"" << menu_font_name
1198 case RC_SCREEN_FONT_SIZES:
1199 if (font_sizes[LyXFont::SIZE_TINY]
1200 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1201 font_sizes[LyXFont::SIZE_SCRIPT]
1202 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1203 font_sizes[LyXFont::SIZE_FOOTNOTE]
1204 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1205 font_sizes[LyXFont::SIZE_SMALL]
1206 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1207 font_sizes[LyXFont::SIZE_NORMAL]
1208 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1209 font_sizes[LyXFont::SIZE_LARGE]
1210 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1211 font_sizes[LyXFont::SIZE_LARGER]
1212 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1213 font_sizes[LyXFont::SIZE_LARGEST]
1214 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1215 font_sizes[LyXFont::SIZE_HUGE]
1216 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1217 font_sizes[LyXFont::SIZE_HUGER]
1218 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1219 os.setf(ios::fixed);
1221 os << "\\screen_font_sizes"
1222 << " " << font_sizes[LyXFont::SIZE_TINY]
1223 << " " << font_sizes[LyXFont::SIZE_SCRIPT]
1224 << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]
1225 << " " << font_sizes[LyXFont::SIZE_SMALL]
1226 << " " << font_sizes[LyXFont::SIZE_NORMAL]
1227 << " " << font_sizes[LyXFont::SIZE_LARGE]
1228 << " " << font_sizes[LyXFont::SIZE_LARGER]
1229 << " " << font_sizes[LyXFont::SIZE_LARGEST]
1230 << " " << font_sizes[LyXFont::SIZE_HUGE]
1231 << " " << font_sizes[LyXFont::SIZE_HUGER]
1236 << "# COLOR SECTION ###################################\n"
1240 for (int i = 0; i < LColor::ignore; ++i ) {
1241 LColor::color lc = static_cast<LColor::color>(i);
1243 string const col(lcolor.getX11Name(lc));
1244 if (col != system_lcolor.getX11Name(lc)) {
1245 os << "\\set_color \""
1246 << lcolor.getLyXName(lc) << "\" \""
1252 << "# PRINTER SECTION ###################################\n"
1256 if (printer != system_lyxrc.printer) {
1257 os << "\\printer \"" << printer << "\"\n";
1259 case RC_PRINT_ADAPTOUTPUT:
1260 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1261 os << "\\print_adapt_output "
1262 << tostr(print_adapt_output)
1265 case RC_PRINT_COMMAND:
1266 if (print_command != system_lyxrc.print_command) {
1267 os << "\\print_command \"" << print_command << "\"\n";
1269 case RC_PRINTEXSTRAOPTIONS:
1270 if (print_extra_options != system_lyxrc.print_extra_options) {
1271 os << "\\print_extra_options \"" << print_extra_options
1274 case RC_PRINTSPOOL_COMMAND:
1275 if (print_spool_command != system_lyxrc.print_spool_command) {
1276 os << "\\print_spool_command \"" << print_spool_command
1279 case RC_PRINTSPOOL_PRINTERPREFIX:
1280 if (print_spool_printerprefix
1281 != system_lyxrc.print_spool_printerprefix) {
1282 os << "\\print_spool_printerprefix \""
1283 << print_spool_printerprefix << "\"\n";
1285 case RC_PRINTEVENPAGEFLAG:
1286 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1287 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1290 case RC_PRINTODDPAGEFLAG:
1291 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1292 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1295 case RC_PRINTREVERSEFLAG:
1296 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1297 os << "\\print_reverse_flag \"" << print_reverse_flag
1300 case RC_PRINTLANDSCAPEFLAG:
1301 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1302 os << "\\print_landscape_flag \"" << print_landscape_flag
1305 case RC_PRINTPAGERANGEFLAG:
1306 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1307 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1310 case RC_PRINTCOPIESFLAG:
1311 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1312 os << "\\print_copies_flag \"" << print_copies_flag
1315 case RC_PRINTCOLLCOPIESFLAG:
1316 if (print_collcopies_flag
1317 != system_lyxrc.print_collcopies_flag) {
1318 os << "\\print_collcopies_flag \""
1319 << print_collcopies_flag
1322 case RC_PRINTPAPERFLAG:
1323 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1324 os << "\\print_paper_flag \"" << print_paper_flag
1327 case RC_PRINTPAPERDIMENSIONFLAG:
1328 if (print_paper_dimension_flag
1329 != system_lyxrc.print_paper_dimension_flag) {
1330 os << "\\print_paper_dimension_flag \""
1331 << print_paper_dimension_flag << "\"\n";
1333 case RC_PRINTTOPRINTER:
1334 if (print_to_printer != system_lyxrc.print_to_printer) {
1335 os << "\\print_to_printer \"" << print_to_printer
1338 case RC_PRINTTOFILE:
1339 if (print_to_file != system_lyxrc.print_to_file) {
1340 os << "\\print_to_file \"" << print_to_file << "\"\n";
1342 case RC_PRINTFILEEXTENSION:
1343 if (print_file_extension != system_lyxrc.print_file_extension) {
1344 os << "\\print_file_extension \""
1345 << print_file_extension
1350 << "# EXPORT SECTION ####################################\n"
1353 case RC_CUSTOM_EXPORT_COMMAND:
1354 if (custom_export_command
1355 != system_lyxrc.custom_export_command) {
1356 os << "\\custom_export_command \""
1357 << custom_export_command
1360 case RC_CUSTOM_EXPORT_FORMAT:
1361 if (custom_export_format
1362 != system_lyxrc.custom_export_format) {
1363 os << "\\custom_export_format \"" << custom_export_format
1368 << "# TEX SECTION #######################################\n"
1371 case RC_FONT_ENCODING:
1372 if (fontenc != system_lyxrc.fontenc) {
1373 os << "\\font_encoding \"" << fontenc << "\"\n";
1377 << "# FILE SECTION ######################################\n"
1380 case RC_DOCUMENTPATH:
1381 if (document_path != system_lyxrc.document_path) {
1382 os << "\\document_path \"" << document_path << "\"\n";
1385 if (lastfiles != system_lyxrc.lastfiles) {
1386 os << "\\lastfiles \"" << lastfiles << "\"\n";
1388 case RC_NUMLASTFILES:
1389 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1390 os << "\\num_lastfiles " << num_lastfiles << "\n";
1392 case RC_CHECKLASTFILES:
1393 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1394 os << "\\check_lastfiles " << tostr(check_lastfiles)
1397 case RC_TEMPLATEPATH:
1398 if (template_path != system_lyxrc.template_path) {
1399 os << "\\template_path \"" << template_path << "\"\n";
1401 case RC_TEMPDIRPATH:
1402 if (tempdir_path != system_lyxrc.tempdir_path) {
1403 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1406 if (use_tempdir != system_lyxrc.use_tempdir) {
1407 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1409 case RC_ASCII_LINELEN:
1410 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1411 os << "\\ascii_linelen " << ascii_linelen << "\n";
1413 case RC_MAKE_BACKUP:
1414 if (make_backup != system_lyxrc.make_backup) {
1415 os << "\\make_backup " << tostr(make_backup) << "\n";
1417 case RC_BACKUPDIR_PATH:
1418 if (backupdir_path != system_lyxrc.backupdir_path) {
1419 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1423 << "# ASCII EXPORT SECTION ##############################\n"
1426 case RC_ASCIIROFF_COMMAND:
1427 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1428 os << "\\ascii_roff_command \"" << ascii_roff_command
1433 << "# SPELLCHECKER SECTION ##############################\n"
1437 if (use_pspell != system_lyxrc.use_pspell) {
1438 os << "\\use_pspell \"" << use_pspell << "\"\n";
1441 case RC_SPELL_COMMAND:
1442 if (isp_command != system_lyxrc.isp_command) {
1443 os << "\\spell_command \"" << isp_command << "\"\n";
1445 case RC_ACCEPT_COMPOUND:
1446 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1447 os << "\\accept_compound " << tostr(isp_accept_compound)
1450 case RC_USE_ALT_LANG:
1451 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1452 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1456 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1457 os << "\\alternate_language \"" << isp_alt_lang
1460 case RC_USE_ESC_CHARS:
1461 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1462 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1466 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1467 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1469 case RC_USE_PERS_DICT:
1470 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1471 os << "\\use_personal_dictionary "
1472 << tostr(isp_use_pers_dict)
1476 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1477 os << "\\personal_dictionary \"" << isp_pers_dict
1480 case RC_USE_INP_ENC:
1481 if (isp_use_input_encoding
1482 != system_lyxrc.isp_use_input_encoding) {
1483 os << "\\use_input_encoding "
1484 << tostr(isp_use_input_encoding)
1489 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1492 case RC_RTL_SUPPORT:
1493 if (rtl_support != system_lyxrc.rtl_support) {
1494 os << "\\rtl " << tostr(rtl_support) << "\n";
1496 case RC_LANGUAGE_PACKAGE:
1497 if (language_package != system_lyxrc.language_package) {
1498 os << "\\language_package \"" << language_package
1501 case RC_LANGUAGE_GLOBAL_OPTIONS:
1502 if (language_global_options
1503 != system_lyxrc.language_global_options) {
1504 os << "\\language_global_options \""
1505 << tostr(language_global_options)
1508 case RC_LANGUAGE_USE_BABEL:
1509 if (language_use_babel != system_lyxrc.language_use_babel) {
1510 os << "\\language_use_babel \""
1511 << tostr(language_use_babel)
1514 case RC_LANGUAGE_COMMAND_BEGIN:
1515 if (language_command_begin
1516 != system_lyxrc.language_command_begin) {
1517 os << "\\language_command_begin \""
1518 << language_command_begin
1521 case RC_LANGUAGE_COMMAND_END:
1522 if (language_command_end
1523 != system_lyxrc.language_command_end) {
1524 os << "\\language_command_end \"" << language_command_end
1527 case RC_LANGUAGE_COMMAND_LOCAL:
1528 if (language_command_local
1529 != system_lyxrc.language_command_local) {
1530 os << "\\language_command_local \""
1531 << language_command_local
1534 case RC_LANGUAGE_AUTO_BEGIN:
1535 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1536 os << "\\language_auto_begin "
1537 << tostr(language_auto_begin) << "\n";
1539 case RC_LANGUAGE_AUTO_END:
1540 if (language_auto_end != system_lyxrc.language_auto_end) {
1541 os << "\\language_auto_end "
1542 << tostr(language_auto_end) << "\n";
1544 case RC_MARK_FOREIGN_LANGUAGE:
1545 if (mark_foreign_language
1546 != system_lyxrc.mark_foreign_language) {
1547 os << "\\mark_foreign_language " <<
1548 tostr(mark_foreign_language) << "\n";
1552 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1555 case RC_OVERRIDE_X_DEADKEYS:
1556 if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) {
1557 os << "\\override_x_deadkeys "
1558 << tostr(override_x_deadkeys) << "\n";
1560 case RC_SCREEN_FONT_ENCODING_MENU:
1561 if (font_norm_menu != system_lyxrc.font_norm_menu) {
1562 os << "\\screen_font_encoding_menu \"" << font_norm_menu
1565 case RC_AUTO_NUMBER:
1566 if (auto_number != system_lyxrc.auto_number) {
1567 os << "\\auto_number " << tostr(auto_number) << "\n";
1569 case RC_NEW_ASK_FILENAME:
1570 if (new_ask_filename != system_lyxrc.new_ask_filename) {
1571 os << "\\new_ask_filename " << tostr(new_ask_filename)
1574 case RC_DEFAULT_LANGUAGE:
1575 if (default_language != system_lyxrc.default_language) {
1576 os << "\\default_language " << default_language << "\n";
1580 << "# FORMATS SECTION ##########################\n"
1584 // Look for deleted formats
1585 for (Formats::const_iterator cit = formats.begin();
1586 cit != formats.end(); ++cit) {
1587 Format const * format =
1588 system_formats.getFormat(cit->name());
1590 format->extension() != cit->extension() ||
1591 format->prettyname() != cit->prettyname() ||
1592 format->shortcut() != cit->shortcut())
1593 os << "\\format \"" << cit->name() << "\" \""
1594 << cit->extension() << "\" \""
1595 << cit->prettyname() << "\" \""
1596 << cit->shortcut() << "\"\n";
1599 // New/modifed formats
1600 for (Formats::const_iterator cit = system_formats.begin();
1601 cit != system_formats.end(); ++cit)
1602 if (!formats.getFormat(cit->name()))
1603 os << "\\format \"" << cit->name()
1604 << "\" \"\" \"\" \"\"\n";
1606 for (Formats::const_iterator cit = formats.begin();
1607 cit != formats.end(); ++cit) {
1608 Format const * format =
1609 system_formats.getFormat(cit->name());
1610 if ((!format || format->viewer() != cit->viewer()) &&
1611 (format || !cit->viewer().empty()))
1612 os << "\\viewer \"" << cit->name() << "\" \""
1613 << cit->viewer() << "\"\n";
1617 << "# CONVERTERS SECTION ##########################\n"
1621 // Look for new converters
1622 for (Converters::const_iterator cit = converters.begin();
1623 cit != converters.end(); ++cit) {
1624 Converter const * converter =
1625 system_converters.getConverter(cit->from,
1628 converter->command != cit->command ||
1629 converter->flags != cit->flags)
1630 os << "\\converter \"" << cit->from << "\" \""
1631 << cit->to << "\" \""
1632 << cit->command << "\" \""
1633 << cit->flags << "\"\n";
1636 // New/modifed converters
1637 for (Converters::const_iterator cit = system_converters.begin();
1638 cit != system_converters.end(); ++cit)
1639 if (!converters.getConverter(cit->from, cit->to))
1640 os << "\\converter \"" << cit->from
1641 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1646 void LyXRC::set_font_norm_type()
1648 if (font_norm == "iso10646-1")
1649 font_norm_type = ISO_10646_1;
1650 else if (font_norm == "iso8859-1")
1651 font_norm_type = ISO_8859_1;
1652 else if (font_norm == "iso8859-3")
1653 font_norm_type = ISO_8859_3;
1654 else if (font_norm == "iso8859-4")
1655 font_norm_type = ISO_8859_4;
1656 else if (font_norm == "iso8859-6.8x")
1657 font_norm_type = ISO_8859_6_8;
1658 else if (font_norm == "iso8859-9")
1659 font_norm_type = ISO_8859_9;
1660 else if (font_norm == "iso8859-15")
1661 font_norm_type = ISO_8859_15;
1663 font_norm_type = OTHER_ENCODING;
1667 string const LyXRC::getDescription(LyXRCTags tag)
1672 case RC_FONT_ENCODING:
1673 str = N_("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1677 str = N_("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1680 case RC_PRINT_COMMAND:
1681 str = N_("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1684 case RC_PRINTEVENPAGEFLAG:
1685 str = N_("The option to print only even pages.");
1688 case RC_PRINTODDPAGEFLAG:
1689 str = N_("The option to print only odd pages.");
1692 case RC_PRINTPAGERANGEFLAG:
1693 str = N_("The option for specifying a comma-separated list of pages to print.");
1696 case RC_PRINTCOPIESFLAG:
1697 str = N_("The option for specifying the number of copies to print.");
1700 case RC_PRINTCOLLCOPIESFLAG:
1701 str = N_("The option for specifying whether the copies should be collated.");
1704 case RC_PRINTREVERSEFLAG:
1705 str = N_("The option to reverse the order of the pages printed.");
1708 case RC_PRINTLANDSCAPEFLAG:
1709 str = N_("The option to print out in landscape.");
1712 case RC_PRINTPAPERFLAG:
1713 str = N_("The option to specify paper type.");
1716 case RC_PRINTPAPERDIMENSIONFLAG:
1717 str = N_("Option to specify the dimensions of the print paper.");
1720 case RC_PRINTTOPRINTER:
1721 str = N_("Option to pass to the print program to print on a specific printer.");
1724 case RC_PRINT_ADAPTOUTPUT:
1725 str = N_("Select for LyX to pass the name of the destination printer to your print command.");
1728 case RC_PRINTTOFILE:
1729 str = N_("Option to pass to the print program to print to a file.");
1732 case RC_PRINTFILEEXTENSION:
1733 str = N_("Extension of printer program output file. Usually \".ps\".");
1736 case RC_PRINTEXSTRAOPTIONS:
1737 str = N_("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1740 case RC_PRINTSPOOL_COMMAND:
1741 str = N_("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.");
1744 case RC_PRINTSPOOL_PRINTERPREFIX:
1745 str = N_("If you specify a printer name in the print dialog, the following argument is prepended along with the printer name after the spool command.");
1749 str = N_("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1752 case RC_SCREEN_ZOOM:
1753 //xgettext:no-c-format
1754 str = N_("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1757 case RC_SCREEN_FONT_SIZES:
1758 str = N_("The font sizes used for calculating the scaling of the screen fonts.");
1761 case RC_SCREEN_FONT_ROMAN:
1762 case RC_SCREEN_FONT_SANS:
1763 case RC_SCREEN_FONT_TYPEWRITER:
1764 str = N_("The screen fonts used to display the text while editing.");
1767 case RC_SCREEN_FONT_MENU:
1768 str = N_("The font for menus (and groups titles in popups).");
1771 case RC_SCREEN_FONT_POPUP:
1772 str = N_("The font for popups.");
1775 case RC_SCREEN_FONT_ENCODING:
1776 str = N_("The encoding for the screen fonts.");
1779 case RC_SCREEN_FONT_ENCODING_MENU:
1780 str = N_("The encoding for the menu/popups fonts.");
1787 str = N_("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1790 case RC_DOCUMENTPATH:
1791 str = N_("The default path for your documents.");
1794 case RC_TEMPLATEPATH:
1795 str = N_("The path that LyX will set when offering to choose a template.");
1798 case RC_TEMPDIRPATH:
1799 str = N_("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1803 str = N_("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1807 str = N_("The file where the last-files information should be stored.");
1810 case RC_AUTOREGIONDELETE:
1811 str = N_("De-select if you don't want the current selection to be replaced automatically by what you type.");
1814 case RC_AUTORESET_OPTIONS:
1815 str = N_("De-select if you don't want the class options to be reset to defaults after class change.");
1818 case RC_OVERRIDE_X_DEADKEYS:
1819 str = N_("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.");
1824 str = N_("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1828 str = N_("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1832 str = N_("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1836 case RC_KBMAP_PRIMARY:
1837 case RC_KBMAP_SECONDARY:
1838 str = N_("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.");
1841 case RC_ASCIIROFF_COMMAND:
1842 str = N_("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.");
1845 case RC_ASCII_LINELEN:
1846 str = N_("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1849 case RC_NUMLASTFILES:
1850 str = N_("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1853 case RC_CHECKLASTFILES:
1854 str = N_("Select to check whether the lastfiles still exist.");
1857 case RC_VIEWDVI_PAPEROPTION:
1858 str = N_("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1861 case RC_DEFAULT_PAPERSIZE:
1862 str = N_("Specify the default paper size.");
1868 case RC_ACCEPT_COMPOUND:
1869 str = N_("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1872 case RC_SPELL_COMMAND:
1873 str = N_("What command runs the spell checker?");
1876 case RC_USE_INP_ENC:
1877 str = N_("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.");
1880 case RC_USE_ALT_LANG:
1882 str = N_("Specify an alternate language. The default is to use the language of the document.");
1885 case RC_USE_PERS_DICT:
1887 str = N_("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1890 case RC_USE_ESC_CHARS:
1892 str = N_("Specify additional chars that can be part of a word.");
1895 case RC_SCREEN_FONT_SCALABLE:
1896 str = N_("Allow the use of scalable screen fonts? If false, LyX will use the closest existing size for a match. Use this if the scalable fonts look bad and you have many fixed size fonts.");
1899 case RC_CHKTEX_COMMAND:
1900 str = N_("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1903 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1904 str = N_("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.");
1907 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1908 str = N_("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
1911 case RC_EXIT_CONFIRMATION:
1912 str = N_("Sets whether LyX asks for a second confirmation to exit when you have changed documents. (LyX will still ask to save changed documents.)");
1915 case RC_DISPLAY_GRAPHICS:
1916 str = N_("Select how LyX will display any graphics.");
1919 case RC_DISPLAY_SHORTCUTS:
1920 str = N_("LyX continously displays names of last command executed, along with a list of defined short-cuts for it in the minibuffer. Set to false if LyX seems slow.");
1923 case RC_MAKE_BACKUP:
1924 str = N_("De-select if you don't want LyX to create backup files.");
1927 case RC_BACKUPDIR_PATH:
1928 str = N_("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.");
1931 case RC_RTL_SUPPORT:
1932 str = N_("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
1935 case RC_MARK_FOREIGN_LANGUAGE:
1936 str = N_("Select to control the highlighting of words with a language foreign to that of the document.");
1939 case RC_LANGUAGE_PACKAGE:
1940 str = N_("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
1943 case RC_LANGUAGE_GLOBAL_OPTIONS:
1944 str = N_("De-select if you don't want the language(s) used as an argument to \\documentclass.");
1947 case RC_LANGUAGE_USE_BABEL:
1948 str = N_("De-select if you don't want babel to be used when the language of the document is the default language.");
1951 case RC_LANGUAGE_AUTO_BEGIN:
1952 str = N_("Select if a language switching command is needed at the beginning of the document.");
1955 case RC_LANGUAGE_AUTO_END:
1956 str = N_("Select if a language switching command is needed at the end of the document.");
1959 case RC_LANGUAGE_COMMAND_BEGIN:
1960 str = N_("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.");
1963 case RC_LANGUAGE_COMMAND_END:
1964 str = N_("The latex command for changing back to the language of the document.");
1967 case RC_LANGUAGE_COMMAND_LOCAL:
1968 str = N_("The latex command for local changing of the language.");
1971 case RC_DATE_INSERT_FORMAT:
1972 //xgettext:no-c-format
1973 str = N_("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
1976 case RC_SHOW_BANNER:
1977 str = N_("De-select if you don't want the startup banner.");
1981 str = N_("The wheel movement factor (for mice with wheels or five button mice).");
1993 case RC_NEW_ASK_FILENAME:
1994 str = N_("This sets the behaviour if you want to be asked for a filename when creating a new document or wait until you save it and be asked then.");
1997 case RC_DEFAULT_LANGUAGE:
1998 str = N_("New documents will be assigned this language.");
2001 case RC_LABEL_INIT_LENGTH:
2002 str = N_("Maximum number of words in the initialization string for a new label");
2012 // The global instance
2015 // The global copy of the system lyxrc entries (everything except preferences)