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"
39 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
43 // when adding something to this array keep it sorted!
44 keyword_item lyxrcTags[] = {
45 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
46 { "\\alternate_language", LyXRC::RC_ALT_LANG },
47 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
48 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
49 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
50 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
51 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
52 { "\\autosave", LyXRC::RC_AUTOSAVE },
53 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
54 { "\\bind", LyXRC::RC_BIND },
55 { "\\bind_file", LyXRC::RC_BINDFILE },
56 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
57 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
58 { "\\converter", LyXRC::RC_CONVERTER },
59 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
60 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
61 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
62 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
63 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
64 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
65 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
66 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
67 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
68 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
69 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
70 { "\\format", LyXRC::RC_FORMAT },
71 { "\\input", LyXRC::RC_INPUT },
72 { "\\kbmap", LyXRC::RC_KBMAP },
73 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
74 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
75 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
76 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
77 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
78 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
79 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
80 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
81 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
82 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
83 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
84 { "\\lastfiles", LyXRC::RC_LASTFILES },
85 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
86 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
87 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
88 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
89 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
90 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
91 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
92 { "\\preview", LyXRC::RC_PREVIEW },
93 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
94 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
95 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
96 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
97 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
98 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
99 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
100 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
101 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
102 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
103 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
104 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
105 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
106 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
107 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
108 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
109 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
110 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
111 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
112 { "\\printer", LyXRC::RC_PRINTER },
113 { "\\ps_command", LyXRC::RC_PS_COMMAND },
114 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
115 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
116 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
117 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
118 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
119 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
120 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
121 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
122 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
123 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
124 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
125 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
126 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
127 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
128 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
129 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
130 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
131 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
132 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
133 { "\\set_color", LyXRC::RC_SET_COLOR },
134 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
135 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
136 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
137 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
138 { "\\ui_file", LyXRC::RC_UIFILE },
139 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
140 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
141 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
142 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
144 { "\\use_pspell", LyXRC::RC_USE_PSPELL },
146 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
147 { "\\user_email", LyXRC::RC_USER_EMAIL },
148 { "\\user_name", LyXRC::RC_USER_NAME },
149 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
150 { "\\viewer" ,LyXRC::RC_VIEWER},
151 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
154 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
165 void LyXRC::setDefaults() {
169 // Get printer from the environment. If fail, use default "",
170 // assuming that everything is set up correctly.
171 printer = GetEnv("PRINTER");
172 print_adapt_output = false;
173 print_command = "dvips";
174 print_evenpage_flag = "-B";
175 print_oddpage_flag = "-A";
176 print_pagerange_flag = "-pp";
177 print_copies_flag = "-c";
178 print_collcopies_flag = "-C";
179 print_reverse_flag = "-r";
180 print_landscape_flag = "-t landscape";
181 print_to_printer = "-P";
182 print_to_file = "-o ";
183 print_file_extension = ".ps";
184 print_paper_flag = "-t";
185 print_paper_dimension_flag = "-T";
186 document_path.erase();
187 tempdir_path = "/tmp";
190 view_dvi_paper_option.erase();
191 default_papersize = BufferParams::PAPER_USLETTER;
192 custom_export_format = "ps";
193 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
196 // Because a screen typically is wider than a piece of paper:
199 // Default LaTeX font size:
200 font_sizes[LyXFont::SIZE_TINY] = 5.0;
201 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
202 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
203 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
204 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
205 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
206 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
207 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
208 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
209 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
210 use_scalable_fonts = true;
211 roman_font_name = "times";
212 sans_font_name = "helvetica";
213 typewriter_font_name = "courier";
214 popup_bold_font = "-*-helvetica-bold-r";
215 popup_normal_font = "-*-helvetica-medium-r";
216 font_norm = "iso8859-1";
217 font_norm_type = ISO_8859_1;
218 popup_font_encoding.erase();
220 auto_region_delete = true;
221 auto_reset_options = false;
224 check_lastfiles = true;
226 backupdir_path.erase();
227 display_graphics = grfx::ColorDisplay;
228 // Spellchecker settings:
232 isp_command = "ispell";
233 isp_accept_compound = false;
234 isp_use_input_encoding = false;
235 isp_use_alt_lang = false;
236 isp_use_pers_dict = false;
237 isp_use_esc_chars = false;
241 mark_foreign_language = true;
242 language_auto_begin = true;
243 language_auto_end = true;
244 language_global_options = true;
245 language_use_babel = true;
246 language_package = "\\usepackage{babel}";
247 language_command_begin = "\\selectlanguage{$$lang}";
248 language_command_local = "\\foreignlanguage{$$lang}{";
249 default_language = "english";
253 date_insert_format = "%A, %e %B %Y";
254 cursor_follows_scrollbar = false;
255 dialogs_iconify_with_main = false;
256 label_init_length = 3;
258 preview_hashed_labels = false;
259 preview_scale_factor = 0.9;
261 /// These variables are not stored on disk (perhaps they
262 // should be moved from the LyXRC class).
266 user_name = lyx::user_name();
268 user_email = lyx::user_email();
270 if (user_email.empty())
271 user_email = _("email address unknown");
275 int LyXRC::ReadBindFile(string const & name)
278 string const tmp = i18nLibFileSearch("bind", name, "bind");
279 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
280 int const result = read(tmp);
282 lyxerr << "Error reading bind file: " << tmp << endl;
287 void LyXRC::readBindFileIfNeeded()
290 ReadBindFile(bind_file);
296 void oldFontFormat(string & family, string & foundry)
298 if (family.empty() || family[0] != '-')
300 foundry = token(family, '-', 1);
301 family = token(family, '-', 2);
309 int LyXRC::read(string const & filename)
311 LyXLex lexrc(lyxrcTags, lyxrcCount);
312 if (lyxerr.debugging(Debug::PARSER))
313 lexrc.printTable(lyxerr);
315 lexrc.setFile(filename);
316 if (!lexrc.isOK()) return -2;
318 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
320 while (lexrc.isOK()) {
321 // By using two switches we take advantage of the compiler
322 // telling us if we have missed a LyXRCTags element in
323 // the second switch.
324 // Note that this also shows a problem with LyXLex since it
325 // helps us avoid taking advantage of the strictness of the
328 int le = lexrc.lex();
330 case LyXLex::LEX_UNDEF:
331 lexrc.printError("Unknown tag `$$Token'");
333 case LyXLex::LEX_FEOF:
337 switch (static_cast<LyXRCTags>(le)) {
338 case RC_INPUT: // Include file
341 LibFileSearch(string(),
344 lexrc.printError("Error reading "
345 "included file: "+tmp);
349 case RC_BINDFILE: // RVDK_PATCH_5
351 string const tmp(lexrc.getString());
353 // We are already in the
354 // "actually read bind file"
358 // We are still in the "just
359 // remember the name of the
368 ui_file = lexrc.getString();
372 case RC_AUTORESET_OPTIONS:
374 auto_reset_options = lexrc.getBool();
378 case RC_DISPLAY_GRAPHICS:
380 display_graphics = grfx::displayTranslator.find(lexrc.getString());
386 use_kbmap = lexrc.getBool();
390 case RC_KBMAP_PRIMARY:
392 string const kmap(lexrc.getString());
395 } else if (!LibFileSearch("kbd", kmap,
397 primary_kbmap = kmap;
399 lexrc.printError("LyX: Keymap `$$Token' not found");
404 case RC_KBMAP_SECONDARY:
406 string const kmap(lexrc.getString());
409 } else if (!LibFileSearch("kbd", kmap,
411 secondary_kbmap = kmap;
413 lexrc.printError("LyX: Keymap `$$Token' not found");
418 case RC_FONT_ENCODING:
420 fontenc = lexrc.getString();
426 printer = lexrc.getString();
430 case RC_PRINT_COMMAND:
432 print_command = lexrc.getString();
436 case RC_PRINTEVENPAGEFLAG:
438 print_evenpage_flag = lexrc.getString();
442 case RC_PRINTODDPAGEFLAG:
444 print_oddpage_flag = lexrc.getString();
448 case RC_PRINTPAGERANGEFLAG:
450 print_pagerange_flag = lexrc.getString();
454 case RC_PRINTCOPIESFLAG:
456 print_copies_flag = lexrc.getString();
460 case RC_PRINTCOLLCOPIESFLAG:
462 print_collcopies_flag = lexrc.getString();
466 case RC_PRINTREVERSEFLAG:
468 print_reverse_flag = lexrc.getString();
472 case RC_PRINTLANDSCAPEFLAG:
474 print_landscape_flag = lexrc.getString();
478 case RC_PRINTTOPRINTER:
480 print_to_printer = lexrc.getString();
484 case RC_PRINT_ADAPTOUTPUT:
486 print_adapt_output = lexrc.getBool();
492 print_to_file = lexrc.getString();
496 case RC_PRINTFILEEXTENSION:
498 print_file_extension = lexrc.getString();
502 case RC_PRINTEXSTRAOPTIONS:
504 print_extra_options = lexrc.getString();
508 case RC_PRINTSPOOL_COMMAND:
510 print_spool_command = lexrc.getString();
514 case RC_PRINTSPOOL_PRINTERPREFIX:
516 print_spool_printerprefix = lexrc.getString();
520 case RC_PRINTPAPERDIMENSIONFLAG:
522 print_paper_dimension_flag = lexrc.getString();
526 case RC_PRINTPAPERFLAG:
528 print_paper_flag = lexrc.getString();
532 case RC_CUSTOM_EXPORT_COMMAND:
534 custom_export_command = lexrc.getString();
538 case RC_CUSTOM_EXPORT_FORMAT:
540 custom_export_format = lexrc.getString();
544 case RC_DEFAULT_PAPERSIZE:
547 ascii_lowercase(lexrc.getString());
548 if (size == "usletter")
550 BufferParams::PAPER_USLETTER;
551 else if (size == "legal")
553 BufferParams::PAPER_LEGALPAPER;
554 else if (size == "executive")
556 BufferParams::PAPER_EXECUTIVEPAPER;
557 else if (size == "a3")
559 BufferParams::PAPER_A3PAPER;
560 else if (size == "a4")
562 BufferParams::PAPER_A4PAPER;
563 else if (size == "a5")
565 BufferParams::PAPER_A5PAPER;
566 else if (size == "b5")
568 BufferParams::PAPER_B5PAPER;
572 case RC_VIEWDVI_PAPEROPTION:
574 view_dvi_paper_option = lexrc.getString();
576 view_dvi_paper_option.erase();
582 ps_command = lexrc.getString();
586 case RC_CHKTEX_COMMAND:
588 chktex_command = lexrc.getString();
594 dpi = lexrc.getInteger();
600 zoom = lexrc.getInteger();
606 wheel_jump = lexrc.getInteger();
610 case RC_SCREEN_FONT_SIZES:
612 font_sizes[LyXFont::SIZE_TINY] =
616 font_sizes[LyXFont::SIZE_SCRIPT] =
620 font_sizes[LyXFont::SIZE_FOOTNOTE] =
624 font_sizes[LyXFont::SIZE_SMALL] =
628 font_sizes[LyXFont::SIZE_NORMAL] =
632 font_sizes[LyXFont::SIZE_LARGE] =
636 font_sizes[LyXFont::SIZE_LARGER] =
640 font_sizes[LyXFont::SIZE_LARGEST] =
644 font_sizes[LyXFont::SIZE_HUGE] =
648 font_sizes[LyXFont::SIZE_HUGER] =
653 case RC_SCREEN_FONT_SCALABLE:
655 use_scalable_fonts = lexrc.getBool();
661 autosave = lexrc.getInteger();
665 case RC_DOCUMENTPATH:
667 document_path = ExpandPath(lexrc.getString());
671 case RC_TEMPLATEPATH:
673 template_path = ExpandPath(lexrc.getString());
679 tempdir_path = ExpandPath(lexrc.getString());
685 use_tempdir = lexrc.getBool();
691 lastfiles = ExpandPath(lexrc.getString());
695 case RC_NUMLASTFILES:
697 num_lastfiles = lexrc.getInteger();
701 case RC_CHECKLASTFILES:
703 check_lastfiles = lexrc.getBool();
707 case RC_SCREEN_FONT_ROMAN:
709 roman_font_name = lexrc.getString();
710 oldFontFormat(roman_font_name,
715 case RC_SCREEN_FONT_SANS:
717 sans_font_name = lexrc.getString();
718 oldFontFormat(sans_font_name, sans_font_foundry);
722 case RC_SCREEN_FONT_TYPEWRITER:
724 typewriter_font_name = lexrc.getString();
725 oldFontFormat(typewriter_font_name,
726 typewriter_font_foundry);
730 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
732 roman_font_foundry = lexrc.getString();
736 case RC_SCREEN_FONT_SANS_FOUNDRY:
738 sans_font_foundry = lexrc.getString();
742 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
744 typewriter_font_foundry = lexrc.getString();
748 case RC_SCREEN_FONT_ENCODING:
750 font_norm = lexrc.getString();
751 set_font_norm_type();
755 case RC_POPUP_BOLD_FONT:
757 popup_bold_font = lexrc.getString();
761 case RC_POPUP_NORMAL_FONT:
763 popup_normal_font = lexrc.getString();
767 case RC_POPUP_FONT_ENCODING:
769 popup_font_encoding = lexrc.getString();
775 string lyx_name, x11_name;
778 lyx_name = lexrc.getString();
780 lexrc.printError("Missing color tag.");
785 x11_name = lexrc.getString();
787 lexrc.printError("Missing color name for color: `$$Token'");
791 if (!lcolor.setColor(lyx_name, x11_name)) {
792 lyxerr << "Bad lyxrc set_color for "
798 case RC_AUTOREGIONDELETE:
799 // Auto region delete defaults to true
801 auto_region_delete = lexrc.getBool();
807 // we should not do an explicit binding before
808 // loading a bind file. So, in this case, load
809 // the default bind file.
810 readBindFileIfNeeded();
812 // !!!chb, dynamic key binding...
814 string::size_type res = 0;
818 seq = lexrc.getString();
820 lexrc.printError("RC_BIND: Missing key sequence");
824 if (lexrc.next(true)) {
825 cmd = lexrc.getString();
827 lexrc.printError("RC_BIND: missing command");
831 if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
832 if (lyxerr.debugging(Debug::LYXRC)) {
833 lyxerr << "RC_BIND: Sequence `"
834 << seq << "' Command `"
835 << cmd << "' Action `"
836 << action << '\'' << endl;
838 res = toplevel_keymap->bind(seq, kb_action(action));
839 if (res != string::npos
840 && lyxerr.debugging(Debug::LYXRC)) {
843 "Invalid key sequence `"
846 } else {// cmd is the last token read.
848 "Unknown LyX function `$$Token'");
854 lyxpipes = ExpandPath(lexrc.getString());
858 case RC_CURSOR_FOLLOWS_SCROLLBAR:
860 cursor_follows_scrollbar = lexrc.getBool();
864 case RC_DIALOGS_ICONIFY_WITH_MAIN:
866 dialogs_iconify_with_main = lexrc.getBool();
870 case RC_ASCIIROFF_COMMAND:
872 ascii_roff_command = lexrc.getString();
875 case RC_ASCII_LINELEN:
877 ascii_linelen = lexrc.getInteger();
880 // Spellchecker settings:
884 use_pspell = lexrc.getBool();
888 case RC_SPELL_COMMAND:
890 isp_command = lexrc.getString();
893 case RC_ACCEPT_COMPOUND:
895 isp_accept_compound = lexrc.getBool();
900 isp_use_input_encoding = lexrc.getBool();
903 case RC_USE_ALT_LANG:
905 isp_use_alt_lang = lexrc.getBool();
908 case RC_USE_PERS_DICT:
910 isp_use_pers_dict = lexrc.getBool();
913 case RC_USE_ESC_CHARS:
915 isp_use_esc_chars = lexrc.getBool();
920 isp_alt_lang = lexrc.getString();
925 isp_pers_dict = lexrc.getString();
930 isp_esc_chars = lexrc.getString();
935 make_backup = lexrc.getBool();
938 case RC_BACKUPDIR_PATH:
940 backupdir_path = ExpandPath(lexrc.getString());
943 case RC_DATE_INSERT_FORMAT:
945 date_insert_format = lexrc.getString();
948 case RC_LANGUAGE_PACKAGE:
950 language_package = lexrc.getString();
953 case RC_LANGUAGE_AUTO_BEGIN:
955 language_auto_begin = lexrc.getBool();
958 case RC_LANGUAGE_AUTO_END:
960 language_auto_end = lexrc.getBool();
963 case RC_LANGUAGE_GLOBAL_OPTIONS:
965 language_global_options = lexrc.getBool();
968 case RC_LANGUAGE_USE_BABEL:
970 language_use_babel = lexrc.getBool();
973 case RC_LANGUAGE_COMMAND_BEGIN:
975 language_command_begin = lexrc.getString();
978 case RC_LANGUAGE_COMMAND_END:
980 language_command_end = lexrc.getString();
983 case RC_LANGUAGE_COMMAND_LOCAL:
985 language_command_local = lexrc.getString();
990 rtl_support = lexrc.getBool();
995 auto_number = lexrc.getBool();
998 case RC_MARK_FOREIGN_LANGUAGE:
1000 mark_foreign_language = lexrc.getBool();
1004 case RC_CONVERTER: {
1005 string from, to, command, flags;
1007 from = lexrc.getString();
1010 to = lexrc.getString();
1013 command = lexrc.getString();
1016 flags = lexrc.getString();
1019 || token(command, ' ', 0) == "none") {
1020 converters.erase(from, to);
1022 converters.add(from, to, command, flags);
1027 string format, command;
1029 format = lexrc.getString();
1032 command = lexrc.getString();
1033 if (token(command, ' ', 0) == "none")
1036 formats.setViewer(format, command);
1040 string format, extension, prettyname, shortcut;
1042 format = lexrc.getString();
1045 extension = lexrc.getString();
1048 prettyname = lexrc.getString();
1051 shortcut = lexrc.getString();
1053 if (prettyname.empty()) {
1054 if (converters.formatIsUsed(format)) {
1055 lyxerr << "Can't delete format "
1058 formats.erase(format);
1061 formats.add(format, extension, prettyname,
1066 case RC_DEFAULT_LANGUAGE:
1068 default_language = lexrc.getString();
1072 case RC_LABEL_INIT_LENGTH:
1074 label_init_length = lexrc.getInteger();
1078 case RC_SHOW_BANNER:
1080 show_banner = lexrc.getBool();
1086 preview = lexrc.getBool();
1090 case RC_PREVIEW_HASHED_LABELS:
1092 preview_hashed_labels = lexrc.getBool();
1096 case RC_PREVIEW_SCALE_FACTOR:
1098 preview_scale_factor = lexrc.getFloat();
1104 user_name = lexrc.getString();
1109 user_email = lexrc.getString();
1112 case RC_LAST: break; // this is just a dummy
1116 /// Update converters data-structures
1117 converters.update(formats);
1118 converters.buildGraph();
1124 void LyXRC::write(string const & filename) const
1126 ofstream ofs(filename.c_str());
1132 void LyXRC::print() const
1134 if (lyxerr.debugging())
1141 void LyXRC::output(ostream & os) const
1143 os << "### This file is part of\n"
1144 << "### ========================================================\n"
1145 << "### LyX, The Document Processor\n"
1147 << "### Copyright 1995 Matthias Ettrich\n"
1148 << "### Copyright 1995-2001 The LyX Team.\n"
1150 << "### ========================================================\n"
1152 << "# This file is written by LyX, if you want to make your own\n"
1153 << "# modifications you should do them from inside LyX and save\n"
1156 // Why the switch you might ask. It is a trick to ensure that all
1157 // the elements in the LyXRCTags enum is handled. As you can see
1158 // there are no breaks at all. So it is just a huge fall-through.
1159 // The nice thing is that we will get a warning from the compiler
1160 // if we forget an element.
1161 LyXRCTags tag = RC_LAST;
1165 // input/include files are not done here
1167 // bindings is not written to the preferences file.
1169 if (bind_file != system_lyxrc.bind_file) {
1170 os << "\\bind_file " << bind_file << "\n";
1176 << "# MISC SECTION ######################################\n"
1179 // bind files are not done here.
1181 if (ui_file != system_lyxrc.ui_file) {
1182 os << "\\ui_file \"" << ui_file << "\"\n";
1184 case RC_AUTOREGIONDELETE:
1185 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1186 os << "# Set to false to inhibit automatic replacement of\n"
1187 << "# the current selection.\n"
1188 << "\\auto_region_delete " << tostr(auto_region_delete)
1191 case RC_AUTORESET_OPTIONS:
1192 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1193 os << "# Set to false to inhibit automatic reset of\n"
1194 << "# the class options to defaults on class change.\n"
1195 << "\\auto_reset_options " << tostr(auto_reset_options)
1199 if (autosave != system_lyxrc.autosave) {
1200 os << "# The time interval between auto-saves in seconds.\n"
1201 << "\\autosave " << autosave << '\n';
1203 case RC_DISPLAY_GRAPHICS:
1204 if (display_graphics != system_lyxrc.display_graphics) {
1205 os << "# Display graphics within LyX\n"
1206 << "# monochrome|grayscale|color|none\n"
1207 << "\\display_graphics " << grfx::displayTranslator.find(display_graphics)
1211 case RC_VIEWDVI_PAPEROPTION:
1212 if (view_dvi_paper_option
1213 != system_lyxrc.view_dvi_paper_option) {
1214 os << "# Options used to specify paper size to the\n"
1215 << "# view_dvi_command (e.g. -paper)\n"
1216 << "\\view_dvi_paper_option \""
1217 << view_dvi_paper_option << "\"\n";
1219 case RC_DEFAULT_PAPERSIZE:
1220 if (default_papersize != system_lyxrc.default_papersize) {
1221 os << "# The default papersize to use.\n"
1222 << "\\default_papersize \"";
1223 switch (default_papersize) {
1224 case BufferParams::PAPER_USLETTER:
1225 os << "usletter"; break;
1226 case BufferParams::PAPER_LEGALPAPER:
1227 os << "legal"; break;
1228 case BufferParams::PAPER_EXECUTIVEPAPER:
1229 os << "executive"; break;
1230 case BufferParams::PAPER_A3PAPER:
1232 case BufferParams::PAPER_A4PAPER:
1234 case BufferParams::PAPER_A5PAPER:
1236 case BufferParams::PAPER_B5PAPER:
1238 case BufferParams::PAPER_DEFAULT: break;
1243 if (ps_command != system_lyxrc.ps_command) {
1244 os << "# Program used for interpreting postscript.\n"
1245 << "\\ps_command \"" << ps_command << "\"\n";
1247 case RC_CHKTEX_COMMAND:
1248 if (chktex_command != system_lyxrc.chktex_command) {
1249 os << "\\chktex_command \"" << chktex_command << "\"\n";
1252 if (use_kbmap != system_lyxrc.use_kbmap) {
1253 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1255 case RC_KBMAP_PRIMARY:
1256 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1257 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1259 case RC_KBMAP_SECONDARY:
1260 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1261 os << "\\kbmap_secondary \"" << secondary_kbmap
1265 if (lyxpipes != system_lyxrc.lyxpipes) {
1266 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1268 case RC_DATE_INSERT_FORMAT:
1269 if (date_insert_format != system_lyxrc.date_insert_format) {
1270 os << "\\date_insert_format \"" << date_insert_format
1273 case RC_LABEL_INIT_LENGTH:
1274 if (label_init_length != system_lyxrc.label_init_length) {
1275 os << "\\label_init_length " << label_init_length
1280 os << "\\user_name \"" << user_name << "\"\n";
1283 os << "\\user_email \"" << user_email << "\"\n";
1285 case RC_SHOW_BANNER:
1286 if (show_banner != system_lyxrc.show_banner) {
1287 os << "\\show_banner " << tostr(show_banner) << '\n';
1291 if (preview != system_lyxrc.preview) {
1292 os << "\\preview " << tostr(preview) << '\n';
1295 case RC_PREVIEW_HASHED_LABELS:
1296 if (preview_hashed_labels !=
1297 system_lyxrc.preview_hashed_labels) {
1298 os << "\\preview_hashed_labels "
1299 << tostr(preview_hashed_labels) << '\n';
1302 case RC_PREVIEW_SCALE_FACTOR:
1303 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1304 os << "\\preview_scale_factor "
1305 << preview_scale_factor << '\n';
1309 << "# SCREEN & FONTS SECTION ############################\n"
1312 case RC_POPUP_NORMAL_FONT:
1313 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1314 os << "\\popup_normal_font \"" << popup_normal_font
1317 case RC_POPUP_BOLD_FONT:
1318 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1319 os << "\\popup_bold_font \"" << popup_bold_font
1322 case RC_POPUP_FONT_ENCODING:
1323 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1324 os << "\\popup_font_encoding \"" << popup_font_encoding
1328 if (dpi != system_lyxrc.dpi) {
1329 os << "\\screen_dpi " << dpi << '\n';
1331 case RC_SCREEN_ZOOM:
1332 if (zoom != system_lyxrc.zoom) {
1333 os << "\\screen_zoom " << zoom << '\n';
1336 if (wheel_jump != system_lyxrc.wheel_jump) {
1337 os << "\\wheel_jump " << wheel_jump << '\n';
1339 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1340 if (cursor_follows_scrollbar
1341 != system_lyxrc.cursor_follows_scrollbar) {
1342 os << "\\cursor_follows_scrollbar "
1343 << tostr(cursor_follows_scrollbar) << '\n';
1345 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1346 if (dialogs_iconify_with_main
1347 != system_lyxrc.dialogs_iconify_with_main) {
1348 os << "\\dialogs_iconify_with_main "
1349 << tostr(dialogs_iconify_with_main) << '\n';
1351 case RC_SCREEN_FONT_ROMAN:
1352 if (roman_font_name != system_lyxrc.roman_font_name) {
1353 os << "\\screen_font_roman \"" << roman_font_name
1356 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1357 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1358 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1361 case RC_SCREEN_FONT_SANS:
1362 if (sans_font_name != system_lyxrc.sans_font_name) {
1363 os << "\\screen_font_sans \"" << sans_font_name
1366 case RC_SCREEN_FONT_SANS_FOUNDRY:
1367 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1368 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1371 case RC_SCREEN_FONT_TYPEWRITER:
1372 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1373 os << "\\screen_font_typewriter \""
1374 << typewriter_font_name << "\"\n";
1376 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1377 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1378 os << "\\screen_font_typewriter_foundry \""
1379 << typewriter_font_foundry << "\"\n";
1382 case RC_SCREEN_FONT_SCALABLE:
1383 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1384 os << "\\screen_font_scalable "
1385 << tostr(use_scalable_fonts)
1388 case RC_SCREEN_FONT_ENCODING:
1389 if (font_norm != system_lyxrc.font_norm) {
1390 os << "\\screen_font_encoding \"" << font_norm
1393 case RC_SCREEN_FONT_SIZES:
1394 if (font_sizes[LyXFont::SIZE_TINY]
1395 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1396 font_sizes[LyXFont::SIZE_SCRIPT]
1397 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1398 font_sizes[LyXFont::SIZE_FOOTNOTE]
1399 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1400 font_sizes[LyXFont::SIZE_SMALL]
1401 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1402 font_sizes[LyXFont::SIZE_NORMAL]
1403 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1404 font_sizes[LyXFont::SIZE_LARGE]
1405 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1406 font_sizes[LyXFont::SIZE_LARGER]
1407 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1408 font_sizes[LyXFont::SIZE_LARGEST]
1409 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1410 font_sizes[LyXFont::SIZE_HUGE]
1411 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1412 font_sizes[LyXFont::SIZE_HUGER]
1413 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1414 os.setf(ios::fixed);
1416 os << "\\screen_font_sizes"
1417 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1418 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1419 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1420 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1421 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1422 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1423 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1424 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1425 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1426 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1431 << "# COLOR SECTION ###################################\n"
1435 for (int i = 0; i < LColor::ignore; ++i) {
1436 LColor::color lc = static_cast<LColor::color>(i);
1438 string const col(lcolor.getX11Name(lc));
1439 if (col != system_lcolor.getX11Name(lc)) {
1440 os << "\\set_color \""
1441 << lcolor.getLyXName(lc) << "\" \""
1447 << "# PRINTER SECTION ###################################\n"
1451 if (printer != system_lyxrc.printer) {
1452 os << "\\printer \"" << printer << "\"\n";
1454 case RC_PRINT_ADAPTOUTPUT:
1455 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1456 os << "\\print_adapt_output "
1457 << tostr(print_adapt_output)
1460 case RC_PRINT_COMMAND:
1461 if (print_command != system_lyxrc.print_command) {
1462 os << "\\print_command \"" << print_command << "\"\n";
1464 case RC_PRINTEXSTRAOPTIONS:
1465 if (print_extra_options != system_lyxrc.print_extra_options) {
1466 os << "\\print_extra_options \"" << print_extra_options
1469 case RC_PRINTSPOOL_COMMAND:
1470 if (print_spool_command != system_lyxrc.print_spool_command) {
1471 os << "\\print_spool_command \"" << print_spool_command
1474 case RC_PRINTSPOOL_PRINTERPREFIX:
1475 if (print_spool_printerprefix
1476 != system_lyxrc.print_spool_printerprefix) {
1477 os << "\\print_spool_printerprefix \""
1478 << print_spool_printerprefix << "\"\n";
1480 case RC_PRINTEVENPAGEFLAG:
1481 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1482 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1485 case RC_PRINTODDPAGEFLAG:
1486 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1487 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1490 case RC_PRINTREVERSEFLAG:
1491 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1492 os << "\\print_reverse_flag \"" << print_reverse_flag
1495 case RC_PRINTLANDSCAPEFLAG:
1496 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1497 os << "\\print_landscape_flag \"" << print_landscape_flag
1500 case RC_PRINTPAGERANGEFLAG:
1501 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1502 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1505 case RC_PRINTCOPIESFLAG:
1506 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1507 os << "\\print_copies_flag \"" << print_copies_flag
1510 case RC_PRINTCOLLCOPIESFLAG:
1511 if (print_collcopies_flag
1512 != system_lyxrc.print_collcopies_flag) {
1513 os << "\\print_collcopies_flag \""
1514 << print_collcopies_flag
1517 case RC_PRINTPAPERFLAG:
1518 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1519 os << "\\print_paper_flag \"" << print_paper_flag
1522 case RC_PRINTPAPERDIMENSIONFLAG:
1523 if (print_paper_dimension_flag
1524 != system_lyxrc.print_paper_dimension_flag) {
1525 os << "\\print_paper_dimension_flag \""
1526 << print_paper_dimension_flag << "\"\n";
1528 case RC_PRINTTOPRINTER:
1529 if (print_to_printer != system_lyxrc.print_to_printer) {
1530 os << "\\print_to_printer \"" << print_to_printer
1533 case RC_PRINTTOFILE:
1534 if (print_to_file != system_lyxrc.print_to_file) {
1535 os << "\\print_to_file \"" << print_to_file << "\"\n";
1537 case RC_PRINTFILEEXTENSION:
1538 if (print_file_extension != system_lyxrc.print_file_extension) {
1539 os << "\\print_file_extension \""
1540 << print_file_extension
1545 << "# EXPORT SECTION ####################################\n"
1548 case RC_CUSTOM_EXPORT_COMMAND:
1549 if (custom_export_command
1550 != system_lyxrc.custom_export_command) {
1551 os << "\\custom_export_command \""
1552 << custom_export_command
1555 case RC_CUSTOM_EXPORT_FORMAT:
1556 if (custom_export_format
1557 != system_lyxrc.custom_export_format) {
1558 os << "\\custom_export_format \"" << custom_export_format
1563 << "# TEX SECTION #######################################\n"
1566 case RC_FONT_ENCODING:
1567 if (fontenc != system_lyxrc.fontenc) {
1568 os << "\\font_encoding \"" << fontenc << "\"\n";
1572 << "# FILE SECTION ######################################\n"
1575 case RC_DOCUMENTPATH:
1576 if (document_path != system_lyxrc.document_path) {
1577 os << "\\document_path \"" << document_path << "\"\n";
1580 if (lastfiles != system_lyxrc.lastfiles) {
1581 os << "\\lastfiles \"" << lastfiles << "\"\n";
1583 case RC_NUMLASTFILES:
1584 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1585 os << "\\num_lastfiles " << num_lastfiles << '\n';
1587 case RC_CHECKLASTFILES:
1588 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1589 os << "\\check_lastfiles " << tostr(check_lastfiles)
1592 case RC_TEMPLATEPATH:
1593 if (template_path != system_lyxrc.template_path) {
1594 os << "\\template_path \"" << template_path << "\"\n";
1596 case RC_TEMPDIRPATH:
1597 if (tempdir_path != system_lyxrc.tempdir_path) {
1598 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1601 if (use_tempdir != system_lyxrc.use_tempdir) {
1602 os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
1604 case RC_ASCII_LINELEN:
1605 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1606 os << "\\ascii_linelen " << ascii_linelen << '\n';
1608 case RC_MAKE_BACKUP:
1609 if (make_backup != system_lyxrc.make_backup) {
1610 os << "\\make_backup " << tostr(make_backup) << '\n';
1612 case RC_BACKUPDIR_PATH:
1613 if (backupdir_path != system_lyxrc.backupdir_path) {
1614 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1618 << "# ASCII EXPORT SECTION ##############################\n"
1621 case RC_ASCIIROFF_COMMAND:
1622 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1623 os << "\\ascii_roff_command \"" << ascii_roff_command
1628 << "# SPELLCHECKER SECTION ##############################\n"
1632 if (use_pspell != system_lyxrc.use_pspell) {
1633 os << "\\use_pspell " << tostr(use_pspell) << '\n';
1636 case RC_SPELL_COMMAND:
1637 if (isp_command != system_lyxrc.isp_command) {
1638 os << "\\spell_command \"" << isp_command << "\"\n";
1640 case RC_ACCEPT_COMPOUND:
1641 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1642 os << "\\accept_compound " << tostr(isp_accept_compound)
1645 case RC_USE_ALT_LANG:
1646 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1647 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1651 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1652 os << "\\alternate_language \"" << isp_alt_lang
1655 case RC_USE_ESC_CHARS:
1656 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1657 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1661 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1662 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1664 case RC_USE_PERS_DICT:
1665 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1666 os << "\\use_personal_dictionary "
1667 << tostr(isp_use_pers_dict)
1671 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1672 os << "\\personal_dictionary \"" << isp_pers_dict
1675 case RC_USE_INP_ENC:
1676 if (isp_use_input_encoding
1677 != system_lyxrc.isp_use_input_encoding) {
1678 os << "\\use_input_encoding "
1679 << tostr(isp_use_input_encoding)
1684 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1687 case RC_RTL_SUPPORT:
1688 if (rtl_support != system_lyxrc.rtl_support) {
1689 os << "\\rtl " << tostr(rtl_support) << '\n';
1691 case RC_LANGUAGE_PACKAGE:
1692 if (language_package != system_lyxrc.language_package) {
1693 os << "\\language_package \"" << language_package
1696 case RC_LANGUAGE_GLOBAL_OPTIONS:
1697 if (language_global_options
1698 != system_lyxrc.language_global_options) {
1699 os << "\\language_global_options \""
1700 << tostr(language_global_options)
1703 case RC_LANGUAGE_USE_BABEL:
1704 if (language_use_babel != system_lyxrc.language_use_babel) {
1705 os << "\\language_use_babel \""
1706 << tostr(language_use_babel)
1709 case RC_LANGUAGE_COMMAND_BEGIN:
1710 if (language_command_begin
1711 != system_lyxrc.language_command_begin) {
1712 os << "\\language_command_begin \""
1713 << language_command_begin
1716 case RC_LANGUAGE_COMMAND_END:
1717 if (language_command_end
1718 != system_lyxrc.language_command_end) {
1719 os << "\\language_command_end \"" << language_command_end
1722 case RC_LANGUAGE_COMMAND_LOCAL:
1723 if (language_command_local
1724 != system_lyxrc.language_command_local) {
1725 os << "\\language_command_local \""
1726 << language_command_local
1729 case RC_LANGUAGE_AUTO_BEGIN:
1730 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1731 os << "\\language_auto_begin "
1732 << tostr(language_auto_begin) << '\n';
1734 case RC_LANGUAGE_AUTO_END:
1735 if (language_auto_end != system_lyxrc.language_auto_end) {
1736 os << "\\language_auto_end "
1737 << tostr(language_auto_end) << '\n';
1739 case RC_MARK_FOREIGN_LANGUAGE:
1740 if (mark_foreign_language
1741 != system_lyxrc.mark_foreign_language) {
1742 os << "\\mark_foreign_language " <<
1743 tostr(mark_foreign_language) << '\n';
1747 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1750 case RC_AUTO_NUMBER:
1751 if (auto_number != system_lyxrc.auto_number) {
1752 os << "\\auto_number " << tostr(auto_number) << '\n';
1754 case RC_DEFAULT_LANGUAGE:
1755 if (default_language != system_lyxrc.default_language) {
1756 os << "\\default_language " << default_language << '\n';
1760 << "# FORMATS SECTION ##########################\n"
1764 // Look for deleted formats
1765 for (Formats::const_iterator cit = formats.begin();
1766 cit != formats.end(); ++cit) {
1767 Format const * format =
1768 system_formats.getFormat(cit->name());
1770 format->extension() != cit->extension() ||
1771 format->prettyname() != cit->prettyname() ||
1772 format->shortcut() != cit->shortcut())
1773 os << "\\format \"" << cit->name() << "\" \""
1774 << cit->extension() << "\" \""
1775 << cit->prettyname() << "\" \""
1776 << cit->shortcut() << "\"\n";
1779 // New/modifed formats
1780 for (Formats::const_iterator cit = system_formats.begin();
1781 cit != system_formats.end(); ++cit)
1782 if (!formats.getFormat(cit->name()))
1783 os << "\\format \"" << cit->name()
1784 << "\" \"\" \"\" \"\"\n";
1786 for (Formats::const_iterator cit = formats.begin();
1787 cit != formats.end(); ++cit) {
1788 Format const * format =
1789 system_formats.getFormat(cit->name());
1790 if ((!format || format->viewer() != cit->viewer()) &&
1791 (format || !cit->viewer().empty()))
1792 os << "\\viewer \"" << cit->name() << "\" \""
1793 << cit->viewer() << "\"\n";
1797 << "# CONVERTERS SECTION ##########################\n"
1801 // Look for new converters
1802 for (Converters::const_iterator cit = converters.begin();
1803 cit != converters.end(); ++cit) {
1804 Converter const * converter =
1805 system_converters.getConverter(cit->from,
1808 converter->command != cit->command ||
1809 converter->flags != cit->flags)
1810 os << "\\converter \"" << cit->from << "\" \""
1811 << cit->to << "\" \""
1812 << cit->command << "\" \""
1813 << cit->flags << "\"\n";
1816 // New/modifed converters
1817 for (Converters::const_iterator cit = system_converters.begin();
1818 cit != system_converters.end(); ++cit)
1819 if (!converters.getConverter(cit->from, cit->to))
1820 os << "\\converter \"" << cit->from
1821 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1827 void LyXRC::set_font_norm_type()
1829 if (font_norm == "iso10646-1")
1830 font_norm_type = ISO_10646_1;
1831 else if (font_norm == "iso8859-1")
1832 font_norm_type = ISO_8859_1;
1833 else if (font_norm == "iso8859-3")
1834 font_norm_type = ISO_8859_3;
1835 else if (font_norm == "iso8859-4")
1836 font_norm_type = ISO_8859_4;
1837 else if (font_norm == "iso8859-6.8x")
1838 font_norm_type = ISO_8859_6_8;
1839 else if (font_norm == "iso8859-9")
1840 font_norm_type = ISO_8859_9;
1841 else if (font_norm == "iso8859-15")
1842 font_norm_type = ISO_8859_15;
1844 font_norm_type = OTHER_ENCODING;
1848 string const LyXRC::getDescription(LyXRCTags tag)
1853 case RC_FONT_ENCODING:
1854 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1858 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1861 case RC_PRINT_COMMAND:
1862 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1865 case RC_PRINTEVENPAGEFLAG:
1866 str = _("The option to print only even pages.");
1869 case RC_PRINTODDPAGEFLAG:
1870 str = _("The option to print only odd pages.");
1873 case RC_PRINTPAGERANGEFLAG:
1874 str = _("The option for specifying a comma-separated list of pages to print.");
1877 case RC_PRINTCOPIESFLAG:
1878 str = _("The option for specifying the number of copies to print.");
1881 case RC_PRINTCOLLCOPIESFLAG:
1882 str = _("The option for specifying whether the copies should be collated.");
1885 case RC_PRINTREVERSEFLAG:
1886 str = _("The option to reverse the order of the pages printed.");
1889 case RC_PRINTLANDSCAPEFLAG:
1890 str = _("The option to print out in landscape.");
1893 case RC_PRINTPAPERFLAG:
1894 str = _("The option to specify paper type.");
1897 case RC_PRINTPAPERDIMENSIONFLAG:
1898 str = _("Option to specify the dimensions of the print paper.");
1901 case RC_PRINTTOPRINTER:
1902 str = _("Option to pass to the print program to print on a specific printer.");
1905 case RC_PRINT_ADAPTOUTPUT:
1906 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1909 case RC_PRINTTOFILE:
1910 str = _("Option to pass to the print program to print to a file.");
1913 case RC_PRINTFILEEXTENSION:
1914 str = _("Extension of printer program output file. Usually \".ps\".");
1917 case RC_PRINTEXSTRAOPTIONS:
1918 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1921 case RC_PRINTSPOOL_COMMAND:
1922 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.");
1925 case RC_PRINTSPOOL_PRINTERPREFIX:
1926 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.");
1930 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1933 case RC_SCREEN_ZOOM:
1934 //xgettext:no-c-format
1935 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1938 case RC_SCREEN_FONT_SIZES:
1939 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1942 case RC_SCREEN_FONT_ROMAN:
1943 case RC_SCREEN_FONT_SANS:
1944 case RC_SCREEN_FONT_TYPEWRITER:
1945 str = _("The screen fonts used to display the text while editing.");
1948 case RC_POPUP_BOLD_FONT:
1949 str = _("The bold font in the dialogs.");
1952 case RC_POPUP_NORMAL_FONT:
1953 str = _("The normal font in the dialogs.");
1956 case RC_SCREEN_FONT_ENCODING:
1957 str = _("The encoding for the screen fonts.");
1960 case RC_POPUP_FONT_ENCODING:
1961 str = _("The encoding for the menu/popups fonts.");
1968 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1971 case RC_DOCUMENTPATH:
1972 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1975 case RC_TEMPLATEPATH:
1976 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1979 case RC_TEMPDIRPATH:
1980 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1984 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1988 str = _("The file where the last-files information should be stored.");
1991 case RC_AUTOREGIONDELETE:
1992 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1995 case RC_AUTORESET_OPTIONS:
1996 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2000 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2004 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2008 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2012 case RC_KBMAP_PRIMARY:
2013 case RC_KBMAP_SECONDARY:
2014 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.");
2017 case RC_ASCIIROFF_COMMAND:
2018 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.");
2021 case RC_ASCII_LINELEN:
2022 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2025 case RC_NUMLASTFILES:
2026 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
2029 case RC_CHECKLASTFILES:
2030 str = _("Select to check whether the lastfiles still exist.");
2033 case RC_VIEWDVI_PAPEROPTION:
2034 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2037 case RC_DEFAULT_PAPERSIZE:
2038 str = _("Specify the default paper size.");
2044 case RC_ACCEPT_COMPOUND:
2045 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2048 case RC_SPELL_COMMAND:
2049 str = _("What command runs the spell checker?");
2052 case RC_USE_INP_ENC:
2053 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.");
2056 case RC_USE_ALT_LANG:
2058 str = _("Specify an alternate language. The default is to use the language of the document.");
2061 case RC_USE_PERS_DICT:
2063 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2066 case RC_USE_ESC_CHARS:
2068 str = _("Specify additional chars that can be part of a word.");
2071 case RC_SCREEN_FONT_SCALABLE:
2072 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.");
2075 case RC_CHKTEX_COMMAND:
2076 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2079 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2080 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.");
2083 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2084 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2087 case RC_DISPLAY_GRAPHICS:
2088 str = _("Select how LyX will display any graphics.");
2091 case RC_MAKE_BACKUP:
2092 str = _("De-select if you don't want LyX to create backup files.");
2095 case RC_BACKUPDIR_PATH:
2096 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.");
2099 case RC_RTL_SUPPORT:
2100 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2103 case RC_MARK_FOREIGN_LANGUAGE:
2104 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2107 case RC_LANGUAGE_PACKAGE:
2108 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2111 case RC_LANGUAGE_GLOBAL_OPTIONS:
2112 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2115 case RC_LANGUAGE_USE_BABEL:
2116 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2119 case RC_LANGUAGE_AUTO_BEGIN:
2120 str = _("Select if a language switching command is needed at the beginning of the document.");
2123 case RC_LANGUAGE_AUTO_END:
2124 str = _("Select if a language switching command is needed at the end of the document.");
2127 case RC_LANGUAGE_COMMAND_BEGIN:
2128 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.");
2131 case RC_LANGUAGE_COMMAND_END:
2132 str = _("The LaTeX command for changing back to the language of the document.");
2135 case RC_LANGUAGE_COMMAND_LOCAL:
2136 str = _("The LaTeX command for local changing of the language.");
2139 case RC_DATE_INSERT_FORMAT:
2140 //xgettext:no-c-format
2141 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2144 case RC_SHOW_BANNER:
2145 str = _("De-select if you don't want the startup banner.");
2149 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2161 case RC_DEFAULT_LANGUAGE:
2162 str = _("New documents will be assigned this language.");
2165 case RC_LABEL_INIT_LENGTH:
2166 str = _("Maximum number of words in the initialization string for a new label");
2170 str = _("Shows a typeset preview of things such as math");
2173 case RC_PREVIEW_HASHED_LABELS:
2174 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2177 case RC_PREVIEW_SCALE_FACTOR:
2178 str = _("Scale the preview size to suit.");
2188 // The global instance
2191 // The global copy of the system lyxrc entries (everything except preferences)