3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * Full author contact details are available in file CREDITS
14 #include <boost/scoped_ptr.hpp>
20 #include "LyXAction.h"
22 #include "converter.h"
27 #include "support/path.h"
28 #include "support/tostr.h"
29 #include "support/filetools.h"
30 #include "support/LAssert.h"
31 #include "support/lstrings.h"
32 #include "support/userinfo.h"
34 using namespace lyx::support;
43 namespace grfx = lyx::graphics;
47 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
51 // when adding something to this array keep it sorted!
52 keyword_item lyxrcTags[] = {
53 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
54 { "\\alternate_language", LyXRC::RC_ALT_LANG },
55 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
56 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
57 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
58 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
59 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
60 { "\\autosave", LyXRC::RC_AUTOSAVE },
61 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
62 { "\\bind", LyXRC::RC_BIND },
63 { "\\bind_file", LyXRC::RC_BINDFILE },
64 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
65 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
66 { "\\converter", LyXRC::RC_CONVERTER },
67 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
68 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
69 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
70 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
71 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
72 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
73 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
74 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
75 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
76 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
77 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
78 { "\\format", LyXRC::RC_FORMAT },
79 { "\\input", LyXRC::RC_INPUT },
80 { "\\kbmap", LyXRC::RC_KBMAP },
81 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
82 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
83 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
84 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
85 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
86 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
87 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
88 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
89 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
90 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
91 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
92 { "\\lastfiles", LyXRC::RC_LASTFILES },
93 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
94 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
95 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
96 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
97 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
98 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
99 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
100 { "\\preview", LyXRC::RC_PREVIEW },
101 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
102 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
103 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
104 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
105 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
106 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
107 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
108 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
109 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
110 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
111 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
112 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
113 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
114 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
115 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
116 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
117 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
118 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
119 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
120 { "\\printer", LyXRC::RC_PRINTER },
121 { "\\ps_command", LyXRC::RC_PS_COMMAND },
122 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
123 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
124 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
125 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
126 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
127 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
128 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
129 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
130 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
131 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
132 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
133 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
134 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
135 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
136 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
137 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
138 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
139 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
140 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
141 { "\\set_color", LyXRC::RC_SET_COLOR },
142 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
143 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
144 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
145 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
146 { "\\ui_file", LyXRC::RC_UIFILE },
147 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
148 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
149 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
150 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
151 // compatibility with versions older than 1.4.0 only
152 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
153 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
154 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
155 { "\\user_email", LyXRC::RC_USER_EMAIL },
156 { "\\user_name", LyXRC::RC_USER_NAME },
157 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
158 { "\\viewer" ,LyXRC::RC_VIEWER},
159 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
162 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
173 void LyXRC::setDefaults() {
177 // Get printer from the environment. If fail, use default "",
178 // assuming that everything is set up correctly.
179 printer = GetEnv("PRINTER");
180 print_adapt_output = false;
181 print_command = "dvips";
182 print_evenpage_flag = "-B";
183 print_oddpage_flag = "-A";
184 print_pagerange_flag = "-pp";
185 print_copies_flag = "-c";
186 print_collcopies_flag = "-C";
187 print_reverse_flag = "-r";
188 print_landscape_flag = "-t landscape";
189 print_to_printer = "-P";
190 print_to_file = "-o ";
191 print_file_extension = ".ps";
192 print_paper_flag = "-t";
193 print_paper_dimension_flag = "-T";
194 document_path.erase();
195 tempdir_path = "/tmp";
198 view_dvi_paper_option.erase();
199 default_papersize = BufferParams::PAPER_USLETTER;
200 custom_export_format = "ps";
201 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
204 // Because a screen typically is wider than a piece of paper:
207 // Default LaTeX font size:
208 font_sizes[LyXFont::SIZE_TINY] = 5.0;
209 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
210 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
211 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
212 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
213 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
214 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
215 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
216 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
217 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
218 use_scalable_fonts = true;
219 roman_font_name = "";
221 typewriter_font_name = "";
222 popup_bold_font = "-*-helvetica-bold-r";
223 popup_normal_font = "-*-helvetica-medium-r";
224 font_norm = "iso8859-1";
225 font_norm_type = ISO_8859_1;
226 popup_font_encoding.erase();
228 auto_region_delete = true;
229 auto_reset_options = false;
232 check_lastfiles = true;
234 backupdir_path.erase();
235 display_graphics = grfx::ColorDisplay;
236 // Spellchecker settings:
237 use_spell_lib = true;
238 isp_command = "ispell";
239 isp_accept_compound = false;
240 isp_use_input_encoding = false;
241 isp_use_alt_lang = false;
242 isp_use_pers_dict = false;
243 isp_use_esc_chars = false;
247 mark_foreign_language = true;
248 language_auto_begin = true;
249 language_auto_end = true;
250 language_global_options = true;
251 language_use_babel = true;
252 language_package = "\\usepackage{babel}";
253 language_command_begin = "\\selectlanguage{$$lang}";
254 language_command_local = "\\foreignlanguage{$$lang}{";
255 default_language = "english";
259 date_insert_format = "%A, %e %B %Y";
260 cursor_follows_scrollbar = false;
261 dialogs_iconify_with_main = false;
262 label_init_length = 3;
264 preview_hashed_labels = false;
265 preview_scale_factor = 0.9;
267 user_name = lyx::support::user_name();
269 user_email = lyx::support::user_email();
271 if (user_email.empty())
272 user_email = _("email address unknown");
276 int LyXRC::ReadBindFile(string const & name)
279 string const tmp = i18nLibFileSearch("bind", name, "bind");
280 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
281 int const result = read(tmp);
283 lyxerr << "Error reading bind file: " << tmp << endl;
288 void LyXRC::readBindFileIfNeeded()
291 ReadBindFile(bind_file);
297 void oldFontFormat(string & family, string & foundry)
299 if (family.empty() || family[0] != '-')
301 foundry = token(family, '-', 1);
302 family = token(family, '-', 2);
310 int LyXRC::read(string const & filename)
312 LyXLex lexrc(lyxrcTags, lyxrcCount);
313 if (lyxerr.debugging(Debug::PARSER))
314 lexrc.printTable(lyxerr);
316 lexrc.setFile(filename);
317 if (!lexrc.isOK()) return -2;
319 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
321 while (lexrc.isOK()) {
322 // By using two switches we take advantage of the compiler
323 // telling us if we have missed a LyXRCTags element in
324 // the second switch.
325 // Note that this also shows a problem with LyXLex since it
326 // helps us avoid taking advantage of the strictness of the
329 int le = lexrc.lex();
331 case LyXLex::LEX_UNDEF:
332 lexrc.printError("Unknown tag `$$Token'");
334 case LyXLex::LEX_FEOF:
338 switch (static_cast<LyXRCTags>(le)) {
339 case RC_INPUT: // Include file
342 LibFileSearch(string(),
345 lexrc.printError("Error reading "
346 "included file: "+tmp);
350 case RC_BINDFILE: // RVDK_PATCH_5
352 string const tmp(lexrc.getString());
354 // We are already in the
355 // "actually read bind file"
359 // We are still in the "just
360 // remember the name of the
369 ui_file = lexrc.getString();
373 case RC_AUTORESET_OPTIONS:
375 auto_reset_options = lexrc.getBool();
379 case RC_DISPLAY_GRAPHICS:
381 display_graphics = grfx::displayTranslator.find(lexrc.getString());
387 use_kbmap = lexrc.getBool();
391 case RC_KBMAP_PRIMARY:
393 string const kmap(lexrc.getString());
396 } else if (!LibFileSearch("kbd", kmap,
398 primary_kbmap = kmap;
400 lexrc.printError("LyX: Keymap `$$Token' not found");
405 case RC_KBMAP_SECONDARY:
407 string const kmap(lexrc.getString());
410 } else if (!LibFileSearch("kbd", kmap,
412 secondary_kbmap = kmap;
414 lexrc.printError("LyX: Keymap `$$Token' not found");
419 case RC_FONT_ENCODING:
421 fontenc = lexrc.getString();
427 printer = lexrc.getString();
431 case RC_PRINT_COMMAND:
433 print_command = lexrc.getString();
437 case RC_PRINTEVENPAGEFLAG:
439 print_evenpage_flag = lexrc.getString();
443 case RC_PRINTODDPAGEFLAG:
445 print_oddpage_flag = lexrc.getString();
449 case RC_PRINTPAGERANGEFLAG:
451 print_pagerange_flag = lexrc.getString();
455 case RC_PRINTCOPIESFLAG:
457 print_copies_flag = lexrc.getString();
461 case RC_PRINTCOLLCOPIESFLAG:
463 print_collcopies_flag = lexrc.getString();
467 case RC_PRINTREVERSEFLAG:
469 print_reverse_flag = lexrc.getString();
473 case RC_PRINTLANDSCAPEFLAG:
475 print_landscape_flag = lexrc.getString();
479 case RC_PRINTTOPRINTER:
481 print_to_printer = lexrc.getString();
485 case RC_PRINT_ADAPTOUTPUT:
487 print_adapt_output = lexrc.getBool();
493 print_to_file = lexrc.getString();
497 case RC_PRINTFILEEXTENSION:
499 print_file_extension = lexrc.getString();
503 case RC_PRINTEXSTRAOPTIONS:
505 print_extra_options = lexrc.getString();
509 case RC_PRINTSPOOL_COMMAND:
511 print_spool_command = lexrc.getString();
515 case RC_PRINTSPOOL_PRINTERPREFIX:
517 print_spool_printerprefix = lexrc.getString();
521 case RC_PRINTPAPERDIMENSIONFLAG:
523 print_paper_dimension_flag = lexrc.getString();
527 case RC_PRINTPAPERFLAG:
529 print_paper_flag = lexrc.getString();
533 case RC_CUSTOM_EXPORT_COMMAND:
535 custom_export_command = lexrc.getString();
539 case RC_CUSTOM_EXPORT_FORMAT:
541 custom_export_format = lexrc.getString();
545 case RC_DEFAULT_PAPERSIZE:
548 ascii_lowercase(lexrc.getString());
549 if (size == "usletter")
551 BufferParams::PAPER_USLETTER;
552 else if (size == "legal")
554 BufferParams::PAPER_LEGALPAPER;
555 else if (size == "executive")
557 BufferParams::PAPER_EXECUTIVEPAPER;
558 else if (size == "a3")
560 BufferParams::PAPER_A3PAPER;
561 else if (size == "a4")
563 BufferParams::PAPER_A4PAPER;
564 else if (size == "a5")
566 BufferParams::PAPER_A5PAPER;
567 else if (size == "b5")
569 BufferParams::PAPER_B5PAPER;
573 case RC_VIEWDVI_PAPEROPTION:
575 view_dvi_paper_option = lexrc.getString();
577 view_dvi_paper_option.erase();
583 ps_command = lexrc.getString();
587 case RC_CHKTEX_COMMAND:
589 chktex_command = lexrc.getString();
595 dpi = lexrc.getInteger();
601 zoom = lexrc.getInteger();
607 wheel_jump = lexrc.getInteger();
611 case RC_SCREEN_FONT_SIZES:
613 font_sizes[LyXFont::SIZE_TINY] =
617 font_sizes[LyXFont::SIZE_SCRIPT] =
621 font_sizes[LyXFont::SIZE_FOOTNOTE] =
625 font_sizes[LyXFont::SIZE_SMALL] =
629 font_sizes[LyXFont::SIZE_NORMAL] =
633 font_sizes[LyXFont::SIZE_LARGE] =
637 font_sizes[LyXFont::SIZE_LARGER] =
641 font_sizes[LyXFont::SIZE_LARGEST] =
645 font_sizes[LyXFont::SIZE_HUGE] =
649 font_sizes[LyXFont::SIZE_HUGER] =
654 case RC_SCREEN_FONT_SCALABLE:
656 use_scalable_fonts = lexrc.getBool();
662 autosave = lexrc.getInteger();
666 case RC_DOCUMENTPATH:
668 document_path = ExpandPath(lexrc.getString());
672 case RC_TEMPLATEPATH:
674 template_path = ExpandPath(lexrc.getString());
680 tempdir_path = ExpandPath(lexrc.getString());
686 use_tempdir = lexrc.getBool();
692 lastfiles = ExpandPath(lexrc.getString());
696 case RC_NUMLASTFILES:
698 num_lastfiles = lexrc.getInteger();
702 case RC_CHECKLASTFILES:
704 check_lastfiles = lexrc.getBool();
708 case RC_SCREEN_FONT_ROMAN:
710 roman_font_name = lexrc.getString();
711 oldFontFormat(roman_font_name,
716 case RC_SCREEN_FONT_SANS:
718 sans_font_name = lexrc.getString();
719 oldFontFormat(sans_font_name, sans_font_foundry);
723 case RC_SCREEN_FONT_TYPEWRITER:
725 typewriter_font_name = lexrc.getString();
726 oldFontFormat(typewriter_font_name,
727 typewriter_font_foundry);
731 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
733 roman_font_foundry = lexrc.getString();
737 case RC_SCREEN_FONT_SANS_FOUNDRY:
739 sans_font_foundry = lexrc.getString();
743 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
745 typewriter_font_foundry = lexrc.getString();
749 case RC_SCREEN_FONT_ENCODING:
751 font_norm = lexrc.getString();
752 set_font_norm_type();
756 case RC_POPUP_BOLD_FONT:
758 popup_bold_font = lexrc.getString();
762 case RC_POPUP_NORMAL_FONT:
764 popup_normal_font = lexrc.getString();
768 case RC_POPUP_FONT_ENCODING:
770 popup_font_encoding = lexrc.getString();
776 string lyx_name, x11_name;
779 lyx_name = lexrc.getString();
781 lexrc.printError("Missing color tag.");
786 x11_name = lexrc.getString();
788 lexrc.printError("Missing color name for color: `$$Token'");
792 if (!lcolor.setColor(lyx_name, x11_name)) {
793 lyxerr << "Bad lyxrc set_color for "
799 case RC_AUTOREGIONDELETE:
800 // Auto region delete defaults to true
802 auto_region_delete = lexrc.getBool();
808 // we should not do an explicit binding before
809 // loading a bind file. So, in this case, load
810 // the default bind file.
811 readBindFileIfNeeded();
813 // !!!chb, dynamic key binding...
815 string::size_type res = 0;
819 seq = lexrc.getString();
821 lexrc.printError("RC_BIND: Missing key sequence");
825 if (lexrc.next(true)) {
826 cmd = lexrc.getString();
828 lexrc.printError("RC_BIND: missing command");
832 if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
833 if (lyxerr.debugging(Debug::LYXRC)) {
834 lyxerr << "RC_BIND: Sequence `"
835 << seq << "' Command `"
836 << cmd << "' Action `"
837 << action << '\'' << endl;
839 res = toplevel_keymap->bind(seq, kb_action(action));
840 if (res != string::npos
841 && lyxerr.debugging(Debug::LYXRC)) {
844 "Invalid key sequence `"
847 } else {// cmd is the last token read.
849 "Unknown LyX function `$$Token'");
855 lyxpipes = ExpandPath(lexrc.getString());
859 case RC_CURSOR_FOLLOWS_SCROLLBAR:
861 cursor_follows_scrollbar = lexrc.getBool();
865 case RC_DIALOGS_ICONIFY_WITH_MAIN:
867 dialogs_iconify_with_main = lexrc.getBool();
871 case RC_ASCIIROFF_COMMAND:
873 ascii_roff_command = lexrc.getString();
876 case RC_ASCII_LINELEN:
878 ascii_linelen = lexrc.getInteger();
881 // Spellchecker settings:
882 case RC_USE_SPELL_LIB:
884 use_spell_lib = lexrc.getBool();
887 case RC_SPELL_COMMAND:
889 isp_command = lexrc.getString();
892 case RC_ACCEPT_COMPOUND:
894 isp_accept_compound = lexrc.getBool();
899 isp_use_input_encoding = lexrc.getBool();
902 case RC_USE_ALT_LANG:
904 isp_use_alt_lang = lexrc.getBool();
907 case RC_USE_PERS_DICT:
909 isp_use_pers_dict = lexrc.getBool();
912 case RC_USE_ESC_CHARS:
914 isp_use_esc_chars = lexrc.getBool();
919 isp_alt_lang = lexrc.getString();
924 isp_pers_dict = lexrc.getString();
929 isp_esc_chars = lexrc.getString();
934 make_backup = lexrc.getBool();
937 case RC_BACKUPDIR_PATH:
939 backupdir_path = ExpandPath(lexrc.getString());
942 case RC_DATE_INSERT_FORMAT:
944 date_insert_format = lexrc.getString();
947 case RC_LANGUAGE_PACKAGE:
949 language_package = lexrc.getString();
952 case RC_LANGUAGE_AUTO_BEGIN:
954 language_auto_begin = lexrc.getBool();
957 case RC_LANGUAGE_AUTO_END:
959 language_auto_end = lexrc.getBool();
962 case RC_LANGUAGE_GLOBAL_OPTIONS:
964 language_global_options = lexrc.getBool();
967 case RC_LANGUAGE_USE_BABEL:
969 language_use_babel = lexrc.getBool();
972 case RC_LANGUAGE_COMMAND_BEGIN:
974 language_command_begin = lexrc.getString();
977 case RC_LANGUAGE_COMMAND_END:
979 language_command_end = lexrc.getString();
982 case RC_LANGUAGE_COMMAND_LOCAL:
984 language_command_local = lexrc.getString();
989 rtl_support = lexrc.getBool();
994 auto_number = lexrc.getBool();
997 case RC_MARK_FOREIGN_LANGUAGE:
999 mark_foreign_language = lexrc.getBool();
1003 case RC_CONVERTER: {
1004 string from, to, command, flags;
1006 from = lexrc.getString();
1009 to = lexrc.getString();
1012 command = lexrc.getString();
1015 flags = lexrc.getString();
1018 || token(command, ' ', 0) == "none") {
1019 converters.erase(from, to);
1021 converters.add(from, to, command, flags);
1026 string format, command;
1028 format = lexrc.getString();
1031 command = lexrc.getString();
1032 if (token(command, ' ', 0) == "none")
1035 formats.setViewer(format, command);
1039 string format, extension, prettyname, shortcut;
1041 format = lexrc.getString();
1044 extension = lexrc.getString();
1047 prettyname = lexrc.getString();
1050 shortcut = lexrc.getString();
1052 if (prettyname.empty()) {
1053 if (converters.formatIsUsed(format)) {
1054 lyxerr << "Can't delete format "
1057 formats.erase(format);
1060 formats.add(format, extension, prettyname,
1065 case RC_DEFAULT_LANGUAGE:
1067 default_language = lexrc.getString();
1071 case RC_LABEL_INIT_LENGTH:
1073 label_init_length = lexrc.getInteger();
1077 case RC_SHOW_BANNER:
1079 show_banner = lexrc.getBool();
1085 preview = lexrc.getBool();
1089 case RC_PREVIEW_HASHED_LABELS:
1091 preview_hashed_labels = lexrc.getBool();
1095 case RC_PREVIEW_SCALE_FACTOR:
1097 preview_scale_factor = lexrc.getFloat();
1103 user_name = lexrc.getString();
1108 user_email = lexrc.getString();
1111 case RC_LAST: break; // this is just a dummy
1115 /// Update converters data-structures
1116 converters.update(formats);
1117 converters.buildGraph();
1123 void LyXRC::write(string const & filename) const
1125 ofstream ofs(filename.c_str());
1131 void LyXRC::print() const
1133 if (lyxerr.debugging())
1140 void LyXRC::output(ostream & os) const
1142 os << "### This file is part of\n"
1143 << "### ========================================================\n"
1144 << "### LyX, The Document Processor\n"
1146 << "### Copyright 1995 Matthias Ettrich\n"
1147 << "### Copyright 1995-2001 The LyX Team.\n"
1149 << "### ========================================================\n"
1151 << "# This file is written by LyX, if you want to make your own\n"
1152 << "# modifications you should do them from inside LyX and save\n"
1155 // Why the switch you might ask. It is a trick to ensure that all
1156 // the elements in the LyXRCTags enum is handled. As you can see
1157 // there are no breaks at all. So it is just a huge fall-through.
1158 // The nice thing is that we will get a warning from the compiler
1159 // if we forget an element.
1160 LyXRCTags tag = RC_LAST;
1164 // input/include files are not done here
1166 // bindings is not written to the preferences file.
1168 if (bind_file != system_lyxrc.bind_file) {
1169 os << "\\bind_file " << bind_file << "\n";
1175 << "# MISC SECTION ######################################\n"
1178 // bind files are not done here.
1180 if (ui_file != system_lyxrc.ui_file) {
1181 os << "\\ui_file \"" << ui_file << "\"\n";
1183 case RC_AUTOREGIONDELETE:
1184 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1185 os << "# Set to false to inhibit automatic replacement of\n"
1186 << "# the current selection.\n"
1187 << "\\auto_region_delete " << tostr(auto_region_delete)
1190 case RC_AUTORESET_OPTIONS:
1191 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1192 os << "# Set to false to inhibit automatic reset of\n"
1193 << "# the class options to defaults on class change.\n"
1194 << "\\auto_reset_options " << tostr(auto_reset_options)
1198 if (autosave != system_lyxrc.autosave) {
1199 os << "# The time interval between auto-saves in seconds.\n"
1200 << "\\autosave " << autosave << '\n';
1202 case RC_DISPLAY_GRAPHICS:
1203 if (display_graphics != system_lyxrc.display_graphics) {
1204 os << "# Display graphics within LyX\n"
1205 << "# monochrome|grayscale|color|none\n"
1206 << "\\display_graphics " << grfx::displayTranslator.find(display_graphics)
1210 case RC_VIEWDVI_PAPEROPTION:
1211 if (view_dvi_paper_option
1212 != system_lyxrc.view_dvi_paper_option) {
1213 os << "# Options used to specify paper size to the\n"
1214 << "# view_dvi_command (e.g. -paper)\n"
1215 << "\\view_dvi_paper_option \""
1216 << view_dvi_paper_option << "\"\n";
1218 case RC_DEFAULT_PAPERSIZE:
1219 if (default_papersize != system_lyxrc.default_papersize) {
1220 os << "# The default papersize to use.\n"
1221 << "\\default_papersize \"";
1222 switch (default_papersize) {
1223 case BufferParams::PAPER_USLETTER:
1224 os << "usletter"; break;
1225 case BufferParams::PAPER_LEGALPAPER:
1226 os << "legal"; break;
1227 case BufferParams::PAPER_EXECUTIVEPAPER:
1228 os << "executive"; break;
1229 case BufferParams::PAPER_A3PAPER:
1231 case BufferParams::PAPER_A4PAPER:
1233 case BufferParams::PAPER_A5PAPER:
1235 case BufferParams::PAPER_B5PAPER:
1237 case BufferParams::PAPER_DEFAULT: break;
1242 if (ps_command != system_lyxrc.ps_command) {
1243 os << "# Program used for interpreting postscript.\n"
1244 << "\\ps_command \"" << ps_command << "\"\n";
1246 case RC_CHKTEX_COMMAND:
1247 if (chktex_command != system_lyxrc.chktex_command) {
1248 os << "\\chktex_command \"" << chktex_command << "\"\n";
1251 if (use_kbmap != system_lyxrc.use_kbmap) {
1252 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1254 case RC_KBMAP_PRIMARY:
1255 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1256 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1258 case RC_KBMAP_SECONDARY:
1259 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1260 os << "\\kbmap_secondary \"" << secondary_kbmap
1264 if (lyxpipes != system_lyxrc.lyxpipes) {
1265 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1267 case RC_DATE_INSERT_FORMAT:
1268 if (date_insert_format != system_lyxrc.date_insert_format) {
1269 os << "\\date_insert_format \"" << date_insert_format
1272 case RC_LABEL_INIT_LENGTH:
1273 if (label_init_length != system_lyxrc.label_init_length) {
1274 os << "\\label_init_length " << label_init_length
1279 os << "\\user_name \"" << user_name << "\"\n";
1282 os << "\\user_email \"" << user_email << "\"\n";
1284 case RC_SHOW_BANNER:
1285 if (show_banner != system_lyxrc.show_banner) {
1286 os << "\\show_banner " << tostr(show_banner) << '\n';
1290 if (preview != system_lyxrc.preview) {
1291 os << "\\preview " << tostr(preview) << '\n';
1294 case RC_PREVIEW_HASHED_LABELS:
1295 if (preview_hashed_labels !=
1296 system_lyxrc.preview_hashed_labels) {
1297 os << "\\preview_hashed_labels "
1298 << tostr(preview_hashed_labels) << '\n';
1301 case RC_PREVIEW_SCALE_FACTOR:
1302 if (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 (popup_normal_font != system_lyxrc.popup_normal_font) {
1313 os << "\\popup_normal_font \"" << popup_normal_font
1316 case RC_POPUP_BOLD_FONT:
1317 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1318 os << "\\popup_bold_font \"" << popup_bold_font
1321 case RC_POPUP_FONT_ENCODING:
1322 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1323 os << "\\popup_font_encoding \"" << popup_font_encoding
1327 if (dpi != system_lyxrc.dpi) {
1328 os << "\\screen_dpi " << dpi << '\n';
1330 case RC_SCREEN_ZOOM:
1331 if (zoom != system_lyxrc.zoom) {
1332 os << "\\screen_zoom " << zoom << '\n';
1335 if (wheel_jump != system_lyxrc.wheel_jump) {
1336 os << "\\wheel_jump " << wheel_jump << '\n';
1338 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1339 if (cursor_follows_scrollbar
1340 != system_lyxrc.cursor_follows_scrollbar) {
1341 os << "\\cursor_follows_scrollbar "
1342 << tostr(cursor_follows_scrollbar) << '\n';
1344 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1345 if (dialogs_iconify_with_main
1346 != system_lyxrc.dialogs_iconify_with_main) {
1347 os << "\\dialogs_iconify_with_main "
1348 << tostr(dialogs_iconify_with_main) << '\n';
1350 case RC_SCREEN_FONT_ROMAN:
1351 if (roman_font_name != system_lyxrc.roman_font_name) {
1352 os << "\\screen_font_roman \"" << roman_font_name
1355 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1356 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1357 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1360 case RC_SCREEN_FONT_SANS:
1361 if (sans_font_name != system_lyxrc.sans_font_name) {
1362 os << "\\screen_font_sans \"" << sans_font_name
1365 case RC_SCREEN_FONT_SANS_FOUNDRY:
1366 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1367 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1370 case RC_SCREEN_FONT_TYPEWRITER:
1371 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1372 os << "\\screen_font_typewriter \""
1373 << typewriter_font_name << "\"\n";
1375 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1376 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1377 os << "\\screen_font_typewriter_foundry \""
1378 << typewriter_font_foundry << "\"\n";
1381 case RC_SCREEN_FONT_SCALABLE:
1382 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1383 os << "\\screen_font_scalable "
1384 << tostr(use_scalable_fonts)
1387 case RC_SCREEN_FONT_ENCODING:
1388 if (font_norm != system_lyxrc.font_norm) {
1389 os << "\\screen_font_encoding \"" << font_norm
1392 case RC_SCREEN_FONT_SIZES:
1393 if (font_sizes[LyXFont::SIZE_TINY]
1394 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1395 font_sizes[LyXFont::SIZE_SCRIPT]
1396 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1397 font_sizes[LyXFont::SIZE_FOOTNOTE]
1398 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1399 font_sizes[LyXFont::SIZE_SMALL]
1400 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1401 font_sizes[LyXFont::SIZE_NORMAL]
1402 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1403 font_sizes[LyXFont::SIZE_LARGE]
1404 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1405 font_sizes[LyXFont::SIZE_LARGER]
1406 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1407 font_sizes[LyXFont::SIZE_LARGEST]
1408 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1409 font_sizes[LyXFont::SIZE_HUGE]
1410 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1411 font_sizes[LyXFont::SIZE_HUGER]
1412 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1413 os.setf(ios::fixed);
1415 os << "\\screen_font_sizes"
1416 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1417 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1418 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1419 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1420 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1421 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1422 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1423 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1424 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1425 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1430 << "# COLOR SECTION ###################################\n"
1434 for (int i = 0; i < LColor::ignore; ++i) {
1435 LColor::color lc = static_cast<LColor::color>(i);
1437 string const col(lcolor.getX11Name(lc));
1438 if (col != system_lcolor.getX11Name(lc)) {
1439 os << "\\set_color \""
1440 << lcolor.getLyXName(lc) << "\" \""
1446 << "# PRINTER SECTION ###################################\n"
1450 if (printer != system_lyxrc.printer) {
1451 os << "\\printer \"" << printer << "\"\n";
1453 case RC_PRINT_ADAPTOUTPUT:
1454 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1455 os << "\\print_adapt_output "
1456 << tostr(print_adapt_output)
1459 case RC_PRINT_COMMAND:
1460 if (print_command != system_lyxrc.print_command) {
1461 os << "\\print_command \"" << print_command << "\"\n";
1463 case RC_PRINTEXSTRAOPTIONS:
1464 if (print_extra_options != system_lyxrc.print_extra_options) {
1465 os << "\\print_extra_options \"" << print_extra_options
1468 case RC_PRINTSPOOL_COMMAND:
1469 if (print_spool_command != system_lyxrc.print_spool_command) {
1470 os << "\\print_spool_command \"" << print_spool_command
1473 case RC_PRINTSPOOL_PRINTERPREFIX:
1474 if (print_spool_printerprefix
1475 != system_lyxrc.print_spool_printerprefix) {
1476 os << "\\print_spool_printerprefix \""
1477 << print_spool_printerprefix << "\"\n";
1479 case RC_PRINTEVENPAGEFLAG:
1480 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1481 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1484 case RC_PRINTODDPAGEFLAG:
1485 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1486 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1489 case RC_PRINTREVERSEFLAG:
1490 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1491 os << "\\print_reverse_flag \"" << print_reverse_flag
1494 case RC_PRINTLANDSCAPEFLAG:
1495 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1496 os << "\\print_landscape_flag \"" << print_landscape_flag
1499 case RC_PRINTPAGERANGEFLAG:
1500 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1501 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1504 case RC_PRINTCOPIESFLAG:
1505 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1506 os << "\\print_copies_flag \"" << print_copies_flag
1509 case RC_PRINTCOLLCOPIESFLAG:
1510 if (print_collcopies_flag
1511 != system_lyxrc.print_collcopies_flag) {
1512 os << "\\print_collcopies_flag \""
1513 << print_collcopies_flag
1516 case RC_PRINTPAPERFLAG:
1517 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1518 os << "\\print_paper_flag \"" << print_paper_flag
1521 case RC_PRINTPAPERDIMENSIONFLAG:
1522 if (print_paper_dimension_flag
1523 != system_lyxrc.print_paper_dimension_flag) {
1524 os << "\\print_paper_dimension_flag \""
1525 << print_paper_dimension_flag << "\"\n";
1527 case RC_PRINTTOPRINTER:
1528 if (print_to_printer != system_lyxrc.print_to_printer) {
1529 os << "\\print_to_printer \"" << print_to_printer
1532 case RC_PRINTTOFILE:
1533 if (print_to_file != system_lyxrc.print_to_file) {
1534 os << "\\print_to_file \"" << print_to_file << "\"\n";
1536 case RC_PRINTFILEEXTENSION:
1537 if (print_file_extension != system_lyxrc.print_file_extension) {
1538 os << "\\print_file_extension \""
1539 << print_file_extension
1544 << "# EXPORT SECTION ####################################\n"
1547 case RC_CUSTOM_EXPORT_COMMAND:
1548 if (custom_export_command
1549 != system_lyxrc.custom_export_command) {
1550 os << "\\custom_export_command \""
1551 << custom_export_command
1554 case RC_CUSTOM_EXPORT_FORMAT:
1555 if (custom_export_format
1556 != system_lyxrc.custom_export_format) {
1557 os << "\\custom_export_format \"" << custom_export_format
1562 << "# TEX SECTION #######################################\n"
1565 case RC_FONT_ENCODING:
1566 if (fontenc != system_lyxrc.fontenc) {
1567 os << "\\font_encoding \"" << fontenc << "\"\n";
1571 << "# FILE SECTION ######################################\n"
1574 case RC_DOCUMENTPATH:
1575 if (document_path != system_lyxrc.document_path) {
1576 os << "\\document_path \"" << document_path << "\"\n";
1579 if (lastfiles != system_lyxrc.lastfiles) {
1580 os << "\\lastfiles \"" << lastfiles << "\"\n";
1582 case RC_NUMLASTFILES:
1583 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1584 os << "\\num_lastfiles " << num_lastfiles << '\n';
1586 case RC_CHECKLASTFILES:
1587 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1588 os << "\\check_lastfiles " << tostr(check_lastfiles)
1591 case RC_TEMPLATEPATH:
1592 if (template_path != system_lyxrc.template_path) {
1593 os << "\\template_path \"" << template_path << "\"\n";
1595 case RC_TEMPDIRPATH:
1596 if (tempdir_path != system_lyxrc.tempdir_path) {
1597 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1600 if (use_tempdir != system_lyxrc.use_tempdir) {
1601 os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
1603 case RC_ASCII_LINELEN:
1604 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1605 os << "\\ascii_linelen " << ascii_linelen << '\n';
1607 case RC_MAKE_BACKUP:
1608 if (make_backup != system_lyxrc.make_backup) {
1609 os << "\\make_backup " << tostr(make_backup) << '\n';
1611 case RC_BACKUPDIR_PATH:
1612 if (backupdir_path != system_lyxrc.backupdir_path) {
1613 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1617 << "# ASCII EXPORT SECTION ##############################\n"
1620 case RC_ASCIIROFF_COMMAND:
1621 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1622 os << "\\ascii_roff_command \"" << ascii_roff_command
1627 << "# SPELLCHECKER SECTION ##############################\n"
1629 case RC_USE_SPELL_LIB:
1630 if (use_spell_lib != system_lyxrc.use_spell_lib) {
1631 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1633 case RC_SPELL_COMMAND:
1634 if (isp_command != system_lyxrc.isp_command) {
1635 os << "\\spell_command \"" << isp_command << "\"\n";
1637 case RC_ACCEPT_COMPOUND:
1638 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1639 os << "\\accept_compound " << tostr(isp_accept_compound)
1642 case RC_USE_ALT_LANG:
1643 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1644 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1648 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1649 os << "\\alternate_language \"" << isp_alt_lang
1652 case RC_USE_ESC_CHARS:
1653 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1654 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1658 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1659 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1661 case RC_USE_PERS_DICT:
1662 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1663 os << "\\use_personal_dictionary "
1664 << tostr(isp_use_pers_dict)
1668 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1669 os << "\\personal_dictionary \"" << isp_pers_dict
1672 case RC_USE_INP_ENC:
1673 if (isp_use_input_encoding
1674 != system_lyxrc.isp_use_input_encoding) {
1675 os << "\\use_input_encoding "
1676 << tostr(isp_use_input_encoding)
1681 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1684 case RC_RTL_SUPPORT:
1685 if (rtl_support != system_lyxrc.rtl_support) {
1686 os << "\\rtl " << tostr(rtl_support) << '\n';
1688 case RC_LANGUAGE_PACKAGE:
1689 if (language_package != system_lyxrc.language_package) {
1690 os << "\\language_package \"" << language_package
1693 case RC_LANGUAGE_GLOBAL_OPTIONS:
1694 if (language_global_options
1695 != system_lyxrc.language_global_options) {
1696 os << "\\language_global_options \""
1697 << tostr(language_global_options)
1700 case RC_LANGUAGE_USE_BABEL:
1701 if (language_use_babel != system_lyxrc.language_use_babel) {
1702 os << "\\language_use_babel \""
1703 << tostr(language_use_babel)
1706 case RC_LANGUAGE_COMMAND_BEGIN:
1707 if (language_command_begin
1708 != system_lyxrc.language_command_begin) {
1709 os << "\\language_command_begin \""
1710 << language_command_begin
1713 case RC_LANGUAGE_COMMAND_END:
1714 if (language_command_end
1715 != system_lyxrc.language_command_end) {
1716 os << "\\language_command_end \"" << language_command_end
1719 case RC_LANGUAGE_COMMAND_LOCAL:
1720 if (language_command_local
1721 != system_lyxrc.language_command_local) {
1722 os << "\\language_command_local \""
1723 << language_command_local
1726 case RC_LANGUAGE_AUTO_BEGIN:
1727 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1728 os << "\\language_auto_begin "
1729 << tostr(language_auto_begin) << '\n';
1731 case RC_LANGUAGE_AUTO_END:
1732 if (language_auto_end != system_lyxrc.language_auto_end) {
1733 os << "\\language_auto_end "
1734 << tostr(language_auto_end) << '\n';
1736 case RC_MARK_FOREIGN_LANGUAGE:
1737 if (mark_foreign_language
1738 != system_lyxrc.mark_foreign_language) {
1739 os << "\\mark_foreign_language " <<
1740 tostr(mark_foreign_language) << '\n';
1744 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1747 case RC_AUTO_NUMBER:
1748 if (auto_number != system_lyxrc.auto_number) {
1749 os << "\\auto_number " << tostr(auto_number) << '\n';
1751 case RC_DEFAULT_LANGUAGE:
1752 if (default_language != system_lyxrc.default_language) {
1753 os << "\\default_language " << default_language << '\n';
1757 << "# FORMATS SECTION ##########################\n"
1761 // Look for deleted formats
1762 for (Formats::const_iterator cit = formats.begin();
1763 cit != formats.end(); ++cit) {
1764 Format const * format =
1765 system_formats.getFormat(cit->name());
1767 format->extension() != cit->extension() ||
1768 format->prettyname() != cit->prettyname() ||
1769 format->shortcut() != cit->shortcut())
1770 os << "\\format \"" << cit->name() << "\" \""
1771 << cit->extension() << "\" \""
1772 << cit->prettyname() << "\" \""
1773 << cit->shortcut() << "\"\n";
1776 // New/modifed formats
1777 for (Formats::const_iterator cit = system_formats.begin();
1778 cit != system_formats.end(); ++cit)
1779 if (!formats.getFormat(cit->name()))
1780 os << "\\format \"" << cit->name()
1781 << "\" \"\" \"\" \"\"\n";
1783 for (Formats::const_iterator cit = formats.begin();
1784 cit != formats.end(); ++cit) {
1785 Format const * format =
1786 system_formats.getFormat(cit->name());
1787 if ((!format || format->viewer() != cit->viewer()) &&
1788 (format || !cit->viewer().empty()))
1789 os << "\\viewer \"" << cit->name() << "\" \""
1790 << cit->viewer() << "\"\n";
1794 << "# CONVERTERS SECTION ##########################\n"
1798 // Look for new converters
1799 for (Converters::const_iterator cit = converters.begin();
1800 cit != converters.end(); ++cit) {
1801 Converter const * converter =
1802 system_converters.getConverter(cit->from,
1805 converter->command != cit->command ||
1806 converter->flags != cit->flags)
1807 os << "\\converter \"" << cit->from << "\" \""
1808 << cit->to << "\" \""
1809 << cit->command << "\" \""
1810 << cit->flags << "\"\n";
1813 // New/modifed converters
1814 for (Converters::const_iterator cit = system_converters.begin();
1815 cit != system_converters.end(); ++cit)
1816 if (!converters.getConverter(cit->from, cit->to))
1817 os << "\\converter \"" << cit->from
1818 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1824 void LyXRC::set_font_norm_type()
1826 if (font_norm == "iso10646-1")
1827 font_norm_type = ISO_10646_1;
1828 else if (font_norm == "iso8859-1")
1829 font_norm_type = ISO_8859_1;
1830 else if (font_norm == "iso8859-3")
1831 font_norm_type = ISO_8859_3;
1832 else if (font_norm == "iso8859-4")
1833 font_norm_type = ISO_8859_4;
1834 else if (font_norm == "iso8859-6.8x")
1835 font_norm_type = ISO_8859_6_8;
1836 else if (font_norm == "iso8859-9")
1837 font_norm_type = ISO_8859_9;
1838 else if (font_norm == "iso8859-15")
1839 font_norm_type = ISO_8859_15;
1841 font_norm_type = OTHER_ENCODING;
1845 string const LyXRC::getDescription(LyXRCTags tag)
1850 case RC_FONT_ENCODING:
1851 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1855 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1858 case RC_PRINT_COMMAND:
1859 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1862 case RC_PRINTEVENPAGEFLAG:
1863 str = _("The option to print only even pages.");
1866 case RC_PRINTODDPAGEFLAG:
1867 str = _("The option to print only odd pages.");
1870 case RC_PRINTPAGERANGEFLAG:
1871 str = _("The option for specifying a comma-separated list of pages to print.");
1874 case RC_PRINTCOPIESFLAG:
1875 str = _("The option for specifying the number of copies to print.");
1878 case RC_PRINTCOLLCOPIESFLAG:
1879 str = _("The option for specifying whether the copies should be collated.");
1882 case RC_PRINTREVERSEFLAG:
1883 str = _("The option to reverse the order of the pages printed.");
1886 case RC_PRINTLANDSCAPEFLAG:
1887 str = _("The option to print out in landscape.");
1890 case RC_PRINTPAPERFLAG:
1891 str = _("The option to specify paper type.");
1894 case RC_PRINTPAPERDIMENSIONFLAG:
1895 str = _("Option to specify the dimensions of the print paper.");
1898 case RC_PRINTTOPRINTER:
1899 str = _("Option to pass to the print program to print on a specific printer.");
1902 case RC_PRINT_ADAPTOUTPUT:
1903 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1906 case RC_PRINTTOFILE:
1907 str = _("Option to pass to the print program to print to a file.");
1910 case RC_PRINTFILEEXTENSION:
1911 str = _("Extension of printer program output file. Usually \".ps\".");
1914 case RC_PRINTEXSTRAOPTIONS:
1915 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1918 case RC_PRINTSPOOL_COMMAND:
1919 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.");
1922 case RC_PRINTSPOOL_PRINTERPREFIX:
1923 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.");
1927 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1930 case RC_SCREEN_ZOOM:
1931 //xgettext:no-c-format
1932 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1935 case RC_SCREEN_FONT_SIZES:
1936 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1939 case RC_SCREEN_FONT_ROMAN:
1940 case RC_SCREEN_FONT_SANS:
1941 case RC_SCREEN_FONT_TYPEWRITER:
1942 str = _("The screen fonts used to display the text while editing.");
1945 case RC_POPUP_BOLD_FONT:
1946 str = _("The bold font in the dialogs.");
1949 case RC_POPUP_NORMAL_FONT:
1950 str = _("The normal font in the dialogs.");
1953 case RC_SCREEN_FONT_ENCODING:
1954 str = _("The encoding for the screen fonts.");
1957 case RC_POPUP_FONT_ENCODING:
1958 str = _("The encoding for the menu/popups fonts.");
1965 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1968 case RC_DOCUMENTPATH:
1969 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1972 case RC_TEMPLATEPATH:
1973 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1976 case RC_TEMPDIRPATH:
1977 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1981 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1985 str = _("The file where the last-files information should be stored.");
1988 case RC_AUTOREGIONDELETE:
1989 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1992 case RC_AUTORESET_OPTIONS:
1993 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1997 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2001 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2005 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2009 case RC_KBMAP_PRIMARY:
2010 case RC_KBMAP_SECONDARY:
2011 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.");
2014 case RC_ASCIIROFF_COMMAND:
2015 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.");
2018 case RC_ASCII_LINELEN:
2019 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2022 case RC_NUMLASTFILES:
2023 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
2026 case RC_CHECKLASTFILES:
2027 str = _("Select to check whether the lastfiles still exist.");
2030 case RC_VIEWDVI_PAPEROPTION:
2031 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2034 case RC_DEFAULT_PAPERSIZE:
2035 str = _("Specify the default paper size.");
2041 case RC_ACCEPT_COMPOUND:
2042 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2045 case RC_SPELL_COMMAND:
2046 str = _("What command runs the spell checker?");
2049 case RC_USE_INP_ENC:
2050 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.");
2053 case RC_USE_ALT_LANG:
2055 str = _("Specify an alternate language. The default is to use the language of the document.");
2058 case RC_USE_PERS_DICT:
2060 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2063 case RC_USE_ESC_CHARS:
2065 str = _("Specify additional chars that can be part of a word.");
2068 case RC_SCREEN_FONT_SCALABLE:
2069 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.");
2072 case RC_CHKTEX_COMMAND:
2073 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2076 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2077 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.");
2080 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2081 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2084 case RC_DISPLAY_GRAPHICS:
2085 str = _("Select how LyX will display any graphics.");
2088 case RC_MAKE_BACKUP:
2089 str = _("De-select if you don't want LyX to create backup files.");
2092 case RC_BACKUPDIR_PATH:
2093 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.");
2096 case RC_RTL_SUPPORT:
2097 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2100 case RC_MARK_FOREIGN_LANGUAGE:
2101 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2104 case RC_LANGUAGE_PACKAGE:
2105 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2108 case RC_LANGUAGE_GLOBAL_OPTIONS:
2109 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2112 case RC_LANGUAGE_USE_BABEL:
2113 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2116 case RC_LANGUAGE_AUTO_BEGIN:
2117 str = _("Select if a language switching command is needed at the beginning of the document.");
2120 case RC_LANGUAGE_AUTO_END:
2121 str = _("Select if a language switching command is needed at the end of the document.");
2124 case RC_LANGUAGE_COMMAND_BEGIN:
2125 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.");
2128 case RC_LANGUAGE_COMMAND_END:
2129 str = _("The LaTeX command for changing back to the language of the document.");
2132 case RC_LANGUAGE_COMMAND_LOCAL:
2133 str = _("The LaTeX command for local changing of the language.");
2136 case RC_DATE_INSERT_FORMAT:
2137 //xgettext:no-c-format
2138 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2141 case RC_SHOW_BANNER:
2142 str = _("De-select if you don't want the startup banner.");
2146 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2158 case RC_DEFAULT_LANGUAGE:
2159 str = _("New documents will be assigned this language.");
2162 case RC_LABEL_INIT_LENGTH:
2163 str = _("Maximum number of words in the initialization string for a new label");
2167 str = _("Shows a typeset preview of things such as math");
2170 case RC_PREVIEW_HASHED_LABELS:
2171 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2174 case RC_PREVIEW_SCALE_FACTOR:
2175 str = _("Scale the preview size to suit.");
2185 // The global instance
2188 // The global copy of the system lyxrc entries (everything except preferences)