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"
28 #include "lastfiles.h"
34 #include "graphics/GraphicsTypes.h"
36 #include "support/convert.h"
37 #include "support/environment.h"
38 #include "support/filetools.h"
39 #include "support/lstrings.h"
40 #include "support/userinfo.h"
42 using lyx::support::ascii_lowercase;
43 using lyx::support::bformat;
44 using lyx::support::ExpandPath;
45 using lyx::support::getEnv;
46 using lyx::support::LibFileSearch;
47 using lyx::support::token;
60 // when adding something to this array keep it sorted!
61 keyword_item lyxrcTags[] = {
62 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
63 { "\\alternate_language", LyXRC::RC_ALT_LANG },
64 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
65 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
66 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
67 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
68 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
69 { "\\autosave", LyXRC::RC_AUTOSAVE },
70 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
71 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
72 { "\\bind_file", LyXRC::RC_BINDFILE },
73 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
74 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
75 { "\\converter", LyXRC::RC_CONVERTER },
76 { "\\copier", LyXRC::RC_COPIER },
77 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
78 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
79 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
80 { "\\cygwin_path_fix_needed", LyXRC::RC_CYGWIN_PATH_FIX },
81 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
82 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
83 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
84 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
85 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
86 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
87 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
88 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
89 { "\\format", LyXRC::RC_FORMAT },
90 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
91 { "\\input", LyXRC::RC_INPUT },
92 { "\\kbmap", LyXRC::RC_KBMAP },
93 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
94 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
95 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
96 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
97 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
98 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
99 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
100 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
101 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
102 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
103 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
104 { "\\lastfiles", LyXRC::RC_LASTFILES },
105 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
106 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
107 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
108 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
109 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
110 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
111 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
112 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
113 { "\\preview", LyXRC::RC_PREVIEW },
114 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
115 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
116 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
117 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
118 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
119 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
120 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
121 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
122 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
123 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
124 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
125 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
126 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
127 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
128 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
129 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
130 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
131 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
132 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
133 { "\\printer", LyXRC::RC_PRINTER },
134 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
135 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
136 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
137 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
138 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
139 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
140 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
141 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
142 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
143 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
144 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
145 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
146 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
147 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
148 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
149 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
150 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
151 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
152 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
153 { "\\set_color", LyXRC::RC_SET_COLOR },
154 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
155 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
156 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
157 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
158 { "\\ui_file", LyXRC::RC_UIFILE },
159 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
160 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
161 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
162 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
163 // compatibility with versions older than 1.4.0 only
164 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
165 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
166 // compatibility with versions older than 1.4.0 only
167 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
168 { "\\user_email", LyXRC::RC_USER_EMAIL },
169 { "\\user_name", LyXRC::RC_USER_NAME },
170 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
171 // compatibility with versions older than 1.4.0 only
172 { "\\viewer" ,LyXRC::RC_VIEWER},
173 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
176 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
187 void LyXRC::setDefaults() {
190 // Get printer from the environment. If fail, use default "",
191 // assuming that everything is set up correctly.
192 printer = getEnv("PRINTER");
193 print_adapt_output = false;
194 print_command = "dvips";
195 print_evenpage_flag = "-B";
196 print_oddpage_flag = "-A";
197 print_pagerange_flag = "-pp";
198 print_copies_flag = "-c";
199 print_collcopies_flag = "-C";
200 print_reverse_flag = "-r";
201 print_landscape_flag = "-t landscape";
202 print_to_printer = "-P";
203 print_to_file = "-o ";
204 print_file_extension = ".ps";
205 print_paper_flag = "-t";
206 print_paper_dimension_flag = "-T";
207 document_path.erase();
208 tempdir_path = "/tmp";
209 view_dvi_paper_option.erase();
210 default_papersize = PAPER_USLETTER;
211 custom_export_format = "ps";
212 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
213 bibtex_command = "bibtex";
215 index_command = "makeindex -c -q";
217 // Because a screen typically is wider than a piece of paper:
220 // Default LaTeX font size:
221 font_sizes[LyXFont::SIZE_TINY] = "5.0";
222 font_sizes[LyXFont::SIZE_SCRIPT] = "7.0";
223 font_sizes[LyXFont::SIZE_FOOTNOTE] = "8.0";
224 font_sizes[LyXFont::SIZE_SMALL] = "9.0";
225 font_sizes[LyXFont::SIZE_NORMAL] = "10.0";
226 font_sizes[LyXFont::SIZE_LARGE] = "12.0";
227 font_sizes[LyXFont::SIZE_LARGER] = "14.4";
228 font_sizes[LyXFont::SIZE_LARGEST] = "17.26";
229 font_sizes[LyXFont::SIZE_HUGE] = "20.74";
230 font_sizes[LyXFont::SIZE_HUGER] = "24.88";
231 use_scalable_fonts = true;
232 roman_font_name = "";
234 typewriter_font_name = "";
235 popup_bold_font = "-*-helvetica-bold-r";
236 popup_normal_font = "-*-helvetica-medium-r";
237 font_norm = "iso8859-1";
238 font_norm_type = ISO_8859_1;
239 popup_font_encoding.erase();
241 auto_region_delete = true;
242 auto_reset_options = false;
244 num_lastfiles = maxlastfiles;
245 check_lastfiles = true;
247 backupdir_path.erase();
248 display_graphics = lyx::graphics::ColorDisplay;
249 // Spellchecker settings:
250 use_spell_lib = true;
251 isp_command = "ispell";
252 isp_accept_compound = false;
253 isp_use_input_encoding = false;
254 isp_use_alt_lang = false;
255 isp_use_pers_dict = false;
256 isp_use_esc_chars = false;
260 mark_foreign_language = true;
261 language_auto_begin = true;
262 language_auto_end = true;
263 language_global_options = true;
264 language_use_babel = true;
265 language_package = "\\usepackage{babel}";
266 language_command_begin = "\\selectlanguage{$$lang}";
267 language_command_local = "\\foreignlanguage{$$lang}{";
268 default_language = "english";
270 cygwin_path_fix = false;
271 date_insert_format = "%A, %e %B %Y";
272 cursor_follows_scrollbar = false;
273 dialogs_iconify_with_main = false;
274 label_init_length = 3;
275 preview = PREVIEW_OFF;
276 preview_hashed_labels = false;
277 preview_scale_factor = "0.9";
279 user_name = lyx::support::user_name();
281 user_email = lyx::support::user_email();
287 void oldFontFormat(string & family, string & foundry)
289 if (family.empty() || family[0] != '-')
291 foundry = token(family, '-', 1);
292 family = token(family, '-', 2);
300 int LyXRC::read(string const & filename)
302 LyXLex lexrc(lyxrcTags, lyxrcCount);
303 if (lyxerr.debugging(Debug::PARSER))
304 lexrc.printTable(lyxerr);
306 lexrc.setFile(filename);
307 if (!lexrc.isOK()) return -2;
309 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
315 int LyXRC::read(std::istream & is)
317 LyXLex lexrc(lyxrcTags, lyxrcCount);
318 if (lyxerr.debugging(Debug::PARSER))
319 lexrc.printTable(lyxerr);
322 if (!lexrc.isOK()) return -2;
324 lyxerr[Debug::LYXRC] << "Reading istream..." << endl;
330 int LyXRC::read(LyXLex & lexrc)
332 if (!lexrc.isOK()) return -2;
334 while (lexrc.isOK()) {
335 // By using two switches we take advantage of the compiler
336 // telling us if we have missed a LyXRCTags element in
337 // the second switch.
338 // Note that this also shows a problem with LyXLex since it
339 // helps us avoid taking advantage of the strictness of the
342 int le = lexrc.lex();
344 case LyXLex::LEX_UNDEF:
345 lexrc.printError("Unknown tag `$$Token'");
347 case LyXLex::LEX_FEOF:
351 switch (static_cast<LyXRCTags>(le)) {
352 case RC_INPUT: // Include file
355 LibFileSearch(string(),
358 lexrc.printError("Error reading "
359 "included file: "+tmp);
363 case RC_BINDFILE: // RVDK_PATCH_5
365 bind_file = lexrc.getString();
371 ui_file = lexrc.getString();
375 case RC_AUTORESET_OPTIONS:
377 auto_reset_options = lexrc.getBool();
381 case RC_DISPLAY_GRAPHICS:
383 display_graphics = lyx::graphics::displayTranslator().find(lexrc.getString());
389 use_kbmap = lexrc.getBool();
393 case RC_CYGWIN_PATH_FIX:
395 cygwin_path_fix = lexrc.getBool();
399 case RC_KBMAP_PRIMARY:
401 string const kmap(lexrc.getString());
404 } else if (!LibFileSearch("kbd", kmap,
406 primary_kbmap = kmap;
408 lexrc.printError("LyX: Keymap `$$Token' not found");
413 case RC_KBMAP_SECONDARY:
415 string const kmap(lexrc.getString());
418 } else if (!LibFileSearch("kbd", kmap,
420 secondary_kbmap = kmap;
422 lexrc.printError("LyX: Keymap `$$Token' not found");
427 case RC_FONT_ENCODING:
429 fontenc = lexrc.getString();
435 printer = lexrc.getString();
439 case RC_PRINT_COMMAND:
441 print_command = lexrc.getString();
445 case RC_PRINTEVENPAGEFLAG:
447 print_evenpage_flag = lexrc.getString();
451 case RC_PRINTODDPAGEFLAG:
453 print_oddpage_flag = lexrc.getString();
457 case RC_PRINTPAGERANGEFLAG:
459 print_pagerange_flag = lexrc.getString();
463 case RC_PRINTCOPIESFLAG:
465 print_copies_flag = lexrc.getString();
469 case RC_PRINTCOLLCOPIESFLAG:
471 print_collcopies_flag = lexrc.getString();
475 case RC_PRINTREVERSEFLAG:
477 print_reverse_flag = lexrc.getString();
481 case RC_PRINTLANDSCAPEFLAG:
483 print_landscape_flag = lexrc.getString();
487 case RC_PRINTTOPRINTER:
489 print_to_printer = lexrc.getString();
493 case RC_PRINT_ADAPTOUTPUT:
495 print_adapt_output = lexrc.getBool();
501 print_to_file = lexrc.getString();
505 case RC_PRINTFILEEXTENSION:
507 print_file_extension = lexrc.getString();
511 case RC_PRINTEXSTRAOPTIONS:
513 print_extra_options = lexrc.getString();
517 case RC_PRINTSPOOL_COMMAND:
519 print_spool_command = lexrc.getString();
523 case RC_PRINTSPOOL_PRINTERPREFIX:
525 print_spool_printerprefix = lexrc.getString();
529 case RC_PRINTPAPERDIMENSIONFLAG:
531 print_paper_dimension_flag = lexrc.getString();
535 case RC_PRINTPAPERFLAG:
537 print_paper_flag = lexrc.getString();
541 case RC_CUSTOM_EXPORT_COMMAND:
543 custom_export_command = lexrc.getString();
547 case RC_CUSTOM_EXPORT_FORMAT:
549 custom_export_format = lexrc.getString();
553 case RC_DEFAULT_PAPERSIZE:
556 ascii_lowercase(lexrc.getString());
557 if (size == "usletter")
560 else if (size == "legal")
563 else if (size == "executive")
565 PAPER_EXECUTIVEPAPER;
566 else if (size == "a3")
569 else if (size == "a4")
572 else if (size == "a5")
575 else if (size == "b5")
581 case RC_VIEWDVI_PAPEROPTION:
583 view_dvi_paper_option = lexrc.getString();
585 view_dvi_paper_option.erase();
589 case RC_CHKTEX_COMMAND:
591 chktex_command = lexrc.getString();
595 case RC_BIBTEX_COMMAND:
597 bibtex_command = lexrc.getString();
601 case RC_INDEX_COMMAND:
603 index_command = lexrc.getString();
609 dpi = lexrc.getInteger();
615 zoom = lexrc.getInteger();
621 wheel_jump = lexrc.getInteger();
625 case RC_SCREEN_FONT_SIZES:
627 font_sizes[LyXFont::SIZE_TINY] =
631 font_sizes[LyXFont::SIZE_SCRIPT] =
635 font_sizes[LyXFont::SIZE_FOOTNOTE] =
639 font_sizes[LyXFont::SIZE_SMALL] =
643 font_sizes[LyXFont::SIZE_NORMAL] =
647 font_sizes[LyXFont::SIZE_LARGE] =
651 font_sizes[LyXFont::SIZE_LARGER] =
655 font_sizes[LyXFont::SIZE_LARGEST] =
659 font_sizes[LyXFont::SIZE_HUGE] =
663 font_sizes[LyXFont::SIZE_HUGER] =
668 case RC_SCREEN_FONT_SCALABLE:
670 use_scalable_fonts = lexrc.getBool();
676 autosave = lexrc.getInteger();
680 case RC_DOCUMENTPATH:
682 document_path = ExpandPath(lexrc.getString());
686 case RC_TEMPLATEPATH:
688 template_path = ExpandPath(lexrc.getString());
694 tempdir_path = ExpandPath(lexrc.getString());
700 lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
706 lastfiles = ExpandPath(lexrc.getString());
710 case RC_NUMLASTFILES:
712 num_lastfiles = lexrc.getInteger();
716 case RC_CHECKLASTFILES:
718 check_lastfiles = lexrc.getBool();
722 case RC_SCREEN_FONT_ROMAN:
724 roman_font_name = lexrc.getString();
725 oldFontFormat(roman_font_name,
730 case RC_SCREEN_FONT_SANS:
732 sans_font_name = lexrc.getString();
733 oldFontFormat(sans_font_name, sans_font_foundry);
737 case RC_SCREEN_FONT_TYPEWRITER:
739 typewriter_font_name = lexrc.getString();
740 oldFontFormat(typewriter_font_name,
741 typewriter_font_foundry);
745 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
747 roman_font_foundry = lexrc.getString();
751 case RC_SCREEN_FONT_SANS_FOUNDRY:
753 sans_font_foundry = lexrc.getString();
757 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
759 typewriter_font_foundry = lexrc.getString();
763 case RC_SCREEN_FONT_ENCODING:
765 font_norm = lexrc.getString();
766 set_font_norm_type();
770 case RC_POPUP_BOLD_FONT:
772 popup_bold_font = lexrc.getString();
776 case RC_POPUP_NORMAL_FONT:
778 popup_normal_font = lexrc.getString();
782 case RC_POPUP_FONT_ENCODING:
784 popup_font_encoding = lexrc.getString();
790 string lyx_name, x11_name;
793 lyx_name = lexrc.getString();
795 lexrc.printError("Missing color tag.");
800 x11_name = lexrc.getString();
802 lexrc.printError("Missing color name for color: `$$Token'");
806 LColor::color const col =
807 lcolor.getFromLyXName(lyx_name);
808 if (col == LColor::none ||
809 col == LColor::inherit ||
810 col == LColor::ignore)
813 if (!lcolor.setColor(col, x11_name)) {
814 lyxerr << "Bad lyxrc set_color for "
820 case RC_AUTOREGIONDELETE:
821 // Auto region delete defaults to true
823 auto_region_delete = lexrc.getBool();
829 lyxpipes = ExpandPath(lexrc.getString());
833 case RC_CURSOR_FOLLOWS_SCROLLBAR:
835 cursor_follows_scrollbar = lexrc.getBool();
839 case RC_DIALOGS_ICONIFY_WITH_MAIN:
841 dialogs_iconify_with_main = lexrc.getBool();
845 case RC_ASCIIROFF_COMMAND:
847 ascii_roff_command = lexrc.getString();
850 case RC_ASCII_LINELEN:
852 ascii_linelen = lexrc.getInteger();
855 // Spellchecker settings:
856 case RC_USE_SPELL_LIB:
858 use_spell_lib = lexrc.getBool();
861 case RC_SPELL_COMMAND:
863 isp_command = lexrc.getString();
866 case RC_ACCEPT_COMPOUND:
868 isp_accept_compound = lexrc.getBool();
873 isp_use_input_encoding = lexrc.getBool();
876 case RC_USE_ALT_LANG:
878 isp_use_alt_lang = lexrc.getBool();
881 case RC_USE_PERS_DICT:
883 isp_use_pers_dict = lexrc.getBool();
886 case RC_USE_ESC_CHARS:
888 isp_use_esc_chars = lexrc.getBool();
893 isp_alt_lang = lexrc.getString();
898 isp_pers_dict = lexrc.getString();
903 isp_esc_chars = lexrc.getString();
908 make_backup = lexrc.getBool();
911 case RC_BACKUPDIR_PATH:
913 backupdir_path = ExpandPath(lexrc.getString());
916 case RC_DATE_INSERT_FORMAT:
918 date_insert_format = lexrc.getString();
921 case RC_LANGUAGE_PACKAGE:
923 language_package = lexrc.getString();
926 case RC_LANGUAGE_AUTO_BEGIN:
928 language_auto_begin = lexrc.getBool();
931 case RC_LANGUAGE_AUTO_END:
933 language_auto_end = lexrc.getBool();
936 case RC_LANGUAGE_GLOBAL_OPTIONS:
938 language_global_options = lexrc.getBool();
941 case RC_LANGUAGE_USE_BABEL:
943 language_use_babel = lexrc.getBool();
946 case RC_LANGUAGE_COMMAND_BEGIN:
948 language_command_begin = lexrc.getString();
951 case RC_LANGUAGE_COMMAND_END:
953 language_command_end = lexrc.getString();
956 case RC_LANGUAGE_COMMAND_LOCAL:
958 language_command_local = lexrc.getString();
963 rtl_support = lexrc.getBool();
968 auto_number = lexrc.getBool();
971 case RC_MARK_FOREIGN_LANGUAGE:
973 mark_foreign_language = lexrc.getBool();
980 fmt = lexrc.getString();
983 command = lexrc.getString();
985 movers.set(fmt, command);
990 string from, to, command, flags;
992 from = lexrc.getString();
995 to = lexrc.getString();
998 command = lexrc.getString();
1001 flags = lexrc.getString();
1004 || token(command, ' ', 0) == "none") {
1005 converters.erase(from, to);
1007 converters.add(from, to, command, flags);
1011 // compatibility with versions older than 1.4.0 only
1013 string format, command;
1015 format = lexrc.getString();
1018 command = lexrc.getString();
1019 if (token(command, ' ', 0) == "none")
1022 formats.setViewer(format, command);
1026 string format, extension, prettyname, shortcut;
1028 format = lexrc.getString();
1031 extension = lexrc.getString();
1034 prettyname = lexrc.getString();
1037 shortcut = lexrc.getString();
1039 string viewer, editor;
1040 // Hack to ensure compatibility with versions older
1042 int le = lexrc.lex();
1043 if (le != LyXLex::LEX_FEOF && le != LyXLex::LEX_UNDEF) {
1044 viewer = lexrc.getString();
1045 if (le == LyXLex::LEX_DATA) {
1046 if (token(viewer, ' ', 0) == "none")
1049 editor = lexrc.getString();
1050 if (token(editor, ' ', 0) == "none")
1054 // We have got a known token.
1055 // Therefore this is an old style
1056 // format definition without
1057 // viewer and editor.
1058 lexrc.pushToken(viewer);
1062 if (prettyname.empty()) {
1063 if (converters.formatIsUsed(format)) {
1064 lyxerr << "Can't delete format "
1067 formats.erase(format);
1070 formats.add(format, extension, prettyname,
1071 shortcut, viewer, editor);
1075 case RC_DEFAULT_LANGUAGE:
1077 default_language = lexrc.getString();
1081 case RC_LABEL_INIT_LENGTH:
1083 label_init_length = lexrc.getInteger();
1087 case RC_SHOW_BANNER:
1089 show_banner = lexrc.getBool();
1095 string const tmp = lexrc.getString();
1096 if (tmp == "true" || tmp == "on")
1097 preview = PREVIEW_ON;
1098 else if (tmp == "no_math")
1099 preview = PREVIEW_NO_MATH;
1101 preview = PREVIEW_OFF;
1102 if (tmp != "false" && tmp != "off")
1103 lyxerr << "Unrecognized "
1105 << tmp << '\n' << endl;
1110 case RC_PREVIEW_HASHED_LABELS:
1112 preview_hashed_labels = lexrc.getBool();
1116 case RC_PREVIEW_SCALE_FACTOR:
1118 preview_scale_factor = lexrc.getString();
1124 user_name = lexrc.getString();
1129 user_email = lexrc.getString();
1132 case RC_PATH_PREFIX:
1134 path_prefix = lexrc.getString();
1137 case RC_LAST: break; // this is just a dummy
1141 /// Update converters data-structures
1142 converters.update(formats);
1143 converters.buildGraph();
1149 void LyXRC::write(string const & filename, bool ignore_system_lyxrc) const
1151 ofstream ofs(filename.c_str());
1153 write(ofs, ignore_system_lyxrc);
1157 void LyXRC::print() const
1159 if (lyxerr.debugging())
1160 write(lyxerr, false);
1168 typedef std::pair<std::string, SpecialisedMover> Data;
1170 SameMover(Data const & comparison)
1171 : comparison_(comparison) {}
1173 bool operator()(Data const & data) const
1175 return data.first == comparison_.first &&
1176 data.second.command() == comparison_.second.command();
1184 void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
1186 os << "### This file is part of\n"
1187 << "### ========================================================\n"
1188 << "### LyX, The Document Processor\n"
1190 << "### Copyright 1995 Matthias Ettrich\n"
1191 << "### Copyright 1995-2001 The LyX Team.\n"
1193 << "### ========================================================\n"
1195 << "# This file is written by LyX, if you want to make your own\n"
1196 << "# modifications you should do them from inside LyX and save\n"
1199 // Why the switch you might ask. It is a trick to ensure that all
1200 // the elements in the LyXRCTags enum is handled. As you can see
1201 // there are no breaks at all. So it is just a huge fall-through.
1202 // The nice thing is that we will get a warning from the compiler
1203 // if we forget an element.
1204 LyXRCTags tag = RC_LAST;
1208 // input/include files are not done here
1210 if (ignore_system_lyxrc ||
1211 bind_file != system_lyxrc.bind_file) {
1212 os << "\\bind_file " << bind_file << "\n";
1218 << "# MISC SECTION ######################################\n"
1221 // bind files are not done here.
1223 case RC_PATH_PREFIX:
1224 if (ignore_system_lyxrc ||
1225 path_prefix != system_lyxrc.path_prefix) {
1226 os << "\\path_prefix \"" << path_prefix << "\"\n";
1230 if (ignore_system_lyxrc ||
1231 ui_file != system_lyxrc.ui_file) {
1232 os << "\\ui_file \"" << ui_file << "\"\n";
1234 case RC_AUTOREGIONDELETE:
1235 if (ignore_system_lyxrc ||
1236 auto_region_delete != system_lyxrc.auto_region_delete) {
1237 os << "# Set to false to inhibit automatic replacement of\n"
1238 << "# the current selection.\n"
1239 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1242 case RC_AUTORESET_OPTIONS:
1243 if (ignore_system_lyxrc ||
1244 auto_reset_options != system_lyxrc.auto_reset_options) {
1245 os << "# Set to false to inhibit automatic reset of\n"
1246 << "# the class options to defaults on class change.\n"
1247 << "\\auto_reset_options "
1248 << convert<string>(auto_reset_options)
1252 if (ignore_system_lyxrc ||
1253 autosave != system_lyxrc.autosave) {
1254 os << "# The time interval between auto-saves in seconds.\n"
1255 << "\\autosave " << autosave << '\n';
1257 case RC_DISPLAY_GRAPHICS:
1258 if (ignore_system_lyxrc ||
1259 display_graphics != system_lyxrc.display_graphics) {
1260 os << "# Display graphics within LyX\n"
1261 << "# monochrome|grayscale|color|none\n"
1262 << "\\display_graphics "
1263 << lyx::graphics::displayTranslator().find(display_graphics)
1267 case RC_VIEWDVI_PAPEROPTION:
1268 if (ignore_system_lyxrc ||
1269 view_dvi_paper_option
1270 != system_lyxrc.view_dvi_paper_option) {
1271 os << "# Options used to specify paper size to the\n"
1272 << "# view_dvi_command (e.g. -paper)\n"
1273 << "\\view_dvi_paper_option \""
1274 << view_dvi_paper_option << "\"\n";
1276 case RC_DEFAULT_PAPERSIZE:
1277 if (ignore_system_lyxrc ||
1278 default_papersize != system_lyxrc.default_papersize) {
1279 os << "# The default papersize to use.\n"
1280 << "\\default_papersize \"";
1281 switch (default_papersize) {
1282 case PAPER_USLETTER:
1283 os << "usletter"; break;
1284 case PAPER_LEGALPAPER:
1285 os << "legal"; break;
1286 case PAPER_EXECUTIVEPAPER:
1287 os << "executive"; break;
1296 case PAPER_DEFAULT: break;
1300 case RC_CHKTEX_COMMAND:
1301 if (ignore_system_lyxrc ||
1302 chktex_command != system_lyxrc.chktex_command) {
1303 os << "\\chktex_command \"" << chktex_command << "\"\n";
1305 case RC_BIBTEX_COMMAND:
1306 if (ignore_system_lyxrc ||
1307 bibtex_command != system_lyxrc.bibtex_command) {
1308 os << "\\bibtex_command \"" << bibtex_command << "\"\n";
1310 case RC_INDEX_COMMAND:
1311 if (ignore_system_lyxrc ||
1312 index_command != system_lyxrc.index_command) {
1313 os << "\\index_command \"" << index_command << "\"\n";
1316 if (ignore_system_lyxrc ||
1317 use_kbmap != system_lyxrc.use_kbmap) {
1318 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1321 case RC_CYGWIN_PATH_FIX:
1322 if (ignore_system_lyxrc ||
1323 cygwin_path_fix != system_lyxrc.cygwin_path_fix) {
1324 os << "\\cygwin_path_fix_needed "
1325 << convert<string>(cygwin_path_fix) << '\n';
1327 case RC_KBMAP_PRIMARY:
1328 if (ignore_system_lyxrc ||
1329 primary_kbmap != system_lyxrc.primary_kbmap) {
1330 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1332 case RC_KBMAP_SECONDARY:
1333 if (ignore_system_lyxrc ||
1334 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1335 os << "\\kbmap_secondary \"" << secondary_kbmap
1339 if (ignore_system_lyxrc ||
1340 lyxpipes != system_lyxrc.lyxpipes) {
1341 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1343 case RC_DATE_INSERT_FORMAT:
1344 if (ignore_system_lyxrc ||
1345 date_insert_format != system_lyxrc.date_insert_format) {
1346 os << "\\date_insert_format \"" << date_insert_format
1349 case RC_LABEL_INIT_LENGTH:
1350 if (ignore_system_lyxrc ||
1351 label_init_length != system_lyxrc.label_init_length) {
1352 os << "\\label_init_length " << label_init_length
1357 os << "\\user_name \"" << user_name << "\"\n";
1360 os << "\\user_email \"" << user_email << "\"\n";
1362 case RC_SHOW_BANNER:
1363 if (ignore_system_lyxrc ||
1364 show_banner != system_lyxrc.show_banner) {
1365 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1369 if (ignore_system_lyxrc ||
1370 preview != system_lyxrc.preview) {
1376 case PREVIEW_NO_MATH:
1383 os << "\\preview " << status << '\n';
1386 case RC_PREVIEW_HASHED_LABELS:
1387 if (ignore_system_lyxrc ||
1388 preview_hashed_labels !=
1389 system_lyxrc.preview_hashed_labels) {
1390 os << "\\preview_hashed_labels "
1391 << convert<string>(preview_hashed_labels) << '\n';
1394 case RC_PREVIEW_SCALE_FACTOR:
1395 if (ignore_system_lyxrc ||
1396 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1397 os << "\\preview_scale_factor "
1398 << preview_scale_factor << '\n';
1402 << "# SCREEN & FONTS SECTION ############################\n"
1405 case RC_POPUP_NORMAL_FONT:
1406 if (ignore_system_lyxrc ||
1407 popup_normal_font != system_lyxrc.popup_normal_font) {
1408 os << "\\popup_normal_font \"" << popup_normal_font
1411 case RC_POPUP_BOLD_FONT:
1412 if (ignore_system_lyxrc ||
1413 popup_bold_font != system_lyxrc.popup_bold_font) {
1414 os << "\\popup_bold_font \"" << popup_bold_font
1417 case RC_POPUP_FONT_ENCODING:
1418 if (ignore_system_lyxrc ||
1419 popup_font_encoding != system_lyxrc.popup_font_encoding) {
1420 os << "\\popup_font_encoding \"" << popup_font_encoding
1424 if (ignore_system_lyxrc ||
1425 dpi != system_lyxrc.dpi) {
1426 os << "\\screen_dpi " << dpi << '\n';
1428 case RC_SCREEN_ZOOM:
1429 if (ignore_system_lyxrc ||
1430 zoom != system_lyxrc.zoom) {
1431 os << "\\screen_zoom " << zoom << '\n';
1434 if (ignore_system_lyxrc ||
1435 wheel_jump != system_lyxrc.wheel_jump) {
1436 os << "\\wheel_jump " << wheel_jump << '\n';
1438 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1439 if (ignore_system_lyxrc ||
1440 cursor_follows_scrollbar
1441 != system_lyxrc.cursor_follows_scrollbar) {
1442 os << "\\cursor_follows_scrollbar "
1443 << convert<string>(cursor_follows_scrollbar) << '\n';
1445 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1446 if (ignore_system_lyxrc ||
1447 dialogs_iconify_with_main
1448 != system_lyxrc.dialogs_iconify_with_main) {
1449 os << "\\dialogs_iconify_with_main "
1450 << convert<string>(dialogs_iconify_with_main) << '\n';
1452 case RC_SCREEN_FONT_ROMAN:
1453 if (ignore_system_lyxrc ||
1454 roman_font_name != system_lyxrc.roman_font_name) {
1455 os << "\\screen_font_roman \"" << roman_font_name
1458 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1459 if (ignore_system_lyxrc ||
1460 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1461 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1464 case RC_SCREEN_FONT_SANS:
1465 if (ignore_system_lyxrc ||
1466 sans_font_name != system_lyxrc.sans_font_name) {
1467 os << "\\screen_font_sans \"" << sans_font_name
1470 case RC_SCREEN_FONT_SANS_FOUNDRY:
1471 if (ignore_system_lyxrc ||
1472 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1473 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1476 case RC_SCREEN_FONT_TYPEWRITER:
1477 if (ignore_system_lyxrc ||
1478 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1479 os << "\\screen_font_typewriter \""
1480 << typewriter_font_name << "\"\n";
1482 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1483 if (ignore_system_lyxrc ||
1484 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1485 os << "\\screen_font_typewriter_foundry \""
1486 << typewriter_font_foundry << "\"\n";
1489 case RC_SCREEN_FONT_SCALABLE:
1490 if (ignore_system_lyxrc ||
1491 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1492 os << "\\screen_font_scalable "
1493 << convert<string>(use_scalable_fonts)
1496 case RC_SCREEN_FONT_ENCODING:
1497 if (ignore_system_lyxrc ||
1498 font_norm != system_lyxrc.font_norm) {
1499 os << "\\screen_font_encoding \"" << font_norm
1502 case RC_SCREEN_FONT_SIZES:
1503 if (ignore_system_lyxrc ||
1504 font_sizes[LyXFont::SIZE_TINY]
1505 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1506 font_sizes[LyXFont::SIZE_SCRIPT]
1507 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1508 font_sizes[LyXFont::SIZE_FOOTNOTE]
1509 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1510 font_sizes[LyXFont::SIZE_SMALL]
1511 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1512 font_sizes[LyXFont::SIZE_NORMAL]
1513 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1514 font_sizes[LyXFont::SIZE_LARGE]
1515 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1516 font_sizes[LyXFont::SIZE_LARGER]
1517 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1518 font_sizes[LyXFont::SIZE_LARGEST]
1519 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1520 font_sizes[LyXFont::SIZE_HUGE]
1521 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1522 font_sizes[LyXFont::SIZE_HUGER]
1523 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1524 os.setf(ios::fixed);
1526 os << "\\screen_font_sizes"
1527 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1528 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1529 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1530 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1531 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1532 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1533 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1534 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1535 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1536 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1541 << "# COLOR SECTION ###################################\n"
1545 for (int i = 0; i < LColor::ignore; ++i) {
1546 LColor::color lc = static_cast<LColor::color>(i);
1548 string const col(lcolor.getX11Name(lc));
1549 if (ignore_system_lyxrc ||
1550 col != system_lcolor.getX11Name(lc)) {
1551 os << "\\set_color \""
1552 << lcolor.getLyXName(lc) << "\" \""
1558 << "# PRINTER SECTION ###################################\n"
1562 if (ignore_system_lyxrc ||
1563 printer != system_lyxrc.printer) {
1564 os << "\\printer \"" << printer << "\"\n";
1566 case RC_PRINT_ADAPTOUTPUT:
1567 if (ignore_system_lyxrc ||
1568 print_adapt_output != system_lyxrc.print_adapt_output) {
1569 os << "\\print_adapt_output "
1570 << convert<string>(print_adapt_output)
1573 case RC_PRINT_COMMAND:
1574 if (ignore_system_lyxrc ||
1575 print_command != system_lyxrc.print_command) {
1576 os << "\\print_command \"" << print_command << "\"\n";
1578 case RC_PRINTEXSTRAOPTIONS:
1579 if (ignore_system_lyxrc ||
1580 print_extra_options != system_lyxrc.print_extra_options) {
1581 os << "\\print_extra_options \"" << print_extra_options
1584 case RC_PRINTSPOOL_COMMAND:
1585 if (ignore_system_lyxrc ||
1586 print_spool_command != system_lyxrc.print_spool_command) {
1587 os << "\\print_spool_command \"" << print_spool_command
1590 case RC_PRINTSPOOL_PRINTERPREFIX:
1591 if (ignore_system_lyxrc ||
1592 print_spool_printerprefix
1593 != system_lyxrc.print_spool_printerprefix) {
1594 os << "\\print_spool_printerprefix \""
1595 << print_spool_printerprefix << "\"\n";
1597 case RC_PRINTEVENPAGEFLAG:
1598 if (ignore_system_lyxrc ||
1599 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1600 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1603 case RC_PRINTODDPAGEFLAG:
1604 if (ignore_system_lyxrc ||
1605 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1606 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1609 case RC_PRINTREVERSEFLAG:
1610 if (ignore_system_lyxrc ||
1611 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1612 os << "\\print_reverse_flag \"" << print_reverse_flag
1615 case RC_PRINTLANDSCAPEFLAG:
1616 if (ignore_system_lyxrc ||
1617 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1618 os << "\\print_landscape_flag \"" << print_landscape_flag
1621 case RC_PRINTPAGERANGEFLAG:
1622 if (ignore_system_lyxrc ||
1623 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1624 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1627 case RC_PRINTCOPIESFLAG:
1628 if (ignore_system_lyxrc ||
1629 print_copies_flag != system_lyxrc.print_copies_flag) {
1630 os << "\\print_copies_flag \"" << print_copies_flag
1633 case RC_PRINTCOLLCOPIESFLAG:
1634 if (ignore_system_lyxrc ||
1635 print_collcopies_flag
1636 != system_lyxrc.print_collcopies_flag) {
1637 os << "\\print_collcopies_flag \""
1638 << print_collcopies_flag
1641 case RC_PRINTPAPERFLAG:
1642 if (ignore_system_lyxrc ||
1643 print_paper_flag != system_lyxrc.print_paper_flag) {
1644 os << "\\print_paper_flag \"" << print_paper_flag
1647 case RC_PRINTPAPERDIMENSIONFLAG:
1648 if (ignore_system_lyxrc ||
1649 print_paper_dimension_flag
1650 != system_lyxrc.print_paper_dimension_flag) {
1651 os << "\\print_paper_dimension_flag \""
1652 << print_paper_dimension_flag << "\"\n";
1654 case RC_PRINTTOPRINTER:
1655 if (ignore_system_lyxrc ||
1656 print_to_printer != system_lyxrc.print_to_printer) {
1657 os << "\\print_to_printer \"" << print_to_printer
1660 case RC_PRINTTOFILE:
1661 if (ignore_system_lyxrc ||
1662 print_to_file != system_lyxrc.print_to_file) {
1663 os << "\\print_to_file \"" << print_to_file << "\"\n";
1665 case RC_PRINTFILEEXTENSION:
1666 if (ignore_system_lyxrc ||
1667 print_file_extension != system_lyxrc.print_file_extension) {
1668 os << "\\print_file_extension \""
1669 << print_file_extension
1674 << "# EXPORT SECTION ####################################\n"
1677 case RC_CUSTOM_EXPORT_COMMAND:
1678 if (ignore_system_lyxrc ||
1679 custom_export_command
1680 != system_lyxrc.custom_export_command) {
1681 os << "\\custom_export_command \""
1682 << custom_export_command
1685 case RC_CUSTOM_EXPORT_FORMAT:
1686 if (ignore_system_lyxrc ||
1687 custom_export_format
1688 != system_lyxrc.custom_export_format) {
1689 os << "\\custom_export_format \"" << custom_export_format
1694 << "# TEX SECTION #######################################\n"
1697 case RC_FONT_ENCODING:
1698 if (ignore_system_lyxrc ||
1699 fontenc != system_lyxrc.fontenc) {
1700 os << "\\font_encoding \"" << fontenc << "\"\n";
1704 << "# FILE SECTION ######################################\n"
1707 case RC_DOCUMENTPATH:
1708 if (ignore_system_lyxrc ||
1709 document_path != system_lyxrc.document_path) {
1710 os << "\\document_path \"" << document_path << "\"\n";
1713 if (ignore_system_lyxrc ||
1714 lastfiles != system_lyxrc.lastfiles) {
1715 os << "\\lastfiles \"" << lastfiles << "\"\n";
1717 case RC_NUMLASTFILES:
1718 if (ignore_system_lyxrc ||
1719 num_lastfiles != system_lyxrc.num_lastfiles) {
1720 os << "\\num_lastfiles " << num_lastfiles << '\n';
1722 case RC_CHECKLASTFILES:
1723 if (ignore_system_lyxrc ||
1724 check_lastfiles != system_lyxrc.check_lastfiles) {
1725 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
1728 case RC_TEMPLATEPATH:
1729 if (ignore_system_lyxrc ||
1730 template_path != system_lyxrc.template_path) {
1731 os << "\\template_path \"" << template_path << "\"\n";
1733 case RC_TEMPDIRPATH:
1734 if (ignore_system_lyxrc ||
1735 tempdir_path != system_lyxrc.tempdir_path) {
1736 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1740 case RC_ASCII_LINELEN:
1741 if (ignore_system_lyxrc ||
1742 ascii_linelen != system_lyxrc.ascii_linelen) {
1743 os << "\\ascii_linelen " << ascii_linelen << '\n';
1745 case RC_MAKE_BACKUP:
1746 if (ignore_system_lyxrc ||
1747 make_backup != system_lyxrc.make_backup) {
1748 os << "\\make_backup " << convert<string>(make_backup) << '\n';
1750 case RC_BACKUPDIR_PATH:
1751 if (ignore_system_lyxrc ||
1752 backupdir_path != system_lyxrc.backupdir_path) {
1753 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1757 << "# ASCII EXPORT SECTION ##############################\n"
1760 case RC_ASCIIROFF_COMMAND:
1761 if (ignore_system_lyxrc ||
1762 ascii_roff_command != system_lyxrc.ascii_roff_command) {
1763 os << "\\ascii_roff_command \"" << ascii_roff_command
1768 << "# SPELLCHECKER SECTION ##############################\n"
1770 case RC_USE_SPELL_LIB:
1771 if (ignore_system_lyxrc ||
1772 use_spell_lib != system_lyxrc.use_spell_lib) {
1773 os << "\\use_spell_lib " << convert<string>(use_spell_lib) << '\n';
1775 case RC_SPELL_COMMAND:
1776 if (ignore_system_lyxrc ||
1777 isp_command != system_lyxrc.isp_command) {
1778 os << "\\spell_command \"" << isp_command << "\"\n";
1780 case RC_ACCEPT_COMPOUND:
1781 if (ignore_system_lyxrc ||
1782 isp_accept_compound != system_lyxrc.isp_accept_compound) {
1783 os << "\\accept_compound " << convert<string>(isp_accept_compound)
1786 case RC_USE_ALT_LANG:
1787 if (ignore_system_lyxrc ||
1788 isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1789 os << "\\use_alt_language " << convert<string>(isp_use_alt_lang)
1793 if (ignore_system_lyxrc ||
1794 isp_alt_lang != system_lyxrc.isp_alt_lang) {
1795 os << "\\alternate_language \"" << isp_alt_lang
1798 case RC_USE_ESC_CHARS:
1799 if (ignore_system_lyxrc ||
1800 isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1801 os << "\\use_escape_chars " << convert<string>(isp_use_esc_chars)
1805 if (ignore_system_lyxrc ||
1806 isp_esc_chars != system_lyxrc.isp_esc_chars) {
1807 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1809 case RC_USE_PERS_DICT:
1810 if (ignore_system_lyxrc ||
1811 isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1812 os << "\\use_personal_dictionary "
1813 << convert<string>(isp_use_pers_dict)
1817 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1818 os << "\\personal_dictionary \"" << isp_pers_dict
1821 case RC_USE_INP_ENC:
1822 if (ignore_system_lyxrc ||
1823 isp_use_input_encoding
1824 != system_lyxrc.isp_use_input_encoding) {
1825 os << "\\use_input_encoding "
1826 << convert<string>(isp_use_input_encoding)
1831 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1834 case RC_RTL_SUPPORT:
1835 if (ignore_system_lyxrc ||
1836 rtl_support != system_lyxrc.rtl_support) {
1837 os << "\\rtl " << convert<string>(rtl_support) << '\n';
1839 case RC_LANGUAGE_PACKAGE:
1840 if (ignore_system_lyxrc ||
1841 language_package != system_lyxrc.language_package) {
1842 os << "\\language_package \"" << language_package
1845 case RC_LANGUAGE_GLOBAL_OPTIONS:
1846 if (ignore_system_lyxrc ||
1847 language_global_options
1848 != system_lyxrc.language_global_options) {
1849 os << "\\language_global_options \""
1850 << convert<string>(language_global_options)
1853 case RC_LANGUAGE_USE_BABEL:
1854 if (ignore_system_lyxrc ||
1855 language_use_babel != system_lyxrc.language_use_babel) {
1856 os << "\\language_use_babel \""
1857 << convert<string>(language_use_babel)
1860 case RC_LANGUAGE_COMMAND_BEGIN:
1861 if (ignore_system_lyxrc ||
1862 language_command_begin
1863 != system_lyxrc.language_command_begin) {
1864 os << "\\language_command_begin \""
1865 << language_command_begin
1868 case RC_LANGUAGE_COMMAND_END:
1869 if (ignore_system_lyxrc ||
1870 language_command_end
1871 != system_lyxrc.language_command_end) {
1872 os << "\\language_command_end \"" << language_command_end
1875 case RC_LANGUAGE_COMMAND_LOCAL:
1876 if (ignore_system_lyxrc ||
1877 language_command_local
1878 != system_lyxrc.language_command_local) {
1879 os << "\\language_command_local \""
1880 << language_command_local
1883 case RC_LANGUAGE_AUTO_BEGIN:
1884 if (ignore_system_lyxrc ||
1885 language_auto_begin != system_lyxrc.language_auto_begin) {
1886 os << "\\language_auto_begin "
1887 << convert<string>(language_auto_begin) << '\n';
1889 case RC_LANGUAGE_AUTO_END:
1890 if (ignore_system_lyxrc ||
1891 language_auto_end != system_lyxrc.language_auto_end) {
1892 os << "\\language_auto_end "
1893 << convert<string>(language_auto_end) << '\n';
1895 case RC_MARK_FOREIGN_LANGUAGE:
1896 if (ignore_system_lyxrc ||
1897 mark_foreign_language
1898 != system_lyxrc.mark_foreign_language) {
1899 os << "\\mark_foreign_language " <<
1900 convert<string>(mark_foreign_language) << '\n';
1904 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1907 case RC_AUTO_NUMBER:
1908 if (ignore_system_lyxrc ||
1909 auto_number != system_lyxrc.auto_number) {
1910 os << "\\auto_number " << convert<string>(auto_number) << '\n';
1912 case RC_DEFAULT_LANGUAGE:
1913 if (ignore_system_lyxrc ||
1914 default_language != system_lyxrc.default_language) {
1915 os << "\\default_language " << default_language << '\n';
1919 << "# FORMATS SECTION ##########################\n"
1923 // New/modifed formats
1924 for (Formats::const_iterator cit = formats.begin();
1925 cit != formats.end(); ++cit) {
1926 Format const * format =
1927 system_formats.getFormat(cit->name());
1929 format->extension() != cit->extension() ||
1930 format->prettyname() != cit->prettyname() ||
1931 format->shortcut() != cit->shortcut() ||
1932 format->viewer() != cit->viewer() ||
1933 format->editor() != cit->editor())
1934 os << "\\format \"" << cit->name() << "\" \""
1935 << cit->extension() << "\" \""
1936 << cit->prettyname() << "\" \""
1937 << cit->shortcut() << "\" \""
1938 << cit->viewer() << "\" \""
1939 << cit->editor() << "\"\n";
1942 // Look for deleted formats
1943 for (Formats::const_iterator cit = system_formats.begin();
1944 cit != system_formats.end(); ++cit)
1945 if (!formats.getFormat(cit->name()))
1946 os << "\\format \"" << cit->name()
1947 << "\" \"\" \"\" \"\" \"\" \"\"\n";
1952 << "# CONVERTERS SECTION ##########################\n"
1956 // Look for new converters
1957 for (Converters::const_iterator cit = converters.begin();
1958 cit != converters.end(); ++cit) {
1959 Converter const * converter =
1960 system_converters.getConverter(cit->from,
1963 converter->command != cit->command ||
1964 converter->flags != cit->flags)
1965 os << "\\converter \"" << cit->from << "\" \""
1966 << cit->to << "\" \""
1967 << cit->command << "\" \""
1968 << cit->flags << "\"\n";
1971 // New/modifed converters
1972 for (Converters::const_iterator cit = system_converters.begin();
1973 cit != system_converters.end(); ++cit)
1974 if (!converters.getConverter(cit->from, cit->to))
1975 os << "\\converter \"" << cit->from
1976 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1980 << "# COPIERS SECTION ##########################\n"
1983 // Look for new movers
1984 Movers::iterator const sysbegin = system_movers.begin();
1985 Movers::iterator const sysend = system_movers.end();
1987 for (Movers::iterator it = movers.begin(), end = movers.end();
1989 Movers::iterator const sysit =
1990 std::find_if(sysbegin, sysend, SameMover(*it));
1991 if (sysit == sysend) {
1992 std::string const & fmt = it->first;
1993 std::string const & command =
1994 it->second.command();
1996 os << "\\copier " << fmt
1997 << " \"" << command << "\"\n";
2001 // We don't actually delete SpecialisedMover(s) from the
2002 // map, just clear their 'command', so there's no need
2003 // to test for anything else.
2009 void LyXRC::set_font_norm_type()
2011 if (font_norm == "iso10646-1")
2012 font_norm_type = ISO_10646_1;
2013 else if (font_norm == "iso8859-1")
2014 font_norm_type = ISO_8859_1;
2015 else if (font_norm == "iso8859-3")
2016 font_norm_type = ISO_8859_3;
2017 else if (font_norm == "iso8859-4")
2018 font_norm_type = ISO_8859_4;
2019 else if (font_norm == "iso8859-6.8x")
2020 font_norm_type = ISO_8859_6_8;
2021 else if (font_norm == "iso8859-9")
2022 font_norm_type = ISO_8859_9;
2023 else if (font_norm == "iso8859-15")
2024 font_norm_type = ISO_8859_15;
2026 font_norm_type = OTHER_ENCODING;
2030 string const LyXRC::getDescription(LyXRCTags tag)
2035 case RC_ACCEPT_COMPOUND:
2036 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2040 case RC_USE_ALT_LANG:
2041 str = _("Specify an alternate language. The default is to use the language of the document.");
2044 case RC_ASCIIROFF_COMMAND:
2045 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.");
2048 case RC_ASCII_LINELEN:
2049 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2052 case RC_AUTOREGIONDELETE:
2053 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2056 case RC_AUTORESET_OPTIONS:
2057 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2061 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2064 case RC_AUTO_NUMBER:
2067 case RC_BACKUPDIR_PATH:
2068 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.");
2071 case RC_BIBTEX_COMMAND:
2072 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2076 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2079 case RC_CHECKLASTFILES:
2080 str = _("Select to check whether the lastfiles still exist.");
2083 case RC_CHKTEX_COMMAND:
2084 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2093 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2094 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.");
2097 case RC_CUSTOM_EXPORT_COMMAND:
2100 case RC_CUSTOM_EXPORT_FORMAT:
2103 case RC_CYGWIN_PATH_FIX:
2106 case RC_DATE_INSERT_FORMAT:
2107 //xgettext:no-c-format
2108 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2111 case RC_DEFAULT_LANGUAGE:
2112 str = _("New documents will be assigned this language.");
2115 case RC_DEFAULT_PAPERSIZE:
2116 str = _("Specify the default paper size.");
2119 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2120 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2123 case RC_DISPLAY_GRAPHICS:
2124 str = _("Select how LyX will display any graphics.");
2127 case RC_DOCUMENTPATH:
2128 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2132 case RC_USE_ESC_CHARS:
2133 str = _("Specify additional chars that can be part of a word.");
2136 case RC_FONT_ENCODING:
2137 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
2143 case RC_INDEX_COMMAND:
2144 str = _("Define the options of makeindex (cf. man makeindex) or select an alternative compiler. E.g., using xindy/make-rules, the command string would be \"makeindex.sh -m $$lang\".");
2151 case RC_KBMAP_PRIMARY:
2152 case RC_KBMAP_SECONDARY:
2153 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.");
2156 case RC_LABEL_INIT_LENGTH:
2157 str = _("Maximum number of words in the initialization string for a new label");
2160 case RC_LANGUAGE_AUTO_BEGIN:
2161 str = _("Select if a language switching command is needed at the beginning of the document.");
2164 case RC_LANGUAGE_AUTO_END:
2165 str = _("Select if a language switching command is needed at the end of the document.");
2168 case RC_LANGUAGE_COMMAND_BEGIN:
2169 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.");
2172 case RC_LANGUAGE_COMMAND_END:
2173 str = _("The LaTeX command for changing back to the language of the document.");
2176 case RC_LANGUAGE_COMMAND_LOCAL:
2177 str = _("The LaTeX command for local changing of the language.");
2180 case RC_LANGUAGE_GLOBAL_OPTIONS:
2181 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2184 case RC_LANGUAGE_PACKAGE:
2185 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2188 case RC_LANGUAGE_USE_BABEL:
2189 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2193 str = _("The file where the last-files information should be stored.");
2196 case RC_MAKE_BACKUP:
2197 str = _("De-select if you don't want LyX to create backup files.");
2200 case RC_MARK_FOREIGN_LANGUAGE:
2201 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2204 case RC_NUMLASTFILES:
2205 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."), maxlastfiles);
2208 case RC_PATH_PREFIX:
2209 str = _("Specify those directories which should be "
2210 "prepended to the PATH environment variable. "
2211 "Use the OS native format.");
2215 case RC_USE_PERS_DICT:
2216 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2219 case RC_POPUP_BOLD_FONT:
2220 str = _("The bold font in the dialogs.");
2223 case RC_POPUP_FONT_ENCODING:
2224 str = _("The encoding for the menu/popups fonts.");
2227 case RC_POPUP_NORMAL_FONT:
2228 str = _("The normal font in the dialogs.");
2232 str = _("Shows a typeset preview of things such as math");
2235 case RC_PREVIEW_HASHED_LABELS:
2236 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2239 case RC_PREVIEW_SCALE_FACTOR:
2240 str = _("Scale the preview size to suit.");
2243 case RC_PRINTCOLLCOPIESFLAG:
2244 str = _("The option for specifying whether the copies should be collated.");
2247 case RC_PRINTCOPIESFLAG:
2248 str = _("The option for specifying the number of copies to print.");
2252 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
2255 case RC_PRINTEVENPAGEFLAG:
2256 str = _("The option to print only even pages.");
2259 case RC_PRINTEXSTRAOPTIONS:
2260 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2263 case RC_PRINTFILEEXTENSION:
2264 str = _("Extension of printer program output file. Usually \".ps\".");
2267 case RC_PRINTLANDSCAPEFLAG:
2268 str = _("The option to print out in landscape.");
2271 case RC_PRINTODDPAGEFLAG:
2272 str = _("The option to print only odd pages.");
2275 case RC_PRINTPAGERANGEFLAG:
2276 str = _("The option for specifying a comma-separated list of pages to print.");
2279 case RC_PRINTPAPERDIMENSIONFLAG:
2280 str = _("Option to specify the dimensions of the print paper.");
2283 case RC_PRINTPAPERFLAG:
2284 str = _("The option to specify paper type.");
2287 case RC_PRINTREVERSEFLAG:
2288 str = _("The option to reverse the order of the pages printed.");
2291 case RC_PRINTSPOOL_COMMAND:
2292 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.");
2295 case RC_PRINTSPOOL_PRINTERPREFIX:
2296 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.");
2299 case RC_PRINTTOFILE:
2300 str = _("Option to pass to the print program to print to a file.");
2303 case RC_PRINTTOPRINTER:
2304 str = _("Option to pass to the print program to print on a specific printer.");
2307 case RC_PRINT_ADAPTOUTPUT:
2308 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2311 case RC_PRINT_COMMAND:
2312 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
2315 case RC_RTL_SUPPORT:
2316 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2320 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2323 case RC_SCREEN_FONT_ENCODING:
2324 str = _("The encoding for the screen fonts.");
2327 case RC_SCREEN_FONT_ROMAN:
2328 case RC_SCREEN_FONT_SANS:
2329 case RC_SCREEN_FONT_TYPEWRITER:
2330 str = _("The screen fonts used to display the text while editing.");
2333 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
2334 case RC_SCREEN_FONT_SANS_FOUNDRY:
2335 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2338 case RC_SCREEN_FONT_SCALABLE:
2339 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.");
2342 case RC_SCREEN_FONT_SIZES:
2343 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2346 case RC_SCREEN_ZOOM:
2347 //xgettext:no-c-format
2348 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2352 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2358 case RC_SHOW_BANNER:
2359 str = _("De-select if you don't want the startup banner.");
2362 case RC_SPELL_COMMAND:
2363 str = _("What command runs the spell checker?");
2366 case RC_TEMPDIRPATH:
2367 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2370 case RC_TEMPLATEPATH:
2371 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2375 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2387 case RC_USE_INP_ENC:
2388 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.");
2391 case RC_USE_SPELL_LIB:
2394 case RC_VIEWDVI_PAPEROPTION:
2395 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2402 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2412 // The global instance
2415 // The global copy of the system lyxrc entries (everything except preferences)