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