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 static keyword_item lyxrcTags[] = {
135 { "\\accept_compound", RC_ACCEPT_COMPOUND },
136 { "\\alternate_language", RC_ALT_LANG },
137 { "\\ascii_linelen", RC_ASCII_LINELEN },
138 { "\\ascii_roff_command", RC_ASCIIROFF_COMMAND },
139 { "\\auto_region_delete", RC_AUTOREGIONDELETE },
140 { "\\autosave", RC_AUTOSAVE },
141 { "\\background_color", RC_BACKGROUND_COLOR },
142 { "\\begin_toolbar", RC_BEGINTOOLBAR },
143 { "\\bind", RC_BIND },
144 { "\\bind_file", RC_BINDFILE },
145 { "\\build_command", RC_BUILD_COMMAND },
146 { "\\build_error_filter", RC_BUILD_ERROR_FILTER },
147 { "\\check_lastfiles", RC_CHECKLASTFILES },
148 { "\\chktex_command", RC_CHKTEX_COMMAND },
149 { "\\cursor_follows_scrollbar", RC_CURSOR_FOLLOWS_SCROLLBAR },
150 { "\\custom_export_command", RC_CUSTOM_EXPORT_COMMAND },
151 { "\\custom_export_format", RC_CUSTOM_EXPORT_FORMAT },
152 { "\\default_papersize", RC_DEFAULT_PAPERSIZE },
153 { "\\display_shortcuts", RC_DISPLAY_SHORTCUTS },
154 { "\\document_path", RC_DOCUMENTPATH },
155 { "\\escape_chars", RC_ESC_CHARS },
156 { "\\exit_confirmation", RC_EXIT_CONFIRMATION },
157 { "\\fast_selection", RC_FAST_SELECTION },
158 { "\\fax_command", RC_FAX_COMMAND },
159 { "\\fax_program", RC_FAXPROGRAM },
160 { "\\font_encoding", RC_FONT_ENCODING },
161 { "\\html_command", RC_HTML_COMMAND },
162 { "\\input", RC_INPUT },
163 { "\\kbmap", RC_KBMAP },
164 { "\\kbmap_primary", RC_KBMAP_PRIMARY },
165 { "\\kbmap_secondary", RC_KBMAP_SECONDARY },
166 { "\\lastfiles", RC_LASTFILES },
167 { "\\latex_command", RC_LATEX_COMMAND },
168 { "\\literate_command", RC_LITERATE_COMMAND },
169 { "\\literate_error_filter", RC_LITERATE_ERROR_FILTER },
170 { "\\literate_extension", RC_LITERATE_EXTENSION },
171 { "\\num_lastfiles", RC_NUMLASTFILES },
172 { "\\personal_dictionary", RC_PERS_DICT },
173 { "\\phone_book", RC_PHONEBOOK },
174 { "\\print_adapt_output", RC_PRINT_ADAPTOUTPUT },
175 { "\\print_collcopies_flag", RC_PRINTCOLLCOPIESFLAG },
176 { "\\print_command", RC_PRINT_COMMAND },
177 { "\\print_copies_flag", RC_PRINTCOPIESFLAG },
178 { "\\print_evenpage_flag", RC_PRINTEVENPAGEFLAG },
179 { "\\print_extra_options", RC_PRINTEXSTRAOPTIONS },
180 { "\\print_file_extension", RC_PRINTFILEEXTENSION },
181 { "\\print_landscape_flag", RC_PRINTLANDSCAPEFLAG },
182 { "\\print_oddpage_flag", RC_PRINTODDPAGEFLAG },
183 { "\\print_pagerange_flag", RC_PRINTPAGERANGEFLAG },
184 { "\\print_paper_dimension_flag", RC_PRINTPAPERDIMENSIONFLAG },
185 { "\\print_paper_flag", RC_PRINTPAPERFLAG },
186 { "\\print_reverse_flag", RC_PRINTREVERSEFLAG },
187 { "\\print_spool_command", RC_PRINTSPOOL_COMMAND },
188 { "\\print_spool_printerprefix", RC_PRINTSPOOL_PRINTERPREFIX },
189 { "\\print_to_file", RC_PRINTTOFILE },
190 { "\\print_to_printer", RC_PRINTTOPRINTER },
191 { "\\printer", RC_PRINTER },
192 { "\\ps_command", RC_PS_COMMAND },
193 { "\\relyx_command", RC_RELYX_COMMAND },
194 { "\\screen_dpi", RC_SCREEN_DPI },
195 { "\\screen_font_encoding", RC_SCREEN_FONT_ENCODING },
196 { "\\screen_font_menu", RC_SCREEN_FONT_MENU },
197 { "\\screen_font_popup", RC_SCREEN_FONT_POPUP },
198 { "\\screen_font_roman", RC_SCREEN_FONT_ROMAN },
199 { "\\screen_font_sans", RC_SCREEN_FONT_SANS },
200 { "\\screen_font_scalable", RC_SCREEN_FONT_SCALABLE },
201 { "\\screen_font_sizes", RC_SCREEN_FONT_SIZES },
202 { "\\screen_font_typewriter", RC_SCREEN_FONT_TYPEWRITER },
203 { "\\screen_zoom", RC_SCREEN_ZOOM },
204 { "\\selection_color", RC_SELECTION_COLOR },
205 { "\\serverpipe", RC_SERVERPIPE },
206 { "\\sgml_extra_options", RC_SGML_EXTRA_OPTIONS },
207 { "\\spell_command", RC_SPELL_COMMAND },
208 { "\\tempdir_path", RC_TEMPDIRPATH },
209 { "\\template_path", RC_TEMPLATEPATH },
210 { "\\use_alt_language", RC_USE_ALT_LANG },
211 { "\\use_escape_chars", RC_USE_ESC_CHARS },
212 { "\\use_input_encoding", RC_USE_INP_ENC },
213 { "\\use_personal_dictionary", RC_USE_PERS_DICT },
214 { "\\use_tempdir", RC_USETEMPDIR },
215 { "\\view_dvi_command", RC_VIEWDVI_COMMAND },
216 { "\\view_ps_command", RC_VIEWPS_COMMAND },
217 { "\\view_pspic_command", RC_VIEWPSPIC_COMMAND }
220 /* Let the range depend of the size of lyxrcTags. Alejandro 240596 */
221 static const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
223 // Should this be moved inside LyXAction?
225 int bindKey(char const * seq, int action)
227 return toplevel_keymap->bind(seq, action);
233 // Get printer from the environment. If fail, use default "",
234 // assuming that everything is set up correctly.
235 printer = GetEnv("PRINTER");
236 print_command = "dvips";
237 print_evenpage_flag = "-B";
238 print_oddpage_flag = "-A";
239 print_pagerange_flag = "-pp";
240 print_copies_flag = "-c";
241 print_collcopies_flag = "-C";
242 print_reverse_flag = "-r";
243 print_landscape_flag = "-t landscape";
244 print_to_printer = "-P";
245 print_to_file = "-o ";
246 print_file_extension = ".ps";
247 print_paper_flag = "-t";
248 print_paper_dimension_flag = "-T";
249 document_path = GetEnvPath("HOME");
250 tempdir_path = "/tmp";
252 latex_command = "latex";
253 literate_command = "none";
254 literate_extension = "none";
255 literate_error_filter = "cat";
256 build_command = "make";
257 build_error_filter = "cat";
258 relyx_command = "reLyX";
260 view_ps_command = "ghostview -swap";
261 view_pspic_command = "ghostview";
262 view_dvi_command = "xdvi";
263 default_papersize = BufferParams::PAPER_USLETTER;
264 custom_export_format = "ps";
265 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
266 html_command = "tth -t";
269 // Because a screen typically is wider than a piece of paper:
271 // Default LaTeX font size:
272 font_sizes[LyXFont::SIZE_TINY] = 5.0;
273 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
274 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
275 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
276 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
277 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
278 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
279 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
280 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
281 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
282 use_scalable_fonts = true;
283 roman_font_name = "-*-times";
284 sans_font_name = "-*-helvetica";
285 typewriter_font_name = "-*-courier";
286 menu_font_name = "-*-helvetica-bold-r";
287 popup_font_name = "-*-helvetica-medium-r";
288 font_norm = "iso8859-1";
290 auto_region_delete = true;
293 check_lastfiles = true;
294 exit_confirmation = true;
295 display_shortcuts = true;
296 // Spellchecker settings:
297 isp_command = "ispell";
298 isp_accept_compound = false;
299 isp_use_input_encoding = false;
300 isp_use_alt_lang = false;
301 isp_use_pers_dict = false;
302 isp_use_esc_chars = false;
305 defaultKeyBindings();
309 int LyXRC::ReadBindFile(string const & name)
312 string tmp = i18nLibFileSearch("bind", name, "bind");
313 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
314 int result = read(tmp);
316 lyxerr << "Error reading bind file: " << tmp << endl;
321 int LyXRC::read(string const & filename)
324 string bindFile = "cua";
326 LyXLex lexrc(lyxrcTags, lyxrcCount);
327 if (lyxerr.debugging(Debug::PARSER))
330 lexrc.setFile(filename);
331 if (!lexrc.IsOK()) return -2;
333 lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
335 while (lexrc.IsOK()) {
336 // By using two switches we take advantage of the compiler
337 // telling us if we have missed a LyXRCTags element in
338 // the second switch.
339 // Note that this also shows a problem with LyXLex since it
340 // helps us avoid taking advantage of the strictness of the
343 int le = lexrc.lex();
345 case LyXLex::LEX_UNDEF:
346 lexrc.printError("Unknown tag `$$Token'");
348 case LyXLex::LEX_FEOF:
352 switch (static_cast<LyXRCTags>(le)) {
353 case RC_INPUT: // Include file
355 string tmp = LibFileSearch(string(),
358 lexrc.printError("Error reading "
359 "included file: "+tmp);
363 case RC_BINDFILE: // RVDK_PATCH_5
365 ReadBindFile(lexrc.GetString());
369 case RC_BEGINTOOLBAR:
370 // this toolbar should be changed to be a completely
371 // non gui toolbar. (Lgb)
377 use_kbmap = lexrc.GetBool();
380 case RC_EXIT_CONFIRMATION:
382 exit_confirmation = lexrc.GetBool();
385 case RC_DISPLAY_SHORTCUTS:
387 display_shortcuts = lexrc.GetBool();
390 case RC_KBMAP_PRIMARY:
392 primary_kbmap = lexrc.GetString();
395 case RC_KBMAP_SECONDARY:
397 secondary_kbmap = lexrc.GetString();
400 case RC_FONT_ENCODING:
402 fontenc = lexrc.GetString();
407 printer = lexrc.GetString();
410 case RC_PRINT_COMMAND:
412 print_command = lexrc.GetString();
415 case RC_PRINTEVENPAGEFLAG:
417 print_evenpage_flag = lexrc.GetString();
420 case RC_PRINTODDPAGEFLAG:
422 print_oddpage_flag = lexrc.GetString();
425 case RC_PRINTPAGERANGEFLAG:
427 print_pagerange_flag = lexrc.GetString();
430 case RC_PRINTCOPIESFLAG:
432 print_copies_flag = lexrc.GetString();
435 case RC_PRINTCOLLCOPIESFLAG:
437 print_collcopies_flag = lexrc.GetString();
440 case RC_PRINTREVERSEFLAG:
442 print_reverse_flag = lexrc.GetString();
445 case RC_PRINTLANDSCAPEFLAG:
447 print_landscape_flag = lexrc.GetString();
450 case RC_PRINTTOPRINTER:
452 print_to_printer = lexrc.GetString();
455 case RC_PRINT_ADAPTOUTPUT:
457 print_adapt_output = lexrc.GetBool();
462 print_to_file = lexrc.GetString();
465 case RC_PRINTFILEEXTENSION:
467 print_file_extension = lexrc.GetString();
470 case RC_PRINTEXSTRAOPTIONS:
472 print_extra_options = lexrc.GetString();
475 case RC_PRINTSPOOL_COMMAND:
477 print_spool_command = lexrc.GetString();
480 case RC_PRINTSPOOL_PRINTERPREFIX:
482 print_spool_printerprefix = lexrc.GetString();
485 case RC_PRINTPAPERDIMENSIONFLAG:
487 print_paper_dimension_flag = lexrc.GetString();
490 case RC_PRINTPAPERFLAG:
492 print_paper_flag = lexrc.GetString();
495 case RC_CUSTOM_EXPORT_COMMAND:
497 custom_export_command = lexrc.GetString();
500 case RC_CUSTOM_EXPORT_FORMAT:
502 custom_export_format = lexrc.GetString();
505 case RC_LATEX_COMMAND:
507 latex_command = lexrc.GetString();
510 case RC_LITERATE_COMMAND:
512 literate_command = lexrc.GetString();
515 case RC_LITERATE_EXTENSION:
517 literate_extension = lexrc.GetString();
520 case RC_LITERATE_ERROR_FILTER:
522 literate_error_filter = lexrc.GetString();
525 case RC_BUILD_COMMAND:
527 build_command = lexrc.GetString();
530 case RC_BUILD_ERROR_FILTER:
532 build_error_filter = lexrc.GetString();
535 case RC_RELYX_COMMAND:
537 relyx_command = lexrc.GetString();
540 case RC_DEFAULT_PAPERSIZE:
542 string size = lowercase(lexrc.GetString());
543 if (size == "usletter")
545 BufferParams::PAPER_USLETTER;
546 else if (size == "legal")
548 BufferParams::PAPER_LEGALPAPER;
549 else if (size == "executive")
551 BufferParams::PAPER_EXECUTIVEPAPER;
552 else if (size == "a3")
554 BufferParams::PAPER_A3PAPER;
555 else if (size == "a4")
557 BufferParams::PAPER_A4PAPER;
558 else if (size == "a5")
560 BufferParams::PAPER_A5PAPER;
561 else if (size == "b5")
563 BufferParams::PAPER_B5PAPER;
566 case RC_VIEWDVI_COMMAND:
568 view_dvi_command = lexrc.GetString();
573 ps_command = lexrc.GetString();
576 case RC_VIEWPS_COMMAND:
578 view_ps_command = lexrc.GetString();
581 case RC_VIEWPSPIC_COMMAND:
583 view_pspic_command = lexrc.GetString();
586 case RC_CHKTEX_COMMAND:
588 chktex_command = lexrc.GetString();
591 case RC_HTML_COMMAND:
593 html_command = lexrc.GetString();
598 dpi = lexrc.GetInteger();
603 zoom = lexrc.GetInteger();
606 case RC_SCREEN_FONT_SIZES:
608 font_sizes[LyXFont::SIZE_TINY] =
611 font_sizes[LyXFont::SIZE_SCRIPT] =
614 font_sizes[LyXFont::SIZE_FOOTNOTE] =
617 font_sizes[LyXFont::SIZE_SMALL] =
620 font_sizes[LyXFont::SIZE_NORMAL] =
623 font_sizes[LyXFont::SIZE_LARGE] =
626 font_sizes[LyXFont::SIZE_LARGER] =
629 font_sizes[LyXFont::SIZE_LARGEST] =
632 font_sizes[LyXFont::SIZE_HUGE] =
635 font_sizes[LyXFont::SIZE_HUGER] =
639 case RC_SCREEN_FONT_SCALABLE:
641 use_scalable_fonts = lexrc.GetBool();
646 autosave = lexrc.GetInteger();
649 case RC_SGML_EXTRA_OPTIONS:
651 sgml_extra_options = lexrc.GetString();
654 case RC_DOCUMENTPATH:
656 document_path = ExpandPath(lexrc.GetString());
660 case RC_TEMPLATEPATH:
662 template_path = ExpandPath(lexrc.GetString());
667 tempdir_path = ExpandPath(lexrc.GetString());
672 use_tempdir = lexrc.GetBool();
677 lastfiles = ExpandPath(lexrc.GetString());
680 case RC_NUMLASTFILES:
682 num_lastfiles = lexrc.GetInteger();
685 case RC_CHECKLASTFILES:
687 check_lastfiles = lexrc.GetBool();
690 case RC_SCREEN_FONT_ROMAN:
692 roman_font_name = lexrc.GetString();
695 case RC_SCREEN_FONT_SANS:
697 sans_font_name = lexrc.GetString();
700 case RC_SCREEN_FONT_TYPEWRITER:
702 typewriter_font_name = lexrc.GetString();
705 case RC_SCREEN_FONT_MENU:
707 menu_font_name = lexrc.GetString();
710 case RC_SCREEN_FONT_POPUP:
712 popup_font_name = lexrc.GetString();
715 case RC_SCREEN_FONT_ENCODING:
717 font_norm = lexrc.GetString();
720 case RC_AUTOREGIONDELETE:
721 // Auto region delete defaults to true
723 auto_region_delete = lexrc.GetBool();
728 // we should not do an explicit binding before
729 // loading a bind file. So, in this case, load
730 // the default bind file.
734 // !!!chb, dynamic key binding...
738 if (lexrc.lex() == LyXLex::LEX_DATA) {
739 seq = lexrc.GetString();
741 lexrc.printError("Bad key sequence: `$$Token'");
745 if (lexrc.lex() == LyXLex::LEX_DATA) {
746 cmd = lexrc.GetString();
748 lexrc.printError("Bad command: `$$Token'");
752 if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) {
753 if (lyxerr.debugging(Debug::KEY)) {
754 lyxerr << "RC_BIND: Sequence `"
755 << seq << "' Command `"
756 << cmd << "' Action `"
757 << action << '\'' << endl;
759 res = bindKey(seq.c_str(), action);
762 "Invalid key sequence `"
765 } else {// cmd is the last token read.
767 "Unknown LyX function `$$Token'");
773 lyxpipes = ExpandPath(lexrc.GetString());
776 case RC_CURSOR_FOLLOWS_SCROLLBAR:
778 cursor_follows_scrollbar = lexrc.GetBool();
780 case RC_FAST_SELECTION:
782 fast_selection = lexrc.GetBool();
784 case RC_BACKGROUND_COLOR:
786 background_color = lexrc.GetString();
788 case RC_SELECTION_COLOR:
790 strncpy(selection_color,
791 lexrc.GetString().c_str(), 31);
795 fax_command = lexrc.GetString();
799 fax_program = lexrc.GetString();
803 string s = lexrc.GetString();
807 phone_book = user_lyxdir + s;
810 case RC_ASCIIROFF_COMMAND:
812 ascii_roff_command = lexrc.GetString();
814 case RC_ASCII_LINELEN:
816 ascii_linelen = lexrc.GetInteger();
818 // Spellchecker settings:
819 case RC_SPELL_COMMAND:
821 isp_command = lexrc.GetString();
823 case RC_ACCEPT_COMPOUND:
825 isp_accept_compound = lexrc.GetBool();
829 isp_use_input_encoding = lexrc.GetBool();
831 case RC_USE_ALT_LANG:
833 isp_use_alt_lang = lexrc.GetBool();
835 case RC_USE_PERS_DICT:
837 isp_use_pers_dict = lexrc.GetBool();
839 case RC_USE_ESC_CHARS:
841 isp_use_esc_chars = lexrc.GetBool();
845 isp_alt_lang = lexrc.GetString();
849 isp_pers_dict = lexrc.GetString();
853 isp_esc_chars = lexrc.GetString();
855 case RC_LAST: break; // this is just a dummy
863 void LyXRC::write(string const & filename) const
865 ofstream ofs(filename.c_str());
871 void LyXRC::print() const
873 if (lyxerr.debugging())
880 void LyXRC::output(ostream & os) const
882 os << "### This file is part of\n"
883 << "### ========================================================\n"
884 << "### LyX, The Document Processor\n"
886 << "### Copyright 1995 Matthias Ettrich\n"
887 << "### Copyright 1995-1998 The LyX Team.\n"
889 << "### ========================================================\n"
891 << "# This file is written by LyX, if you want to make your own\n"
892 << "# modifications you should do them from inside LyX and save\n"
893 << "# your preferences, or you can also make your modifications\n"
894 << "# to lyxrc by hand. It is not advisable to edit this file.\n"
897 // Why the switch you might ask. It is a trick to ensure that all
898 // the elements in the LyXRCTags enum is handled. As you can see
899 // there are no breaks at all. So it is just a huge fall-through.
900 // The nice thing is that we will get a warning from the compiler
901 // if we forget an element.
902 LyXRCTags tag = RC_LAST;
906 // input/include files are not done here
908 // bindings is not written to the preferences file.
910 // bind files are not done here.
911 case RC_BEGINTOOLBAR:
912 // Toolbar is not written here (yet).
913 case RC_FONT_ENCODING:
914 os << "\\font_encoding \"" << fontenc << "\"\n";
916 os << "\\printer \"" << printer << "\"\n";
917 case RC_PRINT_COMMAND:
918 os << "\\print_command \"" << print_command << "\"\n";
919 case RC_PRINTEVENPAGEFLAG:
920 os << "\\print_evenpage_flag \"" << print_evenpage_flag
922 case RC_PRINTODDPAGEFLAG:
923 os << "\\print_oddpage_flag \"" << print_oddpage_flag
925 case RC_PRINTPAGERANGEFLAG:
926 os << "\\print_pagerange_flag \"" << print_pagerange_flag
928 case RC_PRINTCOPIESFLAG:
929 os << "\\print_copies_flag \"" << print_copies_flag << "\"\n";
930 case RC_PRINTCOLLCOPIESFLAG:
931 os << "\\print_collcopies_flag \"" << print_collcopies_flag
933 case RC_PRINTREVERSEFLAG:
934 os << "\\print_reverse_flag \"" << print_reverse_flag
936 case RC_PRINTLANDSCAPEFLAG:
937 os << "\\print_landscape_flag \"" << print_landscape_flag
939 case RC_PRINTTOPRINTER:
940 os << "\\print_to_printer \"" << print_to_printer << "\"\n";
941 case RC_PRINT_ADAPTOUTPUT:
942 os << "\\print_adapt_output " << tostr(print_adapt_output)
945 os << "\\print_to_file \"" << print_to_file << "\"\n";
946 case RC_PRINTFILEEXTENSION:
947 os << "\\print_file_extension \"" << print_file_extension
949 case RC_PRINTEXSTRAOPTIONS:
950 os << "\\print_extra_options \"" << print_extra_options
952 case RC_PRINTSPOOL_COMMAND:
953 os << "\\print_spool_command \"" << print_spool_command
955 case RC_PRINTSPOOL_PRINTERPREFIX:
956 os << "\\print_spool_printerprefix \""
957 << print_spool_printerprefix << "\"\n";
958 case RC_PRINTPAPERDIMENSIONFLAG:
959 os << "\\print_paper_dimension_flag \""
960 << print_paper_dimension_flag << "\"\n";
961 case RC_PRINTPAPERFLAG:
962 os << "\\print_paper_flag \"" << print_paper_flag << "\"\n";
963 case RC_CUSTOM_EXPORT_COMMAND:
964 os << "\\custom_export_command \"" << custom_export_command
966 case RC_CUSTOM_EXPORT_FORMAT:
967 os << "\\custom_export_format \"" << custom_export_format
969 case RC_LATEX_COMMAND:
970 os << "\\latex_command \"" << latex_command << "\"\n";
971 case RC_LITERATE_COMMAND:
972 os << "\\literate_command \"" << literate_command << "\"\n";
973 case RC_LITERATE_EXTENSION:
974 os << "\\literate_extension \"" << literate_extension
976 case RC_LITERATE_ERROR_FILTER:
977 os << "\\literate_error_filter \"" << literate_error_filter
979 case RC_BUILD_COMMAND:
980 os << "\\build_command \"" << build_command << "\"\n";
981 case RC_BUILD_ERROR_FILTER:
982 os << "\\build_error_filter \"" << build_error_filter
985 os << "\\screen_dpi " << dpi << "\n";
987 os << "\\screen_zoom " << zoom << "\n";
988 case RC_SCREEN_FONT_SIZES:
991 os << "\\screen_font_sizes";
992 os << " " << font_sizes[LyXFont::SIZE_TINY];
993 os << " " << font_sizes[LyXFont::SIZE_SCRIPT];
994 os << " " << font_sizes[LyXFont::SIZE_FOOTNOTE];
995 os << " " << font_sizes[LyXFont::SIZE_SMALL];
996 os << " " << font_sizes[LyXFont::SIZE_NORMAL];
997 os << " " << font_sizes[LyXFont::SIZE_LARGE];
998 os << " " << font_sizes[LyXFont::SIZE_LARGER];
999 os << " " << font_sizes[LyXFont::SIZE_LARGEST];
1000 os << " " << font_sizes[LyXFont::SIZE_HUGE];
1001 os << " " << font_sizes[LyXFont::SIZE_HUGER];
1003 case RC_AUTOREGIONDELETE:
1004 os << "\\auto_region_delete " << tostr(auto_region_delete)
1007 os << "\\autosave " << autosave << "\n";
1008 case RC_EXIT_CONFIRMATION:
1009 os << "\\exit_confirmation " << tostr(exit_confirmation)
1011 case RC_DISPLAY_SHORTCUTS:
1012 os << "\\display_shortcuts " << tostr(display_shortcuts)
1014 case RC_VIEWDVI_COMMAND:
1015 os << "\\view_dvi_command \"" << view_dvi_command << "\"\n";
1016 case RC_DEFAULT_PAPERSIZE:
1017 os << "\\default_papersize \"";
1018 switch (default_papersize) {
1019 case BufferParams::PAPER_USLETTER:
1020 os << "usletter"; break;
1021 case BufferParams::PAPER_LEGALPAPER:
1022 os << "legal"; break;
1023 case BufferParams::PAPER_EXECUTIVEPAPER:
1024 os << "executive"; break;
1025 case BufferParams::PAPER_A3PAPER:
1027 case BufferParams::PAPER_A4PAPER:
1029 case BufferParams::PAPER_A5PAPER:
1031 case BufferParams::PAPER_B5PAPER:
1033 case BufferParams::PAPER_DEFAULT: break;
1036 case RC_VIEWPS_COMMAND:
1037 os << "\\view_ps_command \"" << view_ps_command << "\"\n";
1038 case RC_VIEWPSPIC_COMMAND:
1039 os << "\\view_pspic_command \"" << view_pspic_command
1042 os << "\\ps_command \"" << ps_command << "\"\n";
1043 case RC_CHKTEX_COMMAND:
1044 os << "\\chktex_command \"" << chktex_command << "\"\n";
1045 case RC_HTML_COMMAND:
1046 os << "\\html_command \"" << html_command << "\"\n";
1047 case RC_SGML_EXTRA_OPTIONS:
1048 os << "\\sgml_extra_options \"" << sgml_extra_options
1051 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1052 case RC_KBMAP_PRIMARY:
1053 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1054 case RC_KBMAP_SECONDARY:
1055 os << "\\kbmap_secondary \"" << secondary_kbmap << "\"\n";
1057 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1058 case RC_RELYX_COMMAND:
1059 os << "\\relyx_command \"" << relyx_command << "\"\n";
1060 case RC_DOCUMENTPATH:
1061 os << "\\document_path \"" << document_path << "\"\n";
1062 case RC_TEMPLATEPATH:
1063 os << "\\template_path \"" << template_path << "\"\n";
1064 case RC_TEMPDIRPATH:
1065 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1067 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1069 os << "\\lastfiles \"" << lastfiles << "\"\n";
1070 case RC_NUMLASTFILES:
1071 os << "\\num_lastfiles " << num_lastfiles << "\n";
1072 case RC_CHECKLASTFILES:
1073 os << "\\check_lastfiles " << tostr(check_lastfiles) << "\n";
1074 case RC_SCREEN_FONT_ROMAN:
1075 os << "\\screen_font_roman \"" << roman_font_name << "\"\n";
1076 case RC_SCREEN_FONT_SANS:
1077 os << "\\screen_font_sans \"" << sans_font_name << "\"\n";
1078 case RC_SCREEN_FONT_TYPEWRITER:
1079 os << "\\screen_font_typewriter \""
1080 << typewriter_font_name << "\"\n";
1081 case RC_SCREEN_FONT_MENU:
1082 os << "\\screen_font_menu \"" << menu_font_name << "\"\n";
1083 case RC_SCREEN_FONT_POPUP:
1084 os << "\\screen_font_popup \"" << popup_font_name << "\"\n";
1085 case RC_SCREEN_FONT_ENCODING:
1086 os << "\\screen_font_encoding \"" << font_norm << "\"\n";
1087 case RC_SCREEN_FONT_SCALABLE:
1088 os << "\\screen_font_scalable " << tostr(use_scalable_fonts)
1090 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1091 os << "\\cursor_follows_scrollbar "
1092 << tostr(cursor_follows_scrollbar) << "\n";
1093 case RC_FAST_SELECTION:
1094 os << "\\fast_selection "
1095 << tostr(static_cast<bool>(fast_selection)) << "\n";
1096 case RC_BACKGROUND_COLOR:
1097 os << "\\background_color \"" << background_color << "\"\n";
1098 case RC_SELECTION_COLOR:
1099 os << "\\selection_color \"" << selection_color << "\"\n";
1100 case RC_FAX_COMMAND:
1101 os << "\\fax_command \"" << fax_command << "\"\n";
1103 os << "\\fax_program \"" << fax_program << "\"\n";
1105 os << "\\phone_book \"" << phone_book << "\"\n";
1106 case RC_ASCIIROFF_COMMAND:
1107 os << "\\ascii_roff_command \"" << ascii_roff_command
1109 case RC_ASCII_LINELEN:
1110 os << "\\ascii_linelen " << ascii_linelen << "\n";
1111 case RC_SPELL_COMMAND:
1112 os << "\\spell_command \"" << isp_command << "\"\n";
1113 case RC_ACCEPT_COMPOUND:
1114 os << "\\accept_compound " << tostr(isp_accept_compound)
1116 case RC_USE_INP_ENC:
1117 os << "\\use_input_encoding " << tostr(isp_use_input_encoding)
1119 case RC_USE_ALT_LANG:
1120 os << "\\use_alt_language " << tostr(isp_use_alt_lang) << "\n";
1121 case RC_USE_PERS_DICT:
1122 os << "\\use_personal_dictionary " << tostr(isp_use_pers_dict)
1124 case RC_USE_ESC_CHARS:
1125 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1128 os << "\\alternate_language \"" << isp_alt_lang << "\"\n";
1130 os << "\\personal_dictionary \"" << isp_pers_dict << "\"\n";
1132 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1138 /// define the default key bindings for LyX.
1139 void LyXRC::defaultKeyBindings()
1141 bindKey("Right", LFUN_RIGHT);
1142 bindKey("Left", LFUN_LEFT);
1143 bindKey("Up", LFUN_UP);
1144 bindKey("Down", LFUN_DOWN);
1146 bindKey("Tab", LFUN_TAB);
1148 bindKey("Home", LFUN_HOME);
1149 bindKey("End", LFUN_END);
1150 bindKey("Prior", LFUN_PRIOR);
1151 bindKey("Next", LFUN_NEXT);
1153 bindKey("Return", LFUN_BREAKPARAGRAPH);
1154 bindKey("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE);
1156 bindKey("Delete", LFUN_DELETE);
1157 bindKey("BackSpace", LFUN_BACKSPACE);
1158 // bindKeyings for transparent handling of deadkeys
1159 // The keysyms are gotten from XFree86 X11R6
1160 bindKey("~C-~S-~M-dead_acute", LFUN_ACUTE);
1161 bindKey("~C-~S-~M-dead_breve", LFUN_BREVE);
1162 bindKey("~C-~S-~M-dead_caron", LFUN_CARON);
1163 bindKey("~C-~S-~M-dead_cedilla", LFUN_CEDILLA);
1164 bindKey("~C-~S-~M-dead_abovering", LFUN_CIRCLE);
1165 bindKey("~C-~S-~M-dead_circumflex", LFUN_CIRCUMFLEX);
1166 bindKey("~C-~S-~M-dead_abovedot", LFUN_DOT);
1167 bindKey("~C-~S-~M-dead_grave", LFUN_GRAVE);
1168 bindKey("~C-~S-~M-dead_doubleacute", LFUN_HUNG_UMLAUT);
1169 bindKey("~C-~S-~M-dead_macron", LFUN_MACRON);
1170 // nothing with this name
1171 // bindKey("~C-~S-~M-dead_special_caron", LFUN_SPECIAL_CARON);
1172 bindKey("~C-~S-~M-dead_tilde", LFUN_TILDE);
1173 bindKey("~C-~S-~M-dead_diaeresis", LFUN_UMLAUT);
1174 // nothing with this name either...
1175 //bindKey("~C-~S-~M-dead_underbar", LFUN_UNDERBAR);
1176 bindKey("~C-~S-~M-dead_belowdot", LFUN_UNDERDOT);
1177 bindKey("~C-~S-~M-dead_tie", LFUN_TIE);
1178 bindKey("~C-~S-~M-dead_ogonek", LFUN_OGONEK);
1180 // bindings to utilize the use of the numeric keypad
1181 // e.g. Num Lock set
1182 bindKey("KP_0", LFUN_SELFINSERT);
1183 bindKey("KP_Decimal", LFUN_SELFINSERT);
1184 bindKey("KP_Enter", LFUN_SELFINSERT);
1185 bindKey("KP_1", LFUN_SELFINSERT);
1186 bindKey("KP_2", LFUN_SELFINSERT);
1187 bindKey("KP_3", LFUN_SELFINSERT);
1188 bindKey("KP_4", LFUN_SELFINSERT);
1189 bindKey("KP_5", LFUN_SELFINSERT);
1190 bindKey("KP_6", LFUN_SELFINSERT);
1191 bindKey("KP_Add", LFUN_SELFINSERT);
1192 bindKey("KP_7", LFUN_SELFINSERT);
1193 bindKey("KP_8", LFUN_SELFINSERT);
1194 bindKey("KP_9", LFUN_SELFINSERT);
1195 bindKey("KP_Divide", LFUN_SELFINSERT);
1196 bindKey("KP_Multiply", LFUN_SELFINSERT);
1197 bindKey("KP_Subtract", LFUN_SELFINSERT);
1199 /* Most self-insert keys are handled in the 'default:' section of
1200 * WorkAreaKeyPress - so we don't have to define them all.
1201 * However keys explicit decleared as self-insert are
1202 * handled seperatly (LFUN_SELFINSERT.) Lgb. */
1204 bindKey("C-Tab", LFUN_TABINSERT); // ale970515