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,
133 static keyword_item lyxrcTags[] = {
134 { "\\accept_compound", RC_ACCEPT_COMPOUND },
135 { "\\alternate_language", RC_ALT_LANG },
136 { "\\ascii_linelen", RC_ASCII_LINELEN },
137 { "\\ascii_roff_command", RC_ASCIIROFF_COMMAND },
138 { "\\auto_region_delete", RC_AUTOREGIONDELETE },
139 { "\\autosave", RC_AUTOSAVE },
140 { "\\background_color", RC_BACKGROUND_COLOR },
141 { "\\begin_toolbar", RC_BEGINTOOLBAR },
142 { "\\bind", RC_BIND },
143 { "\\bind_file", RC_BINDFILE },
144 { "\\build_command", RC_BUILD_COMMAND },
145 { "\\build_error_filter", RC_BUILD_ERROR_FILTER },
146 { "\\check_lastfiles", RC_CHECKLASTFILES },
147 { "\\chktex_command", RC_CHKTEX_COMMAND },
148 { "\\cursor_follows_scrollbar", RC_CURSOR_FOLLOWS_SCROLLBAR },
149 { "\\custom_export_command", RC_CUSTOM_EXPORT_COMMAND },
150 { "\\custom_export_format", RC_CUSTOM_EXPORT_FORMAT },
151 { "\\default_papersize", RC_DEFAULT_PAPERSIZE },
152 { "\\display_shortcuts", RC_DISPLAY_SHORTCUTS },
153 { "\\document_path", RC_DOCUMENTPATH },
154 { "\\escape_chars", RC_ESC_CHARS },
155 { "\\exit_confirmation", RC_EXIT_CONFIRMATION },
156 { "\\fast_selection", RC_FAST_SELECTION },
157 { "\\fax_command", RC_FAX_COMMAND },
158 { "\\fax_program", RC_FAXPROGRAM },
159 { "\\font_encoding", RC_FONT_ENCODING },
160 { "\\html_command", RC_HTML_COMMAND },
161 { "\\input", RC_INPUT },
162 { "\\kbmap", RC_KBMAP },
163 { "\\kbmap_primary", RC_KBMAP_PRIMARY },
164 { "\\kbmap_secondary", RC_KBMAP_SECONDARY },
165 { "\\lastfiles", RC_LASTFILES },
166 { "\\latex_command", RC_LATEX_COMMAND },
167 { "\\literate_command", RC_LITERATE_COMMAND },
168 { "\\literate_error_filter", RC_LITERATE_ERROR_FILTER },
169 { "\\literate_extension", RC_LITERATE_EXTENSION },
170 { "\\num_lastfiles", RC_NUMLASTFILES },
171 { "\\personal_dictionary", RC_PERS_DICT },
172 { "\\phone_book", RC_PHONEBOOK },
173 { "\\print_adapt_output", RC_PRINT_ADAPTOUTPUT },
174 { "\\print_collcopies_flag", RC_PRINTCOLLCOPIESFLAG },
175 { "\\print_command", RC_PRINT_COMMAND },
176 { "\\print_copies_flag", RC_PRINTCOPIESFLAG },
177 { "\\print_evenpage_flag", RC_PRINTEVENPAGEFLAG },
178 { "\\print_extra_options", RC_PRINTEXSTRAOPTIONS },
179 { "\\print_file_extension", RC_PRINTFILEEXTENSION },
180 { "\\print_landscape_flag", RC_PRINTLANDSCAPEFLAG },
181 { "\\print_oddpage_flag", RC_PRINTODDPAGEFLAG },
182 { "\\print_pagerange_flag", RC_PRINTPAGERANGEFLAG },
183 { "\\print_paper_dimension_flag", RC_PRINTPAPERDIMENSIONFLAG },
184 { "\\print_paper_flag", RC_PRINTPAPERFLAG },
185 { "\\print_reverse_flag", RC_PRINTREVERSEFLAG },
186 { "\\print_spool_command", RC_PRINTSPOOL_COMMAND },
187 { "\\print_spool_printerprefix", RC_PRINTSPOOL_PRINTERPREFIX },
188 { "\\print_to_file", RC_PRINTTOFILE },
189 { "\\print_to_printer", RC_PRINTTOPRINTER },
190 { "\\printer", RC_PRINTER },
191 { "\\ps_command", RC_PS_COMMAND },
192 { "\\relyx_command", RC_RELYX_COMMAND },
193 { "\\screen_dpi", RC_SCREEN_DPI },
194 { "\\screen_font_encoding", RC_SCREEN_FONT_ENCODING },
195 { "\\screen_font_menu", RC_SCREEN_FONT_MENU },
196 { "\\screen_font_popup", RC_SCREEN_FONT_POPUP },
197 { "\\screen_font_roman", RC_SCREEN_FONT_ROMAN },
198 { "\\screen_font_sans", RC_SCREEN_FONT_SANS },
199 { "\\screen_font_scalable", RC_SCREEN_FONT_SCALABLE },
200 { "\\screen_font_sizes", RC_SCREEN_FONT_SIZES },
201 { "\\screen_font_typewriter", RC_SCREEN_FONT_TYPEWRITER },
202 { "\\screen_zoom", RC_SCREEN_ZOOM },
203 { "\\selection_color", RC_SELECTION_COLOR },
204 { "\\serverpipe", RC_SERVERPIPE },
205 { "\\sgml_extra_options", RC_SGML_EXTRA_OPTIONS },
206 { "\\spell_command", RC_SPELL_COMMAND },
207 { "\\tempdir_path", RC_TEMPDIRPATH },
208 { "\\template_path", RC_TEMPLATEPATH },
209 { "\\use_alt_language", RC_USE_ALT_LANG },
210 { "\\use_escape_chars", RC_USE_ESC_CHARS },
211 { "\\use_input_encoding", RC_USE_INP_ENC },
212 { "\\use_personal_dictionary", RC_USE_PERS_DICT },
213 { "\\use_tempdir", RC_USETEMPDIR },
214 { "\\view_dvi_command", RC_VIEWDVI_COMMAND },
215 { "\\view_ps_command", RC_VIEWPS_COMMAND },
216 { "\\view_pspic_command", RC_VIEWPSPIC_COMMAND }
219 /* Let the range depend of the size of lyxrcTags. Alejandro 240596 */
220 static const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
222 // Should this be moved inside LyXAction?
224 int bindKey(char const * seq, int action)
226 return toplevel_keymap->bind(seq, action);
232 // Get printer from the environment. If fail, use default "",
233 // assuming that everything is set up correctly.
234 printer = GetEnv("PRINTER");
235 print_command = "dvips";
236 print_evenpage_flag = "-B";
237 print_oddpage_flag = "-A";
238 print_pagerange_flag = "-pp";
239 print_copies_flag = "-c";
240 print_collcopies_flag = "-C";
241 print_reverse_flag = "-r";
242 print_landscape_flag = "-t landscape";
243 print_to_printer = "-P";
244 print_to_file = "-o ";
245 print_file_extension = ".ps";
246 print_paper_flag = "-t";
247 print_paper_dimension_flag = "-T";
248 document_path = GetEnvPath("HOME");
249 tempdir_path = "/tmp";
251 latex_command = "latex";
252 literate_command = "none";
253 literate_extension = "none";
254 literate_error_filter = "cat";
255 build_command = "make";
256 build_error_filter = "cat";
257 relyx_command = "reLyX";
259 view_ps_command = "ghostview -swap";
260 view_pspic_command = "ghostview";
261 view_dvi_command = "xdvi";
262 default_papersize = BufferParams::PAPER_USLETTER;
263 custom_export_format = "ps";
264 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
265 html_command = "tth -t";
268 // Because a screen typically is wider than a piece of paper:
270 // Default LaTeX font size:
271 font_sizes[LyXFont::SIZE_TINY] = 5.0;
272 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
273 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
274 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
275 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
276 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
277 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
278 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
279 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
280 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
281 use_scalable_fonts = true;
282 roman_font_name = "-*-times";
283 sans_font_name = "-*-helvetica";
284 typewriter_font_name = "-*-courier";
285 menu_font_name = "-*-helvetica-bold-r";
286 popup_font_name = "-*-helvetica-medium-r";
287 font_norm = "iso8859-1";
289 auto_region_delete = true;
292 check_lastfiles = true;
293 exit_confirmation = true;
294 display_shortcuts = true;
295 // Spellchecker settings:
296 isp_command = "ispell";
297 isp_accept_compound = false;
298 isp_use_input_encoding = false;
299 isp_use_alt_lang = false;
300 isp_use_pers_dict = false;
301 isp_use_esc_chars = false;
304 defaultKeyBindings();
308 int LyXRC::ReadBindFile(string const & name)
311 string tmp = i18nLibFileSearch("bind", name, "bind");
312 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
313 int result = read(tmp);
315 lyxerr << "Error reading bind file: " << tmp << endl;
320 int LyXRC::read(string const & filename)
323 string bindFile = "cua";
325 LyXLex lexrc(lyxrcTags, lyxrcCount);
326 if (lyxerr.debugging(Debug::PARSER))
329 lexrc.setFile(filename);
330 if (!lexrc.IsOK()) return -2;
332 lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
334 while (lexrc.IsOK()) {
335 // By using two switches we take advantage of the compiler
336 // telling us if we have missed a LyXRCTags element in
337 // the second switch.
338 // Note that this also shows a problem with LyXLex since it
339 // helps us avoid taking advantage of the strictness of the
342 int le = lexrc.lex();
344 case LyXLex::LEX_UNDEF:
345 lexrc.printError("Unknown tag `$$Token'");
347 case LyXLex::LEX_FEOF:
351 switch (static_cast<LyXRCTags>(le)) {
352 case RC_INPUT: // Include file
354 string tmp = LibFileSearch(string(),
357 lexrc.printError("Error reading "
358 "included file: "+tmp);
362 case RC_BINDFILE: // RVDK_PATCH_5
364 ReadBindFile(lexrc.GetString());
368 case RC_BEGINTOOLBAR:
369 // this toolbar should be changed to be a completely
370 // non gui toolbar. (Lgb)
376 use_kbmap = lexrc.GetBool();
379 case RC_EXIT_CONFIRMATION:
381 exit_confirmation = lexrc.GetBool();
384 case RC_DISPLAY_SHORTCUTS:
386 display_shortcuts = lexrc.GetBool();
389 case RC_KBMAP_PRIMARY:
391 primary_kbmap = lexrc.GetString();
394 case RC_KBMAP_SECONDARY:
396 secondary_kbmap = lexrc.GetString();
399 case RC_FONT_ENCODING:
401 fontenc = lexrc.GetString();
406 printer = lexrc.GetString();
409 case RC_PRINT_COMMAND:
411 print_command = lexrc.GetString();
414 case RC_PRINTEVENPAGEFLAG:
416 print_evenpage_flag = lexrc.GetString();
419 case RC_PRINTODDPAGEFLAG:
421 print_oddpage_flag = lexrc.GetString();
424 case RC_PRINTPAGERANGEFLAG:
426 print_pagerange_flag = lexrc.GetString();
429 case RC_PRINTCOPIESFLAG:
431 print_copies_flag = lexrc.GetString();
434 case RC_PRINTCOLLCOPIESFLAG:
436 print_collcopies_flag = lexrc.GetString();
439 case RC_PRINTREVERSEFLAG:
441 print_reverse_flag = lexrc.GetString();
444 case RC_PRINTLANDSCAPEFLAG:
446 print_landscape_flag = lexrc.GetString();
449 case RC_PRINTTOPRINTER:
451 print_to_printer = lexrc.GetString();
454 case RC_PRINT_ADAPTOUTPUT:
456 print_adapt_output = lexrc.GetBool();
461 print_to_file = lexrc.GetString();
464 case RC_PRINTFILEEXTENSION:
466 print_file_extension = lexrc.GetString();
469 case RC_PRINTEXSTRAOPTIONS:
471 print_extra_options = lexrc.GetString();
474 case RC_PRINTSPOOL_COMMAND:
476 print_spool_command = lexrc.GetString();
479 case RC_PRINTSPOOL_PRINTERPREFIX:
481 print_spool_printerprefix = lexrc.GetString();
484 case RC_PRINTPAPERDIMENSIONFLAG:
486 print_paper_dimension_flag = lexrc.GetString();
489 case RC_PRINTPAPERFLAG:
491 print_paper_flag = lexrc.GetString();
494 case RC_CUSTOM_EXPORT_COMMAND:
496 custom_export_command = lexrc.GetString();
499 case RC_CUSTOM_EXPORT_FORMAT:
501 custom_export_format = lexrc.GetString();
504 case RC_LATEX_COMMAND:
506 latex_command = lexrc.GetString();
509 case RC_LITERATE_COMMAND:
511 literate_command = lexrc.GetString();
514 case RC_LITERATE_EXTENSION:
516 literate_extension = lexrc.GetString();
519 case RC_LITERATE_ERROR_FILTER:
521 literate_error_filter = lexrc.GetString();
524 case RC_BUILD_COMMAND:
526 build_command = lexrc.GetString();
529 case RC_BUILD_ERROR_FILTER:
531 build_error_filter = lexrc.GetString();
534 case RC_RELYX_COMMAND:
536 relyx_command = lexrc.GetString();
539 case RC_DEFAULT_PAPERSIZE:
541 string size = lowercase(lexrc.GetString());
542 if (size == "usletter")
544 BufferParams::PAPER_USLETTER;
545 else if (size == "legal")
547 BufferParams::PAPER_LEGALPAPER;
548 else if (size == "executive")
550 BufferParams::PAPER_EXECUTIVEPAPER;
551 else if (size == "a3")
553 BufferParams::PAPER_A3PAPER;
554 else if (size == "a4")
556 BufferParams::PAPER_A4PAPER;
557 else if (size == "a5")
559 BufferParams::PAPER_A5PAPER;
560 else if (size == "b5")
562 BufferParams::PAPER_B5PAPER;
565 case RC_VIEWDVI_COMMAND:
567 view_dvi_command = lexrc.GetString();
572 ps_command = lexrc.GetString();
575 case RC_VIEWPS_COMMAND:
577 view_ps_command = lexrc.GetString();
580 case RC_VIEWPSPIC_COMMAND:
582 view_pspic_command = lexrc.GetString();
585 case RC_CHKTEX_COMMAND:
587 chktex_command = lexrc.GetString();
590 case RC_HTML_COMMAND:
592 html_command = lexrc.GetString();
597 dpi = lexrc.GetInteger();
602 zoom = lexrc.GetInteger();
605 case RC_SCREEN_FONT_SIZES:
607 font_sizes[LyXFont::SIZE_TINY] =
610 font_sizes[LyXFont::SIZE_SCRIPT] =
613 font_sizes[LyXFont::SIZE_FOOTNOTE] =
616 font_sizes[LyXFont::SIZE_SMALL] =
619 font_sizes[LyXFont::SIZE_NORMAL] =
622 font_sizes[LyXFont::SIZE_LARGE] =
625 font_sizes[LyXFont::SIZE_LARGER] =
628 font_sizes[LyXFont::SIZE_LARGEST] =
631 font_sizes[LyXFont::SIZE_HUGE] =
634 font_sizes[LyXFont::SIZE_HUGER] =
638 case RC_SCREEN_FONT_SCALABLE:
640 use_scalable_fonts = lexrc.GetBool();
645 autosave = lexrc.GetInteger();
648 case RC_SGML_EXTRA_OPTIONS:
650 sgml_extra_options = lexrc.GetString();
653 case RC_DOCUMENTPATH:
655 document_path = ExpandPath(lexrc.GetString());
659 case RC_TEMPLATEPATH:
661 template_path = ExpandPath(lexrc.GetString());
666 tempdir_path = ExpandPath(lexrc.GetString());
671 use_tempdir = lexrc.GetBool();
676 lastfiles = ExpandPath(lexrc.GetString());
679 case RC_NUMLASTFILES:
681 num_lastfiles = lexrc.GetInteger();
684 case RC_CHECKLASTFILES:
686 check_lastfiles = lexrc.GetBool();
689 case RC_SCREEN_FONT_ROMAN:
691 roman_font_name = lexrc.GetString();
694 case RC_SCREEN_FONT_SANS:
696 sans_font_name = lexrc.GetString();
699 case RC_SCREEN_FONT_TYPEWRITER:
701 typewriter_font_name = lexrc.GetString();
704 case RC_SCREEN_FONT_MENU:
706 menu_font_name = lexrc.GetString();
709 case RC_SCREEN_FONT_POPUP:
711 popup_font_name = lexrc.GetString();
714 case RC_SCREEN_FONT_ENCODING:
716 font_norm = lexrc.GetString();
719 case RC_AUTOREGIONDELETE:
720 // Auto region delete defaults to true
722 auto_region_delete = lexrc.GetBool();
727 // we should not do an explicit binding before
728 // loading a bind file. So, in this case, load
729 // the default bind file.
733 // !!!chb, dynamic key binding...
737 if (lexrc.lex() == LyXLex::LEX_DATA) {
738 seq = lexrc.GetString();
740 lexrc.printError("Bad key sequence: `$$Token'");
744 if (lexrc.lex() == LyXLex::LEX_DATA) {
745 cmd = lexrc.GetString();
747 lexrc.printError("Bad command: `$$Token'");
751 if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) {
752 if (lyxerr.debugging(Debug::KEY)) {
753 lyxerr << "RC_BIND: Sequence `"
754 << seq << "' Command `"
755 << cmd << "' Action `"
756 << action << '\'' << endl;
758 res = bindKey(seq.c_str(), action);
761 "Invalid key sequence `"
764 } else {// cmd is the last token read.
766 "Unknown LyX function `$$Token'");
772 lyxpipes = ExpandPath(lexrc.GetString());
775 case RC_CURSOR_FOLLOWS_SCROLLBAR:
777 cursor_follows_scrollbar = lexrc.GetBool();
779 case RC_FAST_SELECTION:
781 fast_selection = lexrc.GetBool();
783 case RC_BACKGROUND_COLOR:
785 background_color = lexrc.GetString();
787 case RC_SELECTION_COLOR:
789 strncpy(selection_color,
790 lexrc.GetString().c_str(), 31);
794 fax_command = lexrc.GetString();
798 fax_program = lexrc.GetString();
802 string s = lexrc.GetString();
806 phone_book = user_lyxdir + s;
809 case RC_ASCIIROFF_COMMAND:
811 ascii_roff_command = lexrc.GetString();
813 case RC_ASCII_LINELEN:
815 ascii_linelen = lexrc.GetInteger();
817 // Spellchecker settings:
818 case RC_SPELL_COMMAND:
820 isp_command = lexrc.GetString();
822 case RC_ACCEPT_COMPOUND:
824 isp_accept_compound = lexrc.GetBool();
828 isp_use_input_encoding = lexrc.GetBool();
830 case RC_USE_ALT_LANG:
832 isp_use_alt_lang = lexrc.GetBool();
834 case RC_USE_PERS_DICT:
836 isp_use_pers_dict = lexrc.GetBool();
838 case RC_USE_ESC_CHARS:
840 isp_use_esc_chars = lexrc.GetBool();
844 isp_alt_lang = lexrc.GetString();
848 isp_pers_dict = lexrc.GetString();
852 isp_esc_chars = lexrc.GetString();
854 case RC_LAST: break; // this is just a dummy
862 void LyXRC::write(string const & filename) const
864 ofstream ofs(filename.c_str());
870 void LyXRC::print() const
872 if (lyxerr.debugging())
879 void LyXRC::output(ostream & os) const
881 os << "### This file is part of\n"
882 << "### ========================================================\n"
883 << "### LyX, The Document Processor\n"
885 << "### Copyright 1995 Matthias Ettrich\n"
886 << "### Copyright 1995-1998 The LyX Team.\n"
888 << "### ========================================================\n"
890 << "# This file is written by LyX, if you want to make your own\n"
891 << "# modifications you should do them from inside LyX and save\n"
892 << "# your preferences, or you can also make your modifications\n"
893 << "# to lyxrc by hand. It is not advisable to edit this file.\n"
896 // Why the switch you might ask. It is a trick to ensure that all
897 // the elements in the LyXRCTags enum is handled. As you can see
898 // there are no breaks at all. So it is just a huge fall-through.
899 // The nice thing is that we will get a warning from the compiler
900 // if we forget an element.
901 LyXRCTags tag = RC_LAST;
905 // input/include files are not done here
907 // bindings is not written to the preferences file.
909 // bind files are not done here.
910 case RC_BEGINTOOLBAR:
911 // Toolbar is not written here (yet).
912 case RC_FONT_ENCODING:
913 os << "\\font_encoding \"" << fontenc << "\"\n";
915 os << "\\printer \"" << printer << "\"\n";
916 case RC_PRINT_COMMAND:
917 os << "\\print_command \"" << print_command << "\"\n";
918 case RC_PRINTEVENPAGEFLAG:
919 os << "\\print_evenpage_flag \"" << print_evenpage_flag
921 case RC_PRINTODDPAGEFLAG:
922 os << "\\print_oddpage_flag \"" << print_oddpage_flag
924 case RC_PRINTPAGERANGEFLAG:
925 os << "\\print_pagerange_flag \"" << print_pagerange_flag
927 case RC_PRINTCOPIESFLAG:
928 os << "\\print_copies_flag \"" << print_copies_flag << "\"\n";
929 case RC_PRINTCOLLCOPIESFLAG:
930 os << "\\print_collcopies_flag \"" << print_collcopies_flag
932 case RC_PRINTREVERSEFLAG:
933 os << "\\print_reverse_flag \"" << print_reverse_flag
935 case RC_PRINTLANDSCAPEFLAG:
936 os << "\\print_landscape_flag \"" << print_landscape_flag
938 case RC_PRINTTOPRINTER:
939 os << "\\print_to_printer \"" << print_to_printer << "\"\n";
940 case RC_PRINT_ADAPTOUTPUT:
941 os << "\\print_adapt_output " << tostr(print_adapt_output)
944 os << "\\print_to_file \"" << print_to_file << "\"\n";
945 case RC_PRINTFILEEXTENSION:
946 os << "\\print_file_extension \"" << print_file_extension
948 case RC_PRINTEXSTRAOPTIONS:
949 os << "\\print_extra_options \"" << print_extra_options
951 case RC_PRINTSPOOL_COMMAND:
952 os << "\\print_spool_command \"" << print_spool_command
954 case RC_PRINTSPOOL_PRINTERPREFIX:
955 os << "\\print_spool_printerprefix \""
956 << print_spool_printerprefix << "\"\n";
957 case RC_PRINTPAPERDIMENSIONFLAG:
958 os << "\\print_paper_dimension_flag \""
959 << print_paper_dimension_flag << "\"\n";
960 case RC_PRINTPAPERFLAG:
961 os << "\\print_paper_flag \"" << print_paper_flag << "\"\n";
962 case RC_CUSTOM_EXPORT_COMMAND:
963 os << "\\custom_export_command \"" << custom_export_command
965 case RC_CUSTOM_EXPORT_FORMAT:
966 os << "\\custom_export_format \"" << custom_export_format
968 case RC_LATEX_COMMAND:
969 os << "\\latex_command \"" << latex_command << "\"\n";
970 case RC_LITERATE_COMMAND:
971 os << "\\literate_command \"" << literate_command << "\"\n";
972 case RC_LITERATE_EXTENSION:
973 os << "\\literate_extension \"" << literate_extension
975 case RC_LITERATE_ERROR_FILTER:
976 os << "\\literate_error_filter \"" << literate_error_filter
978 case RC_BUILD_COMMAND:
979 os << "\\build_command \"" << build_command << "\"\n";
980 case RC_BUILD_ERROR_FILTER:
981 os << "\\build_error_filter \"" << build_error_filter
984 os << "\\screen_dpi " << dpi << "\n";
986 os << "\\screen_zoom " << zoom << "\n";
987 case RC_SCREEN_FONT_SIZES:
990 os << "\\screen_font_sizes";
991 os << " " << font_sizes[LyXFont::SIZE_TINY];
992 os << " " << font_sizes[LyXFont::SIZE_SCRIPT];
993 os << " " << font_sizes[LyXFont::SIZE_FOOTNOTE];
994 os << " " << font_sizes[LyXFont::SIZE_SMALL];
995 os << " " << font_sizes[LyXFont::SIZE_NORMAL];
996 os << " " << font_sizes[LyXFont::SIZE_LARGE];
997 os << " " << font_sizes[LyXFont::SIZE_LARGER];
998 os << " " << font_sizes[LyXFont::SIZE_LARGEST];
999 os << " " << font_sizes[LyXFont::SIZE_HUGE];
1000 os << " " << font_sizes[LyXFont::SIZE_HUGER];
1002 case RC_AUTOREGIONDELETE:
1003 os << "\\auto_region_delete " << tostr(auto_region_delete)
1006 os << "\\autosave " << autosave << "\n";
1007 case RC_EXIT_CONFIRMATION:
1008 os << "\\exit_confirmation " << tostr(exit_confirmation)
1010 case RC_DISPLAY_SHORTCUTS:
1011 os << "\\display_shortcuts " << tostr(display_shortcuts)
1013 case RC_VIEWDVI_COMMAND:
1014 os << "\\view_dvi_command \"" << view_dvi_command << "\"\n";
1015 case RC_DEFAULT_PAPERSIZE:
1016 os << "\\default_papersize \"";
1017 switch (default_papersize) {
1018 case BufferParams::PAPER_USLETTER:
1019 os << "usletter"; break;
1020 case BufferParams::PAPER_LEGALPAPER:
1021 os << "legal"; break;
1022 case BufferParams::PAPER_EXECUTIVEPAPER:
1023 os << "executive"; break;
1024 case BufferParams::PAPER_A3PAPER:
1026 case BufferParams::PAPER_A4PAPER:
1028 case BufferParams::PAPER_A5PAPER:
1030 case BufferParams::PAPER_B5PAPER:
1032 case BufferParams::PAPER_DEFAULT: break;
1035 case RC_VIEWPS_COMMAND:
1036 os << "\\view_ps_command \"" << view_ps_command << "\"\n";
1037 case RC_VIEWPSPIC_COMMAND:
1038 os << "\\view_pspic_command \"" << view_pspic_command
1041 os << "\\ps_command \"" << ps_command << "\"\n";
1042 case RC_CHKTEX_COMMAND:
1043 os << "\\chktex_command \"" << chktex_command << "\"\n";
1044 case RC_HTML_COMMAND:
1045 os << "\\html_command \"" << html_command << "\"\n";
1046 case RC_SGML_EXTRA_OPTIONS:
1047 os << "\\sgml_extra_options \"" << sgml_extra_options
1050 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1051 case RC_KBMAP_PRIMARY:
1052 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1053 case RC_KBMAP_SECONDARY:
1054 os << "\\kbmap_secondary \"" << secondary_kbmap << "\"\n";
1056 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1057 case RC_RELYX_COMMAND:
1058 os << "\\relyx_command \"" << relyx_command << "\"\n";
1059 case RC_DOCUMENTPATH:
1060 os << "\\document_path \"" << document_path << "\"\n";
1061 case RC_TEMPLATEPATH:
1062 os << "\\template_path \"" << template_path << "\"\n";
1063 case RC_TEMPDIRPATH:
1064 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1066 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1068 os << "\\lastfiles \"" << lastfiles << "\"\n";
1069 case RC_NUMLASTFILES:
1070 os << "\\num_lastfiles " << num_lastfiles << "\n";
1071 case RC_CHECKLASTFILES:
1072 os << "\\check_lastfiles " << tostr(check_lastfiles) << "\n";
1073 case RC_SCREEN_FONT_ROMAN:
1074 os << "\\screen_font_roman \"" << roman_font_name << "\"\n";
1075 case RC_SCREEN_FONT_SANS:
1076 os << "\\screen_font_sans \"" << sans_font_name << "\"\n";
1077 case RC_SCREEN_FONT_TYPEWRITER:
1078 os << "\\screen_font_typewriter \""
1079 << typewriter_font_name << "\"\n";
1080 case RC_SCREEN_FONT_MENU:
1081 os << "\\screen_font_menu \"" << menu_font_name << "\"\n";
1082 case RC_SCREEN_FONT_POPUP:
1083 os << "\\screen_font_popup \"" << popup_font_name << "\"\n";
1084 case RC_SCREEN_FONT_ENCODING:
1085 os << "\\screen_font_encoding \"" << font_norm << "\"\n";
1086 case RC_SCREEN_FONT_SCALABLE:
1087 os << "\\screen_font_scalable " << tostr(use_scalable_fonts)
1089 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1090 os << "\\cursor_follows_scrollbar "
1091 << tostr(cursor_follows_scrollbar) << "\n";
1092 case RC_FAST_SELECTION:
1093 os << "\\fast_selection "
1094 << tostr(static_cast<bool>(fast_selection)) << "\n";
1095 case RC_BACKGROUND_COLOR:
1096 os << "\\background_color \"" << background_color << "\"\n";
1097 case RC_SELECTION_COLOR:
1098 os << "\\selection_color \"" << selection_color << "\"\n";
1099 case RC_FAX_COMMAND:
1100 os << "\\fax_command \"" << fax_command << "\"\n";
1102 os << "\\fax_program \"" << fax_program << "\"\n";
1104 os << "\\phone_book \"" << phone_book << "\"\n";
1105 case RC_ASCIIROFF_COMMAND:
1106 os << "\\ascii_roff_command \"" << ascii_roff_command
1108 case RC_ASCII_LINELEN:
1109 os << "\\ascii_linelen " << ascii_linelen << "\n";
1110 case RC_SPELL_COMMAND:
1111 os << "\\spell_command \"" << isp_command << "\"\n";
1112 case RC_ACCEPT_COMPOUND:
1113 os << "\\accept_compound " << tostr(isp_accept_compound)
1115 case RC_USE_INP_ENC:
1116 os << "\\use_input_encoding " << tostr(isp_use_input_encoding)
1118 case RC_USE_ALT_LANG:
1119 os << "\\use_alt_language " << tostr(isp_use_alt_lang) << "\n";
1120 case RC_USE_PERS_DICT:
1121 os << "\\use_personal_dictionary " << tostr(isp_use_pers_dict)
1123 case RC_USE_ESC_CHARS:
1124 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1127 os << "\\alternate_language \"" << isp_alt_lang << "\"\n";
1129 os << "\\personal_dictionary \"" << isp_pers_dict << "\"\n";
1131 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1137 /// define the default key bindings for LyX.
1138 void LyXRC::defaultKeyBindings()
1140 bindKey("Right", LFUN_RIGHT);
1141 bindKey("Left", LFUN_LEFT);
1142 bindKey("Up", LFUN_UP);
1143 bindKey("Down", LFUN_DOWN);
1145 bindKey("Tab", LFUN_TAB);
1147 bindKey("Home", LFUN_HOME);
1148 bindKey("End", LFUN_END);
1149 bindKey("Prior", LFUN_PRIOR);
1150 bindKey("Next", LFUN_NEXT);
1152 bindKey("Return", LFUN_BREAKPARAGRAPH);
1153 bindKey("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE);
1155 bindKey("Delete", LFUN_DELETE);
1156 bindKey("BackSpace", LFUN_BACKSPACE);
1157 // bindKeyings for transparent handling of deadkeys
1158 // The keysyms are gotten from XFree86 X11R6
1159 bindKey("~C-~S-~M-dead_acute", LFUN_ACUTE);
1160 bindKey("~C-~S-~M-dead_breve", LFUN_BREVE);
1161 bindKey("~C-~S-~M-dead_caron", LFUN_CARON);
1162 bindKey("~C-~S-~M-dead_cedilla", LFUN_CEDILLA);
1163 bindKey("~C-~S-~M-dead_abovering", LFUN_CIRCLE);
1164 bindKey("~C-~S-~M-dead_circumflex", LFUN_CIRCUMFLEX);
1165 bindKey("~C-~S-~M-dead_abovedot", LFUN_DOT);
1166 bindKey("~C-~S-~M-dead_grave", LFUN_GRAVE);
1167 bindKey("~C-~S-~M-dead_doubleacute", LFUN_HUNG_UMLAUT);
1168 bindKey("~C-~S-~M-dead_macron", LFUN_MACRON);
1169 // nothing with this name
1170 // bindKey("~C-~S-~M-dead_special_caron", LFUN_SPECIAL_CARON);
1171 bindKey("~C-~S-~M-dead_tilde", LFUN_TILDE);
1172 bindKey("~C-~S-~M-dead_diaeresis", LFUN_UMLAUT);
1173 // nothing with this name either...
1174 //bindKey("~C-~S-~M-dead_underbar", LFUN_UNDERBAR);
1175 bindKey("~C-~S-~M-dead_belowdot", LFUN_UNDERDOT);
1176 bindKey("~C-~S-~M-dead_tie", LFUN_TIE);
1177 bindKey("~C-~S-~M-dead_ogonek", LFUN_OGONEK);
1179 // bindings to utilize the use of the numeric keypad
1180 // e.g. Num Lock set
1181 bindKey("KP_0", LFUN_SELFINSERT);
1182 bindKey("KP_Decimal", LFUN_SELFINSERT);
1183 bindKey("KP_Enter", LFUN_SELFINSERT);
1184 bindKey("KP_1", LFUN_SELFINSERT);
1185 bindKey("KP_2", LFUN_SELFINSERT);
1186 bindKey("KP_3", LFUN_SELFINSERT);
1187 bindKey("KP_4", LFUN_SELFINSERT);
1188 bindKey("KP_5", LFUN_SELFINSERT);
1189 bindKey("KP_6", LFUN_SELFINSERT);
1190 bindKey("KP_Add", LFUN_SELFINSERT);
1191 bindKey("KP_7", LFUN_SELFINSERT);
1192 bindKey("KP_8", LFUN_SELFINSERT);
1193 bindKey("KP_9", LFUN_SELFINSERT);
1194 bindKey("KP_Divide", LFUN_SELFINSERT);
1195 bindKey("KP_Multiply", LFUN_SELFINSERT);
1196 bindKey("KP_Subtract", LFUN_SELFINSERT);
1198 /* Most self-insert keys are handled in the 'default:' section of
1199 * WorkAreaKeyPress - so we don't have to define them all.
1200 * However keys explicit decleared as self-insert are
1201 * handled seperatly (LFUN_SELFINSERT.) Lgb. */
1203 bindKey("C-Tab", LFUN_TABINSERT); // ale970515