1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-1999 The LyX Team.
9 * ====================================================== */
14 #pragma implementation "lyxrc.h"
26 #include "LyXAction.h"
27 #include "lyxserver.h"
30 #include "tex-strings.h"
31 #include "support/path.h"
32 #include "support/filetools.h"
35 // this is crappy... why are those colors command line arguments and
36 // not in lyxrc?? (Matthias)
37 // Because nobody put them there. (Asger)
38 extern int fast_selection;
39 extern string background_color;
40 extern char selection_color[];
41 extern bool cursor_follows_scrollbar;
42 extern kb_keymap * toplevel_keymap;
43 extern LyXAction lyxaction;
52 RC_PRINTPAGERANGEFLAG,
54 RC_PRINTCOLLCOPIESFLAG,
56 RC_PRINTLANDSCAPEFLAG,
60 RC_PRINTFILEEXTENSION,
61 RC_PRINTEXSTRAOPTIONS,
62 RC_PRINTSPOOL_COMMAND,
63 RC_PRINTSPOOL_PRINTERPREFIX,
65 RC_PRINTPAPERDIMENSIONFLAG,
66 RC_CUSTOM_EXPORT_COMMAND,
67 RC_CUSTOM_EXPORT_FORMAT,
70 RC_LITERATE_EXTENSION,
71 RC_LITERATE_ERROR_FILTER,
73 RC_BUILD_ERROR_FILTER,
79 RC_SCREEN_FONT_TYPEWRITER,
82 RC_SCREEN_FONT_ENCODING,
84 RC_SGML_EXTRA_OPTIONS,
93 RC_NOMENUACCELERATORS,
105 RC_ASCIIROFF_COMMAND,
110 RC_DEFAULT_PAPERSIZE,
113 RC_VIEWPSPIC_COMMAND,
120 RC_SCREEN_FONT_SCALABLE,
125 RC_CURSOR_FOLLOWS_SCROLLBAR,
126 RC_EXIT_CONFIRMATION,
127 RC_DISPLAY_SHORTCUTS,
134 RC_PDF_TO_PS_COMMAND,
135 RC_DVI_TO_PS_COMMAND,
136 RC_DATE_INSERT_FORMAT,
141 static keyword_item lyxrcTags[] = {
142 { "\\accept_compound", RC_ACCEPT_COMPOUND },
143 { "\\alternate_language", RC_ALT_LANG },
144 { "\\ascii_linelen", RC_ASCII_LINELEN },
145 { "\\ascii_roff_command", RC_ASCIIROFF_COMMAND },
146 { "\\auto_region_delete", RC_AUTOREGIONDELETE },
147 { "\\autosave", RC_AUTOSAVE },
148 { "\\background_color", RC_BACKGROUND_COLOR },
149 { "\\begin_toolbar", RC_BEGINTOOLBAR },
150 { "\\bind", RC_BIND },
151 { "\\bind_file", RC_BINDFILE },
152 { "\\build_command", RC_BUILD_COMMAND },
153 { "\\build_error_filter", RC_BUILD_ERROR_FILTER },
154 { "\\check_lastfiles", RC_CHECKLASTFILES },
155 { "\\chktex_command", RC_CHKTEX_COMMAND },
156 { "\\cursor_follows_scrollbar", RC_CURSOR_FOLLOWS_SCROLLBAR },
157 { "\\custom_export_command", RC_CUSTOM_EXPORT_COMMAND },
158 { "\\custom_export_format", RC_CUSTOM_EXPORT_FORMAT },
159 { "\\default_papersize", RC_DEFAULT_PAPERSIZE },
160 { "\\display_shortcuts", RC_DISPLAY_SHORTCUTS },
161 { "\\document_path", RC_DOCUMENTPATH },
162 { "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND },
163 { "\\escape_chars", RC_ESC_CHARS },
164 { "\\exit_confirmation", RC_EXIT_CONFIRMATION },
165 { "\\fast_selection", RC_FAST_SELECTION },
166 { "\\fax_command", RC_FAX_COMMAND },
167 { "\\fax_program", RC_FAXPROGRAM },
168 { "\\font_encoding", RC_FONT_ENCODING },
169 { "\\html_command", RC_HTML_COMMAND },
170 { "\\input", RC_INPUT },
171 { "\\date_insert_format", RC_DATE_INSERT_FORMAT },
172 { "\\kbmap", RC_KBMAP },
173 { "\\kbmap_primary", RC_KBMAP_PRIMARY },
174 { "\\kbmap_secondary", RC_KBMAP_SECONDARY },
175 { "\\lastfiles", RC_LASTFILES },
176 { "\\latex_command", RC_LATEX_COMMAND },
177 { "\\literate_command", RC_LITERATE_COMMAND },
178 { "\\literate_error_filter", RC_LITERATE_ERROR_FILTER },
179 { "\\literate_extension", RC_LITERATE_EXTENSION },
180 { "\\make_backup", RC_MAKE_BACKUP },
181 { "\\num_lastfiles", RC_NUMLASTFILES },
182 { "\\pdf_mode", RC_PDF_MODE },
183 { "\\pdf_to_ps_command", RC_PDF_TO_PS_COMMAND },
184 { "\\pdflatex_command", RC_PDFLATEX_COMMAND },
185 { "\\personal_dictionary", RC_PERS_DICT },
186 { "\\phone_book", RC_PHONEBOOK },
187 { "\\print_adapt_output", RC_PRINT_ADAPTOUTPUT },
188 { "\\print_collcopies_flag", RC_PRINTCOLLCOPIESFLAG },
189 { "\\print_command", RC_PRINT_COMMAND },
190 { "\\print_copies_flag", RC_PRINTCOPIESFLAG },
191 { "\\print_evenpage_flag", RC_PRINTEVENPAGEFLAG },
192 { "\\print_extra_options", RC_PRINTEXSTRAOPTIONS },
193 { "\\print_file_extension", RC_PRINTFILEEXTENSION },
194 { "\\print_landscape_flag", RC_PRINTLANDSCAPEFLAG },
195 { "\\print_oddpage_flag", RC_PRINTODDPAGEFLAG },
196 { "\\print_pagerange_flag", RC_PRINTPAGERANGEFLAG },
197 { "\\print_paper_dimension_flag", RC_PRINTPAPERDIMENSIONFLAG },
198 { "\\print_paper_flag", RC_PRINTPAPERFLAG },
199 { "\\print_reverse_flag", RC_PRINTREVERSEFLAG },
200 { "\\print_spool_command", RC_PRINTSPOOL_COMMAND },
201 { "\\print_spool_printerprefix", RC_PRINTSPOOL_PRINTERPREFIX },
202 { "\\print_to_file", RC_PRINTTOFILE },
203 { "\\print_to_printer", RC_PRINTTOPRINTER },
204 { "\\printer", RC_PRINTER },
205 { "\\ps_command", RC_PS_COMMAND },
206 { "\\relyx_command", RC_RELYX_COMMAND },
207 { "\\screen_dpi", RC_SCREEN_DPI },
208 { "\\screen_font_encoding", RC_SCREEN_FONT_ENCODING },
209 { "\\screen_font_menu", RC_SCREEN_FONT_MENU },
210 { "\\screen_font_popup", RC_SCREEN_FONT_POPUP },
211 { "\\screen_font_roman", RC_SCREEN_FONT_ROMAN },
212 { "\\screen_font_sans", RC_SCREEN_FONT_SANS },
213 { "\\screen_font_scalable", RC_SCREEN_FONT_SCALABLE },
214 { "\\screen_font_sizes", RC_SCREEN_FONT_SIZES },
215 { "\\screen_font_typewriter", RC_SCREEN_FONT_TYPEWRITER },
216 { "\\screen_zoom", RC_SCREEN_ZOOM },
217 { "\\selection_color", RC_SELECTION_COLOR },
218 { "\\serverpipe", RC_SERVERPIPE },
219 { "\\sgml_extra_options", RC_SGML_EXTRA_OPTIONS },
220 { "\\spell_command", RC_SPELL_COMMAND },
221 { "\\tempdir_path", RC_TEMPDIRPATH },
222 { "\\template_path", RC_TEMPLATEPATH },
223 { "\\use_alt_language", RC_USE_ALT_LANG },
224 { "\\use_escape_chars", RC_USE_ESC_CHARS },
225 { "\\use_input_encoding", RC_USE_INP_ENC },
226 { "\\use_personal_dictionary", RC_USE_PERS_DICT },
227 { "\\use_tempdir", RC_USETEMPDIR },
228 { "\\view_dvi_command", RC_VIEWDVI_COMMAND },
229 { "\\view_pdf_command", RC_VIEWPDF_COMMAND },
230 { "\\view_ps_command", RC_VIEWPS_COMMAND },
231 { "\\view_pspic_command", RC_VIEWPSPIC_COMMAND }
234 /* Let the range depend of the size of lyxrcTags. Alejandro 240596 */
235 static const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
237 // Should this be moved inside LyXAction?
239 int bindKey(char const * seq, int action)
241 return toplevel_keymap->bind(seq, action);
247 // Get printer from the environment. If fail, use default "",
248 // assuming that everything is set up correctly.
249 printer = GetEnv("PRINTER");
250 print_adapt_output = false;
251 print_command = "dvips";
252 print_evenpage_flag = "-B";
253 print_oddpage_flag = "-A";
254 print_pagerange_flag = "-pp";
255 print_copies_flag = "-c";
256 print_collcopies_flag = "-C";
257 print_reverse_flag = "-r";
258 print_landscape_flag = "-t landscape";
259 print_to_printer = "-P";
260 print_to_file = "-o ";
261 print_file_extension = ".ps";
262 print_paper_flag = "-t";
263 print_paper_dimension_flag = "-T";
264 document_path = GetEnvPath("HOME");
265 tempdir_path = "/tmp";
268 latex_command = "latex";
269 pdflatex_command = "pdflatex";
270 pdf_to_ps_command = "pdf2ps";
271 dvi_to_ps_command = "dvips";
272 literate_command = "none";
273 literate_extension = "none";
274 literate_error_filter = "cat";
275 build_command = "make";
276 build_error_filter = "cat";
277 relyx_command = "reLyX";
279 view_ps_command = "ghostview -swap";
280 view_pspic_command = "ghostview";
281 view_dvi_command = "xdvi";
282 view_pdf_command = "xpdf";
283 default_papersize = BufferParams::PAPER_USLETTER;
284 custom_export_format = "ps";
285 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
286 html_command = "tth -t";
289 // Because a screen typically is wider than a piece of paper:
291 // Default LaTeX font size:
292 font_sizes[LyXFont::SIZE_TINY] = 5.0;
293 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
294 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
295 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
296 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
297 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
298 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
299 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
300 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
301 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
302 use_scalable_fonts = true;
303 roman_font_name = "-*-times";
304 sans_font_name = "-*-helvetica";
305 typewriter_font_name = "-*-courier";
306 menu_font_name = "-*-helvetica-bold-r";
307 popup_font_name = "-*-helvetica-medium-r";
308 font_norm = "iso8859-1";
310 auto_region_delete = true;
313 check_lastfiles = true;
315 exit_confirmation = true;
316 display_shortcuts = true;
317 // Spellchecker settings:
318 isp_command = "ispell";
319 isp_accept_compound = false;
320 isp_use_input_encoding = false;
321 isp_use_alt_lang = false;
322 isp_use_pers_dict = false;
323 isp_use_esc_chars = false;
326 defaultKeyBindings();
328 date_insert_format = "%A, %e. %B %Y";
332 int LyXRC::ReadBindFile(string const & name)
335 string tmp = i18nLibFileSearch("bind", name, "bind");
336 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
337 int result = read(tmp);
339 lyxerr << "Error reading bind file: " << tmp << endl;
345 int LyXRC::read(string const & filename)
348 string bindFile = "cua";
350 LyXLex lexrc(lyxrcTags, lyxrcCount);
351 if (lyxerr.debugging(Debug::PARSER))
354 lexrc.setFile(filename);
355 if (!lexrc.IsOK()) return -2;
357 lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
359 while (lexrc.IsOK()) {
360 // By using two switches we take advantage of the compiler
361 // telling us if we have missed a LyXRCTags element in
362 // the second switch.
363 // Note that this also shows a problem with LyXLex since it
364 // helps us avoid taking advantage of the strictness of the
367 int le = lexrc.lex();
369 case LyXLex::LEX_UNDEF:
370 lexrc.printError("Unknown tag `$$Token'");
372 case LyXLex::LEX_FEOF:
376 switch (static_cast<LyXRCTags>(le)) {
377 case RC_INPUT: // Include file
379 string tmp = LibFileSearch(string(),
382 lexrc.printError("Error reading "
383 "included file: "+tmp);
387 case RC_BINDFILE: // RVDK_PATCH_5
389 ReadBindFile(lexrc.GetString());
393 case RC_BEGINTOOLBAR:
394 // this toolbar should be changed to be a completely
395 // non gui toolbar. (Lgb)
401 use_kbmap = lexrc.GetBool();
404 case RC_EXIT_CONFIRMATION:
406 exit_confirmation = lexrc.GetBool();
409 case RC_DISPLAY_SHORTCUTS:
411 display_shortcuts = lexrc.GetBool();
414 case RC_KBMAP_PRIMARY:
416 primary_kbmap = lexrc.GetString();
419 case RC_KBMAP_SECONDARY:
421 secondary_kbmap = lexrc.GetString();
424 case RC_FONT_ENCODING:
426 fontenc = lexrc.GetString();
431 printer = lexrc.GetString();
434 case RC_PRINT_COMMAND:
436 print_command = lexrc.GetString();
439 case RC_PRINTEVENPAGEFLAG:
441 print_evenpage_flag = lexrc.GetString();
444 case RC_PRINTODDPAGEFLAG:
446 print_oddpage_flag = lexrc.GetString();
449 case RC_PRINTPAGERANGEFLAG:
451 print_pagerange_flag = lexrc.GetString();
454 case RC_PRINTCOPIESFLAG:
456 print_copies_flag = lexrc.GetString();
459 case RC_PRINTCOLLCOPIESFLAG:
461 print_collcopies_flag = lexrc.GetString();
464 case RC_PRINTREVERSEFLAG:
466 print_reverse_flag = lexrc.GetString();
469 case RC_PRINTLANDSCAPEFLAG:
471 print_landscape_flag = lexrc.GetString();
474 case RC_PRINTTOPRINTER:
476 print_to_printer = lexrc.GetString();
479 case RC_PRINT_ADAPTOUTPUT:
481 print_adapt_output = lexrc.GetBool();
486 print_to_file = lexrc.GetString();
489 case RC_PRINTFILEEXTENSION:
491 print_file_extension = lexrc.GetString();
494 case RC_PRINTEXSTRAOPTIONS:
496 print_extra_options = lexrc.GetString();
499 case RC_PRINTSPOOL_COMMAND:
501 print_spool_command = lexrc.GetString();
504 case RC_PRINTSPOOL_PRINTERPREFIX:
506 print_spool_printerprefix = lexrc.GetString();
509 case RC_PRINTPAPERDIMENSIONFLAG:
511 print_paper_dimension_flag = lexrc.GetString();
514 case RC_PRINTPAPERFLAG:
516 print_paper_flag = lexrc.GetString();
519 case RC_CUSTOM_EXPORT_COMMAND:
521 custom_export_command = lexrc.GetString();
524 case RC_CUSTOM_EXPORT_FORMAT:
526 custom_export_format = lexrc.GetString();
531 pdf_mode = lexrc.GetBool();
534 case RC_LATEX_COMMAND:
536 latex_command = lexrc.GetString();
539 case RC_PDFLATEX_COMMAND:
541 pdflatex_command = lexrc.GetString();
544 case RC_PDF_TO_PS_COMMAND:
546 pdf_to_ps_command = lexrc.GetString();
549 case RC_DVI_TO_PS_COMMAND:
551 dvi_to_ps_command = lexrc.GetString();
554 case RC_LITERATE_COMMAND:
556 literate_command = lexrc.GetString();
559 case RC_LITERATE_EXTENSION:
561 literate_extension = lexrc.GetString();
564 case RC_LITERATE_ERROR_FILTER:
566 literate_error_filter = lexrc.GetString();
569 case RC_BUILD_COMMAND:
571 build_command = lexrc.GetString();
574 case RC_BUILD_ERROR_FILTER:
576 build_error_filter = lexrc.GetString();
579 case RC_RELYX_COMMAND:
581 relyx_command = lexrc.GetString();
584 case RC_DEFAULT_PAPERSIZE:
586 string size = lowercase(lexrc.GetString());
587 if (size == "usletter")
589 BufferParams::PAPER_USLETTER;
590 else if (size == "legal")
592 BufferParams::PAPER_LEGALPAPER;
593 else if (size == "executive")
595 BufferParams::PAPER_EXECUTIVEPAPER;
596 else if (size == "a3")
598 BufferParams::PAPER_A3PAPER;
599 else if (size == "a4")
601 BufferParams::PAPER_A4PAPER;
602 else if (size == "a5")
604 BufferParams::PAPER_A5PAPER;
605 else if (size == "b5")
607 BufferParams::PAPER_B5PAPER;
610 case RC_VIEWDVI_COMMAND:
612 view_dvi_command = lexrc.GetString();
615 case RC_VIEWPDF_COMMAND:
617 view_pdf_command = lexrc.GetString();
622 ps_command = lexrc.GetString();
625 case RC_VIEWPS_COMMAND:
627 view_ps_command = lexrc.GetString();
630 case RC_VIEWPSPIC_COMMAND:
632 view_pspic_command = lexrc.GetString();
635 case RC_CHKTEX_COMMAND:
637 chktex_command = lexrc.GetString();
640 case RC_HTML_COMMAND:
642 html_command = lexrc.GetString();
647 dpi = lexrc.GetInteger();
652 zoom = lexrc.GetInteger();
655 case RC_SCREEN_FONT_SIZES:
657 font_sizes[LyXFont::SIZE_TINY] =
660 font_sizes[LyXFont::SIZE_SCRIPT] =
663 font_sizes[LyXFont::SIZE_FOOTNOTE] =
666 font_sizes[LyXFont::SIZE_SMALL] =
669 font_sizes[LyXFont::SIZE_NORMAL] =
672 font_sizes[LyXFont::SIZE_LARGE] =
675 font_sizes[LyXFont::SIZE_LARGER] =
678 font_sizes[LyXFont::SIZE_LARGEST] =
681 font_sizes[LyXFont::SIZE_HUGE] =
684 font_sizes[LyXFont::SIZE_HUGER] =
688 case RC_SCREEN_FONT_SCALABLE:
690 use_scalable_fonts = lexrc.GetBool();
695 autosave = lexrc.GetInteger();
698 case RC_SGML_EXTRA_OPTIONS:
700 sgml_extra_options = lexrc.GetString();
703 case RC_DOCUMENTPATH:
705 document_path = ExpandPath(lexrc.GetString());
709 case RC_TEMPLATEPATH:
711 template_path = ExpandPath(lexrc.GetString());
716 tempdir_path = ExpandPath(lexrc.GetString());
721 use_tempdir = lexrc.GetBool();
726 lastfiles = ExpandPath(lexrc.GetString());
729 case RC_NUMLASTFILES:
731 num_lastfiles = lexrc.GetInteger();
734 case RC_CHECKLASTFILES:
736 check_lastfiles = lexrc.GetBool();
739 case RC_SCREEN_FONT_ROMAN:
741 roman_font_name = lexrc.GetString();
744 case RC_SCREEN_FONT_SANS:
746 sans_font_name = lexrc.GetString();
749 case RC_SCREEN_FONT_TYPEWRITER:
751 typewriter_font_name = lexrc.GetString();
754 case RC_SCREEN_FONT_MENU:
756 menu_font_name = lexrc.GetString();
759 case RC_SCREEN_FONT_POPUP:
761 popup_font_name = lexrc.GetString();
764 case RC_SCREEN_FONT_ENCODING:
766 font_norm = lexrc.GetString();
769 case RC_AUTOREGIONDELETE:
770 // Auto region delete defaults to true
772 auto_region_delete = lexrc.GetBool();
777 // we should not do an explicit binding before
778 // loading a bind file. So, in this case, load
779 // the default bind file.
783 // !!!chb, dynamic key binding...
787 if (lexrc.lex() == LyXLex::LEX_DATA) {
788 seq = lexrc.GetString();
790 lexrc.printError("Bad key sequence: `$$Token'");
794 if (lexrc.lex() == LyXLex::LEX_DATA) {
795 cmd = lexrc.GetString();
797 lexrc.printError("Bad command: `$$Token'");
801 if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) {
802 if (lyxerr.debugging(Debug::KEY)) {
803 lyxerr << "RC_BIND: Sequence `"
804 << seq << "' Command `"
805 << cmd << "' Action `"
806 << action << '\'' << endl;
808 res = bindKey(seq.c_str(), action);
811 "Invalid key sequence `"
814 } else {// cmd is the last token read.
816 "Unknown LyX function `$$Token'");
822 lyxpipes = ExpandPath(lexrc.GetString());
825 case RC_CURSOR_FOLLOWS_SCROLLBAR:
827 cursor_follows_scrollbar = lexrc.GetBool();
830 case RC_FAST_SELECTION:
832 fast_selection = lexrc.GetBool();
835 case RC_BACKGROUND_COLOR:
837 background_color = lexrc.GetString();
839 case RC_SELECTION_COLOR:
841 strncpy(selection_color,
842 lexrc.GetString().c_str(), 31);
846 fax_command = lexrc.GetString();
850 fax_program = lexrc.GetString();
854 string s = lexrc.GetString();
858 phone_book = user_lyxdir + s;
861 case RC_ASCIIROFF_COMMAND:
863 ascii_roff_command = lexrc.GetString();
865 case RC_ASCII_LINELEN:
867 ascii_linelen = lexrc.GetInteger();
869 // Spellchecker settings:
870 case RC_SPELL_COMMAND:
872 isp_command = lexrc.GetString();
874 case RC_ACCEPT_COMPOUND:
876 isp_accept_compound = lexrc.GetBool();
880 isp_use_input_encoding = lexrc.GetBool();
882 case RC_USE_ALT_LANG:
884 isp_use_alt_lang = lexrc.GetBool();
886 case RC_USE_PERS_DICT:
888 isp_use_pers_dict = lexrc.GetBool();
890 case RC_USE_ESC_CHARS:
892 isp_use_esc_chars = lexrc.GetBool();
896 isp_alt_lang = lexrc.GetString();
900 isp_pers_dict = lexrc.GetString();
904 isp_esc_chars = lexrc.GetString();
908 make_backup = lexrc.GetBool();
910 case RC_DATE_INSERT_FORMAT:
912 date_insert_format = lexrc.GetString();
914 case RC_LAST: break; // this is just a dummy
922 void LyXRC::write(string const & filename) const
924 ofstream ofs(filename.c_str());
930 void LyXRC::print() const
932 if (lyxerr.debugging())
939 void LyXRC::output(ostream & os) const
941 os << "### This file is part of\n"
942 << "### ========================================================\n"
943 << "### LyX, The Document Processor\n"
945 << "### Copyright 1995 Matthias Ettrich\n"
946 << "### Copyright 1995-1998 The LyX Team.\n"
948 << "### ========================================================\n"
950 << "# This file is written by LyX, if you want to make your own\n"
951 << "# modifications you should do them from inside LyX and save\n"
952 << "# your preferences, or you can also make your modifications\n"
953 << "# to lyxrc by hand. It is not advisable to edit this file.\n"
956 // Why the switch you might ask. It is a trick to ensure that all
957 // the elements in the LyXRCTags enum is handled. As you can see
958 // there are no breaks at all. So it is just a huge fall-through.
959 // The nice thing is that we will get a warning from the compiler
960 // if we forget an element.
961 LyXRCTags tag = RC_LAST;
965 // input/include files are not done here
967 // bindings is not written to the preferences file.
969 // bind files are not done here.
970 case RC_BEGINTOOLBAR:
971 // Toolbar is not written here (yet).
972 case RC_FONT_ENCODING:
973 os << "\\font_encoding \"" << fontenc << "\"\n";
975 os << "\\printer \"" << printer << "\"\n";
976 case RC_PRINT_COMMAND:
977 os << "\\print_command \"" << print_command << "\"\n";
978 case RC_PRINTEVENPAGEFLAG:
979 os << "\\print_evenpage_flag \"" << print_evenpage_flag
981 case RC_PRINTODDPAGEFLAG:
982 os << "\\print_oddpage_flag \"" << print_oddpage_flag
984 case RC_PRINTPAGERANGEFLAG:
985 os << "\\print_pagerange_flag \"" << print_pagerange_flag
987 case RC_PRINTCOPIESFLAG:
988 os << "\\print_copies_flag \"" << print_copies_flag << "\"\n";
989 case RC_PRINTCOLLCOPIESFLAG:
990 os << "\\print_collcopies_flag \"" << print_collcopies_flag
992 case RC_PRINTREVERSEFLAG:
993 os << "\\print_reverse_flag \"" << print_reverse_flag
995 case RC_PRINTLANDSCAPEFLAG:
996 os << "\\print_landscape_flag \"" << print_landscape_flag
998 case RC_PRINTTOPRINTER:
999 os << "\\print_to_printer \"" << print_to_printer << "\"\n";
1000 case RC_PRINT_ADAPTOUTPUT:
1001 os << "\\print_adapt_output " << tostr(print_adapt_output)
1003 case RC_PRINTTOFILE:
1004 os << "\\print_to_file \"" << print_to_file << "\"\n";
1005 case RC_PRINTFILEEXTENSION:
1006 os << "\\print_file_extension \"" << print_file_extension
1008 case RC_PRINTEXSTRAOPTIONS:
1009 os << "\\print_extra_options \"" << print_extra_options
1011 case RC_PRINTSPOOL_COMMAND:
1012 os << "\\print_spool_command \"" << print_spool_command
1014 case RC_PRINTSPOOL_PRINTERPREFIX:
1015 os << "\\print_spool_printerprefix \""
1016 << print_spool_printerprefix << "\"\n";
1017 case RC_PRINTPAPERDIMENSIONFLAG:
1018 os << "\\print_paper_dimension_flag \""
1019 << print_paper_dimension_flag << "\"\n";
1020 case RC_PRINTPAPERFLAG:
1021 os << "\\print_paper_flag \"" << print_paper_flag << "\"\n";
1022 case RC_CUSTOM_EXPORT_COMMAND:
1023 os << "\\custom_export_command \"" << custom_export_command
1025 case RC_CUSTOM_EXPORT_FORMAT:
1026 os << "\\custom_export_format \"" << custom_export_format
1029 os << "\\pdf_mode " << tostr(pdf_mode) << "\n";
1030 case RC_LATEX_COMMAND:
1031 os << "\\latex_command \"" << latex_command << "\"\n";
1032 case RC_PDFLATEX_COMMAND:
1033 os << "\\pdflatex_command \"" << pdflatex_command << "\"\n";
1034 case RC_PDF_TO_PS_COMMAND:
1035 os << "\\pdf_to_ps_command \"" << pdf_to_ps_command << "\"\n";
1036 case RC_DVI_TO_PS_COMMAND:
1037 os << "\\dvi_to_ps_command \"" << dvi_to_ps_command << "\"\n";
1038 case RC_LITERATE_COMMAND:
1039 os << "\\literate_command \"" << literate_command << "\"\n";
1040 case RC_LITERATE_EXTENSION:
1041 os << "\\literate_extension \"" << literate_extension
1043 case RC_LITERATE_ERROR_FILTER:
1044 os << "\\literate_error_filter \"" << literate_error_filter
1046 case RC_BUILD_COMMAND:
1047 os << "\\build_command \"" << build_command << "\"\n";
1048 case RC_BUILD_ERROR_FILTER:
1049 os << "\\build_error_filter \"" << build_error_filter
1052 os << "\\screen_dpi " << dpi << "\n";
1053 case RC_SCREEN_ZOOM:
1054 os << "\\screen_zoom " << zoom << "\n";
1055 case RC_SCREEN_FONT_SIZES:
1056 os.setf(ios::fixed);
1058 os << "\\screen_font_sizes";
1059 os << " " << font_sizes[LyXFont::SIZE_TINY];
1060 os << " " << font_sizes[LyXFont::SIZE_SCRIPT];
1061 os << " " << font_sizes[LyXFont::SIZE_FOOTNOTE];
1062 os << " " << font_sizes[LyXFont::SIZE_SMALL];
1063 os << " " << font_sizes[LyXFont::SIZE_NORMAL];
1064 os << " " << font_sizes[LyXFont::SIZE_LARGE];
1065 os << " " << font_sizes[LyXFont::SIZE_LARGER];
1066 os << " " << font_sizes[LyXFont::SIZE_LARGEST];
1067 os << " " << font_sizes[LyXFont::SIZE_HUGE];
1068 os << " " << font_sizes[LyXFont::SIZE_HUGER];
1070 case RC_AUTOREGIONDELETE:
1071 os << "\\auto_region_delete " << tostr(auto_region_delete)
1074 os << "\\autosave " << autosave << "\n";
1075 case RC_EXIT_CONFIRMATION:
1076 os << "\\exit_confirmation " << tostr(exit_confirmation)
1078 case RC_DISPLAY_SHORTCUTS:
1079 os << "\\display_shortcuts " << tostr(display_shortcuts)
1081 case RC_VIEWDVI_COMMAND:
1082 os << "\\view_dvi_command \"" << view_dvi_command << "\"\n";
1083 case RC_VIEWPDF_COMMAND:
1084 os << "\\view_pdf_command \"" << view_pdf_command << "\"\n";
1085 case RC_DEFAULT_PAPERSIZE:
1086 os << "\\default_papersize \"";
1087 switch (default_papersize) {
1088 case BufferParams::PAPER_USLETTER:
1089 os << "usletter"; break;
1090 case BufferParams::PAPER_LEGALPAPER:
1091 os << "legal"; break;
1092 case BufferParams::PAPER_EXECUTIVEPAPER:
1093 os << "executive"; break;
1094 case BufferParams::PAPER_A3PAPER:
1096 case BufferParams::PAPER_A4PAPER:
1098 case BufferParams::PAPER_A5PAPER:
1100 case BufferParams::PAPER_B5PAPER:
1102 case BufferParams::PAPER_DEFAULT: break;
1105 case RC_VIEWPS_COMMAND:
1106 os << "\\view_ps_command \"" << view_ps_command << "\"\n";
1107 case RC_VIEWPSPIC_COMMAND:
1108 os << "\\view_pspic_command \"" << view_pspic_command
1111 os << "\\ps_command \"" << ps_command << "\"\n";
1112 case RC_CHKTEX_COMMAND:
1113 os << "\\chktex_command \"" << chktex_command << "\"\n";
1114 case RC_HTML_COMMAND:
1115 os << "\\html_command \"" << html_command << "\"\n";
1116 case RC_SGML_EXTRA_OPTIONS:
1117 os << "\\sgml_extra_options \"" << sgml_extra_options
1120 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1121 case RC_KBMAP_PRIMARY:
1122 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1123 case RC_KBMAP_SECONDARY:
1124 os << "\\kbmap_secondary \"" << secondary_kbmap << "\"\n";
1126 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1127 case RC_RELYX_COMMAND:
1128 os << "\\relyx_command \"" << relyx_command << "\"\n";
1129 case RC_DOCUMENTPATH:
1130 os << "\\document_path \"" << document_path << "\"\n";
1131 case RC_TEMPLATEPATH:
1132 os << "\\template_path \"" << template_path << "\"\n";
1133 case RC_TEMPDIRPATH:
1134 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1136 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1138 os << "\\lastfiles \"" << lastfiles << "\"\n";
1139 case RC_NUMLASTFILES:
1140 os << "\\num_lastfiles " << num_lastfiles << "\n";
1141 case RC_CHECKLASTFILES:
1142 os << "\\check_lastfiles " << tostr(check_lastfiles) << "\n";
1143 case RC_SCREEN_FONT_ROMAN:
1144 os << "\\screen_font_roman \"" << roman_font_name << "\"\n";
1145 case RC_SCREEN_FONT_SANS:
1146 os << "\\screen_font_sans \"" << sans_font_name << "\"\n";
1147 case RC_SCREEN_FONT_TYPEWRITER:
1148 os << "\\screen_font_typewriter \""
1149 << typewriter_font_name << "\"\n";
1150 case RC_SCREEN_FONT_MENU:
1151 os << "\\screen_font_menu \"" << menu_font_name << "\"\n";
1152 case RC_SCREEN_FONT_POPUP:
1153 os << "\\screen_font_popup \"" << popup_font_name << "\"\n";
1154 case RC_SCREEN_FONT_ENCODING:
1155 os << "\\screen_font_encoding \"" << font_norm << "\"\n";
1156 case RC_SCREEN_FONT_SCALABLE:
1157 os << "\\screen_font_scalable " << tostr(use_scalable_fonts)
1159 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1160 os << "\\cursor_follows_scrollbar "
1161 << tostr(cursor_follows_scrollbar) << "\n";
1162 case RC_FAST_SELECTION:
1163 os << "\\fast_selection "
1164 << tostr(static_cast<bool>(fast_selection)) << "\n";
1165 case RC_BACKGROUND_COLOR:
1166 os << "\\background_color \"" << background_color << "\"\n";
1167 case RC_SELECTION_COLOR:
1168 os << "\\selection_color \"" << selection_color << "\"\n";
1169 case RC_FAX_COMMAND:
1170 os << "\\fax_command \"" << fax_command << "\"\n";
1172 os << "\\fax_program \"" << fax_program << "\"\n";
1174 os << "\\phone_book \"" << phone_book << "\"\n";
1175 case RC_ASCIIROFF_COMMAND:
1176 os << "\\ascii_roff_command \"" << ascii_roff_command
1178 case RC_ASCII_LINELEN:
1179 os << "\\ascii_linelen " << ascii_linelen << "\n";
1180 case RC_SPELL_COMMAND:
1181 os << "\\spell_command \"" << isp_command << "\"\n";
1182 case RC_ACCEPT_COMPOUND:
1183 os << "\\accept_compound " << tostr(isp_accept_compound)
1185 case RC_USE_INP_ENC:
1186 os << "\\use_input_encoding " << tostr(isp_use_input_encoding)
1188 case RC_USE_ALT_LANG:
1189 os << "\\use_alt_language " << tostr(isp_use_alt_lang) << "\n";
1190 case RC_USE_PERS_DICT:
1191 os << "\\use_personal_dictionary " << tostr(isp_use_pers_dict)
1193 case RC_USE_ESC_CHARS:
1194 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1197 os << "\\alternate_language \"" << isp_alt_lang << "\"\n";
1199 os << "\\personal_dictionary \"" << isp_pers_dict << "\"\n";
1201 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1202 case RC_MAKE_BACKUP:
1203 os << "\\make_backup " << tostr(make_backup) << "\n";
1204 case RC_DATE_INSERT_FORMAT:
1205 os << "\\date_insert_format \"" << date_insert_format
1212 /// define the default key bindings for LyX.
1213 void LyXRC::defaultKeyBindings()
1215 bindKey("Right", LFUN_RIGHT);
1216 bindKey("Left", LFUN_LEFT);
1217 bindKey("Up", LFUN_UP);
1218 bindKey("Down", LFUN_DOWN);
1220 bindKey("Tab", LFUN_TAB);
1222 bindKey("Home", LFUN_HOME);
1223 bindKey("End", LFUN_END);
1224 bindKey("Prior", LFUN_PRIOR);
1225 bindKey("Next", LFUN_NEXT);
1227 bindKey("Return", LFUN_BREAKPARAGRAPH);
1228 bindKey("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE);
1230 bindKey("Delete", LFUN_DELETE);
1231 bindKey("BackSpace", LFUN_BACKSPACE);
1232 // bindKeyings for transparent handling of deadkeys
1233 // The keysyms are gotten from XFree86 X11R6
1234 bindKey("~C-~S-~M-dead_acute", LFUN_ACUTE);
1235 bindKey("~C-~S-~M-dead_breve", LFUN_BREVE);
1236 bindKey("~C-~S-~M-dead_caron", LFUN_CARON);
1237 bindKey("~C-~S-~M-dead_cedilla", LFUN_CEDILLA);
1238 bindKey("~C-~S-~M-dead_abovering", LFUN_CIRCLE);
1239 bindKey("~C-~S-~M-dead_circumflex", LFUN_CIRCUMFLEX);
1240 bindKey("~C-~S-~M-dead_abovedot", LFUN_DOT);
1241 bindKey("~C-~S-~M-dead_grave", LFUN_GRAVE);
1242 bindKey("~C-~S-~M-dead_doubleacute", LFUN_HUNG_UMLAUT);
1243 bindKey("~C-~S-~M-dead_macron", LFUN_MACRON);
1244 // nothing with this name
1245 // bindKey("~C-~S-~M-dead_special_caron", LFUN_SPECIAL_CARON);
1246 bindKey("~C-~S-~M-dead_tilde", LFUN_TILDE);
1247 bindKey("~C-~S-~M-dead_diaeresis", LFUN_UMLAUT);
1248 // nothing with this name either...
1249 //bindKey("~C-~S-~M-dead_underbar", LFUN_UNDERBAR);
1250 bindKey("~C-~S-~M-dead_belowdot", LFUN_UNDERDOT);
1251 bindKey("~C-~S-~M-dead_tie", LFUN_TIE);
1252 bindKey("~C-~S-~M-dead_ogonek", LFUN_OGONEK);
1254 // bindings to utilize the use of the numeric keypad
1255 // e.g. Num Lock set
1256 bindKey("KP_0", LFUN_SELFINSERT);
1257 bindKey("KP_Decimal", LFUN_SELFINSERT);
1258 bindKey("KP_Enter", LFUN_SELFINSERT);
1259 bindKey("KP_1", LFUN_SELFINSERT);
1260 bindKey("KP_2", LFUN_SELFINSERT);
1261 bindKey("KP_3", LFUN_SELFINSERT);
1262 bindKey("KP_4", LFUN_SELFINSERT);
1263 bindKey("KP_5", LFUN_SELFINSERT);
1264 bindKey("KP_6", LFUN_SELFINSERT);
1265 bindKey("KP_Add", LFUN_SELFINSERT);
1266 bindKey("KP_7", LFUN_SELFINSERT);
1267 bindKey("KP_8", LFUN_SELFINSERT);
1268 bindKey("KP_9", LFUN_SELFINSERT);
1269 bindKey("KP_Divide", LFUN_SELFINSERT);
1270 bindKey("KP_Multiply", LFUN_SELFINSERT);
1271 bindKey("KP_Subtract", LFUN_SELFINSERT);
1273 /* Most self-insert keys are handled in the 'default:' section of
1274 * WorkAreaKeyPress - so we don't have to define them all.
1275 * However keys explicit decleared as self-insert are
1276 * handled seperatly (LFUN_SELFINSERT.) Lgb. */
1278 bindKey("C-Tab", LFUN_TABINSERT); // ale970515