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"
33 #include "graphics/GraphicsTypes.h"
35 #include "support/filetools.h"
36 #include "support/lstrings.h"
37 #include "support/tostr.h"
38 #include "support/userinfo.h"
40 using lyx::support::ascii_lowercase;
41 using lyx::support::bformat;
42 using lyx::support::ExpandPath;
43 using lyx::support::GetEnv;
44 using lyx::support::LibFileSearch;
45 using lyx::support::token;
58 // when adding something to this array keep it sorted!
59 keyword_item lyxrcTags[] = {
60 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
61 { "\\alternate_language", LyXRC::RC_ALT_LANG },
62 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
63 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
64 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
65 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
66 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
67 { "\\autosave", LyXRC::RC_AUTOSAVE },
68 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
69 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
70 { "\\bind_file", LyXRC::RC_BINDFILE },
71 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
72 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
73 { "\\converter", LyXRC::RC_CONVERTER },
74 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
75 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
76 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
77 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
78 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
79 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
80 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
81 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
82 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
83 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
84 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
85 { "\\format", LyXRC::RC_FORMAT },
86 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
87 { "\\input", LyXRC::RC_INPUT },
88 { "\\kbmap", LyXRC::RC_KBMAP },
89 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
90 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
91 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
92 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
93 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
94 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
95 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
96 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
97 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
98 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
99 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
100 { "\\lastfiles", LyXRC::RC_LASTFILES },
101 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
102 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
103 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
104 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
105 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
106 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
107 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
108 { "\\preview", LyXRC::RC_PREVIEW },
109 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
110 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
111 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
112 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
113 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
114 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
115 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
116 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
117 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
118 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
119 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
120 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
121 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
122 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
123 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
124 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
125 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
126 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
127 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
128 { "\\printer", LyXRC::RC_PRINTER },
129 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
130 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
131 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
132 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
133 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
134 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
135 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
136 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
137 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
138 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
139 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
140 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
141 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
142 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
143 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
144 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
145 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
146 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
147 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
148 { "\\set_color", LyXRC::RC_SET_COLOR },
149 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
150 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
151 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
152 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
153 { "\\ui_file", LyXRC::RC_UIFILE },
154 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
155 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
156 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
157 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
158 // compatibility with versions older than 1.4.0 only
159 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
160 { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
161 // compatibility with versions older than 1.4.0 only
162 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
163 { "\\user_email", LyXRC::RC_USER_EMAIL },
164 { "\\user_name", LyXRC::RC_USER_NAME },
165 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
166 // compatibility with versions older than 1.4.0 only
167 { "\\viewer" ,LyXRC::RC_VIEWER},
168 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
171 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
182 void LyXRC::setDefaults() {
185 // Get printer from the environment. If fail, use default "",
186 // assuming that everything is set up correctly.
187 printer = GetEnv("PRINTER");
188 print_adapt_output = false;
189 print_command = "dvips";
190 print_evenpage_flag = "-B";
191 print_oddpage_flag = "-A";
192 print_pagerange_flag = "-pp";
193 print_copies_flag = "-c";
194 print_collcopies_flag = "-C";
195 print_reverse_flag = "-r";
196 print_landscape_flag = "-t landscape";
197 print_to_printer = "-P";
198 print_to_file = "-o ";
199 print_file_extension = ".ps";
200 print_paper_flag = "-t";
201 print_paper_dimension_flag = "-T";
202 document_path.erase();
203 tempdir_path = "/tmp";
204 view_dvi_paper_option.erase();
205 default_papersize = PAPER_USLETTER;
206 custom_export_format = "ps";
207 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
208 bibtex_command = "bibtex";
210 index_command = "makeindex -c -q";
212 // Because a screen typically is wider than a piece of paper:
215 // Default LaTeX font size:
216 font_sizes[LyXFont::SIZE_TINY] = 5.0;
217 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
218 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
219 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
220 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
221 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
222 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
223 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
224 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
225 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
226 use_scalable_fonts = true;
227 roman_font_name = "";
229 typewriter_font_name = "";
230 popup_bold_font = "-*-helvetica-bold-r";
231 popup_normal_font = "-*-helvetica-medium-r";
232 font_norm = "iso8859-1";
233 font_norm_type = ISO_8859_1;
234 popup_font_encoding.erase();
236 auto_region_delete = true;
237 auto_reset_options = false;
239 num_lastfiles = maxlastfiles;
240 check_lastfiles = true;
242 backupdir_path.erase();
243 display_graphics = lyx::graphics::ColorDisplay;
244 // Spellchecker settings:
245 use_spell_lib = true;
246 isp_command = "ispell";
247 isp_accept_compound = false;
248 isp_use_input_encoding = false;
249 isp_use_alt_lang = false;
250 isp_use_pers_dict = false;
251 isp_use_esc_chars = false;
255 mark_foreign_language = true;
256 language_auto_begin = true;
257 language_auto_end = true;
258 language_global_options = true;
259 language_use_babel = true;
260 language_package = "\\usepackage{babel}";
261 language_command_begin = "\\selectlanguage{$$lang}";
262 language_command_local = "\\foreignlanguage{$$lang}{";
263 default_language = "english";
267 date_insert_format = "%A, %e %B %Y";
268 cursor_follows_scrollbar = false;
269 dialogs_iconify_with_main = false;
270 label_init_length = 3;
271 preview = PREVIEW_OFF;
272 preview_hashed_labels = false;
273 preview_scale_factor = 0.9;
275 user_name = lyx::support::user_name();
277 user_email = lyx::support::user_email();
283 void oldFontFormat(string & family, string & foundry)
285 if (family.empty() || family[0] != '-')
287 foundry = token(family, '-', 1);
288 family = token(family, '-', 2);
296 int LyXRC::read(string const & filename)
298 LyXLex lexrc(lyxrcTags, lyxrcCount);
299 if (lyxerr.debugging(Debug::PARSER))
300 lexrc.printTable(lyxerr);
302 lexrc.setFile(filename);
303 if (!lexrc.isOK()) return -2;
305 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
311 int LyXRC::read(std::istream & is)
313 LyXLex lexrc(lyxrcTags, lyxrcCount);
314 if (lyxerr.debugging(Debug::PARSER))
315 lexrc.printTable(lyxerr);
318 if (!lexrc.isOK()) return -2;
320 lyxerr[Debug::LYXRC] << "Reading istream..." << endl;
326 int LyXRC::read(LyXLex & lexrc)
328 if (!lexrc.isOK()) return -2;
330 while (lexrc.isOK()) {
331 // By using two switches we take advantage of the compiler
332 // telling us if we have missed a LyXRCTags element in
333 // the second switch.
334 // Note that this also shows a problem with LyXLex since it
335 // helps us avoid taking advantage of the strictness of the
338 int le = lexrc.lex();
340 case LyXLex::LEX_UNDEF:
341 lexrc.printError("Unknown tag `$$Token'");
343 case LyXLex::LEX_FEOF:
347 switch (static_cast<LyXRCTags>(le)) {
348 case RC_INPUT: // Include file
351 LibFileSearch(string(),
354 lexrc.printError("Error reading "
355 "included file: "+tmp);
359 case RC_BINDFILE: // RVDK_PATCH_5
361 bind_file = lexrc.getString();
367 ui_file = lexrc.getString();
371 case RC_AUTORESET_OPTIONS:
373 auto_reset_options = lexrc.getBool();
377 case RC_DISPLAY_GRAPHICS:
379 display_graphics = lyx::graphics::displayTranslator().find(lexrc.getString());
385 use_kbmap = lexrc.getBool();
389 case RC_KBMAP_PRIMARY:
391 string const kmap(lexrc.getString());
394 } else if (!LibFileSearch("kbd", kmap,
396 primary_kbmap = kmap;
398 lexrc.printError("LyX: Keymap `$$Token' not found");
403 case RC_KBMAP_SECONDARY:
405 string const kmap(lexrc.getString());
408 } else if (!LibFileSearch("kbd", kmap,
410 secondary_kbmap = kmap;
412 lexrc.printError("LyX: Keymap `$$Token' not found");
417 case RC_FONT_ENCODING:
419 fontenc = lexrc.getString();
425 printer = lexrc.getString();
429 case RC_PRINT_COMMAND:
431 print_command = lexrc.getString();
435 case RC_PRINTEVENPAGEFLAG:
437 print_evenpage_flag = lexrc.getString();
441 case RC_PRINTODDPAGEFLAG:
443 print_oddpage_flag = lexrc.getString();
447 case RC_PRINTPAGERANGEFLAG:
449 print_pagerange_flag = lexrc.getString();
453 case RC_PRINTCOPIESFLAG:
455 print_copies_flag = lexrc.getString();
459 case RC_PRINTCOLLCOPIESFLAG:
461 print_collcopies_flag = lexrc.getString();
465 case RC_PRINTREVERSEFLAG:
467 print_reverse_flag = lexrc.getString();
471 case RC_PRINTLANDSCAPEFLAG:
473 print_landscape_flag = lexrc.getString();
477 case RC_PRINTTOPRINTER:
479 print_to_printer = lexrc.getString();
483 case RC_PRINT_ADAPTOUTPUT:
485 print_adapt_output = lexrc.getBool();
491 print_to_file = lexrc.getString();
495 case RC_PRINTFILEEXTENSION:
497 print_file_extension = lexrc.getString();
501 case RC_PRINTEXSTRAOPTIONS:
503 print_extra_options = lexrc.getString();
507 case RC_PRINTSPOOL_COMMAND:
509 print_spool_command = lexrc.getString();
513 case RC_PRINTSPOOL_PRINTERPREFIX:
515 print_spool_printerprefix = lexrc.getString();
519 case RC_PRINTPAPERDIMENSIONFLAG:
521 print_paper_dimension_flag = lexrc.getString();
525 case RC_PRINTPAPERFLAG:
527 print_paper_flag = lexrc.getString();
531 case RC_CUSTOM_EXPORT_COMMAND:
533 custom_export_command = lexrc.getString();
537 case RC_CUSTOM_EXPORT_FORMAT:
539 custom_export_format = lexrc.getString();
543 case RC_DEFAULT_PAPERSIZE:
546 ascii_lowercase(lexrc.getString());
547 if (size == "usletter")
550 else if (size == "legal")
553 else if (size == "executive")
555 PAPER_EXECUTIVEPAPER;
556 else if (size == "a3")
559 else if (size == "a4")
562 else if (size == "a5")
565 else if (size == "b5")
571 case RC_VIEWDVI_PAPEROPTION:
573 view_dvi_paper_option = lexrc.getString();
575 view_dvi_paper_option.erase();
579 case RC_CHKTEX_COMMAND:
581 chktex_command = lexrc.getString();
585 case RC_BIBTEX_COMMAND:
587 bibtex_command = lexrc.getString();
591 case RC_INDEX_COMMAND:
593 index_command = lexrc.getString();
599 dpi = lexrc.getInteger();
605 zoom = lexrc.getInteger();
611 wheel_jump = lexrc.getInteger();
615 case RC_SCREEN_FONT_SIZES:
617 font_sizes[LyXFont::SIZE_TINY] =
621 font_sizes[LyXFont::SIZE_SCRIPT] =
625 font_sizes[LyXFont::SIZE_FOOTNOTE] =
629 font_sizes[LyXFont::SIZE_SMALL] =
633 font_sizes[LyXFont::SIZE_NORMAL] =
637 font_sizes[LyXFont::SIZE_LARGE] =
641 font_sizes[LyXFont::SIZE_LARGER] =
645 font_sizes[LyXFont::SIZE_LARGEST] =
649 font_sizes[LyXFont::SIZE_HUGE] =
653 font_sizes[LyXFont::SIZE_HUGER] =
658 case RC_SCREEN_FONT_SCALABLE:
660 use_scalable_fonts = lexrc.getBool();
666 autosave = lexrc.getInteger();
670 case RC_DOCUMENTPATH:
672 document_path = ExpandPath(lexrc.getString());
676 case RC_TEMPLATEPATH:
678 template_path = ExpandPath(lexrc.getString());
684 tempdir_path = ExpandPath(lexrc.getString());
690 lyxerr << "Ignoring obsolete use_tempdir flag." << endl;
696 lastfiles = ExpandPath(lexrc.getString());
700 case RC_NUMLASTFILES:
702 num_lastfiles = lexrc.getInteger();
706 case RC_CHECKLASTFILES:
708 check_lastfiles = lexrc.getBool();
712 case RC_SCREEN_FONT_ROMAN:
714 roman_font_name = lexrc.getString();
715 oldFontFormat(roman_font_name,
720 case RC_SCREEN_FONT_SANS:
722 sans_font_name = lexrc.getString();
723 oldFontFormat(sans_font_name, sans_font_foundry);
727 case RC_SCREEN_FONT_TYPEWRITER:
729 typewriter_font_name = lexrc.getString();
730 oldFontFormat(typewriter_font_name,
731 typewriter_font_foundry);
735 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
737 roman_font_foundry = lexrc.getString();
741 case RC_SCREEN_FONT_SANS_FOUNDRY:
743 sans_font_foundry = lexrc.getString();
747 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
749 typewriter_font_foundry = lexrc.getString();
753 case RC_SCREEN_FONT_ENCODING:
755 font_norm = lexrc.getString();
756 set_font_norm_type();
760 case RC_POPUP_BOLD_FONT:
762 popup_bold_font = lexrc.getString();
766 case RC_POPUP_NORMAL_FONT:
768 popup_normal_font = lexrc.getString();
772 case RC_POPUP_FONT_ENCODING:
774 popup_font_encoding = lexrc.getString();
780 string lyx_name, x11_name;
783 lyx_name = lexrc.getString();
785 lexrc.printError("Missing color tag.");
790 x11_name = lexrc.getString();
792 lexrc.printError("Missing color name for color: `$$Token'");
796 LColor::color const col =
797 lcolor.getFromLyXName(lyx_name);
798 if (col == LColor::none ||
799 col == LColor::inherit ||
800 col == LColor::ignore)
803 if (!lcolor.setColor(col, x11_name)) {
804 lyxerr << "Bad lyxrc set_color for "
810 case RC_AUTOREGIONDELETE:
811 // Auto region delete defaults to true
813 auto_region_delete = lexrc.getBool();
819 lyxpipes = ExpandPath(lexrc.getString());
823 case RC_CURSOR_FOLLOWS_SCROLLBAR:
825 cursor_follows_scrollbar = lexrc.getBool();
829 case RC_DIALOGS_ICONIFY_WITH_MAIN:
831 dialogs_iconify_with_main = lexrc.getBool();
835 case RC_ASCIIROFF_COMMAND:
837 ascii_roff_command = lexrc.getString();
840 case RC_ASCII_LINELEN:
842 ascii_linelen = lexrc.getInteger();
845 // Spellchecker settings:
846 case RC_USE_SPELL_LIB:
848 use_spell_lib = lexrc.getBool();
851 case RC_SPELL_COMMAND:
853 isp_command = lexrc.getString();
856 case RC_ACCEPT_COMPOUND:
858 isp_accept_compound = lexrc.getBool();
863 isp_use_input_encoding = lexrc.getBool();
866 case RC_USE_ALT_LANG:
868 isp_use_alt_lang = lexrc.getBool();
871 case RC_USE_PERS_DICT:
873 isp_use_pers_dict = lexrc.getBool();
876 case RC_USE_ESC_CHARS:
878 isp_use_esc_chars = lexrc.getBool();
883 isp_alt_lang = lexrc.getString();
888 isp_pers_dict = lexrc.getString();
893 isp_esc_chars = lexrc.getString();
898 make_backup = lexrc.getBool();
901 case RC_BACKUPDIR_PATH:
903 backupdir_path = ExpandPath(lexrc.getString());
906 case RC_DATE_INSERT_FORMAT:
908 date_insert_format = lexrc.getString();
911 case RC_LANGUAGE_PACKAGE:
913 language_package = lexrc.getString();
916 case RC_LANGUAGE_AUTO_BEGIN:
918 language_auto_begin = lexrc.getBool();
921 case RC_LANGUAGE_AUTO_END:
923 language_auto_end = lexrc.getBool();
926 case RC_LANGUAGE_GLOBAL_OPTIONS:
928 language_global_options = lexrc.getBool();
931 case RC_LANGUAGE_USE_BABEL:
933 language_use_babel = lexrc.getBool();
936 case RC_LANGUAGE_COMMAND_BEGIN:
938 language_command_begin = lexrc.getString();
941 case RC_LANGUAGE_COMMAND_END:
943 language_command_end = lexrc.getString();
946 case RC_LANGUAGE_COMMAND_LOCAL:
948 language_command_local = lexrc.getString();
953 rtl_support = lexrc.getBool();
958 auto_number = lexrc.getBool();
961 case RC_MARK_FOREIGN_LANGUAGE:
963 mark_foreign_language = lexrc.getBool();
968 string from, to, command, flags;
970 from = lexrc.getString();
973 to = lexrc.getString();
976 command = lexrc.getString();
979 flags = lexrc.getString();
982 || token(command, ' ', 0) == "none") {
983 converters.erase(from, to);
985 converters.add(from, to, command, flags);
989 // compatibility with versions older than 1.4.0 only
991 string format, command;
993 format = lexrc.getString();
996 command = lexrc.getString();
997 if (token(command, ' ', 0) == "none")
1000 formats.setViewer(format, command);
1004 string format, extension, prettyname, shortcut;
1006 format = lexrc.getString();
1009 extension = lexrc.getString();
1012 prettyname = lexrc.getString();
1015 shortcut = lexrc.getString();
1017 string viewer, editor;
1018 // Hack to ensure compatibility with versions older
1020 int le = lexrc.lex();
1021 if (le != LyXLex::LEX_FEOF && le != LyXLex::LEX_UNDEF) {
1022 viewer = lexrc.getString();
1023 if (le == LyXLex::LEX_DATA) {
1024 if (token(viewer, ' ', 0) == "none")
1027 editor = lexrc.getString();
1028 if (token(editor, ' ', 0) == "none")
1032 // We have got a known token.
1033 // Therefore this is an old style
1034 // format definition without
1035 // viewer and editor.
1036 lexrc.pushToken(viewer);
1040 if (prettyname.empty()) {
1041 if (converters.formatIsUsed(format)) {
1042 lyxerr << "Can't delete format "
1045 formats.erase(format);
1048 formats.add(format, extension, prettyname,
1049 shortcut, viewer, editor);
1053 case RC_DEFAULT_LANGUAGE:
1055 default_language = lexrc.getString();
1059 case RC_LABEL_INIT_LENGTH:
1061 label_init_length = lexrc.getInteger();
1065 case RC_SHOW_BANNER:
1067 show_banner = lexrc.getBool();
1073 string const tmp = lexrc.getString();
1074 if (tmp == "true" || tmp == "on")
1075 preview = PREVIEW_ON;
1076 else if (tmp == "no_math")
1077 preview = PREVIEW_NO_MATH;
1079 preview = PREVIEW_OFF;
1080 if (tmp != "false" && tmp != "off")
1081 lyxerr << "Unrecognized "
1083 << tmp << '\n' << endl;
1088 case RC_PREVIEW_HASHED_LABELS:
1090 preview_hashed_labels = lexrc.getBool();
1094 case RC_PREVIEW_SCALE_FACTOR:
1096 preview_scale_factor = lexrc.getFloat();
1102 user_name = lexrc.getString();
1107 user_email = lexrc.getString();
1110 case RC_LAST: break; // this is just a dummy
1114 /// Update converters data-structures
1115 converters.update(formats);
1116 converters.buildGraph();
1122 void LyXRC::write(string const & filename, bool ignore_system_lyxrc) const
1124 ofstream ofs(filename.c_str());
1126 write(ofs, ignore_system_lyxrc);
1130 void LyXRC::print() const
1132 if (lyxerr.debugging())
1133 write(lyxerr, false);
1139 void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
1141 os << "### This file is part of\n"
1142 << "### ========================================================\n"
1143 << "### LyX, The Document Processor\n"
1145 << "### Copyright 1995 Matthias Ettrich\n"
1146 << "### Copyright 1995-2001 The LyX Team.\n"
1148 << "### ========================================================\n"
1150 << "# This file is written by LyX, if you want to make your own\n"
1151 << "# modifications you should do them from inside LyX and save\n"
1154 // Why the switch you might ask. It is a trick to ensure that all
1155 // the elements in the LyXRCTags enum is handled. As you can see
1156 // there are no breaks at all. So it is just a huge fall-through.
1157 // The nice thing is that we will get a warning from the compiler
1158 // if we forget an element.
1159 LyXRCTags tag = RC_LAST;
1163 // input/include files are not done here
1165 if (ignore_system_lyxrc ||
1166 bind_file != system_lyxrc.bind_file) {
1167 os << "\\bind_file " << bind_file << "\n";
1173 << "# MISC SECTION ######################################\n"
1176 // bind files are not done here.
1178 if (ignore_system_lyxrc ||
1179 ui_file != system_lyxrc.ui_file) {
1180 os << "\\ui_file \"" << ui_file << "\"\n";
1182 case RC_AUTOREGIONDELETE:
1183 if (ignore_system_lyxrc ||
1184 auto_region_delete != system_lyxrc.auto_region_delete) {
1185 os << "# Set to false to inhibit automatic replacement of\n"
1186 << "# the current selection.\n"
1187 << "\\auto_region_delete " << tostr(auto_region_delete)
1190 case RC_AUTORESET_OPTIONS:
1191 if (ignore_system_lyxrc ||
1192 auto_reset_options != system_lyxrc.auto_reset_options) {
1193 os << "# Set to false to inhibit automatic reset of\n"
1194 << "# the class options to defaults on class change.\n"
1195 << "\\auto_reset_options " << tostr(auto_reset_options)
1199 if (ignore_system_lyxrc ||
1200 autosave != system_lyxrc.autosave) {
1201 os << "# The time interval between auto-saves in seconds.\n"
1202 << "\\autosave " << autosave << '\n';
1204 case RC_DISPLAY_GRAPHICS:
1205 if (ignore_system_lyxrc ||
1206 display_graphics != system_lyxrc.display_graphics) {
1207 os << "# Display graphics within LyX\n"
1208 << "# monochrome|grayscale|color|none\n"
1209 << "\\display_graphics "
1210 << lyx::graphics::displayTranslator().find(display_graphics)
1214 case RC_VIEWDVI_PAPEROPTION:
1215 if (ignore_system_lyxrc ||
1216 view_dvi_paper_option
1217 != system_lyxrc.view_dvi_paper_option) {
1218 os << "# Options used to specify paper size to the\n"
1219 << "# view_dvi_command (e.g. -paper)\n"
1220 << "\\view_dvi_paper_option \""
1221 << view_dvi_paper_option << "\"\n";
1223 case RC_DEFAULT_PAPERSIZE:
1224 if (ignore_system_lyxrc ||
1225 default_papersize != system_lyxrc.default_papersize) {
1226 os << "# The default papersize to use.\n"
1227 << "\\default_papersize \"";
1228 switch (default_papersize) {
1229 case PAPER_USLETTER:
1230 os << "usletter"; break;
1231 case PAPER_LEGALPAPER:
1232 os << "legal"; break;
1233 case PAPER_EXECUTIVEPAPER:
1234 os << "executive"; break;
1243 case PAPER_DEFAULT: break;
1247 case RC_CHKTEX_COMMAND:
1248 if (ignore_system_lyxrc ||
1249 chktex_command != system_lyxrc.chktex_command) {
1250 os << "\\chktex_command \"" << chktex_command << "\"\n";
1252 case RC_BIBTEX_COMMAND:
1253 if (ignore_system_lyxrc ||
1254 bibtex_command != system_lyxrc.bibtex_command) {
1255 os << "\\bibtex_command \"" << bibtex_command << "\"\n";
1257 case RC_INDEX_COMMAND:
1258 if (ignore_system_lyxrc ||
1259 index_command != system_lyxrc.index_command) {
1260 os << "\\index_command \"" << index_command << "\"\n";
1263 if (ignore_system_lyxrc ||
1264 use_kbmap != system_lyxrc.use_kbmap) {
1265 os << "\\kbmap " << tostr(use_kbmap) << '\n';
1267 case RC_KBMAP_PRIMARY:
1268 if (ignore_system_lyxrc ||
1269 primary_kbmap != system_lyxrc.primary_kbmap) {
1270 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1272 case RC_KBMAP_SECONDARY:
1273 if (ignore_system_lyxrc ||
1274 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1275 os << "\\kbmap_secondary \"" << secondary_kbmap
1279 if (ignore_system_lyxrc ||
1280 lyxpipes != system_lyxrc.lyxpipes) {
1281 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1283 case RC_DATE_INSERT_FORMAT:
1284 if (ignore_system_lyxrc ||
1285 date_insert_format != system_lyxrc.date_insert_format) {
1286 os << "\\date_insert_format \"" << date_insert_format
1289 case RC_LABEL_INIT_LENGTH:
1290 if (ignore_system_lyxrc ||
1291 label_init_length != system_lyxrc.label_init_length) {
1292 os << "\\label_init_length " << label_init_length
1297 os << "\\user_name \"" << user_name << "\"\n";
1300 os << "\\user_email \"" << user_email << "\"\n";
1302 case RC_SHOW_BANNER:
1303 if (ignore_system_lyxrc ||
1304 show_banner != system_lyxrc.show_banner) {
1305 os << "\\show_banner " << tostr(show_banner) << '\n';
1309 if (ignore_system_lyxrc ||
1310 preview != system_lyxrc.preview) {
1316 case PREVIEW_NO_MATH:
1323 os << "\\preview " << status << '\n';
1326 case RC_PREVIEW_HASHED_LABELS:
1327 if (ignore_system_lyxrc ||
1328 preview_hashed_labels !=
1329 system_lyxrc.preview_hashed_labels) {
1330 os << "\\preview_hashed_labels "
1331 << tostr(preview_hashed_labels) << '\n';
1334 case RC_PREVIEW_SCALE_FACTOR:
1335 if (ignore_system_lyxrc ||
1336 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1337 os << "\\preview_scale_factor "
1338 << preview_scale_factor << '\n';
1342 << "# SCREEN & FONTS SECTION ############################\n"
1345 case RC_POPUP_NORMAL_FONT:
1346 if (ignore_system_lyxrc ||
1347 popup_normal_font != system_lyxrc.popup_normal_font) {
1348 os << "\\popup_normal_font \"" << popup_normal_font
1351 case RC_POPUP_BOLD_FONT:
1352 if (ignore_system_lyxrc ||
1353 popup_bold_font != system_lyxrc.popup_bold_font) {
1354 os << "\\popup_bold_font \"" << popup_bold_font
1357 case RC_POPUP_FONT_ENCODING:
1358 if (ignore_system_lyxrc ||
1359 popup_font_encoding != system_lyxrc.popup_font_encoding) {
1360 os << "\\popup_font_encoding \"" << popup_font_encoding
1364 if (ignore_system_lyxrc ||
1365 dpi != system_lyxrc.dpi) {
1366 os << "\\screen_dpi " << dpi << '\n';
1368 case RC_SCREEN_ZOOM:
1369 if (ignore_system_lyxrc ||
1370 zoom != system_lyxrc.zoom) {
1371 os << "\\screen_zoom " << zoom << '\n';
1374 if (ignore_system_lyxrc ||
1375 wheel_jump != system_lyxrc.wheel_jump) {
1376 os << "\\wheel_jump " << wheel_jump << '\n';
1378 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1379 if (ignore_system_lyxrc ||
1380 cursor_follows_scrollbar
1381 != system_lyxrc.cursor_follows_scrollbar) {
1382 os << "\\cursor_follows_scrollbar "
1383 << tostr(cursor_follows_scrollbar) << '\n';
1385 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1386 if (ignore_system_lyxrc ||
1387 dialogs_iconify_with_main
1388 != system_lyxrc.dialogs_iconify_with_main) {
1389 os << "\\dialogs_iconify_with_main "
1390 << tostr(dialogs_iconify_with_main) << '\n';
1392 case RC_SCREEN_FONT_ROMAN:
1393 if (ignore_system_lyxrc ||
1394 roman_font_name != system_lyxrc.roman_font_name) {
1395 os << "\\screen_font_roman \"" << roman_font_name
1398 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1399 if (ignore_system_lyxrc ||
1400 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1401 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1404 case RC_SCREEN_FONT_SANS:
1405 if (ignore_system_lyxrc ||
1406 sans_font_name != system_lyxrc.sans_font_name) {
1407 os << "\\screen_font_sans \"" << sans_font_name
1410 case RC_SCREEN_FONT_SANS_FOUNDRY:
1411 if (ignore_system_lyxrc ||
1412 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1413 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1416 case RC_SCREEN_FONT_TYPEWRITER:
1417 if (ignore_system_lyxrc ||
1418 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1419 os << "\\screen_font_typewriter \""
1420 << typewriter_font_name << "\"\n";
1422 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1423 if (ignore_system_lyxrc ||
1424 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1425 os << "\\screen_font_typewriter_foundry \""
1426 << typewriter_font_foundry << "\"\n";
1429 case RC_SCREEN_FONT_SCALABLE:
1430 if (ignore_system_lyxrc ||
1431 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1432 os << "\\screen_font_scalable "
1433 << tostr(use_scalable_fonts)
1436 case RC_SCREEN_FONT_ENCODING:
1437 if (ignore_system_lyxrc ||
1438 font_norm != system_lyxrc.font_norm) {
1439 os << "\\screen_font_encoding \"" << font_norm
1442 case RC_SCREEN_FONT_SIZES:
1443 if (ignore_system_lyxrc ||
1444 font_sizes[LyXFont::SIZE_TINY]
1445 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1446 font_sizes[LyXFont::SIZE_SCRIPT]
1447 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1448 font_sizes[LyXFont::SIZE_FOOTNOTE]
1449 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1450 font_sizes[LyXFont::SIZE_SMALL]
1451 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1452 font_sizes[LyXFont::SIZE_NORMAL]
1453 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1454 font_sizes[LyXFont::SIZE_LARGE]
1455 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1456 font_sizes[LyXFont::SIZE_LARGER]
1457 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1458 font_sizes[LyXFont::SIZE_LARGEST]
1459 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1460 font_sizes[LyXFont::SIZE_HUGE]
1461 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1462 font_sizes[LyXFont::SIZE_HUGER]
1463 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1464 os.setf(ios::fixed);
1466 os << "\\screen_font_sizes"
1467 << ' ' << font_sizes[LyXFont::SIZE_TINY]
1468 << ' ' << font_sizes[LyXFont::SIZE_SCRIPT]
1469 << ' ' << font_sizes[LyXFont::SIZE_FOOTNOTE]
1470 << ' ' << font_sizes[LyXFont::SIZE_SMALL]
1471 << ' ' << font_sizes[LyXFont::SIZE_NORMAL]
1472 << ' ' << font_sizes[LyXFont::SIZE_LARGE]
1473 << ' ' << font_sizes[LyXFont::SIZE_LARGER]
1474 << ' ' << font_sizes[LyXFont::SIZE_LARGEST]
1475 << ' ' << font_sizes[LyXFont::SIZE_HUGE]
1476 << ' ' << font_sizes[LyXFont::SIZE_HUGER]
1481 << "# COLOR SECTION ###################################\n"
1485 for (int i = 0; i < LColor::ignore; ++i) {
1486 LColor::color lc = static_cast<LColor::color>(i);
1488 string const col(lcolor.getX11Name(lc));
1489 if (ignore_system_lyxrc ||
1490 col != system_lcolor.getX11Name(lc)) {
1491 os << "\\set_color \""
1492 << lcolor.getLyXName(lc) << "\" \""
1498 << "# PRINTER SECTION ###################################\n"
1502 if (ignore_system_lyxrc ||
1503 printer != system_lyxrc.printer) {
1504 os << "\\printer \"" << printer << "\"\n";
1506 case RC_PRINT_ADAPTOUTPUT:
1507 if (ignore_system_lyxrc ||
1508 print_adapt_output != system_lyxrc.print_adapt_output) {
1509 os << "\\print_adapt_output "
1510 << tostr(print_adapt_output)
1513 case RC_PRINT_COMMAND:
1514 if (ignore_system_lyxrc ||
1515 print_command != system_lyxrc.print_command) {
1516 os << "\\print_command \"" << print_command << "\"\n";
1518 case RC_PRINTEXSTRAOPTIONS:
1519 if (ignore_system_lyxrc ||
1520 print_extra_options != system_lyxrc.print_extra_options) {
1521 os << "\\print_extra_options \"" << print_extra_options
1524 case RC_PRINTSPOOL_COMMAND:
1525 if (ignore_system_lyxrc ||
1526 print_spool_command != system_lyxrc.print_spool_command) {
1527 os << "\\print_spool_command \"" << print_spool_command
1530 case RC_PRINTSPOOL_PRINTERPREFIX:
1531 if (ignore_system_lyxrc ||
1532 print_spool_printerprefix
1533 != system_lyxrc.print_spool_printerprefix) {
1534 os << "\\print_spool_printerprefix \""
1535 << print_spool_printerprefix << "\"\n";
1537 case RC_PRINTEVENPAGEFLAG:
1538 if (ignore_system_lyxrc ||
1539 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1540 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1543 case RC_PRINTODDPAGEFLAG:
1544 if (ignore_system_lyxrc ||
1545 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1546 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1549 case RC_PRINTREVERSEFLAG:
1550 if (ignore_system_lyxrc ||
1551 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1552 os << "\\print_reverse_flag \"" << print_reverse_flag
1555 case RC_PRINTLANDSCAPEFLAG:
1556 if (ignore_system_lyxrc ||
1557 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1558 os << "\\print_landscape_flag \"" << print_landscape_flag
1561 case RC_PRINTPAGERANGEFLAG:
1562 if (ignore_system_lyxrc ||
1563 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1564 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1567 case RC_PRINTCOPIESFLAG:
1568 if (ignore_system_lyxrc ||
1569 print_copies_flag != system_lyxrc.print_copies_flag) {
1570 os << "\\print_copies_flag \"" << print_copies_flag
1573 case RC_PRINTCOLLCOPIESFLAG:
1574 if (ignore_system_lyxrc ||
1575 print_collcopies_flag
1576 != system_lyxrc.print_collcopies_flag) {
1577 os << "\\print_collcopies_flag \""
1578 << print_collcopies_flag
1581 case RC_PRINTPAPERFLAG:
1582 if (ignore_system_lyxrc ||
1583 print_paper_flag != system_lyxrc.print_paper_flag) {
1584 os << "\\print_paper_flag \"" << print_paper_flag
1587 case RC_PRINTPAPERDIMENSIONFLAG:
1588 if (ignore_system_lyxrc ||
1589 print_paper_dimension_flag
1590 != system_lyxrc.print_paper_dimension_flag) {
1591 os << "\\print_paper_dimension_flag \""
1592 << print_paper_dimension_flag << "\"\n";
1594 case RC_PRINTTOPRINTER:
1595 if (ignore_system_lyxrc ||
1596 print_to_printer != system_lyxrc.print_to_printer) {
1597 os << "\\print_to_printer \"" << print_to_printer
1600 case RC_PRINTTOFILE:
1601 if (ignore_system_lyxrc ||
1602 print_to_file != system_lyxrc.print_to_file) {
1603 os << "\\print_to_file \"" << print_to_file << "\"\n";
1605 case RC_PRINTFILEEXTENSION:
1606 if (ignore_system_lyxrc ||
1607 print_file_extension != system_lyxrc.print_file_extension) {
1608 os << "\\print_file_extension \""
1609 << print_file_extension
1614 << "# EXPORT SECTION ####################################\n"
1617 case RC_CUSTOM_EXPORT_COMMAND:
1618 if (ignore_system_lyxrc ||
1619 custom_export_command
1620 != system_lyxrc.custom_export_command) {
1621 os << "\\custom_export_command \""
1622 << custom_export_command
1625 case RC_CUSTOM_EXPORT_FORMAT:
1626 if (ignore_system_lyxrc ||
1627 custom_export_format
1628 != system_lyxrc.custom_export_format) {
1629 os << "\\custom_export_format \"" << custom_export_format
1634 << "# TEX SECTION #######################################\n"
1637 case RC_FONT_ENCODING:
1638 if (ignore_system_lyxrc ||
1639 fontenc != system_lyxrc.fontenc) {
1640 os << "\\font_encoding \"" << fontenc << "\"\n";
1644 << "# FILE SECTION ######################################\n"
1647 case RC_DOCUMENTPATH:
1648 if (ignore_system_lyxrc ||
1649 document_path != system_lyxrc.document_path) {
1650 os << "\\document_path \"" << document_path << "\"\n";
1653 if (ignore_system_lyxrc ||
1654 lastfiles != system_lyxrc.lastfiles) {
1655 os << "\\lastfiles \"" << lastfiles << "\"\n";
1657 case RC_NUMLASTFILES:
1658 if (ignore_system_lyxrc ||
1659 num_lastfiles != system_lyxrc.num_lastfiles) {
1660 os << "\\num_lastfiles " << num_lastfiles << '\n';
1662 case RC_CHECKLASTFILES:
1663 if (ignore_system_lyxrc ||
1664 check_lastfiles != system_lyxrc.check_lastfiles) {
1665 os << "\\check_lastfiles " << tostr(check_lastfiles)
1668 case RC_TEMPLATEPATH:
1669 if (ignore_system_lyxrc ||
1670 template_path != system_lyxrc.template_path) {
1671 os << "\\template_path \"" << template_path << "\"\n";
1673 case RC_TEMPDIRPATH:
1674 if (ignore_system_lyxrc ||
1675 tempdir_path != system_lyxrc.tempdir_path) {
1676 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1680 case RC_ASCII_LINELEN:
1681 if (ignore_system_lyxrc ||
1682 ascii_linelen != system_lyxrc.ascii_linelen) {
1683 os << "\\ascii_linelen " << ascii_linelen << '\n';
1685 case RC_MAKE_BACKUP:
1686 if (ignore_system_lyxrc ||
1687 make_backup != system_lyxrc.make_backup) {
1688 os << "\\make_backup " << tostr(make_backup) << '\n';
1690 case RC_BACKUPDIR_PATH:
1691 if (ignore_system_lyxrc ||
1692 backupdir_path != system_lyxrc.backupdir_path) {
1693 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1697 << "# ASCII EXPORT SECTION ##############################\n"
1700 case RC_ASCIIROFF_COMMAND:
1701 if (ignore_system_lyxrc ||
1702 ascii_roff_command != system_lyxrc.ascii_roff_command) {
1703 os << "\\ascii_roff_command \"" << ascii_roff_command
1708 << "# SPELLCHECKER SECTION ##############################\n"
1710 case RC_USE_SPELL_LIB:
1711 if (ignore_system_lyxrc ||
1712 use_spell_lib != system_lyxrc.use_spell_lib) {
1713 os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
1715 case RC_SPELL_COMMAND:
1716 if (ignore_system_lyxrc ||
1717 isp_command != system_lyxrc.isp_command) {
1718 os << "\\spell_command \"" << isp_command << "\"\n";
1720 case RC_ACCEPT_COMPOUND:
1721 if (ignore_system_lyxrc ||
1722 isp_accept_compound != system_lyxrc.isp_accept_compound) {
1723 os << "\\accept_compound " << tostr(isp_accept_compound)
1726 case RC_USE_ALT_LANG:
1727 if (ignore_system_lyxrc ||
1728 isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1729 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1733 if (ignore_system_lyxrc ||
1734 isp_alt_lang != system_lyxrc.isp_alt_lang) {
1735 os << "\\alternate_language \"" << isp_alt_lang
1738 case RC_USE_ESC_CHARS:
1739 if (ignore_system_lyxrc ||
1740 isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1741 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1745 if (ignore_system_lyxrc ||
1746 isp_esc_chars != system_lyxrc.isp_esc_chars) {
1747 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1749 case RC_USE_PERS_DICT:
1750 if (ignore_system_lyxrc ||
1751 isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1752 os << "\\use_personal_dictionary "
1753 << tostr(isp_use_pers_dict)
1757 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1758 os << "\\personal_dictionary \"" << isp_pers_dict
1761 case RC_USE_INP_ENC:
1762 if (ignore_system_lyxrc ||
1763 isp_use_input_encoding
1764 != system_lyxrc.isp_use_input_encoding) {
1765 os << "\\use_input_encoding "
1766 << tostr(isp_use_input_encoding)
1771 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1774 case RC_RTL_SUPPORT:
1775 if (ignore_system_lyxrc ||
1776 rtl_support != system_lyxrc.rtl_support) {
1777 os << "\\rtl " << tostr(rtl_support) << '\n';
1779 case RC_LANGUAGE_PACKAGE:
1780 if (ignore_system_lyxrc ||
1781 language_package != system_lyxrc.language_package) {
1782 os << "\\language_package \"" << language_package
1785 case RC_LANGUAGE_GLOBAL_OPTIONS:
1786 if (ignore_system_lyxrc ||
1787 language_global_options
1788 != system_lyxrc.language_global_options) {
1789 os << "\\language_global_options \""
1790 << tostr(language_global_options)
1793 case RC_LANGUAGE_USE_BABEL:
1794 if (ignore_system_lyxrc ||
1795 language_use_babel != system_lyxrc.language_use_babel) {
1796 os << "\\language_use_babel \""
1797 << tostr(language_use_babel)
1800 case RC_LANGUAGE_COMMAND_BEGIN:
1801 if (ignore_system_lyxrc ||
1802 language_command_begin
1803 != system_lyxrc.language_command_begin) {
1804 os << "\\language_command_begin \""
1805 << language_command_begin
1808 case RC_LANGUAGE_COMMAND_END:
1809 if (ignore_system_lyxrc ||
1810 language_command_end
1811 != system_lyxrc.language_command_end) {
1812 os << "\\language_command_end \"" << language_command_end
1815 case RC_LANGUAGE_COMMAND_LOCAL:
1816 if (ignore_system_lyxrc ||
1817 language_command_local
1818 != system_lyxrc.language_command_local) {
1819 os << "\\language_command_local \""
1820 << language_command_local
1823 case RC_LANGUAGE_AUTO_BEGIN:
1824 if (ignore_system_lyxrc ||
1825 language_auto_begin != system_lyxrc.language_auto_begin) {
1826 os << "\\language_auto_begin "
1827 << tostr(language_auto_begin) << '\n';
1829 case RC_LANGUAGE_AUTO_END:
1830 if (ignore_system_lyxrc ||
1831 language_auto_end != system_lyxrc.language_auto_end) {
1832 os << "\\language_auto_end "
1833 << tostr(language_auto_end) << '\n';
1835 case RC_MARK_FOREIGN_LANGUAGE:
1836 if (ignore_system_lyxrc ||
1837 mark_foreign_language
1838 != system_lyxrc.mark_foreign_language) {
1839 os << "\\mark_foreign_language " <<
1840 tostr(mark_foreign_language) << '\n';
1844 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1847 case RC_AUTO_NUMBER:
1848 if (ignore_system_lyxrc ||
1849 auto_number != system_lyxrc.auto_number) {
1850 os << "\\auto_number " << tostr(auto_number) << '\n';
1852 case RC_DEFAULT_LANGUAGE:
1853 if (ignore_system_lyxrc ||
1854 default_language != system_lyxrc.default_language) {
1855 os << "\\default_language " << default_language << '\n';
1859 << "# FORMATS SECTION ##########################\n"
1863 // New/modifed formats
1864 for (Formats::const_iterator cit = formats.begin();
1865 cit != formats.end(); ++cit) {
1866 Format const * format =
1867 system_formats.getFormat(cit->name());
1869 format->extension() != cit->extension() ||
1870 format->prettyname() != cit->prettyname() ||
1871 format->shortcut() != cit->shortcut() ||
1872 format->viewer() != cit->viewer() ||
1873 format->editor() != cit->editor())
1874 os << "\\format \"" << cit->name() << "\" \""
1875 << cit->extension() << "\" \""
1876 << cit->prettyname() << "\" \""
1877 << cit->shortcut() << "\" \""
1878 << cit->viewer() << "\" \""
1879 << cit->editor() << "\"\n";
1882 // Look for deleted formats
1883 for (Formats::const_iterator cit = system_formats.begin();
1884 cit != system_formats.end(); ++cit)
1885 if (!formats.getFormat(cit->name()))
1886 os << "\\format \"" << cit->name()
1887 << "\" \"\" \"\" \"\" \"\" \"\"\n";
1892 << "# CONVERTERS SECTION ##########################\n"
1896 // Look for new converters
1897 for (Converters::const_iterator cit = converters.begin();
1898 cit != converters.end(); ++cit) {
1899 Converter const * converter =
1900 system_converters.getConverter(cit->from,
1903 converter->command != cit->command ||
1904 converter->flags != cit->flags)
1905 os << "\\converter \"" << cit->from << "\" \""
1906 << cit->to << "\" \""
1907 << cit->command << "\" \""
1908 << cit->flags << "\"\n";
1911 // New/modifed converters
1912 for (Converters::const_iterator cit = system_converters.begin();
1913 cit != system_converters.end(); ++cit)
1914 if (!converters.getConverter(cit->from, cit->to))
1915 os << "\\converter \"" << cit->from
1916 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1922 void LyXRC::set_font_norm_type()
1924 if (font_norm == "iso10646-1")
1925 font_norm_type = ISO_10646_1;
1926 else if (font_norm == "iso8859-1")
1927 font_norm_type = ISO_8859_1;
1928 else if (font_norm == "iso8859-3")
1929 font_norm_type = ISO_8859_3;
1930 else if (font_norm == "iso8859-4")
1931 font_norm_type = ISO_8859_4;
1932 else if (font_norm == "iso8859-6.8x")
1933 font_norm_type = ISO_8859_6_8;
1934 else if (font_norm == "iso8859-9")
1935 font_norm_type = ISO_8859_9;
1936 else if (font_norm == "iso8859-15")
1937 font_norm_type = ISO_8859_15;
1939 font_norm_type = OTHER_ENCODING;
1943 string const LyXRC::getDescription(LyXRCTags tag)
1948 case RC_FONT_ENCODING:
1949 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1953 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1956 case RC_PRINT_COMMAND:
1957 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1960 case RC_PRINTEVENPAGEFLAG:
1961 str = _("The option to print only even pages.");
1964 case RC_PRINTODDPAGEFLAG:
1965 str = _("The option to print only odd pages.");
1968 case RC_PRINTPAGERANGEFLAG:
1969 str = _("The option for specifying a comma-separated list of pages to print.");
1972 case RC_PRINTCOPIESFLAG:
1973 str = _("The option for specifying the number of copies to print.");
1976 case RC_PRINTCOLLCOPIESFLAG:
1977 str = _("The option for specifying whether the copies should be collated.");
1980 case RC_PRINTREVERSEFLAG:
1981 str = _("The option to reverse the order of the pages printed.");
1984 case RC_PRINTLANDSCAPEFLAG:
1985 str = _("The option to print out in landscape.");
1988 case RC_PRINTPAPERFLAG:
1989 str = _("The option to specify paper type.");
1992 case RC_PRINTPAPERDIMENSIONFLAG:
1993 str = _("Option to specify the dimensions of the print paper.");
1996 case RC_PRINTTOPRINTER:
1997 str = _("Option to pass to the print program to print on a specific printer.");
2000 case RC_PRINT_ADAPTOUTPUT:
2001 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2004 case RC_PRINTTOFILE:
2005 str = _("Option to pass to the print program to print to a file.");
2008 case RC_PRINTFILEEXTENSION:
2009 str = _("Extension of printer program output file. Usually \".ps\".");
2012 case RC_PRINTEXSTRAOPTIONS:
2013 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2016 case RC_PRINTSPOOL_COMMAND:
2017 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.");
2020 case RC_PRINTSPOOL_PRINTERPREFIX:
2021 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.");
2025 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2028 case RC_SCREEN_ZOOM:
2029 //xgettext:no-c-format
2030 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2033 case RC_SCREEN_FONT_SIZES:
2034 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2037 case RC_SCREEN_FONT_ROMAN:
2038 case RC_SCREEN_FONT_SANS:
2039 case RC_SCREEN_FONT_TYPEWRITER:
2040 str = _("The screen fonts used to display the text while editing.");
2043 case RC_POPUP_BOLD_FONT:
2044 str = _("The bold font in the dialogs.");
2047 case RC_POPUP_NORMAL_FONT:
2048 str = _("The normal font in the dialogs.");
2051 case RC_SCREEN_FONT_ENCODING:
2052 str = _("The encoding for the screen fonts.");
2055 case RC_POPUP_FONT_ENCODING:
2056 str = _("The encoding for the menu/popups fonts.");
2063 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2066 case RC_DOCUMENTPATH:
2067 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2070 case RC_TEMPLATEPATH:
2071 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2074 case RC_TEMPDIRPATH:
2075 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2079 str = _("The file where the last-files information should be stored.");
2082 case RC_AUTOREGIONDELETE:
2083 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2086 case RC_AUTORESET_OPTIONS:
2087 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2091 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2095 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2099 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2103 case RC_KBMAP_PRIMARY:
2104 case RC_KBMAP_SECONDARY:
2105 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.");
2108 case RC_ASCIIROFF_COMMAND:
2109 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.");
2112 case RC_ASCII_LINELEN:
2113 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
2116 case RC_NUMLASTFILES:
2117 str = bformat(_("Maximal number of lastfiles. Up to %1$s can appear in the file menu."), tostr(maxlastfiles));
2120 case RC_CHECKLASTFILES:
2121 str = _("Select to check whether the lastfiles still exist.");
2124 case RC_VIEWDVI_PAPEROPTION:
2125 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2128 case RC_DEFAULT_PAPERSIZE:
2129 str = _("Specify the default paper size.");
2132 case RC_ACCEPT_COMPOUND:
2133 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2136 case RC_SPELL_COMMAND:
2137 str = _("What command runs the spell checker?");
2140 case RC_USE_INP_ENC:
2141 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.");
2144 case RC_USE_ALT_LANG:
2146 str = _("Specify an alternate language. The default is to use the language of the document.");
2149 case RC_USE_PERS_DICT:
2151 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
2154 case RC_USE_ESC_CHARS:
2156 str = _("Specify additional chars that can be part of a word.");
2159 case RC_SCREEN_FONT_SCALABLE:
2160 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.");
2163 case RC_CHKTEX_COMMAND:
2164 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2167 case RC_BIBTEX_COMMAND:
2168 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2171 case RC_INDEX_COMMAND:
2172 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\".");
2175 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2176 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.");
2179 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2180 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2183 case RC_DISPLAY_GRAPHICS:
2184 str = _("Select how LyX will display any graphics.");
2187 case RC_MAKE_BACKUP:
2188 str = _("De-select if you don't want LyX to create backup files.");
2191 case RC_BACKUPDIR_PATH:
2192 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.");
2195 case RC_RTL_SUPPORT:
2196 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2199 case RC_MARK_FOREIGN_LANGUAGE:
2200 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2203 case RC_LANGUAGE_PACKAGE:
2204 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2207 case RC_LANGUAGE_GLOBAL_OPTIONS:
2208 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2211 case RC_LANGUAGE_USE_BABEL:
2212 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2215 case RC_LANGUAGE_AUTO_BEGIN:
2216 str = _("Select if a language switching command is needed at the beginning of the document.");
2219 case RC_LANGUAGE_AUTO_END:
2220 str = _("Select if a language switching command is needed at the end of the document.");
2223 case RC_LANGUAGE_COMMAND_BEGIN:
2224 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.");
2227 case RC_LANGUAGE_COMMAND_END:
2228 str = _("The LaTeX command for changing back to the language of the document.");
2231 case RC_LANGUAGE_COMMAND_LOCAL:
2232 str = _("The LaTeX command for local changing of the language.");
2235 case RC_DATE_INSERT_FORMAT:
2236 //xgettext:no-c-format
2237 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2240 case RC_SHOW_BANNER:
2241 str = _("De-select if you don't want the startup banner.");
2245 str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
2257 case RC_DEFAULT_LANGUAGE:
2258 str = _("New documents will be assigned this language.");
2261 case RC_LABEL_INIT_LENGTH:
2262 str = _("Maximum number of words in the initialization string for a new label");
2266 str = _("Shows a typeset preview of things such as math");
2269 case RC_PREVIEW_HASHED_LABELS:
2270 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2273 case RC_PREVIEW_SCALE_FACTOR:
2274 str = _("Scale the preview size to suit.");
2284 // The global instance
2287 // The global copy of the system lyxrc entries (everything except preferences)