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"
43 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
47 // when adding something to this array keep it sorted!
48 keyword_item lyxrcTags[] = {
49 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
50 { "\\alternate_language", LyXRC::RC_ALT_LANG },
51 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
52 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
53 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
54 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
55 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
56 { "\\autosave", LyXRC::RC_AUTOSAVE },
57 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
58 { "\\bind", LyXRC::RC_BIND },
59 { "\\bind_file", LyXRC::RC_BINDFILE },
60 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
61 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
62 { "\\converter", LyXRC::RC_CONVERTER },
63 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
64 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
65 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
66 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
67 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
68 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
69 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
70 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
71 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
72 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
73 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
74 { "\\format", LyXRC::RC_FORMAT },
75 { "\\input", LyXRC::RC_INPUT },
76 { "\\kbmap", LyXRC::RC_KBMAP },
77 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
78 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
79 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
80 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
81 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
82 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
83 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
84 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
85 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
86 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
87 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
88 { "\\lastfiles", LyXRC::RC_LASTFILES },
89 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
90 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
91 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
92 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
93 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
94 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
95 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
96 { "\\preview", LyXRC::RC_PREVIEW },
97 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
98 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
99 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
100 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
101 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
102 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
103 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
104 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
105 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
106 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
107 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
108 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
109 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
110 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
111 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
112 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
113 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
114 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
115 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
116 { "\\printer", LyXRC::RC_PRINTER },
117 { "\\ps_command", LyXRC::RC_PS_COMMAND },
118 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
119 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
120 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
121 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
122 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
123 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
124 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
125 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
126 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
127 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
128 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
129 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
130 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
131 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
132 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
133 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
134 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
135 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
136 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
137 { "\\set_color", LyXRC::RC_SET_COLOR },
138 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
139 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
140 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
141 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
142 { "\\ui_file", LyXRC::RC_UIFILE },
143 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
144 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
145 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
146 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
147 // compatibility with versions older than 1.4.0 only
148 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
149 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
150 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
151 { "\\user_email", LyXRC::RC_USER_EMAIL },
152 { "\\user_name", LyXRC::RC_USER_NAME },
153 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
154 { "\\viewer" ,LyXRC::RC_VIEWER},
155 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
158 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
169 void LyXRC::setDefaults() {
173 // Get printer from the environment. If fail, use default "",
174 // assuming that everything is set up correctly.
175 printer = GetEnv("PRINTER");
176 print_adapt_output = false;
177 print_command = "dvips";
178 print_evenpage_flag = "-B";
179 print_oddpage_flag = "-A";
180 print_pagerange_flag = "-pp";
181 print_copies_flag = "-c";
182 print_collcopies_flag = "-C";
183 print_reverse_flag = "-r";
184 print_landscape_flag = "-t landscape";
185 print_to_printer = "-P";
186 print_to_file = "-o ";
187 print_file_extension = ".ps";
188 print_paper_flag = "-t";
189 print_paper_dimension_flag = "-T";
190 document_path.erase();
191 tempdir_path = "/tmp";
194 view_dvi_paper_option.erase();
195 default_papersize = BufferParams::PAPER_USLETTER;
196 custom_export_format = "ps";
197 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
200 // Because a screen typically is wider than a piece of paper:
203 // Default LaTeX font size:
204 font_sizes[LyXFont::SIZE_TINY] = 5.0;
205 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
206 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
207 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
208 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
209 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
210 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
211 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
212 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
213 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
214 use_scalable_fonts = true;
215 roman_font_name = "";
217 typewriter_font_name = "";
218 popup_bold_font = "-*-helvetica-bold-r";
219 popup_normal_font = "-*-helvetica-medium-r";
220 font_norm = "iso8859-1";
221 font_norm_type = ISO_8859_1;
222 popup_font_encoding.erase();
224 auto_region_delete = true;
225 auto_reset_options = false;
228 check_lastfiles = true;
230 backupdir_path.erase();
231 display_graphics = grfx::ColorDisplay;
232 // Spellchecker settings:
233 use_spell_lib = true;
234 isp_command = "ispell";
235 isp_accept_compound = false;
236 isp_use_input_encoding = false;
237 isp_use_alt_lang = false;
238 isp_use_pers_dict = false;
239 isp_use_esc_chars = false;
243 mark_foreign_language = true;
244 language_auto_begin = true;
245 language_auto_end = true;
246 language_global_options = true;
247 language_use_babel = true;
248 language_package = "\\usepackage{babel}";
249 language_command_begin = "\\selectlanguage{$$lang}";
250 language_command_local = "\\foreignlanguage{$$lang}{";
251 default_language = "english";
255 date_insert_format = "%A, %e %B %Y";
256 cursor_follows_scrollbar = false;
257 dialogs_iconify_with_main = false;
258 label_init_length = 3;
260 preview_hashed_labels = false;
261 preview_scale_factor = 0.9;
263 user_name = lyx::user_name();
265 user_email = lyx::user_email();
267 if (user_email.empty())
268 user_email = _("email address unknown");
272 int LyXRC::ReadBindFile(string const & name)
275 string const tmp = i18nLibFileSearch("bind", name, "bind");
276 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
277 int const result = read(tmp);
279 lyxerr << "Error reading bind file: " << tmp << endl;
284 void LyXRC::readBindFileIfNeeded()
287 ReadBindFile(bind_file);
293 void oldFontFormat(string & family, string & foundry)
295 if (family.empty() || family[0] != '-')
297 foundry = token(family, '-', 1);
298 family = token(family, '-', 2);
306 int LyXRC::read(string const & filename)
308 LyXLex lexrc(lyxrcTags, lyxrcCount);
309 if (lyxerr.debugging(Debug::PARSER))
310 lexrc.printTable(lyxerr);
312 lexrc.setFile(filename);
313 if (!lexrc.isOK()) return -2;
315 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
317 while (lexrc.isOK()) {
318 // By using two switches we take advantage of the compiler
319 // telling us if we have missed a LyXRCTags element in
320 // the second switch.
321 // Note that this also shows a problem with LyXLex since it
322 // helps us avoid taking advantage of the strictness of the
325 int le = lexrc.lex();
327 case LyXLex::LEX_UNDEF:
328 lexrc.printError("Unknown tag `$$Token'");
330 case LyXLex::LEX_FEOF:
334 switch (static_cast<LyXRCTags>(le)) {
335 case RC_INPUT: // Include file
338 LibFileSearch(string(),
341 lexrc.printError("Error reading "
342 "included file: "+tmp);
346 case RC_BINDFILE: // RVDK_PATCH_5
348 string const tmp(lexrc.getString());
350 // We are already in the
351 // "actually read bind file"
355 // We are still in the "just
356 // remember the name of the
365 ui_file = lexrc.getString();
369 case RC_AUTORESET_OPTIONS:
371 auto_reset_options = lexrc.getBool();
375 case RC_DISPLAY_GRAPHICS:
377 display_graphics = grfx::displayTranslator.find(lexrc.getString());
383 use_kbmap = lexrc.getBool();
387 case RC_KBMAP_PRIMARY:
389 string const kmap(lexrc.getString());
392 } else if (!LibFileSearch("kbd", kmap,
394 primary_kbmap = kmap;
396 lexrc.printError("LyX: Keymap `$$Token' not found");
401 case RC_KBMAP_SECONDARY:
403 string const kmap(lexrc.getString());
406 } else if (!LibFileSearch("kbd", kmap,
408 secondary_kbmap = kmap;
410 lexrc.printError("LyX: Keymap `$$Token' not found");
415 case RC_FONT_ENCODING:
417 fontenc = lexrc.getString();
423 printer = lexrc.getString();
427 case RC_PRINT_COMMAND:
429 print_command = lexrc.getString();
433 case RC_PRINTEVENPAGEFLAG:
435 print_evenpage_flag = lexrc.getString();
439 case RC_PRINTODDPAGEFLAG:
441 print_oddpage_flag = lexrc.getString();
445 case RC_PRINTPAGERANGEFLAG:
447 print_pagerange_flag = lexrc.getString();
451 case RC_PRINTCOPIESFLAG:
453 print_copies_flag = lexrc.getString();
457 case RC_PRINTCOLLCOPIESFLAG:
459 print_collcopies_flag = lexrc.getString();
463 case RC_PRINTREVERSEFLAG:
465 print_reverse_flag = lexrc.getString();
469 case RC_PRINTLANDSCAPEFLAG:
471 print_landscape_flag = lexrc.getString();
475 case RC_PRINTTOPRINTER:
477 print_to_printer = lexrc.getString();
481 case RC_PRINT_ADAPTOUTPUT:
483 print_adapt_output = lexrc.getBool();
489 print_to_file = lexrc.getString();
493 case RC_PRINTFILEEXTENSION:
495 print_file_extension = lexrc.getString();
499 case RC_PRINTEXSTRAOPTIONS:
501 print_extra_options = lexrc.getString();
505 case RC_PRINTSPOOL_COMMAND:
507 print_spool_command = lexrc.getString();
511 case RC_PRINTSPOOL_PRINTERPREFIX:
513 print_spool_printerprefix = lexrc.getString();
517 case RC_PRINTPAPERDIMENSIONFLAG:
519 print_paper_dimension_flag = lexrc.getString();
523 case RC_PRINTPAPERFLAG:
525 print_paper_flag = lexrc.getString();
529 case RC_CUSTOM_EXPORT_COMMAND:
531 custom_export_command = lexrc.getString();
535 case RC_CUSTOM_EXPORT_FORMAT:
537 custom_export_format = lexrc.getString();
541 case RC_DEFAULT_PAPERSIZE:
544 ascii_lowercase(lexrc.getString());
545 if (size == "usletter")
547 BufferParams::PAPER_USLETTER;
548 else if (size == "legal")
550 BufferParams::PAPER_LEGALPAPER;
551 else if (size == "executive")
553 BufferParams::PAPER_EXECUTIVEPAPER;
554 else if (size == "a3")
556 BufferParams::PAPER_A3PAPER;
557 else if (size == "a4")
559 BufferParams::PAPER_A4PAPER;
560 else if (size == "a5")
562 BufferParams::PAPER_A5PAPER;
563 else if (size == "b5")
565 BufferParams::PAPER_B5PAPER;
569 case RC_VIEWDVI_PAPEROPTION:
571 view_dvi_paper_option = lexrc.getString();
573 view_dvi_paper_option.erase();
579 ps_command = lexrc.getString();
583 case RC_CHKTEX_COMMAND:
585 chktex_command = lexrc.getString();
591 dpi = lexrc.getInteger();
597 zoom = lexrc.getInteger();
603 wheel_jump = lexrc.getInteger();
607 case RC_SCREEN_FONT_SIZES:
609 font_sizes[LyXFont::SIZE_TINY] =
613 font_sizes[LyXFont::SIZE_SCRIPT] =
617 font_sizes[LyXFont::SIZE_FOOTNOTE] =
621 font_sizes[LyXFont::SIZE_SMALL] =
625 font_sizes[LyXFont::SIZE_NORMAL] =
629 font_sizes[LyXFont::SIZE_LARGE] =
633 font_sizes[LyXFont::SIZE_LARGER] =
637 font_sizes[LyXFont::SIZE_LARGEST] =
641 font_sizes[LyXFont::SIZE_HUGE] =
645 font_sizes[LyXFont::SIZE_HUGER] =
650 case RC_SCREEN_FONT_SCALABLE:
652 use_scalable_fonts = lexrc.getBool();
658 autosave = lexrc.getInteger();
662 case RC_DOCUMENTPATH:
664 document_path = ExpandPath(lexrc.getString());
668 case RC_TEMPLATEPATH:
670 template_path = ExpandPath(lexrc.getString());
676 tempdir_path = ExpandPath(lexrc.getString());
682 use_tempdir = lexrc.getBool();
688 lastfiles = ExpandPath(lexrc.getString());
692 case RC_NUMLASTFILES:
694 num_lastfiles = lexrc.getInteger();
698 case RC_CHECKLASTFILES:
700 check_lastfiles = lexrc.getBool();
704 case RC_SCREEN_FONT_ROMAN:
706 roman_font_name = lexrc.getString();
707 oldFontFormat(roman_font_name,
712 case RC_SCREEN_FONT_SANS:
714 sans_font_name = lexrc.getString();
715 oldFontFormat(sans_font_name, sans_font_foundry);
719 case RC_SCREEN_FONT_TYPEWRITER:
721 typewriter_font_name = lexrc.getString();
722 oldFontFormat(typewriter_font_name,
723 typewriter_font_foundry);
727 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
729 roman_font_foundry = lexrc.getString();
733 case RC_SCREEN_FONT_SANS_FOUNDRY:
735 sans_font_foundry = lexrc.getString();
739 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
741 typewriter_font_foundry = lexrc.getString();
745 case RC_SCREEN_FONT_ENCODING:
747 font_norm = lexrc.getString();
748 set_font_norm_type();
752 case RC_POPUP_BOLD_FONT:
754 popup_bold_font = lexrc.getString();
758 case RC_POPUP_NORMAL_FONT:
760 popup_normal_font = lexrc.getString();
764 case RC_POPUP_FONT_ENCODING:
766 popup_font_encoding = lexrc.getString();
772 string lyx_name, x11_name;
775 lyx_name = lexrc.getString();
777 lexrc.printError("Missing color tag.");
782 x11_name = lexrc.getString();
784 lexrc.printError("Missing color name for color: `$$Token'");
788 if (!lcolor.setColor(lyx_name, x11_name)) {
789 lyxerr << "Bad lyxrc set_color for "
795 case RC_AUTOREGIONDELETE:
796 // Auto region delete defaults to true
798 auto_region_delete = lexrc.getBool();
804 // we should not do an explicit binding before
805 // loading a bind file. So, in this case, load
806 // the default bind file.
807 readBindFileIfNeeded();
809 // !!!chb, dynamic key binding...
811 string::size_type res = 0;
815 seq = lexrc.getString();
817 lexrc.printError("RC_BIND: Missing key sequence");
821 if (lexrc.next(true)) {
822 cmd = lexrc.getString();
824 lexrc.printError("RC_BIND: missing command");
828 if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
829 if (lyxerr.debugging(Debug::LYXRC)) {
830 lyxerr << "RC_BIND: Sequence `"
831 << seq << "' Command `"
832 << cmd << "' Action `"
833 << action << '\'' << endl;
835 res = toplevel_keymap->bind(seq, kb_action(action));
836 if (res != string::npos
837 && lyxerr.debugging(Debug::LYXRC)) {
840 "Invalid key sequence `"
843 } else {// cmd is the last token read.
845 "Unknown LyX function `$$Token'");
851 lyxpipes = ExpandPath(lexrc.getString());
855 case RC_CURSOR_FOLLOWS_SCROLLBAR:
857 cursor_follows_scrollbar = lexrc.getBool();
861 case RC_DIALOGS_ICONIFY_WITH_MAIN:
863 dialogs_iconify_with_main = lexrc.getBool();
867 case RC_ASCIIROFF_COMMAND:
869 ascii_roff_command = lexrc.getString();
872 case RC_ASCII_LINELEN:
874 ascii_linelen = lexrc.getInteger();
877 // Spellchecker settings:
878 case RC_USE_SPELL_LIB:
880 use_spell_lib = lexrc.getBool();
883 case RC_SPELL_COMMAND:
885 isp_command = lexrc.getString();
888 case RC_ACCEPT_COMPOUND:
890 isp_accept_compound = lexrc.getBool();
895 isp_use_input_encoding = lexrc.getBool();
898 case RC_USE_ALT_LANG:
900 isp_use_alt_lang = lexrc.getBool();
903 case RC_USE_PERS_DICT:
905 isp_use_pers_dict = lexrc.getBool();
908 case RC_USE_ESC_CHARS:
910 isp_use_esc_chars = lexrc.getBool();
915 isp_alt_lang = lexrc.getString();
920 isp_pers_dict = lexrc.getString();
925 isp_esc_chars = lexrc.getString();
930 make_backup = lexrc.getBool();
933 case RC_BACKUPDIR_PATH:
935 backupdir_path = ExpandPath(lexrc.getString());
938 case RC_DATE_INSERT_FORMAT:
940 date_insert_format = lexrc.getString();
943 case RC_LANGUAGE_PACKAGE:
945 language_package = lexrc.getString();
948 case RC_LANGUAGE_AUTO_BEGIN:
950 language_auto_begin = lexrc.getBool();
953 case RC_LANGUAGE_AUTO_END:
955 language_auto_end = lexrc.getBool();
958 case RC_LANGUAGE_GLOBAL_OPTIONS:
960 language_global_options = lexrc.getBool();
963 case RC_LANGUAGE_USE_BABEL:
965 language_use_babel = lexrc.getBool();
968 case RC_LANGUAGE_COMMAND_BEGIN:
970 language_command_begin = lexrc.getString();
973 case RC_LANGUAGE_COMMAND_END:
975 language_command_end = lexrc.getString();
978 case RC_LANGUAGE_COMMAND_LOCAL:
980 language_command_local = lexrc.getString();
985 rtl_support = lexrc.getBool();
990 auto_number = lexrc.getBool();
993 case RC_MARK_FOREIGN_LANGUAGE:
995 mark_foreign_language = lexrc.getBool();
1000 string from, to, command, flags;
1002 from = lexrc.getString();
1005 to = lexrc.getString();
1008 command = lexrc.getString();
1011 flags = lexrc.getString();
1014 || token(command, ' ', 0) == "none") {
1015 converters.erase(from, to);
1017 converters.add(from, to, command, flags);
1022 string format, command;
1024 format = lexrc.getString();
1027 command = lexrc.getString();
1028 if (token(command, ' ', 0) == "none")
1031 formats.setViewer(format, command);
1035 string format, extension, prettyname, shortcut;
1037 format = lexrc.getString();
1040 extension = lexrc.getString();
1043 prettyname = lexrc.getString();
1046 shortcut = lexrc.getString();
1048 if (prettyname.empty()) {
1049 if (converters.formatIsUsed(format)) {
1050 lyxerr << "Can't delete format "
1053 formats.erase(format);
1056 formats.add(format, extension, prettyname,
1061 case RC_DEFAULT_LANGUAGE:
1063 default_language = lexrc.getString();
1067 case RC_LABEL_INIT_LENGTH:
1069 label_init_length = lexrc.getInteger();
1073 case RC_SHOW_BANNER:
1075 show_banner = lexrc.getBool();
1081 preview = lexrc.getBool();
1085 case RC_PREVIEW_HASHED_LABELS:
1087 preview_hashed_labels = lexrc.getBool();
1091 case RC_PREVIEW_SCALE_FACTOR:
1093 preview_scale_factor = lexrc.getFloat();
1099 user_name = lexrc.getString();
1104 user_email = lexrc.getString();
1107 case RC_LAST: break; // this is just a dummy
1111 /// Update converters data-structures
1112 converters.update(formats);
1113 converters.buildGraph();
1119 void LyXRC::write(string const & filename) const
1121 ofstream ofs(filename.c_str());
1127 void LyXRC::print() const
1129 if (lyxerr.debugging())
1136 void LyXRC::output(ostream & os) const
1138 os << "### This file is part of\n"
1139 << "### ========================================================\n"
1140 << "### LyX, The Document Processor\n"
1142 << "### Copyright 1995 Matthias Ettrich\n"
1143 << "### Copyright 1995-2001 The LyX Team.\n"
1145 << "### ========================================================\n"
1147 << "# This file is written by LyX, if you want to make your own\n"
1148 << "# modifications you should do them from inside LyX and save\n"
1151 // Why the switch you might ask. It is a trick to ensure that all
1152 // the elements in the LyXRCTags enum is handled. As you can see
1153 // there are no breaks at all. So it is just a huge fall-through.
1154 // The nice thing is that we will get a warning from the compiler
1155 // if we forget an element.
1156 LyXRCTags tag = RC_LAST;
1160 // input/include files are not done here
1162 // bindings is not written to the preferences file.
1164 if (bind_file != system_lyxrc.bind_file) {
1165 os << "\\bind_file " << bind_file << "\n";
1171 << "# MISC SECTION ######################################\n"
1174 // bind files are not done here.
1176 if (ui_file != system_lyxrc.ui_file) {
1177 os << "\\ui_file \"" << ui_file << "\"\n";
1179 case RC_AUTOREGIONDELETE:
1180 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1181 os << "# Set to false to inhibit automatic replacement of\n"
1182 << "# the current selection.\n"
1183 << "\\auto_region_delete " << tostr(auto_region_delete)
1186 case RC_AUTORESET_OPTIONS:
1187 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1188 os << "# Set to false to inhibit automatic reset of\n"
1189 << "# the class options to defaults on class change.\n"
1190 << "\\auto_reset_options " << tostr(auto_reset_options)
1194 if (autosave != system_lyxrc.autosave) {
1195 os << "# The time interval between auto-saves in seconds.\n"
1196 << "\\autosave " << autosave << '\n';
1198 case RC_DISPLAY_GRAPHICS:
1199 if (display_graphics != system_lyxrc.display_graphics) {
1200 os << "# Display graphics within LyX\n"
1201 << "# monochrome|grayscale|color|none\n"
1202 << "\\display_graphics " << grfx::displayTranslator.find(display_graphics)
1206 case RC_VIEWDVI_PAPEROPTION:
1207 if (view_dvi_paper_option
1208 != system_lyxrc.view_dvi_paper_option) {
1209 os << "# Options used to specify paper size to the\n"
1210 << "# view_dvi_command (e.g. -paper)\n"
1211 << "\\view_dvi_paper_option \""
1212 << view_dvi_paper_option << "\"\n";
1214 case RC_DEFAULT_PAPERSIZE:
1215 if (default_papersize != system_lyxrc.default_papersize) {
1216 os << "# The default papersize to use.\n"
1217 << "\\default_papersize \"";
1218 switch (default_papersize) {
1219 case BufferParams::PAPER_USLETTER:
1220 os << "usletter"; break;
1221 case BufferParams::PAPER_LEGALPAPER:
1222 os << "legal"; break;
1223 case BufferParams::PAPER_EXECUTIVEPAPER:
1224 os << "executive"; break;
1225 case BufferParams::PAPER_A3PAPER:
1227 case BufferParams::PAPER_A4PAPER:
1229 case BufferParams::PAPER_A5PAPER:
1231 case BufferParams::PAPER_B5PAPER:
1233 case BufferParams::PAPER_DEFAULT: break;
1238 if (ps_command != system_lyxrc.ps_command) {
1239 os << "# Program used for interpreting postscript.\n"
1240 << "\\ps_command \"" << ps_command << "\"\n";
1242 case RC_CHKTEX_COMMAND:
1243 if (chktex_command != system_lyxrc.chktex_command) {
1244 os << "\\chktex_command \"" << chktex_command << "\"\n";
1247 if (use_kbmap != system_lyxrc.use_kbmap) {
1248 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1250 case RC_KBMAP_PRIMARY:
1251 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1252 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1254 case RC_KBMAP_SECONDARY:
1255 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1256 os << "\\kbmap_secondary \"" << secondary_kbmap
1260 if (lyxpipes != system_lyxrc.lyxpipes) {
1261 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1263 case RC_DATE_INSERT_FORMAT:
1264 if (date_insert_format != system_lyxrc.date_insert_format) {
1265 os << "\\date_insert_format \"" << date_insert_format
1268 case RC_LABEL_INIT_LENGTH:
1269 if (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 (show_banner != system_lyxrc.show_banner) {
1282 os << "\\show_banner " << tostr(show_banner) << '\n';
1286 if (preview != system_lyxrc.preview) {
1287 os << "\\preview " << tostr(preview) << '\n';
1290 case RC_PREVIEW_HASHED_LABELS:
1291 if (preview_hashed_labels !=
1292 system_lyxrc.preview_hashed_labels) {
1293 os << "\\preview_hashed_labels "
1294 << tostr(preview_hashed_labels) << '\n';
1297 case RC_PREVIEW_SCALE_FACTOR:
1298 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1299 os << "\\preview_scale_factor "
1300 << preview_scale_factor << '\n';
1304 << "# SCREEN & FONTS SECTION ############################\n"
1307 case RC_POPUP_NORMAL_FONT:
1308 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1309 os << "\\popup_normal_font \"" << popup_normal_font
1312 case RC_POPUP_BOLD_FONT:
1313 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1314 os << "\\popup_bold_font \"" << popup_bold_font
1317 case RC_POPUP_FONT_ENCODING:
1318 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1319 os << "\\popup_font_encoding \"" << popup_font_encoding
1323 if (dpi != system_lyxrc.dpi) {
1324 os << "\\screen_dpi " << dpi << '\n';
1326 case RC_SCREEN_ZOOM:
1327 if (zoom != system_lyxrc.zoom) {
1328 os << "\\screen_zoom " << zoom << '\n';
1331 if (wheel_jump != system_lyxrc.wheel_jump) {
1332 os << "\\wheel_jump " << wheel_jump << '\n';
1334 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1335 if (cursor_follows_scrollbar
1336 != system_lyxrc.cursor_follows_scrollbar) {
1337 os << "\\cursor_follows_scrollbar "
1338 << tostr(cursor_follows_scrollbar) << '\n';
1340 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1341 if (dialogs_iconify_with_main
1342 != system_lyxrc.dialogs_iconify_with_main) {
1343 os << "\\dialogs_iconify_with_main "
1344 << tostr(dialogs_iconify_with_main) << '\n';
1346 case RC_SCREEN_FONT_ROMAN:
1347 if (roman_font_name != system_lyxrc.roman_font_name) {
1348 os << "\\screen_font_roman \"" << roman_font_name
1351 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1352 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1353 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1356 case RC_SCREEN_FONT_SANS:
1357 if (sans_font_name != system_lyxrc.sans_font_name) {
1358 os << "\\screen_font_sans \"" << sans_font_name
1361 case RC_SCREEN_FONT_SANS_FOUNDRY:
1362 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1363 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1366 case RC_SCREEN_FONT_TYPEWRITER:
1367 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1368 os << "\\screen_font_typewriter \""
1369 << typewriter_font_name << "\"\n";
1371 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1372 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1373 os << "\\screen_font_typewriter_foundry \""
1374 << typewriter_font_foundry << "\"\n";
1377 case RC_SCREEN_FONT_SCALABLE:
1378 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1379 os << "\\screen_font_scalable "
1380 << tostr(use_scalable_fonts)
1383 case RC_SCREEN_FONT_ENCODING:
1384 if (font_norm != system_lyxrc.font_norm) {
1385 os << "\\screen_font_encoding \"" << font_norm
1388 case RC_SCREEN_FONT_SIZES:
1389 if (font_sizes[LyXFont::SIZE_TINY]
1390 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1391 font_sizes[LyXFont::SIZE_SCRIPT]
1392 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1393 font_sizes[LyXFont::SIZE_FOOTNOTE]
1394 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1395 font_sizes[LyXFont::SIZE_SMALL]
1396 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1397 font_sizes[LyXFont::SIZE_NORMAL]
1398 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1399 font_sizes[LyXFont::SIZE_LARGE]
1400 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1401 font_sizes[LyXFont::SIZE_LARGER]
1402 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1403 font_sizes[LyXFont::SIZE_LARGEST]
1404 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1405 font_sizes[LyXFont::SIZE_HUGE]
1406 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1407 font_sizes[LyXFont::SIZE_HUGER]
1408 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1409 os.setf(ios::fixed);
1411 os << "\\screen_font_sizes"
1412 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1413 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1414 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1415 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1416 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1417 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1418 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1419 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1420 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1421 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1426 << "# COLOR SECTION ###################################\n"
1430 for (int i = 0; i < LColor::ignore; ++i) {
1431 LColor::color lc = static_cast<LColor::color>(i);
1433 string const col(lcolor.getX11Name(lc));
1434 if (col != system_lcolor.getX11Name(lc)) {
1435 os << "\\set_color \""
1436 << lcolor.getLyXName(lc) << "\" \""
1442 << "# PRINTER SECTION ###################################\n"
1446 if (printer != system_lyxrc.printer) {
1447 os << "\\printer \"" << printer << "\"\n";
1449 case RC_PRINT_ADAPTOUTPUT:
1450 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1451 os << "\\print_adapt_output "
1452 << tostr(print_adapt_output)
1455 case RC_PRINT_COMMAND:
1456 if (print_command != system_lyxrc.print_command) {
1457 os << "\\print_command \"" << print_command << "\"\n";
1459 case RC_PRINTEXSTRAOPTIONS:
1460 if (print_extra_options != system_lyxrc.print_extra_options) {
1461 os << "\\print_extra_options \"" << print_extra_options
1464 case RC_PRINTSPOOL_COMMAND:
1465 if (print_spool_command != system_lyxrc.print_spool_command) {
1466 os << "\\print_spool_command \"" << print_spool_command
1469 case RC_PRINTSPOOL_PRINTERPREFIX:
1470 if (print_spool_printerprefix
1471 != system_lyxrc.print_spool_printerprefix) {
1472 os << "\\print_spool_printerprefix \""
1473 << print_spool_printerprefix << "\"\n";
1475 case RC_PRINTEVENPAGEFLAG:
1476 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1477 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1480 case RC_PRINTODDPAGEFLAG:
1481 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1482 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1485 case RC_PRINTREVERSEFLAG:
1486 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1487 os << "\\print_reverse_flag \"" << print_reverse_flag
1490 case RC_PRINTLANDSCAPEFLAG:
1491 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1492 os << "\\print_landscape_flag \"" << print_landscape_flag
1495 case RC_PRINTPAGERANGEFLAG:
1496 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1497 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1500 case RC_PRINTCOPIESFLAG:
1501 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1502 os << "\\print_copies_flag \"" << print_copies_flag
1505 case RC_PRINTCOLLCOPIESFLAG:
1506 if (print_collcopies_flag
1507 != system_lyxrc.print_collcopies_flag) {
1508 os << "\\print_collcopies_flag \""
1509 << print_collcopies_flag
1512 case RC_PRINTPAPERFLAG:
1513 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1514 os << "\\print_paper_flag \"" << print_paper_flag
1517 case RC_PRINTPAPERDIMENSIONFLAG:
1518 if (print_paper_dimension_flag
1519 != system_lyxrc.print_paper_dimension_flag) {
1520 os << "\\print_paper_dimension_flag \""
1521 << print_paper_dimension_flag << "\"\n";
1523 case RC_PRINTTOPRINTER:
1524 if (print_to_printer != system_lyxrc.print_to_printer) {
1525 os << "\\print_to_printer \"" << print_to_printer
1528 case RC_PRINTTOFILE:
1529 if (print_to_file != system_lyxrc.print_to_file) {
1530 os << "\\print_to_file \"" << print_to_file << "\"\n";
1532 case RC_PRINTFILEEXTENSION:
1533 if (print_file_extension != system_lyxrc.print_file_extension) {
1534 os << "\\print_file_extension \""
1535 << print_file_extension
1540 << "# EXPORT SECTION ####################################\n"
1543 case RC_CUSTOM_EXPORT_COMMAND:
1544 if (custom_export_command
1545 != system_lyxrc.custom_export_command) {
1546 os << "\\custom_export_command \""
1547 << custom_export_command
1550 case RC_CUSTOM_EXPORT_FORMAT:
1551 if (custom_export_format
1552 != system_lyxrc.custom_export_format) {
1553 os << "\\custom_export_format \"" << custom_export_format
1558 << "# TEX SECTION #######################################\n"
1561 case RC_FONT_ENCODING:
1562 if (fontenc != system_lyxrc.fontenc) {
1563 os << "\\font_encoding \"" << fontenc << "\"\n";
1567 << "# FILE SECTION ######################################\n"
1570 case RC_DOCUMENTPATH:
1571 if (document_path != system_lyxrc.document_path) {
1572 os << "\\document_path \"" << document_path << "\"\n";
1575 if (lastfiles != system_lyxrc.lastfiles) {
1576 os << "\\lastfiles \"" << lastfiles << "\"\n";
1578 case RC_NUMLASTFILES:
1579 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1580 os << "\\num_lastfiles " << num_lastfiles << '\n';
1582 case RC_CHECKLASTFILES:
1583 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1584 os << "\\check_lastfiles " << tostr(check_lastfiles)
1587 case RC_TEMPLATEPATH:
1588 if (template_path != system_lyxrc.template_path) {
1589 os << "\\template_path \"" << template_path << "\"\n";
1591 case RC_TEMPDIRPATH:
1592 if (tempdir_path != system_lyxrc.tempdir_path) {
1593 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1596 if (use_tempdir != system_lyxrc.use_tempdir) {
1597 os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
1599 case RC_ASCII_LINELEN:
1600 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1601 os << "\\ascii_linelen " << ascii_linelen << '\n';
1603 case RC_MAKE_BACKUP:
1604 if (make_backup != system_lyxrc.make_backup) {
1605 os << "\\make_backup " << tostr(make_backup) << '\n';
1607 case RC_BACKUPDIR_PATH:
1608 if (backupdir_path != system_lyxrc.backupdir_path) {
1609 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1613 << "# ASCII EXPORT SECTION ##############################\n"
1616 case RC_ASCIIROFF_COMMAND:
1617 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1618 os << "\\ascii_roff_command \"" << ascii_roff_command
1623 << "# SPELLCHECKER SECTION ##############################\n"
1625 case RC_USE_SPELL_LIB:
1626 if (use_spell_lib != system_lyxrc.use_spell_lib) {
1627 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1629 case RC_SPELL_COMMAND:
1630 if (isp_command != system_lyxrc.isp_command) {
1631 os << "\\spell_command \"" << isp_command << "\"\n";
1633 case RC_ACCEPT_COMPOUND:
1634 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1635 os << "\\accept_compound " << tostr(isp_accept_compound)
1638 case RC_USE_ALT_LANG:
1639 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1640 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1644 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1645 os << "\\alternate_language \"" << isp_alt_lang
1648 case RC_USE_ESC_CHARS:
1649 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1650 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1654 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1655 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1657 case RC_USE_PERS_DICT:
1658 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1659 os << "\\use_personal_dictionary "
1660 << tostr(isp_use_pers_dict)
1664 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1665 os << "\\personal_dictionary \"" << isp_pers_dict
1668 case RC_USE_INP_ENC:
1669 if (isp_use_input_encoding
1670 != system_lyxrc.isp_use_input_encoding) {
1671 os << "\\use_input_encoding "
1672 << tostr(isp_use_input_encoding)
1677 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1680 case RC_RTL_SUPPORT:
1681 if (rtl_support != system_lyxrc.rtl_support) {
1682 os << "\\rtl " << tostr(rtl_support) << '\n';
1684 case RC_LANGUAGE_PACKAGE:
1685 if (language_package != system_lyxrc.language_package) {
1686 os << "\\language_package \"" << language_package
1689 case RC_LANGUAGE_GLOBAL_OPTIONS:
1690 if (language_global_options
1691 != system_lyxrc.language_global_options) {
1692 os << "\\language_global_options \""
1693 << tostr(language_global_options)
1696 case RC_LANGUAGE_USE_BABEL:
1697 if (language_use_babel != system_lyxrc.language_use_babel) {
1698 os << "\\language_use_babel \""
1699 << tostr(language_use_babel)
1702 case RC_LANGUAGE_COMMAND_BEGIN:
1703 if (language_command_begin
1704 != system_lyxrc.language_command_begin) {
1705 os << "\\language_command_begin \""
1706 << language_command_begin
1709 case RC_LANGUAGE_COMMAND_END:
1710 if (language_command_end
1711 != system_lyxrc.language_command_end) {
1712 os << "\\language_command_end \"" << language_command_end
1715 case RC_LANGUAGE_COMMAND_LOCAL:
1716 if (language_command_local
1717 != system_lyxrc.language_command_local) {
1718 os << "\\language_command_local \""
1719 << language_command_local
1722 case RC_LANGUAGE_AUTO_BEGIN:
1723 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1724 os << "\\language_auto_begin "
1725 << tostr(language_auto_begin) << '\n';
1727 case RC_LANGUAGE_AUTO_END:
1728 if (language_auto_end != system_lyxrc.language_auto_end) {
1729 os << "\\language_auto_end "
1730 << tostr(language_auto_end) << '\n';
1732 case RC_MARK_FOREIGN_LANGUAGE:
1733 if (mark_foreign_language
1734 != system_lyxrc.mark_foreign_language) {
1735 os << "\\mark_foreign_language " <<
1736 tostr(mark_foreign_language) << '\n';
1740 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1743 case RC_AUTO_NUMBER:
1744 if (auto_number != system_lyxrc.auto_number) {
1745 os << "\\auto_number " << tostr(auto_number) << '\n';
1747 case RC_DEFAULT_LANGUAGE:
1748 if (default_language != system_lyxrc.default_language) {
1749 os << "\\default_language " << default_language << '\n';
1753 << "# FORMATS SECTION ##########################\n"
1757 // Look for deleted formats
1758 for (Formats::const_iterator cit = formats.begin();
1759 cit != formats.end(); ++cit) {
1760 Format const * format =
1761 system_formats.getFormat(cit->name());
1763 format->extension() != cit->extension() ||
1764 format->prettyname() != cit->prettyname() ||
1765 format->shortcut() != cit->shortcut())
1766 os << "\\format \"" << cit->name() << "\" \""
1767 << cit->extension() << "\" \""
1768 << cit->prettyname() << "\" \""
1769 << cit->shortcut() << "\"\n";
1772 // New/modifed formats
1773 for (Formats::const_iterator cit = system_formats.begin();
1774 cit != system_formats.end(); ++cit)
1775 if (!formats.getFormat(cit->name()))
1776 os << "\\format \"" << cit->name()
1777 << "\" \"\" \"\" \"\"\n";
1779 for (Formats::const_iterator cit = formats.begin();
1780 cit != formats.end(); ++cit) {
1781 Format const * format =
1782 system_formats.getFormat(cit->name());
1783 if ((!format || format->viewer() != cit->viewer()) &&
1784 (format || !cit->viewer().empty()))
1785 os << "\\viewer \"" << cit->name() << "\" \""
1786 << cit->viewer() << "\"\n";
1790 << "# CONVERTERS SECTION ##########################\n"
1794 // Look for new converters
1795 for (Converters::const_iterator cit = converters.begin();
1796 cit != converters.end(); ++cit) {
1797 Converter const * converter =
1798 system_converters.getConverter(cit->from,
1801 converter->command != cit->command ||
1802 converter->flags != cit->flags)
1803 os << "\\converter \"" << cit->from << "\" \""
1804 << cit->to << "\" \""
1805 << cit->command << "\" \""
1806 << cit->flags << "\"\n";
1809 // New/modifed converters
1810 for (Converters::const_iterator cit = system_converters.begin();
1811 cit != system_converters.end(); ++cit)
1812 if (!converters.getConverter(cit->from, cit->to))
1813 os << "\\converter \"" << cit->from
1814 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1820 void LyXRC::set_font_norm_type()
1822 if (font_norm == "iso10646-1")
1823 font_norm_type = ISO_10646_1;
1824 else if (font_norm == "iso8859-1")
1825 font_norm_type = ISO_8859_1;
1826 else if (font_norm == "iso8859-3")
1827 font_norm_type = ISO_8859_3;
1828 else if (font_norm == "iso8859-4")
1829 font_norm_type = ISO_8859_4;
1830 else if (font_norm == "iso8859-6.8x")
1831 font_norm_type = ISO_8859_6_8;
1832 else if (font_norm == "iso8859-9")
1833 font_norm_type = ISO_8859_9;
1834 else if (font_norm == "iso8859-15")
1835 font_norm_type = ISO_8859_15;
1837 font_norm_type = OTHER_ENCODING;
1841 string const LyXRC::getDescription(LyXRCTags tag)
1846 case RC_FONT_ENCODING:
1847 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1851 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1854 case RC_PRINT_COMMAND:
1855 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1858 case RC_PRINTEVENPAGEFLAG:
1859 str = _("The option to print only even pages.");
1862 case RC_PRINTODDPAGEFLAG:
1863 str = _("The option to print only odd pages.");
1866 case RC_PRINTPAGERANGEFLAG:
1867 str = _("The option for specifying a comma-separated list of pages to print.");
1870 case RC_PRINTCOPIESFLAG:
1871 str = _("The option for specifying the number of copies to print.");
1874 case RC_PRINTCOLLCOPIESFLAG:
1875 str = _("The option for specifying whether the copies should be collated.");
1878 case RC_PRINTREVERSEFLAG:
1879 str = _("The option to reverse the order of the pages printed.");
1882 case RC_PRINTLANDSCAPEFLAG:
1883 str = _("The option to print out in landscape.");
1886 case RC_PRINTPAPERFLAG:
1887 str = _("The option to specify paper type.");
1890 case RC_PRINTPAPERDIMENSIONFLAG:
1891 str = _("Option to specify the dimensions of the print paper.");
1894 case RC_PRINTTOPRINTER:
1895 str = _("Option to pass to the print program to print on a specific printer.");
1898 case RC_PRINT_ADAPTOUTPUT:
1899 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1902 case RC_PRINTTOFILE:
1903 str = _("Option to pass to the print program to print to a file.");
1906 case RC_PRINTFILEEXTENSION:
1907 str = _("Extension of printer program output file. Usually \".ps\".");
1910 case RC_PRINTEXSTRAOPTIONS:
1911 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1914 case RC_PRINTSPOOL_COMMAND:
1915 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.");
1918 case RC_PRINTSPOOL_PRINTERPREFIX:
1919 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.");
1923 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1926 case RC_SCREEN_ZOOM:
1927 //xgettext:no-c-format
1928 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1931 case RC_SCREEN_FONT_SIZES:
1932 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1935 case RC_SCREEN_FONT_ROMAN:
1936 case RC_SCREEN_FONT_SANS:
1937 case RC_SCREEN_FONT_TYPEWRITER:
1938 str = _("The screen fonts used to display the text while editing.");
1941 case RC_POPUP_BOLD_FONT:
1942 str = _("The bold font in the dialogs.");
1945 case RC_POPUP_NORMAL_FONT:
1946 str = _("The normal font in the dialogs.");
1949 case RC_SCREEN_FONT_ENCODING:
1950 str = _("The encoding for the screen fonts.");
1953 case RC_POPUP_FONT_ENCODING:
1954 str = _("The encoding for the menu/popups fonts.");
1961 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1964 case RC_DOCUMENTPATH:
1965 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1968 case RC_TEMPLATEPATH:
1969 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1972 case RC_TEMPDIRPATH:
1973 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1977 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1981 str = _("The file where the last-files information should be stored.");
1984 case RC_AUTOREGIONDELETE:
1985 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1988 case RC_AUTORESET_OPTIONS:
1989 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1993 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1997 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2001 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2005 case RC_KBMAP_PRIMARY:
2006 case RC_KBMAP_SECONDARY:
2007 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.");
2010 case RC_ASCIIROFF_COMMAND:
2011 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.");
2014 case RC_ASCII_LINELEN:
2015 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2018 case RC_NUMLASTFILES:
2019 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
2022 case RC_CHECKLASTFILES:
2023 str = _("Select to check whether the lastfiles still exist.");
2026 case RC_VIEWDVI_PAPEROPTION:
2027 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2030 case RC_DEFAULT_PAPERSIZE:
2031 str = _("Specify the default paper size.");
2037 case RC_ACCEPT_COMPOUND:
2038 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2041 case RC_SPELL_COMMAND:
2042 str = _("What command runs the spell checker?");
2045 case RC_USE_INP_ENC:
2046 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.");
2049 case RC_USE_ALT_LANG:
2051 str = _("Specify an alternate language. The default is to use the language of the document.");
2054 case RC_USE_PERS_DICT:
2056 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2059 case RC_USE_ESC_CHARS:
2061 str = _("Specify additional chars that can be part of a word.");
2064 case RC_SCREEN_FONT_SCALABLE:
2065 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.");
2068 case RC_CHKTEX_COMMAND:
2069 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2072 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2073 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.");
2076 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2077 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2080 case RC_DISPLAY_GRAPHICS:
2081 str = _("Select how LyX will display any graphics.");
2084 case RC_MAKE_BACKUP:
2085 str = _("De-select if you don't want LyX to create backup files.");
2088 case RC_BACKUPDIR_PATH:
2089 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.");
2092 case RC_RTL_SUPPORT:
2093 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2096 case RC_MARK_FOREIGN_LANGUAGE:
2097 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2100 case RC_LANGUAGE_PACKAGE:
2101 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2104 case RC_LANGUAGE_GLOBAL_OPTIONS:
2105 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2108 case RC_LANGUAGE_USE_BABEL:
2109 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2112 case RC_LANGUAGE_AUTO_BEGIN:
2113 str = _("Select if a language switching command is needed at the beginning of the document.");
2116 case RC_LANGUAGE_AUTO_END:
2117 str = _("Select if a language switching command is needed at the end of the document.");
2120 case RC_LANGUAGE_COMMAND_BEGIN:
2121 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.");
2124 case RC_LANGUAGE_COMMAND_END:
2125 str = _("The LaTeX command for changing back to the language of the document.");
2128 case RC_LANGUAGE_COMMAND_LOCAL:
2129 str = _("The LaTeX command for local changing of the language.");
2132 case RC_DATE_INSERT_FORMAT:
2133 //xgettext:no-c-format
2134 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2137 case RC_SHOW_BANNER:
2138 str = _("De-select if you don't want the startup banner.");
2142 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2154 case RC_DEFAULT_LANGUAGE:
2155 str = _("New documents will be assigned this language.");
2158 case RC_LABEL_INIT_LENGTH:
2159 str = _("Maximum number of words in the initialization string for a new label");
2163 str = _("Shows a typeset preview of things such as math");
2166 case RC_PREVIEW_HASHED_LABELS:
2167 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2170 case RC_PREVIEW_SCALE_FACTOR:
2171 str = _("Scale the preview size to suit.");
2181 // The global instance
2184 // The global copy of the system lyxrc entries (everything except preferences)