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/tostr.h"
32 #include "support/filetools.h"
33 #include "support/lstrings.h"
34 #include "support/userinfo.h"
35 #include "support/translator.h"
37 using namespace lyx::support;
47 /// The translator between the DisplayType and the corresponding lyx string.
48 extern Translator<DisplayType, string> displayTranslator;
54 // when adding something to this array keep it sorted!
55 keyword_item lyxrcTags[] = {
56 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
57 { "\\alternate_language", LyXRC::RC_ALT_LANG },
58 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
59 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
60 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
61 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
62 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
63 { "\\autosave", LyXRC::RC_AUTOSAVE },
64 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
65 { "\\bind_file", LyXRC::RC_BINDFILE },
66 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
67 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
68 { "\\converter", LyXRC::RC_CONVERTER },
69 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
70 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
71 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
72 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
73 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
74 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
75 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
76 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
77 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
78 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
79 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
80 { "\\format", LyXRC::RC_FORMAT },
81 { "\\input", LyXRC::RC_INPUT },
82 { "\\kbmap", LyXRC::RC_KBMAP },
83 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
84 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
85 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
86 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
87 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
88 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
89 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
90 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
91 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
92 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
93 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
94 { "\\lastfiles", LyXRC::RC_LASTFILES },
95 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
96 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
97 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
98 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
99 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
100 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
101 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
102 { "\\preview", LyXRC::RC_PREVIEW },
103 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
104 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
105 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
106 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
107 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
108 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
109 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
110 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
111 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
112 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
113 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
114 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
115 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
116 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
117 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
118 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
119 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
120 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
121 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
122 { "\\printer", LyXRC::RC_PRINTER },
123 { "\\ps_command", LyXRC::RC_PS_COMMAND },
124 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
125 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
126 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
127 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
128 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
129 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
130 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
131 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
132 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
133 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
134 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
135 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
136 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
137 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
138 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
139 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
140 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
141 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
142 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
143 { "\\set_color", LyXRC::RC_SET_COLOR },
144 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
145 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
146 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
147 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
148 { "\\ui_file", LyXRC::RC_UIFILE },
149 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
150 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
151 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
152 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
153 // compatibility with versions older than 1.4.0 only
154 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
155 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
156 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
157 { "\\user_email", LyXRC::RC_USER_EMAIL },
158 { "\\user_name", LyXRC::RC_USER_NAME },
159 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
160 { "\\viewer" ,LyXRC::RC_VIEWER},
161 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
164 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
175 void LyXRC::setDefaults() {
178 // Get printer from the environment. If fail, use default "",
179 // assuming that everything is set up correctly.
180 printer = GetEnv("PRINTER");
181 print_adapt_output = false;
182 print_command = "dvips";
183 print_evenpage_flag = "-B";
184 print_oddpage_flag = "-A";
185 print_pagerange_flag = "-pp";
186 print_copies_flag = "-c";
187 print_collcopies_flag = "-C";
188 print_reverse_flag = "-r";
189 print_landscape_flag = "-t landscape";
190 print_to_printer = "-P";
191 print_to_file = "-o ";
192 print_file_extension = ".ps";
193 print_paper_flag = "-t";
194 print_paper_dimension_flag = "-T";
195 document_path.erase();
196 tempdir_path = "/tmp";
199 view_dvi_paper_option.erase();
200 default_papersize = PAPER_USLETTER;
201 custom_export_format = "ps";
202 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
205 // Because a screen typically is wider than a piece of paper:
208 // Default LaTeX font size:
209 font_sizes[LyXFont::SIZE_TINY] = 5.0;
210 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
211 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
212 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
213 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
214 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
215 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
216 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
217 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
218 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
219 use_scalable_fonts = true;
220 roman_font_name = "";
222 typewriter_font_name = "";
223 popup_bold_font = "-*-helvetica-bold-r";
224 popup_normal_font = "-*-helvetica-medium-r";
225 font_norm = "iso8859-1";
226 font_norm_type = ISO_8859_1;
227 popup_font_encoding.erase();
229 auto_region_delete = true;
230 auto_reset_options = false;
233 check_lastfiles = true;
235 backupdir_path.erase();
236 display_graphics = lyx::graphics::ColorDisplay;
237 // Spellchecker settings:
238 use_spell_lib = true;
239 isp_command = "ispell";
240 isp_accept_compound = false;
241 isp_use_input_encoding = false;
242 isp_use_alt_lang = false;
243 isp_use_pers_dict = false;
244 isp_use_esc_chars = false;
248 mark_foreign_language = true;
249 language_auto_begin = true;
250 language_auto_end = true;
251 language_global_options = true;
252 language_use_babel = true;
253 language_package = "\\usepackage{babel}";
254 language_command_begin = "\\selectlanguage{$$lang}";
255 language_command_local = "\\foreignlanguage{$$lang}{";
256 default_language = "english";
260 date_insert_format = "%A, %e %B %Y";
261 cursor_follows_scrollbar = false;
262 dialogs_iconify_with_main = false;
263 label_init_length = 3;
265 preview_hashed_labels = false;
266 preview_scale_factor = 0.9;
268 user_name = lyx::support::user_name();
270 user_email = lyx::support::user_email();
272 if (user_email.empty())
273 user_email = _("email address unknown");
279 void oldFontFormat(string & family, string & foundry)
281 if (family.empty() || family[0] != '-')
283 foundry = token(family, '-', 1);
284 family = token(family, '-', 2);
292 int LyXRC::read(string const & filename)
294 LyXLex lexrc(lyxrcTags, lyxrcCount);
295 if (lyxerr.debugging(Debug::PARSER))
296 lexrc.printTable(lyxerr);
298 lexrc.setFile(filename);
299 if (!lexrc.isOK()) return -2;
301 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
303 while (lexrc.isOK()) {
304 // By using two switches we take advantage of the compiler
305 // telling us if we have missed a LyXRCTags element in
306 // the second switch.
307 // Note that this also shows a problem with LyXLex since it
308 // helps us avoid taking advantage of the strictness of the
311 int le = lexrc.lex();
313 case LyXLex::LEX_UNDEF:
314 lexrc.printError("Unknown tag `$$Token'");
316 case LyXLex::LEX_FEOF:
320 switch (static_cast<LyXRCTags>(le)) {
321 case RC_INPUT: // Include file
324 LibFileSearch(string(),
327 lexrc.printError("Error reading "
328 "included file: "+tmp);
332 case RC_BINDFILE: // RVDK_PATCH_5
334 bind_file = lexrc.getString();
340 ui_file = lexrc.getString();
344 case RC_AUTORESET_OPTIONS:
346 auto_reset_options = lexrc.getBool();
350 case RC_DISPLAY_GRAPHICS:
352 display_graphics = lyx::graphics::displayTranslator.find(lexrc.getString());
358 use_kbmap = lexrc.getBool();
362 case RC_KBMAP_PRIMARY:
364 string const kmap(lexrc.getString());
367 } else if (!LibFileSearch("kbd", kmap,
369 primary_kbmap = kmap;
371 lexrc.printError("LyX: Keymap `$$Token' not found");
376 case RC_KBMAP_SECONDARY:
378 string const kmap(lexrc.getString());
381 } else if (!LibFileSearch("kbd", kmap,
383 secondary_kbmap = kmap;
385 lexrc.printError("LyX: Keymap `$$Token' not found");
390 case RC_FONT_ENCODING:
392 fontenc = lexrc.getString();
398 printer = lexrc.getString();
402 case RC_PRINT_COMMAND:
404 print_command = lexrc.getString();
408 case RC_PRINTEVENPAGEFLAG:
410 print_evenpage_flag = lexrc.getString();
414 case RC_PRINTODDPAGEFLAG:
416 print_oddpage_flag = lexrc.getString();
420 case RC_PRINTPAGERANGEFLAG:
422 print_pagerange_flag = lexrc.getString();
426 case RC_PRINTCOPIESFLAG:
428 print_copies_flag = lexrc.getString();
432 case RC_PRINTCOLLCOPIESFLAG:
434 print_collcopies_flag = lexrc.getString();
438 case RC_PRINTREVERSEFLAG:
440 print_reverse_flag = lexrc.getString();
444 case RC_PRINTLANDSCAPEFLAG:
446 print_landscape_flag = lexrc.getString();
450 case RC_PRINTTOPRINTER:
452 print_to_printer = lexrc.getString();
456 case RC_PRINT_ADAPTOUTPUT:
458 print_adapt_output = lexrc.getBool();
464 print_to_file = lexrc.getString();
468 case RC_PRINTFILEEXTENSION:
470 print_file_extension = lexrc.getString();
474 case RC_PRINTEXSTRAOPTIONS:
476 print_extra_options = lexrc.getString();
480 case RC_PRINTSPOOL_COMMAND:
482 print_spool_command = lexrc.getString();
486 case RC_PRINTSPOOL_PRINTERPREFIX:
488 print_spool_printerprefix = lexrc.getString();
492 case RC_PRINTPAPERDIMENSIONFLAG:
494 print_paper_dimension_flag = lexrc.getString();
498 case RC_PRINTPAPERFLAG:
500 print_paper_flag = lexrc.getString();
504 case RC_CUSTOM_EXPORT_COMMAND:
506 custom_export_command = lexrc.getString();
510 case RC_CUSTOM_EXPORT_FORMAT:
512 custom_export_format = lexrc.getString();
516 case RC_DEFAULT_PAPERSIZE:
519 ascii_lowercase(lexrc.getString());
520 if (size == "usletter")
523 else if (size == "legal")
526 else if (size == "executive")
528 PAPER_EXECUTIVEPAPER;
529 else if (size == "a3")
532 else if (size == "a4")
535 else if (size == "a5")
538 else if (size == "b5")
544 case RC_VIEWDVI_PAPEROPTION:
546 view_dvi_paper_option = lexrc.getString();
548 view_dvi_paper_option.erase();
554 ps_command = lexrc.getString();
558 case RC_CHKTEX_COMMAND:
560 chktex_command = lexrc.getString();
566 dpi = lexrc.getInteger();
572 zoom = lexrc.getInteger();
578 wheel_jump = lexrc.getInteger();
582 case RC_SCREEN_FONT_SIZES:
584 font_sizes[LyXFont::SIZE_TINY] =
588 font_sizes[LyXFont::SIZE_SCRIPT] =
592 font_sizes[LyXFont::SIZE_FOOTNOTE] =
596 font_sizes[LyXFont::SIZE_SMALL] =
600 font_sizes[LyXFont::SIZE_NORMAL] =
604 font_sizes[LyXFont::SIZE_LARGE] =
608 font_sizes[LyXFont::SIZE_LARGER] =
612 font_sizes[LyXFont::SIZE_LARGEST] =
616 font_sizes[LyXFont::SIZE_HUGE] =
620 font_sizes[LyXFont::SIZE_HUGER] =
625 case RC_SCREEN_FONT_SCALABLE:
627 use_scalable_fonts = lexrc.getBool();
633 autosave = lexrc.getInteger();
637 case RC_DOCUMENTPATH:
639 document_path = ExpandPath(lexrc.getString());
643 case RC_TEMPLATEPATH:
645 template_path = ExpandPath(lexrc.getString());
651 tempdir_path = ExpandPath(lexrc.getString());
657 use_tempdir = lexrc.getBool();
663 lastfiles = ExpandPath(lexrc.getString());
667 case RC_NUMLASTFILES:
669 num_lastfiles = lexrc.getInteger();
673 case RC_CHECKLASTFILES:
675 check_lastfiles = lexrc.getBool();
679 case RC_SCREEN_FONT_ROMAN:
681 roman_font_name = lexrc.getString();
682 oldFontFormat(roman_font_name,
687 case RC_SCREEN_FONT_SANS:
689 sans_font_name = lexrc.getString();
690 oldFontFormat(sans_font_name, sans_font_foundry);
694 case RC_SCREEN_FONT_TYPEWRITER:
696 typewriter_font_name = lexrc.getString();
697 oldFontFormat(typewriter_font_name,
698 typewriter_font_foundry);
702 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
704 roman_font_foundry = lexrc.getString();
708 case RC_SCREEN_FONT_SANS_FOUNDRY:
710 sans_font_foundry = lexrc.getString();
714 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
716 typewriter_font_foundry = lexrc.getString();
720 case RC_SCREEN_FONT_ENCODING:
722 font_norm = lexrc.getString();
723 set_font_norm_type();
727 case RC_POPUP_BOLD_FONT:
729 popup_bold_font = lexrc.getString();
733 case RC_POPUP_NORMAL_FONT:
735 popup_normal_font = lexrc.getString();
739 case RC_POPUP_FONT_ENCODING:
741 popup_font_encoding = lexrc.getString();
747 string lyx_name, x11_name;
750 lyx_name = lexrc.getString();
752 lexrc.printError("Missing color tag.");
757 x11_name = lexrc.getString();
759 lexrc.printError("Missing color name for color: `$$Token'");
763 if (!lcolor.setColor(lyx_name, x11_name)) {
764 lyxerr << "Bad lyxrc set_color for "
770 case RC_AUTOREGIONDELETE:
771 // Auto region delete defaults to true
773 auto_region_delete = lexrc.getBool();
779 lyxpipes = ExpandPath(lexrc.getString());
783 case RC_CURSOR_FOLLOWS_SCROLLBAR:
785 cursor_follows_scrollbar = lexrc.getBool();
789 case RC_DIALOGS_ICONIFY_WITH_MAIN:
791 dialogs_iconify_with_main = lexrc.getBool();
795 case RC_ASCIIROFF_COMMAND:
797 ascii_roff_command = lexrc.getString();
800 case RC_ASCII_LINELEN:
802 ascii_linelen = lexrc.getInteger();
805 // Spellchecker settings:
806 case RC_USE_SPELL_LIB:
808 use_spell_lib = lexrc.getBool();
811 case RC_SPELL_COMMAND:
813 isp_command = lexrc.getString();
816 case RC_ACCEPT_COMPOUND:
818 isp_accept_compound = lexrc.getBool();
823 isp_use_input_encoding = lexrc.getBool();
826 case RC_USE_ALT_LANG:
828 isp_use_alt_lang = lexrc.getBool();
831 case RC_USE_PERS_DICT:
833 isp_use_pers_dict = lexrc.getBool();
836 case RC_USE_ESC_CHARS:
838 isp_use_esc_chars = lexrc.getBool();
843 isp_alt_lang = lexrc.getString();
848 isp_pers_dict = lexrc.getString();
853 isp_esc_chars = lexrc.getString();
858 make_backup = lexrc.getBool();
861 case RC_BACKUPDIR_PATH:
863 backupdir_path = ExpandPath(lexrc.getString());
866 case RC_DATE_INSERT_FORMAT:
868 date_insert_format = lexrc.getString();
871 case RC_LANGUAGE_PACKAGE:
873 language_package = lexrc.getString();
876 case RC_LANGUAGE_AUTO_BEGIN:
878 language_auto_begin = lexrc.getBool();
881 case RC_LANGUAGE_AUTO_END:
883 language_auto_end = lexrc.getBool();
886 case RC_LANGUAGE_GLOBAL_OPTIONS:
888 language_global_options = lexrc.getBool();
891 case RC_LANGUAGE_USE_BABEL:
893 language_use_babel = lexrc.getBool();
896 case RC_LANGUAGE_COMMAND_BEGIN:
898 language_command_begin = lexrc.getString();
901 case RC_LANGUAGE_COMMAND_END:
903 language_command_end = lexrc.getString();
906 case RC_LANGUAGE_COMMAND_LOCAL:
908 language_command_local = lexrc.getString();
913 rtl_support = lexrc.getBool();
918 auto_number = lexrc.getBool();
921 case RC_MARK_FOREIGN_LANGUAGE:
923 mark_foreign_language = lexrc.getBool();
928 string from, to, command, flags;
930 from = lexrc.getString();
933 to = lexrc.getString();
936 command = lexrc.getString();
939 flags = lexrc.getString();
942 || token(command, ' ', 0) == "none") {
943 converters.erase(from, to);
945 converters.add(from, to, command, flags);
950 string format, command;
952 format = lexrc.getString();
955 command = lexrc.getString();
956 if (token(command, ' ', 0) == "none")
959 formats.setViewer(format, command);
963 string format, extension, prettyname, shortcut;
965 format = lexrc.getString();
968 extension = lexrc.getString();
971 prettyname = lexrc.getString();
974 shortcut = lexrc.getString();
976 if (prettyname.empty()) {
977 if (converters.formatIsUsed(format)) {
978 lyxerr << "Can't delete format "
981 formats.erase(format);
984 formats.add(format, extension, prettyname,
989 case RC_DEFAULT_LANGUAGE:
991 default_language = lexrc.getString();
995 case RC_LABEL_INIT_LENGTH:
997 label_init_length = lexrc.getInteger();
1001 case RC_SHOW_BANNER:
1003 show_banner = lexrc.getBool();
1009 preview = lexrc.getBool();
1013 case RC_PREVIEW_HASHED_LABELS:
1015 preview_hashed_labels = lexrc.getBool();
1019 case RC_PREVIEW_SCALE_FACTOR:
1021 preview_scale_factor = lexrc.getFloat();
1027 user_name = lexrc.getString();
1032 user_email = lexrc.getString();
1035 case RC_LAST: break; // this is just a dummy
1039 /// Update converters data-structures
1040 converters.update(formats);
1041 converters.buildGraph();
1047 void LyXRC::write(string const & filename) const
1049 ofstream ofs(filename.c_str());
1055 void LyXRC::print() const
1057 if (lyxerr.debugging())
1064 void LyXRC::output(ostream & os) const
1066 os << "### This file is part of\n"
1067 << "### ========================================================\n"
1068 << "### LyX, The Document Processor\n"
1070 << "### Copyright 1995 Matthias Ettrich\n"
1071 << "### Copyright 1995-2001 The LyX Team.\n"
1073 << "### ========================================================\n"
1075 << "# This file is written by LyX, if you want to make your own\n"
1076 << "# modifications you should do them from inside LyX and save\n"
1079 // Why the switch you might ask. It is a trick to ensure that all
1080 // the elements in the LyXRCTags enum is handled. As you can see
1081 // there are no breaks at all. So it is just a huge fall-through.
1082 // The nice thing is that we will get a warning from the compiler
1083 // if we forget an element.
1084 LyXRCTags tag = RC_LAST;
1088 // input/include files are not done here
1090 if (bind_file != system_lyxrc.bind_file) {
1091 os << "\\bind_file " << bind_file << "\n";
1097 << "# MISC SECTION ######################################\n"
1100 // bind files are not done here.
1102 if (ui_file != system_lyxrc.ui_file) {
1103 os << "\\ui_file \"" << ui_file << "\"\n";
1105 case RC_AUTOREGIONDELETE:
1106 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1107 os << "# Set to false to inhibit automatic replacement of\n"
1108 << "# the current selection.\n"
1109 << "\\auto_region_delete " << tostr(auto_region_delete)
1112 case RC_AUTORESET_OPTIONS:
1113 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1114 os << "# Set to false to inhibit automatic reset of\n"
1115 << "# the class options to defaults on class change.\n"
1116 << "\\auto_reset_options " << tostr(auto_reset_options)
1120 if (autosave != system_lyxrc.autosave) {
1121 os << "# The time interval between auto-saves in seconds.\n"
1122 << "\\autosave " << autosave << '\n';
1124 case RC_DISPLAY_GRAPHICS:
1125 if (display_graphics != system_lyxrc.display_graphics) {
1126 os << "# Display graphics within LyX\n"
1127 << "# monochrome|grayscale|color|none\n"
1128 << "\\display_graphics "
1129 << lyx::graphics::displayTranslator.find(display_graphics)
1133 case RC_VIEWDVI_PAPEROPTION:
1134 if (view_dvi_paper_option
1135 != system_lyxrc.view_dvi_paper_option) {
1136 os << "# Options used to specify paper size to the\n"
1137 << "# view_dvi_command (e.g. -paper)\n"
1138 << "\\view_dvi_paper_option \""
1139 << view_dvi_paper_option << "\"\n";
1141 case RC_DEFAULT_PAPERSIZE:
1142 if (default_papersize != system_lyxrc.default_papersize) {
1143 os << "# The default papersize to use.\n"
1144 << "\\default_papersize \"";
1145 switch (default_papersize) {
1146 case PAPER_USLETTER:
1147 os << "usletter"; break;
1148 case PAPER_LEGALPAPER:
1149 os << "legal"; break;
1150 case PAPER_EXECUTIVEPAPER:
1151 os << "executive"; break;
1160 case PAPER_DEFAULT: break;
1165 if (ps_command != system_lyxrc.ps_command) {
1166 os << "# Program used for interpreting postscript.\n"
1167 << "\\ps_command \"" << ps_command << "\"\n";
1169 case RC_CHKTEX_COMMAND:
1170 if (chktex_command != system_lyxrc.chktex_command) {
1171 os << "\\chktex_command \"" << chktex_command << "\"\n";
1174 if (use_kbmap != system_lyxrc.use_kbmap) {
1175 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1177 case RC_KBMAP_PRIMARY:
1178 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1179 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1181 case RC_KBMAP_SECONDARY:
1182 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1183 os << "\\kbmap_secondary \"" << secondary_kbmap
1187 if (lyxpipes != system_lyxrc.lyxpipes) {
1188 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1190 case RC_DATE_INSERT_FORMAT:
1191 if (date_insert_format != system_lyxrc.date_insert_format) {
1192 os << "\\date_insert_format \"" << date_insert_format
1195 case RC_LABEL_INIT_LENGTH:
1196 if (label_init_length != system_lyxrc.label_init_length) {
1197 os << "\\label_init_length " << label_init_length
1202 os << "\\user_name \"" << user_name << "\"\n";
1205 os << "\\user_email \"" << user_email << "\"\n";
1207 case RC_SHOW_BANNER:
1208 if (show_banner != system_lyxrc.show_banner) {
1209 os << "\\show_banner " << tostr(show_banner) << '\n';
1213 if (preview != system_lyxrc.preview) {
1214 os << "\\preview " << tostr(preview) << '\n';
1217 case RC_PREVIEW_HASHED_LABELS:
1218 if (preview_hashed_labels !=
1219 system_lyxrc.preview_hashed_labels) {
1220 os << "\\preview_hashed_labels "
1221 << tostr(preview_hashed_labels) << '\n';
1224 case RC_PREVIEW_SCALE_FACTOR:
1225 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1226 os << "\\preview_scale_factor "
1227 << preview_scale_factor << '\n';
1231 << "# SCREEN & FONTS SECTION ############################\n"
1234 case RC_POPUP_NORMAL_FONT:
1235 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1236 os << "\\popup_normal_font \"" << popup_normal_font
1239 case RC_POPUP_BOLD_FONT:
1240 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1241 os << "\\popup_bold_font \"" << popup_bold_font
1244 case RC_POPUP_FONT_ENCODING:
1245 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1246 os << "\\popup_font_encoding \"" << popup_font_encoding
1250 if (dpi != system_lyxrc.dpi) {
1251 os << "\\screen_dpi " << dpi << '\n';
1253 case RC_SCREEN_ZOOM:
1254 if (zoom != system_lyxrc.zoom) {
1255 os << "\\screen_zoom " << zoom << '\n';
1258 if (wheel_jump != system_lyxrc.wheel_jump) {
1259 os << "\\wheel_jump " << wheel_jump << '\n';
1261 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1262 if (cursor_follows_scrollbar
1263 != system_lyxrc.cursor_follows_scrollbar) {
1264 os << "\\cursor_follows_scrollbar "
1265 << tostr(cursor_follows_scrollbar) << '\n';
1267 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1268 if (dialogs_iconify_with_main
1269 != system_lyxrc.dialogs_iconify_with_main) {
1270 os << "\\dialogs_iconify_with_main "
1271 << tostr(dialogs_iconify_with_main) << '\n';
1273 case RC_SCREEN_FONT_ROMAN:
1274 if (roman_font_name != system_lyxrc.roman_font_name) {
1275 os << "\\screen_font_roman \"" << roman_font_name
1278 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1279 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1280 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1283 case RC_SCREEN_FONT_SANS:
1284 if (sans_font_name != system_lyxrc.sans_font_name) {
1285 os << "\\screen_font_sans \"" << sans_font_name
1288 case RC_SCREEN_FONT_SANS_FOUNDRY:
1289 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1290 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1293 case RC_SCREEN_FONT_TYPEWRITER:
1294 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1295 os << "\\screen_font_typewriter \""
1296 << typewriter_font_name << "\"\n";
1298 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1299 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1300 os << "\\screen_font_typewriter_foundry \""
1301 << typewriter_font_foundry << "\"\n";
1304 case RC_SCREEN_FONT_SCALABLE:
1305 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1306 os << "\\screen_font_scalable "
1307 << tostr(use_scalable_fonts)
1310 case RC_SCREEN_FONT_ENCODING:
1311 if (font_norm != system_lyxrc.font_norm) {
1312 os << "\\screen_font_encoding \"" << font_norm
1315 case RC_SCREEN_FONT_SIZES:
1316 if (font_sizes[LyXFont::SIZE_TINY]
1317 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1318 font_sizes[LyXFont::SIZE_SCRIPT]
1319 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1320 font_sizes[LyXFont::SIZE_FOOTNOTE]
1321 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1322 font_sizes[LyXFont::SIZE_SMALL]
1323 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1324 font_sizes[LyXFont::SIZE_NORMAL]
1325 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1326 font_sizes[LyXFont::SIZE_LARGE]
1327 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1328 font_sizes[LyXFont::SIZE_LARGER]
1329 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1330 font_sizes[LyXFont::SIZE_LARGEST]
1331 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1332 font_sizes[LyXFont::SIZE_HUGE]
1333 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1334 font_sizes[LyXFont::SIZE_HUGER]
1335 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1336 os.setf(ios::fixed);
1338 os << "\\screen_font_sizes"
1339 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1340 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1341 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1342 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1343 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1344 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1345 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1346 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1347 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1348 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1353 << "# COLOR SECTION ###################################\n"
1357 for (int i = 0; i < LColor::ignore; ++i) {
1358 LColor::color lc = static_cast<LColor::color>(i);
1360 string const col(lcolor.getX11Name(lc));
1361 if (col != system_lcolor.getX11Name(lc)) {
1362 os << "\\set_color \""
1363 << lcolor.getLyXName(lc) << "\" \""
1369 << "# PRINTER SECTION ###################################\n"
1373 if (printer != system_lyxrc.printer) {
1374 os << "\\printer \"" << printer << "\"\n";
1376 case RC_PRINT_ADAPTOUTPUT:
1377 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1378 os << "\\print_adapt_output "
1379 << tostr(print_adapt_output)
1382 case RC_PRINT_COMMAND:
1383 if (print_command != system_lyxrc.print_command) {
1384 os << "\\print_command \"" << print_command << "\"\n";
1386 case RC_PRINTEXSTRAOPTIONS:
1387 if (print_extra_options != system_lyxrc.print_extra_options) {
1388 os << "\\print_extra_options \"" << print_extra_options
1391 case RC_PRINTSPOOL_COMMAND:
1392 if (print_spool_command != system_lyxrc.print_spool_command) {
1393 os << "\\print_spool_command \"" << print_spool_command
1396 case RC_PRINTSPOOL_PRINTERPREFIX:
1397 if (print_spool_printerprefix
1398 != system_lyxrc.print_spool_printerprefix) {
1399 os << "\\print_spool_printerprefix \""
1400 << print_spool_printerprefix << "\"\n";
1402 case RC_PRINTEVENPAGEFLAG:
1403 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1404 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1407 case RC_PRINTODDPAGEFLAG:
1408 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1409 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1412 case RC_PRINTREVERSEFLAG:
1413 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1414 os << "\\print_reverse_flag \"" << print_reverse_flag
1417 case RC_PRINTLANDSCAPEFLAG:
1418 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1419 os << "\\print_landscape_flag \"" << print_landscape_flag
1422 case RC_PRINTPAGERANGEFLAG:
1423 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1424 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1427 case RC_PRINTCOPIESFLAG:
1428 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1429 os << "\\print_copies_flag \"" << print_copies_flag
1432 case RC_PRINTCOLLCOPIESFLAG:
1433 if (print_collcopies_flag
1434 != system_lyxrc.print_collcopies_flag) {
1435 os << "\\print_collcopies_flag \""
1436 << print_collcopies_flag
1439 case RC_PRINTPAPERFLAG:
1440 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1441 os << "\\print_paper_flag \"" << print_paper_flag
1444 case RC_PRINTPAPERDIMENSIONFLAG:
1445 if (print_paper_dimension_flag
1446 != system_lyxrc.print_paper_dimension_flag) {
1447 os << "\\print_paper_dimension_flag \""
1448 << print_paper_dimension_flag << "\"\n";
1450 case RC_PRINTTOPRINTER:
1451 if (print_to_printer != system_lyxrc.print_to_printer) {
1452 os << "\\print_to_printer \"" << print_to_printer
1455 case RC_PRINTTOFILE:
1456 if (print_to_file != system_lyxrc.print_to_file) {
1457 os << "\\print_to_file \"" << print_to_file << "\"\n";
1459 case RC_PRINTFILEEXTENSION:
1460 if (print_file_extension != system_lyxrc.print_file_extension) {
1461 os << "\\print_file_extension \""
1462 << print_file_extension
1467 << "# EXPORT SECTION ####################################\n"
1470 case RC_CUSTOM_EXPORT_COMMAND:
1471 if (custom_export_command
1472 != system_lyxrc.custom_export_command) {
1473 os << "\\custom_export_command \""
1474 << custom_export_command
1477 case RC_CUSTOM_EXPORT_FORMAT:
1478 if (custom_export_format
1479 != system_lyxrc.custom_export_format) {
1480 os << "\\custom_export_format \"" << custom_export_format
1485 << "# TEX SECTION #######################################\n"
1488 case RC_FONT_ENCODING:
1489 if (fontenc != system_lyxrc.fontenc) {
1490 os << "\\font_encoding \"" << fontenc << "\"\n";
1494 << "# FILE SECTION ######################################\n"
1497 case RC_DOCUMENTPATH:
1498 if (document_path != system_lyxrc.document_path) {
1499 os << "\\document_path \"" << document_path << "\"\n";
1502 if (lastfiles != system_lyxrc.lastfiles) {
1503 os << "\\lastfiles \"" << lastfiles << "\"\n";
1505 case RC_NUMLASTFILES:
1506 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1507 os << "\\num_lastfiles " << num_lastfiles << '\n';
1509 case RC_CHECKLASTFILES:
1510 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1511 os << "\\check_lastfiles " << tostr(check_lastfiles)
1514 case RC_TEMPLATEPATH:
1515 if (template_path != system_lyxrc.template_path) {
1516 os << "\\template_path \"" << template_path << "\"\n";
1518 case RC_TEMPDIRPATH:
1519 if (tempdir_path != system_lyxrc.tempdir_path) {
1520 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1523 if (use_tempdir != system_lyxrc.use_tempdir) {
1524 os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
1526 case RC_ASCII_LINELEN:
1527 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1528 os << "\\ascii_linelen " << ascii_linelen << '\n';
1530 case RC_MAKE_BACKUP:
1531 if (make_backup != system_lyxrc.make_backup) {
1532 os << "\\make_backup " << tostr(make_backup) << '\n';
1534 case RC_BACKUPDIR_PATH:
1535 if (backupdir_path != system_lyxrc.backupdir_path) {
1536 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1540 << "# ASCII EXPORT SECTION ##############################\n"
1543 case RC_ASCIIROFF_COMMAND:
1544 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1545 os << "\\ascii_roff_command \"" << ascii_roff_command
1550 << "# SPELLCHECKER SECTION ##############################\n"
1552 case RC_USE_SPELL_LIB:
1553 if (use_spell_lib != system_lyxrc.use_spell_lib) {
1554 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1556 case RC_SPELL_COMMAND:
1557 if (isp_command != system_lyxrc.isp_command) {
1558 os << "\\spell_command \"" << isp_command << "\"\n";
1560 case RC_ACCEPT_COMPOUND:
1561 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1562 os << "\\accept_compound " << tostr(isp_accept_compound)
1565 case RC_USE_ALT_LANG:
1566 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1567 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1571 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1572 os << "\\alternate_language \"" << isp_alt_lang
1575 case RC_USE_ESC_CHARS:
1576 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1577 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1581 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1582 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1584 case RC_USE_PERS_DICT:
1585 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1586 os << "\\use_personal_dictionary "
1587 << tostr(isp_use_pers_dict)
1591 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1592 os << "\\personal_dictionary \"" << isp_pers_dict
1595 case RC_USE_INP_ENC:
1596 if (isp_use_input_encoding
1597 != system_lyxrc.isp_use_input_encoding) {
1598 os << "\\use_input_encoding "
1599 << tostr(isp_use_input_encoding)
1604 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1607 case RC_RTL_SUPPORT:
1608 if (rtl_support != system_lyxrc.rtl_support) {
1609 os << "\\rtl " << tostr(rtl_support) << '\n';
1611 case RC_LANGUAGE_PACKAGE:
1612 if (language_package != system_lyxrc.language_package) {
1613 os << "\\language_package \"" << language_package
1616 case RC_LANGUAGE_GLOBAL_OPTIONS:
1617 if (language_global_options
1618 != system_lyxrc.language_global_options) {
1619 os << "\\language_global_options \""
1620 << tostr(language_global_options)
1623 case RC_LANGUAGE_USE_BABEL:
1624 if (language_use_babel != system_lyxrc.language_use_babel) {
1625 os << "\\language_use_babel \""
1626 << tostr(language_use_babel)
1629 case RC_LANGUAGE_COMMAND_BEGIN:
1630 if (language_command_begin
1631 != system_lyxrc.language_command_begin) {
1632 os << "\\language_command_begin \""
1633 << language_command_begin
1636 case RC_LANGUAGE_COMMAND_END:
1637 if (language_command_end
1638 != system_lyxrc.language_command_end) {
1639 os << "\\language_command_end \"" << language_command_end
1642 case RC_LANGUAGE_COMMAND_LOCAL:
1643 if (language_command_local
1644 != system_lyxrc.language_command_local) {
1645 os << "\\language_command_local \""
1646 << language_command_local
1649 case RC_LANGUAGE_AUTO_BEGIN:
1650 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1651 os << "\\language_auto_begin "
1652 << tostr(language_auto_begin) << '\n';
1654 case RC_LANGUAGE_AUTO_END:
1655 if (language_auto_end != system_lyxrc.language_auto_end) {
1656 os << "\\language_auto_end "
1657 << tostr(language_auto_end) << '\n';
1659 case RC_MARK_FOREIGN_LANGUAGE:
1660 if (mark_foreign_language
1661 != system_lyxrc.mark_foreign_language) {
1662 os << "\\mark_foreign_language " <<
1663 tostr(mark_foreign_language) << '\n';
1667 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1670 case RC_AUTO_NUMBER:
1671 if (auto_number != system_lyxrc.auto_number) {
1672 os << "\\auto_number " << tostr(auto_number) << '\n';
1674 case RC_DEFAULT_LANGUAGE:
1675 if (default_language != system_lyxrc.default_language) {
1676 os << "\\default_language " << default_language << '\n';
1680 << "# FORMATS SECTION ##########################\n"
1684 // Look for deleted formats
1685 for (Formats::const_iterator cit = formats.begin();
1686 cit != formats.end(); ++cit) {
1687 Format const * format =
1688 system_formats.getFormat(cit->name());
1690 format->extension() != cit->extension() ||
1691 format->prettyname() != cit->prettyname() ||
1692 format->shortcut() != cit->shortcut())
1693 os << "\\format \"" << cit->name() << "\" \""
1694 << cit->extension() << "\" \""
1695 << cit->prettyname() << "\" \""
1696 << cit->shortcut() << "\"\n";
1699 // New/modifed formats
1700 for (Formats::const_iterator cit = system_formats.begin();
1701 cit != system_formats.end(); ++cit)
1702 if (!formats.getFormat(cit->name()))
1703 os << "\\format \"" << cit->name()
1704 << "\" \"\" \"\" \"\"\n";
1706 for (Formats::const_iterator cit = formats.begin();
1707 cit != formats.end(); ++cit) {
1708 Format const * format =
1709 system_formats.getFormat(cit->name());
1710 if ((!format || format->viewer() != cit->viewer()) &&
1711 (format || !cit->viewer().empty()))
1712 os << "\\viewer \"" << cit->name() << "\" \""
1713 << cit->viewer() << "\"\n";
1717 << "# CONVERTERS SECTION ##########################\n"
1721 // Look for new converters
1722 for (Converters::const_iterator cit = converters.begin();
1723 cit != converters.end(); ++cit) {
1724 Converter const * converter =
1725 system_converters.getConverter(cit->from,
1728 converter->command != cit->command ||
1729 converter->flags != cit->flags)
1730 os << "\\converter \"" << cit->from << "\" \""
1731 << cit->to << "\" \""
1732 << cit->command << "\" \""
1733 << cit->flags << "\"\n";
1736 // New/modifed converters
1737 for (Converters::const_iterator cit = system_converters.begin();
1738 cit != system_converters.end(); ++cit)
1739 if (!converters.getConverter(cit->from, cit->to))
1740 os << "\\converter \"" << cit->from
1741 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1747 void LyXRC::set_font_norm_type()
1749 if (font_norm == "iso10646-1")
1750 font_norm_type = ISO_10646_1;
1751 else if (font_norm == "iso8859-1")
1752 font_norm_type = ISO_8859_1;
1753 else if (font_norm == "iso8859-3")
1754 font_norm_type = ISO_8859_3;
1755 else if (font_norm == "iso8859-4")
1756 font_norm_type = ISO_8859_4;
1757 else if (font_norm == "iso8859-6.8x")
1758 font_norm_type = ISO_8859_6_8;
1759 else if (font_norm == "iso8859-9")
1760 font_norm_type = ISO_8859_9;
1761 else if (font_norm == "iso8859-15")
1762 font_norm_type = ISO_8859_15;
1764 font_norm_type = OTHER_ENCODING;
1768 string const LyXRC::getDescription(LyXRCTags tag)
1773 case RC_FONT_ENCODING:
1774 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1778 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1781 case RC_PRINT_COMMAND:
1782 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1785 case RC_PRINTEVENPAGEFLAG:
1786 str = _("The option to print only even pages.");
1789 case RC_PRINTODDPAGEFLAG:
1790 str = _("The option to print only odd pages.");
1793 case RC_PRINTPAGERANGEFLAG:
1794 str = _("The option for specifying a comma-separated list of pages to print.");
1797 case RC_PRINTCOPIESFLAG:
1798 str = _("The option for specifying the number of copies to print.");
1801 case RC_PRINTCOLLCOPIESFLAG:
1802 str = _("The option for specifying whether the copies should be collated.");
1805 case RC_PRINTREVERSEFLAG:
1806 str = _("The option to reverse the order of the pages printed.");
1809 case RC_PRINTLANDSCAPEFLAG:
1810 str = _("The option to print out in landscape.");
1813 case RC_PRINTPAPERFLAG:
1814 str = _("The option to specify paper type.");
1817 case RC_PRINTPAPERDIMENSIONFLAG:
1818 str = _("Option to specify the dimensions of the print paper.");
1821 case RC_PRINTTOPRINTER:
1822 str = _("Option to pass to the print program to print on a specific printer.");
1825 case RC_PRINT_ADAPTOUTPUT:
1826 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1829 case RC_PRINTTOFILE:
1830 str = _("Option to pass to the print program to print to a file.");
1833 case RC_PRINTFILEEXTENSION:
1834 str = _("Extension of printer program output file. Usually \".ps\".");
1837 case RC_PRINTEXSTRAOPTIONS:
1838 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1841 case RC_PRINTSPOOL_COMMAND:
1842 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.");
1845 case RC_PRINTSPOOL_PRINTERPREFIX:
1846 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.");
1850 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1853 case RC_SCREEN_ZOOM:
1854 //xgettext:no-c-format
1855 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1858 case RC_SCREEN_FONT_SIZES:
1859 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1862 case RC_SCREEN_FONT_ROMAN:
1863 case RC_SCREEN_FONT_SANS:
1864 case RC_SCREEN_FONT_TYPEWRITER:
1865 str = _("The screen fonts used to display the text while editing.");
1868 case RC_POPUP_BOLD_FONT:
1869 str = _("The bold font in the dialogs.");
1872 case RC_POPUP_NORMAL_FONT:
1873 str = _("The normal font in the dialogs.");
1876 case RC_SCREEN_FONT_ENCODING:
1877 str = _("The encoding for the screen fonts.");
1880 case RC_POPUP_FONT_ENCODING:
1881 str = _("The encoding for the menu/popups fonts.");
1888 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1891 case RC_DOCUMENTPATH:
1892 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1895 case RC_TEMPLATEPATH:
1896 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1899 case RC_TEMPDIRPATH:
1900 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1904 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1908 str = _("The file where the last-files information should be stored.");
1911 case RC_AUTOREGIONDELETE:
1912 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1915 case RC_AUTORESET_OPTIONS:
1916 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1920 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1924 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1928 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1932 case RC_KBMAP_PRIMARY:
1933 case RC_KBMAP_SECONDARY:
1934 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.");
1937 case RC_ASCIIROFF_COMMAND:
1938 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.");
1941 case RC_ASCII_LINELEN:
1942 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1945 case RC_NUMLASTFILES:
1946 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1949 case RC_CHECKLASTFILES:
1950 str = _("Select to check whether the lastfiles still exist.");
1953 case RC_VIEWDVI_PAPEROPTION:
1954 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1957 case RC_DEFAULT_PAPERSIZE:
1958 str = _("Specify the default paper size.");
1964 case RC_ACCEPT_COMPOUND:
1965 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1968 case RC_SPELL_COMMAND:
1969 str = _("What command runs the spell checker?");
1972 case RC_USE_INP_ENC:
1973 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.");
1976 case RC_USE_ALT_LANG:
1978 str = _("Specify an alternate language. The default is to use the language of the document.");
1981 case RC_USE_PERS_DICT:
1983 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1986 case RC_USE_ESC_CHARS:
1988 str = _("Specify additional chars that can be part of a word.");
1991 case RC_SCREEN_FONT_SCALABLE:
1992 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.");
1995 case RC_CHKTEX_COMMAND:
1996 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1999 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2000 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.");
2003 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2004 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2007 case RC_DISPLAY_GRAPHICS:
2008 str = _("Select how LyX will display any graphics.");
2011 case RC_MAKE_BACKUP:
2012 str = _("De-select if you don't want LyX to create backup files.");
2015 case RC_BACKUPDIR_PATH:
2016 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.");
2019 case RC_RTL_SUPPORT:
2020 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2023 case RC_MARK_FOREIGN_LANGUAGE:
2024 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2027 case RC_LANGUAGE_PACKAGE:
2028 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2031 case RC_LANGUAGE_GLOBAL_OPTIONS:
2032 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2035 case RC_LANGUAGE_USE_BABEL:
2036 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2039 case RC_LANGUAGE_AUTO_BEGIN:
2040 str = _("Select if a language switching command is needed at the beginning of the document.");
2043 case RC_LANGUAGE_AUTO_END:
2044 str = _("Select if a language switching command is needed at the end of the document.");
2047 case RC_LANGUAGE_COMMAND_BEGIN:
2048 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.");
2051 case RC_LANGUAGE_COMMAND_END:
2052 str = _("The LaTeX command for changing back to the language of the document.");
2055 case RC_LANGUAGE_COMMAND_LOCAL:
2056 str = _("The LaTeX command for local changing of the language.");
2059 case RC_DATE_INSERT_FORMAT:
2060 //xgettext:no-c-format
2061 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2064 case RC_SHOW_BANNER:
2065 str = _("De-select if you don't want the startup banner.");
2069 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2081 case RC_DEFAULT_LANGUAGE:
2082 str = _("New documents will be assigned this language.");
2085 case RC_LABEL_INIT_LENGTH:
2086 str = _("Maximum number of words in the initialization string for a new label");
2090 str = _("Shows a typeset preview of things such as math");
2093 case RC_PREVIEW_HASHED_LABELS:
2094 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2097 case RC_PREVIEW_SCALE_FACTOR:
2098 str = _("Scale the preview size to suit.");
2108 // The global instance
2111 // The global copy of the system lyxrc entries (everything except preferences)