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"
23 #include "LyXAction.h"
24 #include "lyxserver.h"
27 #include "tex-strings.h"
28 #include "support/path.h"
29 #include "support/filetools.h"
32 // this is crappy... why are those colors command line arguments and
33 // not in lyxrc?? (Matthias)
34 // Because nobody put them there. (Asger)
35 extern int fast_selection;
36 extern string background_color;
37 extern char selection_color[];
38 extern bool cursor_follows_scrollbar;
39 extern kb_keymap * toplevel_keymap;
40 extern LyXAction lyxaction;
49 RC_PRINTPAGERANGEFLAG,
51 RC_PRINTCOLLCOPIESFLAG,
53 RC_PRINTLANDSCAPEFLAG,
57 RC_PRINTFILEEXTENSION,
58 RC_PRINTEXSTRAOPTIONS,
59 RC_PRINTSPOOL_COMMAND,
60 RC_PRINTSPOOL_PRINTERPREFIX,
62 RC_PRINTPAPERDIMENSIONFLAG,
63 RC_CUSTOM_EXPORT_COMMAND,
64 RC_CUSTOM_EXPORT_FORMAT,
67 RC_LITERATE_EXTENSION,
68 RC_LITERATE_ERROR_FILTER,
70 RC_BUILD_ERROR_FILTER,
76 RC_SCREEN_FONT_TYPEWRITER,
79 RC_SCREEN_FONT_ENCODING,
81 RC_SGML_EXTRA_OPTIONS,
90 RC_NOMENUACCELERATORS,
102 RC_ASCIIROFF_COMMAND,
107 RC_DEFAULT_PAPERSIZE,
110 RC_VIEWPSPIC_COMMAND,
117 RC_SCREEN_FONT_SCALABLE,
122 RC_CURSOR_FOLLOWS_SCROLLBAR,
123 RC_EXIT_CONFIRMATION,
124 RC_DISPLAY_SHORTCUTS,
130 static keyword_item lyxrcTags[] = {
131 { "\\accept_compound", RC_ACCEPT_COMPOUND },
132 { "\\alternate_language", RC_ALT_LANG },
133 { "\\ascii_linelen", RC_ASCII_LINELEN },
134 { "\\ascii_roff_command", RC_ASCIIROFF_COMMAND },
135 { "\\auto_region_delete", RC_AUTOREGIONDELETE },
136 { "\\autosave", RC_AUTOSAVE },
137 { "\\background_color", RC_BACKGROUND_COLOR },
138 { "\\begin_toolbar", RC_BEGINTOOLBAR },
139 { "\\bind", RC_BIND },
140 { "\\bind_file", RC_BINDFILE },
141 { "\\build_command", RC_BUILD_COMMAND },
142 { "\\build_error_filter", RC_BUILD_ERROR_FILTER },
143 { "\\check_lastfiles", RC_CHECKLASTFILES },
144 { "\\chktex_command", RC_CHKTEX_COMMAND },
145 { "\\cursor_follows_scrollbar", RC_CURSOR_FOLLOWS_SCROLLBAR },
146 { "\\custom_export_command", RC_CUSTOM_EXPORT_COMMAND },
147 { "\\custom_export_format", RC_CUSTOM_EXPORT_FORMAT },
148 { "\\default_papersize", RC_DEFAULT_PAPERSIZE },
149 { "\\display_shortcuts", RC_DISPLAY_SHORTCUTS },
150 { "\\document_path", RC_DOCUMENTPATH },
151 { "\\escape_chars", RC_ESC_CHARS },
152 { "\\exit_confirmation", RC_EXIT_CONFIRMATION },
153 { "\\fast_selection", RC_FAST_SELECTION },
154 { "\\fax_command", RC_FAX_COMMAND },
155 { "\\fax_program", RC_FAXPROGRAM },
156 { "\\font_encoding", RC_FONT_ENCODING },
157 { "\\html_command", RC_HTML_COMMAND },
158 { "\\input", RC_INPUT },
159 { "\\kbmap", RC_KBMAP },
160 { "\\kbmap_primary", RC_KBMAP_PRIMARY },
161 { "\\kbmap_secondary", RC_KBMAP_SECONDARY },
162 { "\\lastfiles", RC_LASTFILES },
163 { "\\latex_command", RC_LATEX_COMMAND },
164 { "\\literate_command", RC_LITERATE_COMMAND },
165 { "\\literate_error_filter", RC_LITERATE_ERROR_FILTER },
166 { "\\literate_extension", RC_LITERATE_EXTENSION },
167 { "\\num_lastfiles", RC_NUMLASTFILES },
168 { "\\personal_dictionary", RC_PERS_DICT },
169 { "\\phone_book", RC_PHONEBOOK },
170 { "\\print_adapt_output", RC_PRINT_ADAPTOUTPUT },
171 { "\\print_collcopies_flag", RC_PRINTCOLLCOPIESFLAG },
172 { "\\print_command", RC_PRINT_COMMAND },
173 { "\\print_copies_flag", RC_PRINTCOPIESFLAG },
174 { "\\print_evenpage_flag", RC_PRINTEVENPAGEFLAG },
175 { "\\print_extra_options", RC_PRINTEXSTRAOPTIONS },
176 { "\\print_file_extension", RC_PRINTFILEEXTENSION },
177 { "\\print_landscape_flag", RC_PRINTLANDSCAPEFLAG },
178 { "\\print_oddpage_flag", RC_PRINTODDPAGEFLAG },
179 { "\\print_pagerange_flag", RC_PRINTPAGERANGEFLAG },
180 { "\\print_paper_dimension_flag", RC_PRINTPAPERDIMENSIONFLAG },
181 { "\\print_paper_flag", RC_PRINTPAPERFLAG },
182 { "\\print_reverse_flag", RC_PRINTREVERSEFLAG },
183 { "\\print_spool_command", RC_PRINTSPOOL_COMMAND },
184 { "\\print_spool_printerprefix", RC_PRINTSPOOL_PRINTERPREFIX },
185 { "\\print_to_file", RC_PRINTTOFILE },
186 { "\\print_to_printer", RC_PRINTTOPRINTER },
187 { "\\printer", RC_PRINTER },
188 { "\\ps_command", RC_PS_COMMAND },
189 { "\\relyx_command", RC_RELYX_COMMAND },
190 { "\\screen_dpi", RC_SCREEN_DPI },
191 { "\\screen_font_encoding", RC_SCREEN_FONT_ENCODING },
192 { "\\screen_font_menu", RC_SCREEN_FONT_MENU },
193 { "\\screen_font_popup", RC_SCREEN_FONT_POPUP },
194 { "\\screen_font_roman", RC_SCREEN_FONT_ROMAN },
195 { "\\screen_font_sans", RC_SCREEN_FONT_SANS },
196 { "\\screen_font_scalable", RC_SCREEN_FONT_SCALABLE },
197 { "\\screen_font_sizes", RC_SCREEN_FONT_SIZES },
198 { "\\screen_font_typewriter", RC_SCREEN_FONT_TYPEWRITER },
199 { "\\screen_zoom", RC_SCREEN_ZOOM },
200 { "\\selection_color", RC_SELECTION_COLOR },
201 { "\\serverpipe", RC_SERVERPIPE },
202 { "\\sgml_extra_options", RC_SGML_EXTRA_OPTIONS },
203 { "\\spell_command", RC_SPELL_COMMAND },
204 { "\\tempdir_path", RC_TEMPDIRPATH },
205 { "\\template_path", RC_TEMPLATEPATH },
206 { "\\use_alt_language", RC_USE_ALT_LANG },
207 { "\\use_escape_chars", RC_USE_ESC_CHARS },
208 { "\\use_input_encoding", RC_USE_INP_ENC },
209 { "\\use_personal_dictionary", RC_USE_PERS_DICT },
210 { "\\use_tempdir", RC_USETEMPDIR },
211 { "\\view_dvi_command", RC_VIEWDVI_COMMAND },
212 { "\\view_ps_command", RC_VIEWPS_COMMAND },
213 { "\\view_pspic_command", RC_VIEWPSPIC_COMMAND }
216 /* Let the range depend of the size of lyxrcTags. Alejandro 240596 */
217 static const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
219 // Should this be moved inside LyXAction?
221 int bindKey(char const * seq, int action)
223 return toplevel_keymap->bind(seq, action);
229 // Get printer from the environment. If fail, use default "",
230 // assuming that everything is set up correctly.
231 printer = GetEnv("PRINTER");
232 print_command = "dvips";
233 print_evenpage_flag = "-B";
234 print_oddpage_flag = "-A";
235 print_pagerange_flag = "-pp";
236 print_copies_flag = "-c";
237 print_collcopies_flag = "-C";
238 print_reverse_flag = "-r";
239 print_landscape_flag = "-t landscape";
240 print_to_printer = "-P";
241 print_to_file = "-o ";
242 print_file_extension = ".ps";
243 print_paper_flag = "-t";
244 print_paper_dimension_flag = "-T";
245 document_path = GetEnvPath("HOME");
246 tempdir_path = "/tmp";
248 latex_command = "latex";
249 literate_command = "none";
250 literate_extension = "none";
251 literate_error_filter = "cat";
252 build_command = "make";
253 build_error_filter = "cat";
254 relyx_command = "reLyX";
256 view_ps_command = "ghostview -swap";
257 view_pspic_command = "ghostview";
258 view_dvi_command = "xdvi";
259 default_papersize = BufferParams::PAPER_USLETTER;
260 custom_export_format = "ps";
261 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
262 html_command = "tth -t";
265 // Because a screen typically is wider than a piece of paper:
267 // Default LaTeX font size:
268 font_sizes[LyXFont::SIZE_TINY] = 5.0;
269 font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
270 font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
271 font_sizes[LyXFont::SIZE_SMALL] = 9.0;
272 font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
273 font_sizes[LyXFont::SIZE_LARGE] = 12.0;
274 font_sizes[LyXFont::SIZE_LARGER] = 14.4;
275 font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
276 font_sizes[LyXFont::SIZE_HUGE] = 20.74;
277 font_sizes[LyXFont::SIZE_HUGER] = 24.88;
278 use_scalable_fonts = true;
279 roman_font_name = "-*-times";
280 sans_font_name = "-*-helvetica";
281 typewriter_font_name = "-*-courier";
282 menu_font_name = "-*-helvetica-bold-r";
283 popup_font_name = "-*-helvetica-medium-r";
284 font_norm = "iso8859-1";
286 auto_region_delete = true;
289 check_lastfiles = true;
290 exit_confirmation = true;
291 display_shortcuts = true;
292 // Spellchecker settings:
293 isp_command = "ispell";
294 isp_accept_compound = false;
295 isp_use_input_encoding = false;
296 isp_use_alt_lang = false;
297 isp_use_pers_dict = false;
298 isp_use_esc_chars = false;
301 defaultKeyBindings();
305 int LyXRC::ReadBindFile(string const & name)
308 string tmp = i18nLibFileSearch("bind", name, "bind");
309 lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
310 int result = read(tmp);
312 lyxerr << "Error reading bind file: " << tmp << endl;
317 int LyXRC::read(string const & filename)
320 string bindFile = "cua";
322 LyXLex lexrc(lyxrcTags, lyxrcCount);
323 if (lyxerr.debugging(Debug::PARSER))
326 lexrc.setFile(filename);
327 if (!lexrc.IsOK()) return -2;
329 lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
331 while (lexrc.IsOK()) {
332 // By using two switches we take advantage of the compiler
333 // telling us if we have missed a LyXRCTags element in
334 // the second switch.
335 // Note that this also shows a problem with LyXLex since it
336 // helps us avoid taking advantage of the strictness of the
339 int le = lexrc.lex();
341 case LyXLex::LEX_UNDEF:
342 lexrc.printError("Unknown tag `$$Token'");
344 case LyXLex::LEX_FEOF:
348 switch (static_cast<LyXRCTags>(le)) {
349 case RC_INPUT: // Include file
351 string tmp = LibFileSearch(string(),
354 lexrc.printError("Error reading "
355 "included file: "+tmp);
359 case RC_BINDFILE: // RVDK_PATCH_5
361 ReadBindFile(lexrc.GetString());
365 case RC_BEGINTOOLBAR:
366 // this toolbar should be changed to be a completely
367 // non gui toolbar. (Lgb)
373 use_kbmap = lexrc.GetBool();
376 case RC_EXIT_CONFIRMATION:
378 exit_confirmation = lexrc.GetBool();
381 case RC_DISPLAY_SHORTCUTS:
383 display_shortcuts = lexrc.GetBool();
386 case RC_KBMAP_PRIMARY:
388 primary_kbmap = lexrc.GetString();
391 case RC_KBMAP_SECONDARY:
393 secondary_kbmap = lexrc.GetString();
396 case RC_FONT_ENCODING:
398 fontenc = lexrc.GetString();
403 printer = lexrc.GetString();
406 case RC_PRINT_COMMAND:
408 print_command = lexrc.GetString();
411 case RC_PRINTEVENPAGEFLAG:
413 print_evenpage_flag = lexrc.GetString();
416 case RC_PRINTODDPAGEFLAG:
418 print_oddpage_flag = lexrc.GetString();
421 case RC_PRINTPAGERANGEFLAG:
423 print_pagerange_flag = lexrc.GetString();
426 case RC_PRINTCOPIESFLAG:
428 print_copies_flag = lexrc.GetString();
431 case RC_PRINTCOLLCOPIESFLAG:
433 print_collcopies_flag = lexrc.GetString();
436 case RC_PRINTREVERSEFLAG:
438 print_reverse_flag = lexrc.GetString();
441 case RC_PRINTLANDSCAPEFLAG:
443 print_landscape_flag = lexrc.GetString();
446 case RC_PRINTTOPRINTER:
448 print_to_printer = lexrc.GetString();
451 case RC_PRINT_ADAPTOUTPUT:
453 print_adapt_output = lexrc.GetBool();
458 print_to_file = lexrc.GetString();
461 case RC_PRINTFILEEXTENSION:
463 print_file_extension = lexrc.GetString();
466 case RC_PRINTEXSTRAOPTIONS:
468 print_extra_options = lexrc.GetString();
471 case RC_PRINTSPOOL_COMMAND:
473 print_spool_command = lexrc.GetString();
476 case RC_PRINTSPOOL_PRINTERPREFIX:
478 print_spool_printerprefix = lexrc.GetString();
481 case RC_PRINTPAPERDIMENSIONFLAG:
483 print_paper_dimension_flag = lexrc.GetString();
486 case RC_PRINTPAPERFLAG:
488 print_paper_flag = lexrc.GetString();
491 case RC_CUSTOM_EXPORT_COMMAND:
493 custom_export_command = lexrc.GetString();
496 case RC_CUSTOM_EXPORT_FORMAT:
498 custom_export_format = lexrc.GetString();
501 case RC_LATEX_COMMAND:
503 latex_command = lexrc.GetString();
506 case RC_LITERATE_COMMAND:
508 literate_command = lexrc.GetString();
511 case RC_LITERATE_EXTENSION:
513 literate_extension = lexrc.GetString();
516 case RC_LITERATE_ERROR_FILTER:
518 literate_error_filter = lexrc.GetString();
521 case RC_BUILD_COMMAND:
523 build_command = lexrc.GetString();
526 case RC_BUILD_ERROR_FILTER:
528 build_error_filter = lexrc.GetString();
531 case RC_RELYX_COMMAND:
533 relyx_command = lexrc.GetString();
536 case RC_DEFAULT_PAPERSIZE:
538 string size = lowercase(lexrc.GetString());
539 if (size == "usletter")
541 BufferParams::PAPER_USLETTER;
542 else if (size == "legal")
544 BufferParams::PAPER_LEGALPAPER;
545 else if (size == "executive")
547 BufferParams::PAPER_EXECUTIVEPAPER;
548 else if (size == "a3")
550 BufferParams::PAPER_A3PAPER;
551 else if (size == "a4")
553 BufferParams::PAPER_A4PAPER;
554 else if (size == "a5")
556 BufferParams::PAPER_A5PAPER;
557 else if (size == "b5")
559 BufferParams::PAPER_B5PAPER;
562 case RC_VIEWDVI_COMMAND:
564 view_dvi_command = lexrc.GetString();
569 ps_command = lexrc.GetString();
572 case RC_VIEWPS_COMMAND:
574 view_ps_command = lexrc.GetString();
577 case RC_VIEWPSPIC_COMMAND:
579 view_pspic_command = lexrc.GetString();
582 case RC_CHKTEX_COMMAND:
584 chktex_command = lexrc.GetString();
587 case RC_HTML_COMMAND:
589 html_command = lexrc.GetString();
594 dpi = lexrc.GetInteger();
599 zoom = lexrc.GetInteger();
602 case RC_SCREEN_FONT_SIZES:
604 font_sizes[LyXFont::SIZE_TINY] =
607 font_sizes[LyXFont::SIZE_SCRIPT] =
610 font_sizes[LyXFont::SIZE_FOOTNOTE] =
613 font_sizes[LyXFont::SIZE_SMALL] =
616 font_sizes[LyXFont::SIZE_NORMAL] =
619 font_sizes[LyXFont::SIZE_LARGE] =
622 font_sizes[LyXFont::SIZE_LARGER] =
625 font_sizes[LyXFont::SIZE_LARGEST] =
628 font_sizes[LyXFont::SIZE_HUGE] =
631 font_sizes[LyXFont::SIZE_HUGER] =
635 case RC_SCREEN_FONT_SCALABLE:
637 use_scalable_fonts = lexrc.GetBool();
642 autosave = lexrc.GetInteger();
645 case RC_SGML_EXTRA_OPTIONS:
647 sgml_extra_options = lexrc.GetString();
650 case RC_DOCUMENTPATH:
652 document_path = ExpandPath(lexrc.GetString());
656 case RC_TEMPLATEPATH:
658 template_path = ExpandPath(lexrc.GetString());
663 tempdir_path = ExpandPath(lexrc.GetString());
668 use_tempdir = lexrc.GetBool();
673 lastfiles = ExpandPath(lexrc.GetString());
676 case RC_NUMLASTFILES:
678 num_lastfiles = lexrc.GetInteger();
681 case RC_CHECKLASTFILES:
683 check_lastfiles = lexrc.GetBool();
686 case RC_SCREEN_FONT_ROMAN:
688 roman_font_name = lexrc.GetString();
691 case RC_SCREEN_FONT_SANS:
693 sans_font_name = lexrc.GetString();
696 case RC_SCREEN_FONT_TYPEWRITER:
698 typewriter_font_name = lexrc.GetString();
701 case RC_SCREEN_FONT_MENU:
703 menu_font_name = lexrc.GetString();
706 case RC_SCREEN_FONT_POPUP:
708 popup_font_name = lexrc.GetString();
711 case RC_SCREEN_FONT_ENCODING:
713 font_norm = lexrc.GetString();
716 case RC_AUTOREGIONDELETE:
717 // Auto region delete defaults to true
719 auto_region_delete = lexrc.GetBool();
724 // we should not do an explicit binding before
725 // loading a bind file. So, in this case, load
726 // the default bind file.
730 // !!!chb, dynamic key binding...
734 if (lexrc.lex() == LyXLex::LEX_DATA) {
735 seq = lexrc.GetString();
737 lexrc.printError("Bad key sequence: `$$Token'");
741 if (lexrc.lex() == LyXLex::LEX_DATA) {
742 cmd = lexrc.GetString();
744 lexrc.printError("Bad command: `$$Token'");
748 if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) {
749 if (lyxerr.debugging(Debug::KEY)) {
750 lyxerr << "RC_BIND: Sequence `"
751 << seq << "' Command `"
752 << cmd << "' Action `"
753 << action << '\'' << endl;
755 res = bindKey(seq.c_str(), action);
758 "Invalid key sequence `"
761 } else {// cmd is the last token read.
763 "Unknown LyX function `$$Token'");
769 lyxpipes = ExpandPath(lexrc.GetString());
772 case RC_CURSOR_FOLLOWS_SCROLLBAR:
774 cursor_follows_scrollbar = lexrc.GetBool();
776 case RC_FAST_SELECTION:
778 fast_selection = lexrc.GetBool();
780 case RC_BACKGROUND_COLOR:
782 background_color = lexrc.GetString();
784 case RC_SELECTION_COLOR:
786 strncpy(selection_color,
787 lexrc.GetString().c_str(), 31);
791 fax_command = lexrc.GetString();
795 fax_program = lexrc.GetString();
799 string s = lexrc.GetString();
803 phone_book = user_lyxdir + s;
806 case RC_ASCIIROFF_COMMAND:
808 ascii_roff_command = lexrc.GetString();
810 case RC_ASCII_LINELEN:
812 ascii_linelen = lexrc.GetInteger();
814 // Spellchecker settings:
815 case RC_SPELL_COMMAND:
817 isp_command = lexrc.GetString();
819 case RC_ACCEPT_COMPOUND:
821 isp_accept_compound = lexrc.GetBool();
825 isp_use_input_encoding = lexrc.GetBool();
827 case RC_USE_ALT_LANG:
829 isp_use_alt_lang = lexrc.GetBool();
831 case RC_USE_PERS_DICT:
833 isp_use_pers_dict = lexrc.GetBool();
835 case RC_USE_ESC_CHARS:
837 isp_use_esc_chars = lexrc.GetBool();
841 isp_alt_lang = lexrc.GetString();
845 isp_pers_dict = lexrc.GetString();
849 isp_esc_chars = lexrc.GetString();
851 case RC_LAST: break; // this is just a dummy
859 void LyXRC::write(string const & filename) const
861 ofstream ofs(filename.c_str());
867 void LyXRC::print() const
869 if (lyxerr.debugging())
876 void LyXRC::output(ostream & os) const
878 os << "### This file is part of\n"
879 << "### ========================================================\n"
880 << "### LyX, The Document Processor\n"
882 << "### Copyright 1995 Matthias Ettrich\n"
883 << "### Copyright 1995-1998 The LyX Team.\n"
885 << "### ========================================================\n"
887 << "# This file is written by LyX, if you want to make your own\n"
888 << "# modifications you should do them from inside LyX and save\n"
889 << "# your preferences, or you can also make your modifications\n"
890 << "# to lyxrc by hand. It is not advisable to edit this file.\n"
893 // Why the switch you might ask. It is a trick to ensure that all
894 // the elements in the LyXRCTags enum is handled. As you can see
895 // there are no breaks at all. So it is just a huge fall-through.
896 // The nice thing is that we will get a warning from the compiler
897 // if we forget an element.
898 LyXRCTags tag = RC_LAST;
902 // input/include files are not done here
904 // bindings is not written to the preferences file.
906 // bind files are not done here.
907 case RC_BEGINTOOLBAR:
908 // Toolbar is not written here (yet).
909 case RC_FONT_ENCODING:
910 os << "\\font_encoding \"" << fontenc << "\"\n";
912 os << "\\printer \"" << printer << "\"\n";
913 case RC_PRINT_COMMAND:
914 os << "\\print_command \"" << print_command << "\"\n";
915 case RC_PRINTEVENPAGEFLAG:
916 os << "\\print_evenpage_flag \"" << print_evenpage_flag
918 case RC_PRINTODDPAGEFLAG:
919 os << "\\print_oddpage_flag \"" << print_oddpage_flag
921 case RC_PRINTPAGERANGEFLAG:
922 os << "\\print_pagerange_flag \"" << print_pagerange_flag
924 case RC_PRINTCOPIESFLAG:
925 os << "\\print_copies_flag \"" << print_copies_flag << "\"\n";
926 case RC_PRINTCOLLCOPIESFLAG:
927 os << "\\print_collcopies_flag \"" << print_collcopies_flag
929 case RC_PRINTREVERSEFLAG:
930 os << "\\print_reverse_flag \"" << print_reverse_flag
932 case RC_PRINTLANDSCAPEFLAG:
933 os << "\\print_landscape_flag \"" << print_landscape_flag
935 case RC_PRINTTOPRINTER:
936 os << "\\print_to_printer \"" << print_to_printer << "\"\n";
937 case RC_PRINT_ADAPTOUTPUT:
938 os << "\\print_adapt_output " << tostr(print_adapt_output)
941 os << "\\print_to_file \"" << print_to_file << "\"\n";
942 case RC_PRINTFILEEXTENSION:
943 os << "\\print_file_extension \"" << print_file_extension
945 case RC_PRINTEXSTRAOPTIONS:
946 os << "\\print_extra_options \"" << print_extra_options
948 case RC_PRINTSPOOL_COMMAND:
949 os << "\\print_spool_command \"" << print_spool_command
951 case RC_PRINTSPOOL_PRINTERPREFIX:
952 os << "\\print_spool_printerprefix \""
953 << print_spool_printerprefix << "\"\n";
954 case RC_PRINTPAPERDIMENSIONFLAG:
955 os << "\\print_paper_dimension_flag \""
956 << print_paper_dimension_flag << "\"\n";
957 case RC_PRINTPAPERFLAG:
958 os << "\\print_paper_flag \"" << print_paper_flag << "\"\n";
959 case RC_CUSTOM_EXPORT_COMMAND:
960 os << "\\custom_export_command \"" << custom_export_command
962 case RC_CUSTOM_EXPORT_FORMAT:
963 os << "\\custom_export_format \"" << custom_export_format
965 case RC_LATEX_COMMAND:
966 os << "\\latex_command \"" << latex_command << "\"\n";
967 case RC_LITERATE_COMMAND:
968 os << "\\literate_command \"" << literate_command << "\"\n";
969 case RC_LITERATE_EXTENSION:
970 os << "\\literate_extension \"" << literate_extension
972 case RC_LITERATE_ERROR_FILTER:
973 os << "\\literate_error_filter \"" << literate_error_filter
975 case RC_BUILD_COMMAND:
976 os << "\\build_command \"" << build_command << "\"\n";
977 case RC_BUILD_ERROR_FILTER:
978 os << "\\build_error_filter \"" << build_error_filter
981 os << "\\screen_dpi " << dpi << "\n";
983 os << "\\screen_zoom " << zoom << "\n";
984 case RC_SCREEN_FONT_SIZES:
987 os << "\\screen_font_sizes";
988 os << " " << font_sizes[LyXFont::SIZE_TINY];
989 os << " " << font_sizes[LyXFont::SIZE_SCRIPT];
990 os << " " << font_sizes[LyXFont::SIZE_FOOTNOTE];
991 os << " " << font_sizes[LyXFont::SIZE_SMALL];
992 os << " " << font_sizes[LyXFont::SIZE_NORMAL];
993 os << " " << font_sizes[LyXFont::SIZE_LARGE];
994 os << " " << font_sizes[LyXFont::SIZE_LARGER];
995 os << " " << font_sizes[LyXFont::SIZE_LARGEST];
996 os << " " << font_sizes[LyXFont::SIZE_HUGE];
997 os << " " << font_sizes[LyXFont::SIZE_HUGER];
999 case RC_AUTOREGIONDELETE:
1000 os << "\\auto_region_delete " << tostr(auto_region_delete)
1003 os << "\\autosave " << autosave << "\n";
1004 case RC_EXIT_CONFIRMATION:
1005 os << "\\exit_confirmation " << tostr(exit_confirmation)
1007 case RC_DISPLAY_SHORTCUTS:
1008 os << "\\display_shortcuts " << tostr(display_shortcuts)
1010 case RC_VIEWDVI_COMMAND:
1011 os << "\\view_dvi_command \"" << view_dvi_command << "\"\n";
1012 case RC_DEFAULT_PAPERSIZE:
1013 os << "\\default_papersize \"";
1014 switch (default_papersize) {
1015 case BufferParams::PAPER_USLETTER:
1016 os << "usletter"; break;
1017 case BufferParams::PAPER_LEGALPAPER:
1018 os << "legal"; break;
1019 case BufferParams::PAPER_EXECUTIVEPAPER:
1020 os << "executive"; break;
1021 case BufferParams::PAPER_A3PAPER:
1023 case BufferParams::PAPER_A4PAPER:
1025 case BufferParams::PAPER_A5PAPER:
1027 case BufferParams::PAPER_B5PAPER:
1029 case BufferParams::PAPER_DEFAULT: break;
1032 case RC_VIEWPS_COMMAND:
1033 os << "\\view_ps_command \"" << view_ps_command << "\"\n";
1034 case RC_VIEWPSPIC_COMMAND:
1035 os << "\\view_pspic_command \"" << view_pspic_command
1038 os << "\\ps_command \"" << ps_command << "\"\n";
1039 case RC_CHKTEX_COMMAND:
1040 os << "\\chktex_command \"" << chktex_command << "\"\n";
1041 case RC_HTML_COMMAND:
1042 os << "\\html_command \"" << html_command << "\"\n";
1043 case RC_SGML_EXTRA_OPTIONS:
1044 os << "\\sgml_extra_options \"" << sgml_extra_options
1047 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1048 case RC_KBMAP_PRIMARY:
1049 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1050 case RC_KBMAP_SECONDARY:
1051 os << "\\kbmap_secondary \"" << secondary_kbmap << "\"\n";
1053 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1054 case RC_RELYX_COMMAND:
1055 os << "\\relyx_command \"" << relyx_command << "\"\n";
1056 case RC_DOCUMENTPATH:
1057 os << "\\document_path \"" << document_path << "\"\n";
1058 case RC_TEMPLATEPATH:
1059 os << "\\template_path \"" << template_path << "\"\n";
1060 case RC_TEMPDIRPATH:
1061 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1063 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1065 os << "\\lastfiles \"" << lastfiles << "\"\n";
1066 case RC_NUMLASTFILES:
1067 os << "\\num_lastfiles " << num_lastfiles << "\n";
1068 case RC_CHECKLASTFILES:
1069 os << "\\check_lastfiles " << tostr(check_lastfiles) << "\n";
1070 case RC_SCREEN_FONT_ROMAN:
1071 os << "\\screen_font_roman \"" << roman_font_name << "\"\n";
1072 case RC_SCREEN_FONT_SANS:
1073 os << "\\screen_font_sans \"" << sans_font_name << "\"\n";
1074 case RC_SCREEN_FONT_TYPEWRITER:
1075 os << "\\screen_font_typewriter \""
1076 << typewriter_font_name << "\"\n";
1077 case RC_SCREEN_FONT_MENU:
1078 os << "\\screen_font_menu \"" << menu_font_name << "\"\n";
1079 case RC_SCREEN_FONT_POPUP:
1080 os << "\\screen_font_popup \"" << popup_font_name << "\"\n";
1081 case RC_SCREEN_FONT_ENCODING:
1082 os << "\\screen_font_encoding \"" << font_norm << "\"\n";
1083 case RC_SCREEN_FONT_SCALABLE:
1084 os << "\\screen_font_scalable " << tostr(use_scalable_fonts)
1086 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1087 os << "\\cursor_follows_scrollbar "
1088 << tostr(cursor_follows_scrollbar) << "\n";
1089 case RC_FAST_SELECTION:
1090 os << "\\fast_selection "
1091 << tostr(static_cast<bool>(fast_selection)) << "\n";
1092 case RC_BACKGROUND_COLOR:
1093 os << "\\background_color \"" << background_color << "\"\n";
1094 case RC_SELECTION_COLOR:
1095 os << "\\selection_color \"" << selection_color << "\"\n";
1096 case RC_FAX_COMMAND:
1097 os << "\\fax_command \"" << fax_command << "\"\n";
1099 os << "\\fax_program \"" << fax_program << "\"\n";
1101 os << "\\phone_book \"" << phone_book << "\"\n";
1102 case RC_ASCIIROFF_COMMAND:
1103 os << "\\ascii_roff_command \"" << ascii_roff_command
1105 case RC_ASCII_LINELEN:
1106 os << "\\ascii_linelen " << ascii_linelen << "\n";
1107 case RC_SPELL_COMMAND:
1108 os << "\\spell_command \"" << isp_command << "\"\n";
1109 case RC_ACCEPT_COMPOUND:
1110 os << "\\accept_compound " << tostr(isp_accept_compound)
1112 case RC_USE_INP_ENC:
1113 os << "\\use_input_encoding " << tostr(isp_use_input_encoding)
1115 case RC_USE_ALT_LANG:
1116 os << "\\use_alt_language " << tostr(isp_use_alt_lang) << "\n";
1117 case RC_USE_PERS_DICT:
1118 os << "\\use_personal_dictionary " << tostr(isp_use_pers_dict)
1120 case RC_USE_ESC_CHARS:
1121 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1124 os << "\\alternate_language \"" << isp_alt_lang << "\"\n";
1126 os << "\\personal_dictionary \"" << isp_pers_dict << "\"\n";
1128 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1134 /// define the default key bindings for LyX.
1135 void LyXRC::defaultKeyBindings()
1137 bindKey("Right", LFUN_RIGHT);
1138 bindKey("Left", LFUN_LEFT);
1139 bindKey("Up", LFUN_UP);
1140 bindKey("Down", LFUN_DOWN);
1142 bindKey("Tab", LFUN_TAB);
1144 bindKey("Home", LFUN_HOME);
1145 bindKey("End", LFUN_END);
1146 bindKey("Prior", LFUN_PRIOR);
1147 bindKey("Next", LFUN_NEXT);
1149 bindKey("Return", LFUN_BREAKPARAGRAPH);
1150 bindKey("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE);
1152 bindKey("Delete", LFUN_DELETE);
1153 bindKey("BackSpace", LFUN_BACKSPACE);
1154 // bindKeyings for transparent handling of deadkeys
1155 // The keysyms are gotten from XFree86 X11R6
1156 bindKey("~C-~S-~M-dead_acute", LFUN_ACUTE);
1157 bindKey("~C-~S-~M-dead_breve", LFUN_BREVE);
1158 bindKey("~C-~S-~M-dead_caron", LFUN_CARON);
1159 bindKey("~C-~S-~M-dead_cedilla", LFUN_CEDILLA);
1160 bindKey("~C-~S-~M-dead_abovering", LFUN_CIRCLE);
1161 bindKey("~C-~S-~M-dead_circumflex", LFUN_CIRCUMFLEX);
1162 bindKey("~C-~S-~M-dead_abovedot", LFUN_DOT);
1163 bindKey("~C-~S-~M-dead_grave", LFUN_GRAVE);
1164 bindKey("~C-~S-~M-dead_doubleacute", LFUN_HUNG_UMLAUT);
1165 bindKey("~C-~S-~M-dead_macron", LFUN_MACRON);
1166 // nothing with this name
1167 // bindKey("~C-~S-~M-dead_special_caron", LFUN_SPECIAL_CARON);
1168 bindKey("~C-~S-~M-dead_tilde", LFUN_TILDE);
1169 bindKey("~C-~S-~M-dead_diaeresis", LFUN_UMLAUT);
1170 // nothing with this name either...
1171 //bindKey("~C-~S-~M-dead_underbar", LFUN_UNDERBAR);
1172 bindKey("~C-~S-~M-dead_belowdot", LFUN_UNDERDOT);
1173 bindKey("~C-~S-~M-dead_tie", LFUN_TIE);
1174 bindKey("~C-~S-~M-dead_ogonek", LFUN_OGONEK);
1176 // bindings to utilize the use of the numeric keypad
1177 // e.g. Num Lock set
1178 bindKey("KP_0", LFUN_SELFINSERT);
1179 bindKey("KP_Decimal", LFUN_SELFINSERT);
1180 bindKey("KP_Enter", LFUN_SELFINSERT);
1181 bindKey("KP_1", LFUN_SELFINSERT);
1182 bindKey("KP_2", LFUN_SELFINSERT);
1183 bindKey("KP_3", LFUN_SELFINSERT);
1184 bindKey("KP_4", LFUN_SELFINSERT);
1185 bindKey("KP_5", LFUN_SELFINSERT);
1186 bindKey("KP_6", LFUN_SELFINSERT);
1187 bindKey("KP_Add", LFUN_SELFINSERT);
1188 bindKey("KP_7", LFUN_SELFINSERT);
1189 bindKey("KP_8", LFUN_SELFINSERT);
1190 bindKey("KP_9", LFUN_SELFINSERT);
1191 bindKey("KP_Divide", LFUN_SELFINSERT);
1192 bindKey("KP_Multiply", LFUN_SELFINSERT);
1193 bindKey("KP_Subtract", LFUN_SELFINSERT);
1195 /* Most self-insert keys are handled in the 'default:' section of
1196 * WorkAreaKeyPress - so we don't have to define them all.
1197 * However keys explicit decleared as self-insert are
1198 * handled seperatly (LFUN_SELFINSERT.) Lgb. */
1200 bindKey("C-Tab", LFUN_TABINSERT); // ale970515