3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
14 * Full author contact details are available in file CREDITS.
25 #include "converter.h"
32 #include "graphics/GraphicsTypes.h"
34 #include "support/filetools.h"
35 #include "support/lstrings.h"
36 #include "support/translator.h"
37 #include "support/tostr.h"
38 #include "support/userinfo.h"
40 using lyx::support::ascii_lowercase;
41 using lyx::support::ExpandPath;
42 using lyx::support::GetEnv;
43 using lyx::support::LibFileSearch;
44 using lyx::support::token;
57 // when adding something to this array keep it sorted!
58 keyword_item lyxrcTags[] = {
59 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
60 { "\\alternate_language", LyXRC::RC_ALT_LANG },
61 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
62 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
63 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
64 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
65 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
66 { "\\autosave", LyXRC::RC_AUTOSAVE },
67 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
68 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
69 { "\\bind_file", LyXRC::RC_BINDFILE },
70 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
71 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
72 { "\\converter", LyXRC::RC_CONVERTER },
73 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
74 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
75 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
76 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
77 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
78 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
79 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
80 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
81 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
82 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
83 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
84 { "\\format", LyXRC::RC_FORMAT },
85 { "\\input", LyXRC::RC_INPUT },
86 { "\\kbmap", LyXRC::RC_KBMAP },
87 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
88 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
89 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
90 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
91 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
92 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
93 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
94 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
95 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
96 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
97 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
98 { "\\lastfiles", LyXRC::RC_LASTFILES },
99 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
100 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
101 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
102 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
103 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
104 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
105 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
106 { "\\preview", LyXRC::RC_PREVIEW },
107 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
108 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
109 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
110 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
111 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
112 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
113 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
114 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
115 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
116 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
117 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
118 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
119 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
120 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
121 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
122 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
123 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
124 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
125 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
126 { "\\printer", LyXRC::RC_PRINTER },
127 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
128 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
129 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
130 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
131 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
132 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
133 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
134 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
135 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
136 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
137 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
138 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
139 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
140 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
141 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
142 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
143 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
144 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
145 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
146 { "\\set_color", LyXRC::RC_SET_COLOR },
147 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
148 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
149 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
150 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
151 { "\\ui_file", LyXRC::RC_UIFILE },
152 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
153 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
154 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
155 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
156 // compatibility with versions older than 1.4.0 only
157 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
158 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
159 // compatibility with versions older than 1.4.0 only
160 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
161 { "\\user_email", LyXRC::RC_USER_EMAIL },
162 { "\\user_name", LyXRC::RC_USER_NAME },
163 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
164 // compatibility with versions older than 1.4.0 only
165 { "\\viewer" ,LyXRC::RC_VIEWER},
166 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
169 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
180 void LyXRC::setDefaults() {
183 // Get printer from the environment. If fail, use default "",
184 // assuming that everything is set up correctly.
185 printer = GetEnv("PRINTER");
186 print_adapt_output = false;
187 print_command = "dvips";
188 print_evenpage_flag = "-B";
189 print_oddpage_flag = "-A";
190 print_pagerange_flag = "-pp";
191 print_copies_flag = "-c";
192 print_collcopies_flag = "-C";
193 print_reverse_flag = "-r";
194 print_landscape_flag = "-t landscape";
195 print_to_printer = "-P";
196 print_to_file = "-o ";
197 print_file_extension = ".ps";
198 print_paper_flag = "-t";
199 print_paper_dimension_flag = "-T";
200 document_path.erase();
201 tempdir_path = "/tmp";
202 view_dvi_paper_option.erase();
203 default_papersize = PAPER_USLETTER;
204 custom_export_format = "ps";
205 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
206 bibtex_command = "bibtex";
209 // Because a screen typically is wider than a piece of paper:
212 // Default LaTeX font size:
213 font_sizes[LyXFont::SIZE_TINY] = 5.0;
214 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
215 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
216 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
217 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
218 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
219 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
220 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
221 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
222 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
223 use_scalable_fonts = true;
224 roman_font_name = "";
226 typewriter_font_name = "";
227 popup_bold_font = "-*-helvetica-bold-r";
228 popup_normal_font = "-*-helvetica-medium-r";
229 font_norm = "iso8859-1";
230 font_norm_type = ISO_8859_1;
231 popup_font_encoding.erase();
233 auto_region_delete = true;
234 auto_reset_options = false;
237 check_lastfiles = true;
239 backupdir_path.erase();
240 display_graphics = lyx::graphics::ColorDisplay;
241 // Spellchecker settings:
242 use_spell_lib = true;
243 isp_command = "ispell";
244 isp_accept_compound = false;
245 isp_use_input_encoding = false;
246 isp_use_alt_lang = false;
247 isp_use_pers_dict = false;
248 isp_use_esc_chars = false;
252 mark_foreign_language = true;
253 language_auto_begin = true;
254 language_auto_end = true;
255 language_global_options = true;
256 language_use_babel = true;
257 language_package = "\\usepackage{babel}";
258 language_command_begin = "\\selectlanguage{$$lang}";
259 language_command_local = "\\foreignlanguage{$$lang}{";
260 default_language = "english";
264 date_insert_format = "%A, %e %B %Y";
265 cursor_follows_scrollbar = false;
266 dialogs_iconify_with_main = false;
267 label_init_length = 3;
268 preview = PREVIEW_OFF;
269 preview_hashed_labels = false;
270 preview_scale_factor = 0.9;
272 user_name = lyx::support::user_name();
274 user_email = lyx::support::user_email();
280 void oldFontFormat(string & family, string & foundry)
282 if (family.empty() || family[0] != '-')
284 foundry = token(family, '-', 1);
285 family = token(family, '-', 2);
293 int LyXRC::read(string const & filename)
295 LyXLex lexrc(lyxrcTags, lyxrcCount);
296 if (lyxerr.debugging(Debug::PARSER))
297 lexrc.printTable(lyxerr);
299 lexrc.setFile(filename);
300 if (!lexrc.isOK()) return -2;
302 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
308 int LyXRC::read(std::istream & is)
310 LyXLex lexrc(lyxrcTags, lyxrcCount);
311 if (lyxerr.debugging(Debug::PARSER))
312 lexrc.printTable(lyxerr);
315 if (!lexrc.isOK()) return -2;
317 lyxerr[Debug::LYXRC] << "Reading istream..." << endl;
323 int LyXRC::read(LyXLex & lexrc)
325 if (!lexrc.isOK()) return -2;
327 while (lexrc.isOK()) {
328 // By using two switches we take advantage of the compiler
329 // telling us if we have missed a LyXRCTags element in
330 // the second switch.
331 // Note that this also shows a problem with LyXLex since it
332 // helps us avoid taking advantage of the strictness of the
335 int le = lexrc.lex();
337 case LyXLex::LEX_UNDEF:
338 lexrc.printError("Unknown tag `$$Token'");
340 case LyXLex::LEX_FEOF:
344 switch (static_cast<LyXRCTags>(le)) {
345 case RC_INPUT: // Include file
348 LibFileSearch(string(),
351 lexrc.printError("Error reading "
352 "included file: "+tmp);
356 case RC_BINDFILE: // RVDK_PATCH_5
358 bind_file = lexrc.getString();
364 ui_file = lexrc.getString();
368 case RC_AUTORESET_OPTIONS:
370 auto_reset_options = lexrc.getBool();
374 case RC_DISPLAY_GRAPHICS:
376 display_graphics = lyx::graphics::displayTranslator().find(lexrc.getString());
382 use_kbmap = lexrc.getBool();
386 case RC_KBMAP_PRIMARY:
388 string const kmap(lexrc.getString());
391 } else if (!LibFileSearch("kbd", kmap,
393 primary_kbmap = kmap;
395 lexrc.printError("LyX: Keymap `$$Token' not found");
400 case RC_KBMAP_SECONDARY:
402 string const kmap(lexrc.getString());
405 } else if (!LibFileSearch("kbd", kmap,
407 secondary_kbmap = kmap;
409 lexrc.printError("LyX: Keymap `$$Token' not found");
414 case RC_FONT_ENCODING:
416 fontenc = lexrc.getString();
422 printer = lexrc.getString();
426 case RC_PRINT_COMMAND:
428 print_command = lexrc.getString();
432 case RC_PRINTEVENPAGEFLAG:
434 print_evenpage_flag = lexrc.getString();
438 case RC_PRINTODDPAGEFLAG:
440 print_oddpage_flag = lexrc.getString();
444 case RC_PRINTPAGERANGEFLAG:
446 print_pagerange_flag = lexrc.getString();
450 case RC_PRINTCOPIESFLAG:
452 print_copies_flag = lexrc.getString();
456 case RC_PRINTCOLLCOPIESFLAG:
458 print_collcopies_flag = lexrc.getString();
462 case RC_PRINTREVERSEFLAG:
464 print_reverse_flag = lexrc.getString();
468 case RC_PRINTLANDSCAPEFLAG:
470 print_landscape_flag = lexrc.getString();
474 case RC_PRINTTOPRINTER:
476 print_to_printer = lexrc.getString();
480 case RC_PRINT_ADAPTOUTPUT:
482 print_adapt_output = lexrc.getBool();
488 print_to_file = lexrc.getString();
492 case RC_PRINTFILEEXTENSION:
494 print_file_extension = lexrc.getString();
498 case RC_PRINTEXSTRAOPTIONS:
500 print_extra_options = lexrc.getString();
504 case RC_PRINTSPOOL_COMMAND:
506 print_spool_command = lexrc.getString();
510 case RC_PRINTSPOOL_PRINTERPREFIX:
512 print_spool_printerprefix = lexrc.getString();
516 case RC_PRINTPAPERDIMENSIONFLAG:
518 print_paper_dimension_flag = lexrc.getString();
522 case RC_PRINTPAPERFLAG:
524 print_paper_flag = lexrc.getString();
528 case RC_CUSTOM_EXPORT_COMMAND:
530 custom_export_command = lexrc.getString();
534 case RC_CUSTOM_EXPORT_FORMAT:
536 custom_export_format = lexrc.getString();
540 case RC_DEFAULT_PAPERSIZE:
543 ascii_lowercase(lexrc.getString());
544 if (size == "usletter")
547 else if (size == "legal")
550 else if (size == "executive")
552 PAPER_EXECUTIVEPAPER;
553 else if (size == "a3")
556 else if (size == "a4")
559 else if (size == "a5")
562 else if (size == "b5")
568 case RC_VIEWDVI_PAPEROPTION:
570 view_dvi_paper_option = lexrc.getString();
572 view_dvi_paper_option.erase();
576 case RC_CHKTEX_COMMAND:
578 chktex_command = lexrc.getString();
582 case RC_BIBTEX_COMMAND:
584 bibtex_command = lexrc.getString();
590 dpi = lexrc.getInteger();
596 zoom = lexrc.getInteger();
602 wheel_jump = lexrc.getInteger();
606 case RC_SCREEN_FONT_SIZES:
608 font_sizes[LyXFont::SIZE_TINY] =
612 font_sizes[LyXFont::SIZE_SCRIPT] =
616 font_sizes[LyXFont::SIZE_FOOTNOTE] =
620 font_sizes[LyXFont::SIZE_SMALL] =
624 font_sizes[LyXFont::SIZE_NORMAL] =
628 font_sizes[LyXFont::SIZE_LARGE] =
632 font_sizes[LyXFont::SIZE_LARGER] =
636 font_sizes[LyXFont::SIZE_LARGEST] =
640 font_sizes[LyXFont::SIZE_HUGE] =
644 font_sizes[LyXFont::SIZE_HUGER] =
649 case RC_SCREEN_FONT_SCALABLE:
651 use_scalable_fonts = lexrc.getBool();
657 autosave = lexrc.getInteger();
661 case RC_DOCUMENTPATH:
663 document_path = ExpandPath(lexrc.getString());
667 case RC_TEMPLATEPATH:
669 template_path = ExpandPath(lexrc.getString());
675 tempdir_path = ExpandPath(lexrc.getString());
681 lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
687 lastfiles = ExpandPath(lexrc.getString());
691 case RC_NUMLASTFILES:
693 num_lastfiles = lexrc.getInteger();
697 case RC_CHECKLASTFILES:
699 check_lastfiles = lexrc.getBool();
703 case RC_SCREEN_FONT_ROMAN:
705 roman_font_name = lexrc.getString();
706 oldFontFormat(roman_font_name,
711 case RC_SCREEN_FONT_SANS:
713 sans_font_name = lexrc.getString();
714 oldFontFormat(sans_font_name, sans_font_foundry);
718 case RC_SCREEN_FONT_TYPEWRITER:
720 typewriter_font_name = lexrc.getString();
721 oldFontFormat(typewriter_font_name,
722 typewriter_font_foundry);
726 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
728 roman_font_foundry = lexrc.getString();
732 case RC_SCREEN_FONT_SANS_FOUNDRY:
734 sans_font_foundry = lexrc.getString();
738 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
740 typewriter_font_foundry = lexrc.getString();
744 case RC_SCREEN_FONT_ENCODING:
746 font_norm = lexrc.getString();
747 set_font_norm_type();
751 case RC_POPUP_BOLD_FONT:
753 popup_bold_font = lexrc.getString();
757 case RC_POPUP_NORMAL_FONT:
759 popup_normal_font = lexrc.getString();
763 case RC_POPUP_FONT_ENCODING:
765 popup_font_encoding = lexrc.getString();
771 string lyx_name, x11_name;
774 lyx_name = lexrc.getString();
776 lexrc.printError("Missing color tag.");
781 x11_name = lexrc.getString();
783 lexrc.printError("Missing color name for color: `$$Token'");
787 LColor::color const col =
788 lcolor.getFromLyXName(lyx_name);
789 if (col == LColor::none ||
790 col == LColor::inherit ||
791 col == LColor::ignore)
794 if (!lcolor.setColor(col, x11_name)) {
795 lyxerr << "Bad lyxrc set_color for "
801 case RC_AUTOREGIONDELETE:
802 // Auto region delete defaults to true
804 auto_region_delete = lexrc.getBool();
810 lyxpipes = ExpandPath(lexrc.getString());
814 case RC_CURSOR_FOLLOWS_SCROLLBAR:
816 cursor_follows_scrollbar = lexrc.getBool();
820 case RC_DIALOGS_ICONIFY_WITH_MAIN:
822 dialogs_iconify_with_main = lexrc.getBool();
826 case RC_ASCIIROFF_COMMAND:
828 ascii_roff_command = lexrc.getString();
831 case RC_ASCII_LINELEN:
833 ascii_linelen = lexrc.getInteger();
836 // Spellchecker settings:
837 case RC_USE_SPELL_LIB:
839 use_spell_lib = lexrc.getBool();
842 case RC_SPELL_COMMAND:
844 isp_command = lexrc.getString();
847 case RC_ACCEPT_COMPOUND:
849 isp_accept_compound = lexrc.getBool();
854 isp_use_input_encoding = lexrc.getBool();
857 case RC_USE_ALT_LANG:
859 isp_use_alt_lang = lexrc.getBool();
862 case RC_USE_PERS_DICT:
864 isp_use_pers_dict = lexrc.getBool();
867 case RC_USE_ESC_CHARS:
869 isp_use_esc_chars = lexrc.getBool();
874 isp_alt_lang = lexrc.getString();
879 isp_pers_dict = lexrc.getString();
884 isp_esc_chars = lexrc.getString();
889 make_backup = lexrc.getBool();
892 case RC_BACKUPDIR_PATH:
894 backupdir_path = ExpandPath(lexrc.getString());
897 case RC_DATE_INSERT_FORMAT:
899 date_insert_format = lexrc.getString();
902 case RC_LANGUAGE_PACKAGE:
904 language_package = lexrc.getString();
907 case RC_LANGUAGE_AUTO_BEGIN:
909 language_auto_begin = lexrc.getBool();
912 case RC_LANGUAGE_AUTO_END:
914 language_auto_end = lexrc.getBool();
917 case RC_LANGUAGE_GLOBAL_OPTIONS:
919 language_global_options = lexrc.getBool();
922 case RC_LANGUAGE_USE_BABEL:
924 language_use_babel = lexrc.getBool();
927 case RC_LANGUAGE_COMMAND_BEGIN:
929 language_command_begin = lexrc.getString();
932 case RC_LANGUAGE_COMMAND_END:
934 language_command_end = lexrc.getString();
937 case RC_LANGUAGE_COMMAND_LOCAL:
939 language_command_local = lexrc.getString();
944 rtl_support = lexrc.getBool();
949 auto_number = lexrc.getBool();
952 case RC_MARK_FOREIGN_LANGUAGE:
954 mark_foreign_language = lexrc.getBool();
959 string from, to, command, flags;
961 from = lexrc.getString();
964 to = lexrc.getString();
967 command = lexrc.getString();
970 flags = lexrc.getString();
973 || token(command, ' ', 0) == "none") {
974 converters.erase(from, to);
976 converters.add(from, to, command, flags);
980 // compatibility with versions older than 1.4.0 only
982 string format, command;
984 format = lexrc.getString();
987 command = lexrc.getString();
988 if (token(command, ' ', 0) == "none")
991 formats.setViewer(format, command);
995 string format, extension, prettyname, shortcut;
997 format = lexrc.getString();
1000 extension = lexrc.getString();
1003 prettyname = lexrc.getString();
1006 shortcut = lexrc.getString();
1008 string viewer, editor;
1009 // Hack to ensure compatibility with versions older
1011 int le = lexrc.lex();
1012 if (le != LyXLex::LEX_FEOF && le != LyXLex::LEX_UNDEF) {
1013 viewer = lexrc.getString();
1014 if (le == LyXLex::LEX_DATA) {
1015 if (token(viewer, ' ', 0) == "none")
1018 editor = lexrc.getString();
1019 if (token(editor, ' ', 0) == "none")
1023 // We have got a known token.
1024 // Therefore this is an old style
1025 // format definition without
1026 // viewer and editor.
1027 lexrc.pushToken(viewer);
1031 if (prettyname.empty()) {
1032 if (converters.formatIsUsed(format)) {
1033 lyxerr << "Can't delete format "
1036 formats.erase(format);
1039 formats.add(format, extension, prettyname,
1040 shortcut, viewer, editor);
1044 case RC_DEFAULT_LANGUAGE:
1046 default_language = lexrc.getString();
1050 case RC_LABEL_INIT_LENGTH:
1052 label_init_length = lexrc.getInteger();
1056 case RC_SHOW_BANNER:
1058 show_banner = lexrc.getBool();
1064 string const tmp = lexrc.getString();
1065 if (tmp == "true" || tmp == "on")
1066 preview = PREVIEW_ON;
1067 else if (tmp == "no_math")
1068 preview = PREVIEW_NO_MATH;
1070 preview = PREVIEW_OFF;
1071 if (tmp != "false" && tmp != "off")
1072 lyxerr << "Unrecognized "
1074 << tmp << '\n' << endl;
1079 case RC_PREVIEW_HASHED_LABELS:
1081 preview_hashed_labels = lexrc.getBool();
1085 case RC_PREVIEW_SCALE_FACTOR:
1087 preview_scale_factor = lexrc.getFloat();
1093 user_name = lexrc.getString();
1098 user_email = lexrc.getString();
1101 case RC_LAST: break; // this is just a dummy
1105 /// Update converters data-structures
1106 converters.update(formats);
1107 converters.buildGraph();
1113 void LyXRC::write(string const & filename, bool ignore_system_lyxrc) const
1115 ofstream ofs(filename.c_str());
1117 write(ofs, ignore_system_lyxrc);
1121 void LyXRC::print() const
1123 if (lyxerr.debugging())
1124 write(lyxerr, false);
1130 void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
1132 os << "### This file is part of\n"
1133 << "### ========================================================\n"
1134 << "### LyX, The Document Processor\n"
1136 << "### Copyright 1995 Matthias Ettrich\n"
1137 << "### Copyright 1995-2001 The LyX Team.\n"
1139 << "### ========================================================\n"
1141 << "# This file is written by LyX, if you want to make your own\n"
1142 << "# modifications you should do them from inside LyX and save\n"
1145 // Why the switch you might ask. It is a trick to ensure that all
1146 // the elements in the LyXRCTags enum is handled. As you can see
1147 // there are no breaks at all. So it is just a huge fall-through.
1148 // The nice thing is that we will get a warning from the compiler
1149 // if we forget an element.
1150 LyXRCTags tag = RC_LAST;
1154 // input/include files are not done here
1156 if (ignore_system_lyxrc ||
1157 bind_file != system_lyxrc.bind_file) {
1158 os << "\\bind_file " << bind_file << "\n";
1164 << "# MISC SECTION ######################################\n"
1167 // bind files are not done here.
1169 if (ignore_system_lyxrc ||
1170 ui_file != system_lyxrc.ui_file) {
1171 os << "\\ui_file \"" << ui_file << "\"\n";
1173 case RC_AUTOREGIONDELETE:
1174 if (ignore_system_lyxrc ||
1175 auto_region_delete != system_lyxrc.auto_region_delete) {
1176 os << "# Set to false to inhibit automatic replacement of\n"
1177 << "# the current selection.\n"
1178 << "\\auto_region_delete " << tostr(auto_region_delete)
1181 case RC_AUTORESET_OPTIONS:
1182 if (ignore_system_lyxrc ||
1183 auto_reset_options != system_lyxrc.auto_reset_options) {
1184 os << "# Set to false to inhibit automatic reset of\n"
1185 << "# the class options to defaults on class change.\n"
1186 << "\\auto_reset_options " << tostr(auto_reset_options)
1190 if (ignore_system_lyxrc ||
1191 autosave != system_lyxrc.autosave) {
1192 os << "# The time interval between auto-saves in seconds.\n"
1193 << "\\autosave " << autosave << '\n';
1195 case RC_DISPLAY_GRAPHICS:
1196 if (ignore_system_lyxrc ||
1197 display_graphics != system_lyxrc.display_graphics) {
1198 os << "# Display graphics within LyX\n"
1199 << "# monochrome|grayscale|color|none\n"
1200 << "\\display_graphics "
1201 << lyx::graphics::displayTranslator().find(display_graphics)
1205 case RC_VIEWDVI_PAPEROPTION:
1206 if (ignore_system_lyxrc ||
1207 view_dvi_paper_option
1208 != system_lyxrc.view_dvi_paper_option) {
1209 os << "# Options used to specify paper size to the\n"
1210 << "# view_dvi_command (e.g. -paper)\n"
1211 << "\\view_dvi_paper_option \""
1212 << view_dvi_paper_option << "\"\n";
1214 case RC_DEFAULT_PAPERSIZE:
1215 if (ignore_system_lyxrc ||
1216 default_papersize != system_lyxrc.default_papersize) {
1217 os << "# The default papersize to use.\n"
1218 << "\\default_papersize \"";
1219 switch (default_papersize) {
1220 case PAPER_USLETTER:
1221 os << "usletter"; break;
1222 case PAPER_LEGALPAPER:
1223 os << "legal"; break;
1224 case PAPER_EXECUTIVEPAPER:
1225 os << "executive"; break;
1234 case PAPER_DEFAULT: break;
1238 case RC_CHKTEX_COMMAND:
1239 if (ignore_system_lyxrc ||
1240 chktex_command != system_lyxrc.chktex_command) {
1241 os << "\\chktex_command \"" << chktex_command << "\"\n";
1243 case RC_BIBTEX_COMMAND:
1244 if (ignore_system_lyxrc ||
1245 bibtex_command != system_lyxrc.bibtex_command) {
1246 os << "\\bibtex_command \"" << bibtex_command << "\"\n";
1249 if (ignore_system_lyxrc ||
1250 use_kbmap != system_lyxrc.use_kbmap) {
1251 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1253 case RC_KBMAP_PRIMARY:
1254 if (ignore_system_lyxrc ||
1255 primary_kbmap != system_lyxrc.primary_kbmap) {
1256 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1258 case RC_KBMAP_SECONDARY:
1259 if (ignore_system_lyxrc ||
1260 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1261 os << "\\kbmap_secondary \"" << secondary_kbmap
1265 if (ignore_system_lyxrc ||
1266 lyxpipes != system_lyxrc.lyxpipes) {
1267 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1269 case RC_DATE_INSERT_FORMAT:
1270 if (ignore_system_lyxrc ||
1271 date_insert_format != system_lyxrc.date_insert_format) {
1272 os << "\\date_insert_format \"" << date_insert_format
1275 case RC_LABEL_INIT_LENGTH:
1276 if (ignore_system_lyxrc ||
1277 label_init_length != system_lyxrc.label_init_length) {
1278 os << "\\label_init_length " << label_init_length
1283 os << "\\user_name \"" << user_name << "\"\n";
1286 os << "\\user_email \"" << user_email << "\"\n";
1288 case RC_SHOW_BANNER:
1289 if (ignore_system_lyxrc ||
1290 show_banner != system_lyxrc.show_banner) {
1291 os << "\\show_banner " << tostr(show_banner) << '\n';
1295 if (ignore_system_lyxrc ||
1296 preview != system_lyxrc.preview) {
1302 case PREVIEW_NO_MATH:
1309 os << "\\preview " << status << '\n';
1312 case RC_PREVIEW_HASHED_LABELS:
1313 if (ignore_system_lyxrc ||
1314 preview_hashed_labels !=
1315 system_lyxrc.preview_hashed_labels) {
1316 os << "\\preview_hashed_labels "
1317 << tostr(preview_hashed_labels) << '\n';
1320 case RC_PREVIEW_SCALE_FACTOR:
1321 if (ignore_system_lyxrc ||
1322 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1323 os << "\\preview_scale_factor "
1324 << preview_scale_factor << '\n';
1328 << "# SCREEN & FONTS SECTION ############################\n"
1331 case RC_POPUP_NORMAL_FONT:
1332 if (ignore_system_lyxrc ||
1333 popup_normal_font != system_lyxrc.popup_normal_font) {
1334 os << "\\popup_normal_font \"" << popup_normal_font
1337 case RC_POPUP_BOLD_FONT:
1338 if (ignore_system_lyxrc ||
1339 popup_bold_font != system_lyxrc.popup_bold_font) {
1340 os << "\\popup_bold_font \"" << popup_bold_font
1343 case RC_POPUP_FONT_ENCODING:
1344 if (ignore_system_lyxrc ||
1345 popup_font_encoding != system_lyxrc.popup_font_encoding) {
1346 os << "\\popup_font_encoding \"" << popup_font_encoding
1350 if (ignore_system_lyxrc ||
1351 dpi != system_lyxrc.dpi) {
1352 os << "\\screen_dpi " << dpi << '\n';
1354 case RC_SCREEN_ZOOM:
1355 if (ignore_system_lyxrc ||
1356 zoom != system_lyxrc.zoom) {
1357 os << "\\screen_zoom " << zoom << '\n';
1360 if (ignore_system_lyxrc ||
1361 wheel_jump != system_lyxrc.wheel_jump) {
1362 os << "\\wheel_jump " << wheel_jump << '\n';
1364 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1365 if (ignore_system_lyxrc ||
1366 cursor_follows_scrollbar
1367 != system_lyxrc.cursor_follows_scrollbar) {
1368 os << "\\cursor_follows_scrollbar "
1369 << tostr(cursor_follows_scrollbar) << '\n';
1371 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1372 if (ignore_system_lyxrc ||
1373 dialogs_iconify_with_main
1374 != system_lyxrc.dialogs_iconify_with_main) {
1375 os << "\\dialogs_iconify_with_main "
1376 << tostr(dialogs_iconify_with_main) << '\n';
1378 case RC_SCREEN_FONT_ROMAN:
1379 if (ignore_system_lyxrc ||
1380 roman_font_name != system_lyxrc.roman_font_name) {
1381 os << "\\screen_font_roman \"" << roman_font_name
1384 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1385 if (ignore_system_lyxrc ||
1386 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1387 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1390 case RC_SCREEN_FONT_SANS:
1391 if (ignore_system_lyxrc ||
1392 sans_font_name != system_lyxrc.sans_font_name) {
1393 os << "\\screen_font_sans \"" << sans_font_name
1396 case RC_SCREEN_FONT_SANS_FOUNDRY:
1397 if (ignore_system_lyxrc ||
1398 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1399 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1402 case RC_SCREEN_FONT_TYPEWRITER:
1403 if (ignore_system_lyxrc ||
1404 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1405 os << "\\screen_font_typewriter \""
1406 << typewriter_font_name << "\"\n";
1408 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1409 if (ignore_system_lyxrc ||
1410 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1411 os << "\\screen_font_typewriter_foundry \""
1412 << typewriter_font_foundry << "\"\n";
1415 case RC_SCREEN_FONT_SCALABLE:
1416 if (ignore_system_lyxrc ||
1417 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1418 os << "\\screen_font_scalable "
1419 << tostr(use_scalable_fonts)
1422 case RC_SCREEN_FONT_ENCODING:
1423 if (ignore_system_lyxrc ||
1424 font_norm != system_lyxrc.font_norm) {
1425 os << "\\screen_font_encoding \"" << font_norm
1428 case RC_SCREEN_FONT_SIZES:
1429 if (ignore_system_lyxrc ||
1430 font_sizes[LyXFont::SIZE_TINY]
1431 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1432 font_sizes[LyXFont::SIZE_SCRIPT]
1433 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1434 font_sizes[LyXFont::SIZE_FOOTNOTE]
1435 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1436 font_sizes[LyXFont::SIZE_SMALL]
1437 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1438 font_sizes[LyXFont::SIZE_NORMAL]
1439 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1440 font_sizes[LyXFont::SIZE_LARGE]
1441 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1442 font_sizes[LyXFont::SIZE_LARGER]
1443 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1444 font_sizes[LyXFont::SIZE_LARGEST]
1445 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1446 font_sizes[LyXFont::SIZE_HUGE]
1447 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1448 font_sizes[LyXFont::SIZE_HUGER]
1449 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1450 os.setf(ios::fixed);
1452 os << "\\screen_font_sizes"
1453 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1454 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1455 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1456 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1457 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1458 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1459 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1460 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1461 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1462 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1467 << "# COLOR SECTION ###################################\n"
1471 for (int i = 0; i < LColor::ignore; ++i) {
1472 LColor::color lc = static_cast<LColor::color>(i);
1474 string const col(lcolor.getX11Name(lc));
1475 if (ignore_system_lyxrc ||
1476 col != system_lcolor.getX11Name(lc)) {
1477 os << "\\set_color \""
1478 << lcolor.getLyXName(lc) << "\" \""
1484 << "# PRINTER SECTION ###################################\n"
1488 if (ignore_system_lyxrc ||
1489 printer != system_lyxrc.printer) {
1490 os << "\\printer \"" << printer << "\"\n";
1492 case RC_PRINT_ADAPTOUTPUT:
1493 if (ignore_system_lyxrc ||
1494 print_adapt_output != system_lyxrc.print_adapt_output) {
1495 os << "\\print_adapt_output "
1496 << tostr(print_adapt_output)
1499 case RC_PRINT_COMMAND:
1500 if (ignore_system_lyxrc ||
1501 print_command != system_lyxrc.print_command) {
1502 os << "\\print_command \"" << print_command << "\"\n";
1504 case RC_PRINTEXSTRAOPTIONS:
1505 if (ignore_system_lyxrc ||
1506 print_extra_options != system_lyxrc.print_extra_options) {
1507 os << "\\print_extra_options \"" << print_extra_options
1510 case RC_PRINTSPOOL_COMMAND:
1511 if (ignore_system_lyxrc ||
1512 print_spool_command != system_lyxrc.print_spool_command) {
1513 os << "\\print_spool_command \"" << print_spool_command
1516 case RC_PRINTSPOOL_PRINTERPREFIX:
1517 if (ignore_system_lyxrc ||
1518 print_spool_printerprefix
1519 != system_lyxrc.print_spool_printerprefix) {
1520 os << "\\print_spool_printerprefix \""
1521 << print_spool_printerprefix << "\"\n";
1523 case RC_PRINTEVENPAGEFLAG:
1524 if (ignore_system_lyxrc ||
1525 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1526 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1529 case RC_PRINTODDPAGEFLAG:
1530 if (ignore_system_lyxrc ||
1531 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1532 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1535 case RC_PRINTREVERSEFLAG:
1536 if (ignore_system_lyxrc ||
1537 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1538 os << "\\print_reverse_flag \"" << print_reverse_flag
1541 case RC_PRINTLANDSCAPEFLAG:
1542 if (ignore_system_lyxrc ||
1543 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1544 os << "\\print_landscape_flag \"" << print_landscape_flag
1547 case RC_PRINTPAGERANGEFLAG:
1548 if (ignore_system_lyxrc ||
1549 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1550 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1553 case RC_PRINTCOPIESFLAG:
1554 if (ignore_system_lyxrc ||
1555 print_copies_flag != system_lyxrc.print_copies_flag) {
1556 os << "\\print_copies_flag \"" << print_copies_flag
1559 case RC_PRINTCOLLCOPIESFLAG:
1560 if (ignore_system_lyxrc ||
1561 print_collcopies_flag
1562 != system_lyxrc.print_collcopies_flag) {
1563 os << "\\print_collcopies_flag \""
1564 << print_collcopies_flag
1567 case RC_PRINTPAPERFLAG:
1568 if (ignore_system_lyxrc ||
1569 print_paper_flag != system_lyxrc.print_paper_flag) {
1570 os << "\\print_paper_flag \"" << print_paper_flag
1573 case RC_PRINTPAPERDIMENSIONFLAG:
1574 if (ignore_system_lyxrc ||
1575 print_paper_dimension_flag
1576 != system_lyxrc.print_paper_dimension_flag) {
1577 os << "\\print_paper_dimension_flag \""
1578 << print_paper_dimension_flag << "\"\n";
1580 case RC_PRINTTOPRINTER:
1581 if (ignore_system_lyxrc ||
1582 print_to_printer != system_lyxrc.print_to_printer) {
1583 os << "\\print_to_printer \"" << print_to_printer
1586 case RC_PRINTTOFILE:
1587 if (ignore_system_lyxrc ||
1588 print_to_file != system_lyxrc.print_to_file) {
1589 os << "\\print_to_file \"" << print_to_file << "\"\n";
1591 case RC_PRINTFILEEXTENSION:
1592 if (ignore_system_lyxrc ||
1593 print_file_extension != system_lyxrc.print_file_extension) {
1594 os << "\\print_file_extension \""
1595 << print_file_extension
1600 << "# EXPORT SECTION ####################################\n"
1603 case RC_CUSTOM_EXPORT_COMMAND:
1604 if (ignore_system_lyxrc ||
1605 custom_export_command
1606 != system_lyxrc.custom_export_command) {
1607 os << "\\custom_export_command \""
1608 << custom_export_command
1611 case RC_CUSTOM_EXPORT_FORMAT:
1612 if (ignore_system_lyxrc ||
1613 custom_export_format
1614 != system_lyxrc.custom_export_format) {
1615 os << "\\custom_export_format \"" << custom_export_format
1620 << "# TEX SECTION #######################################\n"
1623 case RC_FONT_ENCODING:
1624 if (ignore_system_lyxrc ||
1625 fontenc != system_lyxrc.fontenc) {
1626 os << "\\font_encoding \"" << fontenc << "\"\n";
1630 << "# FILE SECTION ######################################\n"
1633 case RC_DOCUMENTPATH:
1634 if (ignore_system_lyxrc ||
1635 document_path != system_lyxrc.document_path) {
1636 os << "\\document_path \"" << document_path << "\"\n";
1639 if (ignore_system_lyxrc ||
1640 lastfiles != system_lyxrc.lastfiles) {
1641 os << "\\lastfiles \"" << lastfiles << "\"\n";
1643 case RC_NUMLASTFILES:
1644 if (ignore_system_lyxrc ||
1645 num_lastfiles != system_lyxrc.num_lastfiles) {
1646 os << "\\num_lastfiles " << num_lastfiles << '\n';
1648 case RC_CHECKLASTFILES:
1649 if (ignore_system_lyxrc ||
1650 check_lastfiles != system_lyxrc.check_lastfiles) {
1651 os << "\\check_lastfiles " << tostr(check_lastfiles)
1654 case RC_TEMPLATEPATH:
1655 if (ignore_system_lyxrc ||
1656 template_path != system_lyxrc.template_path) {
1657 os << "\\template_path \"" << template_path << "\"\n";
1659 case RC_TEMPDIRPATH:
1660 if (ignore_system_lyxrc ||
1661 tempdir_path != system_lyxrc.tempdir_path) {
1662 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1666 case RC_ASCII_LINELEN:
1667 if (ignore_system_lyxrc ||
1668 ascii_linelen != system_lyxrc.ascii_linelen) {
1669 os << "\\ascii_linelen " << ascii_linelen << '\n';
1671 case RC_MAKE_BACKUP:
1672 if (ignore_system_lyxrc ||
1673 make_backup != system_lyxrc.make_backup) {
1674 os << "\\make_backup " << tostr(make_backup) << '\n';
1676 case RC_BACKUPDIR_PATH:
1677 if (ignore_system_lyxrc ||
1678 backupdir_path != system_lyxrc.backupdir_path) {
1679 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1683 << "# ASCII EXPORT SECTION ##############################\n"
1686 case RC_ASCIIROFF_COMMAND:
1687 if (ignore_system_lyxrc ||
1688 ascii_roff_command != system_lyxrc.ascii_roff_command) {
1689 os << "\\ascii_roff_command \"" << ascii_roff_command
1694 << "# SPELLCHECKER SECTION ##############################\n"
1696 case RC_USE_SPELL_LIB:
1697 if (ignore_system_lyxrc ||
1698 use_spell_lib != system_lyxrc.use_spell_lib) {
1699 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1701 case RC_SPELL_COMMAND:
1702 if (ignore_system_lyxrc ||
1703 isp_command != system_lyxrc.isp_command) {
1704 os << "\\spell_command \"" << isp_command << "\"\n";
1706 case RC_ACCEPT_COMPOUND:
1707 if (ignore_system_lyxrc ||
1708 isp_accept_compound != system_lyxrc.isp_accept_compound) {
1709 os << "\\accept_compound " << tostr(isp_accept_compound)
1712 case RC_USE_ALT_LANG:
1713 if (ignore_system_lyxrc ||
1714 isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1715 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1719 if (ignore_system_lyxrc ||
1720 isp_alt_lang != system_lyxrc.isp_alt_lang) {
1721 os << "\\alternate_language \"" << isp_alt_lang
1724 case RC_USE_ESC_CHARS:
1725 if (ignore_system_lyxrc ||
1726 isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1727 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1731 if (ignore_system_lyxrc ||
1732 isp_esc_chars != system_lyxrc.isp_esc_chars) {
1733 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1735 case RC_USE_PERS_DICT:
1736 if (ignore_system_lyxrc ||
1737 isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1738 os << "\\use_personal_dictionary "
1739 << tostr(isp_use_pers_dict)
1743 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1744 os << "\\personal_dictionary \"" << isp_pers_dict
1747 case RC_USE_INP_ENC:
1748 if (ignore_system_lyxrc ||
1749 isp_use_input_encoding
1750 != system_lyxrc.isp_use_input_encoding) {
1751 os << "\\use_input_encoding "
1752 << tostr(isp_use_input_encoding)
1757 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1760 case RC_RTL_SUPPORT:
1761 if (ignore_system_lyxrc ||
1762 rtl_support != system_lyxrc.rtl_support) {
1763 os << "\\rtl " << tostr(rtl_support) << '\n';
1765 case RC_LANGUAGE_PACKAGE:
1766 if (ignore_system_lyxrc ||
1767 language_package != system_lyxrc.language_package) {
1768 os << "\\language_package \"" << language_package
1771 case RC_LANGUAGE_GLOBAL_OPTIONS:
1772 if (ignore_system_lyxrc ||
1773 language_global_options
1774 != system_lyxrc.language_global_options) {
1775 os << "\\language_global_options \""
1776 << tostr(language_global_options)
1779 case RC_LANGUAGE_USE_BABEL:
1780 if (ignore_system_lyxrc ||
1781 language_use_babel != system_lyxrc.language_use_babel) {
1782 os << "\\language_use_babel \""
1783 << tostr(language_use_babel)
1786 case RC_LANGUAGE_COMMAND_BEGIN:
1787 if (ignore_system_lyxrc ||
1788 language_command_begin
1789 != system_lyxrc.language_command_begin) {
1790 os << "\\language_command_begin \""
1791 << language_command_begin
1794 case RC_LANGUAGE_COMMAND_END:
1795 if (ignore_system_lyxrc ||
1796 language_command_end
1797 != system_lyxrc.language_command_end) {
1798 os << "\\language_command_end \"" << language_command_end
1801 case RC_LANGUAGE_COMMAND_LOCAL:
1802 if (ignore_system_lyxrc ||
1803 language_command_local
1804 != system_lyxrc.language_command_local) {
1805 os << "\\language_command_local \""
1806 << language_command_local
1809 case RC_LANGUAGE_AUTO_BEGIN:
1810 if (ignore_system_lyxrc ||
1811 language_auto_begin != system_lyxrc.language_auto_begin) {
1812 os << "\\language_auto_begin "
1813 << tostr(language_auto_begin) << '\n';
1815 case RC_LANGUAGE_AUTO_END:
1816 if (ignore_system_lyxrc ||
1817 language_auto_end != system_lyxrc.language_auto_end) {
1818 os << "\\language_auto_end "
1819 << tostr(language_auto_end) << '\n';
1821 case RC_MARK_FOREIGN_LANGUAGE:
1822 if (ignore_system_lyxrc ||
1823 mark_foreign_language
1824 != system_lyxrc.mark_foreign_language) {
1825 os << "\\mark_foreign_language " <<
1826 tostr(mark_foreign_language) << '\n';
1830 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1833 case RC_AUTO_NUMBER:
1834 if (ignore_system_lyxrc ||
1835 auto_number != system_lyxrc.auto_number) {
1836 os << "\\auto_number " << tostr(auto_number) << '\n';
1838 case RC_DEFAULT_LANGUAGE:
1839 if (ignore_system_lyxrc ||
1840 default_language != system_lyxrc.default_language) {
1841 os << "\\default_language " << default_language << '\n';
1845 << "# FORMATS SECTION ##########################\n"
1849 // New/modifed formats
1850 for (Formats::const_iterator cit = formats.begin();
1851 cit != formats.end(); ++cit) {
1852 Format const * format =
1853 system_formats.getFormat(cit->name());
1855 format->extension() != cit->extension() ||
1856 format->prettyname() != cit->prettyname() ||
1857 format->shortcut() != cit->shortcut() ||
1858 format->viewer() != cit->viewer() ||
1859 format->editor() != cit->editor())
1860 os << "\\format \"" << cit->name() << "\" \""
1861 << cit->extension() << "\" \""
1862 << cit->prettyname() << "\" \""
1863 << cit->shortcut() << "\" \""
1864 << cit->viewer() << "\" \""
1865 << cit->editor() << "\"\n";
1868 // Look for deleted formats
1869 for (Formats::const_iterator cit = system_formats.begin();
1870 cit != system_formats.end(); ++cit)
1871 if (!formats.getFormat(cit->name()))
1872 os << "\\format \"" << cit->name()
1873 << "\" \"\" \"\" \"\" \"\" \"\"\n";
1878 << "# CONVERTERS SECTION ##########################\n"
1882 // Look for new converters
1883 for (Converters::const_iterator cit = converters.begin();
1884 cit != converters.end(); ++cit) {
1885 Converter const * converter =
1886 system_converters.getConverter(cit->from,
1889 converter->command != cit->command ||
1890 converter->flags != cit->flags)
1891 os << "\\converter \"" << cit->from << "\" \""
1892 << cit->to << "\" \""
1893 << cit->command << "\" \""
1894 << cit->flags << "\"\n";
1897 // New/modifed converters
1898 for (Converters::const_iterator cit = system_converters.begin();
1899 cit != system_converters.end(); ++cit)
1900 if (!converters.getConverter(cit->from, cit->to))
1901 os << "\\converter \"" << cit->from
1902 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1908 void LyXRC::set_font_norm_type()
1910 if (font_norm == "iso10646-1")
1911 font_norm_type = ISO_10646_1;
1912 else if (font_norm == "iso8859-1")
1913 font_norm_type = ISO_8859_1;
1914 else if (font_norm == "iso8859-3")
1915 font_norm_type = ISO_8859_3;
1916 else if (font_norm == "iso8859-4")
1917 font_norm_type = ISO_8859_4;
1918 else if (font_norm == "iso8859-6.8x")
1919 font_norm_type = ISO_8859_6_8;
1920 else if (font_norm == "iso8859-9")
1921 font_norm_type = ISO_8859_9;
1922 else if (font_norm == "iso8859-15")
1923 font_norm_type = ISO_8859_15;
1925 font_norm_type = OTHER_ENCODING;
1929 string const LyXRC::getDescription(LyXRCTags tag)
1934 case RC_FONT_ENCODING:
1935 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1939 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1942 case RC_PRINT_COMMAND:
1943 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1946 case RC_PRINTEVENPAGEFLAG:
1947 str = _("The option to print only even pages.");
1950 case RC_PRINTODDPAGEFLAG:
1951 str = _("The option to print only odd pages.");
1954 case RC_PRINTPAGERANGEFLAG:
1955 str = _("The option for specifying a comma-separated list of pages to print.");
1958 case RC_PRINTCOPIESFLAG:
1959 str = _("The option for specifying the number of copies to print.");
1962 case RC_PRINTCOLLCOPIESFLAG:
1963 str = _("The option for specifying whether the copies should be collated.");
1966 case RC_PRINTREVERSEFLAG:
1967 str = _("The option to reverse the order of the pages printed.");
1970 case RC_PRINTLANDSCAPEFLAG:
1971 str = _("The option to print out in landscape.");
1974 case RC_PRINTPAPERFLAG:
1975 str = _("The option to specify paper type.");
1978 case RC_PRINTPAPERDIMENSIONFLAG:
1979 str = _("Option to specify the dimensions of the print paper.");
1982 case RC_PRINTTOPRINTER:
1983 str = _("Option to pass to the print program to print on a specific printer.");
1986 case RC_PRINT_ADAPTOUTPUT:
1987 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1990 case RC_PRINTTOFILE:
1991 str = _("Option to pass to the print program to print to a file.");
1994 case RC_PRINTFILEEXTENSION:
1995 str = _("Extension of printer program output file. Usually \".ps\".");
1998 case RC_PRINTEXSTRAOPTIONS:
1999 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2002 case RC_PRINTSPOOL_COMMAND:
2003 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.");
2006 case RC_PRINTSPOOL_PRINTERPREFIX:
2007 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.");
2011 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2014 case RC_SCREEN_ZOOM:
2015 //xgettext:no-c-format
2016 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2019 case RC_SCREEN_FONT_SIZES:
2020 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2023 case RC_SCREEN_FONT_ROMAN:
2024 case RC_SCREEN_FONT_SANS:
2025 case RC_SCREEN_FONT_TYPEWRITER:
2026 str = _("The screen fonts used to display the text while editing.");
2029 case RC_POPUP_BOLD_FONT:
2030 str = _("The bold font in the dialogs.");
2033 case RC_POPUP_NORMAL_FONT:
2034 str = _("The normal font in the dialogs.");
2037 case RC_SCREEN_FONT_ENCODING:
2038 str = _("The encoding for the screen fonts.");
2041 case RC_POPUP_FONT_ENCODING:
2042 str = _("The encoding for the menu/popups fonts.");
2049 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2052 case RC_DOCUMENTPATH:
2053 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2056 case RC_TEMPLATEPATH:
2057 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2060 case RC_TEMPDIRPATH:
2061 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2065 str = _("The file where the last-files information should be stored.");
2068 case RC_AUTOREGIONDELETE:
2069 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2072 case RC_AUTORESET_OPTIONS:
2073 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2077 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2081 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2085 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2089 case RC_KBMAP_PRIMARY:
2090 case RC_KBMAP_SECONDARY:
2091 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.");
2094 case RC_ASCIIROFF_COMMAND:
2095 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.");
2098 case RC_ASCII_LINELEN:
2099 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2102 case RC_NUMLASTFILES:
2103 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
2106 case RC_CHECKLASTFILES:
2107 str = _("Select to check whether the lastfiles still exist.");
2110 case RC_VIEWDVI_PAPEROPTION:
2111 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2114 case RC_DEFAULT_PAPERSIZE:
2115 str = _("Specify the default paper size.");
2118 case RC_ACCEPT_COMPOUND:
2119 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2122 case RC_SPELL_COMMAND:
2123 str = _("What command runs the spell checker?");
2126 case RC_USE_INP_ENC:
2127 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.");
2130 case RC_USE_ALT_LANG:
2132 str = _("Specify an alternate language. The default is to use the language of the document.");
2135 case RC_USE_PERS_DICT:
2137 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2140 case RC_USE_ESC_CHARS:
2142 str = _("Specify additional chars that can be part of a word.");
2145 case RC_SCREEN_FONT_SCALABLE:
2146 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.");
2149 case RC_CHKTEX_COMMAND:
2150 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2153 case RC_BIBTEX_COMMAND:
2154 str = _("Define the options of bibtex (cf. man bibtex) or select and alternative compiler (e.g. mlbibtex or bibulus).");
2157 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2158 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.");
2161 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2162 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2165 case RC_DISPLAY_GRAPHICS:
2166 str = _("Select how LyX will display any graphics.");
2169 case RC_MAKE_BACKUP:
2170 str = _("De-select if you don't want LyX to create backup files.");
2173 case RC_BACKUPDIR_PATH:
2174 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.");
2177 case RC_RTL_SUPPORT:
2178 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2181 case RC_MARK_FOREIGN_LANGUAGE:
2182 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2185 case RC_LANGUAGE_PACKAGE:
2186 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2189 case RC_LANGUAGE_GLOBAL_OPTIONS:
2190 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2193 case RC_LANGUAGE_USE_BABEL:
2194 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2197 case RC_LANGUAGE_AUTO_BEGIN:
2198 str = _("Select if a language switching command is needed at the beginning of the document.");
2201 case RC_LANGUAGE_AUTO_END:
2202 str = _("Select if a language switching command is needed at the end of the document.");
2205 case RC_LANGUAGE_COMMAND_BEGIN:
2206 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.");
2209 case RC_LANGUAGE_COMMAND_END:
2210 str = _("The LaTeX command for changing back to the language of the document.");
2213 case RC_LANGUAGE_COMMAND_LOCAL:
2214 str = _("The LaTeX command for local changing of the language.");
2217 case RC_DATE_INSERT_FORMAT:
2218 //xgettext:no-c-format
2219 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2222 case RC_SHOW_BANNER:
2223 str = _("De-select if you don't want the startup banner.");
2227 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2239 case RC_DEFAULT_LANGUAGE:
2240 str = _("New documents will be assigned this language.");
2243 case RC_LABEL_INIT_LENGTH:
2244 str = _("Maximum number of words in the initialization string for a new label");
2248 str = _("Shows a typeset preview of things such as math");
2251 case RC_PREVIEW_HASHED_LABELS:
2252 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2255 case RC_PREVIEW_SCALE_FACTOR:
2256 str = _("Scale the preview size to suit.");
2266 // The global instance
2269 // The global copy of the system lyxrc entries (everything except preferences)