default magic is useless: only _create_ mboxes and maildirs.
[apps/madmutt.git] / keymap.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 1996-2000,2 Michael R. Elkins <me@mutt.org>
4  *
5  * This file is part of mutt-ng, see http://www.muttng.org/.
6  * It's licensed under the GNU General Public License,
7  * please see the file GPL in the top level source directory.
8  */
9
10 #ifndef KEYMAP_H
11 #define KEYMAP_H
12
13 #include <lib-lib/lib-lib.h>
14
15 /* maximal length of a key binding sequence used for buffer in km_bindkey */
16 #define MAX_SEQ 8
17
18 /* type for key storage, the rest of mutt works fine with int type */
19 typedef short keycode_t;
20
21 void km_bind (const char *, int, int, char *, char *);
22 void km_bindkey (const char *, int, int);
23 int km_dokey (int);
24
25 /* entry in the keymap tree */
26 struct keymap_t {
27   char *macro;                  /* macro expansion (op == OP_MACRO) */
28   char *descr;                  /* description of a macro for the help menu */
29   struct keymap_t *next;        /* next key in map */
30   short op;                     /* operation to perform */
31   short eq;                     /* number of leading keys equal to next entry */
32   short len;                    /* length of key sequence (unit: sizeof (keycode_t)) */
33   keycode_t *keys;              /* key sequence */
34 };
35
36 const char *km_keyname (int);
37 int km_expand_key (char *, size_t, struct keymap_t *);
38 struct keymap_t *km_find_func (int, int);
39 void km_init (void);
40 void km_error_key (int);
41
42 enum {
43   MENU_ALIAS,
44   MENU_ATTACH,
45   MENU_COMPOSE,
46   MENU_EDITOR,
47   MENU_FOLDER,
48   MENU_GENERIC,
49   MENU_MAIN,
50   MENU_PAGER,
51   MENU_POST,
52   MENU_QUERY,
53   MENU_PGP,
54   MENU_SMIME,
55   MENU_KEY_SELECT_PGP,
56   MENU_KEY_SELECT_SMIME,
57   MENU_MAX
58 };
59
60 /* the keymap trees (one for each menu) */
61 extern struct keymap_t *Keymaps[];
62
63 /* dokey() records the last real key pressed  */
64 extern int LastKey;
65
66 extern struct mapping_t Menus[];
67
68 struct binding_t {
69     const char *name;             /* name of the function */
70     int op;                       /* function id number */
71     const char *seq;              /* default key binding */
72 };
73
74 struct binding_t *km_get_table (int menu);
75
76 #define MUTT_FUNCTIONS_PROTO
77 #include "functions.def"
78
79 #endif /* KEYMAP_H */
80 #include "keymap_defs.h"