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 "support/path.h"
23 #include "support/filetools.h"
24 #include "support/LAssert.h"
25 #include "support/userinfo.h"
26 #include "converter.h"
40 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
44 // when adding something to this array keep it sorted!
45 keyword_item lyxrcTags[] = {
46 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
47 { "\\alternate_language", LyXRC::RC_ALT_LANG },
48 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
49 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
50 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
51 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
52 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
53 { "\\autosave", LyXRC::RC_AUTOSAVE },
54 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
55 { "\\bind", LyXRC::RC_BIND },
56 { "\\bind_file", LyXRC::RC_BINDFILE },
57 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
58 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
59 { "\\converter", LyXRC::RC_CONVERTER },
60 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
61 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
62 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
63 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
64 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
65 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
66 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
67 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
68 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
69 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
70 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
71 { "\\format", LyXRC::RC_FORMAT },
72 { "\\input", LyXRC::RC_INPUT },
73 { "\\kbmap", LyXRC::RC_KBMAP },
74 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
75 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
76 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
77 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
78 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
79 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
80 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
81 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
82 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
83 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
84 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
85 { "\\lastfiles", LyXRC::RC_LASTFILES },
86 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
87 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
88 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
89 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
90 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
91 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
92 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
93 { "\\preview", LyXRC::RC_PREVIEW },
94 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
95 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
96 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
97 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
98 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
99 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
100 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
101 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
102 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
103 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
104 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
105 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
106 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
107 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
108 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
109 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
110 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
111 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
112 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
113 { "\\printer", LyXRC::RC_PRINTER },
114 { "\\ps_command", LyXRC::RC_PS_COMMAND },
115 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
116 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
117 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
118 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
119 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
120 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
121 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
122 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
123 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
124 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
125 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
126 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
127 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
128 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
129 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
130 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
131 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
132 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
133 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
134 { "\\set_color", LyXRC::RC_SET_COLOR },
135 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
136 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
137 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
138 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
139 { "\\ui_file", LyXRC::RC_UIFILE },
140 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
141 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
142 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
143 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
144 // compatibility with versions older than 1.4.0 only
145 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
146 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
147 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
148 { "\\user_email", LyXRC::RC_USER_EMAIL },
149 { "\\user_name", LyXRC::RC_USER_NAME },
150 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
151 { "\\viewer" ,LyXRC::RC_VIEWER},
152 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
155 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
166 void LyXRC::setDefaults() {
170 // Get printer from the environment. If fail, use default "",
171 // assuming that everything is set up correctly.
172 printer = GetEnv("PRINTER");
173 print_adapt_output = false;
174 print_command = "dvips";
175 print_evenpage_flag = "-B";
176 print_oddpage_flag = "-A";
177 print_pagerange_flag = "-pp";
178 print_copies_flag = "-c";
179 print_collcopies_flag = "-C";
180 print_reverse_flag = "-r";
181 print_landscape_flag = "-t landscape";
182 print_to_printer = "-P";
183 print_to_file = "-o ";
184 print_file_extension = ".ps";
185 print_paper_flag = "-t";
186 print_paper_dimension_flag = "-T";
187 document_path.erase();
188 tempdir_path = "/tmp";
191 view_dvi_paper_option.erase();
192 default_papersize = BufferParams::PAPER_USLETTER;
193 custom_export_format = "ps";
194 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
197 // Because a screen typically is wider than a piece of paper:
200 // Default LaTeX font size:
201 font_sizes[LyXFont::SIZE_TINY] = 5.0;
202 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
203 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
204 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
205 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
206 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
207 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
208 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
209 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
210 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
211 use_scalable_fonts = true;
212 roman_font_name = "times";
213 sans_font_name = "helvetica";
214 typewriter_font_name = "courier";
215 popup_bold_font = "-*-helvetica-bold-r";
216 popup_normal_font = "-*-helvetica-medium-r";
217 font_norm = "iso8859-1";
218 font_norm_type = ISO_8859_1;
219 popup_font_encoding.erase();
221 auto_region_delete = true;
222 auto_reset_options = false;
225 check_lastfiles = true;
227 backupdir_path.erase();
228 display_graphics = grfx::ColorDisplay;
229 // Spellchecker settings:
230 use_spell_lib = true;
231 isp_command = "ispell";
232 isp_accept_compound = false;
233 isp_use_input_encoding = false;
234 isp_use_alt_lang = false;
235 isp_use_pers_dict = false;
236 isp_use_esc_chars = false;
240 mark_foreign_language = true;
241 language_auto_begin = true;
242 language_auto_end = true;
243 language_global_options = true;
244 language_use_babel = true;
245 language_package = "\\usepackage{babel}";
246 language_command_begin = "\\selectlanguage{$$lang}";
247 language_command_local = "\\foreignlanguage{$$lang}{";
248 default_language = "english";
252 date_insert_format = "%A, %e %B %Y";
253 cursor_follows_scrollbar = false;
254 dialogs_iconify_with_main = false;
255 label_init_length = 3;
257 preview_hashed_labels = false;
258 preview_scale_factor = 0.9;
260 /// These variables are not stored on disk (perhaps they
261 // should be moved from the LyXRC class).
265 user_name = lyx::user_name();
267 user_email = lyx::user_email();
269 if (user_email.empty())
270 user_email = _("email address unknown");
274 int LyXRC::ReadBindFile(string const & name)
277 string const tmp = i18nLibFileSearch("bind", name, "bind");
278 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
279 int const result = read(tmp);
281 lyxerr << "Error reading bind file: " << tmp << endl;
286 void LyXRC::readBindFileIfNeeded()
289 ReadBindFile(bind_file);
295 void oldFontFormat(string & family, string & foundry)
297 if (family.empty() || family[0] != '-')
299 foundry = token(family, '-', 1);
300 family = token(family, '-', 2);
308 int LyXRC::read(string const & filename)
310 LyXLex lexrc(lyxrcTags, lyxrcCount);
311 if (lyxerr.debugging(Debug::PARSER))
312 lexrc.printTable(lyxerr);
314 lexrc.setFile(filename);
315 if (!lexrc.isOK()) return -2;
317 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
319 while (lexrc.isOK()) {
320 // By using two switches we take advantage of the compiler
321 // telling us if we have missed a LyXRCTags element in
322 // the second switch.
323 // Note that this also shows a problem with LyXLex since it
324 // helps us avoid taking advantage of the strictness of the
327 int le = lexrc.lex();
329 case LyXLex::LEX_UNDEF:
330 lexrc.printError("Unknown tag `$$Token'");
332 case LyXLex::LEX_FEOF:
336 switch (static_cast<LyXRCTags>(le)) {
337 case RC_INPUT: // Include file
340 LibFileSearch(string(),
343 lexrc.printError("Error reading "
344 "included file: "+tmp);
348 case RC_BINDFILE: // RVDK_PATCH_5
350 string const tmp(lexrc.getString());
352 // We are already in the
353 // "actually read bind file"
357 // We are still in the "just
358 // remember the name of the
367 ui_file = lexrc.getString();
371 case RC_AUTORESET_OPTIONS:
373 auto_reset_options = lexrc.getBool();
377 case RC_DISPLAY_GRAPHICS:
379 display_graphics = grfx::displayTranslator.find(lexrc.getString());
385 use_kbmap = lexrc.getBool();
389 case RC_KBMAP_PRIMARY:
391 string const kmap(lexrc.getString());
394 } else if (!LibFileSearch("kbd", kmap,
396 primary_kbmap = kmap;
398 lexrc.printError("LyX: Keymap `$$Token' not found");
403 case RC_KBMAP_SECONDARY:
405 string const kmap(lexrc.getString());
408 } else if (!LibFileSearch("kbd", kmap,
410 secondary_kbmap = kmap;
412 lexrc.printError("LyX: Keymap `$$Token' not found");
417 case RC_FONT_ENCODING:
419 fontenc = lexrc.getString();
425 printer = lexrc.getString();
429 case RC_PRINT_COMMAND:
431 print_command = lexrc.getString();
435 case RC_PRINTEVENPAGEFLAG:
437 print_evenpage_flag = lexrc.getString();
441 case RC_PRINTODDPAGEFLAG:
443 print_oddpage_flag = lexrc.getString();
447 case RC_PRINTPAGERANGEFLAG:
449 print_pagerange_flag = lexrc.getString();
453 case RC_PRINTCOPIESFLAG:
455 print_copies_flag = lexrc.getString();
459 case RC_PRINTCOLLCOPIESFLAG:
461 print_collcopies_flag = lexrc.getString();
465 case RC_PRINTREVERSEFLAG:
467 print_reverse_flag = lexrc.getString();
471 case RC_PRINTLANDSCAPEFLAG:
473 print_landscape_flag = lexrc.getString();
477 case RC_PRINTTOPRINTER:
479 print_to_printer = lexrc.getString();
483 case RC_PRINT_ADAPTOUTPUT:
485 print_adapt_output = lexrc.getBool();
491 print_to_file = lexrc.getString();
495 case RC_PRINTFILEEXTENSION:
497 print_file_extension = lexrc.getString();
501 case RC_PRINTEXSTRAOPTIONS:
503 print_extra_options = lexrc.getString();
507 case RC_PRINTSPOOL_COMMAND:
509 print_spool_command = lexrc.getString();
513 case RC_PRINTSPOOL_PRINTERPREFIX:
515 print_spool_printerprefix = lexrc.getString();
519 case RC_PRINTPAPERDIMENSIONFLAG:
521 print_paper_dimension_flag = lexrc.getString();
525 case RC_PRINTPAPERFLAG:
527 print_paper_flag = lexrc.getString();
531 case RC_CUSTOM_EXPORT_COMMAND:
533 custom_export_command = lexrc.getString();
537 case RC_CUSTOM_EXPORT_FORMAT:
539 custom_export_format = lexrc.getString();
543 case RC_DEFAULT_PAPERSIZE:
546 ascii_lowercase(lexrc.getString());
547 if (size == "usletter")
549 BufferParams::PAPER_USLETTER;
550 else if (size == "legal")
552 BufferParams::PAPER_LEGALPAPER;
553 else if (size == "executive")
555 BufferParams::PAPER_EXECUTIVEPAPER;
556 else if (size == "a3")
558 BufferParams::PAPER_A3PAPER;
559 else if (size == "a4")
561 BufferParams::PAPER_A4PAPER;
562 else if (size == "a5")
564 BufferParams::PAPER_A5PAPER;
565 else if (size == "b5")
567 BufferParams::PAPER_B5PAPER;
571 case RC_VIEWDVI_PAPEROPTION:
573 view_dvi_paper_option = lexrc.getString();
575 view_dvi_paper_option.erase();
581 ps_command = lexrc.getString();
585 case RC_CHKTEX_COMMAND:
587 chktex_command = lexrc.getString();
593 dpi = lexrc.getInteger();
599 zoom = lexrc.getInteger();
605 wheel_jump = lexrc.getInteger();
609 case RC_SCREEN_FONT_SIZES:
611 font_sizes[LyXFont::SIZE_TINY] =
615 font_sizes[LyXFont::SIZE_SCRIPT] =
619 font_sizes[LyXFont::SIZE_FOOTNOTE] =
623 font_sizes[LyXFont::SIZE_SMALL] =
627 font_sizes[LyXFont::SIZE_NORMAL] =
631 font_sizes[LyXFont::SIZE_LARGE] =
635 font_sizes[LyXFont::SIZE_LARGER] =
639 font_sizes[LyXFont::SIZE_LARGEST] =
643 font_sizes[LyXFont::SIZE_HUGE] =
647 font_sizes[LyXFont::SIZE_HUGER] =
652 case RC_SCREEN_FONT_SCALABLE:
654 use_scalable_fonts = lexrc.getBool();
660 autosave = lexrc.getInteger();
664 case RC_DOCUMENTPATH:
666 document_path = ExpandPath(lexrc.getString());
670 case RC_TEMPLATEPATH:
672 template_path = ExpandPath(lexrc.getString());
678 tempdir_path = ExpandPath(lexrc.getString());
684 use_tempdir = lexrc.getBool();
690 lastfiles = ExpandPath(lexrc.getString());
694 case RC_NUMLASTFILES:
696 num_lastfiles = lexrc.getInteger();
700 case RC_CHECKLASTFILES:
702 check_lastfiles = lexrc.getBool();
706 case RC_SCREEN_FONT_ROMAN:
708 roman_font_name = lexrc.getString();
709 oldFontFormat(roman_font_name,
714 case RC_SCREEN_FONT_SANS:
716 sans_font_name = lexrc.getString();
717 oldFontFormat(sans_font_name, sans_font_foundry);
721 case RC_SCREEN_FONT_TYPEWRITER:
723 typewriter_font_name = lexrc.getString();
724 oldFontFormat(typewriter_font_name,
725 typewriter_font_foundry);
729 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
731 roman_font_foundry = lexrc.getString();
735 case RC_SCREEN_FONT_SANS_FOUNDRY:
737 sans_font_foundry = lexrc.getString();
741 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
743 typewriter_font_foundry = lexrc.getString();
747 case RC_SCREEN_FONT_ENCODING:
749 font_norm = lexrc.getString();
750 set_font_norm_type();
754 case RC_POPUP_BOLD_FONT:
756 popup_bold_font = lexrc.getString();
760 case RC_POPUP_NORMAL_FONT:
762 popup_normal_font = lexrc.getString();
766 case RC_POPUP_FONT_ENCODING:
768 popup_font_encoding = lexrc.getString();
774 string lyx_name, x11_name;
777 lyx_name = lexrc.getString();
779 lexrc.printError("Missing color tag.");
784 x11_name = lexrc.getString();
786 lexrc.printError("Missing color name for color: `$$Token'");
790 if (!lcolor.setColor(lyx_name, x11_name)) {
791 lyxerr << "Bad lyxrc set_color for "
797 case RC_AUTOREGIONDELETE:
798 // Auto region delete defaults to true
800 auto_region_delete = lexrc.getBool();
806 // we should not do an explicit binding before
807 // loading a bind file. So, in this case, load
808 // the default bind file.
809 readBindFileIfNeeded();
811 // !!!chb, dynamic key binding...
813 string::size_type res = 0;
817 seq = lexrc.getString();
819 lexrc.printError("RC_BIND: Missing key sequence");
823 if (lexrc.next(true)) {
824 cmd = lexrc.getString();
826 lexrc.printError("RC_BIND: missing command");
830 if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
831 if (lyxerr.debugging(Debug::LYXRC)) {
832 lyxerr << "RC_BIND: Sequence `"
833 << seq << "' Command `"
834 << cmd << "' Action `"
835 << action << '\'' << endl;
837 res = toplevel_keymap->bind(seq, kb_action(action));
838 if (res != string::npos
839 && lyxerr.debugging(Debug::LYXRC)) {
842 "Invalid key sequence `"
845 } else {// cmd is the last token read.
847 "Unknown LyX function `$$Token'");
853 lyxpipes = ExpandPath(lexrc.getString());
857 case RC_CURSOR_FOLLOWS_SCROLLBAR:
859 cursor_follows_scrollbar = lexrc.getBool();
863 case RC_DIALOGS_ICONIFY_WITH_MAIN:
865 dialogs_iconify_with_main = lexrc.getBool();
869 case RC_ASCIIROFF_COMMAND:
871 ascii_roff_command = lexrc.getString();
874 case RC_ASCII_LINELEN:
876 ascii_linelen = lexrc.getInteger();
879 // Spellchecker settings:
880 case RC_USE_SPELL_LIB:
882 use_spell_lib = lexrc.getBool();
885 case RC_SPELL_COMMAND:
887 isp_command = lexrc.getString();
890 case RC_ACCEPT_COMPOUND:
892 isp_accept_compound = lexrc.getBool();
897 isp_use_input_encoding = lexrc.getBool();
900 case RC_USE_ALT_LANG:
902 isp_use_alt_lang = lexrc.getBool();
905 case RC_USE_PERS_DICT:
907 isp_use_pers_dict = lexrc.getBool();
910 case RC_USE_ESC_CHARS:
912 isp_use_esc_chars = lexrc.getBool();
917 isp_alt_lang = lexrc.getString();
922 isp_pers_dict = lexrc.getString();
927 isp_esc_chars = lexrc.getString();
932 make_backup = lexrc.getBool();
935 case RC_BACKUPDIR_PATH:
937 backupdir_path = ExpandPath(lexrc.getString());
940 case RC_DATE_INSERT_FORMAT:
942 date_insert_format = lexrc.getString();
945 case RC_LANGUAGE_PACKAGE:
947 language_package = lexrc.getString();
950 case RC_LANGUAGE_AUTO_BEGIN:
952 language_auto_begin = lexrc.getBool();
955 case RC_LANGUAGE_AUTO_END:
957 language_auto_end = lexrc.getBool();
960 case RC_LANGUAGE_GLOBAL_OPTIONS:
962 language_global_options = lexrc.getBool();
965 case RC_LANGUAGE_USE_BABEL:
967 language_use_babel = lexrc.getBool();
970 case RC_LANGUAGE_COMMAND_BEGIN:
972 language_command_begin = lexrc.getString();
975 case RC_LANGUAGE_COMMAND_END:
977 language_command_end = lexrc.getString();
980 case RC_LANGUAGE_COMMAND_LOCAL:
982 language_command_local = lexrc.getString();
987 rtl_support = lexrc.getBool();
992 auto_number = lexrc.getBool();
995 case RC_MARK_FOREIGN_LANGUAGE:
997 mark_foreign_language = lexrc.getBool();
1001 case RC_CONVERTER: {
1002 string from, to, command, flags;
1004 from = lexrc.getString();
1007 to = lexrc.getString();
1010 command = lexrc.getString();
1013 flags = lexrc.getString();
1016 || token(command, ' ', 0) == "none") {
1017 converters.erase(from, to);
1019 converters.add(from, to, command, flags);
1024 string format, command;
1026 format = lexrc.getString();
1029 command = lexrc.getString();
1030 if (token(command, ' ', 0) == "none")
1033 formats.setViewer(format, command);
1037 string format, extension, prettyname, shortcut;
1039 format = lexrc.getString();
1042 extension = lexrc.getString();
1045 prettyname = lexrc.getString();
1048 shortcut = lexrc.getString();
1050 if (prettyname.empty()) {
1051 if (converters.formatIsUsed(format)) {
1052 lyxerr << "Can't delete format "
1055 formats.erase(format);
1058 formats.add(format, extension, prettyname,
1063 case RC_DEFAULT_LANGUAGE:
1065 default_language = lexrc.getString();
1069 case RC_LABEL_INIT_LENGTH:
1071 label_init_length = lexrc.getInteger();
1075 case RC_SHOW_BANNER:
1077 show_banner = lexrc.getBool();
1083 preview = lexrc.getBool();
1087 case RC_PREVIEW_HASHED_LABELS:
1089 preview_hashed_labels = lexrc.getBool();
1093 case RC_PREVIEW_SCALE_FACTOR:
1095 preview_scale_factor = lexrc.getFloat();
1101 user_name = lexrc.getString();
1106 user_email = lexrc.getString();
1109 case RC_LAST: break; // this is just a dummy
1113 /// Update converters data-structures
1114 converters.update(formats);
1115 converters.buildGraph();
1121 void LyXRC::write(string const & filename) const
1123 ofstream ofs(filename.c_str());
1129 void LyXRC::print() const
1131 if (lyxerr.debugging())
1138 void LyXRC::output(ostream & os) const
1140 os << "### This file is part of\n"
1141 << "### ========================================================\n"
1142 << "### LyX, The Document Processor\n"
1144 << "### Copyright 1995 Matthias Ettrich\n"
1145 << "### Copyright 1995-2001 The LyX Team.\n"
1147 << "### ========================================================\n"
1149 << "# This file is written by LyX, if you want to make your own\n"
1150 << "# modifications you should do them from inside LyX and save\n"
1153 // Why the switch you might ask. It is a trick to ensure that all
1154 // the elements in the LyXRCTags enum is handled. As you can see
1155 // there are no breaks at all. So it is just a huge fall-through.
1156 // The nice thing is that we will get a warning from the compiler
1157 // if we forget an element.
1158 LyXRCTags tag = RC_LAST;
1162 // input/include files are not done here
1164 // bindings is not written to the preferences file.
1166 if (bind_file != system_lyxrc.bind_file) {
1167 os << "\\bind_file " << bind_file << "\n";
1173 << "# MISC SECTION ######################################\n"
1176 // bind files are not done here.
1178 if (ui_file != system_lyxrc.ui_file) {
1179 os << "\\ui_file \"" << ui_file << "\"\n";
1181 case RC_AUTOREGIONDELETE:
1182 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1183 os << "# Set to false to inhibit automatic replacement of\n"
1184 << "# the current selection.\n"
1185 << "\\auto_region_delete " << tostr(auto_region_delete)
1188 case RC_AUTORESET_OPTIONS:
1189 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1190 os << "# Set to false to inhibit automatic reset of\n"
1191 << "# the class options to defaults on class change.\n"
1192 << "\\auto_reset_options " << tostr(auto_reset_options)
1196 if (autosave != system_lyxrc.autosave) {
1197 os << "# The time interval between auto-saves in seconds.\n"
1198 << "\\autosave " << autosave << '\n';
1200 case RC_DISPLAY_GRAPHICS:
1201 if (display_graphics != system_lyxrc.display_graphics) {
1202 os << "# Display graphics within LyX\n"
1203 << "# monochrome|grayscale|color|none\n"
1204 << "\\display_graphics " << grfx::displayTranslator.find(display_graphics)
1208 case RC_VIEWDVI_PAPEROPTION:
1209 if (view_dvi_paper_option
1210 != system_lyxrc.view_dvi_paper_option) {
1211 os << "# Options used to specify paper size to the\n"
1212 << "# view_dvi_command (e.g. -paper)\n"
1213 << "\\view_dvi_paper_option \""
1214 << view_dvi_paper_option << "\"\n";
1216 case RC_DEFAULT_PAPERSIZE:
1217 if (default_papersize != system_lyxrc.default_papersize) {
1218 os << "# The default papersize to use.\n"
1219 << "\\default_papersize \"";
1220 switch (default_papersize) {
1221 case BufferParams::PAPER_USLETTER:
1222 os << "usletter"; break;
1223 case BufferParams::PAPER_LEGALPAPER:
1224 os << "legal"; break;
1225 case BufferParams::PAPER_EXECUTIVEPAPER:
1226 os << "executive"; break;
1227 case BufferParams::PAPER_A3PAPER:
1229 case BufferParams::PAPER_A4PAPER:
1231 case BufferParams::PAPER_A5PAPER:
1233 case BufferParams::PAPER_B5PAPER:
1235 case BufferParams::PAPER_DEFAULT: break;
1240 if (ps_command != system_lyxrc.ps_command) {
1241 os << "# Program used for interpreting postscript.\n"
1242 << "\\ps_command \"" << ps_command << "\"\n";
1244 case RC_CHKTEX_COMMAND:
1245 if (chktex_command != system_lyxrc.chktex_command) {
1246 os << "\\chktex_command \"" << chktex_command << "\"\n";
1249 if (use_kbmap != system_lyxrc.use_kbmap) {
1250 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1252 case RC_KBMAP_PRIMARY:
1253 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1254 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1256 case RC_KBMAP_SECONDARY:
1257 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1258 os << "\\kbmap_secondary \"" << secondary_kbmap
1262 if (lyxpipes != system_lyxrc.lyxpipes) {
1263 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1265 case RC_DATE_INSERT_FORMAT:
1266 if (date_insert_format != system_lyxrc.date_insert_format) {
1267 os << "\\date_insert_format \"" << date_insert_format
1270 case RC_LABEL_INIT_LENGTH:
1271 if (label_init_length != system_lyxrc.label_init_length) {
1272 os << "\\label_init_length " << label_init_length
1277 os << "\\user_name \"" << user_name << "\"\n";
1280 os << "\\user_email \"" << user_email << "\"\n";
1282 case RC_SHOW_BANNER:
1283 if (show_banner != system_lyxrc.show_banner) {
1284 os << "\\show_banner " << tostr(show_banner) << '\n';
1288 if (preview != system_lyxrc.preview) {
1289 os << "\\preview " << tostr(preview) << '\n';
1292 case RC_PREVIEW_HASHED_LABELS:
1293 if (preview_hashed_labels !=
1294 system_lyxrc.preview_hashed_labels) {
1295 os << "\\preview_hashed_labels "
1296 << tostr(preview_hashed_labels) << '\n';
1299 case RC_PREVIEW_SCALE_FACTOR:
1300 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1301 os << "\\preview_scale_factor "
1302 << preview_scale_factor << '\n';
1306 << "# SCREEN & FONTS SECTION ############################\n"
1309 case RC_POPUP_NORMAL_FONT:
1310 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1311 os << "\\popup_normal_font \"" << popup_normal_font
1314 case RC_POPUP_BOLD_FONT:
1315 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1316 os << "\\popup_bold_font \"" << popup_bold_font
1319 case RC_POPUP_FONT_ENCODING:
1320 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1321 os << "\\popup_font_encoding \"" << popup_font_encoding
1325 if (dpi != system_lyxrc.dpi) {
1326 os << "\\screen_dpi " << dpi << '\n';
1328 case RC_SCREEN_ZOOM:
1329 if (zoom != system_lyxrc.zoom) {
1330 os << "\\screen_zoom " << zoom << '\n';
1333 if (wheel_jump != system_lyxrc.wheel_jump) {
1334 os << "\\wheel_jump " << wheel_jump << '\n';
1336 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1337 if (cursor_follows_scrollbar
1338 != system_lyxrc.cursor_follows_scrollbar) {
1339 os << "\\cursor_follows_scrollbar "
1340 << tostr(cursor_follows_scrollbar) << '\n';
1342 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1343 if (dialogs_iconify_with_main
1344 != system_lyxrc.dialogs_iconify_with_main) {
1345 os << "\\dialogs_iconify_with_main "
1346 << tostr(dialogs_iconify_with_main) << '\n';
1348 case RC_SCREEN_FONT_ROMAN:
1349 if (roman_font_name != system_lyxrc.roman_font_name) {
1350 os << "\\screen_font_roman \"" << roman_font_name
1353 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1354 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1355 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1358 case RC_SCREEN_FONT_SANS:
1359 if (sans_font_name != system_lyxrc.sans_font_name) {
1360 os << "\\screen_font_sans \"" << sans_font_name
1363 case RC_SCREEN_FONT_SANS_FOUNDRY:
1364 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1365 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1368 case RC_SCREEN_FONT_TYPEWRITER:
1369 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1370 os << "\\screen_font_typewriter \""
1371 << typewriter_font_name << "\"\n";
1373 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1374 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1375 os << "\\screen_font_typewriter_foundry \""
1376 << typewriter_font_foundry << "\"\n";
1379 case RC_SCREEN_FONT_SCALABLE:
1380 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1381 os << "\\screen_font_scalable "
1382 << tostr(use_scalable_fonts)
1385 case RC_SCREEN_FONT_ENCODING:
1386 if (font_norm != system_lyxrc.font_norm) {
1387 os << "\\screen_font_encoding \"" << font_norm
1390 case RC_SCREEN_FONT_SIZES:
1391 if (font_sizes[LyXFont::SIZE_TINY]
1392 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1393 font_sizes[LyXFont::SIZE_SCRIPT]
1394 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1395 font_sizes[LyXFont::SIZE_FOOTNOTE]
1396 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1397 font_sizes[LyXFont::SIZE_SMALL]
1398 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1399 font_sizes[LyXFont::SIZE_NORMAL]
1400 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1401 font_sizes[LyXFont::SIZE_LARGE]
1402 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1403 font_sizes[LyXFont::SIZE_LARGER]
1404 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1405 font_sizes[LyXFont::SIZE_LARGEST]
1406 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1407 font_sizes[LyXFont::SIZE_HUGE]
1408 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1409 font_sizes[LyXFont::SIZE_HUGER]
1410 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1411 os.setf(ios::fixed);
1413 os << "\\screen_font_sizes"
1414 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1415 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1416 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1417 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1418 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1419 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1420 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1421 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1422 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1423 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1428 << "# COLOR SECTION ###################################\n"
1432 for (int i = 0; i < LColor::ignore; ++i) {
1433 LColor::color lc = static_cast<LColor::color>(i);
1435 string const col(lcolor.getX11Name(lc));
1436 if (col != system_lcolor.getX11Name(lc)) {
1437 os << "\\set_color \""
1438 << lcolor.getLyXName(lc) << "\" \""
1444 << "# PRINTER SECTION ###################################\n"
1448 if (printer != system_lyxrc.printer) {
1449 os << "\\printer \"" << printer << "\"\n";
1451 case RC_PRINT_ADAPTOUTPUT:
1452 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1453 os << "\\print_adapt_output "
1454 << tostr(print_adapt_output)
1457 case RC_PRINT_COMMAND:
1458 if (print_command != system_lyxrc.print_command) {
1459 os << "\\print_command \"" << print_command << "\"\n";
1461 case RC_PRINTEXSTRAOPTIONS:
1462 if (print_extra_options != system_lyxrc.print_extra_options) {
1463 os << "\\print_extra_options \"" << print_extra_options
1466 case RC_PRINTSPOOL_COMMAND:
1467 if (print_spool_command != system_lyxrc.print_spool_command) {
1468 os << "\\print_spool_command \"" << print_spool_command
1471 case RC_PRINTSPOOL_PRINTERPREFIX:
1472 if (print_spool_printerprefix
1473 != system_lyxrc.print_spool_printerprefix) {
1474 os << "\\print_spool_printerprefix \""
1475 << print_spool_printerprefix << "\"\n";
1477 case RC_PRINTEVENPAGEFLAG:
1478 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1479 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1482 case RC_PRINTODDPAGEFLAG:
1483 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1484 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1487 case RC_PRINTREVERSEFLAG:
1488 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1489 os << "\\print_reverse_flag \"" << print_reverse_flag
1492 case RC_PRINTLANDSCAPEFLAG:
1493 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1494 os << "\\print_landscape_flag \"" << print_landscape_flag
1497 case RC_PRINTPAGERANGEFLAG:
1498 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1499 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1502 case RC_PRINTCOPIESFLAG:
1503 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1504 os << "\\print_copies_flag \"" << print_copies_flag
1507 case RC_PRINTCOLLCOPIESFLAG:
1508 if (print_collcopies_flag
1509 != system_lyxrc.print_collcopies_flag) {
1510 os << "\\print_collcopies_flag \""
1511 << print_collcopies_flag
1514 case RC_PRINTPAPERFLAG:
1515 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1516 os << "\\print_paper_flag \"" << print_paper_flag
1519 case RC_PRINTPAPERDIMENSIONFLAG:
1520 if (print_paper_dimension_flag
1521 != system_lyxrc.print_paper_dimension_flag) {
1522 os << "\\print_paper_dimension_flag \""
1523 << print_paper_dimension_flag << "\"\n";
1525 case RC_PRINTTOPRINTER:
1526 if (print_to_printer != system_lyxrc.print_to_printer) {
1527 os << "\\print_to_printer \"" << print_to_printer
1530 case RC_PRINTTOFILE:
1531 if (print_to_file != system_lyxrc.print_to_file) {
1532 os << "\\print_to_file \"" << print_to_file << "\"\n";
1534 case RC_PRINTFILEEXTENSION:
1535 if (print_file_extension != system_lyxrc.print_file_extension) {
1536 os << "\\print_file_extension \""
1537 << print_file_extension
1542 << "# EXPORT SECTION ####################################\n"
1545 case RC_CUSTOM_EXPORT_COMMAND:
1546 if (custom_export_command
1547 != system_lyxrc.custom_export_command) {
1548 os << "\\custom_export_command \""
1549 << custom_export_command
1552 case RC_CUSTOM_EXPORT_FORMAT:
1553 if (custom_export_format
1554 != system_lyxrc.custom_export_format) {
1555 os << "\\custom_export_format \"" << custom_export_format
1560 << "# TEX SECTION #######################################\n"
1563 case RC_FONT_ENCODING:
1564 if (fontenc != system_lyxrc.fontenc) {
1565 os << "\\font_encoding \"" << fontenc << "\"\n";
1569 << "# FILE SECTION ######################################\n"
1572 case RC_DOCUMENTPATH:
1573 if (document_path != system_lyxrc.document_path) {
1574 os << "\\document_path \"" << document_path << "\"\n";
1577 if (lastfiles != system_lyxrc.lastfiles) {
1578 os << "\\lastfiles \"" << lastfiles << "\"\n";
1580 case RC_NUMLASTFILES:
1581 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1582 os << "\\num_lastfiles " << num_lastfiles << '\n';
1584 case RC_CHECKLASTFILES:
1585 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1586 os << "\\check_lastfiles " << tostr(check_lastfiles)
1589 case RC_TEMPLATEPATH:
1590 if (template_path != system_lyxrc.template_path) {
1591 os << "\\template_path \"" << template_path << "\"\n";
1593 case RC_TEMPDIRPATH:
1594 if (tempdir_path != system_lyxrc.tempdir_path) {
1595 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1598 if (use_tempdir != system_lyxrc.use_tempdir) {
1599 os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
1601 case RC_ASCII_LINELEN:
1602 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1603 os << "\\ascii_linelen " << ascii_linelen << '\n';
1605 case RC_MAKE_BACKUP:
1606 if (make_backup != system_lyxrc.make_backup) {
1607 os << "\\make_backup " << tostr(make_backup) << '\n';
1609 case RC_BACKUPDIR_PATH:
1610 if (backupdir_path != system_lyxrc.backupdir_path) {
1611 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1615 << "# ASCII EXPORT SECTION ##############################\n"
1618 case RC_ASCIIROFF_COMMAND:
1619 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1620 os << "\\ascii_roff_command \"" << ascii_roff_command
1625 << "# SPELLCHECKER SECTION ##############################\n"
1627 case RC_USE_SPELL_LIB:
1628 if (use_spell_lib != system_lyxrc.use_spell_lib) {
1629 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1631 case RC_SPELL_COMMAND:
1632 if (isp_command != system_lyxrc.isp_command) {
1633 os << "\\spell_command \"" << isp_command << "\"\n";
1635 case RC_ACCEPT_COMPOUND:
1636 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1637 os << "\\accept_compound " << tostr(isp_accept_compound)
1640 case RC_USE_ALT_LANG:
1641 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1642 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1646 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1647 os << "\\alternate_language \"" << isp_alt_lang
1650 case RC_USE_ESC_CHARS:
1651 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1652 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1656 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1657 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1659 case RC_USE_PERS_DICT:
1660 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1661 os << "\\use_personal_dictionary "
1662 << tostr(isp_use_pers_dict)
1666 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1667 os << "\\personal_dictionary \"" << isp_pers_dict
1670 case RC_USE_INP_ENC:
1671 if (isp_use_input_encoding
1672 != system_lyxrc.isp_use_input_encoding) {
1673 os << "\\use_input_encoding "
1674 << tostr(isp_use_input_encoding)
1679 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1682 case RC_RTL_SUPPORT:
1683 if (rtl_support != system_lyxrc.rtl_support) {
1684 os << "\\rtl " << tostr(rtl_support) << '\n';
1686 case RC_LANGUAGE_PACKAGE:
1687 if (language_package != system_lyxrc.language_package) {
1688 os << "\\language_package \"" << language_package
1691 case RC_LANGUAGE_GLOBAL_OPTIONS:
1692 if (language_global_options
1693 != system_lyxrc.language_global_options) {
1694 os << "\\language_global_options \""
1695 << tostr(language_global_options)
1698 case RC_LANGUAGE_USE_BABEL:
1699 if (language_use_babel != system_lyxrc.language_use_babel) {
1700 os << "\\language_use_babel \""
1701 << tostr(language_use_babel)
1704 case RC_LANGUAGE_COMMAND_BEGIN:
1705 if (language_command_begin
1706 != system_lyxrc.language_command_begin) {
1707 os << "\\language_command_begin \""
1708 << language_command_begin
1711 case RC_LANGUAGE_COMMAND_END:
1712 if (language_command_end
1713 != system_lyxrc.language_command_end) {
1714 os << "\\language_command_end \"" << language_command_end
1717 case RC_LANGUAGE_COMMAND_LOCAL:
1718 if (language_command_local
1719 != system_lyxrc.language_command_local) {
1720 os << "\\language_command_local \""
1721 << language_command_local
1724 case RC_LANGUAGE_AUTO_BEGIN:
1725 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1726 os << "\\language_auto_begin "
1727 << tostr(language_auto_begin) << '\n';
1729 case RC_LANGUAGE_AUTO_END:
1730 if (language_auto_end != system_lyxrc.language_auto_end) {
1731 os << "\\language_auto_end "
1732 << tostr(language_auto_end) << '\n';
1734 case RC_MARK_FOREIGN_LANGUAGE:
1735 if (mark_foreign_language
1736 != system_lyxrc.mark_foreign_language) {
1737 os << "\\mark_foreign_language " <<
1738 tostr(mark_foreign_language) << '\n';
1742 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1745 case RC_AUTO_NUMBER:
1746 if (auto_number != system_lyxrc.auto_number) {
1747 os << "\\auto_number " << tostr(auto_number) << '\n';
1749 case RC_DEFAULT_LANGUAGE:
1750 if (default_language != system_lyxrc.default_language) {
1751 os << "\\default_language " << default_language << '\n';
1755 << "# FORMATS SECTION ##########################\n"
1759 // Look for deleted formats
1760 for (Formats::const_iterator cit = formats.begin();
1761 cit != formats.end(); ++cit) {
1762 Format const * format =
1763 system_formats.getFormat(cit->name());
1765 format->extension() != cit->extension() ||
1766 format->prettyname() != cit->prettyname() ||
1767 format->shortcut() != cit->shortcut())
1768 os << "\\format \"" << cit->name() << "\" \""
1769 << cit->extension() << "\" \""
1770 << cit->prettyname() << "\" \""
1771 << cit->shortcut() << "\"\n";
1774 // New/modifed formats
1775 for (Formats::const_iterator cit = system_formats.begin();
1776 cit != system_formats.end(); ++cit)
1777 if (!formats.getFormat(cit->name()))
1778 os << "\\format \"" << cit->name()
1779 << "\" \"\" \"\" \"\"\n";
1781 for (Formats::const_iterator cit = formats.begin();
1782 cit != formats.end(); ++cit) {
1783 Format const * format =
1784 system_formats.getFormat(cit->name());
1785 if ((!format || format->viewer() != cit->viewer()) &&
1786 (format || !cit->viewer().empty()))
1787 os << "\\viewer \"" << cit->name() << "\" \""
1788 << cit->viewer() << "\"\n";
1792 << "# CONVERTERS SECTION ##########################\n"
1796 // Look for new converters
1797 for (Converters::const_iterator cit = converters.begin();
1798 cit != converters.end(); ++cit) {
1799 Converter const * converter =
1800 system_converters.getConverter(cit->from,
1803 converter->command != cit->command ||
1804 converter->flags != cit->flags)
1805 os << "\\converter \"" << cit->from << "\" \""
1806 << cit->to << "\" \""
1807 << cit->command << "\" \""
1808 << cit->flags << "\"\n";
1811 // New/modifed converters
1812 for (Converters::const_iterator cit = system_converters.begin();
1813 cit != system_converters.end(); ++cit)
1814 if (!converters.getConverter(cit->from, cit->to))
1815 os << "\\converter \"" << cit->from
1816 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1822 void LyXRC::set_font_norm_type()
1824 if (font_norm == "iso10646-1")
1825 font_norm_type = ISO_10646_1;
1826 else if (font_norm == "iso8859-1")
1827 font_norm_type = ISO_8859_1;
1828 else if (font_norm == "iso8859-3")
1829 font_norm_type = ISO_8859_3;
1830 else if (font_norm == "iso8859-4")
1831 font_norm_type = ISO_8859_4;
1832 else if (font_norm == "iso8859-6.8x")
1833 font_norm_type = ISO_8859_6_8;
1834 else if (font_norm == "iso8859-9")
1835 font_norm_type = ISO_8859_9;
1836 else if (font_norm == "iso8859-15")
1837 font_norm_type = ISO_8859_15;
1839 font_norm_type = OTHER_ENCODING;
1843 string const LyXRC::getDescription(LyXRCTags tag)
1848 case RC_FONT_ENCODING:
1849 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1853 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1856 case RC_PRINT_COMMAND:
1857 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1860 case RC_PRINTEVENPAGEFLAG:
1861 str = _("The option to print only even pages.");
1864 case RC_PRINTODDPAGEFLAG:
1865 str = _("The option to print only odd pages.");
1868 case RC_PRINTPAGERANGEFLAG:
1869 str = _("The option for specifying a comma-separated list of pages to print.");
1872 case RC_PRINTCOPIESFLAG:
1873 str = _("The option for specifying the number of copies to print.");
1876 case RC_PRINTCOLLCOPIESFLAG:
1877 str = _("The option for specifying whether the copies should be collated.");
1880 case RC_PRINTREVERSEFLAG:
1881 str = _("The option to reverse the order of the pages printed.");
1884 case RC_PRINTLANDSCAPEFLAG:
1885 str = _("The option to print out in landscape.");
1888 case RC_PRINTPAPERFLAG:
1889 str = _("The option to specify paper type.");
1892 case RC_PRINTPAPERDIMENSIONFLAG:
1893 str = _("Option to specify the dimensions of the print paper.");
1896 case RC_PRINTTOPRINTER:
1897 str = _("Option to pass to the print program to print on a specific printer.");
1900 case RC_PRINT_ADAPTOUTPUT:
1901 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1904 case RC_PRINTTOFILE:
1905 str = _("Option to pass to the print program to print to a file.");
1908 case RC_PRINTFILEEXTENSION:
1909 str = _("Extension of printer program output file. Usually \".ps\".");
1912 case RC_PRINTEXSTRAOPTIONS:
1913 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1916 case RC_PRINTSPOOL_COMMAND:
1917 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.");
1920 case RC_PRINTSPOOL_PRINTERPREFIX:
1921 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.");
1925 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1928 case RC_SCREEN_ZOOM:
1929 //xgettext:no-c-format
1930 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1933 case RC_SCREEN_FONT_SIZES:
1934 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1937 case RC_SCREEN_FONT_ROMAN:
1938 case RC_SCREEN_FONT_SANS:
1939 case RC_SCREEN_FONT_TYPEWRITER:
1940 str = _("The screen fonts used to display the text while editing.");
1943 case RC_POPUP_BOLD_FONT:
1944 str = _("The bold font in the dialogs.");
1947 case RC_POPUP_NORMAL_FONT:
1948 str = _("The normal font in the dialogs.");
1951 case RC_SCREEN_FONT_ENCODING:
1952 str = _("The encoding for the screen fonts.");
1955 case RC_POPUP_FONT_ENCODING:
1956 str = _("The encoding for the menu/popups fonts.");
1963 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1966 case RC_DOCUMENTPATH:
1967 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1970 case RC_TEMPLATEPATH:
1971 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1974 case RC_TEMPDIRPATH:
1975 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1979 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1983 str = _("The file where the last-files information should be stored.");
1986 case RC_AUTOREGIONDELETE:
1987 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1990 case RC_AUTORESET_OPTIONS:
1991 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1995 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1999 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2003 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2007 case RC_KBMAP_PRIMARY:
2008 case RC_KBMAP_SECONDARY:
2009 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.");
2012 case RC_ASCIIROFF_COMMAND:
2013 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.");
2016 case RC_ASCII_LINELEN:
2017 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2020 case RC_NUMLASTFILES:
2021 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
2024 case RC_CHECKLASTFILES:
2025 str = _("Select to check whether the lastfiles still exist.");
2028 case RC_VIEWDVI_PAPEROPTION:
2029 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2032 case RC_DEFAULT_PAPERSIZE:
2033 str = _("Specify the default paper size.");
2039 case RC_ACCEPT_COMPOUND:
2040 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2043 case RC_SPELL_COMMAND:
2044 str = _("What command runs the spell checker?");
2047 case RC_USE_INP_ENC:
2048 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.");
2051 case RC_USE_ALT_LANG:
2053 str = _("Specify an alternate language. The default is to use the language of the document.");
2056 case RC_USE_PERS_DICT:
2058 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2061 case RC_USE_ESC_CHARS:
2063 str = _("Specify additional chars that can be part of a word.");
2066 case RC_SCREEN_FONT_SCALABLE:
2067 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.");
2070 case RC_CHKTEX_COMMAND:
2071 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2074 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2075 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.");
2078 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2079 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2082 case RC_DISPLAY_GRAPHICS:
2083 str = _("Select how LyX will display any graphics.");
2086 case RC_MAKE_BACKUP:
2087 str = _("De-select if you don't want LyX to create backup files.");
2090 case RC_BACKUPDIR_PATH:
2091 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.");
2094 case RC_RTL_SUPPORT:
2095 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2098 case RC_MARK_FOREIGN_LANGUAGE:
2099 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2102 case RC_LANGUAGE_PACKAGE:
2103 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2106 case RC_LANGUAGE_GLOBAL_OPTIONS:
2107 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2110 case RC_LANGUAGE_USE_BABEL:
2111 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2114 case RC_LANGUAGE_AUTO_BEGIN:
2115 str = _("Select if a language switching command is needed at the beginning of the document.");
2118 case RC_LANGUAGE_AUTO_END:
2119 str = _("Select if a language switching command is needed at the end of the document.");
2122 case RC_LANGUAGE_COMMAND_BEGIN:
2123 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.");
2126 case RC_LANGUAGE_COMMAND_END:
2127 str = _("The LaTeX command for changing back to the language of the document.");
2130 case RC_LANGUAGE_COMMAND_LOCAL:
2131 str = _("The LaTeX command for local changing of the language.");
2134 case RC_DATE_INSERT_FORMAT:
2135 //xgettext:no-c-format
2136 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2139 case RC_SHOW_BANNER:
2140 str = _("De-select if you don't want the startup banner.");
2144 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2156 case RC_DEFAULT_LANGUAGE:
2157 str = _("New documents will be assigned this language.");
2160 case RC_LABEL_INIT_LENGTH:
2161 str = _("Maximum number of words in the initialization string for a new label");
2165 str = _("Shows a typeset preview of things such as math");
2168 case RC_PREVIEW_HASHED_LABELS:
2169 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2172 case RC_PREVIEW_SCALE_FACTOR:
2173 str = _("Scale the preview size to suit.");
2183 // The global instance
2186 // The global copy of the system lyxrc entries (everything except preferences)