3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
14 * Full author contact details are available in file CREDITS.
25 #include "converter.h"
32 #include "graphics/GraphicsTypes.h"
34 #include "support/filetools.h"
35 #include "support/lstrings.h"
36 #include "support/tostr.h"
37 #include "support/userinfo.h"
39 using lyx::support::ascii_lowercase;
40 using lyx::support::ExpandPath;
41 using lyx::support::GetEnv;
42 using lyx::support::LibFileSearch;
43 using lyx::support::token;
56 // when adding something to this array keep it sorted!
57 keyword_item lyxrcTags[] = {
58 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
59 { "\\alternate_language", LyXRC::RC_ALT_LANG },
60 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
61 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
62 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
63 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
64 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
65 { "\\autosave", LyXRC::RC_AUTOSAVE },
66 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
67 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
68 { "\\bind_file", LyXRC::RC_BINDFILE },
69 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
70 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
71 { "\\converter", LyXRC::RC_CONVERTER },
72 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
73 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
74 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
75 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
76 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
77 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
78 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
79 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
80 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
81 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
82 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
83 { "\\format", LyXRC::RC_FORMAT },
84 { "\\input", LyXRC::RC_INPUT },
85 { "\\kbmap", LyXRC::RC_KBMAP },
86 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
87 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
88 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
89 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
90 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
91 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
92 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
93 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
94 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
95 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
96 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
97 { "\\lastfiles", LyXRC::RC_LASTFILES },
98 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
99 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
100 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
101 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
102 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
103 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
104 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
105 { "\\preview", LyXRC::RC_PREVIEW },
106 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
107 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
108 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
109 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
110 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
111 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
112 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
113 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
114 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
115 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
116 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
117 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
118 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
119 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
120 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
121 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
122 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
123 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
124 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
125 { "\\printer", LyXRC::RC_PRINTER },
126 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
127 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
128 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
129 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
130 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
131 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
132 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
133 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
134 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
135 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
136 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
137 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
138 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
139 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
140 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
141 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
142 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
143 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
144 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
145 { "\\set_color", LyXRC::RC_SET_COLOR },
146 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
147 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
148 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
149 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
150 { "\\ui_file", LyXRC::RC_UIFILE },
151 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
152 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
153 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
154 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
155 // compatibility with versions older than 1.4.0 only
156 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
157 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
158 // compatibility with versions older than 1.4.0 only
159 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
160 { "\\user_email", LyXRC::RC_USER_EMAIL },
161 { "\\user_name", LyXRC::RC_USER_NAME },
162 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
163 // compatibility with versions older than 1.4.0 only
164 { "\\viewer" ,LyXRC::RC_VIEWER},
165 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
168 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
179 void LyXRC::setDefaults() {
182 // Get printer from the environment. If fail, use default "",
183 // assuming that everything is set up correctly.
184 printer = GetEnv("PRINTER");
185 print_adapt_output = false;
186 print_command = "dvips";
187 print_evenpage_flag = "-B";
188 print_oddpage_flag = "-A";
189 print_pagerange_flag = "-pp";
190 print_copies_flag = "-c";
191 print_collcopies_flag = "-C";
192 print_reverse_flag = "-r";
193 print_landscape_flag = "-t landscape";
194 print_to_printer = "-P";
195 print_to_file = "-o ";
196 print_file_extension = ".ps";
197 print_paper_flag = "-t";
198 print_paper_dimension_flag = "-T";
199 document_path.erase();
200 tempdir_path = "/tmp";
201 view_dvi_paper_option.erase();
202 default_papersize = PAPER_USLETTER;
203 custom_export_format = "ps";
204 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
205 bibtex_command = "bibtex";
208 // Because a screen typically is wider than a piece of paper:
211 // Default LaTeX font size:
212 font_sizes[LyXFont::SIZE_TINY] = 5.0;
213 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
214 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
215 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
216 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
217 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
218 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
219 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
220 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
221 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
222 use_scalable_fonts = true;
223 roman_font_name = "";
225 typewriter_font_name = "";
226 popup_bold_font = "-*-helvetica-bold-r";
227 popup_normal_font = "-*-helvetica-medium-r";
228 font_norm = "iso8859-1";
229 font_norm_type = ISO_8859_1;
230 popup_font_encoding.erase();
232 auto_region_delete = true;
233 auto_reset_options = false;
236 check_lastfiles = true;
238 backupdir_path.erase();
239 display_graphics = lyx::graphics::ColorDisplay;
240 // Spellchecker settings:
241 use_spell_lib = true;
242 isp_command = "ispell";
243 isp_accept_compound = false;
244 isp_use_input_encoding = false;
245 isp_use_alt_lang = false;
246 isp_use_pers_dict = false;
247 isp_use_esc_chars = false;
251 mark_foreign_language = true;
252 language_auto_begin = true;
253 language_auto_end = true;
254 language_global_options = true;
255 language_use_babel = true;
256 language_package = "\\usepackage{babel}";
257 language_command_begin = "\\selectlanguage{$$lang}";
258 language_command_local = "\\foreignlanguage{$$lang}{";
259 default_language = "english";
263 date_insert_format = "%A, %e %B %Y";
264 cursor_follows_scrollbar = false;
265 dialogs_iconify_with_main = false;
266 label_init_length = 3;
267 preview = PREVIEW_OFF;
268 preview_hashed_labels = false;
269 preview_scale_factor = 0.9;
271 user_name = lyx::support::user_name();
273 user_email = lyx::support::user_email();
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;
307 int LyXRC::read(std::istream & is)
309 LyXLex lexrc(lyxrcTags, lyxrcCount);
310 if (lyxerr.debugging(Debug::PARSER))
311 lexrc.printTable(lyxerr);
314 if (!lexrc.isOK()) return -2;
316 lyxerr[Debug::LYXRC] << "Reading istream..." << endl;
322 int LyXRC::read(LyXLex & lexrc)
324 if (!lexrc.isOK()) return -2;
326 while (lexrc.isOK()) {
327 // By using two switches we take advantage of the compiler
328 // telling us if we have missed a LyXRCTags element in
329 // the second switch.
330 // Note that this also shows a problem with LyXLex since it
331 // helps us avoid taking advantage of the strictness of the
334 int le = lexrc.lex();
336 case LyXLex::LEX_UNDEF:
337 lexrc.printError("Unknown tag `$$Token'");
339 case LyXLex::LEX_FEOF:
343 switch (static_cast<LyXRCTags>(le)) {
344 case RC_INPUT: // Include file
347 LibFileSearch(string(),
350 lexrc.printError("Error reading "
351 "included file: "+tmp);
355 case RC_BINDFILE: // RVDK_PATCH_5
357 bind_file = lexrc.getString();
363 ui_file = lexrc.getString();
367 case RC_AUTORESET_OPTIONS:
369 auto_reset_options = lexrc.getBool();
373 case RC_DISPLAY_GRAPHICS:
375 display_graphics = lyx::graphics::displayTranslator().find(lexrc.getString());
381 use_kbmap = lexrc.getBool();
385 case RC_KBMAP_PRIMARY:
387 string const kmap(lexrc.getString());
390 } else if (!LibFileSearch("kbd", kmap,
392 primary_kbmap = kmap;
394 lexrc.printError("LyX: Keymap `$$Token' not found");
399 case RC_KBMAP_SECONDARY:
401 string const kmap(lexrc.getString());
404 } else if (!LibFileSearch("kbd", kmap,
406 secondary_kbmap = kmap;
408 lexrc.printError("LyX: Keymap `$$Token' not found");
413 case RC_FONT_ENCODING:
415 fontenc = lexrc.getString();
421 printer = lexrc.getString();
425 case RC_PRINT_COMMAND:
427 print_command = lexrc.getString();
431 case RC_PRINTEVENPAGEFLAG:
433 print_evenpage_flag = lexrc.getString();
437 case RC_PRINTODDPAGEFLAG:
439 print_oddpage_flag = lexrc.getString();
443 case RC_PRINTPAGERANGEFLAG:
445 print_pagerange_flag = lexrc.getString();
449 case RC_PRINTCOPIESFLAG:
451 print_copies_flag = lexrc.getString();
455 case RC_PRINTCOLLCOPIESFLAG:
457 print_collcopies_flag = lexrc.getString();
461 case RC_PRINTREVERSEFLAG:
463 print_reverse_flag = lexrc.getString();
467 case RC_PRINTLANDSCAPEFLAG:
469 print_landscape_flag = lexrc.getString();
473 case RC_PRINTTOPRINTER:
475 print_to_printer = lexrc.getString();
479 case RC_PRINT_ADAPTOUTPUT:
481 print_adapt_output = lexrc.getBool();
487 print_to_file = lexrc.getString();
491 case RC_PRINTFILEEXTENSION:
493 print_file_extension = lexrc.getString();
497 case RC_PRINTEXSTRAOPTIONS:
499 print_extra_options = lexrc.getString();
503 case RC_PRINTSPOOL_COMMAND:
505 print_spool_command = lexrc.getString();
509 case RC_PRINTSPOOL_PRINTERPREFIX:
511 print_spool_printerprefix = lexrc.getString();
515 case RC_PRINTPAPERDIMENSIONFLAG:
517 print_paper_dimension_flag = lexrc.getString();
521 case RC_PRINTPAPERFLAG:
523 print_paper_flag = lexrc.getString();
527 case RC_CUSTOM_EXPORT_COMMAND:
529 custom_export_command = lexrc.getString();
533 case RC_CUSTOM_EXPORT_FORMAT:
535 custom_export_format = lexrc.getString();
539 case RC_DEFAULT_PAPERSIZE:
542 ascii_lowercase(lexrc.getString());
543 if (size == "usletter")
546 else if (size == "legal")
549 else if (size == "executive")
551 PAPER_EXECUTIVEPAPER;
552 else if (size == "a3")
555 else if (size == "a4")
558 else if (size == "a5")
561 else if (size == "b5")
567 case RC_VIEWDVI_PAPEROPTION:
569 view_dvi_paper_option = lexrc.getString();
571 view_dvi_paper_option.erase();
575 case RC_CHKTEX_COMMAND:
577 chktex_command = lexrc.getString();
581 case RC_BIBTEX_COMMAND:
583 bibtex_command = lexrc.getString();
589 dpi = lexrc.getInteger();
595 zoom = lexrc.getInteger();
601 wheel_jump = lexrc.getInteger();
605 case RC_SCREEN_FONT_SIZES:
607 font_sizes[LyXFont::SIZE_TINY] =
611 font_sizes[LyXFont::SIZE_SCRIPT] =
615 font_sizes[LyXFont::SIZE_FOOTNOTE] =
619 font_sizes[LyXFont::SIZE_SMALL] =
623 font_sizes[LyXFont::SIZE_NORMAL] =
627 font_sizes[LyXFont::SIZE_LARGE] =
631 font_sizes[LyXFont::SIZE_LARGER] =
635 font_sizes[LyXFont::SIZE_LARGEST] =
639 font_sizes[LyXFont::SIZE_HUGE] =
643 font_sizes[LyXFont::SIZE_HUGER] =
648 case RC_SCREEN_FONT_SCALABLE:
650 use_scalable_fonts = lexrc.getBool();
656 autosave = lexrc.getInteger();
660 case RC_DOCUMENTPATH:
662 document_path = ExpandPath(lexrc.getString());
666 case RC_TEMPLATEPATH:
668 template_path = ExpandPath(lexrc.getString());
674 tempdir_path = ExpandPath(lexrc.getString());
680 lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
686 lastfiles = ExpandPath(lexrc.getString());
690 case RC_NUMLASTFILES:
692 num_lastfiles = lexrc.getInteger();
696 case RC_CHECKLASTFILES:
698 check_lastfiles = lexrc.getBool();
702 case RC_SCREEN_FONT_ROMAN:
704 roman_font_name = lexrc.getString();
705 oldFontFormat(roman_font_name,
710 case RC_SCREEN_FONT_SANS:
712 sans_font_name = lexrc.getString();
713 oldFontFormat(sans_font_name, sans_font_foundry);
717 case RC_SCREEN_FONT_TYPEWRITER:
719 typewriter_font_name = lexrc.getString();
720 oldFontFormat(typewriter_font_name,
721 typewriter_font_foundry);
725 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
727 roman_font_foundry = lexrc.getString();
731 case RC_SCREEN_FONT_SANS_FOUNDRY:
733 sans_font_foundry = lexrc.getString();
737 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
739 typewriter_font_foundry = lexrc.getString();
743 case RC_SCREEN_FONT_ENCODING:
745 font_norm = lexrc.getString();
746 set_font_norm_type();
750 case RC_POPUP_BOLD_FONT:
752 popup_bold_font = lexrc.getString();
756 case RC_POPUP_NORMAL_FONT:
758 popup_normal_font = lexrc.getString();
762 case RC_POPUP_FONT_ENCODING:
764 popup_font_encoding = lexrc.getString();
770 string lyx_name, x11_name;
773 lyx_name = lexrc.getString();
775 lexrc.printError("Missing color tag.");
780 x11_name = lexrc.getString();
782 lexrc.printError("Missing color name for color: `$$Token'");
786 LColor::color const col =
787 lcolor.getFromLyXName(lyx_name);
788 if (col == LColor::none ||
789 col == LColor::inherit ||
790 col == LColor::ignore)
793 if (!lcolor.setColor(col, x11_name)) {
794 lyxerr << "Bad lyxrc set_color for "
800 case RC_AUTOREGIONDELETE:
801 // Auto region delete defaults to true
803 auto_region_delete = lexrc.getBool();
809 lyxpipes = ExpandPath(lexrc.getString());
813 case RC_CURSOR_FOLLOWS_SCROLLBAR:
815 cursor_follows_scrollbar = lexrc.getBool();
819 case RC_DIALOGS_ICONIFY_WITH_MAIN:
821 dialogs_iconify_with_main = lexrc.getBool();
825 case RC_ASCIIROFF_COMMAND:
827 ascii_roff_command = lexrc.getString();
830 case RC_ASCII_LINELEN:
832 ascii_linelen = lexrc.getInteger();
835 // Spellchecker settings:
836 case RC_USE_SPELL_LIB:
838 use_spell_lib = lexrc.getBool();
841 case RC_SPELL_COMMAND:
843 isp_command = lexrc.getString();
846 case RC_ACCEPT_COMPOUND:
848 isp_accept_compound = lexrc.getBool();
853 isp_use_input_encoding = lexrc.getBool();
856 case RC_USE_ALT_LANG:
858 isp_use_alt_lang = lexrc.getBool();
861 case RC_USE_PERS_DICT:
863 isp_use_pers_dict = lexrc.getBool();
866 case RC_USE_ESC_CHARS:
868 isp_use_esc_chars = lexrc.getBool();
873 isp_alt_lang = lexrc.getString();
878 isp_pers_dict = lexrc.getString();
883 isp_esc_chars = lexrc.getString();
888 make_backup = lexrc.getBool();
891 case RC_BACKUPDIR_PATH:
893 backupdir_path = ExpandPath(lexrc.getString());
896 case RC_DATE_INSERT_FORMAT:
898 date_insert_format = lexrc.getString();
901 case RC_LANGUAGE_PACKAGE:
903 language_package = lexrc.getString();
906 case RC_LANGUAGE_AUTO_BEGIN:
908 language_auto_begin = lexrc.getBool();
911 case RC_LANGUAGE_AUTO_END:
913 language_auto_end = lexrc.getBool();
916 case RC_LANGUAGE_GLOBAL_OPTIONS:
918 language_global_options = lexrc.getBool();
921 case RC_LANGUAGE_USE_BABEL:
923 language_use_babel = lexrc.getBool();
926 case RC_LANGUAGE_COMMAND_BEGIN:
928 language_command_begin = lexrc.getString();
931 case RC_LANGUAGE_COMMAND_END:
933 language_command_end = lexrc.getString();
936 case RC_LANGUAGE_COMMAND_LOCAL:
938 language_command_local = lexrc.getString();
943 rtl_support = lexrc.getBool();
948 auto_number = lexrc.getBool();
951 case RC_MARK_FOREIGN_LANGUAGE:
953 mark_foreign_language = lexrc.getBool();
958 string from, to, command, flags;
960 from = lexrc.getString();
963 to = lexrc.getString();
966 command = lexrc.getString();
969 flags = lexrc.getString();
972 || token(command, ' ', 0) == "none") {
973 converters.erase(from, to);
975 converters.add(from, to, command, flags);
979 // compatibility with versions older than 1.4.0 only
981 string format, command;
983 format = lexrc.getString();
986 command = lexrc.getString();
987 if (token(command, ' ', 0) == "none")
990 formats.setViewer(format, command);
994 string format, extension, prettyname, shortcut;
996 format = lexrc.getString();
999 extension = lexrc.getString();
1002 prettyname = lexrc.getString();
1005 shortcut = lexrc.getString();
1007 string viewer, editor;
1008 // Hack to ensure compatibility with versions older
1010 int le = lexrc.lex();
1011 if (le != LyXLex::LEX_FEOF && le != LyXLex::LEX_UNDEF) {
1012 viewer = lexrc.getString();
1013 if (le == LyXLex::LEX_DATA) {
1014 if (token(viewer, ' ', 0) == "none")
1017 editor = lexrc.getString();
1018 if (token(editor, ' ', 0) == "none")
1022 // We have got a known token.
1023 // Therefore this is an old style
1024 // format definition without
1025 // viewer and editor.
1026 lexrc.pushToken(viewer);
1030 if (prettyname.empty()) {
1031 if (converters.formatIsUsed(format)) {
1032 lyxerr << "Can't delete format "
1035 formats.erase(format);
1038 formats.add(format, extension, prettyname,
1039 shortcut, viewer, editor);
1043 case RC_DEFAULT_LANGUAGE:
1045 default_language = lexrc.getString();
1049 case RC_LABEL_INIT_LENGTH:
1051 label_init_length = lexrc.getInteger();
1055 case RC_SHOW_BANNER:
1057 show_banner = lexrc.getBool();
1063 string const tmp = lexrc.getString();
1064 if (tmp == "true" || tmp == "on")
1065 preview = PREVIEW_ON;
1066 else if (tmp == "no_math")
1067 preview = PREVIEW_NO_MATH;
1069 preview = PREVIEW_OFF;
1070 if (tmp != "false" && tmp != "off")
1071 lyxerr << "Unrecognized "
1073 << tmp << '\n' << endl;
1078 case RC_PREVIEW_HASHED_LABELS:
1080 preview_hashed_labels = lexrc.getBool();
1084 case RC_PREVIEW_SCALE_FACTOR:
1086 preview_scale_factor = lexrc.getFloat();
1092 user_name = lexrc.getString();
1097 user_email = lexrc.getString();
1100 case RC_LAST: break; // this is just a dummy
1104 /// Update converters data-structures
1105 converters.update(formats);
1106 converters.buildGraph();
1112 void LyXRC::write(string const & filename, bool ignore_system_lyxrc) const
1114 ofstream ofs(filename.c_str());
1116 write(ofs, ignore_system_lyxrc);
1120 void LyXRC::print() const
1122 if (lyxerr.debugging())
1123 write(lyxerr, false);
1129 void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
1131 os << "### This file is part of\n"
1132 << "### ========================================================\n"
1133 << "### LyX, The Document Processor\n"
1135 << "### Copyright 1995 Matthias Ettrich\n"
1136 << "### Copyright 1995-2001 The LyX Team.\n"
1138 << "### ========================================================\n"
1140 << "# This file is written by LyX, if you want to make your own\n"
1141 << "# modifications you should do them from inside LyX and save\n"
1144 // Why the switch you might ask. It is a trick to ensure that all
1145 // the elements in the LyXRCTags enum is handled. As you can see
1146 // there are no breaks at all. So it is just a huge fall-through.
1147 // The nice thing is that we will get a warning from the compiler
1148 // if we forget an element.
1149 LyXRCTags tag = RC_LAST;
1153 // input/include files are not done here
1155 if (ignore_system_lyxrc ||
1156 bind_file != system_lyxrc.bind_file) {
1157 os << "\\bind_file " << bind_file << "\n";
1163 << "# MISC SECTION ######################################\n"
1166 // bind files are not done here.
1168 if (ignore_system_lyxrc ||
1169 ui_file != system_lyxrc.ui_file) {
1170 os << "\\ui_file \"" << ui_file << "\"\n";
1172 case RC_AUTOREGIONDELETE:
1173 if (ignore_system_lyxrc ||
1174 auto_region_delete != system_lyxrc.auto_region_delete) {
1175 os << "# Set to false to inhibit automatic replacement of\n"
1176 << "# the current selection.\n"
1177 << "\\auto_region_delete " << tostr(auto_region_delete)
1180 case RC_AUTORESET_OPTIONS:
1181 if (ignore_system_lyxrc ||
1182 auto_reset_options != system_lyxrc.auto_reset_options) {
1183 os << "# Set to false to inhibit automatic reset of\n"
1184 << "# the class options to defaults on class change.\n"
1185 << "\\auto_reset_options " << tostr(auto_reset_options)
1189 if (ignore_system_lyxrc ||
1190 autosave != system_lyxrc.autosave) {
1191 os << "# The time interval between auto-saves in seconds.\n"
1192 << "\\autosave " << autosave << '\n';
1194 case RC_DISPLAY_GRAPHICS:
1195 if (ignore_system_lyxrc ||
1196 display_graphics != system_lyxrc.display_graphics) {
1197 os << "# Display graphics within LyX\n"
1198 << "# monochrome|grayscale|color|none\n"
1199 << "\\display_graphics "
1200 << lyx::graphics::displayTranslator().find(display_graphics)
1204 case RC_VIEWDVI_PAPEROPTION:
1205 if (ignore_system_lyxrc ||
1206 view_dvi_paper_option
1207 != system_lyxrc.view_dvi_paper_option) {
1208 os << "# Options used to specify paper size to the\n"
1209 << "# view_dvi_command (e.g. -paper)\n"
1210 << "\\view_dvi_paper_option \""
1211 << view_dvi_paper_option << "\"\n";
1213 case RC_DEFAULT_PAPERSIZE:
1214 if (ignore_system_lyxrc ||
1215 default_papersize != system_lyxrc.default_papersize) {
1216 os << "# The default papersize to use.\n"
1217 << "\\default_papersize \"";
1218 switch (default_papersize) {
1219 case PAPER_USLETTER:
1220 os << "usletter"; break;
1221 case PAPER_LEGALPAPER:
1222 os << "legal"; break;
1223 case PAPER_EXECUTIVEPAPER:
1224 os << "executive"; break;
1233 case PAPER_DEFAULT: break;
1237 case RC_CHKTEX_COMMAND:
1238 if (ignore_system_lyxrc ||
1239 chktex_command != system_lyxrc.chktex_command) {
1240 os << "\\chktex_command \"" << chktex_command << "\"\n";
1242 case RC_BIBTEX_COMMAND:
1243 if (ignore_system_lyxrc ||
1244 bibtex_command != system_lyxrc.bibtex_command) {
1245 os << "\\bibtex_command \"" << bibtex_command << "\"\n";
1248 if (ignore_system_lyxrc ||
1249 use_kbmap != system_lyxrc.use_kbmap) {
1250 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1252 case RC_KBMAP_PRIMARY:
1253 if (ignore_system_lyxrc ||
1254 primary_kbmap != system_lyxrc.primary_kbmap) {
1255 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1257 case RC_KBMAP_SECONDARY:
1258 if (ignore_system_lyxrc ||
1259 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1260 os << "\\kbmap_secondary \"" << secondary_kbmap
1264 if (ignore_system_lyxrc ||
1265 lyxpipes != system_lyxrc.lyxpipes) {
1266 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1268 case RC_DATE_INSERT_FORMAT:
1269 if (ignore_system_lyxrc ||
1270 date_insert_format != system_lyxrc.date_insert_format) {
1271 os << "\\date_insert_format \"" << date_insert_format
1274 case RC_LABEL_INIT_LENGTH:
1275 if (ignore_system_lyxrc ||
1276 label_init_length != system_lyxrc.label_init_length) {
1277 os << "\\label_init_length " << label_init_length
1282 os << "\\user_name \"" << user_name << "\"\n";
1285 os << "\\user_email \"" << user_email << "\"\n";
1287 case RC_SHOW_BANNER:
1288 if (ignore_system_lyxrc ||
1289 show_banner != system_lyxrc.show_banner) {
1290 os << "\\show_banner " << tostr(show_banner) << '\n';
1294 if (ignore_system_lyxrc ||
1295 preview != system_lyxrc.preview) {
1301 case PREVIEW_NO_MATH:
1308 os << "\\preview " << status << '\n';
1311 case RC_PREVIEW_HASHED_LABELS:
1312 if (ignore_system_lyxrc ||
1313 preview_hashed_labels !=
1314 system_lyxrc.preview_hashed_labels) {
1315 os << "\\preview_hashed_labels "
1316 << tostr(preview_hashed_labels) << '\n';
1319 case RC_PREVIEW_SCALE_FACTOR:
1320 if (ignore_system_lyxrc ||
1321 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1322 os << "\\preview_scale_factor "
1323 << preview_scale_factor << '\n';
1327 << "# SCREEN & FONTS SECTION ############################\n"
1330 case RC_POPUP_NORMAL_FONT:
1331 if (ignore_system_lyxrc ||
1332 popup_normal_font != system_lyxrc.popup_normal_font) {
1333 os << "\\popup_normal_font \"" << popup_normal_font
1336 case RC_POPUP_BOLD_FONT:
1337 if (ignore_system_lyxrc ||
1338 popup_bold_font != system_lyxrc.popup_bold_font) {
1339 os << "\\popup_bold_font \"" << popup_bold_font
1342 case RC_POPUP_FONT_ENCODING:
1343 if (ignore_system_lyxrc ||
1344 popup_font_encoding != system_lyxrc.popup_font_encoding) {
1345 os << "\\popup_font_encoding \"" << popup_font_encoding
1349 if (ignore_system_lyxrc ||
1350 dpi != system_lyxrc.dpi) {
1351 os << "\\screen_dpi " << dpi << '\n';
1353 case RC_SCREEN_ZOOM:
1354 if (ignore_system_lyxrc ||
1355 zoom != system_lyxrc.zoom) {
1356 os << "\\screen_zoom " << zoom << '\n';
1359 if (ignore_system_lyxrc ||
1360 wheel_jump != system_lyxrc.wheel_jump) {
1361 os << "\\wheel_jump " << wheel_jump << '\n';
1363 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1364 if (ignore_system_lyxrc ||
1365 cursor_follows_scrollbar
1366 != system_lyxrc.cursor_follows_scrollbar) {
1367 os << "\\cursor_follows_scrollbar "
1368 << tostr(cursor_follows_scrollbar) << '\n';
1370 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1371 if (ignore_system_lyxrc ||
1372 dialogs_iconify_with_main
1373 != system_lyxrc.dialogs_iconify_with_main) {
1374 os << "\\dialogs_iconify_with_main "
1375 << tostr(dialogs_iconify_with_main) << '\n';
1377 case RC_SCREEN_FONT_ROMAN:
1378 if (ignore_system_lyxrc ||
1379 roman_font_name != system_lyxrc.roman_font_name) {
1380 os << "\\screen_font_roman \"" << roman_font_name
1383 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1384 if (ignore_system_lyxrc ||
1385 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1386 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1389 case RC_SCREEN_FONT_SANS:
1390 if (ignore_system_lyxrc ||
1391 sans_font_name != system_lyxrc.sans_font_name) {
1392 os << "\\screen_font_sans \"" << sans_font_name
1395 case RC_SCREEN_FONT_SANS_FOUNDRY:
1396 if (ignore_system_lyxrc ||
1397 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1398 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1401 case RC_SCREEN_FONT_TYPEWRITER:
1402 if (ignore_system_lyxrc ||
1403 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1404 os << "\\screen_font_typewriter \""
1405 << typewriter_font_name << "\"\n";
1407 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1408 if (ignore_system_lyxrc ||
1409 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1410 os << "\\screen_font_typewriter_foundry \""
1411 << typewriter_font_foundry << "\"\n";
1414 case RC_SCREEN_FONT_SCALABLE:
1415 if (ignore_system_lyxrc ||
1416 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1417 os << "\\screen_font_scalable "
1418 << tostr(use_scalable_fonts)
1421 case RC_SCREEN_FONT_ENCODING:
1422 if (ignore_system_lyxrc ||
1423 font_norm != system_lyxrc.font_norm) {
1424 os << "\\screen_font_encoding \"" << font_norm
1427 case RC_SCREEN_FONT_SIZES:
1428 if (ignore_system_lyxrc ||
1429 font_sizes[LyXFont::SIZE_TINY]
1430 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1431 font_sizes[LyXFont::SIZE_SCRIPT]
1432 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1433 font_sizes[LyXFont::SIZE_FOOTNOTE]
1434 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1435 font_sizes[LyXFont::SIZE_SMALL]
1436 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1437 font_sizes[LyXFont::SIZE_NORMAL]
1438 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1439 font_sizes[LyXFont::SIZE_LARGE]
1440 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1441 font_sizes[LyXFont::SIZE_LARGER]
1442 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1443 font_sizes[LyXFont::SIZE_LARGEST]
1444 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1445 font_sizes[LyXFont::SIZE_HUGE]
1446 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1447 font_sizes[LyXFont::SIZE_HUGER]
1448 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1449 os.setf(ios::fixed);
1451 os << "\\screen_font_sizes"
1452 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1453 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1454 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1455 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1456 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1457 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1458 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1459 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1460 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1461 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1466 << "# COLOR SECTION ###################################\n"
1470 for (int i = 0; i < LColor::ignore; ++i) {
1471 LColor::color lc = static_cast<LColor::color>(i);
1473 string const col(lcolor.getX11Name(lc));
1474 if (ignore_system_lyxrc ||
1475 col != system_lcolor.getX11Name(lc)) {
1476 os << "\\set_color \""
1477 << lcolor.getLyXName(lc) << "\" \""
1483 << "# PRINTER SECTION ###################################\n"
1487 if (ignore_system_lyxrc ||
1488 printer != system_lyxrc.printer) {
1489 os << "\\printer \"" << printer << "\"\n";
1491 case RC_PRINT_ADAPTOUTPUT:
1492 if (ignore_system_lyxrc ||
1493 print_adapt_output != system_lyxrc.print_adapt_output) {
1494 os << "\\print_adapt_output "
1495 << tostr(print_adapt_output)
1498 case RC_PRINT_COMMAND:
1499 if (ignore_system_lyxrc ||
1500 print_command != system_lyxrc.print_command) {
1501 os << "\\print_command \"" << print_command << "\"\n";
1503 case RC_PRINTEXSTRAOPTIONS:
1504 if (ignore_system_lyxrc ||
1505 print_extra_options != system_lyxrc.print_extra_options) {
1506 os << "\\print_extra_options \"" << print_extra_options
1509 case RC_PRINTSPOOL_COMMAND:
1510 if (ignore_system_lyxrc ||
1511 print_spool_command != system_lyxrc.print_spool_command) {
1512 os << "\\print_spool_command \"" << print_spool_command
1515 case RC_PRINTSPOOL_PRINTERPREFIX:
1516 if (ignore_system_lyxrc ||
1517 print_spool_printerprefix
1518 != system_lyxrc.print_spool_printerprefix) {
1519 os << "\\print_spool_printerprefix \""
1520 << print_spool_printerprefix << "\"\n";
1522 case RC_PRINTEVENPAGEFLAG:
1523 if (ignore_system_lyxrc ||
1524 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1525 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1528 case RC_PRINTODDPAGEFLAG:
1529 if (ignore_system_lyxrc ||
1530 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1531 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1534 case RC_PRINTREVERSEFLAG:
1535 if (ignore_system_lyxrc ||
1536 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1537 os << "\\print_reverse_flag \"" << print_reverse_flag
1540 case RC_PRINTLANDSCAPEFLAG:
1541 if (ignore_system_lyxrc ||
1542 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1543 os << "\\print_landscape_flag \"" << print_landscape_flag
1546 case RC_PRINTPAGERANGEFLAG:
1547 if (ignore_system_lyxrc ||
1548 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1549 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1552 case RC_PRINTCOPIESFLAG:
1553 if (ignore_system_lyxrc ||
1554 print_copies_flag != system_lyxrc.print_copies_flag) {
1555 os << "\\print_copies_flag \"" << print_copies_flag
1558 case RC_PRINTCOLLCOPIESFLAG:
1559 if (ignore_system_lyxrc ||
1560 print_collcopies_flag
1561 != system_lyxrc.print_collcopies_flag) {
1562 os << "\\print_collcopies_flag \""
1563 << print_collcopies_flag
1566 case RC_PRINTPAPERFLAG:
1567 if (ignore_system_lyxrc ||
1568 print_paper_flag != system_lyxrc.print_paper_flag) {
1569 os << "\\print_paper_flag \"" << print_paper_flag
1572 case RC_PRINTPAPERDIMENSIONFLAG:
1573 if (ignore_system_lyxrc ||
1574 print_paper_dimension_flag
1575 != system_lyxrc.print_paper_dimension_flag) {
1576 os << "\\print_paper_dimension_flag \""
1577 << print_paper_dimension_flag << "\"\n";
1579 case RC_PRINTTOPRINTER:
1580 if (ignore_system_lyxrc ||
1581 print_to_printer != system_lyxrc.print_to_printer) {
1582 os << "\\print_to_printer \"" << print_to_printer
1585 case RC_PRINTTOFILE:
1586 if (ignore_system_lyxrc ||
1587 print_to_file != system_lyxrc.print_to_file) {
1588 os << "\\print_to_file \"" << print_to_file << "\"\n";
1590 case RC_PRINTFILEEXTENSION:
1591 if (ignore_system_lyxrc ||
1592 print_file_extension != system_lyxrc.print_file_extension) {
1593 os << "\\print_file_extension \""
1594 << print_file_extension
1599 << "# EXPORT SECTION ####################################\n"
1602 case RC_CUSTOM_EXPORT_COMMAND:
1603 if (ignore_system_lyxrc ||
1604 custom_export_command
1605 != system_lyxrc.custom_export_command) {
1606 os << "\\custom_export_command \""
1607 << custom_export_command
1610 case RC_CUSTOM_EXPORT_FORMAT:
1611 if (ignore_system_lyxrc ||
1612 custom_export_format
1613 != system_lyxrc.custom_export_format) {
1614 os << "\\custom_export_format \"" << custom_export_format
1619 << "# TEX SECTION #######################################\n"
1622 case RC_FONT_ENCODING:
1623 if (ignore_system_lyxrc ||
1624 fontenc != system_lyxrc.fontenc) {
1625 os << "\\font_encoding \"" << fontenc << "\"\n";
1629 << "# FILE SECTION ######################################\n"
1632 case RC_DOCUMENTPATH:
1633 if (ignore_system_lyxrc ||
1634 document_path != system_lyxrc.document_path) {
1635 os << "\\document_path \"" << document_path << "\"\n";
1638 if (ignore_system_lyxrc ||
1639 lastfiles != system_lyxrc.lastfiles) {
1640 os << "\\lastfiles \"" << lastfiles << "\"\n";
1642 case RC_NUMLASTFILES:
1643 if (ignore_system_lyxrc ||
1644 num_lastfiles != system_lyxrc.num_lastfiles) {
1645 os << "\\num_lastfiles " << num_lastfiles << '\n';
1647 case RC_CHECKLASTFILES:
1648 if (ignore_system_lyxrc ||
1649 check_lastfiles != system_lyxrc.check_lastfiles) {
1650 os << "\\check_lastfiles " << tostr(check_lastfiles)
1653 case RC_TEMPLATEPATH:
1654 if (ignore_system_lyxrc ||
1655 template_path != system_lyxrc.template_path) {
1656 os << "\\template_path \"" << template_path << "\"\n";
1658 case RC_TEMPDIRPATH:
1659 if (ignore_system_lyxrc ||
1660 tempdir_path != system_lyxrc.tempdir_path) {
1661 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1665 case RC_ASCII_LINELEN:
1666 if (ignore_system_lyxrc ||
1667 ascii_linelen != system_lyxrc.ascii_linelen) {
1668 os << "\\ascii_linelen " << ascii_linelen << '\n';
1670 case RC_MAKE_BACKUP:
1671 if (ignore_system_lyxrc ||
1672 make_backup != system_lyxrc.make_backup) {
1673 os << "\\make_backup " << tostr(make_backup) << '\n';
1675 case RC_BACKUPDIR_PATH:
1676 if (ignore_system_lyxrc ||
1677 backupdir_path != system_lyxrc.backupdir_path) {
1678 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1682 << "# ASCII EXPORT SECTION ##############################\n"
1685 case RC_ASCIIROFF_COMMAND:
1686 if (ignore_system_lyxrc ||
1687 ascii_roff_command != system_lyxrc.ascii_roff_command) {
1688 os << "\\ascii_roff_command \"" << ascii_roff_command
1693 << "# SPELLCHECKER SECTION ##############################\n"
1695 case RC_USE_SPELL_LIB:
1696 if (ignore_system_lyxrc ||
1697 use_spell_lib != system_lyxrc.use_spell_lib) {
1698 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1700 case RC_SPELL_COMMAND:
1701 if (ignore_system_lyxrc ||
1702 isp_command != system_lyxrc.isp_command) {
1703 os << "\\spell_command \"" << isp_command << "\"\n";
1705 case RC_ACCEPT_COMPOUND:
1706 if (ignore_system_lyxrc ||
1707 isp_accept_compound != system_lyxrc.isp_accept_compound) {
1708 os << "\\accept_compound " << tostr(isp_accept_compound)
1711 case RC_USE_ALT_LANG:
1712 if (ignore_system_lyxrc ||
1713 isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1714 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1718 if (ignore_system_lyxrc ||
1719 isp_alt_lang != system_lyxrc.isp_alt_lang) {
1720 os << "\\alternate_language \"" << isp_alt_lang
1723 case RC_USE_ESC_CHARS:
1724 if (ignore_system_lyxrc ||
1725 isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1726 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1730 if (ignore_system_lyxrc ||
1731 isp_esc_chars != system_lyxrc.isp_esc_chars) {
1732 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1734 case RC_USE_PERS_DICT:
1735 if (ignore_system_lyxrc ||
1736 isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1737 os << "\\use_personal_dictionary "
1738 << tostr(isp_use_pers_dict)
1742 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1743 os << "\\personal_dictionary \"" << isp_pers_dict
1746 case RC_USE_INP_ENC:
1747 if (ignore_system_lyxrc ||
1748 isp_use_input_encoding
1749 != system_lyxrc.isp_use_input_encoding) {
1750 os << "\\use_input_encoding "
1751 << tostr(isp_use_input_encoding)
1756 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1759 case RC_RTL_SUPPORT:
1760 if (ignore_system_lyxrc ||
1761 rtl_support != system_lyxrc.rtl_support) {
1762 os << "\\rtl " << tostr(rtl_support) << '\n';
1764 case RC_LANGUAGE_PACKAGE:
1765 if (ignore_system_lyxrc ||
1766 language_package != system_lyxrc.language_package) {
1767 os << "\\language_package \"" << language_package
1770 case RC_LANGUAGE_GLOBAL_OPTIONS:
1771 if (ignore_system_lyxrc ||
1772 language_global_options
1773 != system_lyxrc.language_global_options) {
1774 os << "\\language_global_options \""
1775 << tostr(language_global_options)
1778 case RC_LANGUAGE_USE_BABEL:
1779 if (ignore_system_lyxrc ||
1780 language_use_babel != system_lyxrc.language_use_babel) {
1781 os << "\\language_use_babel \""
1782 << tostr(language_use_babel)
1785 case RC_LANGUAGE_COMMAND_BEGIN:
1786 if (ignore_system_lyxrc ||
1787 language_command_begin
1788 != system_lyxrc.language_command_begin) {
1789 os << "\\language_command_begin \""
1790 << language_command_begin
1793 case RC_LANGUAGE_COMMAND_END:
1794 if (ignore_system_lyxrc ||
1795 language_command_end
1796 != system_lyxrc.language_command_end) {
1797 os << "\\language_command_end \"" << language_command_end
1800 case RC_LANGUAGE_COMMAND_LOCAL:
1801 if (ignore_system_lyxrc ||
1802 language_command_local
1803 != system_lyxrc.language_command_local) {
1804 os << "\\language_command_local \""
1805 << language_command_local
1808 case RC_LANGUAGE_AUTO_BEGIN:
1809 if (ignore_system_lyxrc ||
1810 language_auto_begin != system_lyxrc.language_auto_begin) {
1811 os << "\\language_auto_begin "
1812 << tostr(language_auto_begin) << '\n';
1814 case RC_LANGUAGE_AUTO_END:
1815 if (ignore_system_lyxrc ||
1816 language_auto_end != system_lyxrc.language_auto_end) {
1817 os << "\\language_auto_end "
1818 << tostr(language_auto_end) << '\n';
1820 case RC_MARK_FOREIGN_LANGUAGE:
1821 if (ignore_system_lyxrc ||
1822 mark_foreign_language
1823 != system_lyxrc.mark_foreign_language) {
1824 os << "\\mark_foreign_language " <<
1825 tostr(mark_foreign_language) << '\n';
1829 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1832 case RC_AUTO_NUMBER:
1833 if (ignore_system_lyxrc ||
1834 auto_number != system_lyxrc.auto_number) {
1835 os << "\\auto_number " << tostr(auto_number) << '\n';
1837 case RC_DEFAULT_LANGUAGE:
1838 if (ignore_system_lyxrc ||
1839 default_language != system_lyxrc.default_language) {
1840 os << "\\default_language " << default_language << '\n';
1844 << "# FORMATS SECTION ##########################\n"
1848 // New/modifed formats
1849 for (Formats::const_iterator cit = formats.begin();
1850 cit != formats.end(); ++cit) {
1851 Format const * format =
1852 system_formats.getFormat(cit->name());
1854 format->extension() != cit->extension() ||
1855 format->prettyname() != cit->prettyname() ||
1856 format->shortcut() != cit->shortcut() ||
1857 format->viewer() != cit->viewer() ||
1858 format->editor() != cit->editor())
1859 os << "\\format \"" << cit->name() << "\" \""
1860 << cit->extension() << "\" \""
1861 << cit->prettyname() << "\" \""
1862 << cit->shortcut() << "\" \""
1863 << cit->viewer() << "\" \""
1864 << cit->editor() << "\"\n";
1867 // Look for deleted formats
1868 for (Formats::const_iterator cit = system_formats.begin();
1869 cit != system_formats.end(); ++cit)
1870 if (!formats.getFormat(cit->name()))
1871 os << "\\format \"" << cit->name()
1872 << "\" \"\" \"\" \"\" \"\" \"\"\n";
1877 << "# CONVERTERS SECTION ##########################\n"
1881 // Look for new converters
1882 for (Converters::const_iterator cit = converters.begin();
1883 cit != converters.end(); ++cit) {
1884 Converter const * converter =
1885 system_converters.getConverter(cit->from,
1888 converter->command != cit->command ||
1889 converter->flags != cit->flags)
1890 os << "\\converter \"" << cit->from << "\" \""
1891 << cit->to << "\" \""
1892 << cit->command << "\" \""
1893 << cit->flags << "\"\n";
1896 // New/modifed converters
1897 for (Converters::const_iterator cit = system_converters.begin();
1898 cit != system_converters.end(); ++cit)
1899 if (!converters.getConverter(cit->from, cit->to))
1900 os << "\\converter \"" << cit->from
1901 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1907 void LyXRC::set_font_norm_type()
1909 if (font_norm == "iso10646-1")
1910 font_norm_type = ISO_10646_1;
1911 else if (font_norm == "iso8859-1")
1912 font_norm_type = ISO_8859_1;
1913 else if (font_norm == "iso8859-3")
1914 font_norm_type = ISO_8859_3;
1915 else if (font_norm == "iso8859-4")
1916 font_norm_type = ISO_8859_4;
1917 else if (font_norm == "iso8859-6.8x")
1918 font_norm_type = ISO_8859_6_8;
1919 else if (font_norm == "iso8859-9")
1920 font_norm_type = ISO_8859_9;
1921 else if (font_norm == "iso8859-15")
1922 font_norm_type = ISO_8859_15;
1924 font_norm_type = OTHER_ENCODING;
1928 string const LyXRC::getDescription(LyXRCTags tag)
1933 case RC_FONT_ENCODING:
1934 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1938 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1941 case RC_PRINT_COMMAND:
1942 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1945 case RC_PRINTEVENPAGEFLAG:
1946 str = _("The option to print only even pages.");
1949 case RC_PRINTODDPAGEFLAG:
1950 str = _("The option to print only odd pages.");
1953 case RC_PRINTPAGERANGEFLAG:
1954 str = _("The option for specifying a comma-separated list of pages to print.");
1957 case RC_PRINTCOPIESFLAG:
1958 str = _("The option for specifying the number of copies to print.");
1961 case RC_PRINTCOLLCOPIESFLAG:
1962 str = _("The option for specifying whether the copies should be collated.");
1965 case RC_PRINTREVERSEFLAG:
1966 str = _("The option to reverse the order of the pages printed.");
1969 case RC_PRINTLANDSCAPEFLAG:
1970 str = _("The option to print out in landscape.");
1973 case RC_PRINTPAPERFLAG:
1974 str = _("The option to specify paper type.");
1977 case RC_PRINTPAPERDIMENSIONFLAG:
1978 str = _("Option to specify the dimensions of the print paper.");
1981 case RC_PRINTTOPRINTER:
1982 str = _("Option to pass to the print program to print on a specific printer.");
1985 case RC_PRINT_ADAPTOUTPUT:
1986 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1989 case RC_PRINTTOFILE:
1990 str = _("Option to pass to the print program to print to a file.");
1993 case RC_PRINTFILEEXTENSION:
1994 str = _("Extension of printer program output file. Usually \".ps\".");
1997 case RC_PRINTEXSTRAOPTIONS:
1998 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2001 case RC_PRINTSPOOL_COMMAND:
2002 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.");
2005 case RC_PRINTSPOOL_PRINTERPREFIX:
2006 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.");
2010 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2013 case RC_SCREEN_ZOOM:
2014 //xgettext:no-c-format
2015 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2018 case RC_SCREEN_FONT_SIZES:
2019 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2022 case RC_SCREEN_FONT_ROMAN:
2023 case RC_SCREEN_FONT_SANS:
2024 case RC_SCREEN_FONT_TYPEWRITER:
2025 str = _("The screen fonts used to display the text while editing.");
2028 case RC_POPUP_BOLD_FONT:
2029 str = _("The bold font in the dialogs.");
2032 case RC_POPUP_NORMAL_FONT:
2033 str = _("The normal font in the dialogs.");
2036 case RC_SCREEN_FONT_ENCODING:
2037 str = _("The encoding for the screen fonts.");
2040 case RC_POPUP_FONT_ENCODING:
2041 str = _("The encoding for the menu/popups fonts.");
2048 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2051 case RC_DOCUMENTPATH:
2052 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2055 case RC_TEMPLATEPATH:
2056 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2059 case RC_TEMPDIRPATH:
2060 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2064 str = _("The file where the last-files information should be stored.");
2067 case RC_AUTOREGIONDELETE:
2068 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2071 case RC_AUTORESET_OPTIONS:
2072 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2076 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2080 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2084 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2088 case RC_KBMAP_PRIMARY:
2089 case RC_KBMAP_SECONDARY:
2090 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.");
2093 case RC_ASCIIROFF_COMMAND:
2094 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.");
2097 case RC_ASCII_LINELEN:
2098 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2101 case RC_NUMLASTFILES:
2102 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
2105 case RC_CHECKLASTFILES:
2106 str = _("Select to check whether the lastfiles still exist.");
2109 case RC_VIEWDVI_PAPEROPTION:
2110 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2113 case RC_DEFAULT_PAPERSIZE:
2114 str = _("Specify the default paper size.");
2117 case RC_ACCEPT_COMPOUND:
2118 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2121 case RC_SPELL_COMMAND:
2122 str = _("What command runs the spell checker?");
2125 case RC_USE_INP_ENC:
2126 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.");
2129 case RC_USE_ALT_LANG:
2131 str = _("Specify an alternate language. The default is to use the language of the document.");
2134 case RC_USE_PERS_DICT:
2136 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2139 case RC_USE_ESC_CHARS:
2141 str = _("Specify additional chars that can be part of a word.");
2144 case RC_SCREEN_FONT_SCALABLE:
2145 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.");
2148 case RC_CHKTEX_COMMAND:
2149 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2152 case RC_BIBTEX_COMMAND:
2153 str = _("Define the options of bibtex (cf. man bibtex) or select and alternative compiler (e.g. mlbibtex or bibulus).");
2156 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2157 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.");
2160 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2161 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2164 case RC_DISPLAY_GRAPHICS:
2165 str = _("Select how LyX will display any graphics.");
2168 case RC_MAKE_BACKUP:
2169 str = _("De-select if you don't want LyX to create backup files.");
2172 case RC_BACKUPDIR_PATH:
2173 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.");
2176 case RC_RTL_SUPPORT:
2177 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2180 case RC_MARK_FOREIGN_LANGUAGE:
2181 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2184 case RC_LANGUAGE_PACKAGE:
2185 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2188 case RC_LANGUAGE_GLOBAL_OPTIONS:
2189 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2192 case RC_LANGUAGE_USE_BABEL:
2193 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2196 case RC_LANGUAGE_AUTO_BEGIN:
2197 str = _("Select if a language switching command is needed at the beginning of the document.");
2200 case RC_LANGUAGE_AUTO_END:
2201 str = _("Select if a language switching command is needed at the end of the document.");
2204 case RC_LANGUAGE_COMMAND_BEGIN:
2205 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.");
2208 case RC_LANGUAGE_COMMAND_END:
2209 str = _("The LaTeX command for changing back to the language of the document.");
2212 case RC_LANGUAGE_COMMAND_LOCAL:
2213 str = _("The LaTeX command for local changing of the language.");
2216 case RC_DATE_INSERT_FORMAT:
2217 //xgettext:no-c-format
2218 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2221 case RC_SHOW_BANNER:
2222 str = _("De-select if you don't want the startup banner.");
2226 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2238 case RC_DEFAULT_LANGUAGE:
2239 str = _("New documents will be assigned this language.");
2242 case RC_LABEL_INIT_LENGTH:
2243 str = _("Maximum number of words in the initialization string for a new label");
2247 str = _("Shows a typeset preview of things such as math");
2250 case RC_PREVIEW_HASHED_LABELS:
2251 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2254 case RC_PREVIEW_SCALE_FACTOR:
2255 str = _("Scale the preview size to suit.");
2265 // The global instance
2268 // The global copy of the system lyxrc entries (everything except preferences)