3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
14 * Full author contact details are available in file CREDITS.
25 #include "converter.h"
32 #include "graphics/GraphicsTypes.h"
34 #include "support/filetools.h"
35 #include "support/lstrings.h"
36 #include "support/translator.h"
37 #include "support/tostr.h"
38 #include "support/userinfo.h"
40 using lyx::support::ascii_lowercase;
41 using lyx::support::ExpandPath;
42 using lyx::support::GetEnv;
43 using lyx::support::LibFileSearch;
44 using lyx::support::token;
57 // when adding something to this array keep it sorted!
58 keyword_item lyxrcTags[] = {
59 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
60 { "\\alternate_language", LyXRC::RC_ALT_LANG },
61 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
62 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
63 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
64 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
65 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
66 { "\\autosave", LyXRC::RC_AUTOSAVE },
67 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
68 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
69 { "\\bind_file", LyXRC::RC_BINDFILE },
70 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
71 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
72 { "\\converter", LyXRC::RC_CONVERTER },
73 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
74 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
75 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
76 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
77 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
78 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
79 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
80 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
81 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
82 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
83 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
84 { "\\format", LyXRC::RC_FORMAT },
85 { "\\input", LyXRC::RC_INPUT },
86 { "\\kbmap", LyXRC::RC_KBMAP },
87 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
88 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
89 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
90 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
91 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
92 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
93 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
94 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
95 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
96 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
97 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
98 { "\\lastfiles", LyXRC::RC_LASTFILES },
99 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
100 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
101 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
102 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
103 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
104 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
105 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
106 { "\\preview", LyXRC::RC_PREVIEW },
107 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
108 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
109 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
110 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
111 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
112 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
113 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
114 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
115 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
116 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
117 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
118 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
119 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
120 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
121 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
122 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
123 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
124 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
125 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
126 { "\\printer", LyXRC::RC_PRINTER },
127 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
128 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
129 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
130 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
131 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
132 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
133 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
134 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
135 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
136 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
137 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
138 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
139 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
140 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
141 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
142 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
143 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
144 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
145 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
146 { "\\set_color", LyXRC::RC_SET_COLOR },
147 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
148 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
149 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
150 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
151 { "\\ui_file", LyXRC::RC_UIFILE },
152 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
153 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
154 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
155 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
156 // compatibility with versions older than 1.4.0 only
157 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
158 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
159 // compatibility with versions older than 1.4.0 only
160 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
161 { "\\user_email", LyXRC::RC_USER_EMAIL },
162 { "\\user_name", LyXRC::RC_USER_NAME },
163 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
164 { "\\viewer" ,LyXRC::RC_VIEWER},
165 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
168 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
179 void LyXRC::setDefaults() {
182 // Get printer from the environment. If fail, use default "",
183 // assuming that everything is set up correctly.
184 printer = GetEnv("PRINTER");
185 print_adapt_output = false;
186 print_command = "dvips";
187 print_evenpage_flag = "-B";
188 print_oddpage_flag = "-A";
189 print_pagerange_flag = "-pp";
190 print_copies_flag = "-c";
191 print_collcopies_flag = "-C";
192 print_reverse_flag = "-r";
193 print_landscape_flag = "-t landscape";
194 print_to_printer = "-P";
195 print_to_file = "-o ";
196 print_file_extension = ".ps";
197 print_paper_flag = "-t";
198 print_paper_dimension_flag = "-T";
199 document_path.erase();
200 tempdir_path = "/tmp";
201 view_dvi_paper_option.erase();
202 default_papersize = PAPER_USLETTER;
203 custom_export_format = "ps";
204 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
205 bibtex_command = "bibtex";
208 // Because a screen typically is wider than a piece of paper:
211 // Default LaTeX font size:
212 font_sizes[LyXFont::SIZE_TINY] = 5.0;
213 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
214 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
215 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
216 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
217 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
218 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
219 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
220 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
221 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
222 use_scalable_fonts = true;
223 roman_font_name = "";
225 typewriter_font_name = "";
226 popup_bold_font = "-*-helvetica-bold-r";
227 popup_normal_font = "-*-helvetica-medium-r";
228 font_norm = "iso8859-1";
229 font_norm_type = ISO_8859_1;
230 popup_font_encoding.erase();
232 auto_region_delete = true;
233 auto_reset_options = false;
236 check_lastfiles = true;
238 backupdir_path.erase();
239 display_graphics = lyx::graphics::ColorDisplay;
240 // Spellchecker settings:
241 use_spell_lib = true;
242 isp_command = "ispell";
243 isp_accept_compound = false;
244 isp_use_input_encoding = false;
245 isp_use_alt_lang = false;
246 isp_use_pers_dict = false;
247 isp_use_esc_chars = false;
251 mark_foreign_language = true;
252 language_auto_begin = true;
253 language_auto_end = true;
254 language_global_options = true;
255 language_use_babel = true;
256 language_package = "\\usepackage{babel}";
257 language_command_begin = "\\selectlanguage{$$lang}";
258 language_command_local = "\\foreignlanguage{$$lang}{";
259 default_language = "english";
263 date_insert_format = "%A, %e %B %Y";
264 cursor_follows_scrollbar = false;
265 dialogs_iconify_with_main = false;
266 label_init_length = 3;
268 preview_hashed_labels = false;
269 preview_scale_factor = 0.9;
271 user_name = lyx::support::user_name();
273 user_email = lyx::support::user_email();
275 if (user_email.empty())
276 user_email = _("email address unknown");
282 void oldFontFormat(string & family, string & foundry)
284 if (family.empty() || family[0] != '-')
286 foundry = token(family, '-', 1);
287 family = token(family, '-', 2);
295 int LyXRC::read(string const & filename)
297 LyXLex lexrc(lyxrcTags, lyxrcCount);
298 if (lyxerr.debugging(Debug::PARSER))
299 lexrc.printTable(lyxerr);
301 lexrc.setFile(filename);
302 if (!lexrc.isOK()) return -2;
304 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
310 int LyXRC::read(std::istream & is)
312 LyXLex lexrc(lyxrcTags, lyxrcCount);
313 if (lyxerr.debugging(Debug::PARSER))
314 lexrc.printTable(lyxerr);
317 if (!lexrc.isOK()) return -2;
319 lyxerr[Debug::LYXRC] << "Reading istream..." << endl;
325 int LyXRC::read(LyXLex & lexrc)
327 if (!lexrc.isOK()) return -2;
329 while (lexrc.isOK()) {
330 // By using two switches we take advantage of the compiler
331 // telling us if we have missed a LyXRCTags element in
332 // the second switch.
333 // Note that this also shows a problem with LyXLex since it
334 // helps us avoid taking advantage of the strictness of the
337 int le = lexrc.lex();
339 case LyXLex::LEX_UNDEF:
340 lexrc.printError("Unknown tag `$$Token'");
342 case LyXLex::LEX_FEOF:
346 switch (static_cast<LyXRCTags>(le)) {
347 case RC_INPUT: // Include file
350 LibFileSearch(string(),
353 lexrc.printError("Error reading "
354 "included file: "+tmp);
358 case RC_BINDFILE: // RVDK_PATCH_5
360 bind_file = lexrc.getString();
366 ui_file = lexrc.getString();
370 case RC_AUTORESET_OPTIONS:
372 auto_reset_options = lexrc.getBool();
376 case RC_DISPLAY_GRAPHICS:
378 display_graphics = lyx::graphics::displayTranslator().find(lexrc.getString());
384 use_kbmap = lexrc.getBool();
388 case RC_KBMAP_PRIMARY:
390 string const kmap(lexrc.getString());
393 } else if (!LibFileSearch("kbd", kmap,
395 primary_kbmap = kmap;
397 lexrc.printError("LyX: Keymap `$$Token' not found");
402 case RC_KBMAP_SECONDARY:
404 string const kmap(lexrc.getString());
407 } else if (!LibFileSearch("kbd", kmap,
409 secondary_kbmap = kmap;
411 lexrc.printError("LyX: Keymap `$$Token' not found");
416 case RC_FONT_ENCODING:
418 fontenc = lexrc.getString();
424 printer = lexrc.getString();
428 case RC_PRINT_COMMAND:
430 print_command = lexrc.getString();
434 case RC_PRINTEVENPAGEFLAG:
436 print_evenpage_flag = lexrc.getString();
440 case RC_PRINTODDPAGEFLAG:
442 print_oddpage_flag = lexrc.getString();
446 case RC_PRINTPAGERANGEFLAG:
448 print_pagerange_flag = lexrc.getString();
452 case RC_PRINTCOPIESFLAG:
454 print_copies_flag = lexrc.getString();
458 case RC_PRINTCOLLCOPIESFLAG:
460 print_collcopies_flag = lexrc.getString();
464 case RC_PRINTREVERSEFLAG:
466 print_reverse_flag = lexrc.getString();
470 case RC_PRINTLANDSCAPEFLAG:
472 print_landscape_flag = lexrc.getString();
476 case RC_PRINTTOPRINTER:
478 print_to_printer = lexrc.getString();
482 case RC_PRINT_ADAPTOUTPUT:
484 print_adapt_output = lexrc.getBool();
490 print_to_file = lexrc.getString();
494 case RC_PRINTFILEEXTENSION:
496 print_file_extension = lexrc.getString();
500 case RC_PRINTEXSTRAOPTIONS:
502 print_extra_options = lexrc.getString();
506 case RC_PRINTSPOOL_COMMAND:
508 print_spool_command = lexrc.getString();
512 case RC_PRINTSPOOL_PRINTERPREFIX:
514 print_spool_printerprefix = lexrc.getString();
518 case RC_PRINTPAPERDIMENSIONFLAG:
520 print_paper_dimension_flag = lexrc.getString();
524 case RC_PRINTPAPERFLAG:
526 print_paper_flag = lexrc.getString();
530 case RC_CUSTOM_EXPORT_COMMAND:
532 custom_export_command = lexrc.getString();
536 case RC_CUSTOM_EXPORT_FORMAT:
538 custom_export_format = lexrc.getString();
542 case RC_DEFAULT_PAPERSIZE:
545 ascii_lowercase(lexrc.getString());
546 if (size == "usletter")
549 else if (size == "legal")
552 else if (size == "executive")
554 PAPER_EXECUTIVEPAPER;
555 else if (size == "a3")
558 else if (size == "a4")
561 else if (size == "a5")
564 else if (size == "b5")
570 case RC_VIEWDVI_PAPEROPTION:
572 view_dvi_paper_option = lexrc.getString();
574 view_dvi_paper_option.erase();
578 case RC_CHKTEX_COMMAND:
580 chktex_command = lexrc.getString();
584 case RC_BIBTEX_COMMAND:
586 bibtex_command = lexrc.getString();
592 dpi = lexrc.getInteger();
598 zoom = lexrc.getInteger();
604 wheel_jump = lexrc.getInteger();
608 case RC_SCREEN_FONT_SIZES:
610 font_sizes[LyXFont::SIZE_TINY] =
614 font_sizes[LyXFont::SIZE_SCRIPT] =
618 font_sizes[LyXFont::SIZE_FOOTNOTE] =
622 font_sizes[LyXFont::SIZE_SMALL] =
626 font_sizes[LyXFont::SIZE_NORMAL] =
630 font_sizes[LyXFont::SIZE_LARGE] =
634 font_sizes[LyXFont::SIZE_LARGER] =
638 font_sizes[LyXFont::SIZE_LARGEST] =
642 font_sizes[LyXFont::SIZE_HUGE] =
646 font_sizes[LyXFont::SIZE_HUGER] =
651 case RC_SCREEN_FONT_SCALABLE:
653 use_scalable_fonts = lexrc.getBool();
659 autosave = lexrc.getInteger();
663 case RC_DOCUMENTPATH:
665 document_path = ExpandPath(lexrc.getString());
669 case RC_TEMPLATEPATH:
671 template_path = ExpandPath(lexrc.getString());
677 tempdir_path = ExpandPath(lexrc.getString());
683 lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
689 lastfiles = ExpandPath(lexrc.getString());
693 case RC_NUMLASTFILES:
695 num_lastfiles = lexrc.getInteger();
699 case RC_CHECKLASTFILES:
701 check_lastfiles = lexrc.getBool();
705 case RC_SCREEN_FONT_ROMAN:
707 roman_font_name = lexrc.getString();
708 oldFontFormat(roman_font_name,
713 case RC_SCREEN_FONT_SANS:
715 sans_font_name = lexrc.getString();
716 oldFontFormat(sans_font_name, sans_font_foundry);
720 case RC_SCREEN_FONT_TYPEWRITER:
722 typewriter_font_name = lexrc.getString();
723 oldFontFormat(typewriter_font_name,
724 typewriter_font_foundry);
728 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
730 roman_font_foundry = lexrc.getString();
734 case RC_SCREEN_FONT_SANS_FOUNDRY:
736 sans_font_foundry = lexrc.getString();
740 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
742 typewriter_font_foundry = lexrc.getString();
746 case RC_SCREEN_FONT_ENCODING:
748 font_norm = lexrc.getString();
749 set_font_norm_type();
753 case RC_POPUP_BOLD_FONT:
755 popup_bold_font = lexrc.getString();
759 case RC_POPUP_NORMAL_FONT:
761 popup_normal_font = lexrc.getString();
765 case RC_POPUP_FONT_ENCODING:
767 popup_font_encoding = lexrc.getString();
773 string lyx_name, x11_name;
776 lyx_name = lexrc.getString();
778 lexrc.printError("Missing color tag.");
783 x11_name = lexrc.getString();
785 lexrc.printError("Missing color name for color: `$$Token'");
789 LColor::color col = lcolor.getFromLyXName(lyx_name);
790 if (!lcolor.setColor(col, x11_name)) {
791 lyxerr << "Bad lyxrc set_color for "
797 case RC_AUTOREGIONDELETE:
798 // Auto region delete defaults to true
800 auto_region_delete = lexrc.getBool();
806 lyxpipes = ExpandPath(lexrc.getString());
810 case RC_CURSOR_FOLLOWS_SCROLLBAR:
812 cursor_follows_scrollbar = lexrc.getBool();
816 case RC_DIALOGS_ICONIFY_WITH_MAIN:
818 dialogs_iconify_with_main = lexrc.getBool();
822 case RC_ASCIIROFF_COMMAND:
824 ascii_roff_command = lexrc.getString();
827 case RC_ASCII_LINELEN:
829 ascii_linelen = lexrc.getInteger();
832 // Spellchecker settings:
833 case RC_USE_SPELL_LIB:
835 use_spell_lib = lexrc.getBool();
838 case RC_SPELL_COMMAND:
840 isp_command = lexrc.getString();
843 case RC_ACCEPT_COMPOUND:
845 isp_accept_compound = lexrc.getBool();
850 isp_use_input_encoding = lexrc.getBool();
853 case RC_USE_ALT_LANG:
855 isp_use_alt_lang = lexrc.getBool();
858 case RC_USE_PERS_DICT:
860 isp_use_pers_dict = lexrc.getBool();
863 case RC_USE_ESC_CHARS:
865 isp_use_esc_chars = lexrc.getBool();
870 isp_alt_lang = lexrc.getString();
875 isp_pers_dict = lexrc.getString();
880 isp_esc_chars = lexrc.getString();
885 make_backup = lexrc.getBool();
888 case RC_BACKUPDIR_PATH:
890 backupdir_path = ExpandPath(lexrc.getString());
893 case RC_DATE_INSERT_FORMAT:
895 date_insert_format = lexrc.getString();
898 case RC_LANGUAGE_PACKAGE:
900 language_package = lexrc.getString();
903 case RC_LANGUAGE_AUTO_BEGIN:
905 language_auto_begin = lexrc.getBool();
908 case RC_LANGUAGE_AUTO_END:
910 language_auto_end = lexrc.getBool();
913 case RC_LANGUAGE_GLOBAL_OPTIONS:
915 language_global_options = lexrc.getBool();
918 case RC_LANGUAGE_USE_BABEL:
920 language_use_babel = lexrc.getBool();
923 case RC_LANGUAGE_COMMAND_BEGIN:
925 language_command_begin = lexrc.getString();
928 case RC_LANGUAGE_COMMAND_END:
930 language_command_end = lexrc.getString();
933 case RC_LANGUAGE_COMMAND_LOCAL:
935 language_command_local = lexrc.getString();
940 rtl_support = lexrc.getBool();
945 auto_number = lexrc.getBool();
948 case RC_MARK_FOREIGN_LANGUAGE:
950 mark_foreign_language = lexrc.getBool();
955 string from, to, command, flags;
957 from = lexrc.getString();
960 to = lexrc.getString();
963 command = lexrc.getString();
966 flags = lexrc.getString();
969 || token(command, ' ', 0) == "none") {
970 converters.erase(from, to);
972 converters.add(from, to, command, flags);
977 string format, command;
979 format = lexrc.getString();
982 command = lexrc.getString();
983 if (token(command, ' ', 0) == "none")
986 formats.setViewer(format, command);
990 string format, extension, prettyname, shortcut;
992 format = lexrc.getString();
995 extension = lexrc.getString();
998 prettyname = lexrc.getString();
1001 shortcut = lexrc.getString();
1003 if (prettyname.empty()) {
1004 if (converters.formatIsUsed(format)) {
1005 lyxerr << "Can't delete format "
1008 formats.erase(format);
1011 formats.add(format, extension, prettyname,
1016 case RC_DEFAULT_LANGUAGE:
1018 default_language = lexrc.getString();
1022 case RC_LABEL_INIT_LENGTH:
1024 label_init_length = lexrc.getInteger();
1028 case RC_SHOW_BANNER:
1030 show_banner = lexrc.getBool();
1036 preview = lexrc.getBool();
1040 case RC_PREVIEW_HASHED_LABELS:
1042 preview_hashed_labels = lexrc.getBool();
1046 case RC_PREVIEW_SCALE_FACTOR:
1048 preview_scale_factor = lexrc.getFloat();
1054 user_name = lexrc.getString();
1059 user_email = lexrc.getString();
1062 case RC_LAST: break; // this is just a dummy
1066 /// Update converters data-structures
1067 converters.update(formats);
1068 converters.buildGraph();
1074 void LyXRC::write(string const & filename, bool ignore_system_lyxrc) const
1076 ofstream ofs(filename.c_str());
1078 write(ofs, ignore_system_lyxrc);
1082 void LyXRC::print() const
1084 if (lyxerr.debugging())
1085 write(lyxerr, false);
1091 void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
1093 os << "### This file is part of\n"
1094 << "### ========================================================\n"
1095 << "### LyX, The Document Processor\n"
1097 << "### Copyright 1995 Matthias Ettrich\n"
1098 << "### Copyright 1995-2001 The LyX Team.\n"
1100 << "### ========================================================\n"
1102 << "# This file is written by LyX, if you want to make your own\n"
1103 << "# modifications you should do them from inside LyX and save\n"
1106 // Why the switch you might ask. It is a trick to ensure that all
1107 // the elements in the LyXRCTags enum is handled. As you can see
1108 // there are no breaks at all. So it is just a huge fall-through.
1109 // The nice thing is that we will get a warning from the compiler
1110 // if we forget an element.
1111 LyXRCTags tag = RC_LAST;
1115 // input/include files are not done here
1117 if (ignore_system_lyxrc ||
1118 bind_file != system_lyxrc.bind_file) {
1119 os << "\\bind_file " << bind_file << "\n";
1125 << "# MISC SECTION ######################################\n"
1128 // bind files are not done here.
1130 if (ignore_system_lyxrc ||
1131 ui_file != system_lyxrc.ui_file) {
1132 os << "\\ui_file \"" << ui_file << "\"\n";
1134 case RC_AUTOREGIONDELETE:
1135 if (ignore_system_lyxrc ||
1136 auto_region_delete != system_lyxrc.auto_region_delete) {
1137 os << "# Set to false to inhibit automatic replacement of\n"
1138 << "# the current selection.\n"
1139 << "\\auto_region_delete " << tostr(auto_region_delete)
1142 case RC_AUTORESET_OPTIONS:
1143 if (ignore_system_lyxrc ||
1144 auto_reset_options != system_lyxrc.auto_reset_options) {
1145 os << "# Set to false to inhibit automatic reset of\n"
1146 << "# the class options to defaults on class change.\n"
1147 << "\\auto_reset_options " << tostr(auto_reset_options)
1151 if (ignore_system_lyxrc ||
1152 autosave != system_lyxrc.autosave) {
1153 os << "# The time interval between auto-saves in seconds.\n"
1154 << "\\autosave " << autosave << '\n';
1156 case RC_DISPLAY_GRAPHICS:
1157 if (ignore_system_lyxrc ||
1158 display_graphics != system_lyxrc.display_graphics) {
1159 os << "# Display graphics within LyX\n"
1160 << "# monochrome|grayscale|color|none\n"
1161 << "\\display_graphics "
1162 << lyx::graphics::displayTranslator().find(display_graphics)
1166 case RC_VIEWDVI_PAPEROPTION:
1167 if (ignore_system_lyxrc ||
1168 view_dvi_paper_option
1169 != system_lyxrc.view_dvi_paper_option) {
1170 os << "# Options used to specify paper size to the\n"
1171 << "# view_dvi_command (e.g. -paper)\n"
1172 << "\\view_dvi_paper_option \""
1173 << view_dvi_paper_option << "\"\n";
1175 case RC_DEFAULT_PAPERSIZE:
1176 if (ignore_system_lyxrc ||
1177 default_papersize != system_lyxrc.default_papersize) {
1178 os << "# The default papersize to use.\n"
1179 << "\\default_papersize \"";
1180 switch (default_papersize) {
1181 case PAPER_USLETTER:
1182 os << "usletter"; break;
1183 case PAPER_LEGALPAPER:
1184 os << "legal"; break;
1185 case PAPER_EXECUTIVEPAPER:
1186 os << "executive"; break;
1195 case PAPER_DEFAULT: break;
1199 case RC_CHKTEX_COMMAND:
1200 if (ignore_system_lyxrc ||
1201 chktex_command != system_lyxrc.chktex_command) {
1202 os << "\\chktex_command \"" << chktex_command << "\"\n";
1204 case RC_BIBTEX_COMMAND:
1205 if (ignore_system_lyxrc ||
1206 bibtex_command != system_lyxrc.bibtex_command) {
1207 os << "\\bibtex_command \"" << bibtex_command << "\"\n";
1210 if (ignore_system_lyxrc ||
1211 use_kbmap != system_lyxrc.use_kbmap) {
1212 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1214 case RC_KBMAP_PRIMARY:
1215 if (ignore_system_lyxrc ||
1216 primary_kbmap != system_lyxrc.primary_kbmap) {
1217 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1219 case RC_KBMAP_SECONDARY:
1220 if (ignore_system_lyxrc ||
1221 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1222 os << "\\kbmap_secondary \"" << secondary_kbmap
1226 if (ignore_system_lyxrc ||
1227 lyxpipes != system_lyxrc.lyxpipes) {
1228 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1230 case RC_DATE_INSERT_FORMAT:
1231 if (ignore_system_lyxrc ||
1232 date_insert_format != system_lyxrc.date_insert_format) {
1233 os << "\\date_insert_format \"" << date_insert_format
1236 case RC_LABEL_INIT_LENGTH:
1237 if (ignore_system_lyxrc ||
1238 label_init_length != system_lyxrc.label_init_length) {
1239 os << "\\label_init_length " << label_init_length
1244 os << "\\user_name \"" << user_name << "\"\n";
1247 os << "\\user_email \"" << user_email << "\"\n";
1249 case RC_SHOW_BANNER:
1250 if (ignore_system_lyxrc ||
1251 show_banner != system_lyxrc.show_banner) {
1252 os << "\\show_banner " << tostr(show_banner) << '\n';
1256 if (ignore_system_lyxrc ||
1257 preview != system_lyxrc.preview) {
1258 os << "\\preview " << tostr(preview) << '\n';
1261 case RC_PREVIEW_HASHED_LABELS:
1262 if (ignore_system_lyxrc ||
1263 preview_hashed_labels !=
1264 system_lyxrc.preview_hashed_labels) {
1265 os << "\\preview_hashed_labels "
1266 << tostr(preview_hashed_labels) << '\n';
1269 case RC_PREVIEW_SCALE_FACTOR:
1270 if (ignore_system_lyxrc ||
1271 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1272 os << "\\preview_scale_factor "
1273 << preview_scale_factor << '\n';
1277 << "# SCREEN & FONTS SECTION ############################\n"
1280 case RC_POPUP_NORMAL_FONT:
1281 if (ignore_system_lyxrc ||
1282 popup_normal_font != system_lyxrc.popup_normal_font) {
1283 os << "\\popup_normal_font \"" << popup_normal_font
1286 case RC_POPUP_BOLD_FONT:
1287 if (ignore_system_lyxrc ||
1288 popup_bold_font != system_lyxrc.popup_bold_font) {
1289 os << "\\popup_bold_font \"" << popup_bold_font
1292 case RC_POPUP_FONT_ENCODING:
1293 if (ignore_system_lyxrc ||
1294 popup_font_encoding != system_lyxrc.popup_font_encoding) {
1295 os << "\\popup_font_encoding \"" << popup_font_encoding
1299 if (ignore_system_lyxrc ||
1300 dpi != system_lyxrc.dpi) {
1301 os << "\\screen_dpi " << dpi << '\n';
1303 case RC_SCREEN_ZOOM:
1304 if (ignore_system_lyxrc ||
1305 zoom != system_lyxrc.zoom) {
1306 os << "\\screen_zoom " << zoom << '\n';
1309 if (ignore_system_lyxrc ||
1310 wheel_jump != system_lyxrc.wheel_jump) {
1311 os << "\\wheel_jump " << wheel_jump << '\n';
1313 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1314 if (ignore_system_lyxrc ||
1315 cursor_follows_scrollbar
1316 != system_lyxrc.cursor_follows_scrollbar) {
1317 os << "\\cursor_follows_scrollbar "
1318 << tostr(cursor_follows_scrollbar) << '\n';
1320 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1321 if (ignore_system_lyxrc ||
1322 dialogs_iconify_with_main
1323 != system_lyxrc.dialogs_iconify_with_main) {
1324 os << "\\dialogs_iconify_with_main "
1325 << tostr(dialogs_iconify_with_main) << '\n';
1327 case RC_SCREEN_FONT_ROMAN:
1328 if (ignore_system_lyxrc ||
1329 roman_font_name != system_lyxrc.roman_font_name) {
1330 os << "\\screen_font_roman \"" << roman_font_name
1333 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1334 if (ignore_system_lyxrc ||
1335 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1336 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1339 case RC_SCREEN_FONT_SANS:
1340 if (ignore_system_lyxrc ||
1341 sans_font_name != system_lyxrc.sans_font_name) {
1342 os << "\\screen_font_sans \"" << sans_font_name
1345 case RC_SCREEN_FONT_SANS_FOUNDRY:
1346 if (ignore_system_lyxrc ||
1347 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1348 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1351 case RC_SCREEN_FONT_TYPEWRITER:
1352 if (ignore_system_lyxrc ||
1353 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1354 os << "\\screen_font_typewriter \""
1355 << typewriter_font_name << "\"\n";
1357 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1358 if (ignore_system_lyxrc ||
1359 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1360 os << "\\screen_font_typewriter_foundry \""
1361 << typewriter_font_foundry << "\"\n";
1364 case RC_SCREEN_FONT_SCALABLE:
1365 if (ignore_system_lyxrc ||
1366 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1367 os << "\\screen_font_scalable "
1368 << tostr(use_scalable_fonts)
1371 case RC_SCREEN_FONT_ENCODING:
1372 if (ignore_system_lyxrc ||
1373 font_norm != system_lyxrc.font_norm) {
1374 os << "\\screen_font_encoding \"" << font_norm
1377 case RC_SCREEN_FONT_SIZES:
1378 if (ignore_system_lyxrc ||
1379 font_sizes[LyXFont::SIZE_TINY]
1380 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1381 font_sizes[LyXFont::SIZE_SCRIPT]
1382 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1383 font_sizes[LyXFont::SIZE_FOOTNOTE]
1384 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1385 font_sizes[LyXFont::SIZE_SMALL]
1386 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1387 font_sizes[LyXFont::SIZE_NORMAL]
1388 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1389 font_sizes[LyXFont::SIZE_LARGE]
1390 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1391 font_sizes[LyXFont::SIZE_LARGER]
1392 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1393 font_sizes[LyXFont::SIZE_LARGEST]
1394 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1395 font_sizes[LyXFont::SIZE_HUGE]
1396 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1397 font_sizes[LyXFont::SIZE_HUGER]
1398 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1399 os.setf(ios::fixed);
1401 os << "\\screen_font_sizes"
1402 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1403 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1404 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1405 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1406 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1407 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1408 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1409 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1410 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1411 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1416 << "# COLOR SECTION ###################################\n"
1420 for (int i = 0; i < LColor::ignore; ++i) {
1421 LColor::color lc = static_cast<LColor::color>(i);
1423 string const col(lcolor.getX11Name(lc));
1424 if (ignore_system_lyxrc ||
1425 col != system_lcolor.getX11Name(lc)) {
1426 os << "\\set_color \""
1427 << lcolor.getLyXName(lc) << "\" \""
1433 << "# PRINTER SECTION ###################################\n"
1437 if (ignore_system_lyxrc ||
1438 printer != system_lyxrc.printer) {
1439 os << "\\printer \"" << printer << "\"\n";
1441 case RC_PRINT_ADAPTOUTPUT:
1442 if (ignore_system_lyxrc ||
1443 print_adapt_output != system_lyxrc.print_adapt_output) {
1444 os << "\\print_adapt_output "
1445 << tostr(print_adapt_output)
1448 case RC_PRINT_COMMAND:
1449 if (ignore_system_lyxrc ||
1450 print_command != system_lyxrc.print_command) {
1451 os << "\\print_command \"" << print_command << "\"\n";
1453 case RC_PRINTEXSTRAOPTIONS:
1454 if (ignore_system_lyxrc ||
1455 print_extra_options != system_lyxrc.print_extra_options) {
1456 os << "\\print_extra_options \"" << print_extra_options
1459 case RC_PRINTSPOOL_COMMAND:
1460 if (ignore_system_lyxrc ||
1461 print_spool_command != system_lyxrc.print_spool_command) {
1462 os << "\\print_spool_command \"" << print_spool_command
1465 case RC_PRINTSPOOL_PRINTERPREFIX:
1466 if (ignore_system_lyxrc ||
1467 print_spool_printerprefix
1468 != system_lyxrc.print_spool_printerprefix) {
1469 os << "\\print_spool_printerprefix \""
1470 << print_spool_printerprefix << "\"\n";
1472 case RC_PRINTEVENPAGEFLAG:
1473 if (ignore_system_lyxrc ||
1474 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1475 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1478 case RC_PRINTODDPAGEFLAG:
1479 if (ignore_system_lyxrc ||
1480 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1481 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1484 case RC_PRINTREVERSEFLAG:
1485 if (ignore_system_lyxrc ||
1486 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1487 os << "\\print_reverse_flag \"" << print_reverse_flag
1490 case RC_PRINTLANDSCAPEFLAG:
1491 if (ignore_system_lyxrc ||
1492 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1493 os << "\\print_landscape_flag \"" << print_landscape_flag
1496 case RC_PRINTPAGERANGEFLAG:
1497 if (ignore_system_lyxrc ||
1498 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1499 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1502 case RC_PRINTCOPIESFLAG:
1503 if (ignore_system_lyxrc ||
1504 print_copies_flag != system_lyxrc.print_copies_flag) {
1505 os << "\\print_copies_flag \"" << print_copies_flag
1508 case RC_PRINTCOLLCOPIESFLAG:
1509 if (ignore_system_lyxrc ||
1510 print_collcopies_flag
1511 != system_lyxrc.print_collcopies_flag) {
1512 os << "\\print_collcopies_flag \""
1513 << print_collcopies_flag
1516 case RC_PRINTPAPERFLAG:
1517 if (ignore_system_lyxrc ||
1518 print_paper_flag != system_lyxrc.print_paper_flag) {
1519 os << "\\print_paper_flag \"" << print_paper_flag
1522 case RC_PRINTPAPERDIMENSIONFLAG:
1523 if (ignore_system_lyxrc ||
1524 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 (ignore_system_lyxrc ||
1531 print_to_printer != system_lyxrc.print_to_printer) {
1532 os << "\\print_to_printer \"" << print_to_printer
1535 case RC_PRINTTOFILE:
1536 if (ignore_system_lyxrc ||
1537 print_to_file != system_lyxrc.print_to_file) {
1538 os << "\\print_to_file \"" << print_to_file << "\"\n";
1540 case RC_PRINTFILEEXTENSION:
1541 if (ignore_system_lyxrc ||
1542 print_file_extension != system_lyxrc.print_file_extension) {
1543 os << "\\print_file_extension \""
1544 << print_file_extension
1549 << "# EXPORT SECTION ####################################\n"
1552 case RC_CUSTOM_EXPORT_COMMAND:
1553 if (ignore_system_lyxrc ||
1554 custom_export_command
1555 != system_lyxrc.custom_export_command) {
1556 os << "\\custom_export_command \""
1557 << custom_export_command
1560 case RC_CUSTOM_EXPORT_FORMAT:
1561 if (ignore_system_lyxrc ||
1562 custom_export_format
1563 != system_lyxrc.custom_export_format) {
1564 os << "\\custom_export_format \"" << custom_export_format
1569 << "# TEX SECTION #######################################\n"
1572 case RC_FONT_ENCODING:
1573 if (ignore_system_lyxrc ||
1574 fontenc != system_lyxrc.fontenc) {
1575 os << "\\font_encoding \"" << fontenc << "\"\n";
1579 << "# FILE SECTION ######################################\n"
1582 case RC_DOCUMENTPATH:
1583 if (ignore_system_lyxrc ||
1584 document_path != system_lyxrc.document_path) {
1585 os << "\\document_path \"" << document_path << "\"\n";
1588 if (ignore_system_lyxrc ||
1589 lastfiles != system_lyxrc.lastfiles) {
1590 os << "\\lastfiles \"" << lastfiles << "\"\n";
1592 case RC_NUMLASTFILES:
1593 if (ignore_system_lyxrc ||
1594 num_lastfiles != system_lyxrc.num_lastfiles) {
1595 os << "\\num_lastfiles " << num_lastfiles << '\n';
1597 case RC_CHECKLASTFILES:
1598 if (ignore_system_lyxrc ||
1599 check_lastfiles != system_lyxrc.check_lastfiles) {
1600 os << "\\check_lastfiles " << tostr(check_lastfiles)
1603 case RC_TEMPLATEPATH:
1604 if (ignore_system_lyxrc ||
1605 template_path != system_lyxrc.template_path) {
1606 os << "\\template_path \"" << template_path << "\"\n";
1608 case RC_TEMPDIRPATH:
1609 if (ignore_system_lyxrc ||
1610 tempdir_path != system_lyxrc.tempdir_path) {
1611 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1615 case RC_ASCII_LINELEN:
1616 if (ignore_system_lyxrc ||
1617 ascii_linelen != system_lyxrc.ascii_linelen) {
1618 os << "\\ascii_linelen " << ascii_linelen << '\n';
1620 case RC_MAKE_BACKUP:
1621 if (ignore_system_lyxrc ||
1622 make_backup != system_lyxrc.make_backup) {
1623 os << "\\make_backup " << tostr(make_backup) << '\n';
1625 case RC_BACKUPDIR_PATH:
1626 if (ignore_system_lyxrc ||
1627 backupdir_path != system_lyxrc.backupdir_path) {
1628 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1632 << "# ASCII EXPORT SECTION ##############################\n"
1635 case RC_ASCIIROFF_COMMAND:
1636 if (ignore_system_lyxrc ||
1637 ascii_roff_command != system_lyxrc.ascii_roff_command) {
1638 os << "\\ascii_roff_command \"" << ascii_roff_command
1643 << "# SPELLCHECKER SECTION ##############################\n"
1645 case RC_USE_SPELL_LIB:
1646 if (ignore_system_lyxrc ||
1647 use_spell_lib != system_lyxrc.use_spell_lib) {
1648 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1650 case RC_SPELL_COMMAND:
1651 if (ignore_system_lyxrc ||
1652 isp_command != system_lyxrc.isp_command) {
1653 os << "\\spell_command \"" << isp_command << "\"\n";
1655 case RC_ACCEPT_COMPOUND:
1656 if (ignore_system_lyxrc ||
1657 isp_accept_compound != system_lyxrc.isp_accept_compound) {
1658 os << "\\accept_compound " << tostr(isp_accept_compound)
1661 case RC_USE_ALT_LANG:
1662 if (ignore_system_lyxrc ||
1663 isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1664 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1668 if (ignore_system_lyxrc ||
1669 isp_alt_lang != system_lyxrc.isp_alt_lang) {
1670 os << "\\alternate_language \"" << isp_alt_lang
1673 case RC_USE_ESC_CHARS:
1674 if (ignore_system_lyxrc ||
1675 isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1676 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1680 if (ignore_system_lyxrc ||
1681 isp_esc_chars != system_lyxrc.isp_esc_chars) {
1682 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1684 case RC_USE_PERS_DICT:
1685 if (ignore_system_lyxrc ||
1686 isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1687 os << "\\use_personal_dictionary "
1688 << tostr(isp_use_pers_dict)
1692 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1693 os << "\\personal_dictionary \"" << isp_pers_dict
1696 case RC_USE_INP_ENC:
1697 if (ignore_system_lyxrc ||
1698 isp_use_input_encoding
1699 != system_lyxrc.isp_use_input_encoding) {
1700 os << "\\use_input_encoding "
1701 << tostr(isp_use_input_encoding)
1706 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1709 case RC_RTL_SUPPORT:
1710 if (ignore_system_lyxrc ||
1711 rtl_support != system_lyxrc.rtl_support) {
1712 os << "\\rtl " << tostr(rtl_support) << '\n';
1714 case RC_LANGUAGE_PACKAGE:
1715 if (ignore_system_lyxrc ||
1716 language_package != system_lyxrc.language_package) {
1717 os << "\\language_package \"" << language_package
1720 case RC_LANGUAGE_GLOBAL_OPTIONS:
1721 if (ignore_system_lyxrc ||
1722 language_global_options
1723 != system_lyxrc.language_global_options) {
1724 os << "\\language_global_options \""
1725 << tostr(language_global_options)
1728 case RC_LANGUAGE_USE_BABEL:
1729 if (ignore_system_lyxrc ||
1730 language_use_babel != system_lyxrc.language_use_babel) {
1731 os << "\\language_use_babel \""
1732 << tostr(language_use_babel)
1735 case RC_LANGUAGE_COMMAND_BEGIN:
1736 if (ignore_system_lyxrc ||
1737 language_command_begin
1738 != system_lyxrc.language_command_begin) {
1739 os << "\\language_command_begin \""
1740 << language_command_begin
1743 case RC_LANGUAGE_COMMAND_END:
1744 if (ignore_system_lyxrc ||
1745 language_command_end
1746 != system_lyxrc.language_command_end) {
1747 os << "\\language_command_end \"" << language_command_end
1750 case RC_LANGUAGE_COMMAND_LOCAL:
1751 if (ignore_system_lyxrc ||
1752 language_command_local
1753 != system_lyxrc.language_command_local) {
1754 os << "\\language_command_local \""
1755 << language_command_local
1758 case RC_LANGUAGE_AUTO_BEGIN:
1759 if (ignore_system_lyxrc ||
1760 language_auto_begin != system_lyxrc.language_auto_begin) {
1761 os << "\\language_auto_begin "
1762 << tostr(language_auto_begin) << '\n';
1764 case RC_LANGUAGE_AUTO_END:
1765 if (ignore_system_lyxrc ||
1766 language_auto_end != system_lyxrc.language_auto_end) {
1767 os << "\\language_auto_end "
1768 << tostr(language_auto_end) << '\n';
1770 case RC_MARK_FOREIGN_LANGUAGE:
1771 if (ignore_system_lyxrc ||
1772 mark_foreign_language
1773 != system_lyxrc.mark_foreign_language) {
1774 os << "\\mark_foreign_language " <<
1775 tostr(mark_foreign_language) << '\n';
1779 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1782 case RC_AUTO_NUMBER:
1783 if (ignore_system_lyxrc ||
1784 auto_number != system_lyxrc.auto_number) {
1785 os << "\\auto_number " << tostr(auto_number) << '\n';
1787 case RC_DEFAULT_LANGUAGE:
1788 if (ignore_system_lyxrc ||
1789 default_language != system_lyxrc.default_language) {
1790 os << "\\default_language " << default_language << '\n';
1794 << "# FORMATS SECTION ##########################\n"
1798 // Look for deleted formats
1799 for (Formats::const_iterator cit = formats.begin();
1800 cit != formats.end(); ++cit) {
1801 Format const * format =
1802 system_formats.getFormat(cit->name());
1804 format->extension() != cit->extension() ||
1805 format->prettyname() != cit->prettyname() ||
1806 format->shortcut() != cit->shortcut())
1807 os << "\\format \"" << cit->name() << "\" \""
1808 << cit->extension() << "\" \""
1809 << cit->prettyname() << "\" \""
1810 << cit->shortcut() << "\"\n";
1813 // New/modifed formats
1814 for (Formats::const_iterator cit = system_formats.begin();
1815 cit != system_formats.end(); ++cit)
1816 if (!formats.getFormat(cit->name()))
1817 os << "\\format \"" << cit->name()
1818 << "\" \"\" \"\" \"\"\n";
1820 for (Formats::const_iterator cit = formats.begin();
1821 cit != formats.end(); ++cit) {
1822 Format const * format =
1823 system_formats.getFormat(cit->name());
1824 if ((!format || format->viewer() != cit->viewer()) &&
1825 (format || !cit->viewer().empty()))
1826 os << "\\viewer \"" << cit->name() << "\" \""
1827 << cit->viewer() << "\"\n";
1831 << "# CONVERTERS SECTION ##########################\n"
1835 // Look for new converters
1836 for (Converters::const_iterator cit = converters.begin();
1837 cit != converters.end(); ++cit) {
1838 Converter const * converter =
1839 system_converters.getConverter(cit->from,
1842 converter->command != cit->command ||
1843 converter->flags != cit->flags)
1844 os << "\\converter \"" << cit->from << "\" \""
1845 << cit->to << "\" \""
1846 << cit->command << "\" \""
1847 << cit->flags << "\"\n";
1850 // New/modifed converters
1851 for (Converters::const_iterator cit = system_converters.begin();
1852 cit != system_converters.end(); ++cit)
1853 if (!converters.getConverter(cit->from, cit->to))
1854 os << "\\converter \"" << cit->from
1855 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1861 void LyXRC::set_font_norm_type()
1863 if (font_norm == "iso10646-1")
1864 font_norm_type = ISO_10646_1;
1865 else if (font_norm == "iso8859-1")
1866 font_norm_type = ISO_8859_1;
1867 else if (font_norm == "iso8859-3")
1868 font_norm_type = ISO_8859_3;
1869 else if (font_norm == "iso8859-4")
1870 font_norm_type = ISO_8859_4;
1871 else if (font_norm == "iso8859-6.8x")
1872 font_norm_type = ISO_8859_6_8;
1873 else if (font_norm == "iso8859-9")
1874 font_norm_type = ISO_8859_9;
1875 else if (font_norm == "iso8859-15")
1876 font_norm_type = ISO_8859_15;
1878 font_norm_type = OTHER_ENCODING;
1882 string const LyXRC::getDescription(LyXRCTags tag)
1887 case RC_FONT_ENCODING:
1888 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1892 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1895 case RC_PRINT_COMMAND:
1896 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1899 case RC_PRINTEVENPAGEFLAG:
1900 str = _("The option to print only even pages.");
1903 case RC_PRINTODDPAGEFLAG:
1904 str = _("The option to print only odd pages.");
1907 case RC_PRINTPAGERANGEFLAG:
1908 str = _("The option for specifying a comma-separated list of pages to print.");
1911 case RC_PRINTCOPIESFLAG:
1912 str = _("The option for specifying the number of copies to print.");
1915 case RC_PRINTCOLLCOPIESFLAG:
1916 str = _("The option for specifying whether the copies should be collated.");
1919 case RC_PRINTREVERSEFLAG:
1920 str = _("The option to reverse the order of the pages printed.");
1923 case RC_PRINTLANDSCAPEFLAG:
1924 str = _("The option to print out in landscape.");
1927 case RC_PRINTPAPERFLAG:
1928 str = _("The option to specify paper type.");
1931 case RC_PRINTPAPERDIMENSIONFLAG:
1932 str = _("Option to specify the dimensions of the print paper.");
1935 case RC_PRINTTOPRINTER:
1936 str = _("Option to pass to the print program to print on a specific printer.");
1939 case RC_PRINT_ADAPTOUTPUT:
1940 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1943 case RC_PRINTTOFILE:
1944 str = _("Option to pass to the print program to print to a file.");
1947 case RC_PRINTFILEEXTENSION:
1948 str = _("Extension of printer program output file. Usually \".ps\".");
1951 case RC_PRINTEXSTRAOPTIONS:
1952 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1955 case RC_PRINTSPOOL_COMMAND:
1956 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.");
1959 case RC_PRINTSPOOL_PRINTERPREFIX:
1960 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.");
1964 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1967 case RC_SCREEN_ZOOM:
1968 //xgettext:no-c-format
1969 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1972 case RC_SCREEN_FONT_SIZES:
1973 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1976 case RC_SCREEN_FONT_ROMAN:
1977 case RC_SCREEN_FONT_SANS:
1978 case RC_SCREEN_FONT_TYPEWRITER:
1979 str = _("The screen fonts used to display the text while editing.");
1982 case RC_POPUP_BOLD_FONT:
1983 str = _("The bold font in the dialogs.");
1986 case RC_POPUP_NORMAL_FONT:
1987 str = _("The normal font in the dialogs.");
1990 case RC_SCREEN_FONT_ENCODING:
1991 str = _("The encoding for the screen fonts.");
1994 case RC_POPUP_FONT_ENCODING:
1995 str = _("The encoding for the menu/popups fonts.");
2002 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2005 case RC_DOCUMENTPATH:
2006 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2009 case RC_TEMPLATEPATH:
2010 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2013 case RC_TEMPDIRPATH:
2014 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2018 str = _("The file where the last-files information should be stored.");
2021 case RC_AUTOREGIONDELETE:
2022 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2025 case RC_AUTORESET_OPTIONS:
2026 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2030 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2034 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2038 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2042 case RC_KBMAP_PRIMARY:
2043 case RC_KBMAP_SECONDARY:
2044 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.");
2047 case RC_ASCIIROFF_COMMAND:
2048 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.");
2051 case RC_ASCII_LINELEN:
2052 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2055 case RC_NUMLASTFILES:
2056 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
2059 case RC_CHECKLASTFILES:
2060 str = _("Select to check whether the lastfiles still exist.");
2063 case RC_VIEWDVI_PAPEROPTION:
2064 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2067 case RC_DEFAULT_PAPERSIZE:
2068 str = _("Specify the default paper size.");
2071 case RC_ACCEPT_COMPOUND:
2072 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2075 case RC_SPELL_COMMAND:
2076 str = _("What command runs the spell checker?");
2079 case RC_USE_INP_ENC:
2080 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.");
2083 case RC_USE_ALT_LANG:
2085 str = _("Specify an alternate language. The default is to use the language of the document.");
2088 case RC_USE_PERS_DICT:
2090 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2093 case RC_USE_ESC_CHARS:
2095 str = _("Specify additional chars that can be part of a word.");
2098 case RC_SCREEN_FONT_SCALABLE:
2099 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.");
2102 case RC_CHKTEX_COMMAND:
2103 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2106 case RC_BIBTEX_COMMAND:
2107 str = _("Define the options of bibtex (cf. man bibtex) or select and alternative compiler (e.g. mlbibtex or bibulus).");
2110 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2111 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.");
2114 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2115 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2118 case RC_DISPLAY_GRAPHICS:
2119 str = _("Select how LyX will display any graphics.");
2122 case RC_MAKE_BACKUP:
2123 str = _("De-select if you don't want LyX to create backup files.");
2126 case RC_BACKUPDIR_PATH:
2127 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.");
2130 case RC_RTL_SUPPORT:
2131 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2134 case RC_MARK_FOREIGN_LANGUAGE:
2135 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2138 case RC_LANGUAGE_PACKAGE:
2139 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2142 case RC_LANGUAGE_GLOBAL_OPTIONS:
2143 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2146 case RC_LANGUAGE_USE_BABEL:
2147 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2150 case RC_LANGUAGE_AUTO_BEGIN:
2151 str = _("Select if a language switching command is needed at the beginning of the document.");
2154 case RC_LANGUAGE_AUTO_END:
2155 str = _("Select if a language switching command is needed at the end of the document.");
2158 case RC_LANGUAGE_COMMAND_BEGIN:
2159 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.");
2162 case RC_LANGUAGE_COMMAND_END:
2163 str = _("The LaTeX command for changing back to the language of the document.");
2166 case RC_LANGUAGE_COMMAND_LOCAL:
2167 str = _("The LaTeX command for local changing of the language.");
2170 case RC_DATE_INSERT_FORMAT:
2171 //xgettext:no-c-format
2172 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2175 case RC_SHOW_BANNER:
2176 str = _("De-select if you don't want the startup banner.");
2180 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2192 case RC_DEFAULT_LANGUAGE:
2193 str = _("New documents will be assigned this language.");
2196 case RC_LABEL_INIT_LENGTH:
2197 str = _("Maximum number of words in the initialization string for a new label");
2201 str = _("Shows a typeset preview of things such as math");
2204 case RC_PREVIEW_HASHED_LABELS:
2205 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2208 case RC_PREVIEW_SCALE_FACTOR:
2209 str = _("Scale the preview size to suit.");
2219 // The global instance
2222 // The global copy of the system lyxrc entries (everything except preferences)