]> git.lyx.org Git - lyx.git/blob - src/lyxrc.C
cdb419e60bf667e1ba5a43a401e867fe735df970
[lyx.git] / src / lyxrc.C
1 /* This file is part of
2  * ======================================================
3  * 
4  *           LyX, The Document Processor
5  *       
6  *          Copyright 1995 Matthias Ettrich
7  *          Copyright 1995-1999 The LyX Team.
8  *
9  * ====================================================== */
10
11 #include <config.h>
12
13 #ifdef __GNUG__
14 #pragma implementation "lyxrc.h"
15 #endif
16
17 #include <fstream>
18 #include <iomanip>
19 using std::ofstream;
20 using std::cout;
21 using std::ios;
22
23 #include "debug.h"
24
25 #include "lyxrc.h"
26 #include "LyXAction.h"
27 #include "lyxserver.h"
28 #include "lyx_main.h"
29 #include "intl.h"
30 #include "tex-strings.h"
31 #include "support/path.h"
32 #include "support/filetools.h"
33 #include "lyxtext.h"
34
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;
44
45 enum LyXRCTags {
46         RC_BEGINTOOLBAR = 1,
47         RC_FONT_ENCODING,
48         RC_PRINTER,
49         RC_PRINT_COMMAND,
50         RC_PRINTEVENPAGEFLAG,
51         RC_PRINTODDPAGEFLAG,
52         RC_PRINTPAGERANGEFLAG,
53         RC_PRINTCOPIESFLAG,
54         RC_PRINTCOLLCOPIESFLAG,
55         RC_PRINTREVERSEFLAG,
56         RC_PRINTLANDSCAPEFLAG,
57         RC_PRINTTOPRINTER,
58         RC_PRINT_ADAPTOUTPUT,
59         RC_PRINTTOFILE,
60         RC_PRINTFILEEXTENSION,
61         RC_PRINTEXSTRAOPTIONS,
62         RC_PRINTSPOOL_COMMAND,
63         RC_PRINTSPOOL_PRINTERPREFIX,
64         RC_PRINTPAPERFLAG,
65         RC_PRINTPAPERDIMENSIONFLAG,
66         RC_CUSTOM_EXPORT_COMMAND,
67         RC_CUSTOM_EXPORT_FORMAT,
68         RC_LATEX_COMMAND,
69         RC_LITERATE_COMMAND,
70         RC_LITERATE_EXTENSION,
71         RC_LITERATE_ERROR_FILTER,
72         RC_BUILD_COMMAND,
73         RC_BUILD_ERROR_FILTER,
74         RC_SCREEN_DPI,
75         RC_SCREEN_ZOOM,
76         RC_SCREEN_FONT_SIZES,
77         RC_SCREEN_FONT_ROMAN,
78         RC_SCREEN_FONT_SANS,
79         RC_SCREEN_FONT_TYPEWRITER,
80         RC_SCREEN_FONT_MENU,
81         RC_SCREEN_FONT_POPUP,
82         RC_SCREEN_FONT_ENCODING,
83         RC_AUTOSAVE,
84         RC_SGML_EXTRA_OPTIONS,
85         RC_DOCUMENTPATH,
86         RC_TEMPLATEPATH,
87         RC_TEMPDIRPATH,
88         RC_USETEMPDIR,
89         RC_LASTFILES,
90         RC_AUTOREGIONDELETE,
91         RC_BIND,
92         RC_SERVERPIPE,
93         RC_NOMENUACCELERATORS,
94         RC_INPUT,
95         RC_BINDFILE,
96         RC_KBMAP,
97         RC_KBMAP_PRIMARY,
98         RC_KBMAP_SECONDARY,
99         RC_FAST_SELECTION,
100         RC_SELECTION_COLOR,
101         RC_BACKGROUND_COLOR,
102         RC_FAX_COMMAND,
103         RC_PHONEBOOK,
104         RC_FAXPROGRAM,
105         RC_ASCIIROFF_COMMAND,
106         RC_ASCII_LINELEN,
107         RC_NUMLASTFILES,
108         RC_CHECKLASTFILES,
109         RC_VIEWDVI_COMMAND,
110         RC_DEFAULT_PAPERSIZE,
111         RC_PS_COMMAND,
112         RC_VIEWPS_COMMAND,
113         RC_VIEWPSPIC_COMMAND,
114         RC_ACCEPT_COMPOUND,
115         RC_SPELL_COMMAND,
116         RC_USE_INP_ENC,
117         RC_USE_ALT_LANG,
118         RC_USE_PERS_DICT,
119         RC_USE_ESC_CHARS,
120         RC_SCREEN_FONT_SCALABLE,
121         RC_ALT_LANG,
122         RC_PERS_DICT,
123         RC_ESC_CHARS,
124         RC_CHKTEX_COMMAND,
125         RC_CURSOR_FOLLOWS_SCROLLBAR,
126         RC_EXIT_CONFIRMATION,
127         RC_DISPLAY_SHORTCUTS,
128         RC_RELYX_COMMAND,
129         RC_HTML_COMMAND,
130         RC_LAST 
131 };
132
133
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 }
218 };
219
220 /* Let the range depend of the size of lyxrcTags.  Alejandro 240596 */
221 static const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
222
223 // Should this be moved inside LyXAction? 
224 static inline
225 int bindKey(char const * seq, int action)
226
227         return toplevel_keymap->bind(seq, action); 
228 }
229
230
231 LyXRC::LyXRC()
232 {
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";
252         use_tempdir = true;
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";
260         ps_command = "gs";
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";
268         fontenc = "default";
269         dpi = 75;
270         // Because a screen typically is wider than a piece of paper:
271         zoom = 150;
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";
290         autosave = 300;
291         auto_region_delete = true;
292         ascii_linelen = 75;
293         num_lastfiles = 4;
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;
304         use_kbmap = false;
305         hasBindFile = false;
306         defaultKeyBindings();
307 }
308
309
310 int LyXRC::ReadBindFile(string const & name)
311 {
312         hasBindFile = true;
313         string tmp = i18nLibFileSearch("bind", name, "bind");
314         lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
315         int result = read(tmp);
316         if (result) {
317                 lyxerr << "Error reading bind file: " << tmp << endl;
318         }
319         return result;
320 }
321
322 int LyXRC::read(string const & filename)
323 {
324         // Default bindfile.
325         string bindFile = "cua";
326         
327         LyXLex lexrc(lyxrcTags, lyxrcCount);
328         if (lyxerr.debugging(Debug::PARSER))
329                 lexrc.printTable();
330         
331         lexrc.setFile(filename);
332         if (!lexrc.IsOK()) return -2;
333         
334         lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
335         
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
342                 // compiler.
343
344                 int le = lexrc.lex();
345                 switch(le) {
346                 case LyXLex::LEX_UNDEF:
347                         lexrc.printError("Unknown tag `$$Token'");
348                         continue; 
349                 case LyXLex::LEX_FEOF:
350                         continue; 
351                 default: break;
352                 }
353                 switch (static_cast<LyXRCTags>(le)) {
354                 case RC_INPUT: // Include file
355                         if (lexrc.next()) {
356                                 string tmp = LibFileSearch(string(),
357                                                            lexrc.GetString()); 
358                                 if (read(tmp)) {
359                                         lexrc.printError("Error reading "
360                                                          "included file: "+tmp);
361                                 }
362                         }
363                         break;
364                 case RC_BINDFILE:                     // RVDK_PATCH_5
365                         if (lexrc.next()) {
366                                 ReadBindFile(lexrc.GetString());
367                         }
368                         break;
369                         
370                 case RC_BEGINTOOLBAR:
371                         // this toolbar should be changed to be a completely
372                         // non gui toolbar. (Lgb)
373                         toolbar.read(lexrc);
374                         break;
375                         
376                 case RC_KBMAP:
377                         if (lexrc.next())
378                                 use_kbmap = lexrc.GetBool();
379                         break;
380                         
381                 case RC_EXIT_CONFIRMATION:
382                         if (lexrc.next())
383                                 exit_confirmation = lexrc.GetBool();
384                         break;
385                         
386                 case RC_DISPLAY_SHORTCUTS:
387                         if (lexrc.next())
388                                 display_shortcuts = lexrc.GetBool();
389                         break;
390                         
391                 case RC_KBMAP_PRIMARY:
392                         if (lexrc.next())
393                                 primary_kbmap = lexrc.GetString();
394                         break;
395                         
396                 case RC_KBMAP_SECONDARY:
397                         if (lexrc.next())
398                                 secondary_kbmap = lexrc.GetString();
399                         break;
400                         
401                 case RC_FONT_ENCODING:
402                         if (lexrc.next())
403                                 fontenc = lexrc.GetString();
404                         break;
405                         
406                 case RC_PRINTER:
407                         if (lexrc.next())
408                                 printer = lexrc.GetString();
409                         break;
410                         
411                 case RC_PRINT_COMMAND:
412                         if (lexrc.next())
413                                 print_command = lexrc.GetString();
414                         break;
415                         
416                 case RC_PRINTEVENPAGEFLAG:
417                         if (lexrc.next())
418                                 print_evenpage_flag = lexrc.GetString();
419                         break;
420                         
421                 case RC_PRINTODDPAGEFLAG:
422                         if (lexrc.next())
423                                 print_oddpage_flag = lexrc.GetString();
424                         break;
425                         
426                 case RC_PRINTPAGERANGEFLAG:
427                         if (lexrc.next())
428                                 print_pagerange_flag = lexrc.GetString();
429                         break;
430                         
431                 case RC_PRINTCOPIESFLAG:
432                         if (lexrc.next())
433                                 print_copies_flag = lexrc.GetString();
434                         break;
435                         
436                 case RC_PRINTCOLLCOPIESFLAG:
437                         if (lexrc.next())
438                                 print_collcopies_flag = lexrc.GetString();
439                         break;
440                         
441                 case RC_PRINTREVERSEFLAG:
442                         if (lexrc.next())
443                                 print_reverse_flag = lexrc.GetString();
444                         break;
445                         
446                 case RC_PRINTLANDSCAPEFLAG:
447                         if (lexrc.next())
448                                 print_landscape_flag = lexrc.GetString();
449                         break;
450                         
451                 case RC_PRINTTOPRINTER:
452                         if (lexrc.next())
453                                 print_to_printer = lexrc.GetString();
454                         break;
455                         
456                 case RC_PRINT_ADAPTOUTPUT:
457                         if (lexrc.next())
458                                 print_adapt_output = lexrc.GetBool();
459                         break;
460                         
461                 case RC_PRINTTOFILE:
462                         if (lexrc.next())
463                                 print_to_file = lexrc.GetString();
464                         break;
465                         
466                 case RC_PRINTFILEEXTENSION:
467                         if (lexrc.next())
468                                 print_file_extension = lexrc.GetString();
469                         break;
470                         
471                 case RC_PRINTEXSTRAOPTIONS:
472                         if (lexrc.next())
473                                 print_extra_options = lexrc.GetString();
474                         break;
475                         
476                 case RC_PRINTSPOOL_COMMAND:
477                         if (lexrc.next())
478                                 print_spool_command = lexrc.GetString();
479                         break;
480                         
481                 case RC_PRINTSPOOL_PRINTERPREFIX:
482                         if (lexrc.next())
483                                 print_spool_printerprefix = lexrc.GetString();
484                         break;
485                         
486                 case RC_PRINTPAPERDIMENSIONFLAG:
487                         if (lexrc.next())
488                                 print_paper_dimension_flag = lexrc.GetString();
489                         break;
490                         
491                 case RC_PRINTPAPERFLAG:
492                         if (lexrc.next())
493                                 print_paper_flag = lexrc.GetString();
494                         break;
495                         
496                 case RC_CUSTOM_EXPORT_COMMAND:
497                         if (lexrc.next())
498                                 custom_export_command = lexrc.GetString();
499                         break;
500                         
501                 case RC_CUSTOM_EXPORT_FORMAT:
502                         if (lexrc.next())
503                                 custom_export_format = lexrc.GetString();
504                         break;
505                         
506                 case RC_LATEX_COMMAND:
507                         if (lexrc.next())
508                                 latex_command = lexrc.GetString();
509                         break;
510                         
511                 case RC_LITERATE_COMMAND:
512                         if (lexrc.next())
513                                 literate_command = lexrc.GetString();
514                         break;
515                         
516                 case RC_LITERATE_EXTENSION:
517                         if (lexrc.next())
518                                 literate_extension = lexrc.GetString();
519                         break;
520                         
521                 case RC_LITERATE_ERROR_FILTER:
522                         if (lexrc.next())
523                                 literate_error_filter = lexrc.GetString();
524                         break;
525                         
526                 case RC_BUILD_COMMAND:
527                         if (lexrc.next())
528                                 build_command = lexrc.GetString();
529                         break;
530                         
531                 case RC_BUILD_ERROR_FILTER:
532                         if (lexrc.next())
533                                 build_error_filter = lexrc.GetString();
534                         break;
535                         
536                 case RC_RELYX_COMMAND:
537                         if (lexrc.next())
538                                 relyx_command = lexrc.GetString();
539                         break;
540                         
541                 case RC_DEFAULT_PAPERSIZE:
542                         if (lexrc.next()) {
543                                 string size = lowercase(lexrc.GetString());
544                                 if (size == "usletter")
545                                         default_papersize =
546                                                 BufferParams::PAPER_USLETTER;
547                                 else if (size == "legal")
548                                         default_papersize =
549                                                 BufferParams::PAPER_LEGALPAPER;
550                                 else if (size == "executive")
551                                         default_papersize =
552                                                 BufferParams::PAPER_EXECUTIVEPAPER;
553                                 else if (size == "a3")
554                                         default_papersize =
555                                                 BufferParams::PAPER_A3PAPER;
556                                 else if (size == "a4")
557                                         default_papersize =
558                                                 BufferParams::PAPER_A4PAPER;
559                                 else if (size == "a5")
560                                         default_papersize =
561                                                 BufferParams::PAPER_A5PAPER;
562                                 else if (size == "b5")
563                                         default_papersize =
564                                                 BufferParams::PAPER_B5PAPER;
565                         }
566                         break;
567                 case RC_VIEWDVI_COMMAND:
568                         if (lexrc.next())
569                                 view_dvi_command = lexrc.GetString();
570                         break;
571                         
572                 case RC_PS_COMMAND:
573                         if (lexrc.next())
574                                 ps_command = lexrc.GetString();
575                         break;
576                         
577                 case RC_VIEWPS_COMMAND:
578                         if (lexrc.next())
579                                 view_ps_command = lexrc.GetString();
580                         break;
581                         
582                 case RC_VIEWPSPIC_COMMAND:
583                         if (lexrc.next())
584                                 view_pspic_command = lexrc.GetString();
585                         break;
586                         
587                 case RC_CHKTEX_COMMAND:
588                         if (lexrc.next())
589                                 chktex_command = lexrc.GetString();
590                         break;
591                         
592                 case RC_HTML_COMMAND:
593                         if (lexrc.next())
594                                 html_command = lexrc.GetString();
595                         break;
596                         
597                 case RC_SCREEN_DPI:
598                         if (lexrc.next())
599                                 dpi = lexrc.GetInteger();
600                         break;
601                         
602                 case RC_SCREEN_ZOOM:
603                         if (lexrc.next())
604                                 zoom = lexrc.GetInteger();
605                         break;
606                         
607                 case RC_SCREEN_FONT_SIZES:
608                         if (lexrc.next())
609                                 font_sizes[LyXFont::SIZE_TINY] =
610                                         lexrc.GetFloat();
611                         if (lexrc.next())
612                                 font_sizes[LyXFont::SIZE_SCRIPT] =
613                                         lexrc.GetFloat();
614                         if (lexrc.next())
615                                 font_sizes[LyXFont::SIZE_FOOTNOTE] =
616                                         lexrc.GetFloat();
617                         if (lexrc.next())
618                                 font_sizes[LyXFont::SIZE_SMALL] =
619                                         lexrc.GetFloat();
620                         if (lexrc.next())
621                                 font_sizes[LyXFont::SIZE_NORMAL] =
622                                         lexrc.GetFloat();
623                         if (lexrc.next())
624                                 font_sizes[LyXFont::SIZE_LARGE] =
625                                         lexrc.GetFloat();
626                         if (lexrc.next())
627                                 font_sizes[LyXFont::SIZE_LARGER] =
628                                         lexrc.GetFloat();
629                         if (lexrc.next())
630                                 font_sizes[LyXFont::SIZE_LARGEST] =
631                                         lexrc.GetFloat();
632                         if (lexrc.next())
633                                 font_sizes[LyXFont::SIZE_HUGE] =
634                                         lexrc.GetFloat();
635                         if (lexrc.next())
636                                 font_sizes[LyXFont::SIZE_HUGER] =
637                                         lexrc.GetFloat();
638                         break;
639                         
640                 case RC_SCREEN_FONT_SCALABLE:
641                         if (lexrc.next())
642                                 use_scalable_fonts = lexrc.GetBool();
643                         break;
644                         
645                 case RC_AUTOSAVE:
646                         if (lexrc.next())
647                                 autosave = lexrc.GetInteger();
648                         break;
649                         
650                 case RC_SGML_EXTRA_OPTIONS:
651                         if (lexrc.next())
652                                 sgml_extra_options = lexrc.GetString();
653                         break;
654                         
655                 case RC_DOCUMENTPATH:
656                         if (lexrc.next()) {
657                                 document_path = ExpandPath(lexrc.GetString());
658                         }
659                         break;
660                         
661                 case RC_TEMPLATEPATH:
662                         if (lexrc.next())
663                                 template_path = ExpandPath(lexrc.GetString());
664                         break;
665                         
666                 case RC_TEMPDIRPATH:
667                         if (lexrc.next())
668                                 tempdir_path = ExpandPath(lexrc.GetString());
669                         break;
670                         
671                 case RC_USETEMPDIR:
672                         if (lexrc.next())
673                                 use_tempdir = lexrc.GetBool();
674                         break;
675                         
676                 case RC_LASTFILES:
677                         if (lexrc.next())
678                                 lastfiles = ExpandPath(lexrc.GetString());
679                         break;
680                         
681                 case RC_NUMLASTFILES:
682                         if (lexrc.next())
683                                 num_lastfiles = lexrc.GetInteger();
684                         break;
685                         
686                 case RC_CHECKLASTFILES:
687                         if (lexrc.next())
688                                 check_lastfiles = lexrc.GetBool();
689                         break;
690                         
691                 case RC_SCREEN_FONT_ROMAN:
692                         if (lexrc.next())
693                                 roman_font_name = lexrc.GetString();
694                         break;
695                         
696                 case RC_SCREEN_FONT_SANS:
697                         if (lexrc.next())
698                                 sans_font_name = lexrc.GetString();
699                         break;
700                         
701                 case RC_SCREEN_FONT_TYPEWRITER:
702                         if (lexrc.next())
703                                 typewriter_font_name = lexrc.GetString();
704                         break;
705                         
706                 case RC_SCREEN_FONT_MENU:
707                         if (lexrc.next())
708                                 menu_font_name = lexrc.GetString();
709                         break;
710                         
711                 case RC_SCREEN_FONT_POPUP:
712                         if (lexrc.next())
713                                 popup_font_name = lexrc.GetString();
714                         break;
715                         
716                 case RC_SCREEN_FONT_ENCODING:
717                         if (lexrc.next())
718                                 font_norm = lexrc.GetString();
719                         break;
720                         
721                 case RC_AUTOREGIONDELETE:
722                         // Auto region delete defaults to true
723                         if (lexrc.next())
724                                 auto_region_delete = lexrc.GetBool();
725                         break;
726                         
727                 case RC_BIND:
728                 {
729                         // we should not do an explicit binding before
730                         // loading a bind file. So, in this case, load
731                         // the default bind file.
732                         if (!hasBindFile)
733                                 ReadBindFile();
734                         
735                         // !!!chb, dynamic key binding...
736                         int action, res = 0;
737                         string seq, cmd;
738                         
739                         if (lexrc.lex() == LyXLex::LEX_DATA)  {
740                                 seq = lexrc.GetString();
741                         } else {
742                                 lexrc.printError("Bad key sequence: `$$Token'");
743                                 break;
744                         }
745                         
746                         if (lexrc.lex() == LyXLex::LEX_DATA) {
747                                 cmd = lexrc.GetString();
748                         } else {
749                                 lexrc.printError("Bad command: `$$Token'");
750                                 break;
751                         }
752                         
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;
759                                 }
760                                 res = bindKey(seq.c_str(), action);
761                                 if (res != 0) {
762                                         lexrc.printError(
763                                                 "Invalid key sequence `"
764                                                 + seq + '\''); 
765                                 }
766                         } else {// cmd is the last token read.
767                                 lexrc.printError(
768                                         "Unknown LyX function `$$Token'");
769                         }
770                         break;
771                 }
772                 case RC_SERVERPIPE:
773                         if (lexrc.next())
774                                 lyxpipes = ExpandPath(lexrc.GetString());
775                         break;
776                         
777                 case RC_CURSOR_FOLLOWS_SCROLLBAR:
778                         if (lexrc.next())
779                                 cursor_follows_scrollbar = lexrc.GetBool();
780                         break;
781                 case RC_FAST_SELECTION:
782                         if (lexrc.next())
783                                 fast_selection = lexrc.GetBool();
784                         break;
785                 case RC_BACKGROUND_COLOR:
786                         if (lexrc.next())
787                                 background_color = lexrc.GetString();
788                         break;
789                 case RC_SELECTION_COLOR:
790                         if (lexrc.next())
791                                 strncpy(selection_color,
792                                         lexrc.GetString().c_str(), 31);
793                         break;
794                 case RC_FAX_COMMAND:
795                         if (lexrc.next())
796                                 fax_command = lexrc.GetString();
797                         break;
798                 case RC_FAXPROGRAM:
799                         if (lexrc.next())
800                                 fax_program = lexrc.GetString();
801                         break;
802                 case RC_PHONEBOOK:
803                         if (lexrc.next()) {
804                                 string s = lexrc.GetString();
805                                 if (AbsolutePath(s))
806                                         phone_book = s;
807                                 else
808                                         phone_book = user_lyxdir + s;
809                         }
810                         break;
811                 case RC_ASCIIROFF_COMMAND:
812                         if (lexrc.next())
813                                 ascii_roff_command = lexrc.GetString();
814                         break;
815                 case RC_ASCII_LINELEN:
816                         if (lexrc.next())
817                                 ascii_linelen = lexrc.GetInteger();
818                         break;
819                         // Spellchecker settings:
820                 case RC_SPELL_COMMAND:
821                         if (lexrc.next())
822                                 isp_command = lexrc.GetString();
823                         break;
824                 case RC_ACCEPT_COMPOUND:
825                         if (lexrc.next())
826                                 isp_accept_compound = lexrc.GetBool();
827                         break;
828                 case RC_USE_INP_ENC:
829                         if (lexrc.next())
830                                 isp_use_input_encoding = lexrc.GetBool();
831                         break;
832                 case RC_USE_ALT_LANG:
833                         if (lexrc.next())
834                                 isp_use_alt_lang = lexrc.GetBool();
835                         break;
836                 case RC_USE_PERS_DICT:
837                         if (lexrc.next())
838                                 isp_use_pers_dict = lexrc.GetBool();
839                         break;
840                 case RC_USE_ESC_CHARS:
841                         if (lexrc.next())
842                                 isp_use_esc_chars = lexrc.GetBool();
843                         break;
844                 case RC_ALT_LANG:
845                         if (lexrc.next())
846                                 isp_alt_lang = lexrc.GetString();
847                         break;
848                 case RC_PERS_DICT:
849                         if (lexrc.next())
850                                 isp_pers_dict = lexrc.GetString();
851                         break;
852                 case RC_ESC_CHARS:
853                         if (lexrc.next())
854                                 isp_esc_chars = lexrc.GetString();
855                         break;
856                 case RC_LAST: break; // this is just a dummy
857                 }
858         }
859
860         return 0;
861 }
862
863
864 void LyXRC::write(string const & filename) const
865 {
866         ofstream ofs(filename.c_str());
867         if (ofs)
868                 output(ofs);
869 }
870
871
872 void LyXRC::print() const
873 {
874         if (lyxerr.debugging())
875                 output(lyxerr);
876         else
877                 output(cout);
878 }
879
880
881 void LyXRC::output(ostream & os) const
882 {
883         os << "### This file is part of\n"
884            << "### ========================================================\n"
885            << "###          LyX, The Document Processor\n"
886            << "###\n"
887            << "###          Copyright 1995 Matthias Ettrich\n"
888            << "###          Copyright 1995-1998 The LyX Team.\n"
889            << "###\n"
890            << "### ========================================================\n"
891            << "\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"
896            << "\n";
897         
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;
904         switch(tag) {
905         case RC_LAST:
906         case RC_INPUT:
907                 // input/include files are not done here
908         case RC_BIND:
909                 // bindings is not written to the preferences file.
910         case RC_BINDFILE:
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";
916         case RC_PRINTER:
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
922                    << "\"\n";
923         case RC_PRINTODDPAGEFLAG:
924                 os << "\\print_oddpage_flag \"" << print_oddpage_flag
925                    << "\"\n";
926         case RC_PRINTPAGERANGEFLAG:
927                 os << "\\print_pagerange_flag \"" << print_pagerange_flag
928                    << "\"\n";
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
933                    << "\"\n";
934         case RC_PRINTREVERSEFLAG:
935                 os << "\\print_reverse_flag \"" << print_reverse_flag
936                    << "\"\n";
937         case RC_PRINTLANDSCAPEFLAG:
938                 os << "\\print_landscape_flag \"" << print_landscape_flag
939                    << "\"\n";
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)
944                    << "\n";
945         case RC_PRINTTOFILE:
946                 os << "\\print_to_file \"" << print_to_file << "\"\n";
947         case RC_PRINTFILEEXTENSION:
948                 os << "\\print_file_extension \"" << print_file_extension
949                    << "\"\n";
950         case RC_PRINTEXSTRAOPTIONS:
951                 os << "\\print_extra_options \"" << print_extra_options
952                    << "\"\n";
953         case RC_PRINTSPOOL_COMMAND:
954                 os << "\\print_spool_command \"" << print_spool_command
955                    << "\"\n";
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
966                    << "\"\n";
967         case RC_CUSTOM_EXPORT_FORMAT:
968                 os << "\\custom_export_format \"" << custom_export_format
969                    << "\"\n";
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
976                    << "\"\n";
977         case RC_LITERATE_ERROR_FILTER:
978                 os << "\\literate_error_filter \"" << literate_error_filter
979                    << "\"\n";
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
984                    << "\"\n";
985         case RC_SCREEN_DPI:
986                 os << "\\screen_dpi " << dpi << "\n";
987         case RC_SCREEN_ZOOM:
988                 os << "\\screen_zoom " << zoom << "\n";
989         case RC_SCREEN_FONT_SIZES:
990                 os.setf(ios::fixed);
991                 os.precision(2);
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];
1003                 os << "\n";
1004         case RC_AUTOREGIONDELETE:
1005                 os << "\\auto_region_delete " << tostr(auto_region_delete)
1006                    << "\n";
1007         case RC_AUTOSAVE:
1008                 os << "\\autosave " << autosave << "\n";
1009         case RC_EXIT_CONFIRMATION:
1010                 os << "\\exit_confirmation " << tostr(exit_confirmation)
1011                    << "\n";
1012         case RC_DISPLAY_SHORTCUTS:
1013                 os << "\\display_shortcuts " << tostr(display_shortcuts)
1014                    << "\n";
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:
1027                         os << "a3"; break;
1028                 case BufferParams::PAPER_A4PAPER:
1029                         os << "a4"; break;
1030                 case BufferParams::PAPER_A5PAPER:
1031                         os << "a5"; break;
1032                 case BufferParams::PAPER_B5PAPER:
1033                         os << "b5"; break;
1034                 case BufferParams::PAPER_DEFAULT: break;
1035                 }
1036                 os << "\"\n";
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
1041                    << "\"\n";
1042         case RC_PS_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
1050                    << "\"\n";
1051         case RC_KBMAP:
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";
1057         case RC_SERVERPIPE:
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";
1067         case RC_USETEMPDIR:
1068                 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1069         case RC_LASTFILES:
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)
1090                    << "\n";
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";
1103         case RC_FAXPROGRAM:
1104                 os << "\\fax_program \"" << fax_program << "\"\n";
1105         case RC_PHONEBOOK:
1106                 os << "\\phone_book \"" << phone_book << "\"\n";
1107         case RC_ASCIIROFF_COMMAND:
1108                 os << "\\ascii_roff_command \"" << ascii_roff_command
1109                    << "\"\n";
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)
1116                    << "\n";
1117         case RC_USE_INP_ENC:
1118                 os << "\\use_input_encoding " << tostr(isp_use_input_encoding)
1119                    << "\n";
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)
1124                    << "\n";
1125         case RC_USE_ESC_CHARS:
1126                 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1127                    << "\n";
1128         case RC_ALT_LANG:
1129                 os << "\\alternate_language \"" << isp_alt_lang << "\"\n";
1130         case RC_PERS_DICT:
1131                 os << "\\personal_dictionary \"" << isp_pers_dict << "\"\n";
1132         case RC_ESC_CHARS:
1133                 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1134         }
1135         os.flush();
1136 }
1137
1138
1139 /// define the default key bindings for LyX.
1140 void LyXRC::defaultKeyBindings()
1141 {
1142         bindKey("Right",   LFUN_RIGHT);
1143         bindKey("Left",    LFUN_LEFT);
1144         bindKey("Up",      LFUN_UP);
1145         bindKey("Down",    LFUN_DOWN);
1146         
1147         bindKey("Tab",  LFUN_TAB);
1148         
1149         bindKey("Home",    LFUN_HOME);
1150         bindKey("End",     LFUN_END);
1151         bindKey("Prior",   LFUN_PRIOR);
1152         bindKey("Next",    LFUN_NEXT);
1153         
1154         bindKey("Return",  LFUN_BREAKPARAGRAPH);
1155         bindKey("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE);
1156         
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);
1180         
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);
1199         
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. */
1204         
1205         bindKey("C-Tab",  LFUN_TABINSERT);  // ale970515
1206 }