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,
140 static keyword_item lyxrcTags[] = {
141 { "\\accept_compound", RC_ACCEPT_COMPOUND },
142 { "\\alternate_language", RC_ALT_LANG },
143 { "\\ascii_linelen", RC_ASCII_LINELEN },
144 { "\\ascii_roff_command", RC_ASCIIROFF_COMMAND },
145 { "\\auto_region_delete", RC_AUTOREGIONDELETE },
146 { "\\autosave", RC_AUTOSAVE },
147 { "\\background_color", RC_BACKGROUND_COLOR },
148 { "\\begin_toolbar", RC_BEGINTOOLBAR },
149 { "\\bind", RC_BIND },
150 { "\\bind_file", RC_BINDFILE },
151 { "\\build_command", RC_BUILD_COMMAND },
152 { "\\build_error_filter", RC_BUILD_ERROR_FILTER },
153 { "\\check_lastfiles", RC_CHECKLASTFILES },
154 { "\\chktex_command", RC_CHKTEX_COMMAND },
155 { "\\cursor_follows_scrollbar", RC_CURSOR_FOLLOWS_SCROLLBAR },
156 { "\\custom_export_command", RC_CUSTOM_EXPORT_COMMAND },
157 { "\\custom_export_format", RC_CUSTOM_EXPORT_FORMAT },
158 { "\\default_papersize", RC_DEFAULT_PAPERSIZE },
159 { "\\display_shortcuts", RC_DISPLAY_SHORTCUTS },
160 { "\\document_path", RC_DOCUMENTPATH },
161 { "\\dvi_to_ps_command", RC_DVI_TO_PS_COMMAND },
162 { "\\escape_chars", RC_ESC_CHARS },
163 { "\\exit_confirmation", RC_EXIT_CONFIRMATION },
164 { "\\fast_selection", RC_FAST_SELECTION },
165 { "\\fax_command", RC_FAX_COMMAND },
166 { "\\fax_program", RC_FAXPROGRAM },
167 { "\\font_encoding", RC_FONT_ENCODING },
168 { "\\html_command", RC_HTML_COMMAND },
169 { "\\input", RC_INPUT },
170 { "\\kbmap", RC_KBMAP },
171 { "\\kbmap_primary", RC_KBMAP_PRIMARY },
172 { "\\kbmap_secondary", RC_KBMAP_SECONDARY },
173 { "\\lastfiles", RC_LASTFILES },
174 { "\\latex_command", RC_LATEX_COMMAND },
175 { "\\literate_command", RC_LITERATE_COMMAND },
176 { "\\literate_error_filter", RC_LITERATE_ERROR_FILTER },
177 { "\\literate_extension", RC_LITERATE_EXTENSION },
178 { "\\make_backup", RC_MAKE_BACKUP },
179 { "\\num_lastfiles", RC_NUMLASTFILES },
180 { "\\pdf_mode", RC_PDF_MODE },
181 { "\\pdf_to_ps_command", RC_PDF_TO_PS_COMMAND },
182 { "\\pdflatex_command", RC_PDFLATEX_COMMAND },
183 { "\\personal_dictionary", RC_PERS_DICT },
184 { "\\phone_book", RC_PHONEBOOK },
185 { "\\print_adapt_output", RC_PRINT_ADAPTOUTPUT },
186 { "\\print_collcopies_flag", RC_PRINTCOLLCOPIESFLAG },
187 { "\\print_command", RC_PRINT_COMMAND },
188 { "\\print_copies_flag", RC_PRINTCOPIESFLAG },
189 { "\\print_evenpage_flag", RC_PRINTEVENPAGEFLAG },
190 { "\\print_extra_options", RC_PRINTEXSTRAOPTIONS },
191 { "\\print_file_extension", RC_PRINTFILEEXTENSION },
192 { "\\print_landscape_flag", RC_PRINTLANDSCAPEFLAG },
193 { "\\print_oddpage_flag", RC_PRINTODDPAGEFLAG },
194 { "\\print_pagerange_flag", RC_PRINTPAGERANGEFLAG },
195 { "\\print_paper_dimension_flag", RC_PRINTPAPERDIMENSIONFLAG },
196 { "\\print_paper_flag", RC_PRINTPAPERFLAG },
197 { "\\print_reverse_flag", RC_PRINTREVERSEFLAG },
198 { "\\print_spool_command", RC_PRINTSPOOL_COMMAND },
199 { "\\print_spool_printerprefix", RC_PRINTSPOOL_PRINTERPREFIX },
200 { "\\print_to_file", RC_PRINTTOFILE },
201 { "\\print_to_printer", RC_PRINTTOPRINTER },
202 { "\\printer", RC_PRINTER },
203 { "\\ps_command", RC_PS_COMMAND },
204 { "\\relyx_command", RC_RELYX_COMMAND },
205 { "\\screen_dpi", RC_SCREEN_DPI },
206 { "\\screen_font_encoding", RC_SCREEN_FONT_ENCODING },
207 { "\\screen_font_menu", RC_SCREEN_FONT_MENU },
208 { "\\screen_font_popup", RC_SCREEN_FONT_POPUP },
209 { "\\screen_font_roman", RC_SCREEN_FONT_ROMAN },
210 { "\\screen_font_sans", RC_SCREEN_FONT_SANS },
211 { "\\screen_font_scalable", RC_SCREEN_FONT_SCALABLE },
212 { "\\screen_font_sizes", RC_SCREEN_FONT_SIZES },
213 { "\\screen_font_typewriter", RC_SCREEN_FONT_TYPEWRITER },
214 { "\\screen_zoom", RC_SCREEN_ZOOM },
215 { "\\selection_color", RC_SELECTION_COLOR },
216 { "\\serverpipe", RC_SERVERPIPE },
217 { "\\sgml_extra_options", RC_SGML_EXTRA_OPTIONS },
218 { "\\spell_command", RC_SPELL_COMMAND },
219 { "\\tempdir_path", RC_TEMPDIRPATH },
220 { "\\template_path", RC_TEMPLATEPATH },
221 { "\\use_alt_language", RC_USE_ALT_LANG },
222 { "\\use_escape_chars", RC_USE_ESC_CHARS },
223 { "\\use_input_encoding", RC_USE_INP_ENC },
224 { "\\use_personal_dictionary", RC_USE_PERS_DICT },
225 { "\\use_tempdir", RC_USETEMPDIR },
226 { "\\view_dvi_command", RC_VIEWDVI_COMMAND },
227 { "\\view_pdf_command", RC_VIEWPDF_COMMAND },
228 { "\\view_ps_command", RC_VIEWPS_COMMAND },
229 { "\\view_pspic_command", RC_VIEWPSPIC_COMMAND }
232 /* Let the range depend of the size of lyxrcTags. Alejandro 240596 */
233 static const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
235 // Should this be moved inside LyXAction?
237 int bindKey(char const * seq, int action)
239 return toplevel_keymap->bind(seq, action);
245 // Get printer from the environment. If fail, use default "",
246 // assuming that everything is set up correctly.
247 printer = GetEnv("PRINTER");
248 print_adapt_output = false;
249 print_command = "dvips";
250 print_evenpage_flag = "-B";
251 print_oddpage_flag = "-A";
252 print_pagerange_flag = "-pp";
253 print_copies_flag = "-c";
254 print_collcopies_flag = "-C";
255 print_reverse_flag = "-r";
256 print_landscape_flag = "-t landscape";
257 print_to_printer = "-P";
258 print_to_file = "-o ";
259 print_file_extension = ".ps";
260 print_paper_flag = "-t";
261 print_paper_dimension_flag = "-T";
262 document_path = GetEnvPath("HOME");
263 tempdir_path = "/tmp";
266 latex_command = "latex";
267 pdflatex_command = "pdflatex";
268 pdf_to_ps_command = "pdf2ps";
269 dvi_to_ps_command = "dvips";
270 literate_command = "none";
271 literate_extension = "none";
272 literate_error_filter = "cat";
273 build_command = "make";
274 build_error_filter = "cat";
275 relyx_command = "reLyX";
277 view_ps_command = "ghostview -swap";
278 view_pspic_command = "ghostview";
279 view_dvi_command = "xdvi";
280 view_pdf_command = "xpdf";
281 default_papersize = BufferParams::PAPER_USLETTER;
282 custom_export_format = "ps";
283 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
284 html_command = "tth -t";
287 // Because a screen typically is wider than a piece of paper:
289 // Default LaTeX font size:
290 font_sizes[LyXFont::SIZE_TINY] = 5.0;
291 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
292 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
293 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
294 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
295 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
296 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
297 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
298 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
299 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
300 use_scalable_fonts = true;
301 roman_font_name = "-*-times";
302 sans_font_name = "-*-helvetica";
303 typewriter_font_name = "-*-courier";
304 menu_font_name = "-*-helvetica-bold-r";
305 popup_font_name = "-*-helvetica-medium-r";
306 font_norm = "iso8859-1";
308 auto_region_delete = true;
311 check_lastfiles = true;
313 exit_confirmation = true;
314 display_shortcuts = true;
315 // Spellchecker settings:
316 isp_command = "ispell";
317 isp_accept_compound = false;
318 isp_use_input_encoding = false;
319 isp_use_alt_lang = false;
320 isp_use_pers_dict = false;
321 isp_use_esc_chars = false;
324 defaultKeyBindings();
328 int LyXRC::ReadBindFile(string const & name)
331 string tmp = i18nLibFileSearch("bind", name, "bind");
332 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
333 int result = read(tmp);
335 lyxerr << "Error reading bind file: " << tmp << endl;
341 int LyXRC::read(string const & filename)
344 string bindFile = "cua";
346 LyXLex lexrc(lyxrcTags, lyxrcCount);
347 if (lyxerr.debugging(Debug::PARSER))
350 lexrc.setFile(filename);
351 if (!lexrc.IsOK()) return -2;
353 lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
355 while (lexrc.IsOK()) {
356 // By using two switches we take advantage of the compiler
357 // telling us if we have missed a LyXRCTags element in
358 // the second switch.
359 // Note that this also shows a problem with LyXLex since it
360 // helps us avoid taking advantage of the strictness of the
363 int le = lexrc.lex();
365 case LyXLex::LEX_UNDEF:
366 lexrc.printError("Unknown tag `$$Token'");
368 case LyXLex::LEX_FEOF:
372 switch (static_cast<LyXRCTags>(le)) {
373 case RC_INPUT: // Include file
375 string tmp = LibFileSearch(string(),
378 lexrc.printError("Error reading "
379 "included file: "+tmp);
383 case RC_BINDFILE: // RVDK_PATCH_5
385 ReadBindFile(lexrc.GetString());
389 case RC_BEGINTOOLBAR:
390 // this toolbar should be changed to be a completely
391 // non gui toolbar. (Lgb)
397 use_kbmap = lexrc.GetBool();
400 case RC_EXIT_CONFIRMATION:
402 exit_confirmation = lexrc.GetBool();
405 case RC_DISPLAY_SHORTCUTS:
407 display_shortcuts = lexrc.GetBool();
410 case RC_KBMAP_PRIMARY:
412 primary_kbmap = lexrc.GetString();
415 case RC_KBMAP_SECONDARY:
417 secondary_kbmap = lexrc.GetString();
420 case RC_FONT_ENCODING:
422 fontenc = lexrc.GetString();
427 printer = lexrc.GetString();
430 case RC_PRINT_COMMAND:
432 print_command = lexrc.GetString();
435 case RC_PRINTEVENPAGEFLAG:
437 print_evenpage_flag = lexrc.GetString();
440 case RC_PRINTODDPAGEFLAG:
442 print_oddpage_flag = lexrc.GetString();
445 case RC_PRINTPAGERANGEFLAG:
447 print_pagerange_flag = lexrc.GetString();
450 case RC_PRINTCOPIESFLAG:
452 print_copies_flag = lexrc.GetString();
455 case RC_PRINTCOLLCOPIESFLAG:
457 print_collcopies_flag = lexrc.GetString();
460 case RC_PRINTREVERSEFLAG:
462 print_reverse_flag = lexrc.GetString();
465 case RC_PRINTLANDSCAPEFLAG:
467 print_landscape_flag = lexrc.GetString();
470 case RC_PRINTTOPRINTER:
472 print_to_printer = lexrc.GetString();
475 case RC_PRINT_ADAPTOUTPUT:
477 print_adapt_output = lexrc.GetBool();
482 print_to_file = lexrc.GetString();
485 case RC_PRINTFILEEXTENSION:
487 print_file_extension = lexrc.GetString();
490 case RC_PRINTEXSTRAOPTIONS:
492 print_extra_options = lexrc.GetString();
495 case RC_PRINTSPOOL_COMMAND:
497 print_spool_command = lexrc.GetString();
500 case RC_PRINTSPOOL_PRINTERPREFIX:
502 print_spool_printerprefix = lexrc.GetString();
505 case RC_PRINTPAPERDIMENSIONFLAG:
507 print_paper_dimension_flag = lexrc.GetString();
510 case RC_PRINTPAPERFLAG:
512 print_paper_flag = lexrc.GetString();
515 case RC_CUSTOM_EXPORT_COMMAND:
517 custom_export_command = lexrc.GetString();
520 case RC_CUSTOM_EXPORT_FORMAT:
522 custom_export_format = lexrc.GetString();
527 pdf_mode = lexrc.GetBool();
530 case RC_LATEX_COMMAND:
532 latex_command = lexrc.GetString();
535 case RC_PDFLATEX_COMMAND:
537 pdflatex_command = lexrc.GetString();
540 case RC_PDF_TO_PS_COMMAND:
542 pdf_to_ps_command = lexrc.GetString();
545 case RC_DVI_TO_PS_COMMAND:
547 dvi_to_ps_command = lexrc.GetString();
550 case RC_LITERATE_COMMAND:
552 literate_command = lexrc.GetString();
555 case RC_LITERATE_EXTENSION:
557 literate_extension = lexrc.GetString();
560 case RC_LITERATE_ERROR_FILTER:
562 literate_error_filter = lexrc.GetString();
565 case RC_BUILD_COMMAND:
567 build_command = lexrc.GetString();
570 case RC_BUILD_ERROR_FILTER:
572 build_error_filter = lexrc.GetString();
575 case RC_RELYX_COMMAND:
577 relyx_command = lexrc.GetString();
580 case RC_DEFAULT_PAPERSIZE:
582 string size = lowercase(lexrc.GetString());
583 if (size == "usletter")
585 BufferParams::PAPER_USLETTER;
586 else if (size == "legal")
588 BufferParams::PAPER_LEGALPAPER;
589 else if (size == "executive")
591 BufferParams::PAPER_EXECUTIVEPAPER;
592 else if (size == "a3")
594 BufferParams::PAPER_A3PAPER;
595 else if (size == "a4")
597 BufferParams::PAPER_A4PAPER;
598 else if (size == "a5")
600 BufferParams::PAPER_A5PAPER;
601 else if (size == "b5")
603 BufferParams::PAPER_B5PAPER;
606 case RC_VIEWDVI_COMMAND:
608 view_dvi_command = lexrc.GetString();
611 case RC_VIEWPDF_COMMAND:
613 view_pdf_command = lexrc.GetString();
618 ps_command = lexrc.GetString();
621 case RC_VIEWPS_COMMAND:
623 view_ps_command = lexrc.GetString();
626 case RC_VIEWPSPIC_COMMAND:
628 view_pspic_command = lexrc.GetString();
631 case RC_CHKTEX_COMMAND:
633 chktex_command = lexrc.GetString();
636 case RC_HTML_COMMAND:
638 html_command = lexrc.GetString();
643 dpi = lexrc.GetInteger();
648 zoom = lexrc.GetInteger();
651 case RC_SCREEN_FONT_SIZES:
653 font_sizes[LyXFont::SIZE_TINY] =
656 font_sizes[LyXFont::SIZE_SCRIPT] =
659 font_sizes[LyXFont::SIZE_FOOTNOTE] =
662 font_sizes[LyXFont::SIZE_SMALL] =
665 font_sizes[LyXFont::SIZE_NORMAL] =
668 font_sizes[LyXFont::SIZE_LARGE] =
671 font_sizes[LyXFont::SIZE_LARGER] =
674 font_sizes[LyXFont::SIZE_LARGEST] =
677 font_sizes[LyXFont::SIZE_HUGE] =
680 font_sizes[LyXFont::SIZE_HUGER] =
684 case RC_SCREEN_FONT_SCALABLE:
686 use_scalable_fonts = lexrc.GetBool();
691 autosave = lexrc.GetInteger();
694 case RC_SGML_EXTRA_OPTIONS:
696 sgml_extra_options = lexrc.GetString();
699 case RC_DOCUMENTPATH:
701 document_path = ExpandPath(lexrc.GetString());
705 case RC_TEMPLATEPATH:
707 template_path = ExpandPath(lexrc.GetString());
712 tempdir_path = ExpandPath(lexrc.GetString());
717 use_tempdir = lexrc.GetBool();
722 lastfiles = ExpandPath(lexrc.GetString());
725 case RC_NUMLASTFILES:
727 num_lastfiles = lexrc.GetInteger();
730 case RC_CHECKLASTFILES:
732 check_lastfiles = lexrc.GetBool();
735 case RC_SCREEN_FONT_ROMAN:
737 roman_font_name = lexrc.GetString();
740 case RC_SCREEN_FONT_SANS:
742 sans_font_name = lexrc.GetString();
745 case RC_SCREEN_FONT_TYPEWRITER:
747 typewriter_font_name = lexrc.GetString();
750 case RC_SCREEN_FONT_MENU:
752 menu_font_name = lexrc.GetString();
755 case RC_SCREEN_FONT_POPUP:
757 popup_font_name = lexrc.GetString();
760 case RC_SCREEN_FONT_ENCODING:
762 font_norm = lexrc.GetString();
765 case RC_AUTOREGIONDELETE:
766 // Auto region delete defaults to true
768 auto_region_delete = lexrc.GetBool();
773 // we should not do an explicit binding before
774 // loading a bind file. So, in this case, load
775 // the default bind file.
779 // !!!chb, dynamic key binding...
783 if (lexrc.lex() == LyXLex::LEX_DATA) {
784 seq = lexrc.GetString();
786 lexrc.printError("Bad key sequence: `$$Token'");
790 if (lexrc.lex() == LyXLex::LEX_DATA) {
791 cmd = lexrc.GetString();
793 lexrc.printError("Bad command: `$$Token'");
797 if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) {
798 if (lyxerr.debugging(Debug::KEY)) {
799 lyxerr << "RC_BIND: Sequence `"
800 << seq << "' Command `"
801 << cmd << "' Action `"
802 << action << '\'' << endl;
804 res = bindKey(seq.c_str(), action);
807 "Invalid key sequence `"
810 } else {// cmd is the last token read.
812 "Unknown LyX function `$$Token'");
818 lyxpipes = ExpandPath(lexrc.GetString());
821 case RC_CURSOR_FOLLOWS_SCROLLBAR:
823 cursor_follows_scrollbar = lexrc.GetBool();
826 case RC_FAST_SELECTION:
828 fast_selection = lexrc.GetBool();
831 case RC_BACKGROUND_COLOR:
833 background_color = lexrc.GetString();
835 case RC_SELECTION_COLOR:
837 strncpy(selection_color,
838 lexrc.GetString().c_str(), 31);
842 fax_command = lexrc.GetString();
846 fax_program = lexrc.GetString();
850 string s = lexrc.GetString();
854 phone_book = user_lyxdir + s;
857 case RC_ASCIIROFF_COMMAND:
859 ascii_roff_command = lexrc.GetString();
861 case RC_ASCII_LINELEN:
863 ascii_linelen = lexrc.GetInteger();
865 // Spellchecker settings:
866 case RC_SPELL_COMMAND:
868 isp_command = lexrc.GetString();
870 case RC_ACCEPT_COMPOUND:
872 isp_accept_compound = lexrc.GetBool();
876 isp_use_input_encoding = lexrc.GetBool();
878 case RC_USE_ALT_LANG:
880 isp_use_alt_lang = lexrc.GetBool();
882 case RC_USE_PERS_DICT:
884 isp_use_pers_dict = lexrc.GetBool();
886 case RC_USE_ESC_CHARS:
888 isp_use_esc_chars = lexrc.GetBool();
892 isp_alt_lang = lexrc.GetString();
896 isp_pers_dict = lexrc.GetString();
900 isp_esc_chars = lexrc.GetString();
904 make_backup = lexrc.GetBool();
906 case RC_LAST: break; // this is just a dummy
914 void LyXRC::write(string const & filename) const
916 ofstream ofs(filename.c_str());
922 void LyXRC::print() const
924 if (lyxerr.debugging())
931 void LyXRC::output(ostream & os) const
933 os << "### This file is part of\n"
934 << "### ========================================================\n"
935 << "### LyX, The Document Processor\n"
937 << "### Copyright 1995 Matthias Ettrich\n"
938 << "### Copyright 1995-1998 The LyX Team.\n"
940 << "### ========================================================\n"
942 << "# This file is written by LyX, if you want to make your own\n"
943 << "# modifications you should do them from inside LyX and save\n"
944 << "# your preferences, or you can also make your modifications\n"
945 << "# to lyxrc by hand. It is not advisable to edit this file.\n"
948 // Why the switch you might ask. It is a trick to ensure that all
949 // the elements in the LyXRCTags enum is handled. As you can see
950 // there are no breaks at all. So it is just a huge fall-through.
951 // The nice thing is that we will get a warning from the compiler
952 // if we forget an element.
953 LyXRCTags tag = RC_LAST;
957 // input/include files are not done here
959 // bindings is not written to the preferences file.
961 // bind files are not done here.
962 case RC_BEGINTOOLBAR:
963 // Toolbar is not written here (yet).
964 case RC_FONT_ENCODING:
965 os << "\\font_encoding \"" << fontenc << "\"\n";
967 os << "\\printer \"" << printer << "\"\n";
968 case RC_PRINT_COMMAND:
969 os << "\\print_command \"" << print_command << "\"\n";
970 case RC_PRINTEVENPAGEFLAG:
971 os << "\\print_evenpage_flag \"" << print_evenpage_flag
973 case RC_PRINTODDPAGEFLAG:
974 os << "\\print_oddpage_flag \"" << print_oddpage_flag
976 case RC_PRINTPAGERANGEFLAG:
977 os << "\\print_pagerange_flag \"" << print_pagerange_flag
979 case RC_PRINTCOPIESFLAG:
980 os << "\\print_copies_flag \"" << print_copies_flag << "\"\n";
981 case RC_PRINTCOLLCOPIESFLAG:
982 os << "\\print_collcopies_flag \"" << print_collcopies_flag
984 case RC_PRINTREVERSEFLAG:
985 os << "\\print_reverse_flag \"" << print_reverse_flag
987 case RC_PRINTLANDSCAPEFLAG:
988 os << "\\print_landscape_flag \"" << print_landscape_flag
990 case RC_PRINTTOPRINTER:
991 os << "\\print_to_printer \"" << print_to_printer << "\"\n";
992 case RC_PRINT_ADAPTOUTPUT:
993 os << "\\print_adapt_output " << tostr(print_adapt_output)
996 os << "\\print_to_file \"" << print_to_file << "\"\n";
997 case RC_PRINTFILEEXTENSION:
998 os << "\\print_file_extension \"" << print_file_extension
1000 case RC_PRINTEXSTRAOPTIONS:
1001 os << "\\print_extra_options \"" << print_extra_options
1003 case RC_PRINTSPOOL_COMMAND:
1004 os << "\\print_spool_command \"" << print_spool_command
1006 case RC_PRINTSPOOL_PRINTERPREFIX:
1007 os << "\\print_spool_printerprefix \""
1008 << print_spool_printerprefix << "\"\n";
1009 case RC_PRINTPAPERDIMENSIONFLAG:
1010 os << "\\print_paper_dimension_flag \""
1011 << print_paper_dimension_flag << "\"\n";
1012 case RC_PRINTPAPERFLAG:
1013 os << "\\print_paper_flag \"" << print_paper_flag << "\"\n";
1014 case RC_CUSTOM_EXPORT_COMMAND:
1015 os << "\\custom_export_command \"" << custom_export_command
1017 case RC_CUSTOM_EXPORT_FORMAT:
1018 os << "\\custom_export_format \"" << custom_export_format
1021 os << "\\pdf_mode " << tostr(pdf_mode) << "\n";
1022 case RC_LATEX_COMMAND:
1023 os << "\\latex_command \"" << latex_command << "\"\n";
1024 case RC_PDFLATEX_COMMAND:
1025 os << "\\pdflatex_command \"" << pdflatex_command << "\"\n";
1026 case RC_PDF_TO_PS_COMMAND:
1027 os << "\\pdf_to_ps_command \"" << pdf_to_ps_command << "\"\n";
1028 case RC_DVI_TO_PS_COMMAND:
1029 os << "\\dvi_to_ps_command \"" << dvi_to_ps_command << "\"\n";
1030 case RC_LITERATE_COMMAND:
1031 os << "\\literate_command \"" << literate_command << "\"\n";
1032 case RC_LITERATE_EXTENSION:
1033 os << "\\literate_extension \"" << literate_extension
1035 case RC_LITERATE_ERROR_FILTER:
1036 os << "\\literate_error_filter \"" << literate_error_filter
1038 case RC_BUILD_COMMAND:
1039 os << "\\build_command \"" << build_command << "\"\n";
1040 case RC_BUILD_ERROR_FILTER:
1041 os << "\\build_error_filter \"" << build_error_filter
1044 os << "\\screen_dpi " << dpi << "\n";
1045 case RC_SCREEN_ZOOM:
1046 os << "\\screen_zoom " << zoom << "\n";
1047 case RC_SCREEN_FONT_SIZES:
1048 os.setf(ios::fixed);
1050 os << "\\screen_font_sizes";
1051 os << " " << font_sizes[LyXFont::SIZE_TINY];
1052 os << " " << font_sizes[LyXFont::SIZE_SCRIPT];
1053 os << " " << font_sizes[LyXFont::SIZE_FOOTNOTE];
1054 os << " " << font_sizes[LyXFont::SIZE_SMALL];
1055 os << " " << font_sizes[LyXFont::SIZE_NORMAL];
1056 os << " " << font_sizes[LyXFont::SIZE_LARGE];
1057 os << " " << font_sizes[LyXFont::SIZE_LARGER];
1058 os << " " << font_sizes[LyXFont::SIZE_LARGEST];
1059 os << " " << font_sizes[LyXFont::SIZE_HUGE];
1060 os << " " << font_sizes[LyXFont::SIZE_HUGER];
1062 case RC_AUTOREGIONDELETE:
1063 os << "\\auto_region_delete " << tostr(auto_region_delete)
1066 os << "\\autosave " << autosave << "\n";
1067 case RC_EXIT_CONFIRMATION:
1068 os << "\\exit_confirmation " << tostr(exit_confirmation)
1070 case RC_DISPLAY_SHORTCUTS:
1071 os << "\\display_shortcuts " << tostr(display_shortcuts)
1073 case RC_VIEWDVI_COMMAND:
1074 os << "\\view_dvi_command \"" << view_dvi_command << "\"\n";
1075 case RC_VIEWPDF_COMMAND:
1076 os << "\\view_pdf_command \"" << view_pdf_command << "\"\n";
1077 case RC_DEFAULT_PAPERSIZE:
1078 os << "\\default_papersize \"";
1079 switch (default_papersize) {
1080 case BufferParams::PAPER_USLETTER:
1081 os << "usletter"; break;
1082 case BufferParams::PAPER_LEGALPAPER:
1083 os << "legal"; break;
1084 case BufferParams::PAPER_EXECUTIVEPAPER:
1085 os << "executive"; break;
1086 case BufferParams::PAPER_A3PAPER:
1088 case BufferParams::PAPER_A4PAPER:
1090 case BufferParams::PAPER_A5PAPER:
1092 case BufferParams::PAPER_B5PAPER:
1094 case BufferParams::PAPER_DEFAULT: break;
1097 case RC_VIEWPS_COMMAND:
1098 os << "\\view_ps_command \"" << view_ps_command << "\"\n";
1099 case RC_VIEWPSPIC_COMMAND:
1100 os << "\\view_pspic_command \"" << view_pspic_command
1103 os << "\\ps_command \"" << ps_command << "\"\n";
1104 case RC_CHKTEX_COMMAND:
1105 os << "\\chktex_command \"" << chktex_command << "\"\n";
1106 case RC_HTML_COMMAND:
1107 os << "\\html_command \"" << html_command << "\"\n";
1108 case RC_SGML_EXTRA_OPTIONS:
1109 os << "\\sgml_extra_options \"" << sgml_extra_options
1112 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1113 case RC_KBMAP_PRIMARY:
1114 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1115 case RC_KBMAP_SECONDARY:
1116 os << "\\kbmap_secondary \"" << secondary_kbmap << "\"\n";
1118 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1119 case RC_RELYX_COMMAND:
1120 os << "\\relyx_command \"" << relyx_command << "\"\n";
1121 case RC_DOCUMENTPATH:
1122 os << "\\document_path \"" << document_path << "\"\n";
1123 case RC_TEMPLATEPATH:
1124 os << "\\template_path \"" << template_path << "\"\n";
1125 case RC_TEMPDIRPATH:
1126 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1128 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1130 os << "\\lastfiles \"" << lastfiles << "\"\n";
1131 case RC_NUMLASTFILES:
1132 os << "\\num_lastfiles " << num_lastfiles << "\n";
1133 case RC_CHECKLASTFILES:
1134 os << "\\check_lastfiles " << tostr(check_lastfiles) << "\n";
1135 case RC_SCREEN_FONT_ROMAN:
1136 os << "\\screen_font_roman \"" << roman_font_name << "\"\n";
1137 case RC_SCREEN_FONT_SANS:
1138 os << "\\screen_font_sans \"" << sans_font_name << "\"\n";
1139 case RC_SCREEN_FONT_TYPEWRITER:
1140 os << "\\screen_font_typewriter \""
1141 << typewriter_font_name << "\"\n";
1142 case RC_SCREEN_FONT_MENU:
1143 os << "\\screen_font_menu \"" << menu_font_name << "\"\n";
1144 case RC_SCREEN_FONT_POPUP:
1145 os << "\\screen_font_popup \"" << popup_font_name << "\"\n";
1146 case RC_SCREEN_FONT_ENCODING:
1147 os << "\\screen_font_encoding \"" << font_norm << "\"\n";
1148 case RC_SCREEN_FONT_SCALABLE:
1149 os << "\\screen_font_scalable " << tostr(use_scalable_fonts)
1151 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1152 os << "\\cursor_follows_scrollbar "
1153 << tostr(cursor_follows_scrollbar) << "\n";
1154 case RC_FAST_SELECTION:
1155 os << "\\fast_selection "
1156 << tostr(static_cast<bool>(fast_selection)) << "\n";
1157 case RC_BACKGROUND_COLOR:
1158 os << "\\background_color \"" << background_color << "\"\n";
1159 case RC_SELECTION_COLOR:
1160 os << "\\selection_color \"" << selection_color << "\"\n";
1161 case RC_FAX_COMMAND:
1162 os << "\\fax_command \"" << fax_command << "\"\n";
1164 os << "\\fax_program \"" << fax_program << "\"\n";
1166 os << "\\phone_book \"" << phone_book << "\"\n";
1167 case RC_ASCIIROFF_COMMAND:
1168 os << "\\ascii_roff_command \"" << ascii_roff_command
1170 case RC_ASCII_LINELEN:
1171 os << "\\ascii_linelen " << ascii_linelen << "\n";
1172 case RC_SPELL_COMMAND:
1173 os << "\\spell_command \"" << isp_command << "\"\n";
1174 case RC_ACCEPT_COMPOUND:
1175 os << "\\accept_compound " << tostr(isp_accept_compound)
1177 case RC_USE_INP_ENC:
1178 os << "\\use_input_encoding " << tostr(isp_use_input_encoding)
1180 case RC_USE_ALT_LANG:
1181 os << "\\use_alt_language " << tostr(isp_use_alt_lang) << "\n";
1182 case RC_USE_PERS_DICT:
1183 os << "\\use_personal_dictionary " << tostr(isp_use_pers_dict)
1185 case RC_USE_ESC_CHARS:
1186 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1189 os << "\\alternate_language \"" << isp_alt_lang << "\"\n";
1191 os << "\\personal_dictionary \"" << isp_pers_dict << "\"\n";
1193 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1194 case RC_MAKE_BACKUP:
1195 os << "\\make_backup " << tostr(make_backup) << "\n";
1201 /// define the default key bindings for LyX.
1202 void LyXRC::defaultKeyBindings()
1204 bindKey("Right", LFUN_RIGHT);
1205 bindKey("Left", LFUN_LEFT);
1206 bindKey("Up", LFUN_UP);
1207 bindKey("Down", LFUN_DOWN);
1209 bindKey("Tab", LFUN_TAB);
1211 bindKey("Home", LFUN_HOME);
1212 bindKey("End", LFUN_END);
1213 bindKey("Prior", LFUN_PRIOR);
1214 bindKey("Next", LFUN_NEXT);
1216 bindKey("Return", LFUN_BREAKPARAGRAPH);
1217 bindKey("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE);
1219 bindKey("Delete", LFUN_DELETE);
1220 bindKey("BackSpace", LFUN_BACKSPACE);
1221 // bindKeyings for transparent handling of deadkeys
1222 // The keysyms are gotten from XFree86 X11R6
1223 bindKey("~C-~S-~M-dead_acute", LFUN_ACUTE);
1224 bindKey("~C-~S-~M-dead_breve", LFUN_BREVE);
1225 bindKey("~C-~S-~M-dead_caron", LFUN_CARON);
1226 bindKey("~C-~S-~M-dead_cedilla", LFUN_CEDILLA);
1227 bindKey("~C-~S-~M-dead_abovering", LFUN_CIRCLE);
1228 bindKey("~C-~S-~M-dead_circumflex", LFUN_CIRCUMFLEX);
1229 bindKey("~C-~S-~M-dead_abovedot", LFUN_DOT);
1230 bindKey("~C-~S-~M-dead_grave", LFUN_GRAVE);
1231 bindKey("~C-~S-~M-dead_doubleacute", LFUN_HUNG_UMLAUT);
1232 bindKey("~C-~S-~M-dead_macron", LFUN_MACRON);
1233 // nothing with this name
1234 // bindKey("~C-~S-~M-dead_special_caron", LFUN_SPECIAL_CARON);
1235 bindKey("~C-~S-~M-dead_tilde", LFUN_TILDE);
1236 bindKey("~C-~S-~M-dead_diaeresis", LFUN_UMLAUT);
1237 // nothing with this name either...
1238 //bindKey("~C-~S-~M-dead_underbar", LFUN_UNDERBAR);
1239 bindKey("~C-~S-~M-dead_belowdot", LFUN_UNDERDOT);
1240 bindKey("~C-~S-~M-dead_tie", LFUN_TIE);
1241 bindKey("~C-~S-~M-dead_ogonek", LFUN_OGONEK);
1243 // bindings to utilize the use of the numeric keypad
1244 // e.g. Num Lock set
1245 bindKey("KP_0", LFUN_SELFINSERT);
1246 bindKey("KP_Decimal", LFUN_SELFINSERT);
1247 bindKey("KP_Enter", LFUN_SELFINSERT);
1248 bindKey("KP_1", LFUN_SELFINSERT);
1249 bindKey("KP_2", LFUN_SELFINSERT);
1250 bindKey("KP_3", LFUN_SELFINSERT);
1251 bindKey("KP_4", LFUN_SELFINSERT);
1252 bindKey("KP_5", LFUN_SELFINSERT);
1253 bindKey("KP_6", LFUN_SELFINSERT);
1254 bindKey("KP_Add", LFUN_SELFINSERT);
1255 bindKey("KP_7", LFUN_SELFINSERT);
1256 bindKey("KP_8", LFUN_SELFINSERT);
1257 bindKey("KP_9", LFUN_SELFINSERT);
1258 bindKey("KP_Divide", LFUN_SELFINSERT);
1259 bindKey("KP_Multiply", LFUN_SELFINSERT);
1260 bindKey("KP_Subtract", LFUN_SELFINSERT);
1262 /* Most self-insert keys are handled in the 'default:' section of
1263 * WorkAreaKeyPress - so we don't have to define them all.
1264 * However keys explicit decleared as self-insert are
1265 * handled seperatly (LFUN_SELFINSERT.) Lgb. */
1267 bindKey("C-Tab", LFUN_TABINSERT); // ale970515