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 "support/filetools.h"
33 #include "support/lstrings.h"
34 #include "support/translator.h"
35 #include "support/tostr.h"
36 #include "support/userinfo.h"
38 using lyx::support::ascii_lowercase;
39 using lyx::support::ExpandPath;
40 using lyx::support::GetEnv;
41 using lyx::support::LibFileSearch;
42 using lyx::support::token;
55 /// The translator between the DisplayType and the corresponding lyx string.
56 extern Translator<DisplayType, string> displayTranslator;
62 // when adding something to this array keep it sorted!
63 keyword_item lyxrcTags[] = {
64 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
65 { "\\alternate_language", LyXRC::RC_ALT_LANG },
66 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
67 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
68 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
69 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
70 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
71 { "\\autosave", LyXRC::RC_AUTOSAVE },
72 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
73 { "\\bind_file", LyXRC::RC_BINDFILE },
74 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
75 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
76 { "\\converter", LyXRC::RC_CONVERTER },
77 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
78 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
79 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
80 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
81 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
82 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
83 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
84 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
85 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
86 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
87 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
88 { "\\format", LyXRC::RC_FORMAT },
89 { "\\input", LyXRC::RC_INPUT },
90 { "\\kbmap", LyXRC::RC_KBMAP },
91 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
92 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
93 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
94 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
95 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
96 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
97 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
98 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
99 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
100 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
101 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
102 { "\\lastfiles", LyXRC::RC_LASTFILES },
103 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
104 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
105 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
106 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
107 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
108 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
109 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
110 { "\\preview", LyXRC::RC_PREVIEW },
111 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
112 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
113 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
114 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
115 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
116 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
117 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
118 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
119 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
120 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
121 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
122 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
123 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
124 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
125 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
126 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
127 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
128 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
129 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
130 { "\\printer", LyXRC::RC_PRINTER },
131 { "\\ps_command", LyXRC::RC_PS_COMMAND },
132 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
133 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
134 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
135 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
136 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
137 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
138 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
139 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
140 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
141 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
142 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
143 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
144 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
145 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
146 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
147 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
148 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
149 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
150 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
151 { "\\set_color", LyXRC::RC_SET_COLOR },
152 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
153 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
154 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
155 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
156 { "\\ui_file", LyXRC::RC_UIFILE },
157 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
158 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
159 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
160 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
161 // compatibility with versions older than 1.4.0 only
162 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
163 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
164 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
165 { "\\user_email", LyXRC::RC_USER_EMAIL },
166 { "\\user_name", LyXRC::RC_USER_NAME },
167 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
168 { "\\viewer" ,LyXRC::RC_VIEWER},
169 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
172 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
183 void LyXRC::setDefaults() {
186 // Get printer from the environment. If fail, use default "",
187 // assuming that everything is set up correctly.
188 printer = GetEnv("PRINTER");
189 print_adapt_output = false;
190 print_command = "dvips";
191 print_evenpage_flag = "-B";
192 print_oddpage_flag = "-A";
193 print_pagerange_flag = "-pp";
194 print_copies_flag = "-c";
195 print_collcopies_flag = "-C";
196 print_reverse_flag = "-r";
197 print_landscape_flag = "-t landscape";
198 print_to_printer = "-P";
199 print_to_file = "-o ";
200 print_file_extension = ".ps";
201 print_paper_flag = "-t";
202 print_paper_dimension_flag = "-T";
203 document_path.erase();
204 tempdir_path = "/tmp";
207 view_dvi_paper_option.erase();
208 default_papersize = PAPER_USLETTER;
209 custom_export_format = "ps";
210 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
213 // Because a screen typically is wider than a piece of paper:
216 // Default LaTeX font size:
217 font_sizes[LyXFont::SIZE_TINY] = 5.0;
218 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
219 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
220 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
221 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
222 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
223 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
224 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
225 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
226 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
227 use_scalable_fonts = true;
228 roman_font_name = "";
230 typewriter_font_name = "";
231 popup_bold_font = "-*-helvetica-bold-r";
232 popup_normal_font = "-*-helvetica-medium-r";
233 font_norm = "iso8859-1";
234 font_norm_type = ISO_8859_1;
235 popup_font_encoding.erase();
237 auto_region_delete = true;
238 auto_reset_options = false;
241 check_lastfiles = true;
243 backupdir_path.erase();
244 display_graphics = lyx::graphics::ColorDisplay;
245 // Spellchecker settings:
246 use_spell_lib = true;
247 isp_command = "ispell";
248 isp_accept_compound = false;
249 isp_use_input_encoding = false;
250 isp_use_alt_lang = false;
251 isp_use_pers_dict = false;
252 isp_use_esc_chars = false;
256 mark_foreign_language = true;
257 language_auto_begin = true;
258 language_auto_end = true;
259 language_global_options = true;
260 language_use_babel = true;
261 language_package = "\\usepackage{babel}";
262 language_command_begin = "\\selectlanguage{$$lang}";
263 language_command_local = "\\foreignlanguage{$$lang}{";
264 default_language = "english";
268 date_insert_format = "%A, %e %B %Y";
269 cursor_follows_scrollbar = false;
270 dialogs_iconify_with_main = false;
271 label_init_length = 3;
273 preview_hashed_labels = false;
274 preview_scale_factor = 0.9;
276 user_name = lyx::support::user_name();
278 user_email = lyx::support::user_email();
280 if (user_email.empty())
281 user_email = _("email address unknown");
287 void oldFontFormat(string & family, string & foundry)
289 if (family.empty() || family[0] != '-')
291 foundry = token(family, '-', 1);
292 family = token(family, '-', 2);
300 int LyXRC::read(string const & filename)
302 LyXLex lexrc(lyxrcTags, lyxrcCount);
303 if (lyxerr.debugging(Debug::PARSER))
304 lexrc.printTable(lyxerr);
306 lexrc.setFile(filename);
307 if (!lexrc.isOK()) return -2;
309 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
311 while (lexrc.isOK()) {
312 // By using two switches we take advantage of the compiler
313 // telling us if we have missed a LyXRCTags element in
314 // the second switch.
315 // Note that this also shows a problem with LyXLex since it
316 // helps us avoid taking advantage of the strictness of the
319 int le = lexrc.lex();
321 case LyXLex::LEX_UNDEF:
322 lexrc.printError("Unknown tag `$$Token'");
324 case LyXLex::LEX_FEOF:
328 switch (static_cast<LyXRCTags>(le)) {
329 case RC_INPUT: // Include file
332 LibFileSearch(string(),
335 lexrc.printError("Error reading "
336 "included file: "+tmp);
340 case RC_BINDFILE: // RVDK_PATCH_5
342 bind_file = lexrc.getString();
348 ui_file = lexrc.getString();
352 case RC_AUTORESET_OPTIONS:
354 auto_reset_options = lexrc.getBool();
358 case RC_DISPLAY_GRAPHICS:
360 display_graphics = lyx::graphics::displayTranslator.find(lexrc.getString());
366 use_kbmap = lexrc.getBool();
370 case RC_KBMAP_PRIMARY:
372 string const kmap(lexrc.getString());
375 } else if (!LibFileSearch("kbd", kmap,
377 primary_kbmap = kmap;
379 lexrc.printError("LyX: Keymap `$$Token' not found");
384 case RC_KBMAP_SECONDARY:
386 string const kmap(lexrc.getString());
389 } else if (!LibFileSearch("kbd", kmap,
391 secondary_kbmap = kmap;
393 lexrc.printError("LyX: Keymap `$$Token' not found");
398 case RC_FONT_ENCODING:
400 fontenc = lexrc.getString();
406 printer = lexrc.getString();
410 case RC_PRINT_COMMAND:
412 print_command = lexrc.getString();
416 case RC_PRINTEVENPAGEFLAG:
418 print_evenpage_flag = lexrc.getString();
422 case RC_PRINTODDPAGEFLAG:
424 print_oddpage_flag = lexrc.getString();
428 case RC_PRINTPAGERANGEFLAG:
430 print_pagerange_flag = lexrc.getString();
434 case RC_PRINTCOPIESFLAG:
436 print_copies_flag = lexrc.getString();
440 case RC_PRINTCOLLCOPIESFLAG:
442 print_collcopies_flag = lexrc.getString();
446 case RC_PRINTREVERSEFLAG:
448 print_reverse_flag = lexrc.getString();
452 case RC_PRINTLANDSCAPEFLAG:
454 print_landscape_flag = lexrc.getString();
458 case RC_PRINTTOPRINTER:
460 print_to_printer = lexrc.getString();
464 case RC_PRINT_ADAPTOUTPUT:
466 print_adapt_output = lexrc.getBool();
472 print_to_file = lexrc.getString();
476 case RC_PRINTFILEEXTENSION:
478 print_file_extension = lexrc.getString();
482 case RC_PRINTEXSTRAOPTIONS:
484 print_extra_options = lexrc.getString();
488 case RC_PRINTSPOOL_COMMAND:
490 print_spool_command = lexrc.getString();
494 case RC_PRINTSPOOL_PRINTERPREFIX:
496 print_spool_printerprefix = lexrc.getString();
500 case RC_PRINTPAPERDIMENSIONFLAG:
502 print_paper_dimension_flag = lexrc.getString();
506 case RC_PRINTPAPERFLAG:
508 print_paper_flag = lexrc.getString();
512 case RC_CUSTOM_EXPORT_COMMAND:
514 custom_export_command = lexrc.getString();
518 case RC_CUSTOM_EXPORT_FORMAT:
520 custom_export_format = lexrc.getString();
524 case RC_DEFAULT_PAPERSIZE:
527 ascii_lowercase(lexrc.getString());
528 if (size == "usletter")
531 else if (size == "legal")
534 else if (size == "executive")
536 PAPER_EXECUTIVEPAPER;
537 else if (size == "a3")
540 else if (size == "a4")
543 else if (size == "a5")
546 else if (size == "b5")
552 case RC_VIEWDVI_PAPEROPTION:
554 view_dvi_paper_option = lexrc.getString();
556 view_dvi_paper_option.erase();
562 ps_command = lexrc.getString();
566 case RC_CHKTEX_COMMAND:
568 chktex_command = lexrc.getString();
574 dpi = lexrc.getInteger();
580 zoom = lexrc.getInteger();
586 wheel_jump = lexrc.getInteger();
590 case RC_SCREEN_FONT_SIZES:
592 font_sizes[LyXFont::SIZE_TINY] =
596 font_sizes[LyXFont::SIZE_SCRIPT] =
600 font_sizes[LyXFont::SIZE_FOOTNOTE] =
604 font_sizes[LyXFont::SIZE_SMALL] =
608 font_sizes[LyXFont::SIZE_NORMAL] =
612 font_sizes[LyXFont::SIZE_LARGE] =
616 font_sizes[LyXFont::SIZE_LARGER] =
620 font_sizes[LyXFont::SIZE_LARGEST] =
624 font_sizes[LyXFont::SIZE_HUGE] =
628 font_sizes[LyXFont::SIZE_HUGER] =
633 case RC_SCREEN_FONT_SCALABLE:
635 use_scalable_fonts = lexrc.getBool();
641 autosave = lexrc.getInteger();
645 case RC_DOCUMENTPATH:
647 document_path = ExpandPath(lexrc.getString());
651 case RC_TEMPLATEPATH:
653 template_path = ExpandPath(lexrc.getString());
659 tempdir_path = ExpandPath(lexrc.getString());
665 use_tempdir = lexrc.getBool();
671 lastfiles = ExpandPath(lexrc.getString());
675 case RC_NUMLASTFILES:
677 num_lastfiles = lexrc.getInteger();
681 case RC_CHECKLASTFILES:
683 check_lastfiles = lexrc.getBool();
687 case RC_SCREEN_FONT_ROMAN:
689 roman_font_name = lexrc.getString();
690 oldFontFormat(roman_font_name,
695 case RC_SCREEN_FONT_SANS:
697 sans_font_name = lexrc.getString();
698 oldFontFormat(sans_font_name, sans_font_foundry);
702 case RC_SCREEN_FONT_TYPEWRITER:
704 typewriter_font_name = lexrc.getString();
705 oldFontFormat(typewriter_font_name,
706 typewriter_font_foundry);
710 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
712 roman_font_foundry = lexrc.getString();
716 case RC_SCREEN_FONT_SANS_FOUNDRY:
718 sans_font_foundry = lexrc.getString();
722 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
724 typewriter_font_foundry = lexrc.getString();
728 case RC_SCREEN_FONT_ENCODING:
730 font_norm = lexrc.getString();
731 set_font_norm_type();
735 case RC_POPUP_BOLD_FONT:
737 popup_bold_font = lexrc.getString();
741 case RC_POPUP_NORMAL_FONT:
743 popup_normal_font = lexrc.getString();
747 case RC_POPUP_FONT_ENCODING:
749 popup_font_encoding = lexrc.getString();
755 string lyx_name, x11_name;
758 lyx_name = lexrc.getString();
760 lexrc.printError("Missing color tag.");
765 x11_name = lexrc.getString();
767 lexrc.printError("Missing color name for color: `$$Token'");
771 if (!lcolor.setColor(lyx_name, x11_name)) {
772 lyxerr << "Bad lyxrc set_color for "
778 case RC_AUTOREGIONDELETE:
779 // Auto region delete defaults to true
781 auto_region_delete = lexrc.getBool();
787 lyxpipes = ExpandPath(lexrc.getString());
791 case RC_CURSOR_FOLLOWS_SCROLLBAR:
793 cursor_follows_scrollbar = lexrc.getBool();
797 case RC_DIALOGS_ICONIFY_WITH_MAIN:
799 dialogs_iconify_with_main = lexrc.getBool();
803 case RC_ASCIIROFF_COMMAND:
805 ascii_roff_command = lexrc.getString();
808 case RC_ASCII_LINELEN:
810 ascii_linelen = lexrc.getInteger();
813 // Spellchecker settings:
814 case RC_USE_SPELL_LIB:
816 use_spell_lib = lexrc.getBool();
819 case RC_SPELL_COMMAND:
821 isp_command = lexrc.getString();
824 case RC_ACCEPT_COMPOUND:
826 isp_accept_compound = lexrc.getBool();
831 isp_use_input_encoding = lexrc.getBool();
834 case RC_USE_ALT_LANG:
836 isp_use_alt_lang = lexrc.getBool();
839 case RC_USE_PERS_DICT:
841 isp_use_pers_dict = lexrc.getBool();
844 case RC_USE_ESC_CHARS:
846 isp_use_esc_chars = lexrc.getBool();
851 isp_alt_lang = lexrc.getString();
856 isp_pers_dict = lexrc.getString();
861 isp_esc_chars = lexrc.getString();
866 make_backup = lexrc.getBool();
869 case RC_BACKUPDIR_PATH:
871 backupdir_path = ExpandPath(lexrc.getString());
874 case RC_DATE_INSERT_FORMAT:
876 date_insert_format = lexrc.getString();
879 case RC_LANGUAGE_PACKAGE:
881 language_package = lexrc.getString();
884 case RC_LANGUAGE_AUTO_BEGIN:
886 language_auto_begin = lexrc.getBool();
889 case RC_LANGUAGE_AUTO_END:
891 language_auto_end = lexrc.getBool();
894 case RC_LANGUAGE_GLOBAL_OPTIONS:
896 language_global_options = lexrc.getBool();
899 case RC_LANGUAGE_USE_BABEL:
901 language_use_babel = lexrc.getBool();
904 case RC_LANGUAGE_COMMAND_BEGIN:
906 language_command_begin = lexrc.getString();
909 case RC_LANGUAGE_COMMAND_END:
911 language_command_end = lexrc.getString();
914 case RC_LANGUAGE_COMMAND_LOCAL:
916 language_command_local = lexrc.getString();
921 rtl_support = lexrc.getBool();
926 auto_number = lexrc.getBool();
929 case RC_MARK_FOREIGN_LANGUAGE:
931 mark_foreign_language = lexrc.getBool();
936 string from, to, command, flags;
938 from = lexrc.getString();
941 to = lexrc.getString();
944 command = lexrc.getString();
947 flags = lexrc.getString();
950 || token(command, ' ', 0) == "none") {
951 converters.erase(from, to);
953 converters.add(from, to, command, flags);
958 string format, command;
960 format = lexrc.getString();
963 command = lexrc.getString();
964 if (token(command, ' ', 0) == "none")
967 formats.setViewer(format, command);
971 string format, extension, prettyname, shortcut;
973 format = lexrc.getString();
976 extension = lexrc.getString();
979 prettyname = lexrc.getString();
982 shortcut = lexrc.getString();
984 if (prettyname.empty()) {
985 if (converters.formatIsUsed(format)) {
986 lyxerr << "Can't delete format "
989 formats.erase(format);
992 formats.add(format, extension, prettyname,
997 case RC_DEFAULT_LANGUAGE:
999 default_language = lexrc.getString();
1003 case RC_LABEL_INIT_LENGTH:
1005 label_init_length = lexrc.getInteger();
1009 case RC_SHOW_BANNER:
1011 show_banner = lexrc.getBool();
1017 preview = lexrc.getBool();
1021 case RC_PREVIEW_HASHED_LABELS:
1023 preview_hashed_labels = lexrc.getBool();
1027 case RC_PREVIEW_SCALE_FACTOR:
1029 preview_scale_factor = lexrc.getFloat();
1035 user_name = lexrc.getString();
1040 user_email = lexrc.getString();
1043 case RC_LAST: break; // this is just a dummy
1047 /// Update converters data-structures
1048 converters.update(formats);
1049 converters.buildGraph();
1055 void LyXRC::write(string const & filename) const
1057 ofstream ofs(filename.c_str());
1063 void LyXRC::print() const
1065 if (lyxerr.debugging())
1072 void LyXRC::output(ostream & os) const
1074 os << "### This file is part of\n"
1075 << "### ========================================================\n"
1076 << "### LyX, The Document Processor\n"
1078 << "### Copyright 1995 Matthias Ettrich\n"
1079 << "### Copyright 1995-2001 The LyX Team.\n"
1081 << "### ========================================================\n"
1083 << "# This file is written by LyX, if you want to make your own\n"
1084 << "# modifications you should do them from inside LyX and save\n"
1087 // Why the switch you might ask. It is a trick to ensure that all
1088 // the elements in the LyXRCTags enum is handled. As you can see
1089 // there are no breaks at all. So it is just a huge fall-through.
1090 // The nice thing is that we will get a warning from the compiler
1091 // if we forget an element.
1092 LyXRCTags tag = RC_LAST;
1096 // input/include files are not done here
1098 if (bind_file != system_lyxrc.bind_file) {
1099 os << "\\bind_file " << bind_file << "\n";
1105 << "# MISC SECTION ######################################\n"
1108 // bind files are not done here.
1110 if (ui_file != system_lyxrc.ui_file) {
1111 os << "\\ui_file \"" << ui_file << "\"\n";
1113 case RC_AUTOREGIONDELETE:
1114 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1115 os << "# Set to false to inhibit automatic replacement of\n"
1116 << "# the current selection.\n"
1117 << "\\auto_region_delete " << tostr(auto_region_delete)
1120 case RC_AUTORESET_OPTIONS:
1121 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1122 os << "# Set to false to inhibit automatic reset of\n"
1123 << "# the class options to defaults on class change.\n"
1124 << "\\auto_reset_options " << tostr(auto_reset_options)
1128 if (autosave != system_lyxrc.autosave) {
1129 os << "# The time interval between auto-saves in seconds.\n"
1130 << "\\autosave " << autosave << '\n';
1132 case RC_DISPLAY_GRAPHICS:
1133 if (display_graphics != system_lyxrc.display_graphics) {
1134 os << "# Display graphics within LyX\n"
1135 << "# monochrome|grayscale|color|none\n"
1136 << "\\display_graphics "
1137 << lyx::graphics::displayTranslator.find(display_graphics)
1141 case RC_VIEWDVI_PAPEROPTION:
1142 if (view_dvi_paper_option
1143 != system_lyxrc.view_dvi_paper_option) {
1144 os << "# Options used to specify paper size to the\n"
1145 << "# view_dvi_command (e.g. -paper)\n"
1146 << "\\view_dvi_paper_option \""
1147 << view_dvi_paper_option << "\"\n";
1149 case RC_DEFAULT_PAPERSIZE:
1150 if (default_papersize != system_lyxrc.default_papersize) {
1151 os << "# The default papersize to use.\n"
1152 << "\\default_papersize \"";
1153 switch (default_papersize) {
1154 case PAPER_USLETTER:
1155 os << "usletter"; break;
1156 case PAPER_LEGALPAPER:
1157 os << "legal"; break;
1158 case PAPER_EXECUTIVEPAPER:
1159 os << "executive"; break;
1168 case PAPER_DEFAULT: break;
1173 if (ps_command != system_lyxrc.ps_command) {
1174 os << "# Program used for interpreting postscript.\n"
1175 << "\\ps_command \"" << ps_command << "\"\n";
1177 case RC_CHKTEX_COMMAND:
1178 if (chktex_command != system_lyxrc.chktex_command) {
1179 os << "\\chktex_command \"" << chktex_command << "\"\n";
1182 if (use_kbmap != system_lyxrc.use_kbmap) {
1183 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1185 case RC_KBMAP_PRIMARY:
1186 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1187 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1189 case RC_KBMAP_SECONDARY:
1190 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1191 os << "\\kbmap_secondary \"" << secondary_kbmap
1195 if (lyxpipes != system_lyxrc.lyxpipes) {
1196 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1198 case RC_DATE_INSERT_FORMAT:
1199 if (date_insert_format != system_lyxrc.date_insert_format) {
1200 os << "\\date_insert_format \"" << date_insert_format
1203 case RC_LABEL_INIT_LENGTH:
1204 if (label_init_length != system_lyxrc.label_init_length) {
1205 os << "\\label_init_length " << label_init_length
1210 os << "\\user_name \"" << user_name << "\"\n";
1213 os << "\\user_email \"" << user_email << "\"\n";
1215 case RC_SHOW_BANNER:
1216 if (show_banner != system_lyxrc.show_banner) {
1217 os << "\\show_banner " << tostr(show_banner) << '\n';
1221 if (preview != system_lyxrc.preview) {
1222 os << "\\preview " << tostr(preview) << '\n';
1225 case RC_PREVIEW_HASHED_LABELS:
1226 if (preview_hashed_labels !=
1227 system_lyxrc.preview_hashed_labels) {
1228 os << "\\preview_hashed_labels "
1229 << tostr(preview_hashed_labels) << '\n';
1232 case RC_PREVIEW_SCALE_FACTOR:
1233 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1234 os << "\\preview_scale_factor "
1235 << preview_scale_factor << '\n';
1239 << "# SCREEN & FONTS SECTION ############################\n"
1242 case RC_POPUP_NORMAL_FONT:
1243 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1244 os << "\\popup_normal_font \"" << popup_normal_font
1247 case RC_POPUP_BOLD_FONT:
1248 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1249 os << "\\popup_bold_font \"" << popup_bold_font
1252 case RC_POPUP_FONT_ENCODING:
1253 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1254 os << "\\popup_font_encoding \"" << popup_font_encoding
1258 if (dpi != system_lyxrc.dpi) {
1259 os << "\\screen_dpi " << dpi << '\n';
1261 case RC_SCREEN_ZOOM:
1262 if (zoom != system_lyxrc.zoom) {
1263 os << "\\screen_zoom " << zoom << '\n';
1266 if (wheel_jump != system_lyxrc.wheel_jump) {
1267 os << "\\wheel_jump " << wheel_jump << '\n';
1269 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1270 if (cursor_follows_scrollbar
1271 != system_lyxrc.cursor_follows_scrollbar) {
1272 os << "\\cursor_follows_scrollbar "
1273 << tostr(cursor_follows_scrollbar) << '\n';
1275 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1276 if (dialogs_iconify_with_main
1277 != system_lyxrc.dialogs_iconify_with_main) {
1278 os << "\\dialogs_iconify_with_main "
1279 << tostr(dialogs_iconify_with_main) << '\n';
1281 case RC_SCREEN_FONT_ROMAN:
1282 if (roman_font_name != system_lyxrc.roman_font_name) {
1283 os << "\\screen_font_roman \"" << roman_font_name
1286 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1287 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1288 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1291 case RC_SCREEN_FONT_SANS:
1292 if (sans_font_name != system_lyxrc.sans_font_name) {
1293 os << "\\screen_font_sans \"" << sans_font_name
1296 case RC_SCREEN_FONT_SANS_FOUNDRY:
1297 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1298 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1301 case RC_SCREEN_FONT_TYPEWRITER:
1302 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1303 os << "\\screen_font_typewriter \""
1304 << typewriter_font_name << "\"\n";
1306 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1307 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1308 os << "\\screen_font_typewriter_foundry \""
1309 << typewriter_font_foundry << "\"\n";
1312 case RC_SCREEN_FONT_SCALABLE:
1313 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1314 os << "\\screen_font_scalable "
1315 << tostr(use_scalable_fonts)
1318 case RC_SCREEN_FONT_ENCODING:
1319 if (font_norm != system_lyxrc.font_norm) {
1320 os << "\\screen_font_encoding \"" << font_norm
1323 case RC_SCREEN_FONT_SIZES:
1324 if (font_sizes[LyXFont::SIZE_TINY]
1325 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1326 font_sizes[LyXFont::SIZE_SCRIPT]
1327 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1328 font_sizes[LyXFont::SIZE_FOOTNOTE]
1329 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1330 font_sizes[LyXFont::SIZE_SMALL]
1331 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1332 font_sizes[LyXFont::SIZE_NORMAL]
1333 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1334 font_sizes[LyXFont::SIZE_LARGE]
1335 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1336 font_sizes[LyXFont::SIZE_LARGER]
1337 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1338 font_sizes[LyXFont::SIZE_LARGEST]
1339 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1340 font_sizes[LyXFont::SIZE_HUGE]
1341 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1342 font_sizes[LyXFont::SIZE_HUGER]
1343 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1344 os.setf(ios::fixed);
1346 os << "\\screen_font_sizes"
1347 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1348 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1349 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1350 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1351 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1352 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1353 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1354 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1355 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1356 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1361 << "# COLOR SECTION ###################################\n"
1365 for (int i = 0; i < LColor::ignore; ++i) {
1366 LColor::color lc = static_cast<LColor::color>(i);
1368 string const col(lcolor.getX11Name(lc));
1369 if (col != system_lcolor.getX11Name(lc)) {
1370 os << "\\set_color \""
1371 << lcolor.getLyXName(lc) << "\" \""
1377 << "# PRINTER SECTION ###################################\n"
1381 if (printer != system_lyxrc.printer) {
1382 os << "\\printer \"" << printer << "\"\n";
1384 case RC_PRINT_ADAPTOUTPUT:
1385 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1386 os << "\\print_adapt_output "
1387 << tostr(print_adapt_output)
1390 case RC_PRINT_COMMAND:
1391 if (print_command != system_lyxrc.print_command) {
1392 os << "\\print_command \"" << print_command << "\"\n";
1394 case RC_PRINTEXSTRAOPTIONS:
1395 if (print_extra_options != system_lyxrc.print_extra_options) {
1396 os << "\\print_extra_options \"" << print_extra_options
1399 case RC_PRINTSPOOL_COMMAND:
1400 if (print_spool_command != system_lyxrc.print_spool_command) {
1401 os << "\\print_spool_command \"" << print_spool_command
1404 case RC_PRINTSPOOL_PRINTERPREFIX:
1405 if (print_spool_printerprefix
1406 != system_lyxrc.print_spool_printerprefix) {
1407 os << "\\print_spool_printerprefix \""
1408 << print_spool_printerprefix << "\"\n";
1410 case RC_PRINTEVENPAGEFLAG:
1411 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1412 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1415 case RC_PRINTODDPAGEFLAG:
1416 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1417 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1420 case RC_PRINTREVERSEFLAG:
1421 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1422 os << "\\print_reverse_flag \"" << print_reverse_flag
1425 case RC_PRINTLANDSCAPEFLAG:
1426 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1427 os << "\\print_landscape_flag \"" << print_landscape_flag
1430 case RC_PRINTPAGERANGEFLAG:
1431 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1432 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1435 case RC_PRINTCOPIESFLAG:
1436 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1437 os << "\\print_copies_flag \"" << print_copies_flag
1440 case RC_PRINTCOLLCOPIESFLAG:
1441 if (print_collcopies_flag
1442 != system_lyxrc.print_collcopies_flag) {
1443 os << "\\print_collcopies_flag \""
1444 << print_collcopies_flag
1447 case RC_PRINTPAPERFLAG:
1448 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1449 os << "\\print_paper_flag \"" << print_paper_flag
1452 case RC_PRINTPAPERDIMENSIONFLAG:
1453 if (print_paper_dimension_flag
1454 != system_lyxrc.print_paper_dimension_flag) {
1455 os << "\\print_paper_dimension_flag \""
1456 << print_paper_dimension_flag << "\"\n";
1458 case RC_PRINTTOPRINTER:
1459 if (print_to_printer != system_lyxrc.print_to_printer) {
1460 os << "\\print_to_printer \"" << print_to_printer
1463 case RC_PRINTTOFILE:
1464 if (print_to_file != system_lyxrc.print_to_file) {
1465 os << "\\print_to_file \"" << print_to_file << "\"\n";
1467 case RC_PRINTFILEEXTENSION:
1468 if (print_file_extension != system_lyxrc.print_file_extension) {
1469 os << "\\print_file_extension \""
1470 << print_file_extension
1475 << "# EXPORT SECTION ####################################\n"
1478 case RC_CUSTOM_EXPORT_COMMAND:
1479 if (custom_export_command
1480 != system_lyxrc.custom_export_command) {
1481 os << "\\custom_export_command \""
1482 << custom_export_command
1485 case RC_CUSTOM_EXPORT_FORMAT:
1486 if (custom_export_format
1487 != system_lyxrc.custom_export_format) {
1488 os << "\\custom_export_format \"" << custom_export_format
1493 << "# TEX SECTION #######################################\n"
1496 case RC_FONT_ENCODING:
1497 if (fontenc != system_lyxrc.fontenc) {
1498 os << "\\font_encoding \"" << fontenc << "\"\n";
1502 << "# FILE SECTION ######################################\n"
1505 case RC_DOCUMENTPATH:
1506 if (document_path != system_lyxrc.document_path) {
1507 os << "\\document_path \"" << document_path << "\"\n";
1510 if (lastfiles != system_lyxrc.lastfiles) {
1511 os << "\\lastfiles \"" << lastfiles << "\"\n";
1513 case RC_NUMLASTFILES:
1514 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1515 os << "\\num_lastfiles " << num_lastfiles << '\n';
1517 case RC_CHECKLASTFILES:
1518 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1519 os << "\\check_lastfiles " << tostr(check_lastfiles)
1522 case RC_TEMPLATEPATH:
1523 if (template_path != system_lyxrc.template_path) {
1524 os << "\\template_path \"" << template_path << "\"\n";
1526 case RC_TEMPDIRPATH:
1527 if (tempdir_path != system_lyxrc.tempdir_path) {
1528 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1531 if (use_tempdir != system_lyxrc.use_tempdir) {
1532 os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
1534 case RC_ASCII_LINELEN:
1535 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1536 os << "\\ascii_linelen " << ascii_linelen << '\n';
1538 case RC_MAKE_BACKUP:
1539 if (make_backup != system_lyxrc.make_backup) {
1540 os << "\\make_backup " << tostr(make_backup) << '\n';
1542 case RC_BACKUPDIR_PATH:
1543 if (backupdir_path != system_lyxrc.backupdir_path) {
1544 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1548 << "# ASCII EXPORT SECTION ##############################\n"
1551 case RC_ASCIIROFF_COMMAND:
1552 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1553 os << "\\ascii_roff_command \"" << ascii_roff_command
1558 << "# SPELLCHECKER SECTION ##############################\n"
1560 case RC_USE_SPELL_LIB:
1561 if (use_spell_lib != system_lyxrc.use_spell_lib) {
1562 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1564 case RC_SPELL_COMMAND:
1565 if (isp_command != system_lyxrc.isp_command) {
1566 os << "\\spell_command \"" << isp_command << "\"\n";
1568 case RC_ACCEPT_COMPOUND:
1569 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1570 os << "\\accept_compound " << tostr(isp_accept_compound)
1573 case RC_USE_ALT_LANG:
1574 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1575 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1579 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1580 os << "\\alternate_language \"" << isp_alt_lang
1583 case RC_USE_ESC_CHARS:
1584 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1585 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1589 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1590 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1592 case RC_USE_PERS_DICT:
1593 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1594 os << "\\use_personal_dictionary "
1595 << tostr(isp_use_pers_dict)
1599 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1600 os << "\\personal_dictionary \"" << isp_pers_dict
1603 case RC_USE_INP_ENC:
1604 if (isp_use_input_encoding
1605 != system_lyxrc.isp_use_input_encoding) {
1606 os << "\\use_input_encoding "
1607 << tostr(isp_use_input_encoding)
1612 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1615 case RC_RTL_SUPPORT:
1616 if (rtl_support != system_lyxrc.rtl_support) {
1617 os << "\\rtl " << tostr(rtl_support) << '\n';
1619 case RC_LANGUAGE_PACKAGE:
1620 if (language_package != system_lyxrc.language_package) {
1621 os << "\\language_package \"" << language_package
1624 case RC_LANGUAGE_GLOBAL_OPTIONS:
1625 if (language_global_options
1626 != system_lyxrc.language_global_options) {
1627 os << "\\language_global_options \""
1628 << tostr(language_global_options)
1631 case RC_LANGUAGE_USE_BABEL:
1632 if (language_use_babel != system_lyxrc.language_use_babel) {
1633 os << "\\language_use_babel \""
1634 << tostr(language_use_babel)
1637 case RC_LANGUAGE_COMMAND_BEGIN:
1638 if (language_command_begin
1639 != system_lyxrc.language_command_begin) {
1640 os << "\\language_command_begin \""
1641 << language_command_begin
1644 case RC_LANGUAGE_COMMAND_END:
1645 if (language_command_end
1646 != system_lyxrc.language_command_end) {
1647 os << "\\language_command_end \"" << language_command_end
1650 case RC_LANGUAGE_COMMAND_LOCAL:
1651 if (language_command_local
1652 != system_lyxrc.language_command_local) {
1653 os << "\\language_command_local \""
1654 << language_command_local
1657 case RC_LANGUAGE_AUTO_BEGIN:
1658 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1659 os << "\\language_auto_begin "
1660 << tostr(language_auto_begin) << '\n';
1662 case RC_LANGUAGE_AUTO_END:
1663 if (language_auto_end != system_lyxrc.language_auto_end) {
1664 os << "\\language_auto_end "
1665 << tostr(language_auto_end) << '\n';
1667 case RC_MARK_FOREIGN_LANGUAGE:
1668 if (mark_foreign_language
1669 != system_lyxrc.mark_foreign_language) {
1670 os << "\\mark_foreign_language " <<
1671 tostr(mark_foreign_language) << '\n';
1675 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1678 case RC_AUTO_NUMBER:
1679 if (auto_number != system_lyxrc.auto_number) {
1680 os << "\\auto_number " << tostr(auto_number) << '\n';
1682 case RC_DEFAULT_LANGUAGE:
1683 if (default_language != system_lyxrc.default_language) {
1684 os << "\\default_language " << default_language << '\n';
1688 << "# FORMATS SECTION ##########################\n"
1692 // Look for deleted formats
1693 for (Formats::const_iterator cit = formats.begin();
1694 cit != formats.end(); ++cit) {
1695 Format const * format =
1696 system_formats.getFormat(cit->name());
1698 format->extension() != cit->extension() ||
1699 format->prettyname() != cit->prettyname() ||
1700 format->shortcut() != cit->shortcut())
1701 os << "\\format \"" << cit->name() << "\" \""
1702 << cit->extension() << "\" \""
1703 << cit->prettyname() << "\" \""
1704 << cit->shortcut() << "\"\n";
1707 // New/modifed formats
1708 for (Formats::const_iterator cit = system_formats.begin();
1709 cit != system_formats.end(); ++cit)
1710 if (!formats.getFormat(cit->name()))
1711 os << "\\format \"" << cit->name()
1712 << "\" \"\" \"\" \"\"\n";
1714 for (Formats::const_iterator cit = formats.begin();
1715 cit != formats.end(); ++cit) {
1716 Format const * format =
1717 system_formats.getFormat(cit->name());
1718 if ((!format || format->viewer() != cit->viewer()) &&
1719 (format || !cit->viewer().empty()))
1720 os << "\\viewer \"" << cit->name() << "\" \""
1721 << cit->viewer() << "\"\n";
1725 << "# CONVERTERS SECTION ##########################\n"
1729 // Look for new converters
1730 for (Converters::const_iterator cit = converters.begin();
1731 cit != converters.end(); ++cit) {
1732 Converter const * converter =
1733 system_converters.getConverter(cit->from,
1736 converter->command != cit->command ||
1737 converter->flags != cit->flags)
1738 os << "\\converter \"" << cit->from << "\" \""
1739 << cit->to << "\" \""
1740 << cit->command << "\" \""
1741 << cit->flags << "\"\n";
1744 // New/modifed converters
1745 for (Converters::const_iterator cit = system_converters.begin();
1746 cit != system_converters.end(); ++cit)
1747 if (!converters.getConverter(cit->from, cit->to))
1748 os << "\\converter \"" << cit->from
1749 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1755 void LyXRC::set_font_norm_type()
1757 if (font_norm == "iso10646-1")
1758 font_norm_type = ISO_10646_1;
1759 else if (font_norm == "iso8859-1")
1760 font_norm_type = ISO_8859_1;
1761 else if (font_norm == "iso8859-3")
1762 font_norm_type = ISO_8859_3;
1763 else if (font_norm == "iso8859-4")
1764 font_norm_type = ISO_8859_4;
1765 else if (font_norm == "iso8859-6.8x")
1766 font_norm_type = ISO_8859_6_8;
1767 else if (font_norm == "iso8859-9")
1768 font_norm_type = ISO_8859_9;
1769 else if (font_norm == "iso8859-15")
1770 font_norm_type = ISO_8859_15;
1772 font_norm_type = OTHER_ENCODING;
1776 string const LyXRC::getDescription(LyXRCTags tag)
1781 case RC_FONT_ENCODING:
1782 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1786 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1789 case RC_PRINT_COMMAND:
1790 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1793 case RC_PRINTEVENPAGEFLAG:
1794 str = _("The option to print only even pages.");
1797 case RC_PRINTODDPAGEFLAG:
1798 str = _("The option to print only odd pages.");
1801 case RC_PRINTPAGERANGEFLAG:
1802 str = _("The option for specifying a comma-separated list of pages to print.");
1805 case RC_PRINTCOPIESFLAG:
1806 str = _("The option for specifying the number of copies to print.");
1809 case RC_PRINTCOLLCOPIESFLAG:
1810 str = _("The option for specifying whether the copies should be collated.");
1813 case RC_PRINTREVERSEFLAG:
1814 str = _("The option to reverse the order of the pages printed.");
1817 case RC_PRINTLANDSCAPEFLAG:
1818 str = _("The option to print out in landscape.");
1821 case RC_PRINTPAPERFLAG:
1822 str = _("The option to specify paper type.");
1825 case RC_PRINTPAPERDIMENSIONFLAG:
1826 str = _("Option to specify the dimensions of the print paper.");
1829 case RC_PRINTTOPRINTER:
1830 str = _("Option to pass to the print program to print on a specific printer.");
1833 case RC_PRINT_ADAPTOUTPUT:
1834 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1837 case RC_PRINTTOFILE:
1838 str = _("Option to pass to the print program to print to a file.");
1841 case RC_PRINTFILEEXTENSION:
1842 str = _("Extension of printer program output file. Usually \".ps\".");
1845 case RC_PRINTEXSTRAOPTIONS:
1846 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1849 case RC_PRINTSPOOL_COMMAND:
1850 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.");
1853 case RC_PRINTSPOOL_PRINTERPREFIX:
1854 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.");
1858 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1861 case RC_SCREEN_ZOOM:
1862 //xgettext:no-c-format
1863 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1866 case RC_SCREEN_FONT_SIZES:
1867 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1870 case RC_SCREEN_FONT_ROMAN:
1871 case RC_SCREEN_FONT_SANS:
1872 case RC_SCREEN_FONT_TYPEWRITER:
1873 str = _("The screen fonts used to display the text while editing.");
1876 case RC_POPUP_BOLD_FONT:
1877 str = _("The bold font in the dialogs.");
1880 case RC_POPUP_NORMAL_FONT:
1881 str = _("The normal font in the dialogs.");
1884 case RC_SCREEN_FONT_ENCODING:
1885 str = _("The encoding for the screen fonts.");
1888 case RC_POPUP_FONT_ENCODING:
1889 str = _("The encoding for the menu/popups fonts.");
1896 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1899 case RC_DOCUMENTPATH:
1900 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1903 case RC_TEMPLATEPATH:
1904 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1907 case RC_TEMPDIRPATH:
1908 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1912 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1916 str = _("The file where the last-files information should be stored.");
1919 case RC_AUTOREGIONDELETE:
1920 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1923 case RC_AUTORESET_OPTIONS:
1924 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1928 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1932 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1936 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1940 case RC_KBMAP_PRIMARY:
1941 case RC_KBMAP_SECONDARY:
1942 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.");
1945 case RC_ASCIIROFF_COMMAND:
1946 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.");
1949 case RC_ASCII_LINELEN:
1950 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1953 case RC_NUMLASTFILES:
1954 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1957 case RC_CHECKLASTFILES:
1958 str = _("Select to check whether the lastfiles still exist.");
1961 case RC_VIEWDVI_PAPEROPTION:
1962 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1965 case RC_DEFAULT_PAPERSIZE:
1966 str = _("Specify the default paper size.");
1972 case RC_ACCEPT_COMPOUND:
1973 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1976 case RC_SPELL_COMMAND:
1977 str = _("What command runs the spell checker?");
1980 case RC_USE_INP_ENC:
1981 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.");
1984 case RC_USE_ALT_LANG:
1986 str = _("Specify an alternate language. The default is to use the language of the document.");
1989 case RC_USE_PERS_DICT:
1991 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1994 case RC_USE_ESC_CHARS:
1996 str = _("Specify additional chars that can be part of a word.");
1999 case RC_SCREEN_FONT_SCALABLE:
2000 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.");
2003 case RC_CHKTEX_COMMAND:
2004 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2007 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2008 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.");
2011 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2012 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2015 case RC_DISPLAY_GRAPHICS:
2016 str = _("Select how LyX will display any graphics.");
2019 case RC_MAKE_BACKUP:
2020 str = _("De-select if you don't want LyX to create backup files.");
2023 case RC_BACKUPDIR_PATH:
2024 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.");
2027 case RC_RTL_SUPPORT:
2028 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2031 case RC_MARK_FOREIGN_LANGUAGE:
2032 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2035 case RC_LANGUAGE_PACKAGE:
2036 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2039 case RC_LANGUAGE_GLOBAL_OPTIONS:
2040 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2043 case RC_LANGUAGE_USE_BABEL:
2044 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2047 case RC_LANGUAGE_AUTO_BEGIN:
2048 str = _("Select if a language switching command is needed at the beginning of the document.");
2051 case RC_LANGUAGE_AUTO_END:
2052 str = _("Select if a language switching command is needed at the end of the document.");
2055 case RC_LANGUAGE_COMMAND_BEGIN:
2056 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.");
2059 case RC_LANGUAGE_COMMAND_END:
2060 str = _("The LaTeX command for changing back to the language of the document.");
2063 case RC_LANGUAGE_COMMAND_LOCAL:
2064 str = _("The LaTeX command for local changing of the language.");
2067 case RC_DATE_INSERT_FORMAT:
2068 //xgettext:no-c-format
2069 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2072 case RC_SHOW_BANNER:
2073 str = _("De-select if you don't want the startup banner.");
2077 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2089 case RC_DEFAULT_LANGUAGE:
2090 str = _("New documents will be assigned this language.");
2093 case RC_LABEL_INIT_LENGTH:
2094 str = _("Maximum number of words in the initialization string for a new label");
2098 str = _("Shows a typeset preview of things such as math");
2101 case RC_PREVIEW_HASHED_LABELS:
2102 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2105 case RC_PREVIEW_SCALE_FACTOR:
2106 str = _("Scale the preview size to suit.");
2116 // The global instance
2119 // The global copy of the system lyxrc entries (everything except preferences)