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 { "\\autosave", LyXRC::RC_AUTOSAVE },
56 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
57 { "\\bind", LyXRC::RC_BIND },
58 { "\\bind_file", LyXRC::RC_BINDFILE },
59 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
60 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
61 { "\\converter", LyXRC::RC_CONVERTER },
62 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
63 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
64 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
65 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
66 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
67 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
68 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
69 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
70 { "\\display_shortcuts", LyXRC::RC_DISPLAY_SHORTCUTS },
71 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
72 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
73 { "\\exit_confirmation", LyXRC::RC_EXIT_CONFIRMATION },
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 { "\\new_ask_filename", LyXRC::RC_NEW_ASK_FILENAME },
93 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
94 { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS },
95 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
96 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
97 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
98 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
99 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
100 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
101 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
102 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
103 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
104 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
105 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
106 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
107 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
108 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
109 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
110 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
111 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
112 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
113 { "\\printer", LyXRC::RC_PRINTER },
114 { "\\ps_command", LyXRC::RC_PS_COMMAND },
115 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
116 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
117 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
118 { "\\screen_font_encoding_menu", LyXRC::RC_SCREEN_FONT_ENCODING_MENU },
119 { "\\screen_font_menu", LyXRC::RC_SCREEN_FONT_MENU },
120 { "\\screen_font_popup", LyXRC::RC_SCREEN_FONT_POPUP },
121 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
122 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
123 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
124 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
125 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
126 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
127 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
128 { "\\set_color", LyXRC::RC_SET_COLOR },
129 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
130 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
131 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
132 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
133 { "\\ui_file", LyXRC::RC_UIFILE },
134 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
135 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
136 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
137 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
139 { "\\use_pspell", LyXRC::RC_USE_PSPELL },
141 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
142 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
143 { "\\viewer" ,LyXRC::RC_VIEWER},
144 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
147 /* Let the range depend of the size of lyxrcTags. Alejandro 240596 */
148 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
159 void LyXRC::setDefaults() {
163 // Get printer from the environment. If fail, use default "",
164 // assuming that everything is set up correctly.
165 printer = GetEnv("PRINTER");
166 print_adapt_output = false;
167 print_command = "dvips";
168 print_evenpage_flag = "-B";
169 print_oddpage_flag = "-A";
170 print_pagerange_flag = "-pp";
171 print_copies_flag = "-c";
172 print_collcopies_flag = "-C";
173 print_reverse_flag = "-r";
174 print_landscape_flag = "-t landscape";
175 print_to_printer = "-P";
176 print_to_file = "-o ";
177 print_file_extension = ".ps";
178 print_paper_flag = "-t";
179 print_paper_dimension_flag = "-T";
180 document_path = GetEnvPath("HOME");
181 tempdir_path = "/tmp";
184 view_dvi_paper_option = "";
185 default_papersize = BufferParams::PAPER_USLETTER;
186 custom_export_format = "ps";
187 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
190 // Because a screen typically is wider than a piece of paper:
193 // Default LaTeX font size:
194 font_sizes[LyXFont::SIZE_TINY] = 5.0;
195 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
196 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
197 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
198 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
199 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
200 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
201 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
202 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
203 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
204 use_scalable_fonts = true;
205 roman_font_name = "-*-times";
206 sans_font_name = "-*-helvetica";
207 typewriter_font_name = "-*-courier";
208 menu_font_name = "-*-helvetica-bold-r";
209 popup_font_name = "-*-helvetica-medium-r";
210 font_norm = "iso8859-1";
211 font_norm_type = ISO_8859_1;
213 override_x_deadkeys = true;
215 auto_region_delete = true;
218 check_lastfiles = true;
221 exit_confirmation = true;
222 display_graphics = "mono";
223 display_shortcuts = true;
224 // Spellchecker settings:
228 isp_command = "ispell";
229 isp_accept_compound = false;
230 isp_use_input_encoding = false;
231 isp_use_alt_lang = false;
232 isp_use_pers_dict = false;
233 isp_use_esc_chars = false;
237 mark_foreign_language = true;
238 language_auto_begin = true;
239 language_auto_end = true;
240 language_global_options = true;
241 language_use_babel = true;
242 language_package = "\\usepackage{babel}";
243 language_command_begin = "\\selectlanguage{$$lang}";
244 language_command_end = "\\selectlanguage{$$lang}";
245 language_command_local = "\\foreignlanguage{$$lang}{";
246 default_language = "english";
248 new_ask_filename = false;
251 date_insert_format = "%A, %e %B %Y";
253 cursor_follows_scrollbar = false;
254 dialogs_iconify_with_main = false;
255 label_init_length = 3;
257 /// These variables are not stored on disk (perhaps they
258 // should be moved from the LyXRC class).
264 int LyXRC::ReadBindFile(string const & name)
267 string const tmp = i18nLibFileSearch("bind", name, "bind");
268 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
269 int const result = read(tmp);
271 lyxerr << "Error reading bind file: " << tmp << endl;
276 void LyXRC::readBindFileIfNeeded()
279 ReadBindFile(bind_file);
283 int LyXRC::read(string const & filename)
285 LyXLex lexrc(lyxrcTags, lyxrcCount);
286 if (lyxerr.debugging(Debug::PARSER))
287 lexrc.printTable(lyxerr);
289 lexrc.setFile(filename);
290 if (!lexrc.isOK()) return -2;
292 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
294 while (lexrc.isOK()) {
295 // By using two switches we take advantage of the compiler
296 // telling us if we have missed a LyXRCTags element in
297 // the second switch.
298 // Note that this also shows a problem with LyXLex since it
299 // helps us avoid taking advantage of the strictness of the
302 int le = lexrc.lex();
304 case LyXLex::LEX_UNDEF:
305 lexrc.printError("Unknown tag `$$Token'");
307 case LyXLex::LEX_FEOF:
311 switch (static_cast<LyXRCTags>(le)) {
312 case RC_INPUT: // Include file
315 LibFileSearch(string(),
318 lexrc.printError("Error reading "
319 "included file: "+tmp);
323 case RC_BINDFILE: // RVDK_PATCH_5
325 string const tmp(lexrc.getString());
327 // We are already in the
328 // "actually read bind file"
332 // We are still in the "just
333 // remember the name of the
341 ui_file = lexrc.getString();
345 case RC_EXIT_CONFIRMATION:
347 exit_confirmation = lexrc.getBool();
350 case RC_DISPLAY_GRAPHICS:
352 display_graphics = lexrc.getString();
355 case RC_DISPLAY_SHORTCUTS:
357 display_shortcuts = lexrc.getBool();
362 use_kbmap = lexrc.getBool();
365 case RC_KBMAP_PRIMARY:
367 string const kmap(lexrc.getString());
370 } else if (!LibFileSearch("kbd", kmap,
372 primary_kbmap = kmap;
374 lexrc.printError("LyX: Keymap `$$Token' not found");
378 case RC_KBMAP_SECONDARY:
380 string const kmap(lexrc.getString());
383 } else if (!LibFileSearch("kbd", kmap,
385 secondary_kbmap = kmap;
387 lexrc.printError("LyX: Keymap `$$Token' not found");
391 case RC_FONT_ENCODING:
393 fontenc = lexrc.getString();
398 printer = lexrc.getString();
401 case RC_PRINT_COMMAND:
403 print_command = lexrc.getString();
406 case RC_PRINTEVENPAGEFLAG:
408 print_evenpage_flag = lexrc.getString();
411 case RC_PRINTODDPAGEFLAG:
413 print_oddpage_flag = lexrc.getString();
416 case RC_PRINTPAGERANGEFLAG:
418 print_pagerange_flag = lexrc.getString();
421 case RC_PRINTCOPIESFLAG:
423 print_copies_flag = lexrc.getString();
426 case RC_PRINTCOLLCOPIESFLAG:
428 print_collcopies_flag = lexrc.getString();
431 case RC_PRINTREVERSEFLAG:
433 print_reverse_flag = lexrc.getString();
436 case RC_PRINTLANDSCAPEFLAG:
438 print_landscape_flag = lexrc.getString();
441 case RC_PRINTTOPRINTER:
443 print_to_printer = lexrc.getString();
446 case RC_PRINT_ADAPTOUTPUT:
448 print_adapt_output = lexrc.getBool();
453 print_to_file = lexrc.getString();
456 case RC_PRINTFILEEXTENSION:
458 print_file_extension = lexrc.getString();
461 case RC_PRINTEXSTRAOPTIONS:
463 print_extra_options = lexrc.getString();
466 case RC_PRINTSPOOL_COMMAND:
468 print_spool_command = lexrc.getString();
471 case RC_PRINTSPOOL_PRINTERPREFIX:
473 print_spool_printerprefix = lexrc.getString();
476 case RC_PRINTPAPERDIMENSIONFLAG:
478 print_paper_dimension_flag = lexrc.getString();
481 case RC_PRINTPAPERFLAG:
483 print_paper_flag = lexrc.getString();
486 case RC_CUSTOM_EXPORT_COMMAND:
488 custom_export_command = lexrc.getString();
491 case RC_CUSTOM_EXPORT_FORMAT:
493 custom_export_format = lexrc.getString();
496 case RC_DEFAULT_PAPERSIZE:
499 lowercase(lexrc.getString());
500 if (size == "usletter")
502 BufferParams::PAPER_USLETTER;
503 else if (size == "legal")
505 BufferParams::PAPER_LEGALPAPER;
506 else if (size == "executive")
508 BufferParams::PAPER_EXECUTIVEPAPER;
509 else if (size == "a3")
511 BufferParams::PAPER_A3PAPER;
512 else if (size == "a4")
514 BufferParams::PAPER_A4PAPER;
515 else if (size == "a5")
517 BufferParams::PAPER_A5PAPER;
518 else if (size == "b5")
520 BufferParams::PAPER_B5PAPER;
524 case RC_VIEWDVI_PAPEROPTION:
526 view_dvi_paper_option = lexrc.getString();
528 view_dvi_paper_option = "";
533 ps_command = lexrc.getString();
536 case RC_CHKTEX_COMMAND:
538 chktex_command = lexrc.getString();
543 dpi = lexrc.getInteger();
548 zoom = lexrc.getInteger();
553 wheel_jump = lexrc.getInteger();
556 case RC_SCREEN_FONT_SIZES:
558 font_sizes[LyXFont::SIZE_TINY] =
561 font_sizes[LyXFont::SIZE_SCRIPT] =
564 font_sizes[LyXFont::SIZE_FOOTNOTE] =
567 font_sizes[LyXFont::SIZE_SMALL] =
570 font_sizes[LyXFont::SIZE_NORMAL] =
573 font_sizes[LyXFont::SIZE_LARGE] =
576 font_sizes[LyXFont::SIZE_LARGER] =
579 font_sizes[LyXFont::SIZE_LARGEST] =
582 font_sizes[LyXFont::SIZE_HUGE] =
585 font_sizes[LyXFont::SIZE_HUGER] =
589 case RC_SCREEN_FONT_SCALABLE:
591 use_scalable_fonts = lexrc.getBool();
596 autosave = lexrc.getInteger();
599 case RC_DOCUMENTPATH:
601 document_path = ExpandPath(lexrc.getString());
605 case RC_TEMPLATEPATH:
607 template_path = ExpandPath(lexrc.getString());
612 tempdir_path = ExpandPath(lexrc.getString());
617 use_tempdir = lexrc.getBool();
622 lastfiles = ExpandPath(lexrc.getString());
625 case RC_NUMLASTFILES:
627 num_lastfiles = lexrc.getInteger();
630 case RC_CHECKLASTFILES:
632 check_lastfiles = lexrc.getBool();
635 case RC_SCREEN_FONT_ROMAN:
637 roman_font_name = lexrc.getString();
640 case RC_SCREEN_FONT_SANS:
642 sans_font_name = lexrc.getString();
645 case RC_SCREEN_FONT_TYPEWRITER:
647 typewriter_font_name = lexrc.getString();
650 case RC_SCREEN_FONT_MENU:
652 menu_font_name = lexrc.getString();
655 case RC_SCREEN_FONT_POPUP:
657 popup_font_name = lexrc.getString();
660 case RC_SCREEN_FONT_ENCODING:
662 font_norm = lexrc.getString();
663 set_font_norm_type();
667 case RC_SCREEN_FONT_ENCODING_MENU:
669 font_norm_menu = lexrc.getString();
674 string lyx_name, x11_name;
677 lyx_name = lexrc.getString();
679 lexrc.printError("Missing color tag.");
684 x11_name = lexrc.getString();
686 lexrc.printError("Missing color name for color : `$$Token'");
690 if (!lcolor.setColor(lyx_name, x11_name))
691 lyxerr << "Bad lyxrc set_color for "
696 case RC_AUTOREGIONDELETE:
697 // Auto region delete defaults to true
699 auto_region_delete = lexrc.getBool();
704 // we should not do an explicit binding before
705 // loading a bind file. So, in this case, load
706 // the default bind file.
707 readBindFileIfNeeded();
709 // !!!chb, dynamic key binding...
714 seq = lexrc.getString();
716 lexrc.printError("RC_BIND: Missing key sequence");
720 if (lexrc.next(true)) {
721 cmd = lexrc.getString();
723 lexrc.printError("RC_BIND: missing command");
727 if ((action = lyxaction.LookupFunc(cmd))>= 0) {
728 if (lyxerr.debugging(Debug::LYXRC)) {
729 lyxerr << "RC_BIND: Sequence `"
730 << seq << "' Command `"
731 << cmd << "' Action `"
732 << action << '\'' << endl;
734 res = toplevel_keymap->bind(seq, action);
736 && lyxerr.debugging(Debug::LYXRC)) {
739 "Invalid key sequence `"
742 } else {// cmd is the last token read.
744 "Unknown LyX function `$$Token'");
748 case RC_OVERRIDE_X_DEADKEYS:
750 override_x_deadkeys = lexrc.getBool();
755 lyxpipes = ExpandPath(lexrc.getString());
758 case RC_CURSOR_FOLLOWS_SCROLLBAR:
760 cursor_follows_scrollbar = lexrc.getBool();
763 case RC_DIALOGS_ICONIFY_WITH_MAIN:
765 dialogs_iconify_with_main = lexrc.getBool();
768 case RC_ASCIIROFF_COMMAND:
770 ascii_roff_command = lexrc.getString();
772 case RC_ASCII_LINELEN:
774 ascii_linelen = lexrc.getInteger();
776 // Spellchecker settings:
780 use_pspell = lexrc.getBool();
783 case RC_SPELL_COMMAND:
785 isp_command = lexrc.getString();
787 case RC_ACCEPT_COMPOUND:
789 isp_accept_compound = lexrc.getBool();
793 isp_use_input_encoding = lexrc.getBool();
795 case RC_USE_ALT_LANG:
797 isp_use_alt_lang = lexrc.getBool();
799 case RC_USE_PERS_DICT:
801 isp_use_pers_dict = lexrc.getBool();
803 case RC_USE_ESC_CHARS:
805 isp_use_esc_chars = lexrc.getBool();
809 isp_alt_lang = lexrc.getString();
813 isp_pers_dict = lexrc.getString();
817 isp_esc_chars = lexrc.getString();
821 make_backup = lexrc.getBool();
823 case RC_BACKUPDIR_PATH:
825 backupdir_path = ExpandPath(lexrc.getString());
827 case RC_DATE_INSERT_FORMAT:
829 date_insert_format = lexrc.getString();
831 case RC_LANGUAGE_PACKAGE:
833 language_package = lexrc.getString();
835 case RC_LANGUAGE_AUTO_BEGIN:
837 language_auto_begin = lexrc.getBool();
839 case RC_LANGUAGE_AUTO_END:
841 language_auto_end = lexrc.getBool();
843 case RC_LANGUAGE_GLOBAL_OPTIONS:
845 language_global_options = lexrc.getBool();
847 case RC_LANGUAGE_USE_BABEL:
849 language_use_babel = lexrc.getBool();
851 case RC_LANGUAGE_COMMAND_BEGIN:
853 language_command_begin = lexrc.getString();
855 case RC_LANGUAGE_COMMAND_END:
857 language_command_end = lexrc.getString();
859 case RC_LANGUAGE_COMMAND_LOCAL:
861 language_command_local = lexrc.getString();
865 rtl_support = lexrc.getBool();
869 auto_number = lexrc.getBool();
871 case RC_MARK_FOREIGN_LANGUAGE:
873 mark_foreign_language = lexrc.getBool();
877 show_banner = lexrc.getBool();
880 case RC_NEW_ASK_FILENAME:
882 new_ask_filename = lexrc.getBool();
885 string from, to, command, flags;
887 from = lexrc.getString();
889 to = lexrc.getString();
891 command = lexrc.getString();
893 flags = lexrc.getString();
894 if (command.empty() || command == "none")
895 converters.erase(from, to);
897 converters.add(from, to, command, flags);
901 string format, command;
903 format = lexrc.getString();
905 command = lexrc.getString();
906 formats.setViewer(format, command);
910 string format, extension, prettyname, shortcut;
912 format = lexrc.getString();
914 extension = lexrc.getString();
916 prettyname = lexrc.getString();
918 shortcut = lexrc.getString();
919 if (prettyname.empty()) {
920 if (converters.formatIsUsed(format))
921 lyxerr << "Can't delete format "
924 formats.erase(format);
927 formats.add(format, extension, prettyname,
931 case RC_DEFAULT_LANGUAGE:
933 default_language = lexrc.getString();
936 case RC_LABEL_INIT_LENGTH:
938 label_init_length = lexrc.getInteger();
941 case RC_LAST: break; // this is just a dummy
945 /// Update converters data-structures
946 converters.update(formats);
947 converters.buildGraph();
953 void LyXRC::write(string const & filename) const
955 ofstream ofs(filename.c_str());
961 void LyXRC::print() const
963 if (lyxerr.debugging())
970 void LyXRC::output(ostream & os) const
972 os << "### This file is part of\n"
973 << "### ========================================================\n"
974 << "### LyX, The Document Processor\n"
976 << "### Copyright 1995 Matthias Ettrich\n"
977 << "### Copyright 1995-2001 The LyX Team.\n"
979 << "### ========================================================\n"
981 << "# This file is written by LyX, if you want to make your own\n"
982 << "# modifications you should do them from inside LyX and save\n"
985 // Why the switch you might ask. It is a trick to ensure that all
986 // the elements in the LyXRCTags enum is handled. As you can see
987 // there are no breaks at all. So it is just a huge fall-through.
988 // The nice thing is that we will get a warning from the compiler
989 // if we forget an element.
990 LyXRCTags tag = RC_LAST;
994 // input/include files are not done here
996 // bindings is not written to the preferences file.
998 if (bind_file != system_lyxrc.bind_file) {
999 os << "\\bind_file " << bind_file << "\n";
1005 << "# MISC SECTION ######################################\n"
1008 case RC_SHOW_BANNER:
1009 if (show_banner != system_lyxrc.show_banner) {
1010 os << "# Set to false to inhibit the startup banner.\n"
1011 << "\\show_banner " << tostr(show_banner) << "\n";
1013 // bind files are not done here.
1015 if (ui_file != system_lyxrc.ui_file) {
1016 os << "\\ui_file \"" << ui_file << "\"\n";
1018 case RC_AUTOREGIONDELETE:
1019 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1020 os << "# Set to false to inhibit automatic replacement of\n"
1021 << "# the current selection.\n"
1022 << "\\auto_region_delete " << tostr(auto_region_delete)
1026 if (autosave != system_lyxrc.autosave) {
1027 os << "# The time interval between auto-saves in seconds.\n"
1028 << "\\autosave " << autosave << "\n";
1030 case RC_EXIT_CONFIRMATION:
1031 if (exit_confirmation != system_lyxrc.exit_confirmation) {
1032 os << "# Ask for confirmation before exit if there are\n"
1033 << "# unsaved changed documents.\n"
1034 << "\\exit_confirmation " << tostr(exit_confirmation)
1037 case RC_DISPLAY_GRAPHICS:
1038 if (display_graphics != system_lyxrc.display_graphics) {
1039 os << "# Display graphics within LyX\n"
1040 << "# no|mono|gray|color\n"
1041 << "\\display_graphics " << display_graphics
1045 case RC_DISPLAY_SHORTCUTS:
1046 if (display_shortcuts != system_lyxrc.display_shortcuts) {
1047 os << "# Display name of the last command executed,\n"
1048 << "# with a list of short-cuts in the minibuffer.\n"
1049 << "\\display_shortcuts " << tostr(display_shortcuts)
1052 case RC_VIEWDVI_PAPEROPTION:
1053 if (view_dvi_paper_option
1054 != system_lyxrc.view_dvi_paper_option) {
1055 os << "# Options used to specify paper size to the\n"
1056 << "# view_dvi_command (e.g. -paper)\n"
1057 << "\\view_dvi_paper_option \""
1058 << view_dvi_paper_option << "\"\n";
1060 case RC_DEFAULT_PAPERSIZE:
1061 if (default_papersize != system_lyxrc.default_papersize) {
1062 os << "# The default papersize to use.\n"
1063 << "\\default_papersize \"";
1064 switch (default_papersize) {
1065 case BufferParams::PAPER_USLETTER:
1066 os << "usletter"; break;
1067 case BufferParams::PAPER_LEGALPAPER:
1068 os << "legal"; break;
1069 case BufferParams::PAPER_EXECUTIVEPAPER:
1070 os << "executive"; break;
1071 case BufferParams::PAPER_A3PAPER:
1073 case BufferParams::PAPER_A4PAPER:
1075 case BufferParams::PAPER_A5PAPER:
1077 case BufferParams::PAPER_B5PAPER:
1079 case BufferParams::PAPER_DEFAULT: break;
1084 if (ps_command != system_lyxrc.ps_command) {
1085 os << "# Program used for interpreting postscript.\n"
1086 << "\\ps_command \"" << ps_command << "\"\n";
1088 case RC_CHKTEX_COMMAND:
1089 if (chktex_command != system_lyxrc.chktex_command) {
1090 os << "\\chktex_command \"" << chktex_command << "\"\n";
1093 if (use_kbmap != system_lyxrc.use_kbmap) {
1094 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1096 case RC_KBMAP_PRIMARY:
1097 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1098 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1100 case RC_KBMAP_SECONDARY:
1101 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1102 os << "\\kbmap_secondary \"" << secondary_kbmap
1106 if (lyxpipes != system_lyxrc.lyxpipes) {
1107 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1109 case RC_DATE_INSERT_FORMAT:
1110 if (date_insert_format != system_lyxrc.date_insert_format) {
1111 os << "\\date_insert_format \"" << date_insert_format
1114 case RC_LABEL_INIT_LENGTH:
1115 if (label_init_length != system_lyxrc.label_init_length) {
1116 os << "\\label_init_length " << label_init_length
1121 << "# SCREEN & FONTS SECTION ############################\n"
1125 if (dpi != system_lyxrc.dpi) {
1126 os << "\\screen_dpi " << dpi << "\n";
1128 case RC_SCREEN_ZOOM:
1129 if (zoom != system_lyxrc.zoom) {
1130 os << "\\screen_zoom " << zoom << "\n";
1133 if (wheel_jump != system_lyxrc.wheel_jump) {
1134 os << "\\wheel_jump " << wheel_jump << "\n";
1136 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1137 if (cursor_follows_scrollbar
1138 != system_lyxrc.cursor_follows_scrollbar) {
1139 os << "\\cursor_follows_scrollbar "
1140 << tostr(cursor_follows_scrollbar) << "\n";
1142 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1143 if (dialogs_iconify_with_main
1144 != system_lyxrc.dialogs_iconify_with_main) {
1145 os << "\\dialogs_iconify_with_main "
1146 << tostr(dialogs_iconify_with_main) << "\n";
1148 case RC_SCREEN_FONT_ROMAN:
1149 if (roman_font_name != system_lyxrc.roman_font_name) {
1150 os << "\\screen_font_roman \"" << roman_font_name
1153 case RC_SCREEN_FONT_SANS:
1154 if (sans_font_name != system_lyxrc.sans_font_name) {
1155 os << "\\screen_font_sans \"" << sans_font_name
1158 case RC_SCREEN_FONT_TYPEWRITER:
1159 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1160 os << "\\screen_font_typewriter \""
1161 << typewriter_font_name << "\"\n";
1163 case RC_SCREEN_FONT_SCALABLE:
1164 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1165 os << "\\screen_font_scalable "
1166 << tostr(use_scalable_fonts)
1169 case RC_SCREEN_FONT_ENCODING:
1170 if (font_norm != system_lyxrc.font_norm) {
1171 os << "\\screen_font_encoding \"" << font_norm
1174 case RC_SCREEN_FONT_POPUP:
1175 if (popup_font_name != system_lyxrc.popup_font_name) {
1176 os << "\\screen_font_popup \"" << popup_font_name
1179 case RC_SCREEN_FONT_MENU:
1180 if (menu_font_name != system_lyxrc.menu_font_name) {
1181 os << "\\screen_font_menu \"" << menu_font_name
1184 case RC_SCREEN_FONT_SIZES:
1185 if (font_sizes[LyXFont::SIZE_TINY]
1186 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1187 font_sizes[LyXFont::SIZE_SCRIPT]
1188 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1189 font_sizes[LyXFont::SIZE_FOOTNOTE]
1190 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1191 font_sizes[LyXFont::SIZE_SMALL]
1192 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1193 font_sizes[LyXFont::SIZE_NORMAL]
1194 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1195 font_sizes[LyXFont::SIZE_LARGE]
1196 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1197 font_sizes[LyXFont::SIZE_LARGER]
1198 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1199 font_sizes[LyXFont::SIZE_LARGEST]
1200 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1201 font_sizes[LyXFont::SIZE_HUGE]
1202 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1203 font_sizes[LyXFont::SIZE_HUGER]
1204 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1205 os.setf(ios::fixed);
1207 os << "\\screen_font_sizes"
1208 << " " << font_sizes[LyXFont::SIZE_TINY]
1209 << " " << font_sizes[LyXFont::SIZE_SCRIPT]
1210 << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]
1211 << " " << font_sizes[LyXFont::SIZE_SMALL]
1212 << " " << font_sizes[LyXFont::SIZE_NORMAL]
1213 << " " << font_sizes[LyXFont::SIZE_LARGE]
1214 << " " << font_sizes[LyXFont::SIZE_LARGER]
1215 << " " << font_sizes[LyXFont::SIZE_LARGEST]
1216 << " " << font_sizes[LyXFont::SIZE_HUGE]
1217 << " " << font_sizes[LyXFont::SIZE_HUGER]
1222 << "# COLOR SECTION ###################################\n"
1226 for (int i = 0; i < LColor::ignore; ++i ) {
1227 LColor::color lc = static_cast<LColor::color>(i);
1229 string const col(lcolor.getX11Name(lc));
1230 if (col != system_lcolor.getX11Name(lc)) {
1231 os << "\\set_color \""
1232 << lcolor.getLyXName(lc) << "\" \""
1238 << "# PRINTER SECTION ###################################\n"
1242 if (printer != system_lyxrc.printer) {
1243 os << "\\printer \"" << printer << "\"\n";
1245 case RC_PRINT_ADAPTOUTPUT:
1246 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1247 os << "\\print_adapt_output "
1248 << tostr(print_adapt_output)
1251 case RC_PRINT_COMMAND:
1252 if (print_command != system_lyxrc.print_command) {
1253 os << "\\print_command \"" << print_command << "\"\n";
1255 case RC_PRINTEXSTRAOPTIONS:
1256 if (print_extra_options != system_lyxrc.print_extra_options) {
1257 os << "\\print_extra_options \"" << print_extra_options
1260 case RC_PRINTSPOOL_COMMAND:
1261 if (print_spool_command != system_lyxrc.print_spool_command) {
1262 os << "\\print_spool_command \"" << print_spool_command
1265 case RC_PRINTSPOOL_PRINTERPREFIX:
1266 if (print_spool_printerprefix
1267 != system_lyxrc.print_spool_printerprefix) {
1268 os << "\\print_spool_printerprefix \""
1269 << print_spool_printerprefix << "\"\n";
1271 case RC_PRINTEVENPAGEFLAG:
1272 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1273 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1276 case RC_PRINTODDPAGEFLAG:
1277 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1278 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1281 case RC_PRINTREVERSEFLAG:
1282 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1283 os << "\\print_reverse_flag \"" << print_reverse_flag
1286 case RC_PRINTLANDSCAPEFLAG:
1287 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1288 os << "\\print_landscape_flag \"" << print_landscape_flag
1291 case RC_PRINTPAGERANGEFLAG:
1292 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1293 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1296 case RC_PRINTCOPIESFLAG:
1297 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1298 os << "\\print_copies_flag \"" << print_copies_flag
1301 case RC_PRINTCOLLCOPIESFLAG:
1302 if (print_collcopies_flag
1303 != system_lyxrc.print_collcopies_flag) {
1304 os << "\\print_collcopies_flag \""
1305 << print_collcopies_flag
1308 case RC_PRINTPAPERFLAG:
1309 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1310 os << "\\print_paper_flag \"" << print_paper_flag
1313 case RC_PRINTPAPERDIMENSIONFLAG:
1314 if (print_paper_dimension_flag
1315 != system_lyxrc.print_paper_dimension_flag) {
1316 os << "\\print_paper_dimension_flag \""
1317 << print_paper_dimension_flag << "\"\n";
1319 case RC_PRINTTOPRINTER:
1320 if (print_to_printer != system_lyxrc.print_to_printer) {
1321 os << "\\print_to_printer \"" << print_to_printer
1324 case RC_PRINTTOFILE:
1325 if (print_to_file != system_lyxrc.print_to_file) {
1326 os << "\\print_to_file \"" << print_to_file << "\"\n";
1328 case RC_PRINTFILEEXTENSION:
1329 if (print_file_extension != system_lyxrc.print_file_extension) {
1330 os << "\\print_file_extension \""
1331 << print_file_extension
1336 << "# EXPORT SECTION ####################################\n"
1339 case RC_CUSTOM_EXPORT_COMMAND:
1340 if (custom_export_command
1341 != system_lyxrc.custom_export_command) {
1342 os << "\\custom_export_command \""
1343 << custom_export_command
1346 case RC_CUSTOM_EXPORT_FORMAT:
1347 if (custom_export_format
1348 != system_lyxrc.custom_export_format) {
1349 os << "\\custom_export_format \"" << custom_export_format
1354 << "# TEX SECTION #######################################\n"
1357 case RC_FONT_ENCODING:
1358 if (fontenc != system_lyxrc.fontenc) {
1359 os << "\\font_encoding \"" << fontenc << "\"\n";
1363 << "# FILE SECTION ######################################\n"
1366 case RC_DOCUMENTPATH:
1367 if (document_path != system_lyxrc.document_path) {
1368 os << "\\document_path \"" << document_path << "\"\n";
1371 if (lastfiles != system_lyxrc.lastfiles) {
1372 os << "\\lastfiles \"" << lastfiles << "\"\n";
1374 case RC_NUMLASTFILES:
1375 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1376 os << "\\num_lastfiles " << num_lastfiles << "\n";
1378 case RC_CHECKLASTFILES:
1379 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1380 os << "\\check_lastfiles " << tostr(check_lastfiles)
1383 case RC_TEMPLATEPATH:
1384 if (template_path != system_lyxrc.template_path) {
1385 os << "\\template_path \"" << template_path << "\"\n";
1387 case RC_TEMPDIRPATH:
1388 if (tempdir_path != system_lyxrc.tempdir_path) {
1389 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1392 if (use_tempdir != system_lyxrc.use_tempdir) {
1393 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1395 case RC_ASCII_LINELEN:
1396 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1397 os << "\\ascii_linelen " << ascii_linelen << "\n";
1399 case RC_MAKE_BACKUP:
1400 if (make_backup != system_lyxrc.make_backup) {
1401 os << "\\make_backup " << tostr(make_backup) << "\n";
1403 case RC_BACKUPDIR_PATH:
1404 if (backupdir_path != system_lyxrc.backupdir_path) {
1405 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1409 << "# ASCII EXPORT SECTION ##############################\n"
1412 case RC_ASCIIROFF_COMMAND:
1413 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1414 os << "\\ascii_roff_command \"" << ascii_roff_command
1419 << "# SPELLCHECKER SECTION ##############################\n"
1423 if (use_pspell != system_lyxrc.use_pspell) {
1424 os << "\\use_pspell \"" << use_pspell << "\"\n";
1427 case RC_SPELL_COMMAND:
1428 if (isp_command != system_lyxrc.isp_command) {
1429 os << "\\spell_command \"" << isp_command << "\"\n";
1431 case RC_ACCEPT_COMPOUND:
1432 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1433 os << "\\accept_compound " << tostr(isp_accept_compound)
1436 case RC_USE_ALT_LANG:
1437 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1438 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1442 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1443 os << "\\alternate_language \"" << isp_alt_lang
1446 case RC_USE_ESC_CHARS:
1447 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1448 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1452 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1453 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1455 case RC_USE_PERS_DICT:
1456 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1457 os << "\\use_personal_dictionary "
1458 << tostr(isp_use_pers_dict)
1462 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1463 os << "\\personal_dictionary \"" << isp_pers_dict
1466 case RC_USE_INP_ENC:
1467 if (isp_use_input_encoding
1468 != system_lyxrc.isp_use_input_encoding) {
1469 os << "\\use_input_encoding "
1470 << tostr(isp_use_input_encoding)
1475 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1478 case RC_RTL_SUPPORT:
1479 if (rtl_support != system_lyxrc.rtl_support) {
1480 os << "\\rtl " << tostr(rtl_support) << "\n";
1482 case RC_LANGUAGE_PACKAGE:
1483 if (language_package != system_lyxrc.language_package) {
1484 os << "\\language_package \"" << language_package
1487 case RC_LANGUAGE_GLOBAL_OPTIONS:
1488 if (language_global_options
1489 != system_lyxrc.language_global_options) {
1490 os << "\\language_global_options \""
1491 << tostr(language_global_options)
1494 case RC_LANGUAGE_USE_BABEL:
1495 if (language_use_babel != system_lyxrc.language_use_babel) {
1496 os << "\\language_use_babel \""
1497 << tostr(language_use_babel)
1500 case RC_LANGUAGE_COMMAND_BEGIN:
1501 if (language_command_begin
1502 != system_lyxrc.language_command_begin) {
1503 os << "\\language_command_begin \""
1504 << language_command_begin
1507 case RC_LANGUAGE_COMMAND_END:
1508 if (language_command_end
1509 != system_lyxrc.language_command_end) {
1510 os << "\\language_command_end \"" << language_command_end
1513 case RC_LANGUAGE_COMMAND_LOCAL:
1514 if (language_command_local
1515 != system_lyxrc.language_command_local) {
1516 os << "\\language_command_local \""
1517 << language_command_local
1520 case RC_LANGUAGE_AUTO_BEGIN:
1521 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1522 os << "\\language_auto_begin "
1523 << tostr(language_auto_begin) << "\n";
1525 case RC_LANGUAGE_AUTO_END:
1526 if (language_auto_end != system_lyxrc.language_auto_end) {
1527 os << "\\language_auto_end "
1528 << tostr(language_auto_end) << "\n";
1530 case RC_MARK_FOREIGN_LANGUAGE:
1531 if (mark_foreign_language
1532 != system_lyxrc.mark_foreign_language) {
1533 os << "\\mark_foreign_language " <<
1534 tostr(mark_foreign_language) << "\n";
1538 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1541 case RC_OVERRIDE_X_DEADKEYS:
1542 if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) {
1543 os << "\\override_x_deadkeys "
1544 << tostr(override_x_deadkeys) << "\n";
1546 case RC_SCREEN_FONT_ENCODING_MENU:
1547 if (font_norm_menu != system_lyxrc.font_norm_menu) {
1548 os << "\\screen_font_encoding_menu \"" << font_norm_menu
1551 case RC_AUTO_NUMBER:
1552 if (auto_number != system_lyxrc.auto_number) {
1553 os << "\\auto_number " << tostr(auto_number) << "\n";
1555 case RC_NEW_ASK_FILENAME:
1556 if (new_ask_filename != system_lyxrc.new_ask_filename) {
1557 os << "\\new_ask_filename " << tostr(new_ask_filename)
1560 case RC_DEFAULT_LANGUAGE:
1561 if (default_language != system_lyxrc.default_language) {
1562 os << "\\default_language " << default_language << "\n";
1566 << "# FORMATS SECTION ##########################\n"
1570 // Look for deleted formats
1571 for (Formats::const_iterator cit = formats.begin();
1572 cit != formats.end(); ++cit) {
1573 Format const * format =
1574 system_formats.getFormat(cit->name());
1576 format->extension() != cit->extension() ||
1577 format->prettyname() != cit->prettyname() ||
1578 format->shortcut() != cit->shortcut())
1579 os << "\\format \"" << cit->name() << "\" \""
1580 << cit->extension() << "\" \""
1581 << cit->prettyname() << "\" \""
1582 << cit->shortcut() << "\"\n";
1585 // New/modifed formats
1586 for (Formats::const_iterator cit = system_formats.begin();
1587 cit != system_formats.end(); ++cit)
1588 if (!formats.getFormat(cit->name()))
1589 os << "\\format \"" << cit->name()
1590 << "\" \"\" \"\" \"\"\n";
1592 for (Formats::const_iterator cit = formats.begin();
1593 cit != formats.end(); ++cit) {
1594 Format const * format =
1595 system_formats.getFormat(cit->name());
1596 if ((!format || format->viewer() != cit->viewer()) &&
1597 (format || !cit->viewer().empty()))
1598 os << "\\viewer \"" << cit->name() << "\" \""
1599 << cit->viewer() << "\"\n";
1603 << "# CONVERTERS SECTION ##########################\n"
1607 // Look for new converters
1608 for (Converters::const_iterator cit = converters.begin();
1609 cit != converters.end(); ++cit) {
1610 Converter const * converter =
1611 system_converters.getConverter(cit->from,
1614 converter->command != cit->command ||
1615 converter->flags != cit->flags)
1616 os << "\\converter \"" << cit->from << "\" \""
1617 << cit->to << "\" \""
1618 << cit->command << "\" \""
1619 << cit->flags << "\"\n";
1622 // New/modifed converters
1623 for (Converters::const_iterator cit = system_converters.begin();
1624 cit != system_converters.end(); ++cit)
1625 if (!converters.getConverter(cit->from, cit->to))
1626 os << "\\converter \"" << cit->from
1627 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1632 void LyXRC::set_font_norm_type()
1634 if (font_norm == "iso10646-1")
1635 font_norm_type = ISO_10646_1;
1636 else if (font_norm == "iso8859-1")
1637 font_norm_type = ISO_8859_1;
1638 else if (font_norm == "iso8859-6.8x")
1639 font_norm_type = ISO_8859_6_8;
1640 else if (font_norm == "iso8859-9")
1641 font_norm_type = ISO_8859_9;
1642 else if (font_norm == "iso8859-15")
1643 font_norm_type = ISO_8859_15;
1645 font_norm_type = OTHER_ENCODING;
1649 string const LyXRC::getDescription(LyXRCTags tag)
1654 case RC_FONT_ENCODING:
1655 str = N_("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1659 str = N_("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1662 case RC_PRINT_COMMAND:
1663 str = N_("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1666 case RC_PRINTEVENPAGEFLAG:
1667 str = N_("The option to print only even pages.");
1670 case RC_PRINTODDPAGEFLAG:
1671 str = N_("The option to print only odd pages.");
1674 case RC_PRINTPAGERANGEFLAG:
1675 str = N_("The option for specifying a comma-separated list of pages to print.");
1678 case RC_PRINTCOPIESFLAG:
1679 str = N_("The option for specifying the number of copies to print.");
1682 case RC_PRINTCOLLCOPIESFLAG:
1683 str = N_("The option for specifying whether the copies should be collated.");
1686 case RC_PRINTREVERSEFLAG:
1687 str = N_("The option to reverse the order of the pages printed.");
1690 case RC_PRINTLANDSCAPEFLAG:
1691 str = N_("The option to print out in landscape.");
1694 case RC_PRINTPAPERFLAG:
1695 str = N_("The option to specify paper type.");
1698 case RC_PRINTPAPERDIMENSIONFLAG:
1699 str = N_("Option to specify the dimensions of the print paper.");
1702 case RC_PRINTTOPRINTER:
1703 str = N_("Option to pass to the print program to print on a specific printer.");
1706 case RC_PRINT_ADAPTOUTPUT:
1707 str = N_("Select for LyX to pass the name of the destination printer to your print command.");
1710 case RC_PRINTTOFILE:
1711 str = N_("Option to pass to the print program to print to a file.");
1714 case RC_PRINTFILEEXTENSION:
1715 str = N_("Extension of printer program output file. Usually \".ps\".");
1718 case RC_PRINTEXSTRAOPTIONS:
1719 str = N_("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1722 case RC_PRINTSPOOL_COMMAND:
1723 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.");
1726 case RC_PRINTSPOOL_PRINTERPREFIX:
1727 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.");
1731 str = N_("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1734 case RC_SCREEN_ZOOM:
1735 //xgettext:no-c-format
1736 str = N_("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1739 case RC_SCREEN_FONT_SIZES:
1740 str = N_("The font sizes used for calculating the scaling of the screen fonts.");
1743 case RC_SCREEN_FONT_ROMAN:
1744 case RC_SCREEN_FONT_SANS:
1745 case RC_SCREEN_FONT_TYPEWRITER:
1746 str = N_("The screen fonts used to display the text while editing.");
1749 case RC_SCREEN_FONT_MENU:
1750 str = N_("The font for menus (and groups titles in popups).");
1753 case RC_SCREEN_FONT_POPUP:
1754 str = N_("The font for popups.");
1757 case RC_SCREEN_FONT_ENCODING:
1758 str = N_("The encoding for the screen fonts.");
1761 case RC_SCREEN_FONT_ENCODING_MENU:
1762 str = N_("The encoding for the menu/popups fonts.");
1769 str = N_("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1772 case RC_DOCUMENTPATH:
1773 str = N_("The default path for your documents.");
1776 case RC_TEMPLATEPATH:
1777 str = N_("The path that LyX will set when offering to choose a template.");
1780 case RC_TEMPDIRPATH:
1781 str = N_("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1785 str = N_("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1789 str = N_("The file where the last-files information should be stored.");
1792 case RC_AUTOREGIONDELETE:
1793 str = N_("De-select if you don't want the current selection to be replaced automatically by what you type.");
1796 case RC_OVERRIDE_X_DEADKEYS:
1797 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.");
1802 str = N_("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1806 str = N_("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1810 str = N_("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1814 case RC_KBMAP_PRIMARY:
1815 case RC_KBMAP_SECONDARY:
1816 str = 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.");
1819 case RC_ASCIIROFF_COMMAND:
1820 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.");
1823 case RC_ASCII_LINELEN:
1824 str = N_("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1827 case RC_NUMLASTFILES:
1828 str = N_("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1831 case RC_CHECKLASTFILES:
1832 str = N_("Select to check whether the lastfiles still exist.");
1835 case RC_VIEWDVI_PAPEROPTION:
1836 str = N_("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1839 case RC_DEFAULT_PAPERSIZE:
1840 str = N_("Specify the default paper size.");
1846 case RC_ACCEPT_COMPOUND:
1847 str = N_("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1850 case RC_SPELL_COMMAND:
1851 str = N_("What command runs the spell checker?");
1854 case RC_USE_INP_ENC:
1855 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.");
1858 case RC_USE_ALT_LANG:
1860 str = N_("Specify an alternate language. The default is to use the language of the document.");
1863 case RC_USE_PERS_DICT:
1865 str = N_("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1868 case RC_USE_ESC_CHARS:
1870 str = N_("Specify additional chars that can be part of a word.");
1873 case RC_SCREEN_FONT_SCALABLE:
1874 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.");
1877 case RC_CHKTEX_COMMAND:
1878 str = N_("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1881 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1882 str = 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.");
1885 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1886 str = N_("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
1889 case RC_EXIT_CONFIRMATION:
1890 str = N_("Sets whether LyX asks for a second confirmation to exit when you have changed documents. (LyX will still ask to save changed documents.)");
1893 case RC_DISPLAY_GRAPHICS:
1894 str = N_("Select how LyX will display any graphics.");
1897 case RC_DISPLAY_SHORTCUTS:
1898 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.");
1901 case RC_MAKE_BACKUP:
1902 str = N_("De-select if you don't want LyX to create backup files.");
1905 case RC_BACKUPDIR_PATH:
1906 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.");
1909 case RC_RTL_SUPPORT:
1910 str = N_("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
1913 case RC_MARK_FOREIGN_LANGUAGE:
1914 str = N_("Select to control the highlighting of words with a language foreign to that of the document.");
1917 case RC_LANGUAGE_PACKAGE:
1918 str = N_("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
1921 case RC_LANGUAGE_GLOBAL_OPTIONS:
1922 str = N_("De-select if you don't want the language(s) used as an argument to \\documentclass.");
1925 case RC_LANGUAGE_USE_BABEL:
1926 str = N_("De-select if you don't want babel to be used when the language of the document is the default language.");
1929 case RC_LANGUAGE_AUTO_BEGIN:
1930 str = N_("Select if a language switching command is needed at the beginning of the document.");
1933 case RC_LANGUAGE_AUTO_END:
1934 str = N_("Select if a language switching command is needed at the end of the document.");
1937 case RC_LANGUAGE_COMMAND_BEGIN:
1938 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.");
1941 case RC_LANGUAGE_COMMAND_END:
1942 str = N_("The latex command for changing back to the language of the document.");
1945 case RC_LANGUAGE_COMMAND_LOCAL:
1946 str = N_("The latex command for local changing of the language.");
1949 case RC_DATE_INSERT_FORMAT:
1950 //xgettext:no-c-format
1951 str = N_("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
1954 case RC_SHOW_BANNER:
1955 str = N_("De-select if you don't want the startup banner.");
1959 str = N_("The wheel movement factor (for mice with wheels or five button mice).");
1971 case RC_NEW_ASK_FILENAME:
1972 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.");
1975 case RC_DEFAULT_LANGUAGE:
1976 str = N_("New documents will be assigned this language.");
1979 case RC_LABEL_INIT_LENGTH:
1980 str = N_("Maximum number of words in the initialization string for a new label");
1990 // The global instance
1993 // The global copy of the system lyxrc entries (everything except preferences)