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_end = "\\selectlanguage{$$lang}";
247 language_command_local = "\\foreignlanguage{$$lang}{";
248 default_language = "english";
250 new_ask_filename = false;
253 date_insert_format = "%A, %e %B %Y";
255 cursor_follows_scrollbar = false;
256 dialogs_iconify_with_main = false;
257 label_init_length = 3;
259 /// These variables are not stored on disk (perhaps they
260 // should be moved from the LyXRC class).
266 int LyXRC::ReadBindFile(string const & name)
269 string const tmp = i18nLibFileSearch("bind", name, "bind");
270 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
271 int const result = read(tmp);
273 lyxerr << "Error reading bind file: " << tmp << endl;
278 void LyXRC::readBindFileIfNeeded()
281 ReadBindFile(bind_file);
285 int LyXRC::read(string const & filename)
287 LyXLex lexrc(lyxrcTags, lyxrcCount);
288 if (lyxerr.debugging(Debug::PARSER))
289 lexrc.printTable(lyxerr);
291 lexrc.setFile(filename);
292 if (!lexrc.isOK()) return -2;
294 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
296 while (lexrc.isOK()) {
297 // By using two switches we take advantage of the compiler
298 // telling us if we have missed a LyXRCTags element in
299 // the second switch.
300 // Note that this also shows a problem with LyXLex since it
301 // helps us avoid taking advantage of the strictness of the
304 int le = lexrc.lex();
306 case LyXLex::LEX_UNDEF:
307 lexrc.printError("Unknown tag `$$Token'");
309 case LyXLex::LEX_FEOF:
313 switch (static_cast<LyXRCTags>(le)) {
314 case RC_INPUT: // Include file
317 LibFileSearch(string(),
320 lexrc.printError("Error reading "
321 "included file: "+tmp);
325 case RC_BINDFILE: // RVDK_PATCH_5
327 string const tmp(lexrc.getString());
329 // We are already in the
330 // "actually read bind file"
334 // We are still in the "just
335 // remember the name of the
343 ui_file = lexrc.getString();
347 case RC_EXIT_CONFIRMATION:
349 exit_confirmation = lexrc.getBool();
352 case RC_AUTORESET_OPTIONS:
354 auto_reset_options = lexrc.getBool();
357 case RC_DISPLAY_GRAPHICS:
359 display_graphics = lexrc.getString();
362 case RC_DISPLAY_SHORTCUTS:
364 display_shortcuts = lexrc.getBool();
369 use_kbmap = lexrc.getBool();
372 case RC_KBMAP_PRIMARY:
374 string const kmap(lexrc.getString());
377 } else if (!LibFileSearch("kbd", kmap,
379 primary_kbmap = kmap;
381 lexrc.printError("LyX: Keymap `$$Token' not found");
385 case RC_KBMAP_SECONDARY:
387 string const kmap(lexrc.getString());
390 } else if (!LibFileSearch("kbd", kmap,
392 secondary_kbmap = kmap;
394 lexrc.printError("LyX: Keymap `$$Token' not found");
398 case RC_FONT_ENCODING:
400 fontenc = lexrc.getString();
405 printer = lexrc.getString();
408 case RC_PRINT_COMMAND:
410 print_command = lexrc.getString();
413 case RC_PRINTEVENPAGEFLAG:
415 print_evenpage_flag = lexrc.getString();
418 case RC_PRINTODDPAGEFLAG:
420 print_oddpage_flag = lexrc.getString();
423 case RC_PRINTPAGERANGEFLAG:
425 print_pagerange_flag = lexrc.getString();
428 case RC_PRINTCOPIESFLAG:
430 print_copies_flag = lexrc.getString();
433 case RC_PRINTCOLLCOPIESFLAG:
435 print_collcopies_flag = lexrc.getString();
438 case RC_PRINTREVERSEFLAG:
440 print_reverse_flag = lexrc.getString();
443 case RC_PRINTLANDSCAPEFLAG:
445 print_landscape_flag = lexrc.getString();
448 case RC_PRINTTOPRINTER:
450 print_to_printer = lexrc.getString();
453 case RC_PRINT_ADAPTOUTPUT:
455 print_adapt_output = lexrc.getBool();
460 print_to_file = lexrc.getString();
463 case RC_PRINTFILEEXTENSION:
465 print_file_extension = lexrc.getString();
468 case RC_PRINTEXSTRAOPTIONS:
470 print_extra_options = lexrc.getString();
473 case RC_PRINTSPOOL_COMMAND:
475 print_spool_command = lexrc.getString();
478 case RC_PRINTSPOOL_PRINTERPREFIX:
480 print_spool_printerprefix = lexrc.getString();
483 case RC_PRINTPAPERDIMENSIONFLAG:
485 print_paper_dimension_flag = lexrc.getString();
488 case RC_PRINTPAPERFLAG:
490 print_paper_flag = lexrc.getString();
493 case RC_CUSTOM_EXPORT_COMMAND:
495 custom_export_command = lexrc.getString();
498 case RC_CUSTOM_EXPORT_FORMAT:
500 custom_export_format = lexrc.getString();
503 case RC_DEFAULT_PAPERSIZE:
506 lowercase(lexrc.getString());
507 if (size == "usletter")
509 BufferParams::PAPER_USLETTER;
510 else if (size == "legal")
512 BufferParams::PAPER_LEGALPAPER;
513 else if (size == "executive")
515 BufferParams::PAPER_EXECUTIVEPAPER;
516 else if (size == "a3")
518 BufferParams::PAPER_A3PAPER;
519 else if (size == "a4")
521 BufferParams::PAPER_A4PAPER;
522 else if (size == "a5")
524 BufferParams::PAPER_A5PAPER;
525 else if (size == "b5")
527 BufferParams::PAPER_B5PAPER;
531 case RC_VIEWDVI_PAPEROPTION:
533 view_dvi_paper_option = lexrc.getString();
535 view_dvi_paper_option = "";
540 ps_command = lexrc.getString();
543 case RC_CHKTEX_COMMAND:
545 chktex_command = lexrc.getString();
550 dpi = lexrc.getInteger();
555 zoom = lexrc.getInteger();
560 wheel_jump = lexrc.getInteger();
563 case RC_SCREEN_FONT_SIZES:
565 font_sizes[LyXFont::SIZE_TINY] =
568 font_sizes[LyXFont::SIZE_SCRIPT] =
571 font_sizes[LyXFont::SIZE_FOOTNOTE] =
574 font_sizes[LyXFont::SIZE_SMALL] =
577 font_sizes[LyXFont::SIZE_NORMAL] =
580 font_sizes[LyXFont::SIZE_LARGE] =
583 font_sizes[LyXFont::SIZE_LARGER] =
586 font_sizes[LyXFont::SIZE_LARGEST] =
589 font_sizes[LyXFont::SIZE_HUGE] =
592 font_sizes[LyXFont::SIZE_HUGER] =
596 case RC_SCREEN_FONT_SCALABLE:
598 use_scalable_fonts = lexrc.getBool();
603 autosave = lexrc.getInteger();
606 case RC_DOCUMENTPATH:
608 document_path = ExpandPath(lexrc.getString());
612 case RC_TEMPLATEPATH:
614 template_path = ExpandPath(lexrc.getString());
619 tempdir_path = ExpandPath(lexrc.getString());
624 use_tempdir = lexrc.getBool();
629 lastfiles = ExpandPath(lexrc.getString());
632 case RC_NUMLASTFILES:
634 num_lastfiles = lexrc.getInteger();
637 case RC_CHECKLASTFILES:
639 check_lastfiles = lexrc.getBool();
642 case RC_SCREEN_FONT_ROMAN:
644 roman_font_name = lexrc.getString();
647 case RC_SCREEN_FONT_SANS:
649 sans_font_name = lexrc.getString();
652 case RC_SCREEN_FONT_TYPEWRITER:
654 typewriter_font_name = lexrc.getString();
657 case RC_SCREEN_FONT_MENU:
659 menu_font_name = lexrc.getString();
662 case RC_SCREEN_FONT_POPUP:
664 popup_font_name = lexrc.getString();
667 case RC_SCREEN_FONT_ENCODING:
669 font_norm = lexrc.getString();
670 set_font_norm_type();
674 case RC_SCREEN_FONT_ENCODING_MENU:
676 font_norm_menu = lexrc.getString();
681 string lyx_name, x11_name;
684 lyx_name = lexrc.getString();
686 lexrc.printError("Missing color tag.");
691 x11_name = lexrc.getString();
693 lexrc.printError("Missing color name for color : `$$Token'");
697 if (!lcolor.setColor(lyx_name, x11_name))
698 lyxerr << "Bad lyxrc set_color for "
703 case RC_AUTOREGIONDELETE:
704 // Auto region delete defaults to true
706 auto_region_delete = lexrc.getBool();
711 // we should not do an explicit binding before
712 // loading a bind file. So, in this case, load
713 // the default bind file.
714 readBindFileIfNeeded();
716 // !!!chb, dynamic key binding...
718 string::size_type res = 0;
722 seq = lexrc.getString();
724 lexrc.printError("RC_BIND: Missing key sequence");
728 if (lexrc.next(true)) {
729 cmd = lexrc.getString();
731 lexrc.printError("RC_BIND: missing command");
735 if ((action = lyxaction.LookupFunc(cmd))>= 0) {
736 if (lyxerr.debugging(Debug::LYXRC)) {
737 lyxerr << "RC_BIND: Sequence `"
738 << seq << "' Command `"
739 << cmd << "' Action `"
740 << action << '\'' << endl;
742 res = toplevel_keymap->bind(seq, action);
744 && lyxerr.debugging(Debug::LYXRC)) {
747 "Invalid key sequence `"
750 } else {// cmd is the last token read.
752 "Unknown LyX function `$$Token'");
756 case RC_OVERRIDE_X_DEADKEYS:
758 override_x_deadkeys = lexrc.getBool();
763 lyxpipes = ExpandPath(lexrc.getString());
766 case RC_CURSOR_FOLLOWS_SCROLLBAR:
768 cursor_follows_scrollbar = lexrc.getBool();
771 case RC_DIALOGS_ICONIFY_WITH_MAIN:
773 dialogs_iconify_with_main = lexrc.getBool();
776 case RC_ASCIIROFF_COMMAND:
778 ascii_roff_command = lexrc.getString();
780 case RC_ASCII_LINELEN:
782 ascii_linelen = lexrc.getInteger();
784 // Spellchecker settings:
788 use_pspell = lexrc.getBool();
791 case RC_SPELL_COMMAND:
793 isp_command = lexrc.getString();
795 case RC_ACCEPT_COMPOUND:
797 isp_accept_compound = lexrc.getBool();
801 isp_use_input_encoding = lexrc.getBool();
803 case RC_USE_ALT_LANG:
805 isp_use_alt_lang = lexrc.getBool();
807 case RC_USE_PERS_DICT:
809 isp_use_pers_dict = lexrc.getBool();
811 case RC_USE_ESC_CHARS:
813 isp_use_esc_chars = lexrc.getBool();
817 isp_alt_lang = lexrc.getString();
821 isp_pers_dict = lexrc.getString();
825 isp_esc_chars = lexrc.getString();
829 make_backup = lexrc.getBool();
831 case RC_BACKUPDIR_PATH:
833 backupdir_path = ExpandPath(lexrc.getString());
835 case RC_DATE_INSERT_FORMAT:
837 date_insert_format = lexrc.getString();
839 case RC_LANGUAGE_PACKAGE:
841 language_package = lexrc.getString();
843 case RC_LANGUAGE_AUTO_BEGIN:
845 language_auto_begin = lexrc.getBool();
847 case RC_LANGUAGE_AUTO_END:
849 language_auto_end = lexrc.getBool();
851 case RC_LANGUAGE_GLOBAL_OPTIONS:
853 language_global_options = lexrc.getBool();
855 case RC_LANGUAGE_USE_BABEL:
857 language_use_babel = lexrc.getBool();
859 case RC_LANGUAGE_COMMAND_BEGIN:
861 language_command_begin = lexrc.getString();
863 case RC_LANGUAGE_COMMAND_END:
865 language_command_end = lexrc.getString();
867 case RC_LANGUAGE_COMMAND_LOCAL:
869 language_command_local = lexrc.getString();
873 rtl_support = lexrc.getBool();
877 auto_number = lexrc.getBool();
879 case RC_MARK_FOREIGN_LANGUAGE:
881 mark_foreign_language = lexrc.getBool();
885 show_banner = lexrc.getBool();
888 case RC_NEW_ASK_FILENAME:
890 new_ask_filename = lexrc.getBool();
893 string from, to, command, flags;
895 from = lexrc.getString();
897 to = lexrc.getString();
899 command = lexrc.getString();
901 flags = lexrc.getString();
902 if (command.empty() || command == "none")
903 converters.erase(from, to);
905 converters.add(from, to, command, flags);
909 string format, command;
911 format = lexrc.getString();
913 command = lexrc.getString();
914 formats.setViewer(format, command);
918 string format, extension, prettyname, shortcut;
920 format = lexrc.getString();
922 extension = lexrc.getString();
924 prettyname = lexrc.getString();
926 shortcut = lexrc.getString();
927 if (prettyname.empty()) {
928 if (converters.formatIsUsed(format))
929 lyxerr << "Can't delete format "
932 formats.erase(format);
935 formats.add(format, extension, prettyname,
939 case RC_DEFAULT_LANGUAGE:
941 default_language = lexrc.getString();
944 case RC_LABEL_INIT_LENGTH:
946 label_init_length = lexrc.getInteger();
949 case RC_LAST: break; // this is just a dummy
953 /// Update converters data-structures
954 converters.update(formats);
955 converters.buildGraph();
961 void LyXRC::write(string const & filename) const
963 ofstream ofs(filename.c_str());
969 void LyXRC::print() const
971 if (lyxerr.debugging())
978 void LyXRC::output(ostream & os) const
980 os << "### This file is part of\n"
981 << "### ========================================================\n"
982 << "### LyX, The Document Processor\n"
984 << "### Copyright 1995 Matthias Ettrich\n"
985 << "### Copyright 1995-2001 The LyX Team.\n"
987 << "### ========================================================\n"
989 << "# This file is written by LyX, if you want to make your own\n"
990 << "# modifications you should do them from inside LyX and save\n"
993 // Why the switch you might ask. It is a trick to ensure that all
994 // the elements in the LyXRCTags enum is handled. As you can see
995 // there are no breaks at all. So it is just a huge fall-through.
996 // The nice thing is that we will get a warning from the compiler
997 // if we forget an element.
998 LyXRCTags tag = RC_LAST;
1002 // input/include files are not done here
1004 // bindings is not written to the preferences file.
1006 if (bind_file != system_lyxrc.bind_file) {
1007 os << "\\bind_file " << bind_file << "\n";
1013 << "# MISC SECTION ######################################\n"
1016 case RC_SHOW_BANNER:
1017 if (show_banner != system_lyxrc.show_banner) {
1018 os << "# Set to false to inhibit the startup banner.\n"
1019 << "\\show_banner " << tostr(show_banner) << "\n";
1021 // bind files are not done here.
1023 if (ui_file != system_lyxrc.ui_file) {
1024 os << "\\ui_file \"" << ui_file << "\"\n";
1026 case RC_AUTOREGIONDELETE:
1027 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1028 os << "# Set to false to inhibit automatic replacement of\n"
1029 << "# the current selection.\n"
1030 << "\\auto_region_delete " << tostr(auto_region_delete)
1033 case RC_AUTORESET_OPTIONS:
1034 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1035 os << "# Set to false to inhibit automatic reset of\n"
1036 << "# the class options to defaults on class change.\n"
1037 << "\\auto_reset_options " << tostr(auto_reset_options)
1041 if (autosave != system_lyxrc.autosave) {
1042 os << "# The time interval between auto-saves in seconds.\n"
1043 << "\\autosave " << autosave << "\n";
1045 case RC_EXIT_CONFIRMATION:
1046 if (exit_confirmation != system_lyxrc.exit_confirmation) {
1047 os << "# Ask for confirmation before exit if there are\n"
1048 << "# unsaved changed documents.\n"
1049 << "\\exit_confirmation " << tostr(exit_confirmation)
1052 case RC_DISPLAY_GRAPHICS:
1053 if (display_graphics != system_lyxrc.display_graphics) {
1054 os << "# Display graphics within LyX\n"
1055 << "# no|mono|gray|color\n"
1056 << "\\display_graphics " << display_graphics
1060 case RC_DISPLAY_SHORTCUTS:
1061 if (display_shortcuts != system_lyxrc.display_shortcuts) {
1062 os << "# Display name of the last command executed,\n"
1063 << "# with a list of short-cuts in the minibuffer.\n"
1064 << "\\display_shortcuts " << tostr(display_shortcuts)
1067 case RC_VIEWDVI_PAPEROPTION:
1068 if (view_dvi_paper_option
1069 != system_lyxrc.view_dvi_paper_option) {
1070 os << "# Options used to specify paper size to the\n"
1071 << "# view_dvi_command (e.g. -paper)\n"
1072 << "\\view_dvi_paper_option \""
1073 << view_dvi_paper_option << "\"\n";
1075 case RC_DEFAULT_PAPERSIZE:
1076 if (default_papersize != system_lyxrc.default_papersize) {
1077 os << "# The default papersize to use.\n"
1078 << "\\default_papersize \"";
1079 switch (default_papersize) {
1080 case BufferParams::PAPER_USLETTER:
1081 os << "usletter"; break;
1082 case BufferParams::PAPER_LEGALPAPER:
1083 os << "legal"; break;
1084 case BufferParams::PAPER_EXECUTIVEPAPER:
1085 os << "executive"; break;
1086 case BufferParams::PAPER_A3PAPER:
1088 case BufferParams::PAPER_A4PAPER:
1090 case BufferParams::PAPER_A5PAPER:
1092 case BufferParams::PAPER_B5PAPER:
1094 case BufferParams::PAPER_DEFAULT: break;
1099 if (ps_command != system_lyxrc.ps_command) {
1100 os << "# Program used for interpreting postscript.\n"
1101 << "\\ps_command \"" << ps_command << "\"\n";
1103 case RC_CHKTEX_COMMAND:
1104 if (chktex_command != system_lyxrc.chktex_command) {
1105 os << "\\chktex_command \"" << chktex_command << "\"\n";
1108 if (use_kbmap != system_lyxrc.use_kbmap) {
1109 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1111 case RC_KBMAP_PRIMARY:
1112 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1113 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1115 case RC_KBMAP_SECONDARY:
1116 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1117 os << "\\kbmap_secondary \"" << secondary_kbmap
1121 if (lyxpipes != system_lyxrc.lyxpipes) {
1122 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1124 case RC_DATE_INSERT_FORMAT:
1125 if (date_insert_format != system_lyxrc.date_insert_format) {
1126 os << "\\date_insert_format \"" << date_insert_format
1129 case RC_LABEL_INIT_LENGTH:
1130 if (label_init_length != system_lyxrc.label_init_length) {
1131 os << "\\label_init_length " << label_init_length
1136 << "# SCREEN & FONTS SECTION ############################\n"
1140 if (dpi != system_lyxrc.dpi) {
1141 os << "\\screen_dpi " << dpi << "\n";
1143 case RC_SCREEN_ZOOM:
1144 if (zoom != system_lyxrc.zoom) {
1145 os << "\\screen_zoom " << zoom << "\n";
1148 if (wheel_jump != system_lyxrc.wheel_jump) {
1149 os << "\\wheel_jump " << wheel_jump << "\n";
1151 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1152 if (cursor_follows_scrollbar
1153 != system_lyxrc.cursor_follows_scrollbar) {
1154 os << "\\cursor_follows_scrollbar "
1155 << tostr(cursor_follows_scrollbar) << "\n";
1157 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1158 if (dialogs_iconify_with_main
1159 != system_lyxrc.dialogs_iconify_with_main) {
1160 os << "\\dialogs_iconify_with_main "
1161 << tostr(dialogs_iconify_with_main) << "\n";
1163 case RC_SCREEN_FONT_ROMAN:
1164 if (roman_font_name != system_lyxrc.roman_font_name) {
1165 os << "\\screen_font_roman \"" << roman_font_name
1168 case RC_SCREEN_FONT_SANS:
1169 if (sans_font_name != system_lyxrc.sans_font_name) {
1170 os << "\\screen_font_sans \"" << sans_font_name
1173 case RC_SCREEN_FONT_TYPEWRITER:
1174 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1175 os << "\\screen_font_typewriter \""
1176 << typewriter_font_name << "\"\n";
1178 case RC_SCREEN_FONT_SCALABLE:
1179 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1180 os << "\\screen_font_scalable "
1181 << tostr(use_scalable_fonts)
1184 case RC_SCREEN_FONT_ENCODING:
1185 if (font_norm != system_lyxrc.font_norm) {
1186 os << "\\screen_font_encoding \"" << font_norm
1189 case RC_SCREEN_FONT_POPUP:
1190 if (popup_font_name != system_lyxrc.popup_font_name) {
1191 os << "\\screen_font_popup \"" << popup_font_name
1194 case RC_SCREEN_FONT_MENU:
1195 if (menu_font_name != system_lyxrc.menu_font_name) {
1196 os << "\\screen_font_menu \"" << menu_font_name
1199 case RC_SCREEN_FONT_SIZES:
1200 if (font_sizes[LyXFont::SIZE_TINY]
1201 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1202 font_sizes[LyXFont::SIZE_SCRIPT]
1203 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1204 font_sizes[LyXFont::SIZE_FOOTNOTE]
1205 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1206 font_sizes[LyXFont::SIZE_SMALL]
1207 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1208 font_sizes[LyXFont::SIZE_NORMAL]
1209 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1210 font_sizes[LyXFont::SIZE_LARGE]
1211 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1212 font_sizes[LyXFont::SIZE_LARGER]
1213 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1214 font_sizes[LyXFont::SIZE_LARGEST]
1215 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1216 font_sizes[LyXFont::SIZE_HUGE]
1217 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1218 font_sizes[LyXFont::SIZE_HUGER]
1219 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1220 os.setf(ios::fixed);
1222 os << "\\screen_font_sizes"
1223 << " " << font_sizes[LyXFont::SIZE_TINY]
1224 << " " << font_sizes[LyXFont::SIZE_SCRIPT]
1225 << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]
1226 << " " << font_sizes[LyXFont::SIZE_SMALL]
1227 << " " << font_sizes[LyXFont::SIZE_NORMAL]
1228 << " " << font_sizes[LyXFont::SIZE_LARGE]
1229 << " " << font_sizes[LyXFont::SIZE_LARGER]
1230 << " " << font_sizes[LyXFont::SIZE_LARGEST]
1231 << " " << font_sizes[LyXFont::SIZE_HUGE]
1232 << " " << font_sizes[LyXFont::SIZE_HUGER]
1237 << "# COLOR SECTION ###################################\n"
1241 for (int i = 0; i < LColor::ignore; ++i ) {
1242 LColor::color lc = static_cast<LColor::color>(i);
1244 string const col(lcolor.getX11Name(lc));
1245 if (col != system_lcolor.getX11Name(lc)) {
1246 os << "\\set_color \""
1247 << lcolor.getLyXName(lc) << "\" \""
1253 << "# PRINTER SECTION ###################################\n"
1257 if (printer != system_lyxrc.printer) {
1258 os << "\\printer \"" << printer << "\"\n";
1260 case RC_PRINT_ADAPTOUTPUT:
1261 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1262 os << "\\print_adapt_output "
1263 << tostr(print_adapt_output)
1266 case RC_PRINT_COMMAND:
1267 if (print_command != system_lyxrc.print_command) {
1268 os << "\\print_command \"" << print_command << "\"\n";
1270 case RC_PRINTEXSTRAOPTIONS:
1271 if (print_extra_options != system_lyxrc.print_extra_options) {
1272 os << "\\print_extra_options \"" << print_extra_options
1275 case RC_PRINTSPOOL_COMMAND:
1276 if (print_spool_command != system_lyxrc.print_spool_command) {
1277 os << "\\print_spool_command \"" << print_spool_command
1280 case RC_PRINTSPOOL_PRINTERPREFIX:
1281 if (print_spool_printerprefix
1282 != system_lyxrc.print_spool_printerprefix) {
1283 os << "\\print_spool_printerprefix \""
1284 << print_spool_printerprefix << "\"\n";
1286 case RC_PRINTEVENPAGEFLAG:
1287 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1288 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1291 case RC_PRINTODDPAGEFLAG:
1292 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1293 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1296 case RC_PRINTREVERSEFLAG:
1297 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1298 os << "\\print_reverse_flag \"" << print_reverse_flag
1301 case RC_PRINTLANDSCAPEFLAG:
1302 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1303 os << "\\print_landscape_flag \"" << print_landscape_flag
1306 case RC_PRINTPAGERANGEFLAG:
1307 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1308 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1311 case RC_PRINTCOPIESFLAG:
1312 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1313 os << "\\print_copies_flag \"" << print_copies_flag
1316 case RC_PRINTCOLLCOPIESFLAG:
1317 if (print_collcopies_flag
1318 != system_lyxrc.print_collcopies_flag) {
1319 os << "\\print_collcopies_flag \""
1320 << print_collcopies_flag
1323 case RC_PRINTPAPERFLAG:
1324 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1325 os << "\\print_paper_flag \"" << print_paper_flag
1328 case RC_PRINTPAPERDIMENSIONFLAG:
1329 if (print_paper_dimension_flag
1330 != system_lyxrc.print_paper_dimension_flag) {
1331 os << "\\print_paper_dimension_flag \""
1332 << print_paper_dimension_flag << "\"\n";
1334 case RC_PRINTTOPRINTER:
1335 if (print_to_printer != system_lyxrc.print_to_printer) {
1336 os << "\\print_to_printer \"" << print_to_printer
1339 case RC_PRINTTOFILE:
1340 if (print_to_file != system_lyxrc.print_to_file) {
1341 os << "\\print_to_file \"" << print_to_file << "\"\n";
1343 case RC_PRINTFILEEXTENSION:
1344 if (print_file_extension != system_lyxrc.print_file_extension) {
1345 os << "\\print_file_extension \""
1346 << print_file_extension
1351 << "# EXPORT SECTION ####################################\n"
1354 case RC_CUSTOM_EXPORT_COMMAND:
1355 if (custom_export_command
1356 != system_lyxrc.custom_export_command) {
1357 os << "\\custom_export_command \""
1358 << custom_export_command
1361 case RC_CUSTOM_EXPORT_FORMAT:
1362 if (custom_export_format
1363 != system_lyxrc.custom_export_format) {
1364 os << "\\custom_export_format \"" << custom_export_format
1369 << "# TEX SECTION #######################################\n"
1372 case RC_FONT_ENCODING:
1373 if (fontenc != system_lyxrc.fontenc) {
1374 os << "\\font_encoding \"" << fontenc << "\"\n";
1378 << "# FILE SECTION ######################################\n"
1381 case RC_DOCUMENTPATH:
1382 if (document_path != system_lyxrc.document_path) {
1383 os << "\\document_path \"" << document_path << "\"\n";
1386 if (lastfiles != system_lyxrc.lastfiles) {
1387 os << "\\lastfiles \"" << lastfiles << "\"\n";
1389 case RC_NUMLASTFILES:
1390 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1391 os << "\\num_lastfiles " << num_lastfiles << "\n";
1393 case RC_CHECKLASTFILES:
1394 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1395 os << "\\check_lastfiles " << tostr(check_lastfiles)
1398 case RC_TEMPLATEPATH:
1399 if (template_path != system_lyxrc.template_path) {
1400 os << "\\template_path \"" << template_path << "\"\n";
1402 case RC_TEMPDIRPATH:
1403 if (tempdir_path != system_lyxrc.tempdir_path) {
1404 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1407 if (use_tempdir != system_lyxrc.use_tempdir) {
1408 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1410 case RC_ASCII_LINELEN:
1411 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1412 os << "\\ascii_linelen " << ascii_linelen << "\n";
1414 case RC_MAKE_BACKUP:
1415 if (make_backup != system_lyxrc.make_backup) {
1416 os << "\\make_backup " << tostr(make_backup) << "\n";
1418 case RC_BACKUPDIR_PATH:
1419 if (backupdir_path != system_lyxrc.backupdir_path) {
1420 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1424 << "# ASCII EXPORT SECTION ##############################\n"
1427 case RC_ASCIIROFF_COMMAND:
1428 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1429 os << "\\ascii_roff_command \"" << ascii_roff_command
1434 << "# SPELLCHECKER SECTION ##############################\n"
1438 if (use_pspell != system_lyxrc.use_pspell) {
1439 os << "\\use_pspell \"" << use_pspell << "\"\n";
1442 case RC_SPELL_COMMAND:
1443 if (isp_command != system_lyxrc.isp_command) {
1444 os << "\\spell_command \"" << isp_command << "\"\n";
1446 case RC_ACCEPT_COMPOUND:
1447 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1448 os << "\\accept_compound " << tostr(isp_accept_compound)
1451 case RC_USE_ALT_LANG:
1452 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1453 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1457 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1458 os << "\\alternate_language \"" << isp_alt_lang
1461 case RC_USE_ESC_CHARS:
1462 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1463 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1467 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1468 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1470 case RC_USE_PERS_DICT:
1471 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1472 os << "\\use_personal_dictionary "
1473 << tostr(isp_use_pers_dict)
1477 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1478 os << "\\personal_dictionary \"" << isp_pers_dict
1481 case RC_USE_INP_ENC:
1482 if (isp_use_input_encoding
1483 != system_lyxrc.isp_use_input_encoding) {
1484 os << "\\use_input_encoding "
1485 << tostr(isp_use_input_encoding)
1490 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1493 case RC_RTL_SUPPORT:
1494 if (rtl_support != system_lyxrc.rtl_support) {
1495 os << "\\rtl " << tostr(rtl_support) << "\n";
1497 case RC_LANGUAGE_PACKAGE:
1498 if (language_package != system_lyxrc.language_package) {
1499 os << "\\language_package \"" << language_package
1502 case RC_LANGUAGE_GLOBAL_OPTIONS:
1503 if (language_global_options
1504 != system_lyxrc.language_global_options) {
1505 os << "\\language_global_options \""
1506 << tostr(language_global_options)
1509 case RC_LANGUAGE_USE_BABEL:
1510 if (language_use_babel != system_lyxrc.language_use_babel) {
1511 os << "\\language_use_babel \""
1512 << tostr(language_use_babel)
1515 case RC_LANGUAGE_COMMAND_BEGIN:
1516 if (language_command_begin
1517 != system_lyxrc.language_command_begin) {
1518 os << "\\language_command_begin \""
1519 << language_command_begin
1522 case RC_LANGUAGE_COMMAND_END:
1523 if (language_command_end
1524 != system_lyxrc.language_command_end) {
1525 os << "\\language_command_end \"" << language_command_end
1528 case RC_LANGUAGE_COMMAND_LOCAL:
1529 if (language_command_local
1530 != system_lyxrc.language_command_local) {
1531 os << "\\language_command_local \""
1532 << language_command_local
1535 case RC_LANGUAGE_AUTO_BEGIN:
1536 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1537 os << "\\language_auto_begin "
1538 << tostr(language_auto_begin) << "\n";
1540 case RC_LANGUAGE_AUTO_END:
1541 if (language_auto_end != system_lyxrc.language_auto_end) {
1542 os << "\\language_auto_end "
1543 << tostr(language_auto_end) << "\n";
1545 case RC_MARK_FOREIGN_LANGUAGE:
1546 if (mark_foreign_language
1547 != system_lyxrc.mark_foreign_language) {
1548 os << "\\mark_foreign_language " <<
1549 tostr(mark_foreign_language) << "\n";
1553 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1556 case RC_OVERRIDE_X_DEADKEYS:
1557 if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) {
1558 os << "\\override_x_deadkeys "
1559 << tostr(override_x_deadkeys) << "\n";
1561 case RC_SCREEN_FONT_ENCODING_MENU:
1562 if (font_norm_menu != system_lyxrc.font_norm_menu) {
1563 os << "\\screen_font_encoding_menu \"" << font_norm_menu
1566 case RC_AUTO_NUMBER:
1567 if (auto_number != system_lyxrc.auto_number) {
1568 os << "\\auto_number " << tostr(auto_number) << "\n";
1570 case RC_NEW_ASK_FILENAME:
1571 if (new_ask_filename != system_lyxrc.new_ask_filename) {
1572 os << "\\new_ask_filename " << tostr(new_ask_filename)
1575 case RC_DEFAULT_LANGUAGE:
1576 if (default_language != system_lyxrc.default_language) {
1577 os << "\\default_language " << default_language << "\n";
1581 << "# FORMATS SECTION ##########################\n"
1585 // Look for deleted formats
1586 for (Formats::const_iterator cit = formats.begin();
1587 cit != formats.end(); ++cit) {
1588 Format const * format =
1589 system_formats.getFormat(cit->name());
1591 format->extension() != cit->extension() ||
1592 format->prettyname() != cit->prettyname() ||
1593 format->shortcut() != cit->shortcut())
1594 os << "\\format \"" << cit->name() << "\" \""
1595 << cit->extension() << "\" \""
1596 << cit->prettyname() << "\" \""
1597 << cit->shortcut() << "\"\n";
1600 // New/modifed formats
1601 for (Formats::const_iterator cit = system_formats.begin();
1602 cit != system_formats.end(); ++cit)
1603 if (!formats.getFormat(cit->name()))
1604 os << "\\format \"" << cit->name()
1605 << "\" \"\" \"\" \"\"\n";
1607 for (Formats::const_iterator cit = formats.begin();
1608 cit != formats.end(); ++cit) {
1609 Format const * format =
1610 system_formats.getFormat(cit->name());
1611 if ((!format || format->viewer() != cit->viewer()) &&
1612 (format || !cit->viewer().empty()))
1613 os << "\\viewer \"" << cit->name() << "\" \""
1614 << cit->viewer() << "\"\n";
1618 << "# CONVERTERS SECTION ##########################\n"
1622 // Look for new converters
1623 for (Converters::const_iterator cit = converters.begin();
1624 cit != converters.end(); ++cit) {
1625 Converter const * converter =
1626 system_converters.getConverter(cit->from,
1629 converter->command != cit->command ||
1630 converter->flags != cit->flags)
1631 os << "\\converter \"" << cit->from << "\" \""
1632 << cit->to << "\" \""
1633 << cit->command << "\" \""
1634 << cit->flags << "\"\n";
1637 // New/modifed converters
1638 for (Converters::const_iterator cit = system_converters.begin();
1639 cit != system_converters.end(); ++cit)
1640 if (!converters.getConverter(cit->from, cit->to))
1641 os << "\\converter \"" << cit->from
1642 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1647 void LyXRC::set_font_norm_type()
1649 if (font_norm == "iso10646-1")
1650 font_norm_type = ISO_10646_1;
1651 else if (font_norm == "iso8859-1")
1652 font_norm_type = ISO_8859_1;
1653 else if (font_norm == "iso8859-3")
1654 font_norm_type = ISO_8859_3;
1655 else if (font_norm == "iso8859-4")
1656 font_norm_type = ISO_8859_4;
1657 else if (font_norm == "iso8859-6.8x")
1658 font_norm_type = ISO_8859_6_8;
1659 else if (font_norm == "iso8859-9")
1660 font_norm_type = ISO_8859_9;
1661 else if (font_norm == "iso8859-15")
1662 font_norm_type = ISO_8859_15;
1664 font_norm_type = OTHER_ENCODING;
1668 string const LyXRC::getDescription(LyXRCTags tag)
1673 case RC_FONT_ENCODING:
1674 str = N_("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1678 str = N_("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1681 case RC_PRINT_COMMAND:
1682 str = N_("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1685 case RC_PRINTEVENPAGEFLAG:
1686 str = N_("The option to print only even pages.");
1689 case RC_PRINTODDPAGEFLAG:
1690 str = N_("The option to print only odd pages.");
1693 case RC_PRINTPAGERANGEFLAG:
1694 str = N_("The option for specifying a comma-separated list of pages to print.");
1697 case RC_PRINTCOPIESFLAG:
1698 str = N_("The option for specifying the number of copies to print.");
1701 case RC_PRINTCOLLCOPIESFLAG:
1702 str = N_("The option for specifying whether the copies should be collated.");
1705 case RC_PRINTREVERSEFLAG:
1706 str = N_("The option to reverse the order of the pages printed.");
1709 case RC_PRINTLANDSCAPEFLAG:
1710 str = N_("The option to print out in landscape.");
1713 case RC_PRINTPAPERFLAG:
1714 str = N_("The option to specify paper type.");
1717 case RC_PRINTPAPERDIMENSIONFLAG:
1718 str = N_("Option to specify the dimensions of the print paper.");
1721 case RC_PRINTTOPRINTER:
1722 str = N_("Option to pass to the print program to print on a specific printer.");
1725 case RC_PRINT_ADAPTOUTPUT:
1726 str = N_("Select for LyX to pass the name of the destination printer to your print command.");
1729 case RC_PRINTTOFILE:
1730 str = N_("Option to pass to the print program to print to a file.");
1733 case RC_PRINTFILEEXTENSION:
1734 str = N_("Extension of printer program output file. Usually \".ps\".");
1737 case RC_PRINTEXSTRAOPTIONS:
1738 str = N_("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1741 case RC_PRINTSPOOL_COMMAND:
1742 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.");
1745 case RC_PRINTSPOOL_PRINTERPREFIX:
1746 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.");
1750 str = N_("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1753 case RC_SCREEN_ZOOM:
1754 //xgettext:no-c-format
1755 str = N_("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1758 case RC_SCREEN_FONT_SIZES:
1759 str = N_("The font sizes used for calculating the scaling of the screen fonts.");
1762 case RC_SCREEN_FONT_ROMAN:
1763 case RC_SCREEN_FONT_SANS:
1764 case RC_SCREEN_FONT_TYPEWRITER:
1765 str = N_("The screen fonts used to display the text while editing.");
1768 case RC_SCREEN_FONT_MENU:
1769 str = N_("The font for menus (and groups titles in popups).");
1772 case RC_SCREEN_FONT_POPUP:
1773 str = N_("The font for popups.");
1776 case RC_SCREEN_FONT_ENCODING:
1777 str = N_("The encoding for the screen fonts.");
1780 case RC_SCREEN_FONT_ENCODING_MENU:
1781 str = N_("The encoding for the menu/popups fonts.");
1788 str = N_("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1791 case RC_DOCUMENTPATH:
1792 str = N_("The default path for your documents.");
1795 case RC_TEMPLATEPATH:
1796 str = N_("The path that LyX will set when offering to choose a template.");
1799 case RC_TEMPDIRPATH:
1800 str = N_("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1804 str = N_("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1808 str = N_("The file where the last-files information should be stored.");
1811 case RC_AUTOREGIONDELETE:
1812 str = N_("De-select if you don't want the current selection to be replaced automatically by what you type.");
1815 case RC_AUTORESET_OPTIONS:
1816 str = N_("De-select if you don't want the class options to be reset to defaults after class change.");
1819 case RC_OVERRIDE_X_DEADKEYS:
1820 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.");
1825 str = N_("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1829 str = N_("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1833 str = N_("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1837 case RC_KBMAP_PRIMARY:
1838 case RC_KBMAP_SECONDARY:
1839 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.");
1842 case RC_ASCIIROFF_COMMAND:
1843 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.");
1846 case RC_ASCII_LINELEN:
1847 str = N_("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1850 case RC_NUMLASTFILES:
1851 str = N_("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1854 case RC_CHECKLASTFILES:
1855 str = N_("Select to check whether the lastfiles still exist.");
1858 case RC_VIEWDVI_PAPEROPTION:
1859 str = N_("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1862 case RC_DEFAULT_PAPERSIZE:
1863 str = N_("Specify the default paper size.");
1869 case RC_ACCEPT_COMPOUND:
1870 str = N_("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1873 case RC_SPELL_COMMAND:
1874 str = N_("What command runs the spell checker?");
1877 case RC_USE_INP_ENC:
1878 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.");
1881 case RC_USE_ALT_LANG:
1883 str = N_("Specify an alternate language. The default is to use the language of the document.");
1886 case RC_USE_PERS_DICT:
1888 str = N_("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1891 case RC_USE_ESC_CHARS:
1893 str = N_("Specify additional chars that can be part of a word.");
1896 case RC_SCREEN_FONT_SCALABLE:
1897 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.");
1900 case RC_CHKTEX_COMMAND:
1901 str = N_("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1904 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1905 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.");
1908 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1909 str = N_("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
1912 case RC_EXIT_CONFIRMATION:
1913 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.)");
1916 case RC_DISPLAY_GRAPHICS:
1917 str = N_("Select how LyX will display any graphics.");
1920 case RC_DISPLAY_SHORTCUTS:
1921 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.");
1924 case RC_MAKE_BACKUP:
1925 str = N_("De-select if you don't want LyX to create backup files.");
1928 case RC_BACKUPDIR_PATH:
1929 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.");
1932 case RC_RTL_SUPPORT:
1933 str = N_("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
1936 case RC_MARK_FOREIGN_LANGUAGE:
1937 str = N_("Select to control the highlighting of words with a language foreign to that of the document.");
1940 case RC_LANGUAGE_PACKAGE:
1941 str = N_("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
1944 case RC_LANGUAGE_GLOBAL_OPTIONS:
1945 str = N_("De-select if you don't want the language(s) used as an argument to \\documentclass.");
1948 case RC_LANGUAGE_USE_BABEL:
1949 str = N_("De-select if you don't want babel to be used when the language of the document is the default language.");
1952 case RC_LANGUAGE_AUTO_BEGIN:
1953 str = N_("Select if a language switching command is needed at the beginning of the document.");
1956 case RC_LANGUAGE_AUTO_END:
1957 str = N_("Select if a language switching command is needed at the end of the document.");
1960 case RC_LANGUAGE_COMMAND_BEGIN:
1961 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.");
1964 case RC_LANGUAGE_COMMAND_END:
1965 str = N_("The latex command for changing back to the language of the document.");
1968 case RC_LANGUAGE_COMMAND_LOCAL:
1969 str = N_("The latex command for local changing of the language.");
1972 case RC_DATE_INSERT_FORMAT:
1973 //xgettext:no-c-format
1974 str = N_("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
1977 case RC_SHOW_BANNER:
1978 str = N_("De-select if you don't want the startup banner.");
1982 str = N_("The wheel movement factor (for mice with wheels or five button mice).");
1994 case RC_NEW_ASK_FILENAME:
1995 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.");
1998 case RC_DEFAULT_LANGUAGE:
1999 str = N_("New documents will be assigned this language.");
2002 case RC_LABEL_INIT_LENGTH:
2003 str = N_("Maximum number of words in the initialization string for a new label");
2013 // The global instance
2016 // The global copy of the system lyxrc entries (everything except preferences)