3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
14 * Full author contact details are available in file CREDITS.
25 #include "converter.h"
32 #include "graphics/GraphicsTypes.h"
34 #include "support/filetools.h"
35 #include "support/lstrings.h"
36 #include "support/translator.h"
37 #include "support/tostr.h"
38 #include "support/userinfo.h"
40 using lyx::support::ascii_lowercase;
41 using lyx::support::ExpandPath;
42 using lyx::support::GetEnv;
43 using lyx::support::LibFileSearch;
44 using lyx::support::token;
57 // when adding something to this array keep it sorted!
58 keyword_item lyxrcTags[] = {
59 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
60 { "\\alternate_language", LyXRC::RC_ALT_LANG },
61 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
62 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
63 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
64 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
65 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
66 { "\\autosave", LyXRC::RC_AUTOSAVE },
67 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
68 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
69 { "\\bind_file", LyXRC::RC_BINDFILE },
70 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
71 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
72 { "\\converter", LyXRC::RC_CONVERTER },
73 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
74 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
75 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
76 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
77 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
78 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
79 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
80 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
81 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
82 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
83 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
84 { "\\format", LyXRC::RC_FORMAT },
85 { "\\input", LyXRC::RC_INPUT },
86 { "\\kbmap", LyXRC::RC_KBMAP },
87 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
88 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
89 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
90 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
91 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
92 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
93 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
94 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
95 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
96 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
97 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
98 { "\\lastfiles", LyXRC::RC_LASTFILES },
99 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
100 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
101 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
102 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
103 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
104 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
105 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
106 { "\\preview", LyXRC::RC_PREVIEW },
107 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
108 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
109 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
110 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
111 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
112 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
113 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
114 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
115 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
116 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
117 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
118 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
119 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
120 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
121 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
122 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
123 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
124 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
125 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
126 { "\\printer", LyXRC::RC_PRINTER },
127 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
128 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
129 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
130 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
131 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
132 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
133 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
134 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
135 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
136 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
137 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
138 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
139 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
140 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
141 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
142 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
143 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
144 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
145 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
146 { "\\set_color", LyXRC::RC_SET_COLOR },
147 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
148 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
149 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
150 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
151 { "\\ui_file", LyXRC::RC_UIFILE },
152 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
153 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
154 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
155 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
156 // compatibility with versions older than 1.4.0 only
157 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
158 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
159 // compatibility with versions older than 1.4.0 only
160 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
161 { "\\user_email", LyXRC::RC_USER_EMAIL },
162 { "\\user_name", LyXRC::RC_USER_NAME },
163 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
164 { "\\viewer" ,LyXRC::RC_VIEWER},
165 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
168 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
179 void LyXRC::setDefaults() {
182 // Get printer from the environment. If fail, use default "",
183 // assuming that everything is set up correctly.
184 printer = GetEnv("PRINTER");
185 print_adapt_output = false;
186 print_command = "dvips";
187 print_evenpage_flag = "-B";
188 print_oddpage_flag = "-A";
189 print_pagerange_flag = "-pp";
190 print_copies_flag = "-c";
191 print_collcopies_flag = "-C";
192 print_reverse_flag = "-r";
193 print_landscape_flag = "-t landscape";
194 print_to_printer = "-P";
195 print_to_file = "-o ";
196 print_file_extension = ".ps";
197 print_paper_flag = "-t";
198 print_paper_dimension_flag = "-T";
199 document_path.erase();
200 tempdir_path = "/tmp";
201 view_dvi_paper_option.erase();
202 default_papersize = PAPER_USLETTER;
203 custom_export_format = "ps";
204 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
205 bibtex_command = "bibtex";
208 // Because a screen typically is wider than a piece of paper:
211 // Default LaTeX font size:
212 font_sizes[LyXFont::SIZE_TINY] = 5.0;
213 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
214 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
215 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
216 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
217 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
218 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
219 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
220 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
221 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
222 use_scalable_fonts = true;
223 roman_font_name = "";
225 typewriter_font_name = "";
226 popup_bold_font = "-*-helvetica-bold-r";
227 popup_normal_font = "-*-helvetica-medium-r";
228 font_norm = "iso8859-1";
229 font_norm_type = ISO_8859_1;
230 popup_font_encoding.erase();
232 auto_region_delete = true;
233 auto_reset_options = false;
236 check_lastfiles = true;
238 backupdir_path.erase();
239 display_graphics = lyx::graphics::ColorDisplay;
240 // Spellchecker settings:
241 use_spell_lib = true;
242 isp_command = "ispell";
243 isp_accept_compound = false;
244 isp_use_input_encoding = false;
245 isp_use_alt_lang = false;
246 isp_use_pers_dict = false;
247 isp_use_esc_chars = false;
251 mark_foreign_language = true;
252 language_auto_begin = true;
253 language_auto_end = true;
254 language_global_options = true;
255 language_use_babel = true;
256 language_package = "\\usepackage{babel}";
257 language_command_begin = "\\selectlanguage{$$lang}";
258 language_command_local = "\\foreignlanguage{$$lang}{";
259 default_language = "english";
263 date_insert_format = "%A, %e %B %Y";
264 cursor_follows_scrollbar = false;
265 dialogs_iconify_with_main = false;
266 label_init_length = 3;
268 preview_hashed_labels = false;
269 preview_scale_factor = 0.9;
271 user_name = lyx::support::user_name();
273 user_email = lyx::support::user_email();
275 if (user_email.empty())
276 user_email = _("email address unknown");
282 void oldFontFormat(string & family, string & foundry)
284 if (family.empty() || family[0] != '-')
286 foundry = token(family, '-', 1);
287 family = token(family, '-', 2);
295 int LyXRC::read(string const & filename)
297 LyXLex lexrc(lyxrcTags, lyxrcCount);
298 if (lyxerr.debugging(Debug::PARSER))
299 lexrc.printTable(lyxerr);
301 lexrc.setFile(filename);
302 if (!lexrc.isOK()) return -2;
304 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
306 while (lexrc.isOK()) {
307 // By using two switches we take advantage of the compiler
308 // telling us if we have missed a LyXRCTags element in
309 // the second switch.
310 // Note that this also shows a problem with LyXLex since it
311 // helps us avoid taking advantage of the strictness of the
314 int le = lexrc.lex();
316 case LyXLex::LEX_UNDEF:
317 lexrc.printError("Unknown tag `$$Token'");
319 case LyXLex::LEX_FEOF:
323 switch (static_cast<LyXRCTags>(le)) {
324 case RC_INPUT: // Include file
327 LibFileSearch(string(),
330 lexrc.printError("Error reading "
331 "included file: "+tmp);
335 case RC_BINDFILE: // RVDK_PATCH_5
337 bind_file = lexrc.getString();
343 ui_file = lexrc.getString();
347 case RC_AUTORESET_OPTIONS:
349 auto_reset_options = lexrc.getBool();
353 case RC_DISPLAY_GRAPHICS:
355 display_graphics = lyx::graphics::displayTranslator().find(lexrc.getString());
361 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");
379 case RC_KBMAP_SECONDARY:
381 string const kmap(lexrc.getString());
384 } else if (!LibFileSearch("kbd", kmap,
386 secondary_kbmap = kmap;
388 lexrc.printError("LyX: Keymap `$$Token' not found");
393 case RC_FONT_ENCODING:
395 fontenc = lexrc.getString();
401 printer = lexrc.getString();
405 case RC_PRINT_COMMAND:
407 print_command = lexrc.getString();
411 case RC_PRINTEVENPAGEFLAG:
413 print_evenpage_flag = lexrc.getString();
417 case RC_PRINTODDPAGEFLAG:
419 print_oddpage_flag = lexrc.getString();
423 case RC_PRINTPAGERANGEFLAG:
425 print_pagerange_flag = lexrc.getString();
429 case RC_PRINTCOPIESFLAG:
431 print_copies_flag = lexrc.getString();
435 case RC_PRINTCOLLCOPIESFLAG:
437 print_collcopies_flag = lexrc.getString();
441 case RC_PRINTREVERSEFLAG:
443 print_reverse_flag = lexrc.getString();
447 case RC_PRINTLANDSCAPEFLAG:
449 print_landscape_flag = lexrc.getString();
453 case RC_PRINTTOPRINTER:
455 print_to_printer = lexrc.getString();
459 case RC_PRINT_ADAPTOUTPUT:
461 print_adapt_output = lexrc.getBool();
467 print_to_file = lexrc.getString();
471 case RC_PRINTFILEEXTENSION:
473 print_file_extension = lexrc.getString();
477 case RC_PRINTEXSTRAOPTIONS:
479 print_extra_options = lexrc.getString();
483 case RC_PRINTSPOOL_COMMAND:
485 print_spool_command = lexrc.getString();
489 case RC_PRINTSPOOL_PRINTERPREFIX:
491 print_spool_printerprefix = lexrc.getString();
495 case RC_PRINTPAPERDIMENSIONFLAG:
497 print_paper_dimension_flag = lexrc.getString();
501 case RC_PRINTPAPERFLAG:
503 print_paper_flag = lexrc.getString();
507 case RC_CUSTOM_EXPORT_COMMAND:
509 custom_export_command = lexrc.getString();
513 case RC_CUSTOM_EXPORT_FORMAT:
515 custom_export_format = lexrc.getString();
519 case RC_DEFAULT_PAPERSIZE:
522 ascii_lowercase(lexrc.getString());
523 if (size == "usletter")
526 else if (size == "legal")
529 else if (size == "executive")
531 PAPER_EXECUTIVEPAPER;
532 else if (size == "a3")
535 else if (size == "a4")
538 else if (size == "a5")
541 else if (size == "b5")
547 case RC_VIEWDVI_PAPEROPTION:
549 view_dvi_paper_option = lexrc.getString();
551 view_dvi_paper_option.erase();
555 case RC_CHKTEX_COMMAND:
557 chktex_command = lexrc.getString();
561 case RC_BIBTEX_COMMAND:
563 bibtex_command = lexrc.getString();
569 dpi = lexrc.getInteger();
575 zoom = lexrc.getInteger();
581 wheel_jump = lexrc.getInteger();
585 case RC_SCREEN_FONT_SIZES:
587 font_sizes[LyXFont::SIZE_TINY] =
591 font_sizes[LyXFont::SIZE_SCRIPT] =
595 font_sizes[LyXFont::SIZE_FOOTNOTE] =
599 font_sizes[LyXFont::SIZE_SMALL] =
603 font_sizes[LyXFont::SIZE_NORMAL] =
607 font_sizes[LyXFont::SIZE_LARGE] =
611 font_sizes[LyXFont::SIZE_LARGER] =
615 font_sizes[LyXFont::SIZE_LARGEST] =
619 font_sizes[LyXFont::SIZE_HUGE] =
623 font_sizes[LyXFont::SIZE_HUGER] =
628 case RC_SCREEN_FONT_SCALABLE:
630 use_scalable_fonts = lexrc.getBool();
636 autosave = lexrc.getInteger();
640 case RC_DOCUMENTPATH:
642 document_path = ExpandPath(lexrc.getString());
646 case RC_TEMPLATEPATH:
648 template_path = ExpandPath(lexrc.getString());
654 tempdir_path = ExpandPath(lexrc.getString());
660 lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
666 lastfiles = ExpandPath(lexrc.getString());
670 case RC_NUMLASTFILES:
672 num_lastfiles = lexrc.getInteger();
676 case RC_CHECKLASTFILES:
678 check_lastfiles = lexrc.getBool();
682 case RC_SCREEN_FONT_ROMAN:
684 roman_font_name = lexrc.getString();
685 oldFontFormat(roman_font_name,
690 case RC_SCREEN_FONT_SANS:
692 sans_font_name = lexrc.getString();
693 oldFontFormat(sans_font_name, sans_font_foundry);
697 case RC_SCREEN_FONT_TYPEWRITER:
699 typewriter_font_name = lexrc.getString();
700 oldFontFormat(typewriter_font_name,
701 typewriter_font_foundry);
705 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
707 roman_font_foundry = lexrc.getString();
711 case RC_SCREEN_FONT_SANS_FOUNDRY:
713 sans_font_foundry = lexrc.getString();
717 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
719 typewriter_font_foundry = lexrc.getString();
723 case RC_SCREEN_FONT_ENCODING:
725 font_norm = lexrc.getString();
726 set_font_norm_type();
730 case RC_POPUP_BOLD_FONT:
732 popup_bold_font = lexrc.getString();
736 case RC_POPUP_NORMAL_FONT:
738 popup_normal_font = lexrc.getString();
742 case RC_POPUP_FONT_ENCODING:
744 popup_font_encoding = lexrc.getString();
750 string lyx_name, x11_name;
753 lyx_name = lexrc.getString();
755 lexrc.printError("Missing color tag.");
760 x11_name = lexrc.getString();
762 lexrc.printError("Missing color name for color: `$$Token'");
766 LColor::color col = lcolor.getFromLyXName(lyx_name);
767 if (!lcolor.setColor(col, x11_name)) {
768 lyxerr << "Bad lyxrc set_color for "
774 case RC_AUTOREGIONDELETE:
775 // Auto region delete defaults to true
777 auto_region_delete = lexrc.getBool();
783 lyxpipes = ExpandPath(lexrc.getString());
787 case RC_CURSOR_FOLLOWS_SCROLLBAR:
789 cursor_follows_scrollbar = lexrc.getBool();
793 case RC_DIALOGS_ICONIFY_WITH_MAIN:
795 dialogs_iconify_with_main = lexrc.getBool();
799 case RC_ASCIIROFF_COMMAND:
801 ascii_roff_command = lexrc.getString();
804 case RC_ASCII_LINELEN:
806 ascii_linelen = lexrc.getInteger();
809 // Spellchecker settings:
810 case RC_USE_SPELL_LIB:
812 use_spell_lib = lexrc.getBool();
815 case RC_SPELL_COMMAND:
817 isp_command = lexrc.getString();
820 case RC_ACCEPT_COMPOUND:
822 isp_accept_compound = lexrc.getBool();
827 isp_use_input_encoding = lexrc.getBool();
830 case RC_USE_ALT_LANG:
832 isp_use_alt_lang = lexrc.getBool();
835 case RC_USE_PERS_DICT:
837 isp_use_pers_dict = lexrc.getBool();
840 case RC_USE_ESC_CHARS:
842 isp_use_esc_chars = lexrc.getBool();
847 isp_alt_lang = lexrc.getString();
852 isp_pers_dict = lexrc.getString();
857 isp_esc_chars = lexrc.getString();
862 make_backup = lexrc.getBool();
865 case RC_BACKUPDIR_PATH:
867 backupdir_path = ExpandPath(lexrc.getString());
870 case RC_DATE_INSERT_FORMAT:
872 date_insert_format = lexrc.getString();
875 case RC_LANGUAGE_PACKAGE:
877 language_package = lexrc.getString();
880 case RC_LANGUAGE_AUTO_BEGIN:
882 language_auto_begin = lexrc.getBool();
885 case RC_LANGUAGE_AUTO_END:
887 language_auto_end = lexrc.getBool();
890 case RC_LANGUAGE_GLOBAL_OPTIONS:
892 language_global_options = lexrc.getBool();
895 case RC_LANGUAGE_USE_BABEL:
897 language_use_babel = lexrc.getBool();
900 case RC_LANGUAGE_COMMAND_BEGIN:
902 language_command_begin = lexrc.getString();
905 case RC_LANGUAGE_COMMAND_END:
907 language_command_end = lexrc.getString();
910 case RC_LANGUAGE_COMMAND_LOCAL:
912 language_command_local = lexrc.getString();
917 rtl_support = lexrc.getBool();
922 auto_number = lexrc.getBool();
925 case RC_MARK_FOREIGN_LANGUAGE:
927 mark_foreign_language = lexrc.getBool();
932 string from, to, command, flags;
934 from = lexrc.getString();
937 to = lexrc.getString();
940 command = lexrc.getString();
943 flags = lexrc.getString();
946 || token(command, ' ', 0) == "none") {
947 converters.erase(from, to);
949 converters.add(from, to, command, flags);
954 string format, command;
956 format = lexrc.getString();
959 command = lexrc.getString();
960 if (token(command, ' ', 0) == "none")
963 formats.setViewer(format, command);
967 string format, extension, prettyname, shortcut;
969 format = lexrc.getString();
972 extension = lexrc.getString();
975 prettyname = lexrc.getString();
978 shortcut = lexrc.getString();
980 if (prettyname.empty()) {
981 if (converters.formatIsUsed(format)) {
982 lyxerr << "Can't delete format "
985 formats.erase(format);
988 formats.add(format, extension, prettyname,
993 case RC_DEFAULT_LANGUAGE:
995 default_language = lexrc.getString();
999 case RC_LABEL_INIT_LENGTH:
1001 label_init_length = lexrc.getInteger();
1005 case RC_SHOW_BANNER:
1007 show_banner = lexrc.getBool();
1013 preview = lexrc.getBool();
1017 case RC_PREVIEW_HASHED_LABELS:
1019 preview_hashed_labels = lexrc.getBool();
1023 case RC_PREVIEW_SCALE_FACTOR:
1025 preview_scale_factor = lexrc.getFloat();
1031 user_name = lexrc.getString();
1036 user_email = lexrc.getString();
1039 case RC_LAST: break; // this is just a dummy
1043 /// Update converters data-structures
1044 converters.update(formats);
1045 converters.buildGraph();
1051 void LyXRC::write(string const & filename) const
1053 ofstream ofs(filename.c_str());
1059 void LyXRC::print() const
1061 if (lyxerr.debugging())
1068 void LyXRC::output(ostream & os) const
1070 os << "### This file is part of\n"
1071 << "### ========================================================\n"
1072 << "### LyX, The Document Processor\n"
1074 << "### Copyright 1995 Matthias Ettrich\n"
1075 << "### Copyright 1995-2001 The LyX Team.\n"
1077 << "### ========================================================\n"
1079 << "# This file is written by LyX, if you want to make your own\n"
1080 << "# modifications you should do them from inside LyX and save\n"
1083 // Why the switch you might ask. It is a trick to ensure that all
1084 // the elements in the LyXRCTags enum is handled. As you can see
1085 // there are no breaks at all. So it is just a huge fall-through.
1086 // The nice thing is that we will get a warning from the compiler
1087 // if we forget an element.
1088 LyXRCTags tag = RC_LAST;
1092 // input/include files are not done here
1094 if (bind_file != system_lyxrc.bind_file) {
1095 os << "\\bind_file " << bind_file << "\n";
1101 << "# MISC SECTION ######################################\n"
1104 // bind files are not done here.
1106 if (ui_file != system_lyxrc.ui_file) {
1107 os << "\\ui_file \"" << ui_file << "\"\n";
1109 case RC_AUTOREGIONDELETE:
1110 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1111 os << "# Set to false to inhibit automatic replacement of\n"
1112 << "# the current selection.\n"
1113 << "\\auto_region_delete " << tostr(auto_region_delete)
1116 case RC_AUTORESET_OPTIONS:
1117 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1118 os << "# Set to false to inhibit automatic reset of\n"
1119 << "# the class options to defaults on class change.\n"
1120 << "\\auto_reset_options " << tostr(auto_reset_options)
1124 if (autosave != system_lyxrc.autosave) {
1125 os << "# The time interval between auto-saves in seconds.\n"
1126 << "\\autosave " << autosave << '\n';
1128 case RC_DISPLAY_GRAPHICS:
1129 if (display_graphics != system_lyxrc.display_graphics) {
1130 os << "# Display graphics within LyX\n"
1131 << "# monochrome|grayscale|color|none\n"
1132 << "\\display_graphics "
1133 << lyx::graphics::displayTranslator().find(display_graphics)
1137 case RC_VIEWDVI_PAPEROPTION:
1138 if (view_dvi_paper_option
1139 != system_lyxrc.view_dvi_paper_option) {
1140 os << "# Options used to specify paper size to the\n"
1141 << "# view_dvi_command (e.g. -paper)\n"
1142 << "\\view_dvi_paper_option \""
1143 << view_dvi_paper_option << "\"\n";
1145 case RC_DEFAULT_PAPERSIZE:
1146 if (default_papersize != system_lyxrc.default_papersize) {
1147 os << "# The default papersize to use.\n"
1148 << "\\default_papersize \"";
1149 switch (default_papersize) {
1150 case PAPER_USLETTER:
1151 os << "usletter"; break;
1152 case PAPER_LEGALPAPER:
1153 os << "legal"; break;
1154 case PAPER_EXECUTIVEPAPER:
1155 os << "executive"; break;
1164 case PAPER_DEFAULT: break;
1168 case RC_CHKTEX_COMMAND:
1169 if (chktex_command != system_lyxrc.chktex_command) {
1170 os << "\\chktex_command \"" << chktex_command << "\"\n";
1172 case RC_BIBTEX_COMMAND:
1173 if (bibtex_command != system_lyxrc.bibtex_command) {
1174 os << "\\bibtex_command \"" << bibtex_command << "\"\n";
1177 if (use_kbmap != system_lyxrc.use_kbmap) {
1178 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1180 case RC_KBMAP_PRIMARY:
1181 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1182 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1184 case RC_KBMAP_SECONDARY:
1185 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1186 os << "\\kbmap_secondary \"" << secondary_kbmap
1190 if (lyxpipes != system_lyxrc.lyxpipes) {
1191 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1193 case RC_DATE_INSERT_FORMAT:
1194 if (date_insert_format != system_lyxrc.date_insert_format) {
1195 os << "\\date_insert_format \"" << date_insert_format
1198 case RC_LABEL_INIT_LENGTH:
1199 if (label_init_length != system_lyxrc.label_init_length) {
1200 os << "\\label_init_length " << label_init_length
1205 os << "\\user_name \"" << user_name << "\"\n";
1208 os << "\\user_email \"" << user_email << "\"\n";
1210 case RC_SHOW_BANNER:
1211 if (show_banner != system_lyxrc.show_banner) {
1212 os << "\\show_banner " << tostr(show_banner) << '\n';
1216 if (preview != system_lyxrc.preview) {
1217 os << "\\preview " << tostr(preview) << '\n';
1220 case RC_PREVIEW_HASHED_LABELS:
1221 if (preview_hashed_labels !=
1222 system_lyxrc.preview_hashed_labels) {
1223 os << "\\preview_hashed_labels "
1224 << tostr(preview_hashed_labels) << '\n';
1227 case RC_PREVIEW_SCALE_FACTOR:
1228 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1229 os << "\\preview_scale_factor "
1230 << preview_scale_factor << '\n';
1234 << "# SCREEN & FONTS SECTION ############################\n"
1237 case RC_POPUP_NORMAL_FONT:
1238 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1239 os << "\\popup_normal_font \"" << popup_normal_font
1242 case RC_POPUP_BOLD_FONT:
1243 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1244 os << "\\popup_bold_font \"" << popup_bold_font
1247 case RC_POPUP_FONT_ENCODING:
1248 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1249 os << "\\popup_font_encoding \"" << popup_font_encoding
1253 if (dpi != system_lyxrc.dpi) {
1254 os << "\\screen_dpi " << dpi << '\n';
1256 case RC_SCREEN_ZOOM:
1257 if (zoom != system_lyxrc.zoom) {
1258 os << "\\screen_zoom " << zoom << '\n';
1261 if (wheel_jump != system_lyxrc.wheel_jump) {
1262 os << "\\wheel_jump " << wheel_jump << '\n';
1264 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1265 if (cursor_follows_scrollbar
1266 != system_lyxrc.cursor_follows_scrollbar) {
1267 os << "\\cursor_follows_scrollbar "
1268 << tostr(cursor_follows_scrollbar) << '\n';
1270 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1271 if (dialogs_iconify_with_main
1272 != system_lyxrc.dialogs_iconify_with_main) {
1273 os << "\\dialogs_iconify_with_main "
1274 << tostr(dialogs_iconify_with_main) << '\n';
1276 case RC_SCREEN_FONT_ROMAN:
1277 if (roman_font_name != system_lyxrc.roman_font_name) {
1278 os << "\\screen_font_roman \"" << roman_font_name
1281 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1282 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1283 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1286 case RC_SCREEN_FONT_SANS:
1287 if (sans_font_name != system_lyxrc.sans_font_name) {
1288 os << "\\screen_font_sans \"" << sans_font_name
1291 case RC_SCREEN_FONT_SANS_FOUNDRY:
1292 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1293 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1296 case RC_SCREEN_FONT_TYPEWRITER:
1297 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1298 os << "\\screen_font_typewriter \""
1299 << typewriter_font_name << "\"\n";
1301 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1302 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1303 os << "\\screen_font_typewriter_foundry \""
1304 << typewriter_font_foundry << "\"\n";
1307 case RC_SCREEN_FONT_SCALABLE:
1308 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1309 os << "\\screen_font_scalable "
1310 << tostr(use_scalable_fonts)
1313 case RC_SCREEN_FONT_ENCODING:
1314 if (font_norm != system_lyxrc.font_norm) {
1315 os << "\\screen_font_encoding \"" << font_norm
1318 case RC_SCREEN_FONT_SIZES:
1319 if (font_sizes[LyXFont::SIZE_TINY]
1320 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1321 font_sizes[LyXFont::SIZE_SCRIPT]
1322 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1323 font_sizes[LyXFont::SIZE_FOOTNOTE]
1324 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1325 font_sizes[LyXFont::SIZE_SMALL]
1326 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1327 font_sizes[LyXFont::SIZE_NORMAL]
1328 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1329 font_sizes[LyXFont::SIZE_LARGE]
1330 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1331 font_sizes[LyXFont::SIZE_LARGER]
1332 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1333 font_sizes[LyXFont::SIZE_LARGEST]
1334 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1335 font_sizes[LyXFont::SIZE_HUGE]
1336 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1337 font_sizes[LyXFont::SIZE_HUGER]
1338 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1339 os.setf(ios::fixed);
1341 os << "\\screen_font_sizes"
1342 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1343 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1344 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1345 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1346 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1347 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1348 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1349 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1350 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1351 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1356 << "# COLOR SECTION ###################################\n"
1360 for (int i = 0; i < LColor::ignore; ++i) {
1361 LColor::color lc = static_cast<LColor::color>(i);
1363 string const col(lcolor.getX11Name(lc));
1364 if (col != system_lcolor.getX11Name(lc)) {
1365 os << "\\set_color \""
1366 << lcolor.getLyXName(lc) << "\" \""
1372 << "# PRINTER SECTION ###################################\n"
1376 if (printer != system_lyxrc.printer) {
1377 os << "\\printer \"" << printer << "\"\n";
1379 case RC_PRINT_ADAPTOUTPUT:
1380 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1381 os << "\\print_adapt_output "
1382 << tostr(print_adapt_output)
1385 case RC_PRINT_COMMAND:
1386 if (print_command != system_lyxrc.print_command) {
1387 os << "\\print_command \"" << print_command << "\"\n";
1389 case RC_PRINTEXSTRAOPTIONS:
1390 if (print_extra_options != system_lyxrc.print_extra_options) {
1391 os << "\\print_extra_options \"" << print_extra_options
1394 case RC_PRINTSPOOL_COMMAND:
1395 if (print_spool_command != system_lyxrc.print_spool_command) {
1396 os << "\\print_spool_command \"" << print_spool_command
1399 case RC_PRINTSPOOL_PRINTERPREFIX:
1400 if (print_spool_printerprefix
1401 != system_lyxrc.print_spool_printerprefix) {
1402 os << "\\print_spool_printerprefix \""
1403 << print_spool_printerprefix << "\"\n";
1405 case RC_PRINTEVENPAGEFLAG:
1406 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1407 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1410 case RC_PRINTODDPAGEFLAG:
1411 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1412 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1415 case RC_PRINTREVERSEFLAG:
1416 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1417 os << "\\print_reverse_flag \"" << print_reverse_flag
1420 case RC_PRINTLANDSCAPEFLAG:
1421 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1422 os << "\\print_landscape_flag \"" << print_landscape_flag
1425 case RC_PRINTPAGERANGEFLAG:
1426 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1427 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1430 case RC_PRINTCOPIESFLAG:
1431 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1432 os << "\\print_copies_flag \"" << print_copies_flag
1435 case RC_PRINTCOLLCOPIESFLAG:
1436 if (print_collcopies_flag
1437 != system_lyxrc.print_collcopies_flag) {
1438 os << "\\print_collcopies_flag \""
1439 << print_collcopies_flag
1442 case RC_PRINTPAPERFLAG:
1443 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1444 os << "\\print_paper_flag \"" << print_paper_flag
1447 case RC_PRINTPAPERDIMENSIONFLAG:
1448 if (print_paper_dimension_flag
1449 != system_lyxrc.print_paper_dimension_flag) {
1450 os << "\\print_paper_dimension_flag \""
1451 << print_paper_dimension_flag << "\"\n";
1453 case RC_PRINTTOPRINTER:
1454 if (print_to_printer != system_lyxrc.print_to_printer) {
1455 os << "\\print_to_printer \"" << print_to_printer
1458 case RC_PRINTTOFILE:
1459 if (print_to_file != system_lyxrc.print_to_file) {
1460 os << "\\print_to_file \"" << print_to_file << "\"\n";
1462 case RC_PRINTFILEEXTENSION:
1463 if (print_file_extension != system_lyxrc.print_file_extension) {
1464 os << "\\print_file_extension \""
1465 << print_file_extension
1470 << "# EXPORT SECTION ####################################\n"
1473 case RC_CUSTOM_EXPORT_COMMAND:
1474 if (custom_export_command
1475 != system_lyxrc.custom_export_command) {
1476 os << "\\custom_export_command \""
1477 << custom_export_command
1480 case RC_CUSTOM_EXPORT_FORMAT:
1481 if (custom_export_format
1482 != system_lyxrc.custom_export_format) {
1483 os << "\\custom_export_format \"" << custom_export_format
1488 << "# TEX SECTION #######################################\n"
1491 case RC_FONT_ENCODING:
1492 if (fontenc != system_lyxrc.fontenc) {
1493 os << "\\font_encoding \"" << fontenc << "\"\n";
1497 << "# FILE SECTION ######################################\n"
1500 case RC_DOCUMENTPATH:
1501 if (document_path != system_lyxrc.document_path) {
1502 os << "\\document_path \"" << document_path << "\"\n";
1505 if (lastfiles != system_lyxrc.lastfiles) {
1506 os << "\\lastfiles \"" << lastfiles << "\"\n";
1508 case RC_NUMLASTFILES:
1509 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1510 os << "\\num_lastfiles " << num_lastfiles << '\n';
1512 case RC_CHECKLASTFILES:
1513 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1514 os << "\\check_lastfiles " << tostr(check_lastfiles)
1517 case RC_TEMPLATEPATH:
1518 if (template_path != system_lyxrc.template_path) {
1519 os << "\\template_path \"" << template_path << "\"\n";
1521 case RC_TEMPDIRPATH:
1522 if (tempdir_path != system_lyxrc.tempdir_path) {
1523 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1527 case RC_ASCII_LINELEN:
1528 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1529 os << "\\ascii_linelen " << ascii_linelen << '\n';
1531 case RC_MAKE_BACKUP:
1532 if (make_backup != system_lyxrc.make_backup) {
1533 os << "\\make_backup " << tostr(make_backup) << '\n';
1535 case RC_BACKUPDIR_PATH:
1536 if (backupdir_path != system_lyxrc.backupdir_path) {
1537 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1541 << "# ASCII EXPORT SECTION ##############################\n"
1544 case RC_ASCIIROFF_COMMAND:
1545 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1546 os << "\\ascii_roff_command \"" << ascii_roff_command
1551 << "# SPELLCHECKER SECTION ##############################\n"
1553 case RC_USE_SPELL_LIB:
1554 if (use_spell_lib != system_lyxrc.use_spell_lib) {
1555 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1557 case RC_SPELL_COMMAND:
1558 if (isp_command != system_lyxrc.isp_command) {
1559 os << "\\spell_command \"" << isp_command << "\"\n";
1561 case RC_ACCEPT_COMPOUND:
1562 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1563 os << "\\accept_compound " << tostr(isp_accept_compound)
1566 case RC_USE_ALT_LANG:
1567 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1568 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1572 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1573 os << "\\alternate_language \"" << isp_alt_lang
1576 case RC_USE_ESC_CHARS:
1577 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1578 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1582 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1583 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1585 case RC_USE_PERS_DICT:
1586 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1587 os << "\\use_personal_dictionary "
1588 << tostr(isp_use_pers_dict)
1592 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1593 os << "\\personal_dictionary \"" << isp_pers_dict
1596 case RC_USE_INP_ENC:
1597 if (isp_use_input_encoding
1598 != system_lyxrc.isp_use_input_encoding) {
1599 os << "\\use_input_encoding "
1600 << tostr(isp_use_input_encoding)
1605 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1608 case RC_RTL_SUPPORT:
1609 if (rtl_support != system_lyxrc.rtl_support) {
1610 os << "\\rtl " << tostr(rtl_support) << '\n';
1612 case RC_LANGUAGE_PACKAGE:
1613 if (language_package != system_lyxrc.language_package) {
1614 os << "\\language_package \"" << language_package
1617 case RC_LANGUAGE_GLOBAL_OPTIONS:
1618 if (language_global_options
1619 != system_lyxrc.language_global_options) {
1620 os << "\\language_global_options \""
1621 << tostr(language_global_options)
1624 case RC_LANGUAGE_USE_BABEL:
1625 if (language_use_babel != system_lyxrc.language_use_babel) {
1626 os << "\\language_use_babel \""
1627 << tostr(language_use_babel)
1630 case RC_LANGUAGE_COMMAND_BEGIN:
1631 if (language_command_begin
1632 != system_lyxrc.language_command_begin) {
1633 os << "\\language_command_begin \""
1634 << language_command_begin
1637 case RC_LANGUAGE_COMMAND_END:
1638 if (language_command_end
1639 != system_lyxrc.language_command_end) {
1640 os << "\\language_command_end \"" << language_command_end
1643 case RC_LANGUAGE_COMMAND_LOCAL:
1644 if (language_command_local
1645 != system_lyxrc.language_command_local) {
1646 os << "\\language_command_local \""
1647 << language_command_local
1650 case RC_LANGUAGE_AUTO_BEGIN:
1651 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1652 os << "\\language_auto_begin "
1653 << tostr(language_auto_begin) << '\n';
1655 case RC_LANGUAGE_AUTO_END:
1656 if (language_auto_end != system_lyxrc.language_auto_end) {
1657 os << "\\language_auto_end "
1658 << tostr(language_auto_end) << '\n';
1660 case RC_MARK_FOREIGN_LANGUAGE:
1661 if (mark_foreign_language
1662 != system_lyxrc.mark_foreign_language) {
1663 os << "\\mark_foreign_language " <<
1664 tostr(mark_foreign_language) << '\n';
1668 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1671 case RC_AUTO_NUMBER:
1672 if (auto_number != system_lyxrc.auto_number) {
1673 os << "\\auto_number " << tostr(auto_number) << '\n';
1675 case RC_DEFAULT_LANGUAGE:
1676 if (default_language != system_lyxrc.default_language) {
1677 os << "\\default_language " << default_language << '\n';
1681 << "# FORMATS SECTION ##########################\n"
1685 // Look for deleted formats
1686 for (Formats::const_iterator cit = formats.begin();
1687 cit != formats.end(); ++cit) {
1688 Format const * format =
1689 system_formats.getFormat(cit->name());
1691 format->extension() != cit->extension() ||
1692 format->prettyname() != cit->prettyname() ||
1693 format->shortcut() != cit->shortcut())
1694 os << "\\format \"" << cit->name() << "\" \""
1695 << cit->extension() << "\" \""
1696 << cit->prettyname() << "\" \""
1697 << cit->shortcut() << "\"\n";
1700 // New/modifed formats
1701 for (Formats::const_iterator cit = system_formats.begin();
1702 cit != system_formats.end(); ++cit)
1703 if (!formats.getFormat(cit->name()))
1704 os << "\\format \"" << cit->name()
1705 << "\" \"\" \"\" \"\"\n";
1707 for (Formats::const_iterator cit = formats.begin();
1708 cit != formats.end(); ++cit) {
1709 Format const * format =
1710 system_formats.getFormat(cit->name());
1711 if ((!format || format->viewer() != cit->viewer()) &&
1712 (format || !cit->viewer().empty()))
1713 os << "\\viewer \"" << cit->name() << "\" \""
1714 << cit->viewer() << "\"\n";
1718 << "# CONVERTERS SECTION ##########################\n"
1722 // Look for new converters
1723 for (Converters::const_iterator cit = converters.begin();
1724 cit != converters.end(); ++cit) {
1725 Converter const * converter =
1726 system_converters.getConverter(cit->from,
1729 converter->command != cit->command ||
1730 converter->flags != cit->flags)
1731 os << "\\converter \"" << cit->from << "\" \""
1732 << cit->to << "\" \""
1733 << cit->command << "\" \""
1734 << cit->flags << "\"\n";
1737 // New/modifed converters
1738 for (Converters::const_iterator cit = system_converters.begin();
1739 cit != system_converters.end(); ++cit)
1740 if (!converters.getConverter(cit->from, cit->to))
1741 os << "\\converter \"" << cit->from
1742 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1748 void LyXRC::set_font_norm_type()
1750 if (font_norm == "iso10646-1")
1751 font_norm_type = ISO_10646_1;
1752 else if (font_norm == "iso8859-1")
1753 font_norm_type = ISO_8859_1;
1754 else if (font_norm == "iso8859-3")
1755 font_norm_type = ISO_8859_3;
1756 else if (font_norm == "iso8859-4")
1757 font_norm_type = ISO_8859_4;
1758 else if (font_norm == "iso8859-6.8x")
1759 font_norm_type = ISO_8859_6_8;
1760 else if (font_norm == "iso8859-9")
1761 font_norm_type = ISO_8859_9;
1762 else if (font_norm == "iso8859-15")
1763 font_norm_type = ISO_8859_15;
1765 font_norm_type = OTHER_ENCODING;
1769 string const LyXRC::getDescription(LyXRCTags tag)
1774 case RC_FONT_ENCODING:
1775 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1779 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1782 case RC_PRINT_COMMAND:
1783 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1786 case RC_PRINTEVENPAGEFLAG:
1787 str = _("The option to print only even pages.");
1790 case RC_PRINTODDPAGEFLAG:
1791 str = _("The option to print only odd pages.");
1794 case RC_PRINTPAGERANGEFLAG:
1795 str = _("The option for specifying a comma-separated list of pages to print.");
1798 case RC_PRINTCOPIESFLAG:
1799 str = _("The option for specifying the number of copies to print.");
1802 case RC_PRINTCOLLCOPIESFLAG:
1803 str = _("The option for specifying whether the copies should be collated.");
1806 case RC_PRINTREVERSEFLAG:
1807 str = _("The option to reverse the order of the pages printed.");
1810 case RC_PRINTLANDSCAPEFLAG:
1811 str = _("The option to print out in landscape.");
1814 case RC_PRINTPAPERFLAG:
1815 str = _("The option to specify paper type.");
1818 case RC_PRINTPAPERDIMENSIONFLAG:
1819 str = _("Option to specify the dimensions of the print paper.");
1822 case RC_PRINTTOPRINTER:
1823 str = _("Option to pass to the print program to print on a specific printer.");
1826 case RC_PRINT_ADAPTOUTPUT:
1827 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1830 case RC_PRINTTOFILE:
1831 str = _("Option to pass to the print program to print to a file.");
1834 case RC_PRINTFILEEXTENSION:
1835 str = _("Extension of printer program output file. Usually \".ps\".");
1838 case RC_PRINTEXSTRAOPTIONS:
1839 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1842 case RC_PRINTSPOOL_COMMAND:
1843 str = _("When set, this printer option automatically prints to a file and then calls a separate print spooling program on that file with the given name and arguments.");
1846 case RC_PRINTSPOOL_PRINTERPREFIX:
1847 str = _("If you specify a printer name in the print dialog, the following argument is prepended along with the printer name after the spool command.");
1851 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1854 case RC_SCREEN_ZOOM:
1855 //xgettext:no-c-format
1856 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1859 case RC_SCREEN_FONT_SIZES:
1860 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1863 case RC_SCREEN_FONT_ROMAN:
1864 case RC_SCREEN_FONT_SANS:
1865 case RC_SCREEN_FONT_TYPEWRITER:
1866 str = _("The screen fonts used to display the text while editing.");
1869 case RC_POPUP_BOLD_FONT:
1870 str = _("The bold font in the dialogs.");
1873 case RC_POPUP_NORMAL_FONT:
1874 str = _("The normal font in the dialogs.");
1877 case RC_SCREEN_FONT_ENCODING:
1878 str = _("The encoding for the screen fonts.");
1881 case RC_POPUP_FONT_ENCODING:
1882 str = _("The encoding for the menu/popups fonts.");
1889 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1892 case RC_DOCUMENTPATH:
1893 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1896 case RC_TEMPLATEPATH:
1897 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1900 case RC_TEMPDIRPATH:
1901 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1905 str = _("The file where the last-files information should be stored.");
1908 case RC_AUTOREGIONDELETE:
1909 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1912 case RC_AUTORESET_OPTIONS:
1913 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1917 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1921 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1925 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1929 case RC_KBMAP_PRIMARY:
1930 case RC_KBMAP_SECONDARY:
1931 str = _("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard.");
1934 case RC_ASCIIROFF_COMMAND:
1935 str = _("Use to define an external program to render tables in the ASCII output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"none\" is specified, an internal routine is used.");
1938 case RC_ASCII_LINELEN:
1939 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1942 case RC_NUMLASTFILES:
1943 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1946 case RC_CHECKLASTFILES:
1947 str = _("Select to check whether the lastfiles still exist.");
1950 case RC_VIEWDVI_PAPEROPTION:
1951 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1954 case RC_DEFAULT_PAPERSIZE:
1955 str = _("Specify the default paper size.");
1958 case RC_ACCEPT_COMPOUND:
1959 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1962 case RC_SPELL_COMMAND:
1963 str = _("What command runs the spell checker?");
1966 case RC_USE_INP_ENC:
1967 str = _("Specify whether to pass the -T input encoding option to ispell. Enable this if you can't spellcheck words with international letters in them. This may not work with all dictionaries.");
1970 case RC_USE_ALT_LANG:
1972 str = _("Specify an alternate language. The default is to use the language of the document.");
1975 case RC_USE_PERS_DICT:
1977 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1980 case RC_USE_ESC_CHARS:
1982 str = _("Specify additional chars that can be part of a word.");
1985 case RC_SCREEN_FONT_SCALABLE:
1986 str = _("Allow bitmap fonts to be resized. If you are using a bitmap font, selecting this option may make some fonts look blocky in LyX. Deselecting this option makes LyX use the nearest bitmap font size available, instead of scaling.");
1989 case RC_CHKTEX_COMMAND:
1990 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1993 case RC_BIBTEX_COMMAND:
1994 str = _("Define the options of bibtex (cf. man bibtex) or select and alternative compiler (e.g. mlbibtex or bibulus).");
1997 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1998 str = _("LyX normally doesn't update the cursor position if you move the scrollbar. Set to true if you'd prefer to always have the cursor on screen.");
2001 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2002 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2005 case RC_DISPLAY_GRAPHICS:
2006 str = _("Select how LyX will display any graphics.");
2009 case RC_MAKE_BACKUP:
2010 str = _("De-select if you don't want LyX to create backup files.");
2013 case RC_BACKUPDIR_PATH:
2014 str = _("The path for storing backup files. If it is an empty string, LyX will store the backup file in the same directory as the original file.");
2017 case RC_RTL_SUPPORT:
2018 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2021 case RC_MARK_FOREIGN_LANGUAGE:
2022 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2025 case RC_LANGUAGE_PACKAGE:
2026 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2029 case RC_LANGUAGE_GLOBAL_OPTIONS:
2030 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2033 case RC_LANGUAGE_USE_BABEL:
2034 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2037 case RC_LANGUAGE_AUTO_BEGIN:
2038 str = _("Select if a language switching command is needed at the beginning of the document.");
2041 case RC_LANGUAGE_AUTO_END:
2042 str = _("Select if a language switching command is needed at the end of the document.");
2045 case RC_LANGUAGE_COMMAND_BEGIN:
2046 str = _("The LaTeX command for changing from the language of the document to another language. E.g. \\selectlanguage{$$lang} where $$lang is substituted by the name of the second language.");
2049 case RC_LANGUAGE_COMMAND_END:
2050 str = _("The LaTeX command for changing back to the language of the document.");
2053 case RC_LANGUAGE_COMMAND_LOCAL:
2054 str = _("The LaTeX command for local changing of the language.");
2057 case RC_DATE_INSERT_FORMAT:
2058 //xgettext:no-c-format
2059 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2062 case RC_SHOW_BANNER:
2063 str = _("De-select if you don't want the startup banner.");
2067 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2079 case RC_DEFAULT_LANGUAGE:
2080 str = _("New documents will be assigned this language.");
2083 case RC_LABEL_INIT_LENGTH:
2084 str = _("Maximum number of words in the initialization string for a new label");
2088 str = _("Shows a typeset preview of things such as math");
2091 case RC_PREVIEW_HASHED_LABELS:
2092 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2095 case RC_PREVIEW_SCALE_FACTOR:
2096 str = _("Scale the preview size to suit.");
2106 // The global instance
2109 // The global copy of the system lyxrc entries (everything except preferences)