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öntiz
14 * Full author contact details are available in file CREDITS.
25 #include "converter.h"
31 #include "support/filetools.h"
32 #include "support/lstrings.h"
33 #include "support/translator.h"
34 #include "support/tostr.h"
35 #include "support/userinfo.h"
37 using lyx::support::ascii_lowercase;
38 using lyx::support::ExpandPath;
39 using lyx::support::GetEnv;
40 using lyx::support::LibFileSearch;
41 using lyx::support::token;
53 /// The translator between the DisplayType and the corresponding lyx string.
54 extern Translator<DisplayType, string> displayTranslator;
60 // when adding something to this array keep it sorted!
61 keyword_item lyxrcTags[] = {
62 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
63 { "\\alternate_language", LyXRC::RC_ALT_LANG },
64 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
65 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
66 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
67 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
68 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
69 { "\\autosave", LyXRC::RC_AUTOSAVE },
70 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
71 { "\\bind_file", LyXRC::RC_BINDFILE },
72 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
73 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
74 { "\\converter", LyXRC::RC_CONVERTER },
75 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
76 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
77 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
78 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
79 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
80 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
81 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
82 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
83 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
84 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
85 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
86 { "\\format", LyXRC::RC_FORMAT },
87 { "\\input", LyXRC::RC_INPUT },
88 { "\\kbmap", LyXRC::RC_KBMAP },
89 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
90 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
91 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
92 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
93 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
94 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
95 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
96 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
97 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
98 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
99 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
100 { "\\lastfiles", LyXRC::RC_LASTFILES },
101 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
102 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
103 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
104 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
105 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
106 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
107 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
108 { "\\preview", LyXRC::RC_PREVIEW },
109 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
110 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
111 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
112 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
113 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
114 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
115 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
116 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
117 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
118 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
119 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
120 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
121 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
122 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
123 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
124 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
125 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
126 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
127 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
128 { "\\printer", LyXRC::RC_PRINTER },
129 { "\\ps_command", LyXRC::RC_PS_COMMAND },
130 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
131 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
132 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
133 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
134 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
135 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
136 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
137 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
138 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
139 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
140 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
141 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
142 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
143 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
144 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
145 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
146 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
147 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
148 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
149 { "\\set_color", LyXRC::RC_SET_COLOR },
150 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
151 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
152 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
153 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
154 { "\\ui_file", LyXRC::RC_UIFILE },
155 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
156 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
157 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
158 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
159 // compatibility with versions older than 1.4.0 only
160 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
161 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
162 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
163 { "\\user_email", LyXRC::RC_USER_EMAIL },
164 { "\\user_name", LyXRC::RC_USER_NAME },
165 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
166 { "\\viewer" ,LyXRC::RC_VIEWER},
167 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
170 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
181 void LyXRC::setDefaults() {
184 // Get printer from the environment. If fail, use default "",
185 // assuming that everything is set up correctly.
186 printer = GetEnv("PRINTER");
187 print_adapt_output = false;
188 print_command = "dvips";
189 print_evenpage_flag = "-B";
190 print_oddpage_flag = "-A";
191 print_pagerange_flag = "-pp";
192 print_copies_flag = "-c";
193 print_collcopies_flag = "-C";
194 print_reverse_flag = "-r";
195 print_landscape_flag = "-t landscape";
196 print_to_printer = "-P";
197 print_to_file = "-o ";
198 print_file_extension = ".ps";
199 print_paper_flag = "-t";
200 print_paper_dimension_flag = "-T";
201 document_path.erase();
202 tempdir_path = "/tmp";
205 view_dvi_paper_option.erase();
206 default_papersize = PAPER_USLETTER;
207 custom_export_format = "ps";
208 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
211 // Because a screen typically is wider than a piece of paper:
214 // Default LaTeX font size:
215 font_sizes[LyXFont::SIZE_TINY] = 5.0;
216 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
217 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
218 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
219 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
220 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
221 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
222 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
223 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
224 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
225 use_scalable_fonts = true;
226 roman_font_name = "";
228 typewriter_font_name = "";
229 popup_bold_font = "-*-helvetica-bold-r";
230 popup_normal_font = "-*-helvetica-medium-r";
231 font_norm = "iso8859-1";
232 font_norm_type = ISO_8859_1;
233 popup_font_encoding.erase();
235 auto_region_delete = true;
236 auto_reset_options = false;
239 check_lastfiles = true;
241 backupdir_path.erase();
242 display_graphics = lyx::graphics::ColorDisplay;
243 // Spellchecker settings:
244 use_spell_lib = true;
245 isp_command = "ispell";
246 isp_accept_compound = false;
247 isp_use_input_encoding = false;
248 isp_use_alt_lang = false;
249 isp_use_pers_dict = false;
250 isp_use_esc_chars = false;
254 mark_foreign_language = true;
255 language_auto_begin = true;
256 language_auto_end = true;
257 language_global_options = true;
258 language_use_babel = true;
259 language_package = "\\usepackage{babel}";
260 language_command_begin = "\\selectlanguage{$$lang}";
261 language_command_local = "\\foreignlanguage{$$lang}{";
262 default_language = "english";
266 date_insert_format = "%A, %e %B %Y";
267 cursor_follows_scrollbar = false;
268 dialogs_iconify_with_main = false;
269 label_init_length = 3;
271 preview_hashed_labels = false;
272 preview_scale_factor = 0.9;
274 user_name = lyx::support::user_name();
276 user_email = lyx::support::user_email();
278 if (user_email.empty())
279 user_email = _("email address unknown");
285 void oldFontFormat(string & family, string & foundry)
287 if (family.empty() || family[0] != '-')
289 foundry = token(family, '-', 1);
290 family = token(family, '-', 2);
298 int LyXRC::read(string const & filename)
300 LyXLex lexrc(lyxrcTags, lyxrcCount);
301 if (lyxerr.debugging(Debug::PARSER))
302 lexrc.printTable(lyxerr);
304 lexrc.setFile(filename);
305 if (!lexrc.isOK()) return -2;
307 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
309 while (lexrc.isOK()) {
310 // By using two switches we take advantage of the compiler
311 // telling us if we have missed a LyXRCTags element in
312 // the second switch.
313 // Note that this also shows a problem with LyXLex since it
314 // helps us avoid taking advantage of the strictness of the
317 int le = lexrc.lex();
319 case LyXLex::LEX_UNDEF:
320 lexrc.printError("Unknown tag `$$Token'");
322 case LyXLex::LEX_FEOF:
326 switch (static_cast<LyXRCTags>(le)) {
327 case RC_INPUT: // Include file
330 LibFileSearch(string(),
333 lexrc.printError("Error reading "
334 "included file: "+tmp);
338 case RC_BINDFILE: // RVDK_PATCH_5
340 bind_file = lexrc.getString();
346 ui_file = lexrc.getString();
350 case RC_AUTORESET_OPTIONS:
352 auto_reset_options = lexrc.getBool();
356 case RC_DISPLAY_GRAPHICS:
358 display_graphics = lyx::graphics::displayTranslator.find(lexrc.getString());
364 use_kbmap = lexrc.getBool();
368 case RC_KBMAP_PRIMARY:
370 string const kmap(lexrc.getString());
373 } else if (!LibFileSearch("kbd", kmap,
375 primary_kbmap = kmap;
377 lexrc.printError("LyX: Keymap `$$Token' not found");
382 case RC_KBMAP_SECONDARY:
384 string const kmap(lexrc.getString());
387 } else if (!LibFileSearch("kbd", kmap,
389 secondary_kbmap = kmap;
391 lexrc.printError("LyX: Keymap `$$Token' not found");
396 case RC_FONT_ENCODING:
398 fontenc = lexrc.getString();
404 printer = lexrc.getString();
408 case RC_PRINT_COMMAND:
410 print_command = lexrc.getString();
414 case RC_PRINTEVENPAGEFLAG:
416 print_evenpage_flag = lexrc.getString();
420 case RC_PRINTODDPAGEFLAG:
422 print_oddpage_flag = lexrc.getString();
426 case RC_PRINTPAGERANGEFLAG:
428 print_pagerange_flag = lexrc.getString();
432 case RC_PRINTCOPIESFLAG:
434 print_copies_flag = lexrc.getString();
438 case RC_PRINTCOLLCOPIESFLAG:
440 print_collcopies_flag = lexrc.getString();
444 case RC_PRINTREVERSEFLAG:
446 print_reverse_flag = lexrc.getString();
450 case RC_PRINTLANDSCAPEFLAG:
452 print_landscape_flag = lexrc.getString();
456 case RC_PRINTTOPRINTER:
458 print_to_printer = lexrc.getString();
462 case RC_PRINT_ADAPTOUTPUT:
464 print_adapt_output = lexrc.getBool();
470 print_to_file = lexrc.getString();
474 case RC_PRINTFILEEXTENSION:
476 print_file_extension = lexrc.getString();
480 case RC_PRINTEXSTRAOPTIONS:
482 print_extra_options = lexrc.getString();
486 case RC_PRINTSPOOL_COMMAND:
488 print_spool_command = lexrc.getString();
492 case RC_PRINTSPOOL_PRINTERPREFIX:
494 print_spool_printerprefix = lexrc.getString();
498 case RC_PRINTPAPERDIMENSIONFLAG:
500 print_paper_dimension_flag = lexrc.getString();
504 case RC_PRINTPAPERFLAG:
506 print_paper_flag = lexrc.getString();
510 case RC_CUSTOM_EXPORT_COMMAND:
512 custom_export_command = lexrc.getString();
516 case RC_CUSTOM_EXPORT_FORMAT:
518 custom_export_format = lexrc.getString();
522 case RC_DEFAULT_PAPERSIZE:
525 ascii_lowercase(lexrc.getString());
526 if (size == "usletter")
529 else if (size == "legal")
532 else if (size == "executive")
534 PAPER_EXECUTIVEPAPER;
535 else if (size == "a3")
538 else if (size == "a4")
541 else if (size == "a5")
544 else if (size == "b5")
550 case RC_VIEWDVI_PAPEROPTION:
552 view_dvi_paper_option = lexrc.getString();
554 view_dvi_paper_option.erase();
560 ps_command = lexrc.getString();
564 case RC_CHKTEX_COMMAND:
566 chktex_command = lexrc.getString();
572 dpi = lexrc.getInteger();
578 zoom = lexrc.getInteger();
584 wheel_jump = lexrc.getInteger();
588 case RC_SCREEN_FONT_SIZES:
590 font_sizes[LyXFont::SIZE_TINY] =
594 font_sizes[LyXFont::SIZE_SCRIPT] =
598 font_sizes[LyXFont::SIZE_FOOTNOTE] =
602 font_sizes[LyXFont::SIZE_SMALL] =
606 font_sizes[LyXFont::SIZE_NORMAL] =
610 font_sizes[LyXFont::SIZE_LARGE] =
614 font_sizes[LyXFont::SIZE_LARGER] =
618 font_sizes[LyXFont::SIZE_LARGEST] =
622 font_sizes[LyXFont::SIZE_HUGE] =
626 font_sizes[LyXFont::SIZE_HUGER] =
631 case RC_SCREEN_FONT_SCALABLE:
633 use_scalable_fonts = lexrc.getBool();
639 autosave = lexrc.getInteger();
643 case RC_DOCUMENTPATH:
645 document_path = ExpandPath(lexrc.getString());
649 case RC_TEMPLATEPATH:
651 template_path = ExpandPath(lexrc.getString());
657 tempdir_path = ExpandPath(lexrc.getString());
663 use_tempdir = lexrc.getBool();
669 lastfiles = ExpandPath(lexrc.getString());
673 case RC_NUMLASTFILES:
675 num_lastfiles = lexrc.getInteger();
679 case RC_CHECKLASTFILES:
681 check_lastfiles = lexrc.getBool();
685 case RC_SCREEN_FONT_ROMAN:
687 roman_font_name = lexrc.getString();
688 oldFontFormat(roman_font_name,
693 case RC_SCREEN_FONT_SANS:
695 sans_font_name = lexrc.getString();
696 oldFontFormat(sans_font_name, sans_font_foundry);
700 case RC_SCREEN_FONT_TYPEWRITER:
702 typewriter_font_name = lexrc.getString();
703 oldFontFormat(typewriter_font_name,
704 typewriter_font_foundry);
708 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
710 roman_font_foundry = lexrc.getString();
714 case RC_SCREEN_FONT_SANS_FOUNDRY:
716 sans_font_foundry = lexrc.getString();
720 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
722 typewriter_font_foundry = lexrc.getString();
726 case RC_SCREEN_FONT_ENCODING:
728 font_norm = lexrc.getString();
729 set_font_norm_type();
733 case RC_POPUP_BOLD_FONT:
735 popup_bold_font = lexrc.getString();
739 case RC_POPUP_NORMAL_FONT:
741 popup_normal_font = lexrc.getString();
745 case RC_POPUP_FONT_ENCODING:
747 popup_font_encoding = lexrc.getString();
753 string lyx_name, x11_name;
756 lyx_name = lexrc.getString();
758 lexrc.printError("Missing color tag.");
763 x11_name = lexrc.getString();
765 lexrc.printError("Missing color name for color: `$$Token'");
769 if (!lcolor.setColor(lyx_name, x11_name)) {
770 lyxerr << "Bad lyxrc set_color for "
776 case RC_AUTOREGIONDELETE:
777 // Auto region delete defaults to true
779 auto_region_delete = lexrc.getBool();
785 lyxpipes = ExpandPath(lexrc.getString());
789 case RC_CURSOR_FOLLOWS_SCROLLBAR:
791 cursor_follows_scrollbar = lexrc.getBool();
795 case RC_DIALOGS_ICONIFY_WITH_MAIN:
797 dialogs_iconify_with_main = lexrc.getBool();
801 case RC_ASCIIROFF_COMMAND:
803 ascii_roff_command = lexrc.getString();
806 case RC_ASCII_LINELEN:
808 ascii_linelen = lexrc.getInteger();
811 // Spellchecker settings:
812 case RC_USE_SPELL_LIB:
814 use_spell_lib = lexrc.getBool();
817 case RC_SPELL_COMMAND:
819 isp_command = lexrc.getString();
822 case RC_ACCEPT_COMPOUND:
824 isp_accept_compound = lexrc.getBool();
829 isp_use_input_encoding = lexrc.getBool();
832 case RC_USE_ALT_LANG:
834 isp_use_alt_lang = lexrc.getBool();
837 case RC_USE_PERS_DICT:
839 isp_use_pers_dict = lexrc.getBool();
842 case RC_USE_ESC_CHARS:
844 isp_use_esc_chars = lexrc.getBool();
849 isp_alt_lang = lexrc.getString();
854 isp_pers_dict = lexrc.getString();
859 isp_esc_chars = lexrc.getString();
864 make_backup = lexrc.getBool();
867 case RC_BACKUPDIR_PATH:
869 backupdir_path = ExpandPath(lexrc.getString());
872 case RC_DATE_INSERT_FORMAT:
874 date_insert_format = lexrc.getString();
877 case RC_LANGUAGE_PACKAGE:
879 language_package = lexrc.getString();
882 case RC_LANGUAGE_AUTO_BEGIN:
884 language_auto_begin = lexrc.getBool();
887 case RC_LANGUAGE_AUTO_END:
889 language_auto_end = lexrc.getBool();
892 case RC_LANGUAGE_GLOBAL_OPTIONS:
894 language_global_options = lexrc.getBool();
897 case RC_LANGUAGE_USE_BABEL:
899 language_use_babel = lexrc.getBool();
902 case RC_LANGUAGE_COMMAND_BEGIN:
904 language_command_begin = lexrc.getString();
907 case RC_LANGUAGE_COMMAND_END:
909 language_command_end = lexrc.getString();
912 case RC_LANGUAGE_COMMAND_LOCAL:
914 language_command_local = lexrc.getString();
919 rtl_support = lexrc.getBool();
924 auto_number = lexrc.getBool();
927 case RC_MARK_FOREIGN_LANGUAGE:
929 mark_foreign_language = lexrc.getBool();
934 string from, to, command, flags;
936 from = lexrc.getString();
939 to = lexrc.getString();
942 command = lexrc.getString();
945 flags = lexrc.getString();
948 || token(command, ' ', 0) == "none") {
949 converters.erase(from, to);
951 converters.add(from, to, command, flags);
956 string format, command;
958 format = lexrc.getString();
961 command = lexrc.getString();
962 if (token(command, ' ', 0) == "none")
965 formats.setViewer(format, command);
969 string format, extension, prettyname, shortcut;
971 format = lexrc.getString();
974 extension = lexrc.getString();
977 prettyname = lexrc.getString();
980 shortcut = lexrc.getString();
982 if (prettyname.empty()) {
983 if (converters.formatIsUsed(format)) {
984 lyxerr << "Can't delete format "
987 formats.erase(format);
990 formats.add(format, extension, prettyname,
995 case RC_DEFAULT_LANGUAGE:
997 default_language = lexrc.getString();
1001 case RC_LABEL_INIT_LENGTH:
1003 label_init_length = lexrc.getInteger();
1007 case RC_SHOW_BANNER:
1009 show_banner = lexrc.getBool();
1015 preview = lexrc.getBool();
1019 case RC_PREVIEW_HASHED_LABELS:
1021 preview_hashed_labels = lexrc.getBool();
1025 case RC_PREVIEW_SCALE_FACTOR:
1027 preview_scale_factor = lexrc.getFloat();
1033 user_name = lexrc.getString();
1038 user_email = lexrc.getString();
1041 case RC_LAST: break; // this is just a dummy
1045 /// Update converters data-structures
1046 converters.update(formats);
1047 converters.buildGraph();
1053 void LyXRC::write(string const & filename) const
1055 ofstream ofs(filename.c_str());
1061 void LyXRC::print() const
1063 if (lyxerr.debugging())
1070 void LyXRC::output(ostream & os) const
1072 os << "### This file is part of\n"
1073 << "### ========================================================\n"
1074 << "### LyX, The Document Processor\n"
1076 << "### Copyright 1995 Matthias Ettrich\n"
1077 << "### Copyright 1995-2001 The LyX Team.\n"
1079 << "### ========================================================\n"
1081 << "# This file is written by LyX, if you want to make your own\n"
1082 << "# modifications you should do them from inside LyX and save\n"
1085 // Why the switch you might ask. It is a trick to ensure that all
1086 // the elements in the LyXRCTags enum is handled. As you can see
1087 // there are no breaks at all. So it is just a huge fall-through.
1088 // The nice thing is that we will get a warning from the compiler
1089 // if we forget an element.
1090 LyXRCTags tag = RC_LAST;
1094 // input/include files are not done here
1096 if (bind_file != system_lyxrc.bind_file) {
1097 os << "\\bind_file " << bind_file << "\n";
1103 << "# MISC SECTION ######################################\n"
1106 // bind files are not done here.
1108 if (ui_file != system_lyxrc.ui_file) {
1109 os << "\\ui_file \"" << ui_file << "\"\n";
1111 case RC_AUTOREGIONDELETE:
1112 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1113 os << "# Set to false to inhibit automatic replacement of\n"
1114 << "# the current selection.\n"
1115 << "\\auto_region_delete " << tostr(auto_region_delete)
1118 case RC_AUTORESET_OPTIONS:
1119 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1120 os << "# Set to false to inhibit automatic reset of\n"
1121 << "# the class options to defaults on class change.\n"
1122 << "\\auto_reset_options " << tostr(auto_reset_options)
1126 if (autosave != system_lyxrc.autosave) {
1127 os << "# The time interval between auto-saves in seconds.\n"
1128 << "\\autosave " << autosave << '\n';
1130 case RC_DISPLAY_GRAPHICS:
1131 if (display_graphics != system_lyxrc.display_graphics) {
1132 os << "# Display graphics within LyX\n"
1133 << "# monochrome|grayscale|color|none\n"
1134 << "\\display_graphics "
1135 << lyx::graphics::displayTranslator.find(display_graphics)
1139 case RC_VIEWDVI_PAPEROPTION:
1140 if (view_dvi_paper_option
1141 != system_lyxrc.view_dvi_paper_option) {
1142 os << "# Options used to specify paper size to the\n"
1143 << "# view_dvi_command (e.g. -paper)\n"
1144 << "\\view_dvi_paper_option \""
1145 << view_dvi_paper_option << "\"\n";
1147 case RC_DEFAULT_PAPERSIZE:
1148 if (default_papersize != system_lyxrc.default_papersize) {
1149 os << "# The default papersize to use.\n"
1150 << "\\default_papersize \"";
1151 switch (default_papersize) {
1152 case PAPER_USLETTER:
1153 os << "usletter"; break;
1154 case PAPER_LEGALPAPER:
1155 os << "legal"; break;
1156 case PAPER_EXECUTIVEPAPER:
1157 os << "executive"; break;
1166 case PAPER_DEFAULT: break;
1171 if (ps_command != system_lyxrc.ps_command) {
1172 os << "# Program used for interpreting postscript.\n"
1173 << "\\ps_command \"" << ps_command << "\"\n";
1175 case RC_CHKTEX_COMMAND:
1176 if (chktex_command != system_lyxrc.chktex_command) {
1177 os << "\\chktex_command \"" << chktex_command << "\"\n";
1180 if (use_kbmap != system_lyxrc.use_kbmap) {
1181 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1183 case RC_KBMAP_PRIMARY:
1184 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1185 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1187 case RC_KBMAP_SECONDARY:
1188 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1189 os << "\\kbmap_secondary \"" << secondary_kbmap
1193 if (lyxpipes != system_lyxrc.lyxpipes) {
1194 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1196 case RC_DATE_INSERT_FORMAT:
1197 if (date_insert_format != system_lyxrc.date_insert_format) {
1198 os << "\\date_insert_format \"" << date_insert_format
1201 case RC_LABEL_INIT_LENGTH:
1202 if (label_init_length != system_lyxrc.label_init_length) {
1203 os << "\\label_init_length " << label_init_length
1208 os << "\\user_name \"" << user_name << "\"\n";
1211 os << "\\user_email \"" << user_email << "\"\n";
1213 case RC_SHOW_BANNER:
1214 if (show_banner != system_lyxrc.show_banner) {
1215 os << "\\show_banner " << tostr(show_banner) << '\n';
1219 if (preview != system_lyxrc.preview) {
1220 os << "\\preview " << tostr(preview) << '\n';
1223 case RC_PREVIEW_HASHED_LABELS:
1224 if (preview_hashed_labels !=
1225 system_lyxrc.preview_hashed_labels) {
1226 os << "\\preview_hashed_labels "
1227 << tostr(preview_hashed_labels) << '\n';
1230 case RC_PREVIEW_SCALE_FACTOR:
1231 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1232 os << "\\preview_scale_factor "
1233 << preview_scale_factor << '\n';
1237 << "# SCREEN & FONTS SECTION ############################\n"
1240 case RC_POPUP_NORMAL_FONT:
1241 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1242 os << "\\popup_normal_font \"" << popup_normal_font
1245 case RC_POPUP_BOLD_FONT:
1246 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1247 os << "\\popup_bold_font \"" << popup_bold_font
1250 case RC_POPUP_FONT_ENCODING:
1251 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1252 os << "\\popup_font_encoding \"" << popup_font_encoding
1256 if (dpi != system_lyxrc.dpi) {
1257 os << "\\screen_dpi " << dpi << '\n';
1259 case RC_SCREEN_ZOOM:
1260 if (zoom != system_lyxrc.zoom) {
1261 os << "\\screen_zoom " << zoom << '\n';
1264 if (wheel_jump != system_lyxrc.wheel_jump) {
1265 os << "\\wheel_jump " << wheel_jump << '\n';
1267 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1268 if (cursor_follows_scrollbar
1269 != system_lyxrc.cursor_follows_scrollbar) {
1270 os << "\\cursor_follows_scrollbar "
1271 << tostr(cursor_follows_scrollbar) << '\n';
1273 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1274 if (dialogs_iconify_with_main
1275 != system_lyxrc.dialogs_iconify_with_main) {
1276 os << "\\dialogs_iconify_with_main "
1277 << tostr(dialogs_iconify_with_main) << '\n';
1279 case RC_SCREEN_FONT_ROMAN:
1280 if (roman_font_name != system_lyxrc.roman_font_name) {
1281 os << "\\screen_font_roman \"" << roman_font_name
1284 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1285 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1286 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1289 case RC_SCREEN_FONT_SANS:
1290 if (sans_font_name != system_lyxrc.sans_font_name) {
1291 os << "\\screen_font_sans \"" << sans_font_name
1294 case RC_SCREEN_FONT_SANS_FOUNDRY:
1295 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1296 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1299 case RC_SCREEN_FONT_TYPEWRITER:
1300 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1301 os << "\\screen_font_typewriter \""
1302 << typewriter_font_name << "\"\n";
1304 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1305 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1306 os << "\\screen_font_typewriter_foundry \""
1307 << typewriter_font_foundry << "\"\n";
1310 case RC_SCREEN_FONT_SCALABLE:
1311 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1312 os << "\\screen_font_scalable "
1313 << tostr(use_scalable_fonts)
1316 case RC_SCREEN_FONT_ENCODING:
1317 if (font_norm != system_lyxrc.font_norm) {
1318 os << "\\screen_font_encoding \"" << font_norm
1321 case RC_SCREEN_FONT_SIZES:
1322 if (font_sizes[LyXFont::SIZE_TINY]
1323 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1324 font_sizes[LyXFont::SIZE_SCRIPT]
1325 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1326 font_sizes[LyXFont::SIZE_FOOTNOTE]
1327 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1328 font_sizes[LyXFont::SIZE_SMALL]
1329 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1330 font_sizes[LyXFont::SIZE_NORMAL]
1331 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1332 font_sizes[LyXFont::SIZE_LARGE]
1333 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1334 font_sizes[LyXFont::SIZE_LARGER]
1335 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1336 font_sizes[LyXFont::SIZE_LARGEST]
1337 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1338 font_sizes[LyXFont::SIZE_HUGE]
1339 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1340 font_sizes[LyXFont::SIZE_HUGER]
1341 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1342 os.setf(ios::fixed);
1344 os << "\\screen_font_sizes"
1345 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1346 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1347 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1348 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1349 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1350 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1351 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1352 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1353 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1354 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1359 << "# COLOR SECTION ###################################\n"
1363 for (int i = 0; i < LColor::ignore; ++i) {
1364 LColor::color lc = static_cast<LColor::color>(i);
1366 string const col(lcolor.getX11Name(lc));
1367 if (col != system_lcolor.getX11Name(lc)) {
1368 os << "\\set_color \""
1369 << lcolor.getLyXName(lc) << "\" \""
1375 << "# PRINTER SECTION ###################################\n"
1379 if (printer != system_lyxrc.printer) {
1380 os << "\\printer \"" << printer << "\"\n";
1382 case RC_PRINT_ADAPTOUTPUT:
1383 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1384 os << "\\print_adapt_output "
1385 << tostr(print_adapt_output)
1388 case RC_PRINT_COMMAND:
1389 if (print_command != system_lyxrc.print_command) {
1390 os << "\\print_command \"" << print_command << "\"\n";
1392 case RC_PRINTEXSTRAOPTIONS:
1393 if (print_extra_options != system_lyxrc.print_extra_options) {
1394 os << "\\print_extra_options \"" << print_extra_options
1397 case RC_PRINTSPOOL_COMMAND:
1398 if (print_spool_command != system_lyxrc.print_spool_command) {
1399 os << "\\print_spool_command \"" << print_spool_command
1402 case RC_PRINTSPOOL_PRINTERPREFIX:
1403 if (print_spool_printerprefix
1404 != system_lyxrc.print_spool_printerprefix) {
1405 os << "\\print_spool_printerprefix \""
1406 << print_spool_printerprefix << "\"\n";
1408 case RC_PRINTEVENPAGEFLAG:
1409 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1410 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1413 case RC_PRINTODDPAGEFLAG:
1414 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1415 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1418 case RC_PRINTREVERSEFLAG:
1419 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1420 os << "\\print_reverse_flag \"" << print_reverse_flag
1423 case RC_PRINTLANDSCAPEFLAG:
1424 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1425 os << "\\print_landscape_flag \"" << print_landscape_flag
1428 case RC_PRINTPAGERANGEFLAG:
1429 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1430 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1433 case RC_PRINTCOPIESFLAG:
1434 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1435 os << "\\print_copies_flag \"" << print_copies_flag
1438 case RC_PRINTCOLLCOPIESFLAG:
1439 if (print_collcopies_flag
1440 != system_lyxrc.print_collcopies_flag) {
1441 os << "\\print_collcopies_flag \""
1442 << print_collcopies_flag
1445 case RC_PRINTPAPERFLAG:
1446 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1447 os << "\\print_paper_flag \"" << print_paper_flag
1450 case RC_PRINTPAPERDIMENSIONFLAG:
1451 if (print_paper_dimension_flag
1452 != system_lyxrc.print_paper_dimension_flag) {
1453 os << "\\print_paper_dimension_flag \""
1454 << print_paper_dimension_flag << "\"\n";
1456 case RC_PRINTTOPRINTER:
1457 if (print_to_printer != system_lyxrc.print_to_printer) {
1458 os << "\\print_to_printer \"" << print_to_printer
1461 case RC_PRINTTOFILE:
1462 if (print_to_file != system_lyxrc.print_to_file) {
1463 os << "\\print_to_file \"" << print_to_file << "\"\n";
1465 case RC_PRINTFILEEXTENSION:
1466 if (print_file_extension != system_lyxrc.print_file_extension) {
1467 os << "\\print_file_extension \""
1468 << print_file_extension
1473 << "# EXPORT SECTION ####################################\n"
1476 case RC_CUSTOM_EXPORT_COMMAND:
1477 if (custom_export_command
1478 != system_lyxrc.custom_export_command) {
1479 os << "\\custom_export_command \""
1480 << custom_export_command
1483 case RC_CUSTOM_EXPORT_FORMAT:
1484 if (custom_export_format
1485 != system_lyxrc.custom_export_format) {
1486 os << "\\custom_export_format \"" << custom_export_format
1491 << "# TEX SECTION #######################################\n"
1494 case RC_FONT_ENCODING:
1495 if (fontenc != system_lyxrc.fontenc) {
1496 os << "\\font_encoding \"" << fontenc << "\"\n";
1500 << "# FILE SECTION ######################################\n"
1503 case RC_DOCUMENTPATH:
1504 if (document_path != system_lyxrc.document_path) {
1505 os << "\\document_path \"" << document_path << "\"\n";
1508 if (lastfiles != system_lyxrc.lastfiles) {
1509 os << "\\lastfiles \"" << lastfiles << "\"\n";
1511 case RC_NUMLASTFILES:
1512 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1513 os << "\\num_lastfiles " << num_lastfiles << '\n';
1515 case RC_CHECKLASTFILES:
1516 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1517 os << "\\check_lastfiles " << tostr(check_lastfiles)
1520 case RC_TEMPLATEPATH:
1521 if (template_path != system_lyxrc.template_path) {
1522 os << "\\template_path \"" << template_path << "\"\n";
1524 case RC_TEMPDIRPATH:
1525 if (tempdir_path != system_lyxrc.tempdir_path) {
1526 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1529 if (use_tempdir != system_lyxrc.use_tempdir) {
1530 os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
1532 case RC_ASCII_LINELEN:
1533 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1534 os << "\\ascii_linelen " << ascii_linelen << '\n';
1536 case RC_MAKE_BACKUP:
1537 if (make_backup != system_lyxrc.make_backup) {
1538 os << "\\make_backup " << tostr(make_backup) << '\n';
1540 case RC_BACKUPDIR_PATH:
1541 if (backupdir_path != system_lyxrc.backupdir_path) {
1542 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1546 << "# ASCII EXPORT SECTION ##############################\n"
1549 case RC_ASCIIROFF_COMMAND:
1550 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1551 os << "\\ascii_roff_command \"" << ascii_roff_command
1556 << "# SPELLCHECKER SECTION ##############################\n"
1558 case RC_USE_SPELL_LIB:
1559 if (use_spell_lib != system_lyxrc.use_spell_lib) {
1560 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1562 case RC_SPELL_COMMAND:
1563 if (isp_command != system_lyxrc.isp_command) {
1564 os << "\\spell_command \"" << isp_command << "\"\n";
1566 case RC_ACCEPT_COMPOUND:
1567 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1568 os << "\\accept_compound " << tostr(isp_accept_compound)
1571 case RC_USE_ALT_LANG:
1572 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1573 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1577 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1578 os << "\\alternate_language \"" << isp_alt_lang
1581 case RC_USE_ESC_CHARS:
1582 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1583 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1587 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1588 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1590 case RC_USE_PERS_DICT:
1591 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1592 os << "\\use_personal_dictionary "
1593 << tostr(isp_use_pers_dict)
1597 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1598 os << "\\personal_dictionary \"" << isp_pers_dict
1601 case RC_USE_INP_ENC:
1602 if (isp_use_input_encoding
1603 != system_lyxrc.isp_use_input_encoding) {
1604 os << "\\use_input_encoding "
1605 << tostr(isp_use_input_encoding)
1610 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1613 case RC_RTL_SUPPORT:
1614 if (rtl_support != system_lyxrc.rtl_support) {
1615 os << "\\rtl " << tostr(rtl_support) << '\n';
1617 case RC_LANGUAGE_PACKAGE:
1618 if (language_package != system_lyxrc.language_package) {
1619 os << "\\language_package \"" << language_package
1622 case RC_LANGUAGE_GLOBAL_OPTIONS:
1623 if (language_global_options
1624 != system_lyxrc.language_global_options) {
1625 os << "\\language_global_options \""
1626 << tostr(language_global_options)
1629 case RC_LANGUAGE_USE_BABEL:
1630 if (language_use_babel != system_lyxrc.language_use_babel) {
1631 os << "\\language_use_babel \""
1632 << tostr(language_use_babel)
1635 case RC_LANGUAGE_COMMAND_BEGIN:
1636 if (language_command_begin
1637 != system_lyxrc.language_command_begin) {
1638 os << "\\language_command_begin \""
1639 << language_command_begin
1642 case RC_LANGUAGE_COMMAND_END:
1643 if (language_command_end
1644 != system_lyxrc.language_command_end) {
1645 os << "\\language_command_end \"" << language_command_end
1648 case RC_LANGUAGE_COMMAND_LOCAL:
1649 if (language_command_local
1650 != system_lyxrc.language_command_local) {
1651 os << "\\language_command_local \""
1652 << language_command_local
1655 case RC_LANGUAGE_AUTO_BEGIN:
1656 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1657 os << "\\language_auto_begin "
1658 << tostr(language_auto_begin) << '\n';
1660 case RC_LANGUAGE_AUTO_END:
1661 if (language_auto_end != system_lyxrc.language_auto_end) {
1662 os << "\\language_auto_end "
1663 << tostr(language_auto_end) << '\n';
1665 case RC_MARK_FOREIGN_LANGUAGE:
1666 if (mark_foreign_language
1667 != system_lyxrc.mark_foreign_language) {
1668 os << "\\mark_foreign_language " <<
1669 tostr(mark_foreign_language) << '\n';
1673 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1676 case RC_AUTO_NUMBER:
1677 if (auto_number != system_lyxrc.auto_number) {
1678 os << "\\auto_number " << tostr(auto_number) << '\n';
1680 case RC_DEFAULT_LANGUAGE:
1681 if (default_language != system_lyxrc.default_language) {
1682 os << "\\default_language " << default_language << '\n';
1686 << "# FORMATS SECTION ##########################\n"
1690 // Look for deleted formats
1691 for (Formats::const_iterator cit = formats.begin();
1692 cit != formats.end(); ++cit) {
1693 Format const * format =
1694 system_formats.getFormat(cit->name());
1696 format->extension() != cit->extension() ||
1697 format->prettyname() != cit->prettyname() ||
1698 format->shortcut() != cit->shortcut())
1699 os << "\\format \"" << cit->name() << "\" \""
1700 << cit->extension() << "\" \""
1701 << cit->prettyname() << "\" \""
1702 << cit->shortcut() << "\"\n";
1705 // New/modifed formats
1706 for (Formats::const_iterator cit = system_formats.begin();
1707 cit != system_formats.end(); ++cit)
1708 if (!formats.getFormat(cit->name()))
1709 os << "\\format \"" << cit->name()
1710 << "\" \"\" \"\" \"\"\n";
1712 for (Formats::const_iterator cit = formats.begin();
1713 cit != formats.end(); ++cit) {
1714 Format const * format =
1715 system_formats.getFormat(cit->name());
1716 if ((!format || format->viewer() != cit->viewer()) &&
1717 (format || !cit->viewer().empty()))
1718 os << "\\viewer \"" << cit->name() << "\" \""
1719 << cit->viewer() << "\"\n";
1723 << "# CONVERTERS SECTION ##########################\n"
1727 // Look for new converters
1728 for (Converters::const_iterator cit = converters.begin();
1729 cit != converters.end(); ++cit) {
1730 Converter const * converter =
1731 system_converters.getConverter(cit->from,
1734 converter->command != cit->command ||
1735 converter->flags != cit->flags)
1736 os << "\\converter \"" << cit->from << "\" \""
1737 << cit->to << "\" \""
1738 << cit->command << "\" \""
1739 << cit->flags << "\"\n";
1742 // New/modifed converters
1743 for (Converters::const_iterator cit = system_converters.begin();
1744 cit != system_converters.end(); ++cit)
1745 if (!converters.getConverter(cit->from, cit->to))
1746 os << "\\converter \"" << cit->from
1747 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1753 void LyXRC::set_font_norm_type()
1755 if (font_norm == "iso10646-1")
1756 font_norm_type = ISO_10646_1;
1757 else if (font_norm == "iso8859-1")
1758 font_norm_type = ISO_8859_1;
1759 else if (font_norm == "iso8859-3")
1760 font_norm_type = ISO_8859_3;
1761 else if (font_norm == "iso8859-4")
1762 font_norm_type = ISO_8859_4;
1763 else if (font_norm == "iso8859-6.8x")
1764 font_norm_type = ISO_8859_6_8;
1765 else if (font_norm == "iso8859-9")
1766 font_norm_type = ISO_8859_9;
1767 else if (font_norm == "iso8859-15")
1768 font_norm_type = ISO_8859_15;
1770 font_norm_type = OTHER_ENCODING;
1774 string const LyXRC::getDescription(LyXRCTags tag)
1779 case RC_FONT_ENCODING:
1780 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1784 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1787 case RC_PRINT_COMMAND:
1788 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1791 case RC_PRINTEVENPAGEFLAG:
1792 str = _("The option to print only even pages.");
1795 case RC_PRINTODDPAGEFLAG:
1796 str = _("The option to print only odd pages.");
1799 case RC_PRINTPAGERANGEFLAG:
1800 str = _("The option for specifying a comma-separated list of pages to print.");
1803 case RC_PRINTCOPIESFLAG:
1804 str = _("The option for specifying the number of copies to print.");
1807 case RC_PRINTCOLLCOPIESFLAG:
1808 str = _("The option for specifying whether the copies should be collated.");
1811 case RC_PRINTREVERSEFLAG:
1812 str = _("The option to reverse the order of the pages printed.");
1815 case RC_PRINTLANDSCAPEFLAG:
1816 str = _("The option to print out in landscape.");
1819 case RC_PRINTPAPERFLAG:
1820 str = _("The option to specify paper type.");
1823 case RC_PRINTPAPERDIMENSIONFLAG:
1824 str = _("Option to specify the dimensions of the print paper.");
1827 case RC_PRINTTOPRINTER:
1828 str = _("Option to pass to the print program to print on a specific printer.");
1831 case RC_PRINT_ADAPTOUTPUT:
1832 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1835 case RC_PRINTTOFILE:
1836 str = _("Option to pass to the print program to print to a file.");
1839 case RC_PRINTFILEEXTENSION:
1840 str = _("Extension of printer program output file. Usually \".ps\".");
1843 case RC_PRINTEXSTRAOPTIONS:
1844 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1847 case RC_PRINTSPOOL_COMMAND:
1848 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.");
1851 case RC_PRINTSPOOL_PRINTERPREFIX:
1852 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.");
1856 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1859 case RC_SCREEN_ZOOM:
1860 //xgettext:no-c-format
1861 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1864 case RC_SCREEN_FONT_SIZES:
1865 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1868 case RC_SCREEN_FONT_ROMAN:
1869 case RC_SCREEN_FONT_SANS:
1870 case RC_SCREEN_FONT_TYPEWRITER:
1871 str = _("The screen fonts used to display the text while editing.");
1874 case RC_POPUP_BOLD_FONT:
1875 str = _("The bold font in the dialogs.");
1878 case RC_POPUP_NORMAL_FONT:
1879 str = _("The normal font in the dialogs.");
1882 case RC_SCREEN_FONT_ENCODING:
1883 str = _("The encoding for the screen fonts.");
1886 case RC_POPUP_FONT_ENCODING:
1887 str = _("The encoding for the menu/popups fonts.");
1894 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1897 case RC_DOCUMENTPATH:
1898 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1901 case RC_TEMPLATEPATH:
1902 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1905 case RC_TEMPDIRPATH:
1906 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1910 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1914 str = _("The file where the last-files information should be stored.");
1917 case RC_AUTOREGIONDELETE:
1918 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1921 case RC_AUTORESET_OPTIONS:
1922 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1926 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1930 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1934 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1938 case RC_KBMAP_PRIMARY:
1939 case RC_KBMAP_SECONDARY:
1940 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.");
1943 case RC_ASCIIROFF_COMMAND:
1944 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.");
1947 case RC_ASCII_LINELEN:
1948 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1951 case RC_NUMLASTFILES:
1952 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1955 case RC_CHECKLASTFILES:
1956 str = _("Select to check whether the lastfiles still exist.");
1959 case RC_VIEWDVI_PAPEROPTION:
1960 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1963 case RC_DEFAULT_PAPERSIZE:
1964 str = _("Specify the default paper size.");
1970 case RC_ACCEPT_COMPOUND:
1971 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1974 case RC_SPELL_COMMAND:
1975 str = _("What command runs the spell checker?");
1978 case RC_USE_INP_ENC:
1979 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.");
1982 case RC_USE_ALT_LANG:
1984 str = _("Specify an alternate language. The default is to use the language of the document.");
1987 case RC_USE_PERS_DICT:
1989 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1992 case RC_USE_ESC_CHARS:
1994 str = _("Specify additional chars that can be part of a word.");
1997 case RC_SCREEN_FONT_SCALABLE:
1998 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.");
2001 case RC_CHKTEX_COMMAND:
2002 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2005 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2006 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.");
2009 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2010 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2013 case RC_DISPLAY_GRAPHICS:
2014 str = _("Select how LyX will display any graphics.");
2017 case RC_MAKE_BACKUP:
2018 str = _("De-select if you don't want LyX to create backup files.");
2021 case RC_BACKUPDIR_PATH:
2022 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.");
2025 case RC_RTL_SUPPORT:
2026 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2029 case RC_MARK_FOREIGN_LANGUAGE:
2030 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2033 case RC_LANGUAGE_PACKAGE:
2034 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2037 case RC_LANGUAGE_GLOBAL_OPTIONS:
2038 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2041 case RC_LANGUAGE_USE_BABEL:
2042 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2045 case RC_LANGUAGE_AUTO_BEGIN:
2046 str = _("Select if a language switching command is needed at the beginning of the document.");
2049 case RC_LANGUAGE_AUTO_END:
2050 str = _("Select if a language switching command is needed at the end of the document.");
2053 case RC_LANGUAGE_COMMAND_BEGIN:
2054 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.");
2057 case RC_LANGUAGE_COMMAND_END:
2058 str = _("The LaTeX command for changing back to the language of the document.");
2061 case RC_LANGUAGE_COMMAND_LOCAL:
2062 str = _("The LaTeX command for local changing of the language.");
2065 case RC_DATE_INSERT_FORMAT:
2066 //xgettext:no-c-format
2067 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2070 case RC_SHOW_BANNER:
2071 str = _("De-select if you don't want the startup banner.");
2075 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2087 case RC_DEFAULT_LANGUAGE:
2088 str = _("New documents will be assigned this language.");
2091 case RC_LABEL_INIT_LENGTH:
2092 str = _("Maximum number of words in the initialization string for a new label");
2096 str = _("Shows a typeset preview of things such as math");
2099 case RC_PREVIEW_HASHED_LABELS:
2100 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2103 case RC_PREVIEW_SCALE_FACTOR:
2104 str = _("Scale the preview size to suit.");
2114 // The global instance
2117 // The global copy of the system lyxrc entries (everything except preferences)