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_adapt_output = false;
237 print_command = "dvips";
238 print_evenpage_flag = "-B";
239 print_oddpage_flag = "-A";
240 print_pagerange_flag = "-pp";
241 print_copies_flag = "-c";
242 print_collcopies_flag = "-C";
243 print_reverse_flag = "-r";
244 print_landscape_flag = "-t landscape";
245 print_to_printer = "-P";
246 print_to_file = "-o ";
247 print_file_extension = ".ps";
248 print_paper_flag = "-t";
249 print_paper_dimension_flag = "-T";
250 document_path = GetEnvPath("HOME");
251 tempdir_path = "/tmp";
253 latex_command = "latex";
254 literate_command = "none";
255 literate_extension = "none";
256 literate_error_filter = "cat";
257 build_command = "make";
258 build_error_filter = "cat";
259 relyx_command = "reLyX";
261 view_ps_command = "ghostview -swap";
262 view_pspic_command = "ghostview";
263 view_dvi_command = "xdvi";
264 default_papersize = BufferParams::PAPER_USLETTER;
265 custom_export_format = "ps";
266 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
267 html_command = "tth -t";
270 // Because a screen typically is wider than a piece of paper:
272 // Default LaTeX font size:
273 font_sizes[LyXFont::SIZE_TINY] = 5.0;
274 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
275 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
276 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
277 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
278 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
279 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
280 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
281 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
282 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
283 use_scalable_fonts = true;
284 roman_font_name = "-*-times";
285 sans_font_name = "-*-helvetica";
286 typewriter_font_name = "-*-courier";
287 menu_font_name = "-*-helvetica-bold-r";
288 popup_font_name = "-*-helvetica-medium-r";
289 font_norm = "iso8859-1";
291 auto_region_delete = true;
294 check_lastfiles = true;
295 exit_confirmation = true;
296 display_shortcuts = true;
297 // Spellchecker settings:
298 isp_command = "ispell";
299 isp_accept_compound = false;
300 isp_use_input_encoding = false;
301 isp_use_alt_lang = false;
302 isp_use_pers_dict = false;
303 isp_use_esc_chars = false;
306 defaultKeyBindings();
310 int LyXRC::ReadBindFile(string const & name)
313 string tmp = i18nLibFileSearch("bind", name, "bind");
314 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
315 int result = read(tmp);
317 lyxerr << "Error reading bind file: " << tmp << endl;
322 int LyXRC::read(string const & filename)
325 string bindFile = "cua";
327 LyXLex lexrc(lyxrcTags, lyxrcCount);
328 if (lyxerr.debugging(Debug::PARSER))
331 lexrc.setFile(filename);
332 if (!lexrc.IsOK()) return -2;
334 lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
336 while (lexrc.IsOK()) {
337 // By using two switches we take advantage of the compiler
338 // telling us if we have missed a LyXRCTags element in
339 // the second switch.
340 // Note that this also shows a problem with LyXLex since it
341 // helps us avoid taking advantage of the strictness of the
344 int le = lexrc.lex();
346 case LyXLex::LEX_UNDEF:
347 lexrc.printError("Unknown tag `$$Token'");
349 case LyXLex::LEX_FEOF:
353 switch (static_cast<LyXRCTags>(le)) {
354 case RC_INPUT: // Include file
356 string tmp = LibFileSearch(string(),
359 lexrc.printError("Error reading "
360 "included file: "+tmp);
364 case RC_BINDFILE: // RVDK_PATCH_5
366 ReadBindFile(lexrc.GetString());
370 case RC_BEGINTOOLBAR:
371 // this toolbar should be changed to be a completely
372 // non gui toolbar. (Lgb)
378 use_kbmap = lexrc.GetBool();
381 case RC_EXIT_CONFIRMATION:
383 exit_confirmation = lexrc.GetBool();
386 case RC_DISPLAY_SHORTCUTS:
388 display_shortcuts = lexrc.GetBool();
391 case RC_KBMAP_PRIMARY:
393 primary_kbmap = lexrc.GetString();
396 case RC_KBMAP_SECONDARY:
398 secondary_kbmap = lexrc.GetString();
401 case RC_FONT_ENCODING:
403 fontenc = lexrc.GetString();
408 printer = lexrc.GetString();
411 case RC_PRINT_COMMAND:
413 print_command = lexrc.GetString();
416 case RC_PRINTEVENPAGEFLAG:
418 print_evenpage_flag = lexrc.GetString();
421 case RC_PRINTODDPAGEFLAG:
423 print_oddpage_flag = lexrc.GetString();
426 case RC_PRINTPAGERANGEFLAG:
428 print_pagerange_flag = lexrc.GetString();
431 case RC_PRINTCOPIESFLAG:
433 print_copies_flag = lexrc.GetString();
436 case RC_PRINTCOLLCOPIESFLAG:
438 print_collcopies_flag = lexrc.GetString();
441 case RC_PRINTREVERSEFLAG:
443 print_reverse_flag = lexrc.GetString();
446 case RC_PRINTLANDSCAPEFLAG:
448 print_landscape_flag = lexrc.GetString();
451 case RC_PRINTTOPRINTER:
453 print_to_printer = lexrc.GetString();
456 case RC_PRINT_ADAPTOUTPUT:
458 print_adapt_output = lexrc.GetBool();
463 print_to_file = lexrc.GetString();
466 case RC_PRINTFILEEXTENSION:
468 print_file_extension = lexrc.GetString();
471 case RC_PRINTEXSTRAOPTIONS:
473 print_extra_options = lexrc.GetString();
476 case RC_PRINTSPOOL_COMMAND:
478 print_spool_command = lexrc.GetString();
481 case RC_PRINTSPOOL_PRINTERPREFIX:
483 print_spool_printerprefix = lexrc.GetString();
486 case RC_PRINTPAPERDIMENSIONFLAG:
488 print_paper_dimension_flag = lexrc.GetString();
491 case RC_PRINTPAPERFLAG:
493 print_paper_flag = lexrc.GetString();
496 case RC_CUSTOM_EXPORT_COMMAND:
498 custom_export_command = lexrc.GetString();
501 case RC_CUSTOM_EXPORT_FORMAT:
503 custom_export_format = lexrc.GetString();
506 case RC_LATEX_COMMAND:
508 latex_command = lexrc.GetString();
511 case RC_LITERATE_COMMAND:
513 literate_command = lexrc.GetString();
516 case RC_LITERATE_EXTENSION:
518 literate_extension = lexrc.GetString();
521 case RC_LITERATE_ERROR_FILTER:
523 literate_error_filter = lexrc.GetString();
526 case RC_BUILD_COMMAND:
528 build_command = lexrc.GetString();
531 case RC_BUILD_ERROR_FILTER:
533 build_error_filter = lexrc.GetString();
536 case RC_RELYX_COMMAND:
538 relyx_command = lexrc.GetString();
541 case RC_DEFAULT_PAPERSIZE:
543 string size = lowercase(lexrc.GetString());
544 if (size == "usletter")
546 BufferParams::PAPER_USLETTER;
547 else if (size == "legal")
549 BufferParams::PAPER_LEGALPAPER;
550 else if (size == "executive")
552 BufferParams::PAPER_EXECUTIVEPAPER;
553 else if (size == "a3")
555 BufferParams::PAPER_A3PAPER;
556 else if (size == "a4")
558 BufferParams::PAPER_A4PAPER;
559 else if (size == "a5")
561 BufferParams::PAPER_A5PAPER;
562 else if (size == "b5")
564 BufferParams::PAPER_B5PAPER;
567 case RC_VIEWDVI_COMMAND:
569 view_dvi_command = lexrc.GetString();
574 ps_command = lexrc.GetString();
577 case RC_VIEWPS_COMMAND:
579 view_ps_command = lexrc.GetString();
582 case RC_VIEWPSPIC_COMMAND:
584 view_pspic_command = lexrc.GetString();
587 case RC_CHKTEX_COMMAND:
589 chktex_command = lexrc.GetString();
592 case RC_HTML_COMMAND:
594 html_command = lexrc.GetString();
599 dpi = lexrc.GetInteger();
604 zoom = lexrc.GetInteger();
607 case RC_SCREEN_FONT_SIZES:
609 font_sizes[LyXFont::SIZE_TINY] =
612 font_sizes[LyXFont::SIZE_SCRIPT] =
615 font_sizes[LyXFont::SIZE_FOOTNOTE] =
618 font_sizes[LyXFont::SIZE_SMALL] =
621 font_sizes[LyXFont::SIZE_NORMAL] =
624 font_sizes[LyXFont::SIZE_LARGE] =
627 font_sizes[LyXFont::SIZE_LARGER] =
630 font_sizes[LyXFont::SIZE_LARGEST] =
633 font_sizes[LyXFont::SIZE_HUGE] =
636 font_sizes[LyXFont::SIZE_HUGER] =
640 case RC_SCREEN_FONT_SCALABLE:
642 use_scalable_fonts = lexrc.GetBool();
647 autosave = lexrc.GetInteger();
650 case RC_SGML_EXTRA_OPTIONS:
652 sgml_extra_options = lexrc.GetString();
655 case RC_DOCUMENTPATH:
657 document_path = ExpandPath(lexrc.GetString());
661 case RC_TEMPLATEPATH:
663 template_path = ExpandPath(lexrc.GetString());
668 tempdir_path = ExpandPath(lexrc.GetString());
673 use_tempdir = lexrc.GetBool();
678 lastfiles = ExpandPath(lexrc.GetString());
681 case RC_NUMLASTFILES:
683 num_lastfiles = lexrc.GetInteger();
686 case RC_CHECKLASTFILES:
688 check_lastfiles = lexrc.GetBool();
691 case RC_SCREEN_FONT_ROMAN:
693 roman_font_name = lexrc.GetString();
696 case RC_SCREEN_FONT_SANS:
698 sans_font_name = lexrc.GetString();
701 case RC_SCREEN_FONT_TYPEWRITER:
703 typewriter_font_name = lexrc.GetString();
706 case RC_SCREEN_FONT_MENU:
708 menu_font_name = lexrc.GetString();
711 case RC_SCREEN_FONT_POPUP:
713 popup_font_name = lexrc.GetString();
716 case RC_SCREEN_FONT_ENCODING:
718 font_norm = lexrc.GetString();
721 case RC_AUTOREGIONDELETE:
722 // Auto region delete defaults to true
724 auto_region_delete = lexrc.GetBool();
729 // we should not do an explicit binding before
730 // loading a bind file. So, in this case, load
731 // the default bind file.
735 // !!!chb, dynamic key binding...
739 if (lexrc.lex() == LyXLex::LEX_DATA) {
740 seq = lexrc.GetString();
742 lexrc.printError("Bad key sequence: `$$Token'");
746 if (lexrc.lex() == LyXLex::LEX_DATA) {
747 cmd = lexrc.GetString();
749 lexrc.printError("Bad command: `$$Token'");
753 if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) {
754 if (lyxerr.debugging(Debug::KEY)) {
755 lyxerr << "RC_BIND: Sequence `"
756 << seq << "' Command `"
757 << cmd << "' Action `"
758 << action << '\'' << endl;
760 res = bindKey(seq.c_str(), action);
763 "Invalid key sequence `"
766 } else {// cmd is the last token read.
768 "Unknown LyX function `$$Token'");
774 lyxpipes = ExpandPath(lexrc.GetString());
777 case RC_CURSOR_FOLLOWS_SCROLLBAR:
779 cursor_follows_scrollbar = lexrc.GetBool();
781 case RC_FAST_SELECTION:
783 fast_selection = lexrc.GetBool();
785 case RC_BACKGROUND_COLOR:
787 background_color = lexrc.GetString();
789 case RC_SELECTION_COLOR:
791 strncpy(selection_color,
792 lexrc.GetString().c_str(), 31);
796 fax_command = lexrc.GetString();
800 fax_program = lexrc.GetString();
804 string s = lexrc.GetString();
808 phone_book = user_lyxdir + s;
811 case RC_ASCIIROFF_COMMAND:
813 ascii_roff_command = lexrc.GetString();
815 case RC_ASCII_LINELEN:
817 ascii_linelen = lexrc.GetInteger();
819 // Spellchecker settings:
820 case RC_SPELL_COMMAND:
822 isp_command = lexrc.GetString();
824 case RC_ACCEPT_COMPOUND:
826 isp_accept_compound = lexrc.GetBool();
830 isp_use_input_encoding = lexrc.GetBool();
832 case RC_USE_ALT_LANG:
834 isp_use_alt_lang = lexrc.GetBool();
836 case RC_USE_PERS_DICT:
838 isp_use_pers_dict = lexrc.GetBool();
840 case RC_USE_ESC_CHARS:
842 isp_use_esc_chars = lexrc.GetBool();
846 isp_alt_lang = lexrc.GetString();
850 isp_pers_dict = lexrc.GetString();
854 isp_esc_chars = lexrc.GetString();
856 case RC_LAST: break; // this is just a dummy
864 void LyXRC::write(string const & filename) const
866 ofstream ofs(filename.c_str());
872 void LyXRC::print() const
874 if (lyxerr.debugging())
881 void LyXRC::output(ostream & os) const
883 os << "### This file is part of\n"
884 << "### ========================================================\n"
885 << "### LyX, The Document Processor\n"
887 << "### Copyright 1995 Matthias Ettrich\n"
888 << "### Copyright 1995-1998 The LyX Team.\n"
890 << "### ========================================================\n"
892 << "# This file is written by LyX, if you want to make your own\n"
893 << "# modifications you should do them from inside LyX and save\n"
894 << "# your preferences, or you can also make your modifications\n"
895 << "# to lyxrc by hand. It is not advisable to edit this file.\n"
898 // Why the switch you might ask. It is a trick to ensure that all
899 // the elements in the LyXRCTags enum is handled. As you can see
900 // there are no breaks at all. So it is just a huge fall-through.
901 // The nice thing is that we will get a warning from the compiler
902 // if we forget an element.
903 LyXRCTags tag = RC_LAST;
907 // input/include files are not done here
909 // bindings is not written to the preferences file.
911 // bind files are not done here.
912 case RC_BEGINTOOLBAR:
913 // Toolbar is not written here (yet).
914 case RC_FONT_ENCODING:
915 os << "\\font_encoding \"" << fontenc << "\"\n";
917 os << "\\printer \"" << printer << "\"\n";
918 case RC_PRINT_COMMAND:
919 os << "\\print_command \"" << print_command << "\"\n";
920 case RC_PRINTEVENPAGEFLAG:
921 os << "\\print_evenpage_flag \"" << print_evenpage_flag
923 case RC_PRINTODDPAGEFLAG:
924 os << "\\print_oddpage_flag \"" << print_oddpage_flag
926 case RC_PRINTPAGERANGEFLAG:
927 os << "\\print_pagerange_flag \"" << print_pagerange_flag
929 case RC_PRINTCOPIESFLAG:
930 os << "\\print_copies_flag \"" << print_copies_flag << "\"\n";
931 case RC_PRINTCOLLCOPIESFLAG:
932 os << "\\print_collcopies_flag \"" << print_collcopies_flag
934 case RC_PRINTREVERSEFLAG:
935 os << "\\print_reverse_flag \"" << print_reverse_flag
937 case RC_PRINTLANDSCAPEFLAG:
938 os << "\\print_landscape_flag \"" << print_landscape_flag
940 case RC_PRINTTOPRINTER:
941 os << "\\print_to_printer \"" << print_to_printer << "\"\n";
942 case RC_PRINT_ADAPTOUTPUT:
943 os << "\\print_adapt_output " << tostr(print_adapt_output)
946 os << "\\print_to_file \"" << print_to_file << "\"\n";
947 case RC_PRINTFILEEXTENSION:
948 os << "\\print_file_extension \"" << print_file_extension
950 case RC_PRINTEXSTRAOPTIONS:
951 os << "\\print_extra_options \"" << print_extra_options
953 case RC_PRINTSPOOL_COMMAND:
954 os << "\\print_spool_command \"" << print_spool_command
956 case RC_PRINTSPOOL_PRINTERPREFIX:
957 os << "\\print_spool_printerprefix \""
958 << print_spool_printerprefix << "\"\n";
959 case RC_PRINTPAPERDIMENSIONFLAG:
960 os << "\\print_paper_dimension_flag \""
961 << print_paper_dimension_flag << "\"\n";
962 case RC_PRINTPAPERFLAG:
963 os << "\\print_paper_flag \"" << print_paper_flag << "\"\n";
964 case RC_CUSTOM_EXPORT_COMMAND:
965 os << "\\custom_export_command \"" << custom_export_command
967 case RC_CUSTOM_EXPORT_FORMAT:
968 os << "\\custom_export_format \"" << custom_export_format
970 case RC_LATEX_COMMAND:
971 os << "\\latex_command \"" << latex_command << "\"\n";
972 case RC_LITERATE_COMMAND:
973 os << "\\literate_command \"" << literate_command << "\"\n";
974 case RC_LITERATE_EXTENSION:
975 os << "\\literate_extension \"" << literate_extension
977 case RC_LITERATE_ERROR_FILTER:
978 os << "\\literate_error_filter \"" << literate_error_filter
980 case RC_BUILD_COMMAND:
981 os << "\\build_command \"" << build_command << "\"\n";
982 case RC_BUILD_ERROR_FILTER:
983 os << "\\build_error_filter \"" << build_error_filter
986 os << "\\screen_dpi " << dpi << "\n";
988 os << "\\screen_zoom " << zoom << "\n";
989 case RC_SCREEN_FONT_SIZES:
992 os << "\\screen_font_sizes";
993 os << " " << font_sizes[LyXFont::SIZE_TINY];
994 os << " " << font_sizes[LyXFont::SIZE_SCRIPT];
995 os << " " << font_sizes[LyXFont::SIZE_FOOTNOTE];
996 os << " " << font_sizes[LyXFont::SIZE_SMALL];
997 os << " " << font_sizes[LyXFont::SIZE_NORMAL];
998 os << " " << font_sizes[LyXFont::SIZE_LARGE];
999 os << " " << font_sizes[LyXFont::SIZE_LARGER];
1000 os << " " << font_sizes[LyXFont::SIZE_LARGEST];
1001 os << " " << font_sizes[LyXFont::SIZE_HUGE];
1002 os << " " << font_sizes[LyXFont::SIZE_HUGER];
1004 case RC_AUTOREGIONDELETE:
1005 os << "\\auto_region_delete " << tostr(auto_region_delete)
1008 os << "\\autosave " << autosave << "\n";
1009 case RC_EXIT_CONFIRMATION:
1010 os << "\\exit_confirmation " << tostr(exit_confirmation)
1012 case RC_DISPLAY_SHORTCUTS:
1013 os << "\\display_shortcuts " << tostr(display_shortcuts)
1015 case RC_VIEWDVI_COMMAND:
1016 os << "\\view_dvi_command \"" << view_dvi_command << "\"\n";
1017 case RC_DEFAULT_PAPERSIZE:
1018 os << "\\default_papersize \"";
1019 switch (default_papersize) {
1020 case BufferParams::PAPER_USLETTER:
1021 os << "usletter"; break;
1022 case BufferParams::PAPER_LEGALPAPER:
1023 os << "legal"; break;
1024 case BufferParams::PAPER_EXECUTIVEPAPER:
1025 os << "executive"; break;
1026 case BufferParams::PAPER_A3PAPER:
1028 case BufferParams::PAPER_A4PAPER:
1030 case BufferParams::PAPER_A5PAPER:
1032 case BufferParams::PAPER_B5PAPER:
1034 case BufferParams::PAPER_DEFAULT: break;
1037 case RC_VIEWPS_COMMAND:
1038 os << "\\view_ps_command \"" << view_ps_command << "\"\n";
1039 case RC_VIEWPSPIC_COMMAND:
1040 os << "\\view_pspic_command \"" << view_pspic_command
1043 os << "\\ps_command \"" << ps_command << "\"\n";
1044 case RC_CHKTEX_COMMAND:
1045 os << "\\chktex_command \"" << chktex_command << "\"\n";
1046 case RC_HTML_COMMAND:
1047 os << "\\html_command \"" << html_command << "\"\n";
1048 case RC_SGML_EXTRA_OPTIONS:
1049 os << "\\sgml_extra_options \"" << sgml_extra_options
1052 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1053 case RC_KBMAP_PRIMARY:
1054 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1055 case RC_KBMAP_SECONDARY:
1056 os << "\\kbmap_secondary \"" << secondary_kbmap << "\"\n";
1058 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1059 case RC_RELYX_COMMAND:
1060 os << "\\relyx_command \"" << relyx_command << "\"\n";
1061 case RC_DOCUMENTPATH:
1062 os << "\\document_path \"" << document_path << "\"\n";
1063 case RC_TEMPLATEPATH:
1064 os << "\\template_path \"" << template_path << "\"\n";
1065 case RC_TEMPDIRPATH:
1066 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1068 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1070 os << "\\lastfiles \"" << lastfiles << "\"\n";
1071 case RC_NUMLASTFILES:
1072 os << "\\num_lastfiles " << num_lastfiles << "\n";
1073 case RC_CHECKLASTFILES:
1074 os << "\\check_lastfiles " << tostr(check_lastfiles) << "\n";
1075 case RC_SCREEN_FONT_ROMAN:
1076 os << "\\screen_font_roman \"" << roman_font_name << "\"\n";
1077 case RC_SCREEN_FONT_SANS:
1078 os << "\\screen_font_sans \"" << sans_font_name << "\"\n";
1079 case RC_SCREEN_FONT_TYPEWRITER:
1080 os << "\\screen_font_typewriter \""
1081 << typewriter_font_name << "\"\n";
1082 case RC_SCREEN_FONT_MENU:
1083 os << "\\screen_font_menu \"" << menu_font_name << "\"\n";
1084 case RC_SCREEN_FONT_POPUP:
1085 os << "\\screen_font_popup \"" << popup_font_name << "\"\n";
1086 case RC_SCREEN_FONT_ENCODING:
1087 os << "\\screen_font_encoding \"" << font_norm << "\"\n";
1088 case RC_SCREEN_FONT_SCALABLE:
1089 os << "\\screen_font_scalable " << tostr(use_scalable_fonts)
1091 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1092 os << "\\cursor_follows_scrollbar "
1093 << tostr(cursor_follows_scrollbar) << "\n";
1094 case RC_FAST_SELECTION:
1095 os << "\\fast_selection "
1096 << tostr(static_cast<bool>(fast_selection)) << "\n";
1097 case RC_BACKGROUND_COLOR:
1098 os << "\\background_color \"" << background_color << "\"\n";
1099 case RC_SELECTION_COLOR:
1100 os << "\\selection_color \"" << selection_color << "\"\n";
1101 case RC_FAX_COMMAND:
1102 os << "\\fax_command \"" << fax_command << "\"\n";
1104 os << "\\fax_program \"" << fax_program << "\"\n";
1106 os << "\\phone_book \"" << phone_book << "\"\n";
1107 case RC_ASCIIROFF_COMMAND:
1108 os << "\\ascii_roff_command \"" << ascii_roff_command
1110 case RC_ASCII_LINELEN:
1111 os << "\\ascii_linelen " << ascii_linelen << "\n";
1112 case RC_SPELL_COMMAND:
1113 os << "\\spell_command \"" << isp_command << "\"\n";
1114 case RC_ACCEPT_COMPOUND:
1115 os << "\\accept_compound " << tostr(isp_accept_compound)
1117 case RC_USE_INP_ENC:
1118 os << "\\use_input_encoding " << tostr(isp_use_input_encoding)
1120 case RC_USE_ALT_LANG:
1121 os << "\\use_alt_language " << tostr(isp_use_alt_lang) << "\n";
1122 case RC_USE_PERS_DICT:
1123 os << "\\use_personal_dictionary " << tostr(isp_use_pers_dict)
1125 case RC_USE_ESC_CHARS:
1126 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1129 os << "\\alternate_language \"" << isp_alt_lang << "\"\n";
1131 os << "\\personal_dictionary \"" << isp_pers_dict << "\"\n";
1133 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1139 /// define the default key bindings for LyX.
1140 void LyXRC::defaultKeyBindings()
1142 bindKey("Right", LFUN_RIGHT);
1143 bindKey("Left", LFUN_LEFT);
1144 bindKey("Up", LFUN_UP);
1145 bindKey("Down", LFUN_DOWN);
1147 bindKey("Tab", LFUN_TAB);
1149 bindKey("Home", LFUN_HOME);
1150 bindKey("End", LFUN_END);
1151 bindKey("Prior", LFUN_PRIOR);
1152 bindKey("Next", LFUN_NEXT);
1154 bindKey("Return", LFUN_BREAKPARAGRAPH);
1155 bindKey("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE);
1157 bindKey("Delete", LFUN_DELETE);
1158 bindKey("BackSpace", LFUN_BACKSPACE);
1159 // bindKeyings for transparent handling of deadkeys
1160 // The keysyms are gotten from XFree86 X11R6
1161 bindKey("~C-~S-~M-dead_acute", LFUN_ACUTE);
1162 bindKey("~C-~S-~M-dead_breve", LFUN_BREVE);
1163 bindKey("~C-~S-~M-dead_caron", LFUN_CARON);
1164 bindKey("~C-~S-~M-dead_cedilla", LFUN_CEDILLA);
1165 bindKey("~C-~S-~M-dead_abovering", LFUN_CIRCLE);
1166 bindKey("~C-~S-~M-dead_circumflex", LFUN_CIRCUMFLEX);
1167 bindKey("~C-~S-~M-dead_abovedot", LFUN_DOT);
1168 bindKey("~C-~S-~M-dead_grave", LFUN_GRAVE);
1169 bindKey("~C-~S-~M-dead_doubleacute", LFUN_HUNG_UMLAUT);
1170 bindKey("~C-~S-~M-dead_macron", LFUN_MACRON);
1171 // nothing with this name
1172 // bindKey("~C-~S-~M-dead_special_caron", LFUN_SPECIAL_CARON);
1173 bindKey("~C-~S-~M-dead_tilde", LFUN_TILDE);
1174 bindKey("~C-~S-~M-dead_diaeresis", LFUN_UMLAUT);
1175 // nothing with this name either...
1176 //bindKey("~C-~S-~M-dead_underbar", LFUN_UNDERBAR);
1177 bindKey("~C-~S-~M-dead_belowdot", LFUN_UNDERDOT);
1178 bindKey("~C-~S-~M-dead_tie", LFUN_TIE);
1179 bindKey("~C-~S-~M-dead_ogonek", LFUN_OGONEK);
1181 // bindings to utilize the use of the numeric keypad
1182 // e.g. Num Lock set
1183 bindKey("KP_0", LFUN_SELFINSERT);
1184 bindKey("KP_Decimal", LFUN_SELFINSERT);
1185 bindKey("KP_Enter", LFUN_SELFINSERT);
1186 bindKey("KP_1", LFUN_SELFINSERT);
1187 bindKey("KP_2", LFUN_SELFINSERT);
1188 bindKey("KP_3", LFUN_SELFINSERT);
1189 bindKey("KP_4", LFUN_SELFINSERT);
1190 bindKey("KP_5", LFUN_SELFINSERT);
1191 bindKey("KP_6", LFUN_SELFINSERT);
1192 bindKey("KP_Add", LFUN_SELFINSERT);
1193 bindKey("KP_7", LFUN_SELFINSERT);
1194 bindKey("KP_8", LFUN_SELFINSERT);
1195 bindKey("KP_9", LFUN_SELFINSERT);
1196 bindKey("KP_Divide", LFUN_SELFINSERT);
1197 bindKey("KP_Multiply", LFUN_SELFINSERT);
1198 bindKey("KP_Subtract", LFUN_SELFINSERT);
1200 /* Most self-insert keys are handled in the 'default:' section of
1201 * WorkAreaKeyPress - so we don't have to define them all.
1202 * However keys explicit decleared as self-insert are
1203 * handled seperatly (LFUN_SELFINSERT.) Lgb. */
1205 bindKey("C-Tab", LFUN_TABINSERT); // ale970515