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 "converter.h"
26 #include "support/path.h"
27 #include "support/tostr.h"
28 #include "support/filetools.h"
29 #include "support/LAssert.h"
30 #include "support/lstrings.h"
31 #include "support/userinfo.h"
32 #include "support/translator.h"
34 using namespace lyx::support;
45 /// The translator between the DisplayType and the corresponding lyx string.
46 extern Translator<DisplayType, string> displayTranslator;
52 // when adding something to this array keep it sorted!
53 keyword_item lyxrcTags[] = {
54 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
55 { "\\alternate_language", LyXRC::RC_ALT_LANG },
56 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
57 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
58 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
59 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
60 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
61 { "\\autosave", LyXRC::RC_AUTOSAVE },
62 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
63 { "\\bind_file", LyXRC::RC_BINDFILE },
64 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
65 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
66 { "\\converter", LyXRC::RC_CONVERTER },
67 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
68 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
69 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
70 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
71 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
72 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
73 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
74 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
75 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
76 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
77 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
78 { "\\format", LyXRC::RC_FORMAT },
79 { "\\input", LyXRC::RC_INPUT },
80 { "\\kbmap", LyXRC::RC_KBMAP },
81 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
82 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
83 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
84 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
85 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
86 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
87 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
88 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
89 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
90 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
91 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
92 { "\\lastfiles", LyXRC::RC_LASTFILES },
93 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
94 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
95 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
96 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
97 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
98 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
99 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
100 { "\\preview", LyXRC::RC_PREVIEW },
101 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
102 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
103 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
104 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
105 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
106 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
107 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
108 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
109 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
110 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
111 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
112 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
113 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
114 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
115 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
116 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
117 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
118 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
119 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
120 { "\\printer", LyXRC::RC_PRINTER },
121 { "\\ps_command", LyXRC::RC_PS_COMMAND },
122 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
123 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
124 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
125 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
126 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
127 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
128 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
129 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
130 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
131 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
132 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
133 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
134 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
135 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
136 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
137 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
138 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
139 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
140 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
141 { "\\set_color", LyXRC::RC_SET_COLOR },
142 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
143 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
144 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
145 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
146 { "\\ui_file", LyXRC::RC_UIFILE },
147 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
148 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
149 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
150 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
151 // compatibility with versions older than 1.4.0 only
152 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
153 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
154 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
155 { "\\user_email", LyXRC::RC_USER_EMAIL },
156 { "\\user_name", LyXRC::RC_USER_NAME },
157 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
158 { "\\viewer" ,LyXRC::RC_VIEWER},
159 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
162 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
173 void LyXRC::setDefaults() {
176 // Get printer from the environment. If fail, use default "",
177 // assuming that everything is set up correctly.
178 printer = GetEnv("PRINTER");
179 print_adapt_output = false;
180 print_command = "dvips";
181 print_evenpage_flag = "-B";
182 print_oddpage_flag = "-A";
183 print_pagerange_flag = "-pp";
184 print_copies_flag = "-c";
185 print_collcopies_flag = "-C";
186 print_reverse_flag = "-r";
187 print_landscape_flag = "-t landscape";
188 print_to_printer = "-P";
189 print_to_file = "-o ";
190 print_file_extension = ".ps";
191 print_paper_flag = "-t";
192 print_paper_dimension_flag = "-T";
193 document_path.erase();
194 tempdir_path = "/tmp";
197 view_dvi_paper_option.erase();
198 default_papersize = PAPER_USLETTER;
199 custom_export_format = "ps";
200 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
203 // Because a screen typically is wider than a piece of paper:
206 // Default LaTeX font size:
207 font_sizes[LyXFont::SIZE_TINY] = 5.0;
208 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
209 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
210 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
211 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
212 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
213 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
214 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
215 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
216 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
217 use_scalable_fonts = true;
218 roman_font_name = "";
220 typewriter_font_name = "";
221 popup_bold_font = "-*-helvetica-bold-r";
222 popup_normal_font = "-*-helvetica-medium-r";
223 font_norm = "iso8859-1";
224 font_norm_type = ISO_8859_1;
225 popup_font_encoding.erase();
227 auto_region_delete = true;
228 auto_reset_options = false;
231 check_lastfiles = true;
233 backupdir_path.erase();
234 display_graphics = lyx::graphics::ColorDisplay;
235 // Spellchecker settings:
236 use_spell_lib = true;
237 isp_command = "ispell";
238 isp_accept_compound = false;
239 isp_use_input_encoding = false;
240 isp_use_alt_lang = false;
241 isp_use_pers_dict = false;
242 isp_use_esc_chars = false;
246 mark_foreign_language = true;
247 language_auto_begin = true;
248 language_auto_end = true;
249 language_global_options = true;
250 language_use_babel = true;
251 language_package = "\\usepackage{babel}";
252 language_command_begin = "\\selectlanguage{$$lang}";
253 language_command_local = "\\foreignlanguage{$$lang}{";
254 default_language = "english";
258 date_insert_format = "%A, %e %B %Y";
259 cursor_follows_scrollbar = false;
260 dialogs_iconify_with_main = false;
261 label_init_length = 3;
263 preview_hashed_labels = false;
264 preview_scale_factor = 0.9;
266 user_name = lyx::support::user_name();
268 user_email = lyx::support::user_email();
270 if (user_email.empty())
271 user_email = _("email address unknown");
277 void oldFontFormat(string & family, string & foundry)
279 if (family.empty() || family[0] != '-')
281 foundry = token(family, '-', 1);
282 family = token(family, '-', 2);
290 int LyXRC::read(string const & filename)
292 LyXLex lexrc(lyxrcTags, lyxrcCount);
293 if (lyxerr.debugging(Debug::PARSER))
294 lexrc.printTable(lyxerr);
296 lexrc.setFile(filename);
297 if (!lexrc.isOK()) return -2;
299 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
301 while (lexrc.isOK()) {
302 // By using two switches we take advantage of the compiler
303 // telling us if we have missed a LyXRCTags element in
304 // the second switch.
305 // Note that this also shows a problem with LyXLex since it
306 // helps us avoid taking advantage of the strictness of the
309 int le = lexrc.lex();
311 case LyXLex::LEX_UNDEF:
312 lexrc.printError("Unknown tag `$$Token'");
314 case LyXLex::LEX_FEOF:
318 switch (static_cast<LyXRCTags>(le)) {
319 case RC_INPUT: // Include file
322 LibFileSearch(string(),
325 lexrc.printError("Error reading "
326 "included file: "+tmp);
330 case RC_BINDFILE: // RVDK_PATCH_5
332 bind_file = lexrc.getString();
338 ui_file = lexrc.getString();
342 case RC_AUTORESET_OPTIONS:
344 auto_reset_options = lexrc.getBool();
348 case RC_DISPLAY_GRAPHICS:
350 display_graphics = lyx::graphics::displayTranslator.find(lexrc.getString());
356 use_kbmap = lexrc.getBool();
360 case RC_KBMAP_PRIMARY:
362 string const kmap(lexrc.getString());
365 } else if (!LibFileSearch("kbd", kmap,
367 primary_kbmap = kmap;
369 lexrc.printError("LyX: Keymap `$$Token' not found");
374 case RC_KBMAP_SECONDARY:
376 string const kmap(lexrc.getString());
379 } else if (!LibFileSearch("kbd", kmap,
381 secondary_kbmap = kmap;
383 lexrc.printError("LyX: Keymap `$$Token' not found");
388 case RC_FONT_ENCODING:
390 fontenc = lexrc.getString();
396 printer = lexrc.getString();
400 case RC_PRINT_COMMAND:
402 print_command = lexrc.getString();
406 case RC_PRINTEVENPAGEFLAG:
408 print_evenpage_flag = lexrc.getString();
412 case RC_PRINTODDPAGEFLAG:
414 print_oddpage_flag = lexrc.getString();
418 case RC_PRINTPAGERANGEFLAG:
420 print_pagerange_flag = lexrc.getString();
424 case RC_PRINTCOPIESFLAG:
426 print_copies_flag = lexrc.getString();
430 case RC_PRINTCOLLCOPIESFLAG:
432 print_collcopies_flag = lexrc.getString();
436 case RC_PRINTREVERSEFLAG:
438 print_reverse_flag = lexrc.getString();
442 case RC_PRINTLANDSCAPEFLAG:
444 print_landscape_flag = lexrc.getString();
448 case RC_PRINTTOPRINTER:
450 print_to_printer = lexrc.getString();
454 case RC_PRINT_ADAPTOUTPUT:
456 print_adapt_output = lexrc.getBool();
462 print_to_file = lexrc.getString();
466 case RC_PRINTFILEEXTENSION:
468 print_file_extension = lexrc.getString();
472 case RC_PRINTEXSTRAOPTIONS:
474 print_extra_options = lexrc.getString();
478 case RC_PRINTSPOOL_COMMAND:
480 print_spool_command = lexrc.getString();
484 case RC_PRINTSPOOL_PRINTERPREFIX:
486 print_spool_printerprefix = lexrc.getString();
490 case RC_PRINTPAPERDIMENSIONFLAG:
492 print_paper_dimension_flag = lexrc.getString();
496 case RC_PRINTPAPERFLAG:
498 print_paper_flag = lexrc.getString();
502 case RC_CUSTOM_EXPORT_COMMAND:
504 custom_export_command = lexrc.getString();
508 case RC_CUSTOM_EXPORT_FORMAT:
510 custom_export_format = lexrc.getString();
514 case RC_DEFAULT_PAPERSIZE:
517 ascii_lowercase(lexrc.getString());
518 if (size == "usletter")
521 else if (size == "legal")
524 else if (size == "executive")
526 PAPER_EXECUTIVEPAPER;
527 else if (size == "a3")
530 else if (size == "a4")
533 else if (size == "a5")
536 else if (size == "b5")
542 case RC_VIEWDVI_PAPEROPTION:
544 view_dvi_paper_option = lexrc.getString();
546 view_dvi_paper_option.erase();
552 ps_command = lexrc.getString();
556 case RC_CHKTEX_COMMAND:
558 chktex_command = lexrc.getString();
564 dpi = lexrc.getInteger();
570 zoom = lexrc.getInteger();
576 wheel_jump = lexrc.getInteger();
580 case RC_SCREEN_FONT_SIZES:
582 font_sizes[LyXFont::SIZE_TINY] =
586 font_sizes[LyXFont::SIZE_SCRIPT] =
590 font_sizes[LyXFont::SIZE_FOOTNOTE] =
594 font_sizes[LyXFont::SIZE_SMALL] =
598 font_sizes[LyXFont::SIZE_NORMAL] =
602 font_sizes[LyXFont::SIZE_LARGE] =
606 font_sizes[LyXFont::SIZE_LARGER] =
610 font_sizes[LyXFont::SIZE_LARGEST] =
614 font_sizes[LyXFont::SIZE_HUGE] =
618 font_sizes[LyXFont::SIZE_HUGER] =
623 case RC_SCREEN_FONT_SCALABLE:
625 use_scalable_fonts = lexrc.getBool();
631 autosave = lexrc.getInteger();
635 case RC_DOCUMENTPATH:
637 document_path = ExpandPath(lexrc.getString());
641 case RC_TEMPLATEPATH:
643 template_path = ExpandPath(lexrc.getString());
649 tempdir_path = ExpandPath(lexrc.getString());
655 use_tempdir = lexrc.getBool();
661 lastfiles = ExpandPath(lexrc.getString());
665 case RC_NUMLASTFILES:
667 num_lastfiles = lexrc.getInteger();
671 case RC_CHECKLASTFILES:
673 check_lastfiles = lexrc.getBool();
677 case RC_SCREEN_FONT_ROMAN:
679 roman_font_name = lexrc.getString();
680 oldFontFormat(roman_font_name,
685 case RC_SCREEN_FONT_SANS:
687 sans_font_name = lexrc.getString();
688 oldFontFormat(sans_font_name, sans_font_foundry);
692 case RC_SCREEN_FONT_TYPEWRITER:
694 typewriter_font_name = lexrc.getString();
695 oldFontFormat(typewriter_font_name,
696 typewriter_font_foundry);
700 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
702 roman_font_foundry = lexrc.getString();
706 case RC_SCREEN_FONT_SANS_FOUNDRY:
708 sans_font_foundry = lexrc.getString();
712 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
714 typewriter_font_foundry = lexrc.getString();
718 case RC_SCREEN_FONT_ENCODING:
720 font_norm = lexrc.getString();
721 set_font_norm_type();
725 case RC_POPUP_BOLD_FONT:
727 popup_bold_font = lexrc.getString();
731 case RC_POPUP_NORMAL_FONT:
733 popup_normal_font = lexrc.getString();
737 case RC_POPUP_FONT_ENCODING:
739 popup_font_encoding = lexrc.getString();
745 string lyx_name, x11_name;
748 lyx_name = lexrc.getString();
750 lexrc.printError("Missing color tag.");
755 x11_name = lexrc.getString();
757 lexrc.printError("Missing color name for color: `$$Token'");
761 if (!lcolor.setColor(lyx_name, x11_name)) {
762 lyxerr << "Bad lyxrc set_color for "
768 case RC_AUTOREGIONDELETE:
769 // Auto region delete defaults to true
771 auto_region_delete = lexrc.getBool();
777 lyxpipes = ExpandPath(lexrc.getString());
781 case RC_CURSOR_FOLLOWS_SCROLLBAR:
783 cursor_follows_scrollbar = lexrc.getBool();
787 case RC_DIALOGS_ICONIFY_WITH_MAIN:
789 dialogs_iconify_with_main = lexrc.getBool();
793 case RC_ASCIIROFF_COMMAND:
795 ascii_roff_command = lexrc.getString();
798 case RC_ASCII_LINELEN:
800 ascii_linelen = lexrc.getInteger();
803 // Spellchecker settings:
804 case RC_USE_SPELL_LIB:
806 use_spell_lib = lexrc.getBool();
809 case RC_SPELL_COMMAND:
811 isp_command = lexrc.getString();
814 case RC_ACCEPT_COMPOUND:
816 isp_accept_compound = lexrc.getBool();
821 isp_use_input_encoding = lexrc.getBool();
824 case RC_USE_ALT_LANG:
826 isp_use_alt_lang = lexrc.getBool();
829 case RC_USE_PERS_DICT:
831 isp_use_pers_dict = lexrc.getBool();
834 case RC_USE_ESC_CHARS:
836 isp_use_esc_chars = lexrc.getBool();
841 isp_alt_lang = lexrc.getString();
846 isp_pers_dict = lexrc.getString();
851 isp_esc_chars = lexrc.getString();
856 make_backup = lexrc.getBool();
859 case RC_BACKUPDIR_PATH:
861 backupdir_path = ExpandPath(lexrc.getString());
864 case RC_DATE_INSERT_FORMAT:
866 date_insert_format = lexrc.getString();
869 case RC_LANGUAGE_PACKAGE:
871 language_package = lexrc.getString();
874 case RC_LANGUAGE_AUTO_BEGIN:
876 language_auto_begin = lexrc.getBool();
879 case RC_LANGUAGE_AUTO_END:
881 language_auto_end = lexrc.getBool();
884 case RC_LANGUAGE_GLOBAL_OPTIONS:
886 language_global_options = lexrc.getBool();
889 case RC_LANGUAGE_USE_BABEL:
891 language_use_babel = lexrc.getBool();
894 case RC_LANGUAGE_COMMAND_BEGIN:
896 language_command_begin = lexrc.getString();
899 case RC_LANGUAGE_COMMAND_END:
901 language_command_end = lexrc.getString();
904 case RC_LANGUAGE_COMMAND_LOCAL:
906 language_command_local = lexrc.getString();
911 rtl_support = lexrc.getBool();
916 auto_number = lexrc.getBool();
919 case RC_MARK_FOREIGN_LANGUAGE:
921 mark_foreign_language = lexrc.getBool();
926 string from, to, command, flags;
928 from = lexrc.getString();
931 to = lexrc.getString();
934 command = lexrc.getString();
937 flags = lexrc.getString();
940 || token(command, ' ', 0) == "none") {
941 converters.erase(from, to);
943 converters.add(from, to, command, flags);
948 string format, command;
950 format = lexrc.getString();
953 command = lexrc.getString();
954 if (token(command, ' ', 0) == "none")
957 formats.setViewer(format, command);
961 string format, extension, prettyname, shortcut;
963 format = lexrc.getString();
966 extension = lexrc.getString();
969 prettyname = lexrc.getString();
972 shortcut = lexrc.getString();
974 if (prettyname.empty()) {
975 if (converters.formatIsUsed(format)) {
976 lyxerr << "Can't delete format "
979 formats.erase(format);
982 formats.add(format, extension, prettyname,
987 case RC_DEFAULT_LANGUAGE:
989 default_language = lexrc.getString();
993 case RC_LABEL_INIT_LENGTH:
995 label_init_length = lexrc.getInteger();
1001 show_banner = lexrc.getBool();
1007 preview = lexrc.getBool();
1011 case RC_PREVIEW_HASHED_LABELS:
1013 preview_hashed_labels = lexrc.getBool();
1017 case RC_PREVIEW_SCALE_FACTOR:
1019 preview_scale_factor = lexrc.getFloat();
1025 user_name = lexrc.getString();
1030 user_email = lexrc.getString();
1033 case RC_LAST: break; // this is just a dummy
1037 /// Update converters data-structures
1038 converters.update(formats);
1039 converters.buildGraph();
1045 void LyXRC::write(string const & filename) const
1047 ofstream ofs(filename.c_str());
1053 void LyXRC::print() const
1055 if (lyxerr.debugging())
1062 void LyXRC::output(ostream & os) const
1064 os << "### This file is part of\n"
1065 << "### ========================================================\n"
1066 << "### LyX, The Document Processor\n"
1068 << "### Copyright 1995 Matthias Ettrich\n"
1069 << "### Copyright 1995-2001 The LyX Team.\n"
1071 << "### ========================================================\n"
1073 << "# This file is written by LyX, if you want to make your own\n"
1074 << "# modifications you should do them from inside LyX and save\n"
1077 // Why the switch you might ask. It is a trick to ensure that all
1078 // the elements in the LyXRCTags enum is handled. As you can see
1079 // there are no breaks at all. So it is just a huge fall-through.
1080 // The nice thing is that we will get a warning from the compiler
1081 // if we forget an element.
1082 LyXRCTags tag = RC_LAST;
1086 // input/include files are not done here
1088 if (bind_file != system_lyxrc.bind_file) {
1089 os << "\\bind_file " << bind_file << "\n";
1095 << "# MISC SECTION ######################################\n"
1098 // bind files are not done here.
1100 if (ui_file != system_lyxrc.ui_file) {
1101 os << "\\ui_file \"" << ui_file << "\"\n";
1103 case RC_AUTOREGIONDELETE:
1104 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1105 os << "# Set to false to inhibit automatic replacement of\n"
1106 << "# the current selection.\n"
1107 << "\\auto_region_delete " << tostr(auto_region_delete)
1110 case RC_AUTORESET_OPTIONS:
1111 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1112 os << "# Set to false to inhibit automatic reset of\n"
1113 << "# the class options to defaults on class change.\n"
1114 << "\\auto_reset_options " << tostr(auto_reset_options)
1118 if (autosave != system_lyxrc.autosave) {
1119 os << "# The time interval between auto-saves in seconds.\n"
1120 << "\\autosave " << autosave << '\n';
1122 case RC_DISPLAY_GRAPHICS:
1123 if (display_graphics != system_lyxrc.display_graphics) {
1124 os << "# Display graphics within LyX\n"
1125 << "# monochrome|grayscale|color|none\n"
1126 << "\\display_graphics "
1127 << lyx::graphics::displayTranslator.find(display_graphics)
1131 case RC_VIEWDVI_PAPEROPTION:
1132 if (view_dvi_paper_option
1133 != system_lyxrc.view_dvi_paper_option) {
1134 os << "# Options used to specify paper size to the\n"
1135 << "# view_dvi_command (e.g. -paper)\n"
1136 << "\\view_dvi_paper_option \""
1137 << view_dvi_paper_option << "\"\n";
1139 case RC_DEFAULT_PAPERSIZE:
1140 if (default_papersize != system_lyxrc.default_papersize) {
1141 os << "# The default papersize to use.\n"
1142 << "\\default_papersize \"";
1143 switch (default_papersize) {
1144 case PAPER_USLETTER:
1145 os << "usletter"; break;
1146 case PAPER_LEGALPAPER:
1147 os << "legal"; break;
1148 case PAPER_EXECUTIVEPAPER:
1149 os << "executive"; break;
1158 case PAPER_DEFAULT: break;
1163 if (ps_command != system_lyxrc.ps_command) {
1164 os << "# Program used for interpreting postscript.\n"
1165 << "\\ps_command \"" << ps_command << "\"\n";
1167 case RC_CHKTEX_COMMAND:
1168 if (chktex_command != system_lyxrc.chktex_command) {
1169 os << "\\chktex_command \"" << chktex_command << "\"\n";
1172 if (use_kbmap != system_lyxrc.use_kbmap) {
1173 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1175 case RC_KBMAP_PRIMARY:
1176 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1177 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1179 case RC_KBMAP_SECONDARY:
1180 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1181 os << "\\kbmap_secondary \"" << secondary_kbmap
1185 if (lyxpipes != system_lyxrc.lyxpipes) {
1186 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1188 case RC_DATE_INSERT_FORMAT:
1189 if (date_insert_format != system_lyxrc.date_insert_format) {
1190 os << "\\date_insert_format \"" << date_insert_format
1193 case RC_LABEL_INIT_LENGTH:
1194 if (label_init_length != system_lyxrc.label_init_length) {
1195 os << "\\label_init_length " << label_init_length
1200 os << "\\user_name \"" << user_name << "\"\n";
1203 os << "\\user_email \"" << user_email << "\"\n";
1205 case RC_SHOW_BANNER:
1206 if (show_banner != system_lyxrc.show_banner) {
1207 os << "\\show_banner " << tostr(show_banner) << '\n';
1211 if (preview != system_lyxrc.preview) {
1212 os << "\\preview " << tostr(preview) << '\n';
1215 case RC_PREVIEW_HASHED_LABELS:
1216 if (preview_hashed_labels !=
1217 system_lyxrc.preview_hashed_labels) {
1218 os << "\\preview_hashed_labels "
1219 << tostr(preview_hashed_labels) << '\n';
1222 case RC_PREVIEW_SCALE_FACTOR:
1223 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1224 os << "\\preview_scale_factor "
1225 << preview_scale_factor << '\n';
1229 << "# SCREEN & FONTS SECTION ############################\n"
1232 case RC_POPUP_NORMAL_FONT:
1233 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1234 os << "\\popup_normal_font \"" << popup_normal_font
1237 case RC_POPUP_BOLD_FONT:
1238 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1239 os << "\\popup_bold_font \"" << popup_bold_font
1242 case RC_POPUP_FONT_ENCODING:
1243 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1244 os << "\\popup_font_encoding \"" << popup_font_encoding
1248 if (dpi != system_lyxrc.dpi) {
1249 os << "\\screen_dpi " << dpi << '\n';
1251 case RC_SCREEN_ZOOM:
1252 if (zoom != system_lyxrc.zoom) {
1253 os << "\\screen_zoom " << zoom << '\n';
1256 if (wheel_jump != system_lyxrc.wheel_jump) {
1257 os << "\\wheel_jump " << wheel_jump << '\n';
1259 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1260 if (cursor_follows_scrollbar
1261 != system_lyxrc.cursor_follows_scrollbar) {
1262 os << "\\cursor_follows_scrollbar "
1263 << tostr(cursor_follows_scrollbar) << '\n';
1265 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1266 if (dialogs_iconify_with_main
1267 != system_lyxrc.dialogs_iconify_with_main) {
1268 os << "\\dialogs_iconify_with_main "
1269 << tostr(dialogs_iconify_with_main) << '\n';
1271 case RC_SCREEN_FONT_ROMAN:
1272 if (roman_font_name != system_lyxrc.roman_font_name) {
1273 os << "\\screen_font_roman \"" << roman_font_name
1276 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1277 if (roman_font_foundry != system_lyxrc.roman_font_foundry) {
1278 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1281 case RC_SCREEN_FONT_SANS:
1282 if (sans_font_name != system_lyxrc.sans_font_name) {
1283 os << "\\screen_font_sans \"" << sans_font_name
1286 case RC_SCREEN_FONT_SANS_FOUNDRY:
1287 if (sans_font_foundry != system_lyxrc.sans_font_foundry) {
1288 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1291 case RC_SCREEN_FONT_TYPEWRITER:
1292 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1293 os << "\\screen_font_typewriter \""
1294 << typewriter_font_name << "\"\n";
1296 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1297 if (typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1298 os << "\\screen_font_typewriter_foundry \""
1299 << typewriter_font_foundry << "\"\n";
1302 case RC_SCREEN_FONT_SCALABLE:
1303 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1304 os << "\\screen_font_scalable "
1305 << tostr(use_scalable_fonts)
1308 case RC_SCREEN_FONT_ENCODING:
1309 if (font_norm != system_lyxrc.font_norm) {
1310 os << "\\screen_font_encoding \"" << font_norm
1313 case RC_SCREEN_FONT_SIZES:
1314 if (font_sizes[LyXFont::SIZE_TINY]
1315 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1316 font_sizes[LyXFont::SIZE_SCRIPT]
1317 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1318 font_sizes[LyXFont::SIZE_FOOTNOTE]
1319 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1320 font_sizes[LyXFont::SIZE_SMALL]
1321 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1322 font_sizes[LyXFont::SIZE_NORMAL]
1323 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1324 font_sizes[LyXFont::SIZE_LARGE]
1325 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1326 font_sizes[LyXFont::SIZE_LARGER]
1327 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1328 font_sizes[LyXFont::SIZE_LARGEST]
1329 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1330 font_sizes[LyXFont::SIZE_HUGE]
1331 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1332 font_sizes[LyXFont::SIZE_HUGER]
1333 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1334 os.setf(ios::fixed);
1336 os << "\\screen_font_sizes"
1337 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1338 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1339 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1340 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1341 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1342 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1343 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1344 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1345 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1346 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1351 << "# COLOR SECTION ###################################\n"
1355 for (int i = 0; i < LColor::ignore; ++i) {
1356 LColor::color lc = static_cast<LColor::color>(i);
1358 string const col(lcolor.getX11Name(lc));
1359 if (col != system_lcolor.getX11Name(lc)) {
1360 os << "\\set_color \""
1361 << lcolor.getLyXName(lc) << "\" \""
1367 << "# PRINTER SECTION ###################################\n"
1371 if (printer != system_lyxrc.printer) {
1372 os << "\\printer \"" << printer << "\"\n";
1374 case RC_PRINT_ADAPTOUTPUT:
1375 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1376 os << "\\print_adapt_output "
1377 << tostr(print_adapt_output)
1380 case RC_PRINT_COMMAND:
1381 if (print_command != system_lyxrc.print_command) {
1382 os << "\\print_command \"" << print_command << "\"\n";
1384 case RC_PRINTEXSTRAOPTIONS:
1385 if (print_extra_options != system_lyxrc.print_extra_options) {
1386 os << "\\print_extra_options \"" << print_extra_options
1389 case RC_PRINTSPOOL_COMMAND:
1390 if (print_spool_command != system_lyxrc.print_spool_command) {
1391 os << "\\print_spool_command \"" << print_spool_command
1394 case RC_PRINTSPOOL_PRINTERPREFIX:
1395 if (print_spool_printerprefix
1396 != system_lyxrc.print_spool_printerprefix) {
1397 os << "\\print_spool_printerprefix \""
1398 << print_spool_printerprefix << "\"\n";
1400 case RC_PRINTEVENPAGEFLAG:
1401 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1402 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1405 case RC_PRINTODDPAGEFLAG:
1406 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1407 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1410 case RC_PRINTREVERSEFLAG:
1411 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1412 os << "\\print_reverse_flag \"" << print_reverse_flag
1415 case RC_PRINTLANDSCAPEFLAG:
1416 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1417 os << "\\print_landscape_flag \"" << print_landscape_flag
1420 case RC_PRINTPAGERANGEFLAG:
1421 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1422 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1425 case RC_PRINTCOPIESFLAG:
1426 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1427 os << "\\print_copies_flag \"" << print_copies_flag
1430 case RC_PRINTCOLLCOPIESFLAG:
1431 if (print_collcopies_flag
1432 != system_lyxrc.print_collcopies_flag) {
1433 os << "\\print_collcopies_flag \""
1434 << print_collcopies_flag
1437 case RC_PRINTPAPERFLAG:
1438 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1439 os << "\\print_paper_flag \"" << print_paper_flag
1442 case RC_PRINTPAPERDIMENSIONFLAG:
1443 if (print_paper_dimension_flag
1444 != system_lyxrc.print_paper_dimension_flag) {
1445 os << "\\print_paper_dimension_flag \""
1446 << print_paper_dimension_flag << "\"\n";
1448 case RC_PRINTTOPRINTER:
1449 if (print_to_printer != system_lyxrc.print_to_printer) {
1450 os << "\\print_to_printer \"" << print_to_printer
1453 case RC_PRINTTOFILE:
1454 if (print_to_file != system_lyxrc.print_to_file) {
1455 os << "\\print_to_file \"" << print_to_file << "\"\n";
1457 case RC_PRINTFILEEXTENSION:
1458 if (print_file_extension != system_lyxrc.print_file_extension) {
1459 os << "\\print_file_extension \""
1460 << print_file_extension
1465 << "# EXPORT SECTION ####################################\n"
1468 case RC_CUSTOM_EXPORT_COMMAND:
1469 if (custom_export_command
1470 != system_lyxrc.custom_export_command) {
1471 os << "\\custom_export_command \""
1472 << custom_export_command
1475 case RC_CUSTOM_EXPORT_FORMAT:
1476 if (custom_export_format
1477 != system_lyxrc.custom_export_format) {
1478 os << "\\custom_export_format \"" << custom_export_format
1483 << "# TEX SECTION #######################################\n"
1486 case RC_FONT_ENCODING:
1487 if (fontenc != system_lyxrc.fontenc) {
1488 os << "\\font_encoding \"" << fontenc << "\"\n";
1492 << "# FILE SECTION ######################################\n"
1495 case RC_DOCUMENTPATH:
1496 if (document_path != system_lyxrc.document_path) {
1497 os << "\\document_path \"" << document_path << "\"\n";
1500 if (lastfiles != system_lyxrc.lastfiles) {
1501 os << "\\lastfiles \"" << lastfiles << "\"\n";
1503 case RC_NUMLASTFILES:
1504 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1505 os << "\\num_lastfiles " << num_lastfiles << '\n';
1507 case RC_CHECKLASTFILES:
1508 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1509 os << "\\check_lastfiles " << tostr(check_lastfiles)
1512 case RC_TEMPLATEPATH:
1513 if (template_path != system_lyxrc.template_path) {
1514 os << "\\template_path \"" << template_path << "\"\n";
1516 case RC_TEMPDIRPATH:
1517 if (tempdir_path != system_lyxrc.tempdir_path) {
1518 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1521 if (use_tempdir != system_lyxrc.use_tempdir) {
1522 os << "\\use_tempdir " << tostr(use_tempdir) << '\n';
1524 case RC_ASCII_LINELEN:
1525 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1526 os << "\\ascii_linelen " << ascii_linelen << '\n';
1528 case RC_MAKE_BACKUP:
1529 if (make_backup != system_lyxrc.make_backup) {
1530 os << "\\make_backup " << tostr(make_backup) << '\n';
1532 case RC_BACKUPDIR_PATH:
1533 if (backupdir_path != system_lyxrc.backupdir_path) {
1534 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1538 << "# ASCII EXPORT SECTION ##############################\n"
1541 case RC_ASCIIROFF_COMMAND:
1542 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1543 os << "\\ascii_roff_command \"" << ascii_roff_command
1548 << "# SPELLCHECKER SECTION ##############################\n"
1550 case RC_USE_SPELL_LIB:
1551 if (use_spell_lib != system_lyxrc.use_spell_lib) {
1552 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1554 case RC_SPELL_COMMAND:
1555 if (isp_command != system_lyxrc.isp_command) {
1556 os << "\\spell_command \"" << isp_command << "\"\n";
1558 case RC_ACCEPT_COMPOUND:
1559 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1560 os << "\\accept_compound " << tostr(isp_accept_compound)
1563 case RC_USE_ALT_LANG:
1564 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1565 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1569 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1570 os << "\\alternate_language \"" << isp_alt_lang
1573 case RC_USE_ESC_CHARS:
1574 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1575 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1579 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1580 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1582 case RC_USE_PERS_DICT:
1583 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1584 os << "\\use_personal_dictionary "
1585 << tostr(isp_use_pers_dict)
1589 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1590 os << "\\personal_dictionary \"" << isp_pers_dict
1593 case RC_USE_INP_ENC:
1594 if (isp_use_input_encoding
1595 != system_lyxrc.isp_use_input_encoding) {
1596 os << "\\use_input_encoding "
1597 << tostr(isp_use_input_encoding)
1602 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1605 case RC_RTL_SUPPORT:
1606 if (rtl_support != system_lyxrc.rtl_support) {
1607 os << "\\rtl " << tostr(rtl_support) << '\n';
1609 case RC_LANGUAGE_PACKAGE:
1610 if (language_package != system_lyxrc.language_package) {
1611 os << "\\language_package \"" << language_package
1614 case RC_LANGUAGE_GLOBAL_OPTIONS:
1615 if (language_global_options
1616 != system_lyxrc.language_global_options) {
1617 os << "\\language_global_options \""
1618 << tostr(language_global_options)
1621 case RC_LANGUAGE_USE_BABEL:
1622 if (language_use_babel != system_lyxrc.language_use_babel) {
1623 os << "\\language_use_babel \""
1624 << tostr(language_use_babel)
1627 case RC_LANGUAGE_COMMAND_BEGIN:
1628 if (language_command_begin
1629 != system_lyxrc.language_command_begin) {
1630 os << "\\language_command_begin \""
1631 << language_command_begin
1634 case RC_LANGUAGE_COMMAND_END:
1635 if (language_command_end
1636 != system_lyxrc.language_command_end) {
1637 os << "\\language_command_end \"" << language_command_end
1640 case RC_LANGUAGE_COMMAND_LOCAL:
1641 if (language_command_local
1642 != system_lyxrc.language_command_local) {
1643 os << "\\language_command_local \""
1644 << language_command_local
1647 case RC_LANGUAGE_AUTO_BEGIN:
1648 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1649 os << "\\language_auto_begin "
1650 << tostr(language_auto_begin) << '\n';
1652 case RC_LANGUAGE_AUTO_END:
1653 if (language_auto_end != system_lyxrc.language_auto_end) {
1654 os << "\\language_auto_end "
1655 << tostr(language_auto_end) << '\n';
1657 case RC_MARK_FOREIGN_LANGUAGE:
1658 if (mark_foreign_language
1659 != system_lyxrc.mark_foreign_language) {
1660 os << "\\mark_foreign_language " <<
1661 tostr(mark_foreign_language) << '\n';
1665 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1668 case RC_AUTO_NUMBER:
1669 if (auto_number != system_lyxrc.auto_number) {
1670 os << "\\auto_number " << tostr(auto_number) << '\n';
1672 case RC_DEFAULT_LANGUAGE:
1673 if (default_language != system_lyxrc.default_language) {
1674 os << "\\default_language " << default_language << '\n';
1678 << "# FORMATS SECTION ##########################\n"
1682 // Look for deleted formats
1683 for (Formats::const_iterator cit = formats.begin();
1684 cit != formats.end(); ++cit) {
1685 Format const * format =
1686 system_formats.getFormat(cit->name());
1688 format->extension() != cit->extension() ||
1689 format->prettyname() != cit->prettyname() ||
1690 format->shortcut() != cit->shortcut())
1691 os << "\\format \"" << cit->name() << "\" \""
1692 << cit->extension() << "\" \""
1693 << cit->prettyname() << "\" \""
1694 << cit->shortcut() << "\"\n";
1697 // New/modifed formats
1698 for (Formats::const_iterator cit = system_formats.begin();
1699 cit != system_formats.end(); ++cit)
1700 if (!formats.getFormat(cit->name()))
1701 os << "\\format \"" << cit->name()
1702 << "\" \"\" \"\" \"\"\n";
1704 for (Formats::const_iterator cit = formats.begin();
1705 cit != formats.end(); ++cit) {
1706 Format const * format =
1707 system_formats.getFormat(cit->name());
1708 if ((!format || format->viewer() != cit->viewer()) &&
1709 (format || !cit->viewer().empty()))
1710 os << "\\viewer \"" << cit->name() << "\" \""
1711 << cit->viewer() << "\"\n";
1715 << "# CONVERTERS SECTION ##########################\n"
1719 // Look for new converters
1720 for (Converters::const_iterator cit = converters.begin();
1721 cit != converters.end(); ++cit) {
1722 Converter const * converter =
1723 system_converters.getConverter(cit->from,
1726 converter->command != cit->command ||
1727 converter->flags != cit->flags)
1728 os << "\\converter \"" << cit->from << "\" \""
1729 << cit->to << "\" \""
1730 << cit->command << "\" \""
1731 << cit->flags << "\"\n";
1734 // New/modifed converters
1735 for (Converters::const_iterator cit = system_converters.begin();
1736 cit != system_converters.end(); ++cit)
1737 if (!converters.getConverter(cit->from, cit->to))
1738 os << "\\converter \"" << cit->from
1739 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1745 void LyXRC::set_font_norm_type()
1747 if (font_norm == "iso10646-1")
1748 font_norm_type = ISO_10646_1;
1749 else if (font_norm == "iso8859-1")
1750 font_norm_type = ISO_8859_1;
1751 else if (font_norm == "iso8859-3")
1752 font_norm_type = ISO_8859_3;
1753 else if (font_norm == "iso8859-4")
1754 font_norm_type = ISO_8859_4;
1755 else if (font_norm == "iso8859-6.8x")
1756 font_norm_type = ISO_8859_6_8;
1757 else if (font_norm == "iso8859-9")
1758 font_norm_type = ISO_8859_9;
1759 else if (font_norm == "iso8859-15")
1760 font_norm_type = ISO_8859_15;
1762 font_norm_type = OTHER_ENCODING;
1766 string const LyXRC::getDescription(LyXRCTags tag)
1771 case RC_FONT_ENCODING:
1772 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1776 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1779 case RC_PRINT_COMMAND:
1780 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1783 case RC_PRINTEVENPAGEFLAG:
1784 str = _("The option to print only even pages.");
1787 case RC_PRINTODDPAGEFLAG:
1788 str = _("The option to print only odd pages.");
1791 case RC_PRINTPAGERANGEFLAG:
1792 str = _("The option for specifying a comma-separated list of pages to print.");
1795 case RC_PRINTCOPIESFLAG:
1796 str = _("The option for specifying the number of copies to print.");
1799 case RC_PRINTCOLLCOPIESFLAG:
1800 str = _("The option for specifying whether the copies should be collated.");
1803 case RC_PRINTREVERSEFLAG:
1804 str = _("The option to reverse the order of the pages printed.");
1807 case RC_PRINTLANDSCAPEFLAG:
1808 str = _("The option to print out in landscape.");
1811 case RC_PRINTPAPERFLAG:
1812 str = _("The option to specify paper type.");
1815 case RC_PRINTPAPERDIMENSIONFLAG:
1816 str = _("Option to specify the dimensions of the print paper.");
1819 case RC_PRINTTOPRINTER:
1820 str = _("Option to pass to the print program to print on a specific printer.");
1823 case RC_PRINT_ADAPTOUTPUT:
1824 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1827 case RC_PRINTTOFILE:
1828 str = _("Option to pass to the print program to print to a file.");
1831 case RC_PRINTFILEEXTENSION:
1832 str = _("Extension of printer program output file. Usually \".ps\".");
1835 case RC_PRINTEXSTRAOPTIONS:
1836 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1839 case RC_PRINTSPOOL_COMMAND:
1840 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.");
1843 case RC_PRINTSPOOL_PRINTERPREFIX:
1844 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.");
1848 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1851 case RC_SCREEN_ZOOM:
1852 //xgettext:no-c-format
1853 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1856 case RC_SCREEN_FONT_SIZES:
1857 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1860 case RC_SCREEN_FONT_ROMAN:
1861 case RC_SCREEN_FONT_SANS:
1862 case RC_SCREEN_FONT_TYPEWRITER:
1863 str = _("The screen fonts used to display the text while editing.");
1866 case RC_POPUP_BOLD_FONT:
1867 str = _("The bold font in the dialogs.");
1870 case RC_POPUP_NORMAL_FONT:
1871 str = _("The normal font in the dialogs.");
1874 case RC_SCREEN_FONT_ENCODING:
1875 str = _("The encoding for the screen fonts.");
1878 case RC_POPUP_FONT_ENCODING:
1879 str = _("The encoding for the menu/popups fonts.");
1886 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1889 case RC_DOCUMENTPATH:
1890 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1893 case RC_TEMPLATEPATH:
1894 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1897 case RC_TEMPDIRPATH:
1898 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1902 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1906 str = _("The file where the last-files information should be stored.");
1909 case RC_AUTOREGIONDELETE:
1910 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1913 case RC_AUTORESET_OPTIONS:
1914 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1918 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1922 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1926 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1930 case RC_KBMAP_PRIMARY:
1931 case RC_KBMAP_SECONDARY:
1932 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.");
1935 case RC_ASCIIROFF_COMMAND:
1936 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.");
1939 case RC_ASCII_LINELEN:
1940 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1943 case RC_NUMLASTFILES:
1944 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1947 case RC_CHECKLASTFILES:
1948 str = _("Select to check whether the lastfiles still exist.");
1951 case RC_VIEWDVI_PAPEROPTION:
1952 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1955 case RC_DEFAULT_PAPERSIZE:
1956 str = _("Specify the default paper size.");
1962 case RC_ACCEPT_COMPOUND:
1963 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1966 case RC_SPELL_COMMAND:
1967 str = _("What command runs the spell checker?");
1970 case RC_USE_INP_ENC:
1971 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.");
1974 case RC_USE_ALT_LANG:
1976 str = _("Specify an alternate language. The default is to use the language of the document.");
1979 case RC_USE_PERS_DICT:
1981 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1984 case RC_USE_ESC_CHARS:
1986 str = _("Specify additional chars that can be part of a word.");
1989 case RC_SCREEN_FONT_SCALABLE:
1990 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.");
1993 case RC_CHKTEX_COMMAND:
1994 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1997 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1998 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.");
2001 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2002 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2005 case RC_DISPLAY_GRAPHICS:
2006 str = _("Select how LyX will display any graphics.");
2009 case RC_MAKE_BACKUP:
2010 str = _("De-select if you don't want LyX to create backup files.");
2013 case RC_BACKUPDIR_PATH:
2014 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.");
2017 case RC_RTL_SUPPORT:
2018 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2021 case RC_MARK_FOREIGN_LANGUAGE:
2022 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2025 case RC_LANGUAGE_PACKAGE:
2026 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2029 case RC_LANGUAGE_GLOBAL_OPTIONS:
2030 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2033 case RC_LANGUAGE_USE_BABEL:
2034 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2037 case RC_LANGUAGE_AUTO_BEGIN:
2038 str = _("Select if a language switching command is needed at the beginning of the document.");
2041 case RC_LANGUAGE_AUTO_END:
2042 str = _("Select if a language switching command is needed at the end of the document.");
2045 case RC_LANGUAGE_COMMAND_BEGIN:
2046 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.");
2049 case RC_LANGUAGE_COMMAND_END:
2050 str = _("The LaTeX command for changing back to the language of the document.");
2053 case RC_LANGUAGE_COMMAND_LOCAL:
2054 str = _("The LaTeX command for local changing of the language.");
2057 case RC_DATE_INSERT_FORMAT:
2058 //xgettext:no-c-format
2059 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2062 case RC_SHOW_BANNER:
2063 str = _("De-select if you don't want the startup banner.");
2067 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2079 case RC_DEFAULT_LANGUAGE:
2080 str = _("New documents will be assigned this language.");
2083 case RC_LABEL_INIT_LENGTH:
2084 str = _("Maximum number of words in the initialization string for a new label");
2088 str = _("Shows a typeset preview of things such as math");
2091 case RC_PREVIEW_HASHED_LABELS:
2092 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2095 case RC_PREVIEW_SCALE_FACTOR:
2096 str = _("Scale the preview size to suit.");
2106 // The global instance
2109 // The global copy of the system lyxrc entries (everything except preferences)