1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2001 The LyX Team.
9 * ====================================================== */
14 #pragma implementation "lyxrc.h"
20 #include <boost/scoped_ptr.hpp>
26 #include "LyXAction.h"
28 #include "support/path.h"
29 #include "support/filetools.h"
30 #include "converter.h"
43 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
47 // when adding something to this array keep it sorted!
48 keyword_item lyxrcTags[] = {
49 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
50 { "\\alternate_language", LyXRC::RC_ALT_LANG },
51 { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
52 { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
53 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
54 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
55 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
56 { "\\autosave", LyXRC::RC_AUTOSAVE },
57 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
58 { "\\bind", LyXRC::RC_BIND },
59 { "\\bind_file", LyXRC::RC_BINDFILE },
60 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
61 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
62 { "\\converter", LyXRC::RC_CONVERTER },
63 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
64 { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
65 { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
66 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
67 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
68 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
69 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
70 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
71 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
72 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
73 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
74 { "\\format", LyXRC::RC_FORMAT },
75 { "\\input", LyXRC::RC_INPUT },
76 { "\\kbmap", LyXRC::RC_KBMAP },
77 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
78 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
79 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
80 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
81 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
82 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
83 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
84 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
85 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
86 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
87 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
88 { "\\lastfiles", LyXRC::RC_LASTFILES },
89 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
90 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
91 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
92 { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS },
93 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
94 { "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
95 { "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
96 { "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
97 { "\\preview", LyXRC::RC_PREVIEW },
98 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
99 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
100 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
101 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
102 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
103 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
104 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
105 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
106 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
107 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
108 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
109 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
110 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
111 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
112 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
113 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
114 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
115 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
116 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
117 { "\\printer", LyXRC::RC_PRINTER },
118 { "\\ps_command", LyXRC::RC_PS_COMMAND },
119 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
120 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
121 { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING },
122 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
123 { "\\screen_font_encoding_menu", LyXRC::RC_POPUP_FONT_ENCODING },
124 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
125 { "\\screen_font_menu", LyXRC::RC_POPUP_BOLD_FONT },
126 // compatibility with versions older than 1.2.0 only Angus 10 Jan 2002
127 { "\\screen_font_popup", LyXRC::RC_POPUP_NORMAL_FONT },
128 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
129 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
130 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
131 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
132 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
133 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
134 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
135 { "\\set_color", LyXRC::RC_SET_COLOR },
136 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
137 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
138 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
139 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
140 { "\\ui_file", LyXRC::RC_UIFILE },
141 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
142 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
143 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
144 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
146 { "\\use_pspell", LyXRC::RC_USE_PSPELL },
148 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
149 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
150 { "\\viewer" ,LyXRC::RC_VIEWER},
151 { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP }
154 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
165 void LyXRC::setDefaults() {
169 // Get printer from the environment. If fail, use default "",
170 // assuming that everything is set up correctly.
171 printer = GetEnv("PRINTER");
172 print_adapt_output = false;
173 print_command = "dvips";
174 print_evenpage_flag = "-B";
175 print_oddpage_flag = "-A";
176 print_pagerange_flag = "-pp";
177 print_copies_flag = "-c";
178 print_collcopies_flag = "-C";
179 print_reverse_flag = "-r";
180 print_landscape_flag = "-t landscape";
181 print_to_printer = "-P";
182 print_to_file = "-o ";
183 print_file_extension = ".ps";
184 print_paper_flag = "-t";
185 print_paper_dimension_flag = "-T";
186 document_path.erase();
187 tempdir_path = "/tmp";
190 view_dvi_paper_option.erase();
191 default_papersize = BufferParams::PAPER_USLETTER;
192 custom_export_format = "ps";
193 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
196 // Because a screen typically is wider than a piece of paper:
199 // Default LaTeX font size:
200 font_sizes[LyXFont::SIZE_TINY] = 5.0;
201 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
202 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
203 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
204 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
205 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
206 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
207 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
208 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
209 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
210 use_scalable_fonts = true;
211 roman_font_name = "-*-times";
212 sans_font_name = "-*-helvetica";
213 typewriter_font_name = "-*-courier";
214 popup_bold_font = "-*-helvetica-bold-r";
215 popup_normal_font = "-*-helvetica-medium-r";
216 font_norm = "iso8859-1";
217 font_norm_type = ISO_8859_1;
218 popup_font_encoding.erase();
219 override_x_deadkeys = true;
221 auto_region_delete = true;
222 auto_reset_options = false;
225 check_lastfiles = true;
227 backupdir_path.erase();
228 display_graphics = "color";
229 // Spellchecker settings:
233 isp_command = "ispell";
234 isp_accept_compound = false;
235 isp_use_input_encoding = false;
236 isp_use_alt_lang = false;
237 isp_use_pers_dict = false;
238 isp_use_esc_chars = false;
242 mark_foreign_language = true;
243 language_auto_begin = true;
244 language_auto_end = true;
245 language_global_options = true;
246 language_use_babel = true;
247 language_package = "\\usepackage{babel}";
248 language_command_begin = "\\selectlanguage{$$lang}";
249 language_command_local = "\\foreignlanguage{$$lang}{";
250 default_language = "english";
254 date_insert_format = "%A, %e %B %Y";
255 cursor_follows_scrollbar = false;
256 dialogs_iconify_with_main = false;
257 label_init_length = 3;
259 preview_hashed_labels = false;
260 preview_scale_factor = 0.9;
262 /// These variables are not stored on disk (perhaps they
263 // should be moved from the LyXRC class).
269 int LyXRC::ReadBindFile(string const & name)
272 string const tmp = i18nLibFileSearch("bind", name, "bind");
273 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
274 int const result = read(tmp);
276 lyxerr << "Error reading bind file: " << tmp << endl;
281 void LyXRC::readBindFileIfNeeded()
284 ReadBindFile(bind_file);
288 int LyXRC::read(string const & filename)
290 LyXLex lexrc(lyxrcTags, lyxrcCount);
291 if (lyxerr.debugging(Debug::PARSER))
292 lexrc.printTable(lyxerr);
294 lexrc.setFile(filename);
295 if (!lexrc.isOK()) return -2;
297 lyxerr[Debug::LYXRC] << "Reading '" << filename << "'..." << endl;
299 while (lexrc.isOK()) {
300 // By using two switches we take advantage of the compiler
301 // telling us if we have missed a LyXRCTags element in
302 // the second switch.
303 // Note that this also shows a problem with LyXLex since it
304 // helps us avoid taking advantage of the strictness of the
307 int le = lexrc.lex();
309 case LyXLex::LEX_UNDEF:
310 lexrc.printError("Unknown tag `$$Token'");
312 case LyXLex::LEX_FEOF:
316 switch (static_cast<LyXRCTags>(le)) {
317 case RC_INPUT: // Include file
320 LibFileSearch(string(),
323 lexrc.printError("Error reading "
324 "included file: "+tmp);
328 case RC_BINDFILE: // RVDK_PATCH_5
330 string const tmp(lexrc.getString());
332 // We are already in the
333 // "actually read bind file"
337 // We are still in the "just
338 // remember the name of the
346 ui_file = lexrc.getString();
350 case RC_AUTORESET_OPTIONS:
352 auto_reset_options = lexrc.getBool();
355 case RC_DISPLAY_GRAPHICS:
357 display_graphics = lexrc.getString();
358 // backward compatibility
359 if (display_graphics == "mono") display_graphics = "monochrome";
360 else if (display_graphics == "gray") display_graphics = "grayscale";
361 else if (display_graphics == "no") display_graphics = "none";
367 use_kbmap = lexrc.getBool();
370 case RC_KBMAP_PRIMARY:
372 string const kmap(lexrc.getString());
375 } else if (!LibFileSearch("kbd", kmap,
377 primary_kbmap = kmap;
379 lexrc.printError("LyX: Keymap `$$Token' not found");
383 case RC_KBMAP_SECONDARY:
385 string const kmap(lexrc.getString());
388 } else if (!LibFileSearch("kbd", kmap,
390 secondary_kbmap = kmap;
392 lexrc.printError("LyX: Keymap `$$Token' not found");
396 case RC_FONT_ENCODING:
398 fontenc = lexrc.getString();
403 printer = lexrc.getString();
406 case RC_PRINT_COMMAND:
408 print_command = lexrc.getString();
411 case RC_PRINTEVENPAGEFLAG:
413 print_evenpage_flag = lexrc.getString();
416 case RC_PRINTODDPAGEFLAG:
418 print_oddpage_flag = lexrc.getString();
421 case RC_PRINTPAGERANGEFLAG:
423 print_pagerange_flag = lexrc.getString();
426 case RC_PRINTCOPIESFLAG:
428 print_copies_flag = lexrc.getString();
431 case RC_PRINTCOLLCOPIESFLAG:
433 print_collcopies_flag = lexrc.getString();
436 case RC_PRINTREVERSEFLAG:
438 print_reverse_flag = lexrc.getString();
441 case RC_PRINTLANDSCAPEFLAG:
443 print_landscape_flag = lexrc.getString();
446 case RC_PRINTTOPRINTER:
448 print_to_printer = lexrc.getString();
451 case RC_PRINT_ADAPTOUTPUT:
453 print_adapt_output = lexrc.getBool();
458 print_to_file = lexrc.getString();
461 case RC_PRINTFILEEXTENSION:
463 print_file_extension = lexrc.getString();
466 case RC_PRINTEXSTRAOPTIONS:
468 print_extra_options = lexrc.getString();
471 case RC_PRINTSPOOL_COMMAND:
473 print_spool_command = lexrc.getString();
476 case RC_PRINTSPOOL_PRINTERPREFIX:
478 print_spool_printerprefix = lexrc.getString();
481 case RC_PRINTPAPERDIMENSIONFLAG:
483 print_paper_dimension_flag = lexrc.getString();
486 case RC_PRINTPAPERFLAG:
488 print_paper_flag = lexrc.getString();
491 case RC_CUSTOM_EXPORT_COMMAND:
493 custom_export_command = lexrc.getString();
496 case RC_CUSTOM_EXPORT_FORMAT:
498 custom_export_format = lexrc.getString();
501 case RC_DEFAULT_PAPERSIZE:
504 ascii_lowercase(lexrc.getString());
505 if (size == "usletter")
507 BufferParams::PAPER_USLETTER;
508 else if (size == "legal")
510 BufferParams::PAPER_LEGALPAPER;
511 else if (size == "executive")
513 BufferParams::PAPER_EXECUTIVEPAPER;
514 else if (size == "a3")
516 BufferParams::PAPER_A3PAPER;
517 else if (size == "a4")
519 BufferParams::PAPER_A4PAPER;
520 else if (size == "a5")
522 BufferParams::PAPER_A5PAPER;
523 else if (size == "b5")
525 BufferParams::PAPER_B5PAPER;
529 case RC_VIEWDVI_PAPEROPTION:
531 view_dvi_paper_option = lexrc.getString();
533 view_dvi_paper_option.erase();
538 ps_command = lexrc.getString();
541 case RC_CHKTEX_COMMAND:
543 chktex_command = lexrc.getString();
548 dpi = lexrc.getInteger();
553 zoom = lexrc.getInteger();
558 wheel_jump = lexrc.getInteger();
561 case RC_SCREEN_FONT_SIZES:
563 font_sizes[LyXFont::SIZE_TINY] =
566 font_sizes[LyXFont::SIZE_SCRIPT] =
569 font_sizes[LyXFont::SIZE_FOOTNOTE] =
572 font_sizes[LyXFont::SIZE_SMALL] =
575 font_sizes[LyXFont::SIZE_NORMAL] =
578 font_sizes[LyXFont::SIZE_LARGE] =
581 font_sizes[LyXFont::SIZE_LARGER] =
584 font_sizes[LyXFont::SIZE_LARGEST] =
587 font_sizes[LyXFont::SIZE_HUGE] =
590 font_sizes[LyXFont::SIZE_HUGER] =
594 case RC_SCREEN_FONT_SCALABLE:
596 use_scalable_fonts = lexrc.getBool();
601 autosave = lexrc.getInteger();
604 case RC_DOCUMENTPATH:
606 document_path = ExpandPath(lexrc.getString());
610 case RC_TEMPLATEPATH:
612 template_path = ExpandPath(lexrc.getString());
617 tempdir_path = ExpandPath(lexrc.getString());
622 use_tempdir = lexrc.getBool();
627 lastfiles = ExpandPath(lexrc.getString());
630 case RC_NUMLASTFILES:
632 num_lastfiles = lexrc.getInteger();
635 case RC_CHECKLASTFILES:
637 check_lastfiles = lexrc.getBool();
640 case RC_SCREEN_FONT_ROMAN:
642 roman_font_name = lexrc.getString();
645 case RC_SCREEN_FONT_SANS:
647 sans_font_name = lexrc.getString();
650 case RC_SCREEN_FONT_TYPEWRITER:
652 typewriter_font_name = lexrc.getString();
655 case RC_SCREEN_FONT_ENCODING:
657 font_norm = lexrc.getString();
658 set_font_norm_type();
662 case RC_POPUP_BOLD_FONT:
664 popup_bold_font = lexrc.getString();
667 case RC_POPUP_NORMAL_FONT:
669 popup_normal_font = lexrc.getString();
672 case RC_POPUP_FONT_ENCODING:
674 popup_font_encoding = lexrc.getString();
679 string lyx_name, x11_name;
682 lyx_name = lexrc.getString();
684 lexrc.printError("Missing color tag.");
689 x11_name = lexrc.getString();
691 lexrc.printError("Missing color name for color : `$$Token'");
695 if (!lcolor.setColor(lyx_name, x11_name))
696 lyxerr << "Bad lyxrc set_color for "
701 case RC_AUTOREGIONDELETE:
702 // Auto region delete defaults to true
704 auto_region_delete = lexrc.getBool();
709 // we should not do an explicit binding before
710 // loading a bind file. So, in this case, load
711 // the default bind file.
712 readBindFileIfNeeded();
714 // !!!chb, dynamic key binding...
716 string::size_type res = 0;
720 seq = lexrc.getString();
722 lexrc.printError("RC_BIND: Missing key sequence");
726 if (lexrc.next(true)) {
727 cmd = lexrc.getString();
729 lexrc.printError("RC_BIND: missing command");
733 if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
734 if (lyxerr.debugging(Debug::LYXRC)) {
735 lyxerr << "RC_BIND: Sequence `"
736 << seq << "' Command `"
737 << cmd << "' Action `"
738 << action << '\'' << endl;
740 res = toplevel_keymap->bind(seq, kb_action(action));
741 if (res != string::npos
742 && lyxerr.debugging(Debug::LYXRC)) {
745 "Invalid key sequence `"
748 } else {// cmd is the last token read.
750 "Unknown LyX function `$$Token'");
754 case RC_OVERRIDE_X_DEADKEYS:
756 override_x_deadkeys = lexrc.getBool();
761 lyxpipes = ExpandPath(lexrc.getString());
764 case RC_CURSOR_FOLLOWS_SCROLLBAR:
766 cursor_follows_scrollbar = lexrc.getBool();
769 case RC_DIALOGS_ICONIFY_WITH_MAIN:
771 dialogs_iconify_with_main = lexrc.getBool();
774 case RC_ASCIIROFF_COMMAND:
776 ascii_roff_command = lexrc.getString();
778 case RC_ASCII_LINELEN:
780 ascii_linelen = lexrc.getInteger();
782 // Spellchecker settings:
786 use_pspell = lexrc.getBool();
789 case RC_SPELL_COMMAND:
791 isp_command = lexrc.getString();
793 case RC_ACCEPT_COMPOUND:
795 isp_accept_compound = lexrc.getBool();
799 isp_use_input_encoding = lexrc.getBool();
801 case RC_USE_ALT_LANG:
803 isp_use_alt_lang = lexrc.getBool();
805 case RC_USE_PERS_DICT:
807 isp_use_pers_dict = lexrc.getBool();
809 case RC_USE_ESC_CHARS:
811 isp_use_esc_chars = lexrc.getBool();
815 isp_alt_lang = lexrc.getString();
819 isp_pers_dict = lexrc.getString();
823 isp_esc_chars = lexrc.getString();
827 make_backup = lexrc.getBool();
829 case RC_BACKUPDIR_PATH:
831 backupdir_path = ExpandPath(lexrc.getString());
833 case RC_DATE_INSERT_FORMAT:
835 date_insert_format = lexrc.getString();
837 case RC_LANGUAGE_PACKAGE:
839 language_package = lexrc.getString();
841 case RC_LANGUAGE_AUTO_BEGIN:
843 language_auto_begin = lexrc.getBool();
845 case RC_LANGUAGE_AUTO_END:
847 language_auto_end = lexrc.getBool();
849 case RC_LANGUAGE_GLOBAL_OPTIONS:
851 language_global_options = lexrc.getBool();
853 case RC_LANGUAGE_USE_BABEL:
855 language_use_babel = lexrc.getBool();
857 case RC_LANGUAGE_COMMAND_BEGIN:
859 language_command_begin = lexrc.getString();
861 case RC_LANGUAGE_COMMAND_END:
863 language_command_end = lexrc.getString();
865 case RC_LANGUAGE_COMMAND_LOCAL:
867 language_command_local = lexrc.getString();
871 rtl_support = lexrc.getBool();
875 auto_number = lexrc.getBool();
877 case RC_MARK_FOREIGN_LANGUAGE:
879 mark_foreign_language = lexrc.getBool();
883 string from, to, command, flags;
885 from = lexrc.getString();
887 to = lexrc.getString();
889 command = lexrc.getString();
891 flags = lexrc.getString();
892 if (command.empty() || command == "none")
893 converters.erase(from, to);
895 converters.add(from, to, command, flags);
899 string format, command;
901 format = lexrc.getString();
903 command = lexrc.getString();
904 formats.setViewer(format, command);
908 string format, extension, prettyname, shortcut;
910 format = lexrc.getString();
912 extension = lexrc.getString();
914 prettyname = lexrc.getString();
916 shortcut = lexrc.getString();
917 if (prettyname.empty()) {
918 if (converters.formatIsUsed(format))
919 lyxerr << "Can't delete format "
922 formats.erase(format);
925 formats.add(format, extension, prettyname,
929 case RC_DEFAULT_LANGUAGE:
931 default_language = lexrc.getString();
934 case RC_LABEL_INIT_LENGTH:
936 label_init_length = lexrc.getInteger();
941 show_banner = lexrc.getBool();
946 preview = lexrc.getBool();
949 case RC_PREVIEW_HASHED_LABELS:
951 preview_hashed_labels = lexrc.getBool();
954 case RC_PREVIEW_SCALE_FACTOR:
956 preview_scale_factor = lexrc.getFloat();
959 case RC_LAST: break; // this is just a dummy
963 /// Update converters data-structures
964 converters.update(formats);
965 converters.buildGraph();
971 void LyXRC::write(string const & filename) const
973 ofstream ofs(filename.c_str());
979 void LyXRC::print() const
981 if (lyxerr.debugging())
988 void LyXRC::output(ostream & os) const
990 os << "### This file is part of\n"
991 << "### ========================================================\n"
992 << "### LyX, The Document Processor\n"
994 << "### Copyright 1995 Matthias Ettrich\n"
995 << "### Copyright 1995-2001 The LyX Team.\n"
997 << "### ========================================================\n"
999 << "# This file is written by LyX, if you want to make your own\n"
1000 << "# modifications you should do them from inside LyX and save\n"
1003 // Why the switch you might ask. It is a trick to ensure that all
1004 // the elements in the LyXRCTags enum is handled. As you can see
1005 // there are no breaks at all. So it is just a huge fall-through.
1006 // The nice thing is that we will get a warning from the compiler
1007 // if we forget an element.
1008 LyXRCTags tag = RC_LAST;
1012 // input/include files are not done here
1014 // bindings is not written to the preferences file.
1016 if (bind_file != system_lyxrc.bind_file) {
1017 os << "\\bind_file " << bind_file << "\n";
1023 << "# MISC SECTION ######################################\n"
1026 // bind files are not done here.
1028 if (ui_file != system_lyxrc.ui_file) {
1029 os << "\\ui_file \"" << ui_file << "\"\n";
1031 case RC_AUTOREGIONDELETE:
1032 if (auto_region_delete != system_lyxrc.auto_region_delete) {
1033 os << "# Set to false to inhibit automatic replacement of\n"
1034 << "# the current selection.\n"
1035 << "\\auto_region_delete " << tostr(auto_region_delete)
1038 case RC_AUTORESET_OPTIONS:
1039 if (auto_reset_options != system_lyxrc.auto_reset_options) {
1040 os << "# Set to false to inhibit automatic reset of\n"
1041 << "# the class options to defaults on class change.\n"
1042 << "\\auto_reset_options " << tostr(auto_reset_options)
1046 if (autosave != system_lyxrc.autosave) {
1047 os << "# The time interval between auto-saves in seconds.\n"
1048 << "\\autosave " << autosave << "\n";
1050 case RC_DISPLAY_GRAPHICS:
1051 if (display_graphics != system_lyxrc.display_graphics) {
1052 os << "# Display graphics within LyX\n"
1053 << "# monochrome|grayscale|color|none\n"
1054 << "\\display_graphics " << display_graphics
1058 case RC_VIEWDVI_PAPEROPTION:
1059 if (view_dvi_paper_option
1060 != system_lyxrc.view_dvi_paper_option) {
1061 os << "# Options used to specify paper size to the\n"
1062 << "# view_dvi_command (e.g. -paper)\n"
1063 << "\\view_dvi_paper_option \""
1064 << view_dvi_paper_option << "\"\n";
1066 case RC_DEFAULT_PAPERSIZE:
1067 if (default_papersize != system_lyxrc.default_papersize) {
1068 os << "# The default papersize to use.\n"
1069 << "\\default_papersize \"";
1070 switch (default_papersize) {
1071 case BufferParams::PAPER_USLETTER:
1072 os << "usletter"; break;
1073 case BufferParams::PAPER_LEGALPAPER:
1074 os << "legal"; break;
1075 case BufferParams::PAPER_EXECUTIVEPAPER:
1076 os << "executive"; break;
1077 case BufferParams::PAPER_A3PAPER:
1079 case BufferParams::PAPER_A4PAPER:
1081 case BufferParams::PAPER_A5PAPER:
1083 case BufferParams::PAPER_B5PAPER:
1085 case BufferParams::PAPER_DEFAULT: break;
1090 if (ps_command != system_lyxrc.ps_command) {
1091 os << "# Program used for interpreting postscript.\n"
1092 << "\\ps_command \"" << ps_command << "\"\n";
1094 case RC_CHKTEX_COMMAND:
1095 if (chktex_command != system_lyxrc.chktex_command) {
1096 os << "\\chktex_command \"" << chktex_command << "\"\n";
1099 if (use_kbmap != system_lyxrc.use_kbmap) {
1100 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1102 case RC_KBMAP_PRIMARY:
1103 if (primary_kbmap != system_lyxrc.primary_kbmap) {
1104 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1106 case RC_KBMAP_SECONDARY:
1107 if (secondary_kbmap != system_lyxrc.secondary_kbmap) {
1108 os << "\\kbmap_secondary \"" << secondary_kbmap
1112 if (lyxpipes != system_lyxrc.lyxpipes) {
1113 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1115 case RC_DATE_INSERT_FORMAT:
1116 if (date_insert_format != system_lyxrc.date_insert_format) {
1117 os << "\\date_insert_format \"" << date_insert_format
1120 case RC_LABEL_INIT_LENGTH:
1121 if (label_init_length != system_lyxrc.label_init_length) {
1122 os << "\\label_init_length " << label_init_length
1126 case RC_SHOW_BANNER:
1127 if (show_banner != system_lyxrc.show_banner) {
1128 os << "\\show_banner " << tostr(show_banner) << "\n";
1132 if (preview != system_lyxrc.preview) {
1133 os << "\\preview " << tostr(preview) << "\n";
1136 case RC_PREVIEW_HASHED_LABELS:
1137 if (preview_hashed_labels !=
1138 system_lyxrc.preview_hashed_labels) {
1139 os << "\\preview_hashed_labels "
1140 << tostr(preview_hashed_labels) << "\n";
1143 case RC_PREVIEW_SCALE_FACTOR:
1144 if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
1145 os << "\\preview_scale_factor "
1146 << preview_scale_factor << "\n";
1150 << "# SCREEN & FONTS SECTION ############################\n"
1153 case RC_POPUP_NORMAL_FONT:
1154 if (popup_normal_font != system_lyxrc.popup_normal_font) {
1155 os << "\\popup_normal_font \"" << popup_normal_font
1158 case RC_POPUP_BOLD_FONT:
1159 if (popup_bold_font != system_lyxrc.popup_bold_font) {
1160 os << "\\popup_bold_font \"" << popup_bold_font
1163 case RC_POPUP_FONT_ENCODING:
1164 if (popup_font_encoding != system_lyxrc.popup_font_encoding) {
1165 os << "\\popup_font_encoding \"" << popup_font_encoding
1169 if (dpi != system_lyxrc.dpi) {
1170 os << "\\screen_dpi " << dpi << "\n";
1172 case RC_SCREEN_ZOOM:
1173 if (zoom != system_lyxrc.zoom) {
1174 os << "\\screen_zoom " << zoom << "\n";
1177 if (wheel_jump != system_lyxrc.wheel_jump) {
1178 os << "\\wheel_jump " << wheel_jump << "\n";
1180 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1181 if (cursor_follows_scrollbar
1182 != system_lyxrc.cursor_follows_scrollbar) {
1183 os << "\\cursor_follows_scrollbar "
1184 << tostr(cursor_follows_scrollbar) << "\n";
1186 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1187 if (dialogs_iconify_with_main
1188 != system_lyxrc.dialogs_iconify_with_main) {
1189 os << "\\dialogs_iconify_with_main "
1190 << tostr(dialogs_iconify_with_main) << "\n";
1192 case RC_SCREEN_FONT_ROMAN:
1193 if (roman_font_name != system_lyxrc.roman_font_name) {
1194 os << "\\screen_font_roman \"" << roman_font_name
1197 case RC_SCREEN_FONT_SANS:
1198 if (sans_font_name != system_lyxrc.sans_font_name) {
1199 os << "\\screen_font_sans \"" << sans_font_name
1202 case RC_SCREEN_FONT_TYPEWRITER:
1203 if (typewriter_font_name != system_lyxrc.typewriter_font_name) {
1204 os << "\\screen_font_typewriter \""
1205 << typewriter_font_name << "\"\n";
1207 case RC_SCREEN_FONT_SCALABLE:
1208 if (use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1209 os << "\\screen_font_scalable "
1210 << tostr(use_scalable_fonts)
1213 case RC_SCREEN_FONT_ENCODING:
1214 if (font_norm != system_lyxrc.font_norm) {
1215 os << "\\screen_font_encoding \"" << font_norm
1218 case RC_SCREEN_FONT_SIZES:
1219 if (font_sizes[LyXFont::SIZE_TINY]
1220 != system_lyxrc.font_sizes[LyXFont::SIZE_TINY] ||
1221 font_sizes[LyXFont::SIZE_SCRIPT]
1222 != system_lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] ||
1223 font_sizes[LyXFont::SIZE_FOOTNOTE]
1224 != system_lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] ||
1225 font_sizes[LyXFont::SIZE_SMALL]
1226 != system_lyxrc.font_sizes[LyXFont::SIZE_SMALL] ||
1227 font_sizes[LyXFont::SIZE_NORMAL]
1228 != system_lyxrc.font_sizes[LyXFont::SIZE_NORMAL] ||
1229 font_sizes[LyXFont::SIZE_LARGE]
1230 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGE] ||
1231 font_sizes[LyXFont::SIZE_LARGER]
1232 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGER] ||
1233 font_sizes[LyXFont::SIZE_LARGEST]
1234 != system_lyxrc.font_sizes[LyXFont::SIZE_LARGEST] ||
1235 font_sizes[LyXFont::SIZE_HUGE]
1236 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGE] ||
1237 font_sizes[LyXFont::SIZE_HUGER]
1238 != system_lyxrc.font_sizes[LyXFont::SIZE_HUGER]) {
1239 os.setf(ios::fixed);
1241 os << "\\screen_font_sizes"
1242 << " " << font_sizes[LyXFont::SIZE_TINY]
1243 << " " << font_sizes[LyXFont::SIZE_SCRIPT]
1244 << " " << font_sizes[LyXFont::SIZE_FOOTNOTE]
1245 << " " << font_sizes[LyXFont::SIZE_SMALL]
1246 << " " << font_sizes[LyXFont::SIZE_NORMAL]
1247 << " " << font_sizes[LyXFont::SIZE_LARGE]
1248 << " " << font_sizes[LyXFont::SIZE_LARGER]
1249 << " " << font_sizes[LyXFont::SIZE_LARGEST]
1250 << " " << font_sizes[LyXFont::SIZE_HUGE]
1251 << " " << font_sizes[LyXFont::SIZE_HUGER]
1256 << "# COLOR SECTION ###################################\n"
1260 for (int i = 0; i < LColor::ignore; ++i) {
1261 LColor::color lc = static_cast<LColor::color>(i);
1263 string const col(lcolor.getX11Name(lc));
1264 if (col != system_lcolor.getX11Name(lc)) {
1265 os << "\\set_color \""
1266 << lcolor.getLyXName(lc) << "\" \""
1272 << "# PRINTER SECTION ###################################\n"
1276 if (printer != system_lyxrc.printer) {
1277 os << "\\printer \"" << printer << "\"\n";
1279 case RC_PRINT_ADAPTOUTPUT:
1280 if (print_adapt_output != system_lyxrc.print_adapt_output) {
1281 os << "\\print_adapt_output "
1282 << tostr(print_adapt_output)
1285 case RC_PRINT_COMMAND:
1286 if (print_command != system_lyxrc.print_command) {
1287 os << "\\print_command \"" << print_command << "\"\n";
1289 case RC_PRINTEXSTRAOPTIONS:
1290 if (print_extra_options != system_lyxrc.print_extra_options) {
1291 os << "\\print_extra_options \"" << print_extra_options
1294 case RC_PRINTSPOOL_COMMAND:
1295 if (print_spool_command != system_lyxrc.print_spool_command) {
1296 os << "\\print_spool_command \"" << print_spool_command
1299 case RC_PRINTSPOOL_PRINTERPREFIX:
1300 if (print_spool_printerprefix
1301 != system_lyxrc.print_spool_printerprefix) {
1302 os << "\\print_spool_printerprefix \""
1303 << print_spool_printerprefix << "\"\n";
1305 case RC_PRINTEVENPAGEFLAG:
1306 if (print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1307 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1310 case RC_PRINTODDPAGEFLAG:
1311 if (print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1312 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1315 case RC_PRINTREVERSEFLAG:
1316 if (print_reverse_flag != system_lyxrc.print_reverse_flag) {
1317 os << "\\print_reverse_flag \"" << print_reverse_flag
1320 case RC_PRINTLANDSCAPEFLAG:
1321 if (print_landscape_flag != system_lyxrc.print_landscape_flag) {
1322 os << "\\print_landscape_flag \"" << print_landscape_flag
1325 case RC_PRINTPAGERANGEFLAG:
1326 if (print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1327 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1330 case RC_PRINTCOPIESFLAG:
1331 if (print_copies_flag != system_lyxrc.print_copies_flag) {
1332 os << "\\print_copies_flag \"" << print_copies_flag
1335 case RC_PRINTCOLLCOPIESFLAG:
1336 if (print_collcopies_flag
1337 != system_lyxrc.print_collcopies_flag) {
1338 os << "\\print_collcopies_flag \""
1339 << print_collcopies_flag
1342 case RC_PRINTPAPERFLAG:
1343 if (print_paper_flag != system_lyxrc.print_paper_flag) {
1344 os << "\\print_paper_flag \"" << print_paper_flag
1347 case RC_PRINTPAPERDIMENSIONFLAG:
1348 if (print_paper_dimension_flag
1349 != system_lyxrc.print_paper_dimension_flag) {
1350 os << "\\print_paper_dimension_flag \""
1351 << print_paper_dimension_flag << "\"\n";
1353 case RC_PRINTTOPRINTER:
1354 if (print_to_printer != system_lyxrc.print_to_printer) {
1355 os << "\\print_to_printer \"" << print_to_printer
1358 case RC_PRINTTOFILE:
1359 if (print_to_file != system_lyxrc.print_to_file) {
1360 os << "\\print_to_file \"" << print_to_file << "\"\n";
1362 case RC_PRINTFILEEXTENSION:
1363 if (print_file_extension != system_lyxrc.print_file_extension) {
1364 os << "\\print_file_extension \""
1365 << print_file_extension
1370 << "# EXPORT SECTION ####################################\n"
1373 case RC_CUSTOM_EXPORT_COMMAND:
1374 if (custom_export_command
1375 != system_lyxrc.custom_export_command) {
1376 os << "\\custom_export_command \""
1377 << custom_export_command
1380 case RC_CUSTOM_EXPORT_FORMAT:
1381 if (custom_export_format
1382 != system_lyxrc.custom_export_format) {
1383 os << "\\custom_export_format \"" << custom_export_format
1388 << "# TEX SECTION #######################################\n"
1391 case RC_FONT_ENCODING:
1392 if (fontenc != system_lyxrc.fontenc) {
1393 os << "\\font_encoding \"" << fontenc << "\"\n";
1397 << "# FILE SECTION ######################################\n"
1400 case RC_DOCUMENTPATH:
1401 if (document_path != system_lyxrc.document_path) {
1402 os << "\\document_path \"" << document_path << "\"\n";
1405 if (lastfiles != system_lyxrc.lastfiles) {
1406 os << "\\lastfiles \"" << lastfiles << "\"\n";
1408 case RC_NUMLASTFILES:
1409 if (num_lastfiles != system_lyxrc.num_lastfiles) {
1410 os << "\\num_lastfiles " << num_lastfiles << "\n";
1412 case RC_CHECKLASTFILES:
1413 if (check_lastfiles != system_lyxrc.check_lastfiles) {
1414 os << "\\check_lastfiles " << tostr(check_lastfiles)
1417 case RC_TEMPLATEPATH:
1418 if (template_path != system_lyxrc.template_path) {
1419 os << "\\template_path \"" << template_path << "\"\n";
1421 case RC_TEMPDIRPATH:
1422 if (tempdir_path != system_lyxrc.tempdir_path) {
1423 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1426 if (use_tempdir != system_lyxrc.use_tempdir) {
1427 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1429 case RC_ASCII_LINELEN:
1430 if (ascii_linelen != system_lyxrc.ascii_linelen) {
1431 os << "\\ascii_linelen " << ascii_linelen << "\n";
1433 case RC_MAKE_BACKUP:
1434 if (make_backup != system_lyxrc.make_backup) {
1435 os << "\\make_backup " << tostr(make_backup) << "\n";
1437 case RC_BACKUPDIR_PATH:
1438 if (backupdir_path != system_lyxrc.backupdir_path) {
1439 os << "\\backupdir_path \"" << backupdir_path << "\"\n";
1443 << "# ASCII EXPORT SECTION ##############################\n"
1446 case RC_ASCIIROFF_COMMAND:
1447 if (ascii_roff_command != system_lyxrc.ascii_roff_command) {
1448 os << "\\ascii_roff_command \"" << ascii_roff_command
1453 << "# SPELLCHECKER SECTION ##############################\n"
1457 if (use_pspell != system_lyxrc.use_pspell) {
1458 os << "\\use_pspell " << tostr(use_pspell) << "\n";
1461 case RC_SPELL_COMMAND:
1462 if (isp_command != system_lyxrc.isp_command) {
1463 os << "\\spell_command \"" << isp_command << "\"\n";
1465 case RC_ACCEPT_COMPOUND:
1466 if (isp_accept_compound != system_lyxrc.isp_accept_compound) {
1467 os << "\\accept_compound " << tostr(isp_accept_compound)
1470 case RC_USE_ALT_LANG:
1471 if (isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
1472 os << "\\use_alt_language " << tostr(isp_use_alt_lang)
1476 if (isp_alt_lang != system_lyxrc.isp_alt_lang) {
1477 os << "\\alternate_language \"" << isp_alt_lang
1480 case RC_USE_ESC_CHARS:
1481 if (isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
1482 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1486 if (isp_esc_chars != system_lyxrc.isp_esc_chars) {
1487 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1489 case RC_USE_PERS_DICT:
1490 if (isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
1491 os << "\\use_personal_dictionary "
1492 << tostr(isp_use_pers_dict)
1496 if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
1497 os << "\\personal_dictionary \"" << isp_pers_dict
1500 case RC_USE_INP_ENC:
1501 if (isp_use_input_encoding
1502 != system_lyxrc.isp_use_input_encoding) {
1503 os << "\\use_input_encoding "
1504 << tostr(isp_use_input_encoding)
1509 << "# LANGUAGE SUPPORT SECTION ##########################\n"
1512 case RC_RTL_SUPPORT:
1513 if (rtl_support != system_lyxrc.rtl_support) {
1514 os << "\\rtl " << tostr(rtl_support) << "\n";
1516 case RC_LANGUAGE_PACKAGE:
1517 if (language_package != system_lyxrc.language_package) {
1518 os << "\\language_package \"" << language_package
1521 case RC_LANGUAGE_GLOBAL_OPTIONS:
1522 if (language_global_options
1523 != system_lyxrc.language_global_options) {
1524 os << "\\language_global_options \""
1525 << tostr(language_global_options)
1528 case RC_LANGUAGE_USE_BABEL:
1529 if (language_use_babel != system_lyxrc.language_use_babel) {
1530 os << "\\language_use_babel \""
1531 << tostr(language_use_babel)
1534 case RC_LANGUAGE_COMMAND_BEGIN:
1535 if (language_command_begin
1536 != system_lyxrc.language_command_begin) {
1537 os << "\\language_command_begin \""
1538 << language_command_begin
1541 case RC_LANGUAGE_COMMAND_END:
1542 if (language_command_end
1543 != system_lyxrc.language_command_end) {
1544 os << "\\language_command_end \"" << language_command_end
1547 case RC_LANGUAGE_COMMAND_LOCAL:
1548 if (language_command_local
1549 != system_lyxrc.language_command_local) {
1550 os << "\\language_command_local \""
1551 << language_command_local
1554 case RC_LANGUAGE_AUTO_BEGIN:
1555 if (language_auto_begin != system_lyxrc.language_auto_begin) {
1556 os << "\\language_auto_begin "
1557 << tostr(language_auto_begin) << "\n";
1559 case RC_LANGUAGE_AUTO_END:
1560 if (language_auto_end != system_lyxrc.language_auto_end) {
1561 os << "\\language_auto_end "
1562 << tostr(language_auto_end) << "\n";
1564 case RC_MARK_FOREIGN_LANGUAGE:
1565 if (mark_foreign_language
1566 != system_lyxrc.mark_foreign_language) {
1567 os << "\\mark_foreign_language " <<
1568 tostr(mark_foreign_language) << "\n";
1572 << "# 2nd MISC SUPPORT SECTION ##########################\n"
1575 case RC_OVERRIDE_X_DEADKEYS:
1576 if (override_x_deadkeys != system_lyxrc.override_x_deadkeys) {
1577 os << "\\override_x_deadkeys "
1578 << tostr(override_x_deadkeys) << "\n";
1580 case RC_AUTO_NUMBER:
1581 if (auto_number != system_lyxrc.auto_number) {
1582 os << "\\auto_number " << tostr(auto_number) << "\n";
1584 case RC_DEFAULT_LANGUAGE:
1585 if (default_language != system_lyxrc.default_language) {
1586 os << "\\default_language " << default_language << "\n";
1590 << "# FORMATS SECTION ##########################\n"
1594 // Look for deleted formats
1595 for (Formats::const_iterator cit = formats.begin();
1596 cit != formats.end(); ++cit) {
1597 Format const * format =
1598 system_formats.getFormat(cit->name());
1600 format->extension() != cit->extension() ||
1601 format->prettyname() != cit->prettyname() ||
1602 format->shortcut() != cit->shortcut())
1603 os << "\\format \"" << cit->name() << "\" \""
1604 << cit->extension() << "\" \""
1605 << cit->prettyname() << "\" \""
1606 << cit->shortcut() << "\"\n";
1609 // New/modifed formats
1610 for (Formats::const_iterator cit = system_formats.begin();
1611 cit != system_formats.end(); ++cit)
1612 if (!formats.getFormat(cit->name()))
1613 os << "\\format \"" << cit->name()
1614 << "\" \"\" \"\" \"\"\n";
1616 for (Formats::const_iterator cit = formats.begin();
1617 cit != formats.end(); ++cit) {
1618 Format const * format =
1619 system_formats.getFormat(cit->name());
1620 if ((!format || format->viewer() != cit->viewer()) &&
1621 (format || !cit->viewer().empty()))
1622 os << "\\viewer \"" << cit->name() << "\" \""
1623 << cit->viewer() << "\"\n";
1627 << "# CONVERTERS SECTION ##########################\n"
1631 // Look for new converters
1632 for (Converters::const_iterator cit = converters.begin();
1633 cit != converters.end(); ++cit) {
1634 Converter const * converter =
1635 system_converters.getConverter(cit->from,
1638 converter->command != cit->command ||
1639 converter->flags != cit->flags)
1640 os << "\\converter \"" << cit->from << "\" \""
1641 << cit->to << "\" \""
1642 << cit->command << "\" \""
1643 << cit->flags << "\"\n";
1646 // New/modifed converters
1647 for (Converters::const_iterator cit = system_converters.begin();
1648 cit != system_converters.end(); ++cit)
1649 if (!converters.getConverter(cit->from, cit->to))
1650 os << "\\converter \"" << cit->from
1651 << "\" \"" << cit->to << "\" \"\" \"\"\n";
1656 void LyXRC::set_font_norm_type()
1658 if (font_norm == "iso10646-1")
1659 font_norm_type = ISO_10646_1;
1660 else if (font_norm == "iso8859-1")
1661 font_norm_type = ISO_8859_1;
1662 else if (font_norm == "iso8859-3")
1663 font_norm_type = ISO_8859_3;
1664 else if (font_norm == "iso8859-4")
1665 font_norm_type = ISO_8859_4;
1666 else if (font_norm == "iso8859-6.8x")
1667 font_norm_type = ISO_8859_6_8;
1668 else if (font_norm == "iso8859-9")
1669 font_norm_type = ISO_8859_9;
1670 else if (font_norm == "iso8859-15")
1671 font_norm_type = ISO_8859_15;
1673 font_norm_type = OTHER_ENCODING;
1677 string const LyXRC::getDescription(LyXRCTags tag)
1682 case RC_FONT_ENCODING:
1683 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
1687 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
1690 case RC_PRINT_COMMAND:
1691 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
1694 case RC_PRINTEVENPAGEFLAG:
1695 str = _("The option to print only even pages.");
1698 case RC_PRINTODDPAGEFLAG:
1699 str = _("The option to print only odd pages.");
1702 case RC_PRINTPAGERANGEFLAG:
1703 str = _("The option for specifying a comma-separated list of pages to print.");
1706 case RC_PRINTCOPIESFLAG:
1707 str = _("The option for specifying the number of copies to print.");
1710 case RC_PRINTCOLLCOPIESFLAG:
1711 str = _("The option for specifying whether the copies should be collated.");
1714 case RC_PRINTREVERSEFLAG:
1715 str = _("The option to reverse the order of the pages printed.");
1718 case RC_PRINTLANDSCAPEFLAG:
1719 str = _("The option to print out in landscape.");
1722 case RC_PRINTPAPERFLAG:
1723 str = _("The option to specify paper type.");
1726 case RC_PRINTPAPERDIMENSIONFLAG:
1727 str = _("Option to specify the dimensions of the print paper.");
1730 case RC_PRINTTOPRINTER:
1731 str = _("Option to pass to the print program to print on a specific printer.");
1734 case RC_PRINT_ADAPTOUTPUT:
1735 str = _("Select for LyX to pass the name of the destination printer to your print command.");
1738 case RC_PRINTTOFILE:
1739 str = _("Option to pass to the print program to print to a file.");
1742 case RC_PRINTFILEEXTENSION:
1743 str = _("Extension of printer program output file. Usually \".ps\".");
1746 case RC_PRINTEXSTRAOPTIONS:
1747 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
1750 case RC_PRINTSPOOL_COMMAND:
1751 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.");
1754 case RC_PRINTSPOOL_PRINTERPREFIX:
1755 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.");
1759 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
1762 case RC_SCREEN_ZOOM:
1763 //xgettext:no-c-format
1764 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
1767 case RC_SCREEN_FONT_SIZES:
1768 str = _("The font sizes used for calculating the scaling of the screen fonts.");
1771 case RC_SCREEN_FONT_ROMAN:
1772 case RC_SCREEN_FONT_SANS:
1773 case RC_SCREEN_FONT_TYPEWRITER:
1774 str = _("The screen fonts used to display the text while editing.");
1777 case RC_POPUP_BOLD_FONT:
1778 str = _("The bold font in the dialogs.");
1781 case RC_POPUP_NORMAL_FONT:
1782 str = _("The normal font in the dialogs.");
1785 case RC_SCREEN_FONT_ENCODING:
1786 str = _("The encoding for the screen fonts.");
1789 case RC_POPUP_FONT_ENCODING:
1790 str = _("The encoding for the menu/popups fonts.");
1797 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
1800 case RC_DOCUMENTPATH:
1801 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
1804 case RC_TEMPLATEPATH:
1805 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
1808 case RC_TEMPDIRPATH:
1809 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
1813 str = _("Select if you wish to use a temporary directory structure to store temporary TeX output.");
1817 str = _("The file where the last-files information should be stored.");
1820 case RC_AUTOREGIONDELETE:
1821 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
1824 case RC_AUTORESET_OPTIONS:
1825 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
1828 case RC_OVERRIDE_X_DEADKEYS:
1829 str = _("Select if LyX is to take over the handling of the dead keys (a.k.a. accent keys) that may be defined for your keyboard.");
1834 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
1838 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
1842 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
1846 case RC_KBMAP_PRIMARY:
1847 case RC_KBMAP_SECONDARY:
1848 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.");
1851 case RC_ASCIIROFF_COMMAND:
1852 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.");
1855 case RC_ASCII_LINELEN:
1856 str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
1859 case RC_NUMLASTFILES:
1860 str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
1863 case RC_CHECKLASTFILES:
1864 str = _("Select to check whether the lastfiles still exist.");
1867 case RC_VIEWDVI_PAPEROPTION:
1868 str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
1871 case RC_DEFAULT_PAPERSIZE:
1872 str = _("Specify the default paper size.");
1878 case RC_ACCEPT_COMPOUND:
1879 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
1882 case RC_SPELL_COMMAND:
1883 str = _("What command runs the spell checker?");
1886 case RC_USE_INP_ENC:
1887 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.");
1890 case RC_USE_ALT_LANG:
1892 str = _("Specify an alternate language. The default is to use the language of the document.");
1895 case RC_USE_PERS_DICT:
1897 str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
1900 case RC_USE_ESC_CHARS:
1902 str = _("Specify additional chars that can be part of a word.");
1905 case RC_SCREEN_FONT_SCALABLE:
1906 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.");
1909 case RC_CHKTEX_COMMAND:
1910 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
1913 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1914 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.");
1917 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1918 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
1921 case RC_DISPLAY_GRAPHICS:
1922 str = _("Select how LyX will display any graphics.");
1925 case RC_MAKE_BACKUP:
1926 str = _("De-select if you don't want LyX to create backup files.");
1929 case RC_BACKUPDIR_PATH:
1930 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.");
1933 case RC_RTL_SUPPORT:
1934 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
1937 case RC_MARK_FOREIGN_LANGUAGE:
1938 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
1941 case RC_LANGUAGE_PACKAGE:
1942 str = _("The latex command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
1945 case RC_LANGUAGE_GLOBAL_OPTIONS:
1946 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
1949 case RC_LANGUAGE_USE_BABEL:
1950 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
1953 case RC_LANGUAGE_AUTO_BEGIN:
1954 str = _("Select if a language switching command is needed at the beginning of the document.");
1957 case RC_LANGUAGE_AUTO_END:
1958 str = _("Select if a language switching command is needed at the end of the document.");
1961 case RC_LANGUAGE_COMMAND_BEGIN:
1962 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.");
1965 case RC_LANGUAGE_COMMAND_END:
1966 str = _("The latex command for changing back to the language of the document.");
1969 case RC_LANGUAGE_COMMAND_LOCAL:
1970 str = _("The latex command for local changing of the language.");
1973 case RC_DATE_INSERT_FORMAT:
1974 //xgettext:no-c-format
1975 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
1978 case RC_SHOW_BANNER:
1979 str = _("De-select if you don't want the startup banner.");
1983 str = _("The wheel movement factor (for mice with wheels or five button mice).");
1995 case RC_DEFAULT_LANGUAGE:
1996 str = _("New documents will be assigned this language.");
1999 case RC_LABEL_INIT_LENGTH:
2000 str = _("Maximum number of words in the initialization string for a new label");
2004 str = _("Shows a typeset preview of things such as math");
2007 case RC_PREVIEW_HASHED_LABELS:
2008 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2011 case RC_PREVIEW_SCALE_FACTOR:
2012 str = _("Scale the preview size to suit.");
2022 // The global instance
2025 // The global copy of the system lyxrc entries (everything except preferences)