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 { "\\bind_file", LyXRC::RC_BINDFILE },
69 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
70 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
71 { "\\converter", LyXRC::RC_CONVERTER },
72 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
73 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
74 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
75 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
76 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
77 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
78 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
79 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
80 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
81 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
82 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
83 { "\\format", LyXRC::RC_FORMAT },
84 { "\\input", LyXRC::RC_INPUT },
85 { "\\kbmap", LyXRC::RC_KBMAP },
86 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
87 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
88 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
89 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
90 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
91 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
92 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
93 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
94 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
95 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
96 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
97 { "\\lastfiles", LyXRC::RC_LASTFILES },
98 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
99 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
100 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
101 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
102 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
103 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
104 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
105 { "\\preview", LyXRC::RC_PREVIEW },
106 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
107 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
108 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
109 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
110 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
111 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
112 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
113 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
114 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
115 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
116 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
117 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
118 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
119 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
120 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
121 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
122 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
123 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
124 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
125 { "\\printer", LyXRC::RC_PRINTER },
126 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
127 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
128 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
129 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
130 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
131 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
132 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
133 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
134 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
135 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
136 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
137 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
138 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
139 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
140 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
141 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
142 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
143 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
144 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
145 { "\\set_color", LyXRC::RC_SET_COLOR },
146 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
147 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
148 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
149 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
150 { "\\ui_file", LyXRC::RC_UIFILE },
151 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
152 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
153 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
154 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
155 // compatibility with versions older than 1.4.0 only
156 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
157 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
158 // compatibility with versions older than 1.4.0 only
159 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
160 { "\\user_email", LyXRC::RC_USER_EMAIL },
161 { "\\user_name", LyXRC::RC_USER_NAME },
162 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
163 { "\\viewer" ,LyXRC::RC_VIEWER},
164 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
167 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
178 void LyXRC::setDefaults() {
181 // Get printer from the environment. If fail, use default "",
182 // assuming that everything is set up correctly.
183 printer = GetEnv("PRINTER");
184 print_adapt_output = false;
185 print_command = "dvips";
186 print_evenpage_flag = "-B";
187 print_oddpage_flag = "-A";
188 print_pagerange_flag = "-pp";
189 print_copies_flag = "-c";
190 print_collcopies_flag = "-C";
191 print_reverse_flag = "-r";
192 print_landscape_flag = "-t landscape";
193 print_to_printer = "-P";
194 print_to_file = "-o ";
195 print_file_extension = ".ps";
196 print_paper_flag = "-t";
197 print_paper_dimension_flag = "-T";
198 document_path.erase();
199 tempdir_path = "/tmp";
200 view_dvi_paper_option.erase();
201 default_papersize = PAPER_USLETTER;
202 custom_export_format = "ps";
203 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
206 // Because a screen typically is wider than a piece of paper:
209 // Default LaTeX font size:
210 font_sizes[LyXFont::SIZE_TINY] = 5.0;
211 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
212 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
213 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
214 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
215 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
216 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
217 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
218 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
219 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
220 use_scalable_fonts = true;
221 roman_font_name = "";
223 typewriter_font_name = "";
224 popup_bold_font = "-*-helvetica-bold-r";
225 popup_normal_font = "-*-helvetica-medium-r";
226 font_norm = "iso8859-1";
227 font_norm_type = ISO_8859_1;
228 popup_font_encoding.erase();
230 auto_region_delete = true;
231 auto_reset_options = false;
234 check_lastfiles = true;
236 backupdir_path.erase();
237 display_graphics = lyx::graphics::ColorDisplay;
238 // Spellchecker settings:
239 use_spell_lib = true;
240 isp_command = "ispell";
241 isp_accept_compound = false;
242 isp_use_input_encoding = false;
243 isp_use_alt_lang = false;
244 isp_use_pers_dict = false;
245 isp_use_esc_chars = false;
249 mark_foreign_language = true;
250 language_auto_begin = true;
251 language_auto_end = true;
252 language_global_options = true;
253 language_use_babel = true;
254 language_package = "\\usepackage{babel}";
255 language_command_begin = "\\selectlanguage{$$lang}";
256 language_command_local = "\\foreignlanguage{$$lang}{";
257 default_language = "english";
261 date_insert_format = "%A, %e %B %Y";
262 cursor_follows_scrollbar = false;
263 dialogs_iconify_with_main = false;
264 label_init_length = 3;
266 preview_hashed_labels = false;
267 preview_scale_factor = 0.9;
269 user_name = lyx::support::user_name();
271 user_email = lyx::support::user_email();
273 if (user_email.empty())
274 user_email = _("email address unknown");
280 void oldFontFormat(string & family, string & foundry)
282 if (family.empty() || family[0] != '-')
284 foundry = token(family, '-', 1);
285 family = token(family, '-', 2);
293 int LyXRC::read(string const & filename)
295 LyXLex lexrc(lyxrcTags, lyxrcCount);
296 if (lyxerr.debugging(Debug::PARSER))
297 lexrc.printTable(lyxerr);
299 lexrc.setFile(filename);
300 if (!lexrc.isOK()) return -2;
302 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
304 while (lexrc.isOK()) {
305 // By using two switches we take advantage of the compiler
306 // telling us if we have missed a LyXRCTags element in
307 // the second switch.
308 // Note that this also shows a problem with LyXLex since it
309 // helps us avoid taking advantage of the strictness of the
312 int le = lexrc.lex();
314 case LyXLex::LEX_UNDEF:
315 lexrc.printError("Unknown tag `$$Token'");
317 case LyXLex::LEX_FEOF:
321 switch (static_cast<LyXRCTags>(le)) {
322 case RC_INPUT: // Include file
325 LibFileSearch(string(),
328 lexrc.printError("Error reading "
329 "included file: "+tmp);
333 case RC_BINDFILE: // RVDK_PATCH_5
335 bind_file = lexrc.getString();
341 ui_file = lexrc.getString();
345 case RC_AUTORESET_OPTIONS:
347 auto_reset_options = lexrc.getBool();
351 case RC_DISPLAY_GRAPHICS:
353 display_graphics = lyx::graphics::displayTranslator().find(lexrc.getString());
359 use_kbmap = lexrc.getBool();
363 case RC_KBMAP_PRIMARY:
365 string const kmap(lexrc.getString());
368 } else if (!LibFileSearch("kbd", kmap,
370 primary_kbmap = kmap;
372 lexrc.printError("LyX: Keymap `$$Token' not found");
377 case RC_KBMAP_SECONDARY:
379 string const kmap(lexrc.getString());
382 } else if (!LibFileSearch("kbd", kmap,
384 secondary_kbmap = kmap;
386 lexrc.printError("LyX: Keymap `$$Token' not found");
391 case RC_FONT_ENCODING:
393 fontenc = lexrc.getString();
399 printer = lexrc.getString();
403 case RC_PRINT_COMMAND:
405 print_command = lexrc.getString();
409 case RC_PRINTEVENPAGEFLAG:
411 print_evenpage_flag = lexrc.getString();
415 case RC_PRINTODDPAGEFLAG:
417 print_oddpage_flag = lexrc.getString();
421 case RC_PRINTPAGERANGEFLAG:
423 print_pagerange_flag = lexrc.getString();
427 case RC_PRINTCOPIESFLAG:
429 print_copies_flag = lexrc.getString();
433 case RC_PRINTCOLLCOPIESFLAG:
435 print_collcopies_flag = lexrc.getString();
439 case RC_PRINTREVERSEFLAG:
441 print_reverse_flag = lexrc.getString();
445 case RC_PRINTLANDSCAPEFLAG:
447 print_landscape_flag = lexrc.getString();
451 case RC_PRINTTOPRINTER:
453 print_to_printer = lexrc.getString();
457 case RC_PRINT_ADAPTOUTPUT:
459 print_adapt_output = lexrc.getBool();
465 print_to_file = lexrc.getString();
469 case RC_PRINTFILEEXTENSION:
471 print_file_extension = lexrc.getString();
475 case RC_PRINTEXSTRAOPTIONS:
477 print_extra_options = lexrc.getString();
481 case RC_PRINTSPOOL_COMMAND:
483 print_spool_command = lexrc.getString();
487 case RC_PRINTSPOOL_PRINTERPREFIX:
489 print_spool_printerprefix = lexrc.getString();
493 case RC_PRINTPAPERDIMENSIONFLAG:
495 print_paper_dimension_flag = lexrc.getString();
499 case RC_PRINTPAPERFLAG:
501 print_paper_flag = lexrc.getString();
505 case RC_CUSTOM_EXPORT_COMMAND:
507 custom_export_command = lexrc.getString();
511 case RC_CUSTOM_EXPORT_FORMAT:
513 custom_export_format = lexrc.getString();
517 case RC_DEFAULT_PAPERSIZE:
520 ascii_lowercase(lexrc.getString());
521 if (size == "usletter")
524 else if (size == "legal")
527 else if (size == "executive")
529 PAPER_EXECUTIVEPAPER;
530 else if (size == "a3")
533 else if (size == "a4")
536 else if (size == "a5")
539 else if (size == "b5")
545 case RC_VIEWDVI_PAPEROPTION:
547 view_dvi_paper_option = lexrc.getString();
549 view_dvi_paper_option.erase();
553 case RC_CHKTEX_COMMAND:
555 chktex_command = lexrc.getString();
561 dpi = lexrc.getInteger();
567 zoom = lexrc.getInteger();
573 wheel_jump = lexrc.getInteger();
577 case RC_SCREEN_FONT_SIZES:
579 font_sizes[LyXFont::SIZE_TINY] =
583 font_sizes[LyXFont::SIZE_SCRIPT] =
587 font_sizes[LyXFont::SIZE_FOOTNOTE] =
591 font_sizes[LyXFont::SIZE_SMALL] =
595 font_sizes[LyXFont::SIZE_NORMAL] =
599 font_sizes[LyXFont::SIZE_LARGE] =
603 font_sizes[LyXFont::SIZE_LARGER] =
607 font_sizes[LyXFont::SIZE_LARGEST] =
611 font_sizes[LyXFont::SIZE_HUGE] =
615 font_sizes[LyXFont::SIZE_HUGER] =
620 case RC_SCREEN_FONT_SCALABLE:
622 use_scalable_fonts = lexrc.getBool();
628 autosave = lexrc.getInteger();
632 case RC_DOCUMENTPATH:
634 document_path = ExpandPath(lexrc.getString());
638 case RC_TEMPLATEPATH:
640 template_path = ExpandPath(lexrc.getString());
646 tempdir_path = ExpandPath(lexrc.getString());
652 lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
658 lastfiles = ExpandPath(lexrc.getString());
662 case RC_NUMLASTFILES:
664 num_lastfiles = lexrc.getInteger();
668 case RC_CHECKLASTFILES:
670 check_lastfiles = lexrc.getBool();
674 case RC_SCREEN_FONT_ROMAN:
676 roman_font_name = lexrc.getString();
677 oldFontFormat(roman_font_name,
682 case RC_SCREEN_FONT_SANS:
684 sans_font_name = lexrc.getString();
685 oldFontFormat(sans_font_name, sans_font_foundry);
689 case RC_SCREEN_FONT_TYPEWRITER:
691 typewriter_font_name = lexrc.getString();
692 oldFontFormat(typewriter_font_name,
693 typewriter_font_foundry);
697 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
699 roman_font_foundry = lexrc.getString();
703 case RC_SCREEN_FONT_SANS_FOUNDRY:
705 sans_font_foundry = lexrc.getString();
709 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
711 typewriter_font_foundry = lexrc.getString();
715 case RC_SCREEN_FONT_ENCODING:
717 font_norm = lexrc.getString();
718 set_font_norm_type();
722 case RC_POPUP_BOLD_FONT:
724 popup_bold_font = lexrc.getString();
728 case RC_POPUP_NORMAL_FONT:
730 popup_normal_font = lexrc.getString();
734 case RC_POPUP_FONT_ENCODING:
736 popup_font_encoding = lexrc.getString();
742 string lyx_name, x11_name;
745 lyx_name = lexrc.getString();
747 lexrc.printError("Missing color tag.");
752 x11_name = lexrc.getString();
754 lexrc.printError("Missing color name for color: `$$Token'");
758 LColor::color col = lcolor.getFromLyXName(lyx_name);
759 if (!lcolor.setColor(col, x11_name)) {
760 lyxerr << "Bad lyxrc set_color for "
766 case RC_AUTOREGIONDELETE:
767 // Auto region delete defaults to true
769 auto_region_delete = lexrc.getBool();
775 lyxpipes = ExpandPath(lexrc.getString());
779 case RC_CURSOR_FOLLOWS_SCROLLBAR:
781 cursor_follows_scrollbar = lexrc.getBool();
785 case RC_DIALOGS_ICONIFY_WITH_MAIN:
787 dialogs_iconify_with_main = lexrc.getBool();
791 case RC_ASCIIROFF_COMMAND:
793 ascii_roff_command = lexrc.getString();
796 case RC_ASCII_LINELEN:
798 ascii_linelen = lexrc.getInteger();
801 // Spellchecker settings:
802 case RC_USE_SPELL_LIB:
804 use_spell_lib = lexrc.getBool();
807 case RC_SPELL_COMMAND:
809 isp_command = lexrc.getString();
812 case RC_ACCEPT_COMPOUND:
814 isp_accept_compound = lexrc.getBool();
819 isp_use_input_encoding = lexrc.getBool();
822 case RC_USE_ALT_LANG:
824 isp_use_alt_lang = lexrc.getBool();
827 case RC_USE_PERS_DICT:
829 isp_use_pers_dict = lexrc.getBool();
832 case RC_USE_ESC_CHARS:
834 isp_use_esc_chars = lexrc.getBool();
839 isp_alt_lang = lexrc.getString();
844 isp_pers_dict = lexrc.getString();
849 isp_esc_chars = lexrc.getString();
854 make_backup = lexrc.getBool();
857 case RC_BACKUPDIR_PATH:
859 backupdir_path = ExpandPath(lexrc.getString());
862 case RC_DATE_INSERT_FORMAT:
864 date_insert_format = lexrc.getString();
867 case RC_LANGUAGE_PACKAGE:
869 language_package = lexrc.getString();
872 case RC_LANGUAGE_AUTO_BEGIN:
874 language_auto_begin = lexrc.getBool();
877 case RC_LANGUAGE_AUTO_END:
879 language_auto_end = lexrc.getBool();
882 case RC_LANGUAGE_GLOBAL_OPTIONS:
884 language_global_options = lexrc.getBool();
887 case RC_LANGUAGE_USE_BABEL:
889 language_use_babel = lexrc.getBool();
892 case RC_LANGUAGE_COMMAND_BEGIN:
894 language_command_begin = lexrc.getString();
897 case RC_LANGUAGE_COMMAND_END:
899 language_command_end = lexrc.getString();
902 case RC_LANGUAGE_COMMAND_LOCAL:
904 language_command_local = lexrc.getString();
909 rtl_support = lexrc.getBool();
914 auto_number = lexrc.getBool();
917 case RC_MARK_FOREIGN_LANGUAGE:
919 mark_foreign_language = lexrc.getBool();
924 string from, to, command, flags;
926 from = lexrc.getString();
929 to = lexrc.getString();
932 command = lexrc.getString();
935 flags = lexrc.getString();
938 || token(command, ' ', 0) == "none") {
939 converters.erase(from, to);
941 converters.add(from, to, command, flags);
946 string format, command;
948 format = lexrc.getString();
951 command = lexrc.getString();
952 if (token(command, ' ', 0) == "none")
955 formats.setViewer(format, command);
959 string format, extension, prettyname, shortcut;
961 format = lexrc.getString();
964 extension = lexrc.getString();
967 prettyname = lexrc.getString();
970 shortcut = lexrc.getString();
972 if (prettyname.empty()) {
973 if (converters.formatIsUsed(format)) {
974 lyxerr << "Can't delete format "
977 formats.erase(format);
980 formats.add(format, extension, prettyname,
985 case RC_DEFAULT_LANGUAGE:
987 default_language = lexrc.getString();
991 case RC_LABEL_INIT_LENGTH:
993 label_init_length = lexrc.getInteger();
999 show_banner = lexrc.getBool();
1005 preview = lexrc.getBool();
1009 case RC_PREVIEW_HASHED_LABELS:
1011 preview_hashed_labels = lexrc.getBool();
1015 case RC_PREVIEW_SCALE_FACTOR:
1017 preview_scale_factor = lexrc.getFloat();
1023 user_name = lexrc.getString();
1028 user_email = lexrc.getString();
1031 case RC_LAST: break; // this is just a dummy
1035 /// Update converters data-structures
1036 converters.update(formats);
1037 converters.buildGraph();
1043 void LyXRC::write(string const & filename) const
1045 ofstream ofs(filename.c_str());
1051 void LyXRC::print() const
1053 if (lyxerr.debugging())
1060 void LyXRC::output(ostream & os) const
1062 os << "### This file is part of\n"
1063 << "### ========================================================\n"
1064 << "### LyX, The Document Processor\n"
1066 << "### Copyright 1995 Matthias Ettrich\n"
1067 << "### Copyright 1995-2001 The LyX Team.\n"
1069 << "### ========================================================\n"
1071 << "# This file is written by LyX, if you want to make your own\n"
1072 << "# modifications you should do them from inside LyX and save\n"
1075 // Why the switch you might ask. It is a trick to ensure that all
1076 // the elements in the LyXRCTags enum is handled. As you can see
1077 // there are no breaks at all. So it is just a huge fall-through.
1078 // The nice thing is that we will get a warning from the compiler
1079 // if we forget an element.
1080 LyXRCTags tag = RC_LAST;
1084 // input/include files are not done here
1086 if (bind_file != system_lyxrc.bind_file) {
1087 os << "\\bind_file " << bind_file << "\n";
1093 << "# MISC SECTION ######################################\n"
1096 // bind files are not done here.
1098 if (ui_file != system_lyxrc.ui_file) {
1099 os << "\\ui_file \"" << ui_file << "\"\n";
1101 case RC_AUTOREGIONDELETE:
1102 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1103 os << "# Set to false to inhibit automatic replacement of\n"
1104 << "# the current selection.\n"
1105 << "\\auto_region_delete " << tostr(auto_region_delete)
1108 case RC_AUTORESET_OPTIONS:
1109 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1110 os << "# Set to false to inhibit automatic reset of\n"
1111 << "# the class options to defaults on class change.\n"
1112 << "\\auto_reset_options " << tostr(auto_reset_options)
1116 if (autosave != system_lyxrc.autosave) {
1117 os << "# The time interval between auto-saves in seconds.\n"
1118 << "\\autosave " << autosave << '\n';
1120 case RC_DISPLAY_GRAPHICS:
1121 if (display_graphics != system_lyxrc.display_graphics) {
1122 os << "# Display graphics within LyX\n"
1123 << "# monochrome|grayscale|color|none\n"
1124 << "\\display_graphics "
1125 << lyx::graphics::displayTranslator().find(display_graphics)
1129 case RC_VIEWDVI_PAPEROPTION:
1130 if (view_dvi_paper_option
1131 != system_lyxrc.view_dvi_paper_option) {
1132 os << "# Options used to specify paper size to the\n"
1133 << "# view_dvi_command (e.g. -paper)\n"
1134 << "\\view_dvi_paper_option \""
1135 << view_dvi_paper_option << "\"\n";
1137 case RC_DEFAULT_PAPERSIZE:
1138 if (default_papersize != system_lyxrc.default_papersize) {
1139 os << "# The default papersize to use.\n"
1140 << "\\default_papersize \"";
1141 switch (default_papersize) {
1142 case PAPER_USLETTER:
1143 os << "usletter"; break;
1144 case PAPER_LEGALPAPER:
1145 os << "legal"; break;
1146 case PAPER_EXECUTIVEPAPER:
1147 os << "executive"; break;
1156 case PAPER_DEFAULT: break;
1160 case RC_CHKTEX_COMMAND:
1161 if (chktex_command != system_lyxrc.chktex_command) {
1162 os << "\\chktex_command \"" << chktex_command << "\"\n";
1165 if (use_kbmap != system_lyxrc.use_kbmap) {
1166 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1168 case RC_KBMAP_PRIMARY:
1169 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1170 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1172 case RC_KBMAP_SECONDARY:
1173 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1174 os << "\\kbmap_secondary \"" << secondary_kbmap
1178 if (lyxpipes != system_lyxrc.lyxpipes) {
1179 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1181 case RC_DATE_INSERT_FORMAT:
1182 if (date_insert_format != system_lyxrc.date_insert_format) {
1183 os << "\\date_insert_format \"" << date_insert_format
1186 case RC_LABEL_INIT_LENGTH:
1187 if (label_init_length != system_lyxrc.label_init_length) {
1188 os << "\\label_init_length " << label_init_length
1193 os << "\\user_name \"" << user_name << "\"\n";
1196 os << "\\user_email \"" << user_email << "\"\n";
1198 case RC_SHOW_BANNER:
1199 if (show_banner != system_lyxrc.show_banner) {
1200 os << "\\show_banner " << tostr(show_banner) << '\n';
1204 if (preview != system_lyxrc.preview) {
1205 os << "\\preview " << tostr(preview) << '\n';
1208 case RC_PREVIEW_HASHED_LABELS:
1209 if (preview_hashed_labels !=
1210 system_lyxrc.preview_hashed_labels) {
1211 os << "\\preview_hashed_labels "
1212 << tostr(preview_hashed_labels) << '\n';
1215 case RC_PREVIEW_SCALE_FACTOR:
1216 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1217 os << "\\preview_scale_factor "
1218 << preview_scale_factor << '\n';
1222 << "# SCREEN & FONTS SECTION ############################\n"
1225 case RC_POPUP_NORMAL_FONT:
1226 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1227 os << "\\popup_normal_font \"" << popup_normal_font
1230 case RC_POPUP_BOLD_FONT:
1231 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1232 os << "\\popup_bold_font \"" << popup_bold_font
1235 case RC_POPUP_FONT_ENCODING:
1236 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1237 os << "\\popup_font_encoding \"" << popup_font_encoding
1241 if (dpi != system_lyxrc.dpi) {
1242 os << "\\screen_dpi " << dpi << '\n';
1244 case RC_SCREEN_ZOOM:
1245 if (zoom != system_lyxrc.zoom) {
1246 os << "\\screen_zoom " << zoom << '\n';
1249 if (wheel_jump != system_lyxrc.wheel_jump) {
1250 os << "\\wheel_jump " << wheel_jump << '\n';
1252 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1253 if (cursor_follows_scrollbar
1254 != system_lyxrc.cursor_follows_scrollbar) {
1255 os << "\\cursor_follows_scrollbar "
1256 << tostr(cursor_follows_scrollbar) << '\n';
1258 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1259 if (dialogs_iconify_with_main
1260 != system_lyxrc.dialogs_iconify_with_main) {
1261 os << "\\dialogs_iconify_with_main "
1262 << tostr(dialogs_iconify_with_main) << '\n';
1264 case RC_SCREEN_FONT_ROMAN:
1265 if (roman_font_name != system_lyxrc.roman_font_name) {
1266 os << "\\screen_font_roman \"" << roman_font_name
1269 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1270 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1271 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1274 case RC_SCREEN_FONT_SANS:
1275 if (sans_font_name != system_lyxrc.sans_font_name) {
1276 os << "\\screen_font_sans \"" << sans_font_name
1279 case RC_SCREEN_FONT_SANS_FOUNDRY:
1280 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1281 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1284 case RC_SCREEN_FONT_TYPEWRITER:
1285 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1286 os << "\\screen_font_typewriter \""
1287 << typewriter_font_name << "\"\n";
1289 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1290 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1291 os << "\\screen_font_typewriter_foundry \""
1292 << typewriter_font_foundry << "\"\n";
1295 case RC_SCREEN_FONT_SCALABLE:
1296 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1297 os << "\\screen_font_scalable "
1298 << tostr(use_scalable_fonts)
1301 case RC_SCREEN_FONT_ENCODING:
1302 if (font_norm != system_lyxrc.font_norm) {
1303 os << "\\screen_font_encoding \"" << font_norm
1306 case RC_SCREEN_FONT_SIZES:
1307 if (font_sizes[LyXFont::SIZE_TINY]
1308 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1309 font_sizes[LyXFont::SIZE_SCRIPT]
1310 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1311 font_sizes[LyXFont::SIZE_FOOTNOTE]
1312 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1313 font_sizes[LyXFont::SIZE_SMALL]
1314 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1315 font_sizes[LyXFont::SIZE_NORMAL]
1316 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1317 font_sizes[LyXFont::SIZE_LARGE]
1318 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1319 font_sizes[LyXFont::SIZE_LARGER]
1320 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1321 font_sizes[LyXFont::SIZE_LARGEST]
1322 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1323 font_sizes[LyXFont::SIZE_HUGE]
1324 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1325 font_sizes[LyXFont::SIZE_HUGER]
1326 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1327 os.setf(ios::fixed);
1329 os << "\\screen_font_sizes"
1330 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1331 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1332 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1333 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1334 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1335 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1336 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1337 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1338 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1339 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1344 << "# COLOR SECTION ###################################\n"
1348 for (int i = 0; i < LColor::ignore; ++i) {
1349 LColor::color lc = static_cast<LColor::color>(i);
1351 string const col(lcolor.getX11Name(lc));
1352 if (col != system_lcolor.getX11Name(lc)) {
1353 os << "\\set_color \""
1354 << lcolor.getLyXName(lc) << "\" \""
1360 << "# PRINTER SECTION ###################################\n"
1364 if (printer != system_lyxrc.printer) {
1365 os << "\\printer \"" << printer << "\"\n";
1367 case RC_PRINT_ADAPTOUTPUT:
1368 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1369 os << "\\print_adapt_output "
1370 << tostr(print_adapt_output)
1373 case RC_PRINT_COMMAND:
1374 if (print_command != system_lyxrc.print_command) {
1375 os << "\\print_command \"" << print_command << "\"\n";
1377 case RC_PRINTEXSTRAOPTIONS:
1378 if (print_extra_options != system_lyxrc.print_extra_options) {
1379 os << "\\print_extra_options \"" << print_extra_options
1382 case RC_PRINTSPOOL_COMMAND:
1383 if (print_spool_command != system_lyxrc.print_spool_command) {
1384 os << "\\print_spool_command \"" << print_spool_command
1387 case RC_PRINTSPOOL_PRINTERPREFIX:
1388 if (print_spool_printerprefix
1389 != system_lyxrc.print_spool_printerprefix) {
1390 os << "\\print_spool_printerprefix \""
1391 << print_spool_printerprefix << "\"\n";
1393 case RC_PRINTEVENPAGEFLAG:
1394 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1395 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1398 case RC_PRINTODDPAGEFLAG:
1399 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1400 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1403 case RC_PRINTREVERSEFLAG:
1404 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1405 os << "\\print_reverse_flag \"" << print_reverse_flag
1408 case RC_PRINTLANDSCAPEFLAG:
1409 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1410 os << "\\print_landscape_flag \"" << print_landscape_flag
1413 case RC_PRINTPAGERANGEFLAG:
1414 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1415 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1418 case RC_PRINTCOPIESFLAG:
1419 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1420 os << "\\print_copies_flag \"" << print_copies_flag
1423 case RC_PRINTCOLLCOPIESFLAG:
1424 if (print_collcopies_flag
1425 != system_lyxrc.print_collcopies_flag) {
1426 os << "\\print_collcopies_flag \""
1427 << print_collcopies_flag
1430 case RC_PRINTPAPERFLAG:
1431 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1432 os << "\\print_paper_flag \"" << print_paper_flag
1435 case RC_PRINTPAPERDIMENSIONFLAG:
1436 if (print_paper_dimension_flag
1437 != system_lyxrc.print_paper_dimension_flag) {
1438 os << "\\print_paper_dimension_flag \""
1439 << print_paper_dimension_flag << "\"\n";
1441 case RC_PRINTTOPRINTER:
1442 if (print_to_printer != system_lyxrc.print_to_printer) {
1443 os << "\\print_to_printer \"" << print_to_printer
1446 case RC_PRINTTOFILE:
1447 if (print_to_file != system_lyxrc.print_to_file) {
1448 os << "\\print_to_file \"" << print_to_file << "\"\n";
1450 case RC_PRINTFILEEXTENSION:
1451 if (print_file_extension != system_lyxrc.print_file_extension) {
1452 os << "\\print_file_extension \""
1453 << print_file_extension
1458 << "# EXPORT SECTION ####################################\n"
1461 case RC_CUSTOM_EXPORT_COMMAND:
1462 if (custom_export_command
1463 != system_lyxrc.custom_export_command) {
1464 os << "\\custom_export_command \""
1465 << custom_export_command
1468 case RC_CUSTOM_EXPORT_FORMAT:
1469 if (custom_export_format
1470 != system_lyxrc.custom_export_format) {
1471 os << "\\custom_export_format \"" << custom_export_format
1476 << "# TEX SECTION #######################################\n"
1479 case RC_FONT_ENCODING:
1480 if (fontenc != system_lyxrc.fontenc) {
1481 os << "\\font_encoding \"" << fontenc << "\"\n";
1485 << "# FILE SECTION ######################################\n"
1488 case RC_DOCUMENTPATH:
1489 if (document_path != system_lyxrc.document_path) {
1490 os << "\\document_path \"" << document_path << "\"\n";
1493 if (lastfiles != system_lyxrc.lastfiles) {
1494 os << "\\lastfiles \"" << lastfiles << "\"\n";
1496 case RC_NUMLASTFILES:
1497 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1498 os << "\\num_lastfiles " << num_lastfiles << '\n';
1500 case RC_CHECKLASTFILES:
1501 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1502 os << "\\check_lastfiles " << tostr(check_lastfiles)
1505 case RC_TEMPLATEPATH:
1506 if (template_path != system_lyxrc.template_path) {
1507 os << "\\template_path \"" << template_path << "\"\n";
1509 case RC_TEMPDIRPATH:
1510 if (tempdir_path != system_lyxrc.tempdir_path) {
1511 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1515 case RC_ASCII_LINELEN:
1516 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1517 os << "\\ascii_linelen " << ascii_linelen << '\n';
1519 case RC_MAKE_BACKUP:
1520 if (make_backup != system_lyxrc.make_backup) {
1521 os << "\\make_backup " << tostr(make_backup) << '\n';
1523 case RC_BACKUPDIR_PATH:
1524 if (backupdir_path != system_lyxrc.backupdir_path) {
1525 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1529 << "# ASCII EXPORT SECTION ##############################\n"
1532 case RC_ASCIIROFF_COMMAND:
1533 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1534 os << "\\ascii_roff_command \"" << ascii_roff_command
1539 << "# SPELLCHECKER SECTION ##############################\n"
1541 case RC_USE_SPELL_LIB:
1542 if (use_spell_lib != system_lyxrc.use_spell_lib) {
1543 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1545 case RC_SPELL_COMMAND:
1546 if (isp_command != system_lyxrc.isp_command) {
1547 os << "\\spell_command \"" << isp_command << "\"\n";
1549 case RC_ACCEPT_COMPOUND:
1550 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1551 os << "\\accept_compound " << tostr(isp_accept_compound)
1554 case RC_USE_ALT_LANG:
1555 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1556 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1560 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1561 os << "\\alternate_language \"" << isp_alt_lang
1564 case RC_USE_ESC_CHARS:
1565 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1566 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1570 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1571 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1573 case RC_USE_PERS_DICT:
1574 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1575 os << "\\use_personal_dictionary "
1576 << tostr(isp_use_pers_dict)
1580 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1581 os << "\\personal_dictionary \"" << isp_pers_dict
1584 case RC_USE_INP_ENC:
1585 if (isp_use_input_encoding
1586 != system_lyxrc.isp_use_input_encoding) {
1587 os << "\\use_input_encoding "
1588 << tostr(isp_use_input_encoding)
1593 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1596 case RC_RTL_SUPPORT:
1597 if (rtl_support != system_lyxrc.rtl_support) {
1598 os << "\\rtl " << tostr(rtl_support) << '\n';
1600 case RC_LANGUAGE_PACKAGE:
1601 if (language_package != system_lyxrc.language_package) {
1602 os << "\\language_package \"" << language_package
1605 case RC_LANGUAGE_GLOBAL_OPTIONS:
1606 if (language_global_options
1607 != system_lyxrc.language_global_options) {
1608 os << "\\language_global_options \""
1609 << tostr(language_global_options)
1612 case RC_LANGUAGE_USE_BABEL:
1613 if (language_use_babel != system_lyxrc.language_use_babel) {
1614 os << "\\language_use_babel \""
1615 << tostr(language_use_babel)
1618 case RC_LANGUAGE_COMMAND_BEGIN:
1619 if (language_command_begin
1620 != system_lyxrc.language_command_begin) {
1621 os << "\\language_command_begin \""
1622 << language_command_begin
1625 case RC_LANGUAGE_COMMAND_END:
1626 if (language_command_end
1627 != system_lyxrc.language_command_end) {
1628 os << "\\language_command_end \"" << language_command_end
1631 case RC_LANGUAGE_COMMAND_LOCAL:
1632 if (language_command_local
1633 != system_lyxrc.language_command_local) {
1634 os << "\\language_command_local \""
1635 << language_command_local
1638 case RC_LANGUAGE_AUTO_BEGIN:
1639 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1640 os << "\\language_auto_begin "
1641 << tostr(language_auto_begin) << '\n';
1643 case RC_LANGUAGE_AUTO_END:
1644 if (language_auto_end != system_lyxrc.language_auto_end) {
1645 os << "\\language_auto_end "
1646 << tostr(language_auto_end) << '\n';
1648 case RC_MARK_FOREIGN_LANGUAGE:
1649 if (mark_foreign_language
1650 != system_lyxrc.mark_foreign_language) {
1651 os << "\\mark_foreign_language " <<
1652 tostr(mark_foreign_language) << '\n';
1656 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1659 case RC_AUTO_NUMBER:
1660 if (auto_number != system_lyxrc.auto_number) {
1661 os << "\\auto_number " << tostr(auto_number) << '\n';
1663 case RC_DEFAULT_LANGUAGE:
1664 if (default_language != system_lyxrc.default_language) {
1665 os << "\\default_language " << default_language << '\n';
1669 << "# FORMATS SECTION ##########################\n"
1673 // Look for deleted formats
1674 for (Formats::const_iterator cit = formats.begin();
1675 cit != formats.end(); ++cit) {
1676 Format const * format =
1677 system_formats.getFormat(cit->name());
1679 format->extension() != cit->extension() ||
1680 format->prettyname() != cit->prettyname() ||
1681 format->shortcut() != cit->shortcut())
1682 os << "\\format \"" << cit->name() << "\" \""
1683 << cit->extension() << "\" \""
1684 << cit->prettyname() << "\" \""
1685 << cit->shortcut() << "\"\n";
1688 // New/modifed formats
1689 for (Formats::const_iterator cit = system_formats.begin();
1690 cit != system_formats.end(); ++cit)
1691 if (!formats.getFormat(cit->name()))
1692 os << "\\format \"" << cit->name()
1693 << "\" \"\" \"\" \"\"\n";
1695 for (Formats::const_iterator cit = formats.begin();
1696 cit != formats.end(); ++cit) {
1697 Format const * format =
1698 system_formats.getFormat(cit->name());
1699 if ((!format || format->viewer() != cit->viewer()) &&
1700 (format || !cit->viewer().empty()))
1701 os << "\\viewer \"" << cit->name() << "\" \""
1702 << cit->viewer() << "\"\n";
1706 << "# CONVERTERS SECTION ##########################\n"
1710 // Look for new converters
1711 for (Converters::const_iterator cit = converters.begin();
1712 cit != converters.end(); ++cit) {
1713 Converter const * converter =
1714 system_converters.getConverter(cit->from,
1717 converter->command != cit->command ||
1718 converter->flags != cit->flags)
1719 os << "\\converter \"" << cit->from << "\" \""
1720 << cit->to << "\" \""
1721 << cit->command << "\" \""
1722 << cit->flags << "\"\n";
1725 // New/modifed converters
1726 for (Converters::const_iterator cit = system_converters.begin();
1727 cit != system_converters.end(); ++cit)
1728 if (!converters.getConverter(cit->from, cit->to))
1729 os << "\\converter \"" << cit->from
1730 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1736 void LyXRC::set_font_norm_type()
1738 if (font_norm == "iso10646-1")
1739 font_norm_type = ISO_10646_1;
1740 else if (font_norm == "iso8859-1")
1741 font_norm_type = ISO_8859_1;
1742 else if (font_norm == "iso8859-3")
1743 font_norm_type = ISO_8859_3;
1744 else if (font_norm == "iso8859-4")
1745 font_norm_type = ISO_8859_4;
1746 else if (font_norm == "iso8859-6.8x")
1747 font_norm_type = ISO_8859_6_8;
1748 else if (font_norm == "iso8859-9")
1749 font_norm_type = ISO_8859_9;
1750 else if (font_norm == "iso8859-15")
1751 font_norm_type = ISO_8859_15;
1753 font_norm_type = OTHER_ENCODING;
1757 string const LyXRC::getDescription(LyXRCTags tag)
1762 case RC_FONT_ENCODING:
1763 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1767 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1770 case RC_PRINT_COMMAND:
1771 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1774 case RC_PRINTEVENPAGEFLAG:
1775 str = _("The option to print only even pages.");
1778 case RC_PRINTODDPAGEFLAG:
1779 str = _("The option to print only odd pages.");
1782 case RC_PRINTPAGERANGEFLAG:
1783 str = _("The option for specifying a comma-separated list of pages to print.");
1786 case RC_PRINTCOPIESFLAG:
1787 str = _("The option for specifying the number of copies to print.");
1790 case RC_PRINTCOLLCOPIESFLAG:
1791 str = _("The option for specifying whether the copies should be collated.");
1794 case RC_PRINTREVERSEFLAG:
1795 str = _("The option to reverse the order of the pages printed.");
1798 case RC_PRINTLANDSCAPEFLAG:
1799 str = _("The option to print out in landscape.");
1802 case RC_PRINTPAPERFLAG:
1803 str = _("The option to specify paper type.");
1806 case RC_PRINTPAPERDIMENSIONFLAG:
1807 str = _("Option to specify the dimensions of the print paper.");
1810 case RC_PRINTTOPRINTER:
1811 str = _("Option to pass to the print program to print on a specific printer.");
1814 case RC_PRINT_ADAPTOUTPUT:
1815 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1818 case RC_PRINTTOFILE:
1819 str = _("Option to pass to the print program to print to a file.");
1822 case RC_PRINTFILEEXTENSION:
1823 str = _("Extension of printer program output file. Usually \".ps\".");
1826 case RC_PRINTEXSTRAOPTIONS:
1827 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1830 case RC_PRINTSPOOL_COMMAND:
1831 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.");
1834 case RC_PRINTSPOOL_PRINTERPREFIX:
1835 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.");
1839 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1842 case RC_SCREEN_ZOOM:
1843 //xgettext:no-c-format
1844 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1847 case RC_SCREEN_FONT_SIZES:
1848 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1851 case RC_SCREEN_FONT_ROMAN:
1852 case RC_SCREEN_FONT_SANS:
1853 case RC_SCREEN_FONT_TYPEWRITER:
1854 str = _("The screen fonts used to display the text while editing.");
1857 case RC_POPUP_BOLD_FONT:
1858 str = _("The bold font in the dialogs.");
1861 case RC_POPUP_NORMAL_FONT:
1862 str = _("The normal font in the dialogs.");
1865 case RC_SCREEN_FONT_ENCODING:
1866 str = _("The encoding for the screen fonts.");
1869 case RC_POPUP_FONT_ENCODING:
1870 str = _("The encoding for the menu/popups fonts.");
1877 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1880 case RC_DOCUMENTPATH:
1881 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1884 case RC_TEMPLATEPATH:
1885 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1888 case RC_TEMPDIRPATH:
1889 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1893 str = _("The file where the last-files information should be stored.");
1896 case RC_AUTOREGIONDELETE:
1897 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1900 case RC_AUTORESET_OPTIONS:
1901 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1905 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1909 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1913 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1917 case RC_KBMAP_PRIMARY:
1918 case RC_KBMAP_SECONDARY:
1919 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.");
1922 case RC_ASCIIROFF_COMMAND:
1923 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.");
1926 case RC_ASCII_LINELEN:
1927 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1930 case RC_NUMLASTFILES:
1931 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1934 case RC_CHECKLASTFILES:
1935 str = _("Select to check whether the lastfiles still exist.");
1938 case RC_VIEWDVI_PAPEROPTION:
1939 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1942 case RC_DEFAULT_PAPERSIZE:
1943 str = _("Specify the default paper size.");
1946 case RC_ACCEPT_COMPOUND:
1947 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1950 case RC_SPELL_COMMAND:
1951 str = _("What command runs the spell checker?");
1954 case RC_USE_INP_ENC:
1955 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.");
1958 case RC_USE_ALT_LANG:
1960 str = _("Specify an alternate language. The default is to use the language of the document.");
1963 case RC_USE_PERS_DICT:
1965 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1968 case RC_USE_ESC_CHARS:
1970 str = _("Specify additional chars that can be part of a word.");
1973 case RC_SCREEN_FONT_SCALABLE:
1974 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.");
1977 case RC_CHKTEX_COMMAND:
1978 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1981 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1982 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.");
1985 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1986 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
1989 case RC_DISPLAY_GRAPHICS:
1990 str = _("Select how LyX will display any graphics.");
1993 case RC_MAKE_BACKUP:
1994 str = _("De-select if you don't want LyX to create backup files.");
1997 case RC_BACKUPDIR_PATH:
1998 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.");
2001 case RC_RTL_SUPPORT:
2002 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2005 case RC_MARK_FOREIGN_LANGUAGE:
2006 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2009 case RC_LANGUAGE_PACKAGE:
2010 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2013 case RC_LANGUAGE_GLOBAL_OPTIONS:
2014 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2017 case RC_LANGUAGE_USE_BABEL:
2018 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2021 case RC_LANGUAGE_AUTO_BEGIN:
2022 str = _("Select if a language switching command is needed at the beginning of the document.");
2025 case RC_LANGUAGE_AUTO_END:
2026 str = _("Select if a language switching command is needed at the end of the document.");
2029 case RC_LANGUAGE_COMMAND_BEGIN:
2030 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.");
2033 case RC_LANGUAGE_COMMAND_END:
2034 str = _("The LaTeX command for changing back to the language of the document.");
2037 case RC_LANGUAGE_COMMAND_LOCAL:
2038 str = _("The LaTeX command for local changing of the language.");
2041 case RC_DATE_INSERT_FORMAT:
2042 //xgettext:no-c-format
2043 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2046 case RC_SHOW_BANNER:
2047 str = _("De-select if you don't want the startup banner.");
2051 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2063 case RC_DEFAULT_LANGUAGE:
2064 str = _("New documents will be assigned this language.");
2067 case RC_LABEL_INIT_LENGTH:
2068 str = _("Maximum number of words in the initialization string for a new label");
2072 str = _("Shows a typeset preview of things such as math");
2075 case RC_PREVIEW_HASHED_LABELS:
2076 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2079 case RC_PREVIEW_SCALE_FACTOR:
2080 str = _("Scale the preview size to suit.");
2090 // The global instance
2093 // The global copy of the system lyxrc entries (everything except preferences)