]> git.lyx.org Git - features.git/blob - src/lyxrc.C
a4d72f1942afa47c0ff469e74becb876b41314f5
[features.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 static keyword_item lyxrcTags[] = {
134         { "\\accept_compound", RC_ACCEPT_COMPOUND },
135         { "\\alternate_language", RC_ALT_LANG },
136         { "\\ascii_linelen", RC_ASCII_LINELEN },
137         { "\\ascii_roff_command", RC_ASCIIROFF_COMMAND },
138         { "\\auto_region_delete", RC_AUTOREGIONDELETE },
139         { "\\autosave", RC_AUTOSAVE },
140         { "\\background_color", RC_BACKGROUND_COLOR },
141         { "\\begin_toolbar", RC_BEGINTOOLBAR },
142         { "\\bind", RC_BIND },
143         { "\\bind_file", RC_BINDFILE },
144         { "\\build_command", RC_BUILD_COMMAND },
145         { "\\build_error_filter", RC_BUILD_ERROR_FILTER },
146         { "\\check_lastfiles", RC_CHECKLASTFILES },
147         { "\\chktex_command", RC_CHKTEX_COMMAND },
148         { "\\cursor_follows_scrollbar", RC_CURSOR_FOLLOWS_SCROLLBAR },
149         { "\\custom_export_command", RC_CUSTOM_EXPORT_COMMAND },
150         { "\\custom_export_format", RC_CUSTOM_EXPORT_FORMAT },
151         { "\\default_papersize", RC_DEFAULT_PAPERSIZE },
152         { "\\display_shortcuts", RC_DISPLAY_SHORTCUTS },
153         { "\\document_path", RC_DOCUMENTPATH },
154         { "\\escape_chars", RC_ESC_CHARS },
155         { "\\exit_confirmation", RC_EXIT_CONFIRMATION },
156         { "\\fast_selection", RC_FAST_SELECTION },
157         { "\\fax_command", RC_FAX_COMMAND },
158         { "\\fax_program", RC_FAXPROGRAM },
159         { "\\font_encoding", RC_FONT_ENCODING },
160         { "\\html_command", RC_HTML_COMMAND },
161         { "\\input", RC_INPUT },
162         { "\\kbmap", RC_KBMAP },
163         { "\\kbmap_primary", RC_KBMAP_PRIMARY },
164         { "\\kbmap_secondary", RC_KBMAP_SECONDARY },
165         { "\\lastfiles", RC_LASTFILES },
166         { "\\latex_command", RC_LATEX_COMMAND },
167         { "\\literate_command", RC_LITERATE_COMMAND },
168         { "\\literate_error_filter", RC_LITERATE_ERROR_FILTER },
169         { "\\literate_extension", RC_LITERATE_EXTENSION },
170         { "\\num_lastfiles", RC_NUMLASTFILES },
171         { "\\personal_dictionary", RC_PERS_DICT },
172         { "\\phone_book", RC_PHONEBOOK },
173         { "\\print_adapt_output", RC_PRINT_ADAPTOUTPUT },
174         { "\\print_collcopies_flag", RC_PRINTCOLLCOPIESFLAG },
175         { "\\print_command", RC_PRINT_COMMAND },
176         { "\\print_copies_flag", RC_PRINTCOPIESFLAG },
177         { "\\print_evenpage_flag", RC_PRINTEVENPAGEFLAG },
178         { "\\print_extra_options", RC_PRINTEXSTRAOPTIONS },
179         { "\\print_file_extension", RC_PRINTFILEEXTENSION },
180         { "\\print_landscape_flag", RC_PRINTLANDSCAPEFLAG },
181         { "\\print_oddpage_flag", RC_PRINTODDPAGEFLAG },
182         { "\\print_pagerange_flag", RC_PRINTPAGERANGEFLAG },
183         { "\\print_paper_dimension_flag", RC_PRINTPAPERDIMENSIONFLAG },
184         { "\\print_paper_flag", RC_PRINTPAPERFLAG },
185         { "\\print_reverse_flag", RC_PRINTREVERSEFLAG },
186         { "\\print_spool_command", RC_PRINTSPOOL_COMMAND },
187         { "\\print_spool_printerprefix", RC_PRINTSPOOL_PRINTERPREFIX },
188         { "\\print_to_file", RC_PRINTTOFILE },
189         { "\\print_to_printer", RC_PRINTTOPRINTER },
190         { "\\printer", RC_PRINTER },
191         { "\\ps_command", RC_PS_COMMAND },
192         { "\\relyx_command", RC_RELYX_COMMAND },
193         { "\\screen_dpi", RC_SCREEN_DPI },
194         { "\\screen_font_encoding", RC_SCREEN_FONT_ENCODING },
195         { "\\screen_font_menu", RC_SCREEN_FONT_MENU },
196         { "\\screen_font_popup", RC_SCREEN_FONT_POPUP },
197         { "\\screen_font_roman", RC_SCREEN_FONT_ROMAN },
198         { "\\screen_font_sans", RC_SCREEN_FONT_SANS },
199         { "\\screen_font_scalable", RC_SCREEN_FONT_SCALABLE },
200         { "\\screen_font_sizes", RC_SCREEN_FONT_SIZES },
201         { "\\screen_font_typewriter", RC_SCREEN_FONT_TYPEWRITER },
202         { "\\screen_zoom", RC_SCREEN_ZOOM },
203         { "\\selection_color", RC_SELECTION_COLOR },
204         { "\\serverpipe", RC_SERVERPIPE },
205         { "\\sgml_extra_options", RC_SGML_EXTRA_OPTIONS },
206         { "\\spell_command", RC_SPELL_COMMAND },
207         { "\\tempdir_path", RC_TEMPDIRPATH },
208         { "\\template_path", RC_TEMPLATEPATH },
209         { "\\use_alt_language", RC_USE_ALT_LANG },
210         { "\\use_escape_chars", RC_USE_ESC_CHARS },
211         { "\\use_input_encoding", RC_USE_INP_ENC },
212         { "\\use_personal_dictionary", RC_USE_PERS_DICT },
213         { "\\use_tempdir", RC_USETEMPDIR },
214         { "\\view_dvi_command", RC_VIEWDVI_COMMAND },
215         { "\\view_ps_command", RC_VIEWPS_COMMAND },
216         { "\\view_pspic_command", RC_VIEWPSPIC_COMMAND }
217 };
218
219 /* Let the range depend of the size of lyxrcTags.  Alejandro 240596 */
220 static const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
221
222 // Should this be moved inside LyXAction? 
223 static inline
224 int bindKey(char const * seq, int action)
225
226         return toplevel_keymap->bind(seq, action); 
227 }
228
229
230 LyXRC::LyXRC()
231 {
232         // Get printer from the environment. If fail, use default "",
233         // assuming that everything is set up correctly.
234         printer = GetEnv("PRINTER");
235         print_command = "dvips";
236         print_evenpage_flag = "-B";
237         print_oddpage_flag = "-A";
238         print_pagerange_flag = "-pp";
239         print_copies_flag = "-c";
240         print_collcopies_flag = "-C";
241         print_reverse_flag = "-r";
242         print_landscape_flag = "-t landscape";
243         print_to_printer = "-P";
244         print_to_file = "-o ";
245         print_file_extension = ".ps";
246         print_paper_flag = "-t";
247         print_paper_dimension_flag = "-T";
248         document_path = GetEnvPath("HOME");
249         tempdir_path = "/tmp";
250         use_tempdir = true;
251         latex_command = "latex";
252         literate_command = "none";
253         literate_extension = "none";
254         literate_error_filter = "cat";
255         build_command = "make";
256         build_error_filter = "cat";
257         relyx_command = "reLyX";
258         ps_command = "gs";
259         view_ps_command = "ghostview -swap";
260         view_pspic_command = "ghostview";
261         view_dvi_command = "xdvi";
262         default_papersize = BufferParams::PAPER_USLETTER;
263         custom_export_format = "ps";
264         chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
265         html_command = "tth -t";
266         fontenc = "default";
267         dpi = 75;
268         // Because a screen typically is wider than a piece of paper:
269         zoom = 150;
270         // Default LaTeX font size:
271         font_sizes[LyXFont::SIZE_TINY] = 5.0;
272         font_sizes[LyXFont::SIZE_SCRIPT] = 7.0;
273         font_sizes[LyXFont::SIZE_FOOTNOTE] = 8.0;
274         font_sizes[LyXFont::SIZE_SMALL] = 9.0;
275         font_sizes[LyXFont::SIZE_NORMAL] = 10.0;
276         font_sizes[LyXFont::SIZE_LARGE] = 12.0;
277         font_sizes[LyXFont::SIZE_LARGER] = 14.4;
278         font_sizes[LyXFont::SIZE_LARGEST] = 17.26;
279         font_sizes[LyXFont::SIZE_HUGE] = 20.74;
280         font_sizes[LyXFont::SIZE_HUGER] = 24.88;
281         use_scalable_fonts = true;
282         roman_font_name = "-*-times";
283         sans_font_name = "-*-helvetica";
284         typewriter_font_name = "-*-courier";
285         menu_font_name = "-*-helvetica-bold-r";
286         popup_font_name = "-*-helvetica-medium-r";
287         font_norm = "iso8859-1";
288         autosave = 300;
289         auto_region_delete = true;
290         ascii_linelen = 75;
291         num_lastfiles = 4;
292         check_lastfiles = true;
293         exit_confirmation = true;
294         display_shortcuts = true;
295         // Spellchecker settings:
296         isp_command = "ispell";
297         isp_accept_compound = false;
298         isp_use_input_encoding = false;
299         isp_use_alt_lang = false;
300         isp_use_pers_dict = false;
301         isp_use_esc_chars = false;
302         use_kbmap = false;
303         hasBindFile = false;
304         defaultKeyBindings();
305 }
306
307
308 int LyXRC::ReadBindFile(string const & name)
309 {
310         hasBindFile = true;
311         string tmp = i18nLibFileSearch("bind", name, "bind");
312         lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl;
313         int result = read(tmp);
314         if (result) {
315                 lyxerr << "Error reading bind file: " << tmp << endl;
316         }
317         return result;
318 }
319
320 int LyXRC::read(string const & filename)
321 {
322         // Default bindfile.
323         string bindFile = "cua";
324         
325         LyXLex lexrc(lyxrcTags, lyxrcCount);
326         if (lyxerr.debugging(Debug::PARSER))
327                 lexrc.printTable();
328         
329         lexrc.setFile(filename);
330         if (!lexrc.IsOK()) return -2;
331         
332         lyxerr[Debug::INIT] << "Reading '" << filename << "'..." << endl;
333         
334         while (lexrc.IsOK()) {
335                 // By using two switches we take advantage of the compiler
336                 // telling us if we have missed a LyXRCTags element in
337                 // the second switch.
338                 // Note that this also shows a problem with LyXLex since it
339                 // helps us avoid taking advantage of the strictness of the
340                 // compiler.
341
342                 int le = lexrc.lex();
343                 switch(le) {
344                 case LyXLex::LEX_UNDEF:
345                         lexrc.printError("Unknown tag `$$Token'");
346                         continue; 
347                 case LyXLex::LEX_FEOF:
348                         continue; 
349                 default: break;
350                 }
351                 switch (static_cast<LyXRCTags>(le)) {
352                 case RC_INPUT: // Include file
353                         if (lexrc.next()) {
354                                 string tmp = LibFileSearch(string(),
355                                                            lexrc.GetString()); 
356                                 if (read(tmp)) {
357                                         lexrc.printError("Error reading "
358                                                          "included file: "+tmp);
359                                 }
360                         }
361                         break;
362                 case RC_BINDFILE:                     // RVDK_PATCH_5
363                         if (lexrc.next()) {
364                                 ReadBindFile(lexrc.GetString());
365                         }
366                         break;
367                         
368                 case RC_BEGINTOOLBAR:
369                         // this toolbar should be changed to be a completely
370                         // non gui toolbar. (Lgb)
371                         toolbar.read(lexrc);
372                         break;
373                         
374                 case RC_KBMAP:
375                         if (lexrc.next())
376                                 use_kbmap = lexrc.GetBool();
377                         break;
378                         
379                 case RC_EXIT_CONFIRMATION:
380                         if (lexrc.next())
381                                 exit_confirmation = lexrc.GetBool();
382                         break;
383                         
384                 case RC_DISPLAY_SHORTCUTS:
385                         if (lexrc.next())
386                                 display_shortcuts = lexrc.GetBool();
387                         break;
388                         
389                 case RC_KBMAP_PRIMARY:
390                         if (lexrc.next())
391                                 primary_kbmap = lexrc.GetString();
392                         break;
393                         
394                 case RC_KBMAP_SECONDARY:
395                         if (lexrc.next())
396                                 secondary_kbmap = lexrc.GetString();
397                         break;
398                         
399                 case RC_FONT_ENCODING:
400                         if (lexrc.next())
401                                 fontenc = lexrc.GetString();
402                         break;
403                         
404                 case RC_PRINTER:
405                         if (lexrc.next())
406                                 printer = lexrc.GetString();
407                         break;
408                         
409                 case RC_PRINT_COMMAND:
410                         if (lexrc.next())
411                                 print_command = lexrc.GetString();
412                         break;
413                         
414                 case RC_PRINTEVENPAGEFLAG:
415                         if (lexrc.next())
416                                 print_evenpage_flag = lexrc.GetString();
417                         break;
418                         
419                 case RC_PRINTODDPAGEFLAG:
420                         if (lexrc.next())
421                                 print_oddpage_flag = lexrc.GetString();
422                         break;
423                         
424                 case RC_PRINTPAGERANGEFLAG:
425                         if (lexrc.next())
426                                 print_pagerange_flag = lexrc.GetString();
427                         break;
428                         
429                 case RC_PRINTCOPIESFLAG:
430                         if (lexrc.next())
431                                 print_copies_flag = lexrc.GetString();
432                         break;
433                         
434                 case RC_PRINTCOLLCOPIESFLAG:
435                         if (lexrc.next())
436                                 print_collcopies_flag = lexrc.GetString();
437                         break;
438                         
439                 case RC_PRINTREVERSEFLAG:
440                         if (lexrc.next())
441                                 print_reverse_flag = lexrc.GetString();
442                         break;
443                         
444                 case RC_PRINTLANDSCAPEFLAG:
445                         if (lexrc.next())
446                                 print_landscape_flag = lexrc.GetString();
447                         break;
448                         
449                 case RC_PRINTTOPRINTER:
450                         if (lexrc.next())
451                                 print_to_printer = lexrc.GetString();
452                         break;
453                         
454                 case RC_PRINT_ADAPTOUTPUT:
455                         if (lexrc.next())
456                                 print_adapt_output = lexrc.GetBool();
457                         break;
458                         
459                 case RC_PRINTTOFILE:
460                         if (lexrc.next())
461                                 print_to_file = lexrc.GetString();
462                         break;
463                         
464                 case RC_PRINTFILEEXTENSION:
465                         if (lexrc.next())
466                                 print_file_extension = lexrc.GetString();
467                         break;
468                         
469                 case RC_PRINTEXSTRAOPTIONS:
470                         if (lexrc.next())
471                                 print_extra_options = lexrc.GetString();
472                         break;
473                         
474                 case RC_PRINTSPOOL_COMMAND:
475                         if (lexrc.next())
476                                 print_spool_command = lexrc.GetString();
477                         break;
478                         
479                 case RC_PRINTSPOOL_PRINTERPREFIX:
480                         if (lexrc.next())
481                                 print_spool_printerprefix = lexrc.GetString();
482                         break;
483                         
484                 case RC_PRINTPAPERDIMENSIONFLAG:
485                         if (lexrc.next())
486                                 print_paper_dimension_flag = lexrc.GetString();
487                         break;
488                         
489                 case RC_PRINTPAPERFLAG:
490                         if (lexrc.next())
491                                 print_paper_flag = lexrc.GetString();
492                         break;
493                         
494                 case RC_CUSTOM_EXPORT_COMMAND:
495                         if (lexrc.next())
496                                 custom_export_command = lexrc.GetString();
497                         break;
498                         
499                 case RC_CUSTOM_EXPORT_FORMAT:
500                         if (lexrc.next())
501                                 custom_export_format = lexrc.GetString();
502                         break;
503                         
504                 case RC_LATEX_COMMAND:
505                         if (lexrc.next())
506                                 latex_command = lexrc.GetString();
507                         break;
508                         
509                 case RC_LITERATE_COMMAND:
510                         if (lexrc.next())
511                                 literate_command = lexrc.GetString();
512                         break;
513                         
514                 case RC_LITERATE_EXTENSION:
515                         if (lexrc.next())
516                                 literate_extension = lexrc.GetString();
517                         break;
518                         
519                 case RC_LITERATE_ERROR_FILTER:
520                         if (lexrc.next())
521                                 literate_error_filter = lexrc.GetString();
522                         break;
523                         
524                 case RC_BUILD_COMMAND:
525                         if (lexrc.next())
526                                 build_command = lexrc.GetString();
527                         break;
528                         
529                 case RC_BUILD_ERROR_FILTER:
530                         if (lexrc.next())
531                                 build_error_filter = lexrc.GetString();
532                         break;
533                         
534                 case RC_RELYX_COMMAND:
535                         if (lexrc.next())
536                                 relyx_command = lexrc.GetString();
537                         break;
538                         
539                 case RC_DEFAULT_PAPERSIZE:
540                         if (lexrc.next()) {
541                                 string size = lowercase(lexrc.GetString());
542                                 if (size == "usletter")
543                                         default_papersize =
544                                                 BufferParams::PAPER_USLETTER;
545                                 else if (size == "legal")
546                                         default_papersize =
547                                                 BufferParams::PAPER_LEGALPAPER;
548                                 else if (size == "executive")
549                                         default_papersize =
550                                             BufferParams::PAPER_EXECUTIVEPAPER;
551                                 else if (size == "a3")
552                                         default_papersize =
553                                                 BufferParams::PAPER_A3PAPER;
554                                 else if (size == "a4")
555                                         default_papersize =
556                                                 BufferParams::PAPER_A4PAPER;
557                                 else if (size == "a5")
558                                         default_papersize =
559                                                 BufferParams::PAPER_A5PAPER;
560                                 else if (size == "b5")
561                                         default_papersize =
562                                                 BufferParams::PAPER_B5PAPER;
563                         }
564                         break;
565                 case RC_VIEWDVI_COMMAND:
566                         if (lexrc.next())
567                                 view_dvi_command = lexrc.GetString();
568                         break;
569                         
570                 case RC_PS_COMMAND:
571                         if (lexrc.next())
572                                 ps_command = lexrc.GetString();
573                         break;
574                         
575                 case RC_VIEWPS_COMMAND:
576                         if (lexrc.next())
577                                 view_ps_command = lexrc.GetString();
578                         break;
579                         
580                 case RC_VIEWPSPIC_COMMAND:
581                         if (lexrc.next())
582                                 view_pspic_command = lexrc.GetString();
583                         break;
584                         
585                 case RC_CHKTEX_COMMAND:
586                         if (lexrc.next())
587                                 chktex_command = lexrc.GetString();
588                         break;
589                         
590                 case RC_HTML_COMMAND:
591                         if (lexrc.next())
592                                 html_command = lexrc.GetString();
593                         break;
594                         
595                 case RC_SCREEN_DPI:
596                         if (lexrc.next())
597                                 dpi = lexrc.GetInteger();
598                         break;
599                         
600                 case RC_SCREEN_ZOOM:
601                         if (lexrc.next())
602                                 zoom = lexrc.GetInteger();
603                         break;
604                         
605                 case RC_SCREEN_FONT_SIZES:
606                         if (lexrc.next())
607                                 font_sizes[LyXFont::SIZE_TINY] =
608                                         lexrc.GetFloat();
609                         if (lexrc.next())
610                                 font_sizes[LyXFont::SIZE_SCRIPT] =
611                                         lexrc.GetFloat();
612                         if (lexrc.next())
613                                 font_sizes[LyXFont::SIZE_FOOTNOTE] =
614                                         lexrc.GetFloat();
615                         if (lexrc.next())
616                                 font_sizes[LyXFont::SIZE_SMALL] =
617                                         lexrc.GetFloat();
618                         if (lexrc.next())
619                                 font_sizes[LyXFont::SIZE_NORMAL] =
620                                         lexrc.GetFloat();
621                         if (lexrc.next())
622                                 font_sizes[LyXFont::SIZE_LARGE] =
623                                         lexrc.GetFloat();
624                         if (lexrc.next())
625                                 font_sizes[LyXFont::SIZE_LARGER] =
626                                         lexrc.GetFloat();
627                         if (lexrc.next())
628                                 font_sizes[LyXFont::SIZE_LARGEST] =
629                                         lexrc.GetFloat();
630                         if (lexrc.next())
631                                 font_sizes[LyXFont::SIZE_HUGE] =
632                                         lexrc.GetFloat();
633                         if (lexrc.next())
634                                 font_sizes[LyXFont::SIZE_HUGER] =
635                                         lexrc.GetFloat();
636                         break;
637                         
638                 case RC_SCREEN_FONT_SCALABLE:
639                         if (lexrc.next())
640                                 use_scalable_fonts = lexrc.GetBool();
641                         break;
642                         
643                 case RC_AUTOSAVE:
644                         if (lexrc.next())
645                                 autosave = lexrc.GetInteger();
646                         break;
647                         
648                 case RC_SGML_EXTRA_OPTIONS:
649                         if (lexrc.next())
650                                 sgml_extra_options = lexrc.GetString();
651                         break;
652                         
653                 case RC_DOCUMENTPATH:
654                         if (lexrc.next()) {
655                                 document_path = ExpandPath(lexrc.GetString());
656                         }
657                         break;
658                         
659                 case RC_TEMPLATEPATH:
660                         if (lexrc.next())
661                                 template_path = ExpandPath(lexrc.GetString());
662                         break;
663                         
664                 case RC_TEMPDIRPATH:
665                         if (lexrc.next())
666                                 tempdir_path = ExpandPath(lexrc.GetString());
667                         break;
668                         
669                 case RC_USETEMPDIR:
670                         if (lexrc.next())
671                                 use_tempdir = lexrc.GetBool();
672                         break;
673                         
674                 case RC_LASTFILES:
675                         if (lexrc.next())
676                                 lastfiles = ExpandPath(lexrc.GetString());
677                         break;
678                         
679                 case RC_NUMLASTFILES:
680                         if (lexrc.next())
681                                 num_lastfiles = lexrc.GetInteger();
682                         break;
683                         
684                 case RC_CHECKLASTFILES:
685                         if (lexrc.next())
686                                 check_lastfiles = lexrc.GetBool();
687                         break;
688                         
689                 case RC_SCREEN_FONT_ROMAN:
690                         if (lexrc.next())
691                                 roman_font_name = lexrc.GetString();
692                         break;
693                         
694                 case RC_SCREEN_FONT_SANS:
695                         if (lexrc.next())
696                                 sans_font_name = lexrc.GetString();
697                         break;
698                         
699                 case RC_SCREEN_FONT_TYPEWRITER:
700                         if (lexrc.next())
701                                 typewriter_font_name = lexrc.GetString();
702                         break;
703                         
704                 case RC_SCREEN_FONT_MENU:
705                         if (lexrc.next())
706                                 menu_font_name = lexrc.GetString();
707                         break;
708                         
709                 case RC_SCREEN_FONT_POPUP:
710                         if (lexrc.next())
711                                 popup_font_name = lexrc.GetString();
712                         break;
713                         
714                 case RC_SCREEN_FONT_ENCODING:
715                         if (lexrc.next())
716                                 font_norm = lexrc.GetString();
717                         break;
718                         
719                 case RC_AUTOREGIONDELETE:
720                         // Auto region delete defaults to true
721                         if (lexrc.next())
722                                 auto_region_delete = lexrc.GetBool();
723                         break;
724                         
725                 case RC_BIND:
726                 {
727                         // we should not do an explicit binding before
728                         // loading a bind file. So, in this case, load
729                         // the default bind file.
730                         if (!hasBindFile)
731                                 ReadBindFile();
732                         
733                         // !!!chb, dynamic key binding...
734                         int action, res = 0;
735                         string seq, cmd;
736                         
737                         if (lexrc.lex() == LyXLex::LEX_DATA)  {
738                                 seq = lexrc.GetString();
739                         } else {
740                                 lexrc.printError("Bad key sequence: `$$Token'");
741                                 break;
742                         }
743                         
744                         if (lexrc.lex() == LyXLex::LEX_DATA) {
745                                 cmd = lexrc.GetString();
746                         } else {
747                                 lexrc.printError("Bad command: `$$Token'");
748                                 break;
749                         }
750                         
751                         if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) {
752                                 if (lyxerr.debugging(Debug::KEY)) {
753                                         lyxerr << "RC_BIND: Sequence `"
754                                                << seq << "' Command `"
755                                                << cmd << "' Action `"
756                                                << action << '\'' << endl;
757                                 }
758                                 res = bindKey(seq.c_str(), action);
759                                 if (res != 0) {
760                                         lexrc.printError(
761                                                 "Invalid key sequence `"
762                                                 + seq + '\''); 
763                                 }
764                         } else {// cmd is the last token read.
765                                 lexrc.printError(
766                                         "Unknown LyX function `$$Token'");
767                         }
768                         break;
769                 }
770                 case RC_SERVERPIPE:
771                         if (lexrc.next())
772                                 lyxpipes = ExpandPath(lexrc.GetString());
773                         break;
774                         
775                 case RC_CURSOR_FOLLOWS_SCROLLBAR:
776                         if (lexrc.next())
777                                 cursor_follows_scrollbar = lexrc.GetBool();
778                         break;
779                 case RC_FAST_SELECTION:
780                         if (lexrc.next())
781                                 fast_selection = lexrc.GetBool();
782                         break;
783                 case RC_BACKGROUND_COLOR:
784                         if (lexrc.next())
785                                 background_color = lexrc.GetString();
786                         break;
787                 case RC_SELECTION_COLOR:
788                         if (lexrc.next())
789                                 strncpy(selection_color,
790                                         lexrc.GetString().c_str(), 31);
791                         break;
792                 case RC_FAX_COMMAND:
793                         if (lexrc.next())
794                                 fax_command = lexrc.GetString();
795                         break;
796                 case RC_FAXPROGRAM:
797                         if (lexrc.next())
798                                 fax_program = lexrc.GetString();
799                         break;
800                 case RC_PHONEBOOK:
801                         if (lexrc.next()) {
802                                 string s = lexrc.GetString();
803                                 if (AbsolutePath(s))
804                                         phone_book = s;
805                                 else
806                                         phone_book = user_lyxdir + s;
807                         }
808                         break;
809                 case RC_ASCIIROFF_COMMAND:
810                         if (lexrc.next())
811                                 ascii_roff_command = lexrc.GetString();
812                         break;
813                 case RC_ASCII_LINELEN:
814                         if (lexrc.next())
815                                 ascii_linelen = lexrc.GetInteger();
816                         break;
817                         // Spellchecker settings:
818                 case RC_SPELL_COMMAND:
819                         if (lexrc.next())
820                                 isp_command = lexrc.GetString();
821                         break;
822                 case RC_ACCEPT_COMPOUND:
823                         if (lexrc.next())
824                                 isp_accept_compound = lexrc.GetBool();
825                         break;
826                 case RC_USE_INP_ENC:
827                         if (lexrc.next())
828                                 isp_use_input_encoding = lexrc.GetBool();
829                         break;
830                 case RC_USE_ALT_LANG:
831                         if (lexrc.next())
832                                 isp_use_alt_lang = lexrc.GetBool();
833                         break;
834                 case RC_USE_PERS_DICT:
835                         if (lexrc.next())
836                                 isp_use_pers_dict = lexrc.GetBool();
837                         break;
838                 case RC_USE_ESC_CHARS:
839                         if (lexrc.next())
840                                 isp_use_esc_chars = lexrc.GetBool();
841                         break;
842                 case RC_ALT_LANG:
843                         if (lexrc.next())
844                                 isp_alt_lang = lexrc.GetString();
845                         break;
846                 case RC_PERS_DICT:
847                         if (lexrc.next())
848                                 isp_pers_dict = lexrc.GetString();
849                         break;
850                 case RC_ESC_CHARS:
851                         if (lexrc.next())
852                                 isp_esc_chars = lexrc.GetString();
853                         break;
854                 case RC_LAST: break; // this is just a dummy
855                 }
856         }
857
858         return 0;
859 }
860
861
862 void LyXRC::write(string const & filename) const
863 {
864         ofstream ofs(filename.c_str());
865         if (ofs)
866                 output(ofs);
867 }
868
869
870 void LyXRC::print() const
871 {
872         if (lyxerr.debugging())
873                 output(lyxerr);
874         else
875                 output(cout);
876 }
877
878
879 void LyXRC::output(ostream & os) const
880 {
881         os << "### This file is part of\n"
882            << "### ========================================================\n"
883            << "###          LyX, The Document Processor\n"
884            << "###\n"
885            << "###          Copyright 1995 Matthias Ettrich\n"
886            << "###          Copyright 1995-1998 The LyX Team.\n"
887            << "###\n"
888            << "### ========================================================\n"
889            << "\n"
890            << "# This file is written by LyX, if you want to make your own\n"
891            << "# modifications you should do them from inside LyX and save\n"
892            << "# your preferences, or you can also make your modifications\n"
893            << "# to lyxrc by hand. It is not advisable to edit this file.\n"
894            << "\n";
895         
896         // Why the switch you might ask. It is a trick to ensure that all
897         // the elements in the LyXRCTags enum is handled. As you can see
898         // there are no breaks at all. So it is just a huge fall-through.
899         // The nice thing is that we will get a warning from the compiler
900         // if we forget an element.
901         LyXRCTags tag = RC_LAST;
902         switch(tag) {
903         case RC_LAST:
904         case RC_INPUT:
905                 // input/include files are not done here
906         case RC_BIND:
907                 // bindings is not written to the preferences file.
908         case RC_BINDFILE:
909                 // bind files are not done here.
910         case RC_BEGINTOOLBAR:
911                 // Toolbar is not written here (yet).
912         case RC_FONT_ENCODING:
913                 os << "\\font_encoding \"" << fontenc << "\"\n";
914         case RC_PRINTER:
915                 os << "\\printer \"" << printer << "\"\n";
916         case RC_PRINT_COMMAND:
917                 os << "\\print_command \"" << print_command << "\"\n";
918         case RC_PRINTEVENPAGEFLAG:
919                 os << "\\print_evenpage_flag \"" << print_evenpage_flag
920                    << "\"\n";
921         case RC_PRINTODDPAGEFLAG:
922                 os << "\\print_oddpage_flag \"" << print_oddpage_flag
923                    << "\"\n";
924         case RC_PRINTPAGERANGEFLAG:
925                 os << "\\print_pagerange_flag \"" << print_pagerange_flag
926                    << "\"\n";
927         case RC_PRINTCOPIESFLAG:
928                 os << "\\print_copies_flag \"" << print_copies_flag << "\"\n";
929         case RC_PRINTCOLLCOPIESFLAG:
930                 os << "\\print_collcopies_flag \"" << print_collcopies_flag
931                    << "\"\n";
932         case RC_PRINTREVERSEFLAG:
933                 os << "\\print_reverse_flag \"" << print_reverse_flag
934                    << "\"\n";
935         case RC_PRINTLANDSCAPEFLAG:
936                 os << "\\print_landscape_flag \"" << print_landscape_flag
937                    << "\"\n";
938         case RC_PRINTTOPRINTER:
939                 os << "\\print_to_printer \"" << print_to_printer << "\"\n";
940         case RC_PRINT_ADAPTOUTPUT:
941                 os << "\\print_adapt_output " << tostr(print_adapt_output)
942                    << "\n";
943         case RC_PRINTTOFILE:
944                 os << "\\print_to_file \"" << print_to_file << "\"\n";
945         case RC_PRINTFILEEXTENSION:
946                 os << "\\print_file_extension \"" << print_file_extension
947                    << "\"\n";
948         case RC_PRINTEXSTRAOPTIONS:
949                 os << "\\print_extra_options \"" << print_extra_options
950                    << "\"\n";
951         case RC_PRINTSPOOL_COMMAND:
952                 os << "\\print_spool_command \"" << print_spool_command
953                    << "\"\n";
954         case RC_PRINTSPOOL_PRINTERPREFIX:
955                 os << "\\print_spool_printerprefix \""
956                    << print_spool_printerprefix << "\"\n";
957         case RC_PRINTPAPERDIMENSIONFLAG:
958                 os << "\\print_paper_dimension_flag \""
959                    << print_paper_dimension_flag << "\"\n";
960         case RC_PRINTPAPERFLAG:
961                 os << "\\print_paper_flag \"" << print_paper_flag << "\"\n";
962         case RC_CUSTOM_EXPORT_COMMAND:
963                 os << "\\custom_export_command \"" << custom_export_command
964                    << "\"\n";
965         case RC_CUSTOM_EXPORT_FORMAT:
966                 os << "\\custom_export_format \"" << custom_export_format
967                    << "\"\n";
968         case RC_LATEX_COMMAND:
969                 os << "\\latex_command \"" << latex_command << "\"\n";
970         case RC_LITERATE_COMMAND:
971                 os << "\\literate_command \"" << literate_command << "\"\n";
972         case RC_LITERATE_EXTENSION:
973                 os << "\\literate_extension \"" << literate_extension
974                    << "\"\n";
975         case RC_LITERATE_ERROR_FILTER:
976                 os << "\\literate_error_filter \"" << literate_error_filter
977                    << "\"\n";
978         case RC_BUILD_COMMAND:
979                 os << "\\build_command \"" << build_command << "\"\n";
980         case RC_BUILD_ERROR_FILTER:
981                 os << "\\build_error_filter \"" << build_error_filter
982                    << "\"\n";
983         case RC_SCREEN_DPI:
984                 os << "\\screen_dpi " << dpi << "\n";
985         case RC_SCREEN_ZOOM:
986                 os << "\\screen_zoom " << zoom << "\n";
987         case RC_SCREEN_FONT_SIZES:
988                 os.setf(ios::fixed);
989                 os.precision(2);
990                 os << "\\screen_font_sizes";
991                 os << " " << font_sizes[LyXFont::SIZE_TINY];
992                 os << " " << font_sizes[LyXFont::SIZE_SCRIPT];
993                 os << " " << font_sizes[LyXFont::SIZE_FOOTNOTE];
994                 os << " " << font_sizes[LyXFont::SIZE_SMALL];
995                 os << " " << font_sizes[LyXFont::SIZE_NORMAL];
996                 os << " " << font_sizes[LyXFont::SIZE_LARGE];
997                 os << " " << font_sizes[LyXFont::SIZE_LARGER];
998                 os << " " << font_sizes[LyXFont::SIZE_LARGEST];
999                 os << " " << font_sizes[LyXFont::SIZE_HUGE];
1000                 os << " " << font_sizes[LyXFont::SIZE_HUGER];
1001                 os << "\n";
1002         case RC_AUTOREGIONDELETE:
1003                 os << "\\auto_region_delete " << tostr(auto_region_delete)
1004                    << "\n";
1005         case RC_AUTOSAVE:
1006                 os << "\\autosave " << autosave << "\n";
1007         case RC_EXIT_CONFIRMATION:
1008                 os << "\\exit_confirmation " << tostr(exit_confirmation)
1009                    << "\n";
1010         case RC_DISPLAY_SHORTCUTS:
1011                 os << "\\display_shortcuts " << tostr(display_shortcuts)
1012                    << "\n";
1013         case RC_VIEWDVI_COMMAND:
1014                 os << "\\view_dvi_command \"" << view_dvi_command << "\"\n";
1015         case RC_DEFAULT_PAPERSIZE:
1016                 os << "\\default_papersize \"";
1017                 switch (default_papersize) {
1018                 case BufferParams::PAPER_USLETTER:
1019                         os << "usletter"; break;
1020                 case BufferParams::PAPER_LEGALPAPER:
1021                         os << "legal"; break;
1022                 case BufferParams::PAPER_EXECUTIVEPAPER:
1023                         os << "executive"; break;
1024                 case BufferParams::PAPER_A3PAPER:
1025                         os << "a3"; break;
1026                 case BufferParams::PAPER_A4PAPER:
1027                         os << "a4"; break;
1028                 case BufferParams::PAPER_A5PAPER:
1029                         os << "a5"; break;
1030                 case BufferParams::PAPER_B5PAPER:
1031                         os << "b5"; break;
1032                 case BufferParams::PAPER_DEFAULT: break;
1033                 }
1034                 os << "\"\n";
1035         case RC_VIEWPS_COMMAND:
1036                 os << "\\view_ps_command \"" << view_ps_command << "\"\n";
1037         case RC_VIEWPSPIC_COMMAND:
1038                 os << "\\view_pspic_command \"" << view_pspic_command
1039                    << "\"\n";
1040         case RC_PS_COMMAND:
1041                 os << "\\ps_command \"" << ps_command << "\"\n";
1042         case RC_CHKTEX_COMMAND:
1043                 os << "\\chktex_command \"" << chktex_command << "\"\n";
1044         case RC_HTML_COMMAND:
1045                 os << "\\html_command \"" << html_command << "\"\n";
1046         case RC_SGML_EXTRA_OPTIONS:
1047                 os << "\\sgml_extra_options \"" << sgml_extra_options
1048                    << "\"\n";
1049         case RC_KBMAP:
1050                 os << "\\kbmap " << tostr(use_kbmap) << "\n";
1051         case RC_KBMAP_PRIMARY:
1052                 os << "\\kbmap_primary \"" << primary_kbmap << "\"\n";
1053         case RC_KBMAP_SECONDARY:
1054                 os << "\\kbmap_secondary \"" << secondary_kbmap << "\"\n";
1055         case RC_SERVERPIPE:
1056                 os << "\\serverpipe \"" << lyxpipes << "\"\n";
1057         case RC_RELYX_COMMAND:
1058                 os << "\\relyx_command \"" << relyx_command << "\"\n";
1059         case RC_DOCUMENTPATH:
1060                 os << "\\document_path \"" << document_path << "\"\n";
1061         case RC_TEMPLATEPATH:
1062                 os << "\\template_path \"" << template_path << "\"\n";
1063         case RC_TEMPDIRPATH:
1064                 os << "\\tempdir_path \"" << tempdir_path << "\"\n";
1065         case RC_USETEMPDIR:
1066                 os << "\\use_tempdir " << tostr(use_tempdir) << "\n";
1067         case RC_LASTFILES:
1068                 os << "\\lastfiles \"" << lastfiles << "\"\n";
1069         case RC_NUMLASTFILES:
1070                 os << "\\num_lastfiles " << num_lastfiles << "\n";
1071         case RC_CHECKLASTFILES:
1072                 os << "\\check_lastfiles " << tostr(check_lastfiles) << "\n";
1073         case RC_SCREEN_FONT_ROMAN:
1074                 os << "\\screen_font_roman \"" << roman_font_name << "\"\n";
1075         case RC_SCREEN_FONT_SANS:
1076                 os << "\\screen_font_sans \"" << sans_font_name << "\"\n";
1077         case RC_SCREEN_FONT_TYPEWRITER:
1078                 os << "\\screen_font_typewriter \""
1079                    << typewriter_font_name << "\"\n";
1080         case RC_SCREEN_FONT_MENU:
1081                 os << "\\screen_font_menu \"" << menu_font_name << "\"\n";
1082         case RC_SCREEN_FONT_POPUP:
1083                 os << "\\screen_font_popup \"" << popup_font_name << "\"\n";
1084         case RC_SCREEN_FONT_ENCODING:
1085                 os << "\\screen_font_encoding \"" << font_norm << "\"\n";
1086         case RC_SCREEN_FONT_SCALABLE:
1087                 os << "\\screen_font_scalable " << tostr(use_scalable_fonts)
1088                    << "\n";
1089         case RC_CURSOR_FOLLOWS_SCROLLBAR:
1090                 os << "\\cursor_follows_scrollbar "
1091                    << tostr(cursor_follows_scrollbar) << "\n";
1092         case RC_FAST_SELECTION:
1093                 os << "\\fast_selection "
1094                    << tostr(static_cast<bool>(fast_selection)) << "\n";
1095         case RC_BACKGROUND_COLOR:
1096                 os << "\\background_color \"" << background_color << "\"\n";
1097         case RC_SELECTION_COLOR:
1098                 os << "\\selection_color \"" << selection_color << "\"\n";
1099         case RC_FAX_COMMAND:
1100                 os << "\\fax_command \"" << fax_command << "\"\n";
1101         case RC_FAXPROGRAM:
1102                 os << "\\fax_program \"" << fax_program << "\"\n";
1103         case RC_PHONEBOOK:
1104                 os << "\\phone_book \"" << phone_book << "\"\n";
1105         case RC_ASCIIROFF_COMMAND:
1106                 os << "\\ascii_roff_command \"" << ascii_roff_command
1107                    << "\"\n";
1108         case RC_ASCII_LINELEN:
1109                 os << "\\ascii_linelen " << ascii_linelen << "\n";
1110         case RC_SPELL_COMMAND:
1111                 os << "\\spell_command \"" << isp_command << "\"\n";
1112         case RC_ACCEPT_COMPOUND:
1113                 os << "\\accept_compound " << tostr(isp_accept_compound)
1114                    << "\n";
1115         case RC_USE_INP_ENC:
1116                 os << "\\use_input_encoding " << tostr(isp_use_input_encoding)
1117                    << "\n";
1118         case RC_USE_ALT_LANG:
1119                 os << "\\use_alt_language " << tostr(isp_use_alt_lang) << "\n";
1120         case RC_USE_PERS_DICT:
1121                 os << "\\use_personal_dictionary " << tostr(isp_use_pers_dict)
1122                    << "\n";
1123         case RC_USE_ESC_CHARS:
1124                 os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
1125                    << "\n";
1126         case RC_ALT_LANG:
1127                 os << "\\alternate_language \"" << isp_alt_lang << "\"\n";
1128         case RC_PERS_DICT:
1129                 os << "\\personal_dictionary \"" << isp_pers_dict << "\"\n";
1130         case RC_ESC_CHARS:
1131                 os << "\\escape_chars \"" << isp_esc_chars << "\"\n";
1132         }
1133         os.flush();
1134 }
1135
1136
1137 /// define the default key bindings for LyX.
1138 void LyXRC::defaultKeyBindings()
1139 {
1140         bindKey("Right",   LFUN_RIGHT);
1141         bindKey("Left",    LFUN_LEFT);
1142         bindKey("Up",      LFUN_UP);
1143         bindKey("Down",    LFUN_DOWN);
1144         
1145         bindKey("Tab",  LFUN_TAB);
1146         
1147         bindKey("Home",    LFUN_HOME);
1148         bindKey("End",     LFUN_END);
1149         bindKey("Prior",   LFUN_PRIOR);
1150         bindKey("Next",    LFUN_NEXT);
1151         
1152         bindKey("Return",  LFUN_BREAKPARAGRAPH);
1153         bindKey("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE);
1154         
1155         bindKey("Delete",  LFUN_DELETE);
1156         bindKey("BackSpace",    LFUN_BACKSPACE);
1157         // bindKeyings for transparent handling of deadkeys
1158         // The keysyms are gotten from XFree86 X11R6
1159         bindKey("~C-~S-~M-dead_acute",           LFUN_ACUTE);
1160         bindKey("~C-~S-~M-dead_breve",           LFUN_BREVE);
1161         bindKey("~C-~S-~M-dead_caron",           LFUN_CARON);
1162         bindKey("~C-~S-~M-dead_cedilla",         LFUN_CEDILLA);
1163         bindKey("~C-~S-~M-dead_abovering",          LFUN_CIRCLE);
1164         bindKey("~C-~S-~M-dead_circumflex",      LFUN_CIRCUMFLEX);
1165         bindKey("~C-~S-~M-dead_abovedot",             LFUN_DOT);
1166         bindKey("~C-~S-~M-dead_grave",           LFUN_GRAVE);
1167         bindKey("~C-~S-~M-dead_doubleacute",     LFUN_HUNG_UMLAUT);
1168         bindKey("~C-~S-~M-dead_macron",          LFUN_MACRON);
1169         // nothing with this name
1170         // bindKey("~C-~S-~M-dead_special_caron",   LFUN_SPECIAL_CARON);
1171         bindKey("~C-~S-~M-dead_tilde",           LFUN_TILDE);
1172         bindKey("~C-~S-~M-dead_diaeresis",       LFUN_UMLAUT);
1173         // nothing with this name either...
1174         //bindKey("~C-~S-~M-dead_underbar",        LFUN_UNDERBAR);
1175         bindKey("~C-~S-~M-dead_belowdot",        LFUN_UNDERDOT);
1176         bindKey("~C-~S-~M-dead_tie",             LFUN_TIE);
1177         bindKey("~C-~S-~M-dead_ogonek",           LFUN_OGONEK);
1178         
1179         // bindings to utilize the use of the numeric keypad
1180         // e.g. Num Lock set
1181         bindKey("KP_0",        LFUN_SELFINSERT);
1182         bindKey("KP_Decimal",  LFUN_SELFINSERT);
1183         bindKey("KP_Enter",    LFUN_SELFINSERT);
1184         bindKey("KP_1",        LFUN_SELFINSERT);
1185         bindKey("KP_2",        LFUN_SELFINSERT);
1186         bindKey("KP_3",        LFUN_SELFINSERT);
1187         bindKey("KP_4",        LFUN_SELFINSERT);
1188         bindKey("KP_5",        LFUN_SELFINSERT);
1189         bindKey("KP_6",        LFUN_SELFINSERT);
1190         bindKey("KP_Add",      LFUN_SELFINSERT);
1191         bindKey("KP_7",        LFUN_SELFINSERT);
1192         bindKey("KP_8",        LFUN_SELFINSERT);
1193         bindKey("KP_9",        LFUN_SELFINSERT);
1194         bindKey("KP_Divide",   LFUN_SELFINSERT);
1195         bindKey("KP_Multiply", LFUN_SELFINSERT);
1196         bindKey("KP_Subtract", LFUN_SELFINSERT);
1197         
1198         /* Most self-insert keys are handled in the 'default:' section of
1199          * WorkAreaKeyPress - so we don't have to define them all.
1200          * However keys explicit decleared as self-insert are
1201          * handled seperatly (LFUN_SELFINSERT.) Lgb. */
1202         
1203         bindKey("C-Tab",  LFUN_TABINSERT);  // ale970515
1204 }