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;
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();
276 if (user_email.empty())
277 user_email = _("email address unknown");
283 void oldFontFormat(string & family, string & foundry)
285 if (family.empty() || family[0] != '-')
287 foundry = token(family, '-', 1);
288 family = token(family, '-', 2);
296 int LyXRC::read(string const & filename)
298 LyXLex lexrc(lyxrcTags, lyxrcCount);
299 if (lyxerr.debugging(Debug::PARSER))
300 lexrc.printTable(lyxerr);
302 lexrc.setFile(filename);
303 if (!lexrc.isOK()) return -2;
305 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
311 int LyXRC::read(std::istream & is)
313 LyXLex lexrc(lyxrcTags, lyxrcCount);
314 if (lyxerr.debugging(Debug::PARSER))
315 lexrc.printTable(lyxerr);
318 if (!lexrc.isOK()) return -2;
320 lyxerr[Debug::LYXRC] << "Reading istream..." << endl;
326 int LyXRC::read(LyXLex & lexrc)
328 if (!lexrc.isOK()) return -2;
330 while (lexrc.isOK()) {
331 // By using two switches we take advantage of the compiler
332 // telling us if we have missed a LyXRCTags element in
333 // the second switch.
334 // Note that this also shows a problem with LyXLex since it
335 // helps us avoid taking advantage of the strictness of the
338 int le = lexrc.lex();
340 case LyXLex::LEX_UNDEF:
341 lexrc.printError("Unknown tag `$$Token'");
343 case LyXLex::LEX_FEOF:
347 switch (static_cast<LyXRCTags>(le)) {
348 case RC_INPUT: // Include file
351 LibFileSearch(string(),
354 lexrc.printError("Error reading "
355 "included file: "+tmp);
359 case RC_BINDFILE: // RVDK_PATCH_5
361 bind_file = lexrc.getString();
367 ui_file = lexrc.getString();
371 case RC_AUTORESET_OPTIONS:
373 auto_reset_options = lexrc.getBool();
377 case RC_DISPLAY_GRAPHICS:
379 display_graphics = lyx::graphics::displayTranslator().find(lexrc.getString());
385 use_kbmap = lexrc.getBool();
389 case RC_KBMAP_PRIMARY:
391 string const kmap(lexrc.getString());
394 } else if (!LibFileSearch("kbd", kmap,
396 primary_kbmap = kmap;
398 lexrc.printError("LyX: Keymap `$$Token' not found");
403 case RC_KBMAP_SECONDARY:
405 string const kmap(lexrc.getString());
408 } else if (!LibFileSearch("kbd", kmap,
410 secondary_kbmap = kmap;
412 lexrc.printError("LyX: Keymap `$$Token' not found");
417 case RC_FONT_ENCODING:
419 fontenc = lexrc.getString();
425 printer = lexrc.getString();
429 case RC_PRINT_COMMAND:
431 print_command = lexrc.getString();
435 case RC_PRINTEVENPAGEFLAG:
437 print_evenpage_flag = lexrc.getString();
441 case RC_PRINTODDPAGEFLAG:
443 print_oddpage_flag = lexrc.getString();
447 case RC_PRINTPAGERANGEFLAG:
449 print_pagerange_flag = lexrc.getString();
453 case RC_PRINTCOPIESFLAG:
455 print_copies_flag = lexrc.getString();
459 case RC_PRINTCOLLCOPIESFLAG:
461 print_collcopies_flag = lexrc.getString();
465 case RC_PRINTREVERSEFLAG:
467 print_reverse_flag = lexrc.getString();
471 case RC_PRINTLANDSCAPEFLAG:
473 print_landscape_flag = lexrc.getString();
477 case RC_PRINTTOPRINTER:
479 print_to_printer = lexrc.getString();
483 case RC_PRINT_ADAPTOUTPUT:
485 print_adapt_output = lexrc.getBool();
491 print_to_file = lexrc.getString();
495 case RC_PRINTFILEEXTENSION:
497 print_file_extension = lexrc.getString();
501 case RC_PRINTEXSTRAOPTIONS:
503 print_extra_options = lexrc.getString();
507 case RC_PRINTSPOOL_COMMAND:
509 print_spool_command = lexrc.getString();
513 case RC_PRINTSPOOL_PRINTERPREFIX:
515 print_spool_printerprefix = lexrc.getString();
519 case RC_PRINTPAPERDIMENSIONFLAG:
521 print_paper_dimension_flag = lexrc.getString();
525 case RC_PRINTPAPERFLAG:
527 print_paper_flag = lexrc.getString();
531 case RC_CUSTOM_EXPORT_COMMAND:
533 custom_export_command = lexrc.getString();
537 case RC_CUSTOM_EXPORT_FORMAT:
539 custom_export_format = lexrc.getString();
543 case RC_DEFAULT_PAPERSIZE:
546 ascii_lowercase(lexrc.getString());
547 if (size == "usletter")
550 else if (size == "legal")
553 else if (size == "executive")
555 PAPER_EXECUTIVEPAPER;
556 else if (size == "a3")
559 else if (size == "a4")
562 else if (size == "a5")
565 else if (size == "b5")
571 case RC_VIEWDVI_PAPEROPTION:
573 view_dvi_paper_option = lexrc.getString();
575 view_dvi_paper_option.erase();
579 case RC_CHKTEX_COMMAND:
581 chktex_command = lexrc.getString();
585 case RC_BIBTEX_COMMAND:
587 bibtex_command = lexrc.getString();
593 dpi = lexrc.getInteger();
599 zoom = lexrc.getInteger();
605 wheel_jump = lexrc.getInteger();
609 case RC_SCREEN_FONT_SIZES:
611 font_sizes[LyXFont::SIZE_TINY] =
615 font_sizes[LyXFont::SIZE_SCRIPT] =
619 font_sizes[LyXFont::SIZE_FOOTNOTE] =
623 font_sizes[LyXFont::SIZE_SMALL] =
627 font_sizes[LyXFont::SIZE_NORMAL] =
631 font_sizes[LyXFont::SIZE_LARGE] =
635 font_sizes[LyXFont::SIZE_LARGER] =
639 font_sizes[LyXFont::SIZE_LARGEST] =
643 font_sizes[LyXFont::SIZE_HUGE] =
647 font_sizes[LyXFont::SIZE_HUGER] =
652 case RC_SCREEN_FONT_SCALABLE:
654 use_scalable_fonts = lexrc.getBool();
660 autosave = lexrc.getInteger();
664 case RC_DOCUMENTPATH:
666 document_path = ExpandPath(lexrc.getString());
670 case RC_TEMPLATEPATH:
672 template_path = ExpandPath(lexrc.getString());
678 tempdir_path = ExpandPath(lexrc.getString());
684 lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
690 lastfiles = ExpandPath(lexrc.getString());
694 case RC_NUMLASTFILES:
696 num_lastfiles = lexrc.getInteger();
700 case RC_CHECKLASTFILES:
702 check_lastfiles = lexrc.getBool();
706 case RC_SCREEN_FONT_ROMAN:
708 roman_font_name = lexrc.getString();
709 oldFontFormat(roman_font_name,
714 case RC_SCREEN_FONT_SANS:
716 sans_font_name = lexrc.getString();
717 oldFontFormat(sans_font_name, sans_font_foundry);
721 case RC_SCREEN_FONT_TYPEWRITER:
723 typewriter_font_name = lexrc.getString();
724 oldFontFormat(typewriter_font_name,
725 typewriter_font_foundry);
729 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
731 roman_font_foundry = lexrc.getString();
735 case RC_SCREEN_FONT_SANS_FOUNDRY:
737 sans_font_foundry = lexrc.getString();
741 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
743 typewriter_font_foundry = lexrc.getString();
747 case RC_SCREEN_FONT_ENCODING:
749 font_norm = lexrc.getString();
750 set_font_norm_type();
754 case RC_POPUP_BOLD_FONT:
756 popup_bold_font = lexrc.getString();
760 case RC_POPUP_NORMAL_FONT:
762 popup_normal_font = lexrc.getString();
766 case RC_POPUP_FONT_ENCODING:
768 popup_font_encoding = lexrc.getString();
774 string lyx_name, x11_name;
777 lyx_name = lexrc.getString();
779 lexrc.printError("Missing color tag.");
784 x11_name = lexrc.getString();
786 lexrc.printError("Missing color name for color: `$$Token'");
790 LColor::color const col =
791 lcolor.getFromLyXName(lyx_name);
792 if (col == LColor::none ||
793 col == LColor::inherit ||
794 col == LColor::ignore)
797 if (!lcolor.setColor(col, x11_name)) {
798 lyxerr << "Bad lyxrc set_color for "
804 case RC_AUTOREGIONDELETE:
805 // Auto region delete defaults to true
807 auto_region_delete = lexrc.getBool();
813 lyxpipes = ExpandPath(lexrc.getString());
817 case RC_CURSOR_FOLLOWS_SCROLLBAR:
819 cursor_follows_scrollbar = lexrc.getBool();
823 case RC_DIALOGS_ICONIFY_WITH_MAIN:
825 dialogs_iconify_with_main = lexrc.getBool();
829 case RC_ASCIIROFF_COMMAND:
831 ascii_roff_command = lexrc.getString();
834 case RC_ASCII_LINELEN:
836 ascii_linelen = lexrc.getInteger();
839 // Spellchecker settings:
840 case RC_USE_SPELL_LIB:
842 use_spell_lib = lexrc.getBool();
845 case RC_SPELL_COMMAND:
847 isp_command = lexrc.getString();
850 case RC_ACCEPT_COMPOUND:
852 isp_accept_compound = lexrc.getBool();
857 isp_use_input_encoding = lexrc.getBool();
860 case RC_USE_ALT_LANG:
862 isp_use_alt_lang = lexrc.getBool();
865 case RC_USE_PERS_DICT:
867 isp_use_pers_dict = lexrc.getBool();
870 case RC_USE_ESC_CHARS:
872 isp_use_esc_chars = lexrc.getBool();
877 isp_alt_lang = lexrc.getString();
882 isp_pers_dict = lexrc.getString();
887 isp_esc_chars = lexrc.getString();
892 make_backup = lexrc.getBool();
895 case RC_BACKUPDIR_PATH:
897 backupdir_path = ExpandPath(lexrc.getString());
900 case RC_DATE_INSERT_FORMAT:
902 date_insert_format = lexrc.getString();
905 case RC_LANGUAGE_PACKAGE:
907 language_package = lexrc.getString();
910 case RC_LANGUAGE_AUTO_BEGIN:
912 language_auto_begin = lexrc.getBool();
915 case RC_LANGUAGE_AUTO_END:
917 language_auto_end = lexrc.getBool();
920 case RC_LANGUAGE_GLOBAL_OPTIONS:
922 language_global_options = lexrc.getBool();
925 case RC_LANGUAGE_USE_BABEL:
927 language_use_babel = lexrc.getBool();
930 case RC_LANGUAGE_COMMAND_BEGIN:
932 language_command_begin = lexrc.getString();
935 case RC_LANGUAGE_COMMAND_END:
937 language_command_end = lexrc.getString();
940 case RC_LANGUAGE_COMMAND_LOCAL:
942 language_command_local = lexrc.getString();
947 rtl_support = lexrc.getBool();
952 auto_number = lexrc.getBool();
955 case RC_MARK_FOREIGN_LANGUAGE:
957 mark_foreign_language = lexrc.getBool();
962 string from, to, command, flags;
964 from = lexrc.getString();
967 to = lexrc.getString();
970 command = lexrc.getString();
973 flags = lexrc.getString();
976 || token(command, ' ', 0) == "none") {
977 converters.erase(from, to);
979 converters.add(from, to, command, flags);
983 // compatibility with versions older than 1.4.0 only
985 string format, command;
987 format = lexrc.getString();
990 command = lexrc.getString();
991 if (token(command, ' ', 0) == "none")
994 formats.setViewer(format, command);
998 string format, extension, prettyname, shortcut;
1000 format = lexrc.getString();
1003 extension = lexrc.getString();
1006 prettyname = lexrc.getString();
1009 shortcut = lexrc.getString();
1011 string viewer, editor;
1012 // Hack to ensure compatibility with versions older
1014 int le = lexrc.lex();
1015 if (le != LyXLex::LEX_FEOF && le != LyXLex::LEX_UNDEF) {
1016 viewer = lexrc.getString();
1017 if (le == LyXLex::LEX_DATA) {
1018 if (token(viewer, ' ', 0) == "none")
1021 editor = lexrc.getString();
1022 if (token(editor, ' ', 0) == "none")
1026 // We have got a known token.
1027 // Therefore this is an old style
1028 // format definition without
1029 // viewer and editor.
1030 lexrc.pushToken(viewer);
1034 if (prettyname.empty()) {
1035 if (converters.formatIsUsed(format)) {
1036 lyxerr << "Can't delete format "
1039 formats.erase(format);
1042 formats.add(format, extension, prettyname,
1043 shortcut, viewer, editor);
1047 case RC_DEFAULT_LANGUAGE:
1049 default_language = lexrc.getString();
1053 case RC_LABEL_INIT_LENGTH:
1055 label_init_length = lexrc.getInteger();
1059 case RC_SHOW_BANNER:
1061 show_banner = lexrc.getBool();
1067 preview = lexrc.getBool();
1071 case RC_PREVIEW_HASHED_LABELS:
1073 preview_hashed_labels = lexrc.getBool();
1077 case RC_PREVIEW_SCALE_FACTOR:
1079 preview_scale_factor = lexrc.getFloat();
1085 user_name = lexrc.getString();
1090 user_email = lexrc.getString();
1093 case RC_LAST: break; // this is just a dummy
1097 /// Update converters data-structures
1098 converters.update(formats);
1099 converters.buildGraph();
1105 void LyXRC::write(string const & filename, bool ignore_system_lyxrc) const
1107 ofstream ofs(filename.c_str());
1109 write(ofs, ignore_system_lyxrc);
1113 void LyXRC::print() const
1115 if (lyxerr.debugging())
1116 write(lyxerr, false);
1122 void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
1124 os << "### This file is part of\n"
1125 << "### ========================================================\n"
1126 << "### LyX, The Document Processor\n"
1128 << "### Copyright 1995 Matthias Ettrich\n"
1129 << "### Copyright 1995-2001 The LyX Team.\n"
1131 << "### ========================================================\n"
1133 << "# This file is written by LyX, if you want to make your own\n"
1134 << "# modifications you should do them from inside LyX and save\n"
1137 // Why the switch you might ask. It is a trick to ensure that all
1138 // the elements in the LyXRCTags enum is handled. As you can see
1139 // there are no breaks at all. So it is just a huge fall-through.
1140 // The nice thing is that we will get a warning from the compiler
1141 // if we forget an element.
1142 LyXRCTags tag = RC_LAST;
1146 // input/include files are not done here
1148 if (ignore_system_lyxrc ||
1149 bind_file != system_lyxrc.bind_file) {
1150 os << "\\bind_file " << bind_file << "\n";
1156 << "# MISC SECTION ######################################\n"
1159 // bind files are not done here.
1161 if (ignore_system_lyxrc ||
1162 ui_file != system_lyxrc.ui_file) {
1163 os << "\\ui_file \"" << ui_file << "\"\n";
1165 case RC_AUTOREGIONDELETE:
1166 if (ignore_system_lyxrc ||
1167 auto_region_delete != system_lyxrc.auto_region_delete) {
1168 os << "# Set to false to inhibit automatic replacement of\n"
1169 << "# the current selection.\n"
1170 << "\\auto_region_delete " << tostr(auto_region_delete)
1173 case RC_AUTORESET_OPTIONS:
1174 if (ignore_system_lyxrc ||
1175 auto_reset_options != system_lyxrc.auto_reset_options) {
1176 os << "# Set to false to inhibit automatic reset of\n"
1177 << "# the class options to defaults on class change.\n"
1178 << "\\auto_reset_options " << tostr(auto_reset_options)
1182 if (ignore_system_lyxrc ||
1183 autosave != system_lyxrc.autosave) {
1184 os << "# The time interval between auto-saves in seconds.\n"
1185 << "\\autosave " << autosave << '\n';
1187 case RC_DISPLAY_GRAPHICS:
1188 if (ignore_system_lyxrc ||
1189 display_graphics != system_lyxrc.display_graphics) {
1190 os << "# Display graphics within LyX\n"
1191 << "# monochrome|grayscale|color|none\n"
1192 << "\\display_graphics "
1193 << lyx::graphics::displayTranslator().find(display_graphics)
1197 case RC_VIEWDVI_PAPEROPTION:
1198 if (ignore_system_lyxrc ||
1199 view_dvi_paper_option
1200 != system_lyxrc.view_dvi_paper_option) {
1201 os << "# Options used to specify paper size to the\n"
1202 << "# view_dvi_command (e.g. -paper)\n"
1203 << "\\view_dvi_paper_option \""
1204 << view_dvi_paper_option << "\"\n";
1206 case RC_DEFAULT_PAPERSIZE:
1207 if (ignore_system_lyxrc ||
1208 default_papersize != system_lyxrc.default_papersize) {
1209 os << "# The default papersize to use.\n"
1210 << "\\default_papersize \"";
1211 switch (default_papersize) {
1212 case PAPER_USLETTER:
1213 os << "usletter"; break;
1214 case PAPER_LEGALPAPER:
1215 os << "legal"; break;
1216 case PAPER_EXECUTIVEPAPER:
1217 os << "executive"; break;
1226 case PAPER_DEFAULT: break;
1230 case RC_CHKTEX_COMMAND:
1231 if (ignore_system_lyxrc ||
1232 chktex_command != system_lyxrc.chktex_command) {
1233 os << "\\chktex_command \"" << chktex_command << "\"\n";
1235 case RC_BIBTEX_COMMAND:
1236 if (ignore_system_lyxrc ||
1237 bibtex_command != system_lyxrc.bibtex_command) {
1238 os << "\\bibtex_command \"" << bibtex_command << "\"\n";
1241 if (ignore_system_lyxrc ||
1242 use_kbmap != system_lyxrc.use_kbmap) {
1243 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1245 case RC_KBMAP_PRIMARY:
1246 if (ignore_system_lyxrc ||
1247 primary_kbmap != system_lyxrc.primary_kbmap) {
1248 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1250 case RC_KBMAP_SECONDARY:
1251 if (ignore_system_lyxrc ||
1252 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1253 os << "\\kbmap_secondary \"" << secondary_kbmap
1257 if (ignore_system_lyxrc ||
1258 lyxpipes != system_lyxrc.lyxpipes) {
1259 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1261 case RC_DATE_INSERT_FORMAT:
1262 if (ignore_system_lyxrc ||
1263 date_insert_format != system_lyxrc.date_insert_format) {
1264 os << "\\date_insert_format \"" << date_insert_format
1267 case RC_LABEL_INIT_LENGTH:
1268 if (ignore_system_lyxrc ||
1269 label_init_length != system_lyxrc.label_init_length) {
1270 os << "\\label_init_length " << label_init_length
1275 os << "\\user_name \"" << user_name << "\"\n";
1278 os << "\\user_email \"" << user_email << "\"\n";
1280 case RC_SHOW_BANNER:
1281 if (ignore_system_lyxrc ||
1282 show_banner != system_lyxrc.show_banner) {
1283 os << "\\show_banner " << tostr(show_banner) << '\n';
1287 if (ignore_system_lyxrc ||
1288 preview != system_lyxrc.preview) {
1289 os << "\\preview " << tostr(preview) << '\n';
1292 case RC_PREVIEW_HASHED_LABELS:
1293 if (ignore_system_lyxrc ||
1294 preview_hashed_labels !=
1295 system_lyxrc.preview_hashed_labels) {
1296 os << "\\preview_hashed_labels "
1297 << tostr(preview_hashed_labels) << '\n';
1300 case RC_PREVIEW_SCALE_FACTOR:
1301 if (ignore_system_lyxrc ||
1302 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1303 os << "\\preview_scale_factor "
1304 << preview_scale_factor << '\n';
1308 << "# SCREEN & FONTS SECTION ############################\n"
1311 case RC_POPUP_NORMAL_FONT:
1312 if (ignore_system_lyxrc ||
1313 popup_normal_font != system_lyxrc.popup_normal_font) {
1314 os << "\\popup_normal_font \"" << popup_normal_font
1317 case RC_POPUP_BOLD_FONT:
1318 if (ignore_system_lyxrc ||
1319 popup_bold_font != system_lyxrc.popup_bold_font) {
1320 os << "\\popup_bold_font \"" << popup_bold_font
1323 case RC_POPUP_FONT_ENCODING:
1324 if (ignore_system_lyxrc ||
1325 popup_font_encoding != system_lyxrc.popup_font_encoding) {
1326 os << "\\popup_font_encoding \"" << popup_font_encoding
1330 if (ignore_system_lyxrc ||
1331 dpi != system_lyxrc.dpi) {
1332 os << "\\screen_dpi " << dpi << '\n';
1334 case RC_SCREEN_ZOOM:
1335 if (ignore_system_lyxrc ||
1336 zoom != system_lyxrc.zoom) {
1337 os << "\\screen_zoom " << zoom << '\n';
1340 if (ignore_system_lyxrc ||
1341 wheel_jump != system_lyxrc.wheel_jump) {
1342 os << "\\wheel_jump " << wheel_jump << '\n';
1344 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1345 if (ignore_system_lyxrc ||
1346 cursor_follows_scrollbar
1347 != system_lyxrc.cursor_follows_scrollbar) {
1348 os << "\\cursor_follows_scrollbar "
1349 << tostr(cursor_follows_scrollbar) << '\n';
1351 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1352 if (ignore_system_lyxrc ||
1353 dialogs_iconify_with_main
1354 != system_lyxrc.dialogs_iconify_with_main) {
1355 os << "\\dialogs_iconify_with_main "
1356 << tostr(dialogs_iconify_with_main) << '\n';
1358 case RC_SCREEN_FONT_ROMAN:
1359 if (ignore_system_lyxrc ||
1360 roman_font_name != system_lyxrc.roman_font_name) {
1361 os << "\\screen_font_roman \"" << roman_font_name
1364 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1365 if (ignore_system_lyxrc ||
1366 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1367 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1370 case RC_SCREEN_FONT_SANS:
1371 if (ignore_system_lyxrc ||
1372 sans_font_name != system_lyxrc.sans_font_name) {
1373 os << "\\screen_font_sans \"" << sans_font_name
1376 case RC_SCREEN_FONT_SANS_FOUNDRY:
1377 if (ignore_system_lyxrc ||
1378 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1379 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1382 case RC_SCREEN_FONT_TYPEWRITER:
1383 if (ignore_system_lyxrc ||
1384 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1385 os << "\\screen_font_typewriter \""
1386 << typewriter_font_name << "\"\n";
1388 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1389 if (ignore_system_lyxrc ||
1390 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1391 os << "\\screen_font_typewriter_foundry \""
1392 << typewriter_font_foundry << "\"\n";
1395 case RC_SCREEN_FONT_SCALABLE:
1396 if (ignore_system_lyxrc ||
1397 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1398 os << "\\screen_font_scalable "
1399 << tostr(use_scalable_fonts)
1402 case RC_SCREEN_FONT_ENCODING:
1403 if (ignore_system_lyxrc ||
1404 font_norm != system_lyxrc.font_norm) {
1405 os << "\\screen_font_encoding \"" << font_norm
1408 case RC_SCREEN_FONT_SIZES:
1409 if (ignore_system_lyxrc ||
1410 font_sizes[LyXFont::SIZE_TINY]
1411 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1412 font_sizes[LyXFont::SIZE_SCRIPT]
1413 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1414 font_sizes[LyXFont::SIZE_FOOTNOTE]
1415 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1416 font_sizes[LyXFont::SIZE_SMALL]
1417 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1418 font_sizes[LyXFont::SIZE_NORMAL]
1419 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1420 font_sizes[LyXFont::SIZE_LARGE]
1421 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1422 font_sizes[LyXFont::SIZE_LARGER]
1423 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1424 font_sizes[LyXFont::SIZE_LARGEST]
1425 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1426 font_sizes[LyXFont::SIZE_HUGE]
1427 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1428 font_sizes[LyXFont::SIZE_HUGER]
1429 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1430 os.setf(ios::fixed);
1432 os << "\\screen_font_sizes"
1433 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1434 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1435 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1436 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1437 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1438 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1439 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1440 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1441 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1442 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1447 << "# COLOR SECTION ###################################\n"
1451 for (int i = 0; i < LColor::ignore; ++i) {
1452 LColor::color lc = static_cast<LColor::color>(i);
1454 string const col(lcolor.getX11Name(lc));
1455 if (ignore_system_lyxrc ||
1456 col != system_lcolor.getX11Name(lc)) {
1457 os << "\\set_color \""
1458 << lcolor.getLyXName(lc) << "\" \""
1464 << "# PRINTER SECTION ###################################\n"
1468 if (ignore_system_lyxrc ||
1469 printer != system_lyxrc.printer) {
1470 os << "\\printer \"" << printer << "\"\n";
1472 case RC_PRINT_ADAPTOUTPUT:
1473 if (ignore_system_lyxrc ||
1474 print_adapt_output != system_lyxrc.print_adapt_output) {
1475 os << "\\print_adapt_output "
1476 << tostr(print_adapt_output)
1479 case RC_PRINT_COMMAND:
1480 if (ignore_system_lyxrc ||
1481 print_command != system_lyxrc.print_command) {
1482 os << "\\print_command \"" << print_command << "\"\n";
1484 case RC_PRINTEXSTRAOPTIONS:
1485 if (ignore_system_lyxrc ||
1486 print_extra_options != system_lyxrc.print_extra_options) {
1487 os << "\\print_extra_options \"" << print_extra_options
1490 case RC_PRINTSPOOL_COMMAND:
1491 if (ignore_system_lyxrc ||
1492 print_spool_command != system_lyxrc.print_spool_command) {
1493 os << "\\print_spool_command \"" << print_spool_command
1496 case RC_PRINTSPOOL_PRINTERPREFIX:
1497 if (ignore_system_lyxrc ||
1498 print_spool_printerprefix
1499 != system_lyxrc.print_spool_printerprefix) {
1500 os << "\\print_spool_printerprefix \""
1501 << print_spool_printerprefix << "\"\n";
1503 case RC_PRINTEVENPAGEFLAG:
1504 if (ignore_system_lyxrc ||
1505 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1506 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1509 case RC_PRINTODDPAGEFLAG:
1510 if (ignore_system_lyxrc ||
1511 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1512 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1515 case RC_PRINTREVERSEFLAG:
1516 if (ignore_system_lyxrc ||
1517 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1518 os << "\\print_reverse_flag \"" << print_reverse_flag
1521 case RC_PRINTLANDSCAPEFLAG:
1522 if (ignore_system_lyxrc ||
1523 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1524 os << "\\print_landscape_flag \"" << print_landscape_flag
1527 case RC_PRINTPAGERANGEFLAG:
1528 if (ignore_system_lyxrc ||
1529 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1530 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1533 case RC_PRINTCOPIESFLAG:
1534 if (ignore_system_lyxrc ||
1535 print_copies_flag != system_lyxrc.print_copies_flag) {
1536 os << "\\print_copies_flag \"" << print_copies_flag
1539 case RC_PRINTCOLLCOPIESFLAG:
1540 if (ignore_system_lyxrc ||
1541 print_collcopies_flag
1542 != system_lyxrc.print_collcopies_flag) {
1543 os << "\\print_collcopies_flag \""
1544 << print_collcopies_flag
1547 case RC_PRINTPAPERFLAG:
1548 if (ignore_system_lyxrc ||
1549 print_paper_flag != system_lyxrc.print_paper_flag) {
1550 os << "\\print_paper_flag \"" << print_paper_flag
1553 case RC_PRINTPAPERDIMENSIONFLAG:
1554 if (ignore_system_lyxrc ||
1555 print_paper_dimension_flag
1556 != system_lyxrc.print_paper_dimension_flag) {
1557 os << "\\print_paper_dimension_flag \""
1558 << print_paper_dimension_flag << "\"\n";
1560 case RC_PRINTTOPRINTER:
1561 if (ignore_system_lyxrc ||
1562 print_to_printer != system_lyxrc.print_to_printer) {
1563 os << "\\print_to_printer \"" << print_to_printer
1566 case RC_PRINTTOFILE:
1567 if (ignore_system_lyxrc ||
1568 print_to_file != system_lyxrc.print_to_file) {
1569 os << "\\print_to_file \"" << print_to_file << "\"\n";
1571 case RC_PRINTFILEEXTENSION:
1572 if (ignore_system_lyxrc ||
1573 print_file_extension != system_lyxrc.print_file_extension) {
1574 os << "\\print_file_extension \""
1575 << print_file_extension
1580 << "# EXPORT SECTION ####################################\n"
1583 case RC_CUSTOM_EXPORT_COMMAND:
1584 if (ignore_system_lyxrc ||
1585 custom_export_command
1586 != system_lyxrc.custom_export_command) {
1587 os << "\\custom_export_command \""
1588 << custom_export_command
1591 case RC_CUSTOM_EXPORT_FORMAT:
1592 if (ignore_system_lyxrc ||
1593 custom_export_format
1594 != system_lyxrc.custom_export_format) {
1595 os << "\\custom_export_format \"" << custom_export_format
1600 << "# TEX SECTION #######################################\n"
1603 case RC_FONT_ENCODING:
1604 if (ignore_system_lyxrc ||
1605 fontenc != system_lyxrc.fontenc) {
1606 os << "\\font_encoding \"" << fontenc << "\"\n";
1610 << "# FILE SECTION ######################################\n"
1613 case RC_DOCUMENTPATH:
1614 if (ignore_system_lyxrc ||
1615 document_path != system_lyxrc.document_path) {
1616 os << "\\document_path \"" << document_path << "\"\n";
1619 if (ignore_system_lyxrc ||
1620 lastfiles != system_lyxrc.lastfiles) {
1621 os << "\\lastfiles \"" << lastfiles << "\"\n";
1623 case RC_NUMLASTFILES:
1624 if (ignore_system_lyxrc ||
1625 num_lastfiles != system_lyxrc.num_lastfiles) {
1626 os << "\\num_lastfiles " << num_lastfiles << '\n';
1628 case RC_CHECKLASTFILES:
1629 if (ignore_system_lyxrc ||
1630 check_lastfiles != system_lyxrc.check_lastfiles) {
1631 os << "\\check_lastfiles " << tostr(check_lastfiles)
1634 case RC_TEMPLATEPATH:
1635 if (ignore_system_lyxrc ||
1636 template_path != system_lyxrc.template_path) {
1637 os << "\\template_path \"" << template_path << "\"\n";
1639 case RC_TEMPDIRPATH:
1640 if (ignore_system_lyxrc ||
1641 tempdir_path != system_lyxrc.tempdir_path) {
1642 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1646 case RC_ASCII_LINELEN:
1647 if (ignore_system_lyxrc ||
1648 ascii_linelen != system_lyxrc.ascii_linelen) {
1649 os << "\\ascii_linelen " << ascii_linelen << '\n';
1651 case RC_MAKE_BACKUP:
1652 if (ignore_system_lyxrc ||
1653 make_backup != system_lyxrc.make_backup) {
1654 os << "\\make_backup " << tostr(make_backup) << '\n';
1656 case RC_BACKUPDIR_PATH:
1657 if (ignore_system_lyxrc ||
1658 backupdir_path != system_lyxrc.backupdir_path) {
1659 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1663 << "# ASCII EXPORT SECTION ##############################\n"
1666 case RC_ASCIIROFF_COMMAND:
1667 if (ignore_system_lyxrc ||
1668 ascii_roff_command != system_lyxrc.ascii_roff_command) {
1669 os << "\\ascii_roff_command \"" << ascii_roff_command
1674 << "# SPELLCHECKER SECTION ##############################\n"
1676 case RC_USE_SPELL_LIB:
1677 if (ignore_system_lyxrc ||
1678 use_spell_lib != system_lyxrc.use_spell_lib) {
1679 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1681 case RC_SPELL_COMMAND:
1682 if (ignore_system_lyxrc ||
1683 isp_command != system_lyxrc.isp_command) {
1684 os << "\\spell_command \"" << isp_command << "\"\n";
1686 case RC_ACCEPT_COMPOUND:
1687 if (ignore_system_lyxrc ||
1688 isp_accept_compound != system_lyxrc.isp_accept_compound) {
1689 os << "\\accept_compound " << tostr(isp_accept_compound)
1692 case RC_USE_ALT_LANG:
1693 if (ignore_system_lyxrc ||
1694 isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1695 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1699 if (ignore_system_lyxrc ||
1700 isp_alt_lang != system_lyxrc.isp_alt_lang) {
1701 os << "\\alternate_language \"" << isp_alt_lang
1704 case RC_USE_ESC_CHARS:
1705 if (ignore_system_lyxrc ||
1706 isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1707 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1711 if (ignore_system_lyxrc ||
1712 isp_esc_chars != system_lyxrc.isp_esc_chars) {
1713 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1715 case RC_USE_PERS_DICT:
1716 if (ignore_system_lyxrc ||
1717 isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1718 os << "\\use_personal_dictionary "
1719 << tostr(isp_use_pers_dict)
1723 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1724 os << "\\personal_dictionary \"" << isp_pers_dict
1727 case RC_USE_INP_ENC:
1728 if (ignore_system_lyxrc ||
1729 isp_use_input_encoding
1730 != system_lyxrc.isp_use_input_encoding) {
1731 os << "\\use_input_encoding "
1732 << tostr(isp_use_input_encoding)
1737 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1740 case RC_RTL_SUPPORT:
1741 if (ignore_system_lyxrc ||
1742 rtl_support != system_lyxrc.rtl_support) {
1743 os << "\\rtl " << tostr(rtl_support) << '\n';
1745 case RC_LANGUAGE_PACKAGE:
1746 if (ignore_system_lyxrc ||
1747 language_package != system_lyxrc.language_package) {
1748 os << "\\language_package \"" << language_package
1751 case RC_LANGUAGE_GLOBAL_OPTIONS:
1752 if (ignore_system_lyxrc ||
1753 language_global_options
1754 != system_lyxrc.language_global_options) {
1755 os << "\\language_global_options \""
1756 << tostr(language_global_options)
1759 case RC_LANGUAGE_USE_BABEL:
1760 if (ignore_system_lyxrc ||
1761 language_use_babel != system_lyxrc.language_use_babel) {
1762 os << "\\language_use_babel \""
1763 << tostr(language_use_babel)
1766 case RC_LANGUAGE_COMMAND_BEGIN:
1767 if (ignore_system_lyxrc ||
1768 language_command_begin
1769 != system_lyxrc.language_command_begin) {
1770 os << "\\language_command_begin \""
1771 << language_command_begin
1774 case RC_LANGUAGE_COMMAND_END:
1775 if (ignore_system_lyxrc ||
1776 language_command_end
1777 != system_lyxrc.language_command_end) {
1778 os << "\\language_command_end \"" << language_command_end
1781 case RC_LANGUAGE_COMMAND_LOCAL:
1782 if (ignore_system_lyxrc ||
1783 language_command_local
1784 != system_lyxrc.language_command_local) {
1785 os << "\\language_command_local \""
1786 << language_command_local
1789 case RC_LANGUAGE_AUTO_BEGIN:
1790 if (ignore_system_lyxrc ||
1791 language_auto_begin != system_lyxrc.language_auto_begin) {
1792 os << "\\language_auto_begin "
1793 << tostr(language_auto_begin) << '\n';
1795 case RC_LANGUAGE_AUTO_END:
1796 if (ignore_system_lyxrc ||
1797 language_auto_end != system_lyxrc.language_auto_end) {
1798 os << "\\language_auto_end "
1799 << tostr(language_auto_end) << '\n';
1801 case RC_MARK_FOREIGN_LANGUAGE:
1802 if (ignore_system_lyxrc ||
1803 mark_foreign_language
1804 != system_lyxrc.mark_foreign_language) {
1805 os << "\\mark_foreign_language " <<
1806 tostr(mark_foreign_language) << '\n';
1810 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1813 case RC_AUTO_NUMBER:
1814 if (ignore_system_lyxrc ||
1815 auto_number != system_lyxrc.auto_number) {
1816 os << "\\auto_number " << tostr(auto_number) << '\n';
1818 case RC_DEFAULT_LANGUAGE:
1819 if (ignore_system_lyxrc ||
1820 default_language != system_lyxrc.default_language) {
1821 os << "\\default_language " << default_language << '\n';
1825 << "# FORMATS SECTION ##########################\n"
1829 // New/modifed formats
1830 for (Formats::const_iterator cit = formats.begin();
1831 cit != formats.end(); ++cit) {
1832 Format const * format =
1833 system_formats.getFormat(cit->name());
1835 format->extension() != cit->extension() ||
1836 format->prettyname() != cit->prettyname() ||
1837 format->shortcut() != cit->shortcut() ||
1838 format->viewer() != cit->viewer() ||
1839 format->editor() != cit->editor())
1840 os << "\\format \"" << cit->name() << "\" \""
1841 << cit->extension() << "\" \""
1842 << cit->prettyname() << "\" \""
1843 << cit->shortcut() << "\" \""
1844 << cit->viewer() << "\" \""
1845 << cit->editor() << "\"\n";
1848 // Look for deleted formats
1849 for (Formats::const_iterator cit = system_formats.begin();
1850 cit != system_formats.end(); ++cit)
1851 if (!formats.getFormat(cit->name()))
1852 os << "\\format \"" << cit->name()
1853 << "\" \"\" \"\" \"\" \"\" \"\"\n";
1858 << "# CONVERTERS SECTION ##########################\n"
1862 // Look for new converters
1863 for (Converters::const_iterator cit = converters.begin();
1864 cit != converters.end(); ++cit) {
1865 Converter const * converter =
1866 system_converters.getConverter(cit->from,
1869 converter->command != cit->command ||
1870 converter->flags != cit->flags)
1871 os << "\\converter \"" << cit->from << "\" \""
1872 << cit->to << "\" \""
1873 << cit->command << "\" \""
1874 << cit->flags << "\"\n";
1877 // New/modifed converters
1878 for (Converters::const_iterator cit = system_converters.begin();
1879 cit != system_converters.end(); ++cit)
1880 if (!converters.getConverter(cit->from, cit->to))
1881 os << "\\converter \"" << cit->from
1882 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1888 void LyXRC::set_font_norm_type()
1890 if (font_norm == "iso10646-1")
1891 font_norm_type = ISO_10646_1;
1892 else if (font_norm == "iso8859-1")
1893 font_norm_type = ISO_8859_1;
1894 else if (font_norm == "iso8859-3")
1895 font_norm_type = ISO_8859_3;
1896 else if (font_norm == "iso8859-4")
1897 font_norm_type = ISO_8859_4;
1898 else if (font_norm == "iso8859-6.8x")
1899 font_norm_type = ISO_8859_6_8;
1900 else if (font_norm == "iso8859-9")
1901 font_norm_type = ISO_8859_9;
1902 else if (font_norm == "iso8859-15")
1903 font_norm_type = ISO_8859_15;
1905 font_norm_type = OTHER_ENCODING;
1909 string const LyXRC::getDescription(LyXRCTags tag)
1914 case RC_FONT_ENCODING:
1915 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1919 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1922 case RC_PRINT_COMMAND:
1923 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1926 case RC_PRINTEVENPAGEFLAG:
1927 str = _("The option to print only even pages.");
1930 case RC_PRINTODDPAGEFLAG:
1931 str = _("The option to print only odd pages.");
1934 case RC_PRINTPAGERANGEFLAG:
1935 str = _("The option for specifying a comma-separated list of pages to print.");
1938 case RC_PRINTCOPIESFLAG:
1939 str = _("The option for specifying the number of copies to print.");
1942 case RC_PRINTCOLLCOPIESFLAG:
1943 str = _("The option for specifying whether the copies should be collated.");
1946 case RC_PRINTREVERSEFLAG:
1947 str = _("The option to reverse the order of the pages printed.");
1950 case RC_PRINTLANDSCAPEFLAG:
1951 str = _("The option to print out in landscape.");
1954 case RC_PRINTPAPERFLAG:
1955 str = _("The option to specify paper type.");
1958 case RC_PRINTPAPERDIMENSIONFLAG:
1959 str = _("Option to specify the dimensions of the print paper.");
1962 case RC_PRINTTOPRINTER:
1963 str = _("Option to pass to the print program to print on a specific printer.");
1966 case RC_PRINT_ADAPTOUTPUT:
1967 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1970 case RC_PRINTTOFILE:
1971 str = _("Option to pass to the print program to print to a file.");
1974 case RC_PRINTFILEEXTENSION:
1975 str = _("Extension of printer program output file. Usually \".ps\".");
1978 case RC_PRINTEXSTRAOPTIONS:
1979 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1982 case RC_PRINTSPOOL_COMMAND:
1983 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.");
1986 case RC_PRINTSPOOL_PRINTERPREFIX:
1987 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.");
1991 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1994 case RC_SCREEN_ZOOM:
1995 //xgettext:no-c-format
1996 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1999 case RC_SCREEN_FONT_SIZES:
2000 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2003 case RC_SCREEN_FONT_ROMAN:
2004 case RC_SCREEN_FONT_SANS:
2005 case RC_SCREEN_FONT_TYPEWRITER:
2006 str = _("The screen fonts used to display the text while editing.");
2009 case RC_POPUP_BOLD_FONT:
2010 str = _("The bold font in the dialogs.");
2013 case RC_POPUP_NORMAL_FONT:
2014 str = _("The normal font in the dialogs.");
2017 case RC_SCREEN_FONT_ENCODING:
2018 str = _("The encoding for the screen fonts.");
2021 case RC_POPUP_FONT_ENCODING:
2022 str = _("The encoding for the menu/popups fonts.");
2029 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2032 case RC_DOCUMENTPATH:
2033 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2036 case RC_TEMPLATEPATH:
2037 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2040 case RC_TEMPDIRPATH:
2041 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2045 str = _("The file where the last-files information should be stored.");
2048 case RC_AUTOREGIONDELETE:
2049 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2052 case RC_AUTORESET_OPTIONS:
2053 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2057 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2061 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2065 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2069 case RC_KBMAP_PRIMARY:
2070 case RC_KBMAP_SECONDARY:
2071 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.");
2074 case RC_ASCIIROFF_COMMAND:
2075 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.");
2078 case RC_ASCII_LINELEN:
2079 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2082 case RC_NUMLASTFILES:
2083 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
2086 case RC_CHECKLASTFILES:
2087 str = _("Select to check whether the lastfiles still exist.");
2090 case RC_VIEWDVI_PAPEROPTION:
2091 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2094 case RC_DEFAULT_PAPERSIZE:
2095 str = _("Specify the default paper size.");
2098 case RC_ACCEPT_COMPOUND:
2099 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2102 case RC_SPELL_COMMAND:
2103 str = _("What command runs the spell checker?");
2106 case RC_USE_INP_ENC:
2107 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.");
2110 case RC_USE_ALT_LANG:
2112 str = _("Specify an alternate language. The default is to use the language of the document.");
2115 case RC_USE_PERS_DICT:
2117 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2120 case RC_USE_ESC_CHARS:
2122 str = _("Specify additional chars that can be part of a word.");
2125 case RC_SCREEN_FONT_SCALABLE:
2126 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.");
2129 case RC_CHKTEX_COMMAND:
2130 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2133 case RC_BIBTEX_COMMAND:
2134 str = _("Define the options of bibtex (cf. man bibtex) or select and alternative compiler (e.g. mlbibtex or bibulus).");
2137 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2138 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.");
2141 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2142 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2145 case RC_DISPLAY_GRAPHICS:
2146 str = _("Select how LyX will display any graphics.");
2149 case RC_MAKE_BACKUP:
2150 str = _("De-select if you don't want LyX to create backup files.");
2153 case RC_BACKUPDIR_PATH:
2154 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.");
2157 case RC_RTL_SUPPORT:
2158 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2161 case RC_MARK_FOREIGN_LANGUAGE:
2162 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2165 case RC_LANGUAGE_PACKAGE:
2166 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2169 case RC_LANGUAGE_GLOBAL_OPTIONS:
2170 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2173 case RC_LANGUAGE_USE_BABEL:
2174 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2177 case RC_LANGUAGE_AUTO_BEGIN:
2178 str = _("Select if a language switching command is needed at the beginning of the document.");
2181 case RC_LANGUAGE_AUTO_END:
2182 str = _("Select if a language switching command is needed at the end of the document.");
2185 case RC_LANGUAGE_COMMAND_BEGIN:
2186 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.");
2189 case RC_LANGUAGE_COMMAND_END:
2190 str = _("The LaTeX command for changing back to the language of the document.");
2193 case RC_LANGUAGE_COMMAND_LOCAL:
2194 str = _("The LaTeX command for local changing of the language.");
2197 case RC_DATE_INSERT_FORMAT:
2198 //xgettext:no-c-format
2199 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2202 case RC_SHOW_BANNER:
2203 str = _("De-select if you don't want the startup banner.");
2207 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2219 case RC_DEFAULT_LANGUAGE:
2220 str = _("New documents will be assigned this language.");
2223 case RC_LABEL_INIT_LENGTH:
2224 str = _("Maximum number of words in the initialization string for a new label");
2228 str = _("Shows a typeset preview of things such as math");
2231 case RC_PREVIEW_HASHED_LABELS:
2232 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2235 case RC_PREVIEW_SCALE_FACTOR:
2236 str = _("Scale the preview size to suit.");
2246 // The global instance
2249 // The global copy of the system lyxrc entries (everything except preferences)