9c7fecb16a49a6f383471c6cf3d4a32a87f10873
[apps/madmutt.git] / keymap.h
1 /*
2  * Copyright (C) 1996-2000,2 Michael R. Elkins <me@mutt.org>
3  * 
4  *     This program is free software; you can redistribute it and/or modify
5  *     it under the terms of the GNU General Public License as published by
6  *     the Free Software Foundation; either version 2 of the License, or
7  *     (at your option) any later version.
8  * 
9  *     This program is distributed in the hope that it will be useful,
10  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *     GNU General Public License for more details.
13  * 
14  *     You should have received a copy of the GNU General Public License
15  *     along with this program; if not, write to the Free Software
16  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
17  */
18
19 #ifndef KEYMAP_H
20 #define KEYMAP_H
21
22 #include "mapping.h"
23
24 /* maximal length of a key binding sequence used for buffer in km_bindkey */
25 #define MAX_SEQ 8
26
27 /* type for key storage, the rest of mutt works fine with int type */
28 typedef short keycode_t;
29
30 void km_bind (char *, int, int, char *, char *);
31 void km_bindkey (char *, int, int);
32 int km_dokey (int);
33
34 /* entry in the keymap tree */
35 struct keymap_t {
36   char *macro;                  /* macro expansion (op == OP_MACRO) */
37   char *descr;                  /* description of a macro for the help menu */
38   struct keymap_t *next;        /* next key in map */
39   short op;                     /* operation to perform */
40   short eq;                     /* number of leading keys equal to next entry */
41   short len;                    /* length of key sequence (unit: sizeof (keycode_t)) */
42   keycode_t *keys;              /* key sequence */
43 };
44
45 char *km_keyname (int);
46 int km_expand_key (char *, size_t, struct keymap_t *);
47 struct keymap_t *km_find_func (int, int);
48 void km_init (void);
49 void km_error_key (int);
50 void mutt_what_key (void);
51
52 enum {
53   MENU_ALIAS,
54   MENU_ATTACH,
55   MENU_COMPOSE,
56   MENU_EDITOR,
57   MENU_FOLDER,
58   MENU_GENERIC,
59   MENU_MAIN,
60   MENU_PAGER,
61   MENU_POST,
62   MENU_QUERY,
63
64
65   MENU_PGP,
66   MENU_SMIME,
67
68 #ifdef CRYPT_BACKEND_GPGME
69   MENU_KEY_SELECT_PGP,
70   MENU_KEY_SELECT_SMIME,
71 #endif
72
73 #ifdef MIXMASTER
74   MENU_MIX,
75 #endif
76
77
78
79   MENU_MAX
80 };
81
82 /* the keymap trees (one for each menu) */
83 extern struct keymap_t *Keymaps[];
84
85 /* dokey() records the last real key pressed  */
86 extern int LastKey;
87
88 extern struct mapping_t Menus[];
89
90 struct binding_t {
91   char *name;                   /* name of the function */
92   int op;                       /* function id number */
93   char *seq;                    /* default key binding */
94 };
95
96 struct binding_t *km_get_table (int menu);
97
98 extern struct binding_t OpGeneric[];
99 extern struct binding_t OpPost[];
100 extern struct binding_t OpMain[];
101 extern struct binding_t OpAttach[];
102 extern struct binding_t OpPager[];
103 extern struct binding_t OpCompose[];
104 extern struct binding_t OpBrowser[];
105 extern struct binding_t OpEditor[];
106 extern struct binding_t OpQuery[];
107 extern struct binding_t OpAlias[];
108
109 extern struct binding_t OpPgp[];
110
111 extern struct binding_t OpSmime[];
112
113 #ifdef MIXMASTER
114 extern struct binding_t OpMix[];
115 #endif
116
117 #include "keymap_defs.h"
118
119 #endif /* KEYMAP_H */