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