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 },
145 { "\\use_pspell", LyXRC::RC_USE_PSPELL },
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:
233 isp_command = "ispell";
234 isp_accept_compound = false;
235 isp_use_input_encoding = false;
236 isp_use_alt_lang = false;
237 isp_use_pers_dict = false;
238 isp_use_esc_chars = false;
242 mark_foreign_language = true;
243 language_auto_begin = true;
244 language_auto_end = true;
245 language_global_options = true;
246 language_use_babel = true;
247 language_package = "\\usepackage{babel}";
248 language_command_begin = "\\selectlanguage{$$lang}";
249 language_command_local = "\\foreignlanguage{$$lang}{";
250 default_language = "english";
254 date_insert_format = "%A, %e %B %Y";
255 cursor_follows_scrollbar = false;
256 dialogs_iconify_with_main = false;
257 label_init_length = 3;
259 preview_hashed_labels = false;
260 preview_scale_factor = 0.9;
262 /// These variables are not stored on disk (perhaps they
263 // should be moved from the LyXRC class).
267 user_name = lyx::user_name();
269 user_email = lyx::user_email();
271 if (user_email.empty())
272 user_email = _("email address unknown");
276 int LyXRC::ReadBindFile(string const & name)
279 string const tmp = i18nLibFileSearch("bind", name, "bind");
280 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
281 int const result = read(tmp);
283 lyxerr << "Error reading bind file: " << tmp << endl;
288 void LyXRC::readBindFileIfNeeded()
291 ReadBindFile(bind_file);
297 void oldFontFormat(string & family, string & foundry)
299 if (family.empty() || family[0] != '-')
301 foundry = token(family, '-', 1);
302 family = token(family, '-', 2);
310 int LyXRC::read(string const & filename)
312 LyXLex lexrc(lyxrcTags, lyxrcCount);
313 if (lyxerr.debugging(Debug::PARSER))
314 lexrc.printTable(lyxerr);
316 lexrc.setFile(filename);
317 if (!lexrc.isOK()) return -2;
319 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
321 while (lexrc.isOK()) {
322 // By using two switches we take advantage of the compiler
323 // telling us if we have missed a LyXRCTags element in
324 // the second switch.
325 // Note that this also shows a problem with LyXLex since it
326 // helps us avoid taking advantage of the strictness of the
329 int le = lexrc.lex();
331 case LyXLex::LEX_UNDEF:
332 lexrc.printError("Unknown tag `$$Token'");
334 case LyXLex::LEX_FEOF:
338 switch (static_cast<LyXRCTags>(le)) {
339 case RC_INPUT: // Include file
342 LibFileSearch(string(),
345 lexrc.printError("Error reading "
346 "included file: "+tmp);
350 case RC_BINDFILE: // RVDK_PATCH_5
352 string const tmp(lexrc.getString());
354 // We are already in the
355 // "actually read bind file"
359 // We are still in the "just
360 // remember the name of the
369 ui_file = lexrc.getString();
373 case RC_AUTORESET_OPTIONS:
375 auto_reset_options = lexrc.getBool();
379 case RC_DISPLAY_GRAPHICS:
381 display_graphics = grfx::displayTranslator.find(lexrc.getString());
387 use_kbmap = lexrc.getBool();
391 case RC_KBMAP_PRIMARY:
393 string const kmap(lexrc.getString());
396 } else if (!LibFileSearch("kbd", kmap,
398 primary_kbmap = kmap;
400 lexrc.printError("LyX: Keymap `$$Token' not found");
405 case RC_KBMAP_SECONDARY:
407 string const kmap(lexrc.getString());
410 } else if (!LibFileSearch("kbd", kmap,
412 secondary_kbmap = kmap;
414 lexrc.printError("LyX: Keymap `$$Token' not found");
419 case RC_FONT_ENCODING:
421 fontenc = lexrc.getString();
427 printer = lexrc.getString();
431 case RC_PRINT_COMMAND:
433 print_command = lexrc.getString();
437 case RC_PRINTEVENPAGEFLAG:
439 print_evenpage_flag = lexrc.getString();
443 case RC_PRINTODDPAGEFLAG:
445 print_oddpage_flag = lexrc.getString();
449 case RC_PRINTPAGERANGEFLAG:
451 print_pagerange_flag = lexrc.getString();
455 case RC_PRINTCOPIESFLAG:
457 print_copies_flag = lexrc.getString();
461 case RC_PRINTCOLLCOPIESFLAG:
463 print_collcopies_flag = lexrc.getString();
467 case RC_PRINTREVERSEFLAG:
469 print_reverse_flag = lexrc.getString();
473 case RC_PRINTLANDSCAPEFLAG:
475 print_landscape_flag = lexrc.getString();
479 case RC_PRINTTOPRINTER:
481 print_to_printer = lexrc.getString();
485 case RC_PRINT_ADAPTOUTPUT:
487 print_adapt_output = lexrc.getBool();
493 print_to_file = lexrc.getString();
497 case RC_PRINTFILEEXTENSION:
499 print_file_extension = lexrc.getString();
503 case RC_PRINTEXSTRAOPTIONS:
505 print_extra_options = lexrc.getString();
509 case RC_PRINTSPOOL_COMMAND:
511 print_spool_command = lexrc.getString();
515 case RC_PRINTSPOOL_PRINTERPREFIX:
517 print_spool_printerprefix = lexrc.getString();
521 case RC_PRINTPAPERDIMENSIONFLAG:
523 print_paper_dimension_flag = lexrc.getString();
527 case RC_PRINTPAPERFLAG:
529 print_paper_flag = lexrc.getString();
533 case RC_CUSTOM_EXPORT_COMMAND:
535 custom_export_command = lexrc.getString();
539 case RC_CUSTOM_EXPORT_FORMAT:
541 custom_export_format = lexrc.getString();
545 case RC_DEFAULT_PAPERSIZE:
548 ascii_lowercase(lexrc.getString());
549 if (size == "usletter")
551 BufferParams::PAPER_USLETTER;
552 else if (size == "legal")
554 BufferParams::PAPER_LEGALPAPER;
555 else if (size == "executive")
557 BufferParams::PAPER_EXECUTIVEPAPER;
558 else if (size == "a3")
560 BufferParams::PAPER_A3PAPER;
561 else if (size == "a4")
563 BufferParams::PAPER_A4PAPER;
564 else if (size == "a5")
566 BufferParams::PAPER_A5PAPER;
567 else if (size == "b5")
569 BufferParams::PAPER_B5PAPER;
573 case RC_VIEWDVI_PAPEROPTION:
575 view_dvi_paper_option = lexrc.getString();
577 view_dvi_paper_option.erase();
583 ps_command = lexrc.getString();
587 case RC_CHKTEX_COMMAND:
589 chktex_command = lexrc.getString();
595 dpi = lexrc.getInteger();
601 zoom = lexrc.getInteger();
607 wheel_jump = lexrc.getInteger();
611 case RC_SCREEN_FONT_SIZES:
613 font_sizes[LyXFont::SIZE_TINY] =
617 font_sizes[LyXFont::SIZE_SCRIPT] =
621 font_sizes[LyXFont::SIZE_FOOTNOTE] =
625 font_sizes[LyXFont::SIZE_SMALL] =
629 font_sizes[LyXFont::SIZE_NORMAL] =
633 font_sizes[LyXFont::SIZE_LARGE] =
637 font_sizes[LyXFont::SIZE_LARGER] =
641 font_sizes[LyXFont::SIZE_LARGEST] =
645 font_sizes[LyXFont::SIZE_HUGE] =
649 font_sizes[LyXFont::SIZE_HUGER] =
654 case RC_SCREEN_FONT_SCALABLE:
656 use_scalable_fonts = lexrc.getBool();
662 autosave = lexrc.getInteger();
666 case RC_DOCUMENTPATH:
668 document_path = ExpandPath(lexrc.getString());
672 case RC_TEMPLATEPATH:
674 template_path = ExpandPath(lexrc.getString());
680 tempdir_path = ExpandPath(lexrc.getString());
686 use_tempdir = lexrc.getBool();
692 lastfiles = ExpandPath(lexrc.getString());
696 case RC_NUMLASTFILES:
698 num_lastfiles = lexrc.getInteger();
702 case RC_CHECKLASTFILES:
704 check_lastfiles = lexrc.getBool();
708 case RC_SCREEN_FONT_ROMAN:
710 roman_font_name = lexrc.getString();
711 oldFontFormat(roman_font_name,
716 case RC_SCREEN_FONT_SANS:
718 sans_font_name = lexrc.getString();
719 oldFontFormat(sans_font_name, sans_font_foundry);
723 case RC_SCREEN_FONT_TYPEWRITER:
725 typewriter_font_name = lexrc.getString();
726 oldFontFormat(typewriter_font_name,
727 typewriter_font_foundry);
731 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
733 roman_font_foundry = lexrc.getString();
737 case RC_SCREEN_FONT_SANS_FOUNDRY:
739 sans_font_foundry = lexrc.getString();
743 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
745 typewriter_font_foundry = lexrc.getString();
749 case RC_SCREEN_FONT_ENCODING:
751 font_norm = lexrc.getString();
752 set_font_norm_type();
756 case RC_POPUP_BOLD_FONT:
758 popup_bold_font = lexrc.getString();
762 case RC_POPUP_NORMAL_FONT:
764 popup_normal_font = lexrc.getString();
768 case RC_POPUP_FONT_ENCODING:
770 popup_font_encoding = lexrc.getString();
776 string lyx_name, x11_name;
779 lyx_name = lexrc.getString();
781 lexrc.printError("Missing color tag.");
786 x11_name = lexrc.getString();
788 lexrc.printError("Missing color name for color: `$$Token'");
792 if (!lcolor.setColor(lyx_name, x11_name)) {
793 lyxerr << "Bad lyxrc set_color for "
799 case RC_AUTOREGIONDELETE:
800 // Auto region delete defaults to true
802 auto_region_delete = lexrc.getBool();
808 // we should not do an explicit binding before
809 // loading a bind file. So, in this case, load
810 // the default bind file.
811 readBindFileIfNeeded();
813 // !!!chb, dynamic key binding...
815 string::size_type res = 0;
819 seq = lexrc.getString();
821 lexrc.printError("RC_BIND: Missing key sequence");
825 if (lexrc.next(true)) {
826 cmd = lexrc.getString();
828 lexrc.printError("RC_BIND: missing command");
832 if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
833 if (lyxerr.debugging(Debug::LYXRC)) {
834 lyxerr << "RC_BIND: Sequence `"
835 << seq << "' Command `"
836 << cmd << "' Action `"
837 << action << '\'' << endl;
839 res = toplevel_keymap->bind(seq, kb_action(action));
840 if (res != string::npos
841 && lyxerr.debugging(Debug::LYXRC)) {
844 "Invalid key sequence `"
847 } else {// cmd is the last token read.
849 "Unknown LyX function `$$Token'");
855 lyxpipes = ExpandPath(lexrc.getString());
859 case RC_CURSOR_FOLLOWS_SCROLLBAR:
861 cursor_follows_scrollbar = lexrc.getBool();
865 case RC_DIALOGS_ICONIFY_WITH_MAIN:
867 dialogs_iconify_with_main = lexrc.getBool();
871 case RC_ASCIIROFF_COMMAND:
873 ascii_roff_command = lexrc.getString();
876 case RC_ASCII_LINELEN:
878 ascii_linelen = lexrc.getInteger();
881 // Spellchecker settings:
885 use_pspell = lexrc.getBool();
889 case RC_SPELL_COMMAND:
891 isp_command = lexrc.getString();
894 case RC_ACCEPT_COMPOUND:
896 isp_accept_compound = lexrc.getBool();
901 isp_use_input_encoding = lexrc.getBool();
904 case RC_USE_ALT_LANG:
906 isp_use_alt_lang = lexrc.getBool();
909 case RC_USE_PERS_DICT:
911 isp_use_pers_dict = lexrc.getBool();
914 case RC_USE_ESC_CHARS:
916 isp_use_esc_chars = lexrc.getBool();
921 isp_alt_lang = lexrc.getString();
926 isp_pers_dict = lexrc.getString();
931 isp_esc_chars = lexrc.getString();
936 make_backup = lexrc.getBool();
939 case RC_BACKUPDIR_PATH:
941 backupdir_path = ExpandPath(lexrc.getString());
944 case RC_DATE_INSERT_FORMAT:
946 date_insert_format = lexrc.getString();
949 case RC_LANGUAGE_PACKAGE:
951 language_package = lexrc.getString();
954 case RC_LANGUAGE_AUTO_BEGIN:
956 language_auto_begin = lexrc.getBool();
959 case RC_LANGUAGE_AUTO_END:
961 language_auto_end = lexrc.getBool();
964 case RC_LANGUAGE_GLOBAL_OPTIONS:
966 language_global_options = lexrc.getBool();
969 case RC_LANGUAGE_USE_BABEL:
971 language_use_babel = lexrc.getBool();
974 case RC_LANGUAGE_COMMAND_BEGIN:
976 language_command_begin = lexrc.getString();
979 case RC_LANGUAGE_COMMAND_END:
981 language_command_end = lexrc.getString();
984 case RC_LANGUAGE_COMMAND_LOCAL:
986 language_command_local = lexrc.getString();
991 rtl_support = lexrc.getBool();
996 auto_number = lexrc.getBool();
999 case RC_MARK_FOREIGN_LANGUAGE:
1001 mark_foreign_language = lexrc.getBool();
1005 case RC_CONVERTER: {
1006 string from, to, command, flags;
1008 from = lexrc.getString();
1011 to = lexrc.getString();
1014 command = lexrc.getString();
1017 flags = lexrc.getString();
1020 || token(command, ' ', 0) == "none") {
1021 converters.erase(from, to);
1023 converters.add(from, to, command, flags);
1028 string format, command;
1030 format = lexrc.getString();
1033 command = lexrc.getString();
1034 if (token(command, ' ', 0) == "none")
1037 formats.setViewer(format, command);
1041 string format, extension, prettyname, shortcut;
1043 format = lexrc.getString();
1046 extension = lexrc.getString();
1049 prettyname = lexrc.getString();
1052 shortcut = lexrc.getString();
1054 if (prettyname.empty()) {
1055 if (converters.formatIsUsed(format)) {
1056 lyxerr << "Can't delete format "
1059 formats.erase(format);
1062 formats.add(format, extension, prettyname,
1067 case RC_DEFAULT_LANGUAGE:
1069 default_language = lexrc.getString();
1073 case RC_LABEL_INIT_LENGTH:
1075 label_init_length = lexrc.getInteger();
1079 case RC_SHOW_BANNER:
1081 show_banner = lexrc.getBool();
1087 preview = lexrc.getBool();
1091 case RC_PREVIEW_HASHED_LABELS:
1093 preview_hashed_labels = lexrc.getBool();
1097 case RC_PREVIEW_SCALE_FACTOR:
1099 preview_scale_factor = lexrc.getFloat();
1105 user_name = lexrc.getString();
1110 user_email = lexrc.getString();
1113 case RC_LAST: break; // this is just a dummy
1117 /// Update converters data-structures
1118 converters.update(formats);
1119 converters.buildGraph();
1125 void LyXRC::write(string const & filename) const
1127 ofstream ofs(filename.c_str());
1133 void LyXRC::print() const
1135 if (lyxerr.debugging())
1142 void LyXRC::output(ostream & os) const
1144 os << "### This file is part of\n"
1145 << "### ========================================================\n"
1146 << "### LyX, The Document Processor\n"
1148 << "### Copyright 1995 Matthias Ettrich\n"
1149 << "### Copyright 1995-2001 The LyX Team.\n"
1151 << "### ========================================================\n"
1153 << "# This file is written by LyX, if you want to make your own\n"
1154 << "# modifications you should do them from inside LyX and save\n"
1157 // Why the switch you might ask. It is a trick to ensure that all
1158 // the elements in the LyXRCTags enum is handled. As you can see
1159 // there are no breaks at all. So it is just a huge fall-through.
1160 // The nice thing is that we will get a warning from the compiler
1161 // if we forget an element.
1162 LyXRCTags tag = RC_LAST;
1166 // input/include files are not done here
1168 // bindings is not written to the preferences file.
1170 if (bind_file != system_lyxrc.bind_file) {
1171 os << "\\bind_file " << bind_file << "\n";
1177 << "# MISC SECTION ######################################\n"
1180 // bind files are not done here.
1182 if (ui_file != system_lyxrc.ui_file) {
1183 os << "\\ui_file \"" << ui_file << "\"\n";
1185 case RC_AUTOREGIONDELETE:
1186 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1187 os << "# Set to false to inhibit automatic replacement of\n"
1188 << "# the current selection.\n"
1189 << "\\auto_region_delete " << tostr(auto_region_delete)
1192 case RC_AUTORESET_OPTIONS:
1193 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1194 os << "# Set to false to inhibit automatic reset of\n"
1195 << "# the class options to defaults on class change.\n"
1196 << "\\auto_reset_options " << tostr(auto_reset_options)
1200 if (autosave != system_lyxrc.autosave) {
1201 os << "# The time interval between auto-saves in seconds.\n"
1202 << "\\autosave " << autosave << '\n';
1204 case RC_DISPLAY_GRAPHICS:
1205 if (display_graphics != system_lyxrc.display_graphics) {
1206 os << "# Display graphics within LyX\n"
1207 << "# monochrome|grayscale|color|none\n"
1208 << "\\display_graphics " << grfx::displayTranslator.find(display_graphics)
1212 case RC_VIEWDVI_PAPEROPTION:
1213 if (view_dvi_paper_option
1214 != system_lyxrc.view_dvi_paper_option) {
1215 os << "# Options used to specify paper size to the\n"
1216 << "# view_dvi_command (e.g. -paper)\n"
1217 << "\\view_dvi_paper_option \""
1218 << view_dvi_paper_option << "\"\n";
1220 case RC_DEFAULT_PAPERSIZE:
1221 if (default_papersize != system_lyxrc.default_papersize) {
1222 os << "# The default papersize to use.\n"
1223 << "\\default_papersize \"";
1224 switch (default_papersize) {
1225 case BufferParams::PAPER_USLETTER:
1226 os << "usletter"; break;
1227 case BufferParams::PAPER_LEGALPAPER:
1228 os << "legal"; break;
1229 case BufferParams::PAPER_EXECUTIVEPAPER:
1230 os << "executive"; break;
1231 case BufferParams::PAPER_A3PAPER:
1233 case BufferParams::PAPER_A4PAPER:
1235 case BufferParams::PAPER_A5PAPER:
1237 case BufferParams::PAPER_B5PAPER:
1239 case BufferParams::PAPER_DEFAULT: break;
1244 if (ps_command != system_lyxrc.ps_command) {
1245 os << "# Program used for interpreting postscript.\n"
1246 << "\\ps_command \"" << ps_command << "\"\n";
1248 case RC_CHKTEX_COMMAND:
1249 if (chktex_command != system_lyxrc.chktex_command) {
1250 os << "\\chktex_command \"" << chktex_command << "\"\n";
1253 if (use_kbmap != system_lyxrc.use_kbmap) {
1254 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1256 case RC_KBMAP_PRIMARY:
1257 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1258 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1260 case RC_KBMAP_SECONDARY:
1261 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1262 os << "\\kbmap_secondary \"" << secondary_kbmap
1266 if (lyxpipes != system_lyxrc.lyxpipes) {
1267 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1269 case RC_DATE_INSERT_FORMAT:
1270 if (date_insert_format != system_lyxrc.date_insert_format) {
1271 os << "\\date_insert_format \"" << date_insert_format
1274 case RC_LABEL_INIT_LENGTH:
1275 if (label_init_length != system_lyxrc.label_init_length) {
1276 os << "\\label_init_length " << label_init_length
1281 os << "\\user_name \"" << user_name << "\"\n";
1284 os << "\\user_email \"" << user_email << "\"\n";
1286 case RC_SHOW_BANNER:
1287 if (show_banner != system_lyxrc.show_banner) {
1288 os << "\\show_banner " << tostr(show_banner) << '\n';
1292 if (preview != system_lyxrc.preview) {
1293 os << "\\preview " << tostr(preview) << '\n';
1296 case RC_PREVIEW_HASHED_LABELS:
1297 if (preview_hashed_labels !=
1298 system_lyxrc.preview_hashed_labels) {
1299 os << "\\preview_hashed_labels "
1300 << tostr(preview_hashed_labels) << '\n';
1303 case RC_PREVIEW_SCALE_FACTOR:
1304 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1305 os << "\\preview_scale_factor "
1306 << preview_scale_factor << '\n';
1310 << "# SCREEN & FONTS SECTION ############################\n"
1313 case RC_POPUP_NORMAL_FONT:
1314 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1315 os << "\\popup_normal_font \"" << popup_normal_font
1318 case RC_POPUP_BOLD_FONT:
1319 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1320 os << "\\popup_bold_font \"" << popup_bold_font
1323 case RC_POPUP_FONT_ENCODING:
1324 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1325 os << "\\popup_font_encoding \"" << popup_font_encoding
1329 if (dpi != system_lyxrc.dpi) {
1330 os << "\\screen_dpi " << dpi << '\n';
1332 case RC_SCREEN_ZOOM:
1333 if (zoom != system_lyxrc.zoom) {
1334 os << "\\screen_zoom " << zoom << '\n';
1337 if (wheel_jump != system_lyxrc.wheel_jump) {
1338 os << "\\wheel_jump " << wheel_jump << '\n';
1340 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1341 if (cursor_follows_scrollbar
1342 != system_lyxrc.cursor_follows_scrollbar) {
1343 os << "\\cursor_follows_scrollbar "
1344 << tostr(cursor_follows_scrollbar) << '\n';
1346 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1347 if (dialogs_iconify_with_main
1348 != system_lyxrc.dialogs_iconify_with_main) {
1349 os << "\\dialogs_iconify_with_main "
1350 << tostr(dialogs_iconify_with_main) << '\n';
1352 case RC_SCREEN_FONT_ROMAN:
1353 if (roman_font_name != system_lyxrc.roman_font_name) {
1354 os << "\\screen_font_roman \"" << roman_font_name
1357 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1358 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1359 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1362 case RC_SCREEN_FONT_SANS:
1363 if (sans_font_name != system_lyxrc.sans_font_name) {
1364 os << "\\screen_font_sans \"" << sans_font_name
1367 case RC_SCREEN_FONT_SANS_FOUNDRY:
1368 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1369 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1372 case RC_SCREEN_FONT_TYPEWRITER:
1373 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1374 os << "\\screen_font_typewriter \""
1375 << typewriter_font_name << "\"\n";
1377 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1378 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1379 os << "\\screen_font_typewriter_foundry \""
1380 << typewriter_font_foundry << "\"\n";
1383 case RC_SCREEN_FONT_SCALABLE:
1384 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1385 os << "\\screen_font_scalable "
1386 << tostr(use_scalable_fonts)
1389 case RC_SCREEN_FONT_ENCODING:
1390 if (font_norm != system_lyxrc.font_norm) {
1391 os << "\\screen_font_encoding \"" << font_norm
1394 case RC_SCREEN_FONT_SIZES:
1395 if (font_sizes[LyXFont::SIZE_TINY]
1396 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1397 font_sizes[LyXFont::SIZE_SCRIPT]
1398 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1399 font_sizes[LyXFont::SIZE_FOOTNOTE]
1400 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1401 font_sizes[LyXFont::SIZE_SMALL]
1402 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1403 font_sizes[LyXFont::SIZE_NORMAL]
1404 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1405 font_sizes[LyXFont::SIZE_LARGE]
1406 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1407 font_sizes[LyXFont::SIZE_LARGER]
1408 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1409 font_sizes[LyXFont::SIZE_LARGEST]
1410 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1411 font_sizes[LyXFont::SIZE_HUGE]
1412 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1413 font_sizes[LyXFont::SIZE_HUGER]
1414 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1415 os.setf(ios::fixed);
1417 os << "\\screen_font_sizes"
1418 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1419 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1420 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1421 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1422 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1423 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1424 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1425 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1426 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1427 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1432 << "# COLOR SECTION ###################################\n"
1436 for (int i = 0; i < LColor::ignore; ++i) {
1437 LColor::color lc = static_cast<LColor::color>(i);
1439 string const col(lcolor.getX11Name(lc));
1440 if (col != system_lcolor.getX11Name(lc)) {
1441 os << "\\set_color \""
1442 << lcolor.getLyXName(lc) << "\" \""
1448 << "# PRINTER SECTION ###################################\n"
1452 if (printer != system_lyxrc.printer) {
1453 os << "\\printer \"" << printer << "\"\n";
1455 case RC_PRINT_ADAPTOUTPUT:
1456 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1457 os << "\\print_adapt_output "
1458 << tostr(print_adapt_output)
1461 case RC_PRINT_COMMAND:
1462 if (print_command != system_lyxrc.print_command) {
1463 os << "\\print_command \"" << print_command << "\"\n";
1465 case RC_PRINTEXSTRAOPTIONS:
1466 if (print_extra_options != system_lyxrc.print_extra_options) {
1467 os << "\\print_extra_options \"" << print_extra_options
1470 case RC_PRINTSPOOL_COMMAND:
1471 if (print_spool_command != system_lyxrc.print_spool_command) {
1472 os << "\\print_spool_command \"" << print_spool_command
1475 case RC_PRINTSPOOL_PRINTERPREFIX:
1476 if (print_spool_printerprefix
1477 != system_lyxrc.print_spool_printerprefix) {
1478 os << "\\print_spool_printerprefix \""
1479 << print_spool_printerprefix << "\"\n";
1481 case RC_PRINTEVENPAGEFLAG:
1482 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1483 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1486 case RC_PRINTODDPAGEFLAG:
1487 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1488 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1491 case RC_PRINTREVERSEFLAG:
1492 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1493 os << "\\print_reverse_flag \"" << print_reverse_flag
1496 case RC_PRINTLANDSCAPEFLAG:
1497 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1498 os << "\\print_landscape_flag \"" << print_landscape_flag
1501 case RC_PRINTPAGERANGEFLAG:
1502 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1503 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1506 case RC_PRINTCOPIESFLAG:
1507 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1508 os << "\\print_copies_flag \"" << print_copies_flag
1511 case RC_PRINTCOLLCOPIESFLAG:
1512 if (print_collcopies_flag
1513 != system_lyxrc.print_collcopies_flag) {
1514 os << "\\print_collcopies_flag \""
1515 << print_collcopies_flag
1518 case RC_PRINTPAPERFLAG:
1519 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1520 os << "\\print_paper_flag \"" << print_paper_flag
1523 case RC_PRINTPAPERDIMENSIONFLAG:
1524 if (print_paper_dimension_flag
1525 != system_lyxrc.print_paper_dimension_flag) {
1526 os << "\\print_paper_dimension_flag \""
1527 << print_paper_dimension_flag << "\"\n";
1529 case RC_PRINTTOPRINTER:
1530 if (print_to_printer != system_lyxrc.print_to_printer) {
1531 os << "\\print_to_printer \"" << print_to_printer
1534 case RC_PRINTTOFILE:
1535 if (print_to_file != system_lyxrc.print_to_file) {
1536 os << "\\print_to_file \"" << print_to_file << "\"\n";
1538 case RC_PRINTFILEEXTENSION:
1539 if (print_file_extension != system_lyxrc.print_file_extension) {
1540 os << "\\print_file_extension \""
1541 << print_file_extension
1546 << "# EXPORT SECTION ####################################\n"
1549 case RC_CUSTOM_EXPORT_COMMAND:
1550 if (custom_export_command
1551 != system_lyxrc.custom_export_command) {
1552 os << "\\custom_export_command \""
1553 << custom_export_command
1556 case RC_CUSTOM_EXPORT_FORMAT:
1557 if (custom_export_format
1558 != system_lyxrc.custom_export_format) {
1559 os << "\\custom_export_format \"" << custom_export_format
1564 << "# TEX SECTION #######################################\n"
1567 case RC_FONT_ENCODING:
1568 if (fontenc != system_lyxrc.fontenc) {
1569 os << "\\font_encoding \"" << fontenc << "\"\n";
1573 << "# FILE SECTION ######################################\n"
1576 case RC_DOCUMENTPATH:
1577 if (document_path != system_lyxrc.document_path) {
1578 os << "\\document_path \"" << document_path << "\"\n";
1581 if (lastfiles != system_lyxrc.lastfiles) {
1582 os << "\\lastfiles \"" << lastfiles << "\"\n";
1584 case RC_NUMLASTFILES:
1585 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1586 os << "\\num_lastfiles " << num_lastfiles << '\n';
1588 case RC_CHECKLASTFILES:
1589 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1590 os << "\\check_lastfiles " << tostr(check_lastfiles)
1593 case RC_TEMPLATEPATH:
1594 if (template_path != system_lyxrc.template_path) {
1595 os << "\\template_path \"" << template_path << "\"\n";
1597 case RC_TEMPDIRPATH:
1598 if (tempdir_path != system_lyxrc.tempdir_path) {
1599 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1602 if (use_tempdir != system_lyxrc.use_tempdir) {
1603 os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
1605 case RC_ASCII_LINELEN:
1606 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1607 os << "\\ascii_linelen " << ascii_linelen << '\n';
1609 case RC_MAKE_BACKUP:
1610 if (make_backup != system_lyxrc.make_backup) {
1611 os << "\\make_backup " << tostr(make_backup) << '\n';
1613 case RC_BACKUPDIR_PATH:
1614 if (backupdir_path != system_lyxrc.backupdir_path) {
1615 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1619 << "# ASCII EXPORT SECTION ##############################\n"
1622 case RC_ASCIIROFF_COMMAND:
1623 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1624 os << "\\ascii_roff_command \"" << ascii_roff_command
1629 << "# SPELLCHECKER SECTION ##############################\n"
1633 if (use_pspell != system_lyxrc.use_pspell) {
1634 os << "\\use_pspell " << tostr(use_pspell) << '\n';
1637 case RC_SPELL_COMMAND:
1638 if (isp_command != system_lyxrc.isp_command) {
1639 os << "\\spell_command \"" << isp_command << "\"\n";
1641 case RC_ACCEPT_COMPOUND:
1642 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1643 os << "\\accept_compound " << tostr(isp_accept_compound)
1646 case RC_USE_ALT_LANG:
1647 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1648 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1652 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1653 os << "\\alternate_language \"" << isp_alt_lang
1656 case RC_USE_ESC_CHARS:
1657 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1658 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1662 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1663 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1665 case RC_USE_PERS_DICT:
1666 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1667 os << "\\use_personal_dictionary "
1668 << tostr(isp_use_pers_dict)
1672 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1673 os << "\\personal_dictionary \"" << isp_pers_dict
1676 case RC_USE_INP_ENC:
1677 if (isp_use_input_encoding
1678 != system_lyxrc.isp_use_input_encoding) {
1679 os << "\\use_input_encoding "
1680 << tostr(isp_use_input_encoding)
1685 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1688 case RC_RTL_SUPPORT:
1689 if (rtl_support != system_lyxrc.rtl_support) {
1690 os << "\\rtl " << tostr(rtl_support) << '\n';
1692 case RC_LANGUAGE_PACKAGE:
1693 if (language_package != system_lyxrc.language_package) {
1694 os << "\\language_package \"" << language_package
1697 case RC_LANGUAGE_GLOBAL_OPTIONS:
1698 if (language_global_options
1699 != system_lyxrc.language_global_options) {
1700 os << "\\language_global_options \""
1701 << tostr(language_global_options)
1704 case RC_LANGUAGE_USE_BABEL:
1705 if (language_use_babel != system_lyxrc.language_use_babel) {
1706 os << "\\language_use_babel \""
1707 << tostr(language_use_babel)
1710 case RC_LANGUAGE_COMMAND_BEGIN:
1711 if (language_command_begin
1712 != system_lyxrc.language_command_begin) {
1713 os << "\\language_command_begin \""
1714 << language_command_begin
1717 case RC_LANGUAGE_COMMAND_END:
1718 if (language_command_end
1719 != system_lyxrc.language_command_end) {
1720 os << "\\language_command_end \"" << language_command_end
1723 case RC_LANGUAGE_COMMAND_LOCAL:
1724 if (language_command_local
1725 != system_lyxrc.language_command_local) {
1726 os << "\\language_command_local \""
1727 << language_command_local
1730 case RC_LANGUAGE_AUTO_BEGIN:
1731 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1732 os << "\\language_auto_begin "
1733 << tostr(language_auto_begin) << '\n';
1735 case RC_LANGUAGE_AUTO_END:
1736 if (language_auto_end != system_lyxrc.language_auto_end) {
1737 os << "\\language_auto_end "
1738 << tostr(language_auto_end) << '\n';
1740 case RC_MARK_FOREIGN_LANGUAGE:
1741 if (mark_foreign_language
1742 != system_lyxrc.mark_foreign_language) {
1743 os << "\\mark_foreign_language " <<
1744 tostr(mark_foreign_language) << '\n';
1748 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1751 case RC_AUTO_NUMBER:
1752 if (auto_number != system_lyxrc.auto_number) {
1753 os << "\\auto_number " << tostr(auto_number) << '\n';
1755 case RC_DEFAULT_LANGUAGE:
1756 if (default_language != system_lyxrc.default_language) {
1757 os << "\\default_language " << default_language << '\n';
1761 << "# FORMATS SECTION ##########################\n"
1765 // Look for deleted formats
1766 for (Formats::const_iterator cit = formats.begin();
1767 cit != formats.end(); ++cit) {
1768 Format const * format =
1769 system_formats.getFormat(cit->name());
1771 format->extension() != cit->extension() ||
1772 format->prettyname() != cit->prettyname() ||
1773 format->shortcut() != cit->shortcut())
1774 os << "\\format \"" << cit->name() << "\" \""
1775 << cit->extension() << "\" \""
1776 << cit->prettyname() << "\" \""
1777 << cit->shortcut() << "\"\n";
1780 // New/modifed formats
1781 for (Formats::const_iterator cit = system_formats.begin();
1782 cit != system_formats.end(); ++cit)
1783 if (!formats.getFormat(cit->name()))
1784 os << "\\format \"" << cit->name()
1785 << "\" \"\" \"\" \"\"\n";
1787 for (Formats::const_iterator cit = formats.begin();
1788 cit != formats.end(); ++cit) {
1789 Format const * format =
1790 system_formats.getFormat(cit->name());
1791 if ((!format || format->viewer() != cit->viewer()) &&
1792 (format || !cit->viewer().empty()))
1793 os << "\\viewer \"" << cit->name() << "\" \""
1794 << cit->viewer() << "\"\n";
1798 << "# CONVERTERS SECTION ##########################\n"
1802 // Look for new converters
1803 for (Converters::const_iterator cit = converters.begin();
1804 cit != converters.end(); ++cit) {
1805 Converter const * converter =
1806 system_converters.getConverter(cit->from,
1809 converter->command != cit->command ||
1810 converter->flags != cit->flags)
1811 os << "\\converter \"" << cit->from << "\" \""
1812 << cit->to << "\" \""
1813 << cit->command << "\" \""
1814 << cit->flags << "\"\n";
1817 // New/modifed converters
1818 for (Converters::const_iterator cit = system_converters.begin();
1819 cit != system_converters.end(); ++cit)
1820 if (!converters.getConverter(cit->from, cit->to))
1821 os << "\\converter \"" << cit->from
1822 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1828 void LyXRC::set_font_norm_type()
1830 if (font_norm == "iso10646-1")
1831 font_norm_type = ISO_10646_1;
1832 else if (font_norm == "iso8859-1")
1833 font_norm_type = ISO_8859_1;
1834 else if (font_norm == "iso8859-3")
1835 font_norm_type = ISO_8859_3;
1836 else if (font_norm == "iso8859-4")
1837 font_norm_type = ISO_8859_4;
1838 else if (font_norm == "iso8859-6.8x")
1839 font_norm_type = ISO_8859_6_8;
1840 else if (font_norm == "iso8859-9")
1841 font_norm_type = ISO_8859_9;
1842 else if (font_norm == "iso8859-15")
1843 font_norm_type = ISO_8859_15;
1845 font_norm_type = OTHER_ENCODING;
1849 string const LyXRC::getDescription(LyXRCTags tag)
1854 case RC_FONT_ENCODING:
1855 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1859 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1862 case RC_PRINT_COMMAND:
1863 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1866 case RC_PRINTEVENPAGEFLAG:
1867 str = _("The option to print only even pages.");
1870 case RC_PRINTODDPAGEFLAG:
1871 str = _("The option to print only odd pages.");
1874 case RC_PRINTPAGERANGEFLAG:
1875 str = _("The option for specifying a comma-separated list of pages to print.");
1878 case RC_PRINTCOPIESFLAG:
1879 str = _("The option for specifying the number of copies to print.");
1882 case RC_PRINTCOLLCOPIESFLAG:
1883 str = _("The option for specifying whether the copies should be collated.");
1886 case RC_PRINTREVERSEFLAG:
1887 str = _("The option to reverse the order of the pages printed.");
1890 case RC_PRINTLANDSCAPEFLAG:
1891 str = _("The option to print out in landscape.");
1894 case RC_PRINTPAPERFLAG:
1895 str = _("The option to specify paper type.");
1898 case RC_PRINTPAPERDIMENSIONFLAG:
1899 str = _("Option to specify the dimensions of the print paper.");
1902 case RC_PRINTTOPRINTER:
1903 str = _("Option to pass to the print program to print on a specific printer.");
1906 case RC_PRINT_ADAPTOUTPUT:
1907 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1910 case RC_PRINTTOFILE:
1911 str = _("Option to pass to the print program to print to a file.");
1914 case RC_PRINTFILEEXTENSION:
1915 str = _("Extension of printer program output file. Usually \".ps\".");
1918 case RC_PRINTEXSTRAOPTIONS:
1919 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1922 case RC_PRINTSPOOL_COMMAND:
1923 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.");
1926 case RC_PRINTSPOOL_PRINTERPREFIX:
1927 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.");
1931 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1934 case RC_SCREEN_ZOOM:
1935 //xgettext:no-c-format
1936 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1939 case RC_SCREEN_FONT_SIZES:
1940 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1943 case RC_SCREEN_FONT_ROMAN:
1944 case RC_SCREEN_FONT_SANS:
1945 case RC_SCREEN_FONT_TYPEWRITER:
1946 str = _("The screen fonts used to display the text while editing.");
1949 case RC_POPUP_BOLD_FONT:
1950 str = _("The bold font in the dialogs.");
1953 case RC_POPUP_NORMAL_FONT:
1954 str = _("The normal font in the dialogs.");
1957 case RC_SCREEN_FONT_ENCODING:
1958 str = _("The encoding for the screen fonts.");
1961 case RC_POPUP_FONT_ENCODING:
1962 str = _("The encoding for the menu/popups fonts.");
1969 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1972 case RC_DOCUMENTPATH:
1973 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1976 case RC_TEMPLATEPATH:
1977 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1980 case RC_TEMPDIRPATH:
1981 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1985 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1989 str = _("The file where the last-files information should be stored.");
1992 case RC_AUTOREGIONDELETE:
1993 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1996 case RC_AUTORESET_OPTIONS:
1997 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2001 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2005 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2009 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2013 case RC_KBMAP_PRIMARY:
2014 case RC_KBMAP_SECONDARY:
2015 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.");
2018 case RC_ASCIIROFF_COMMAND:
2019 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.");
2022 case RC_ASCII_LINELEN:
2023 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2026 case RC_NUMLASTFILES:
2027 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
2030 case RC_CHECKLASTFILES:
2031 str = _("Select to check whether the lastfiles still exist.");
2034 case RC_VIEWDVI_PAPEROPTION:
2035 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2038 case RC_DEFAULT_PAPERSIZE:
2039 str = _("Specify the default paper size.");
2045 case RC_ACCEPT_COMPOUND:
2046 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2049 case RC_SPELL_COMMAND:
2050 str = _("What command runs the spell checker?");
2053 case RC_USE_INP_ENC:
2054 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.");
2057 case RC_USE_ALT_LANG:
2059 str = _("Specify an alternate language. The default is to use the language of the document.");
2062 case RC_USE_PERS_DICT:
2064 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2067 case RC_USE_ESC_CHARS:
2069 str = _("Specify additional chars that can be part of a word.");
2072 case RC_SCREEN_FONT_SCALABLE:
2073 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.");
2076 case RC_CHKTEX_COMMAND:
2077 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2080 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2081 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.");
2084 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2085 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2088 case RC_DISPLAY_GRAPHICS:
2089 str = _("Select how LyX will display any graphics.");
2092 case RC_MAKE_BACKUP:
2093 str = _("De-select if you don't want LyX to create backup files.");
2096 case RC_BACKUPDIR_PATH:
2097 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.");
2100 case RC_RTL_SUPPORT:
2101 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2104 case RC_MARK_FOREIGN_LANGUAGE:
2105 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2108 case RC_LANGUAGE_PACKAGE:
2109 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2112 case RC_LANGUAGE_GLOBAL_OPTIONS:
2113 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2116 case RC_LANGUAGE_USE_BABEL:
2117 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2120 case RC_LANGUAGE_AUTO_BEGIN:
2121 str = _("Select if a language switching command is needed at the beginning of the document.");
2124 case RC_LANGUAGE_AUTO_END:
2125 str = _("Select if a language switching command is needed at the end of the document.");
2128 case RC_LANGUAGE_COMMAND_BEGIN:
2129 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.");
2132 case RC_LANGUAGE_COMMAND_END:
2133 str = _("The LaTeX command for changing back to the language of the document.");
2136 case RC_LANGUAGE_COMMAND_LOCAL:
2137 str = _("The LaTeX command for local changing of the language.");
2140 case RC_DATE_INSERT_FORMAT:
2141 //xgettext:no-c-format
2142 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2145 case RC_SHOW_BANNER:
2146 str = _("De-select if you don't want the startup banner.");
2150 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2162 case RC_DEFAULT_LANGUAGE:
2163 str = _("New documents will be assigned this language.");
2166 case RC_LABEL_INIT_LENGTH:
2167 str = _("Maximum number of words in the initialization string for a new label");
2171 str = _("Shows a typeset preview of things such as math");
2174 case RC_PREVIEW_HASHED_LABELS:
2175 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2178 case RC_PREVIEW_SCALE_FACTOR:
2179 str = _("Scale the preview size to suit.");
2189 // The global instance
2192 // The global copy of the system lyxrc entries (everything except preferences)