mutt stable branch with some hacks
1/*
2 * Copyright (C) 1996-2000,2002,2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 */
28typedef short keycode_t;
29
30void km_bind (char *, int, int, char *, char *);
31void km_bindkey (char *, int, int);
32int km_dokey (int);
33
34void init_extended_keys(void);
35
36/* entry in the keymap tree */
37struct keymap_t
38{
39 char *macro; /* macro expansion (op == OP_MACRO) */
40 char *descr; /* description of a macro for the help menu */
41 struct keymap_t *next; /* next key in map */
42 short op; /* operation to perform */
43 short eq; /* number of leading keys equal to next entry */
44 short len; /* length of key sequence (unit: sizeof (keycode_t)) */
45 keycode_t *keys; /* key sequence */
46};
47
48int km_expand_key (char *, size_t, struct keymap_t *);
49struct keymap_t *km_find_func (int, int);
50void km_init (void);
51void km_error_key (int);
52void mutt_what_key (void);
53
54enum
55{
56 MENU_ALIAS,
57 MENU_ATTACH,
58 MENU_COMPOSE,
59 MENU_EDITOR,
60 MENU_FOLDER,
61 MENU_GENERIC,
62 MENU_MAIN,
63 MENU_PAGER,
64 MENU_POST,
65 MENU_QUERY,
66
67
68 MENU_PGP,
69 MENU_SMIME,
70
71#ifdef CRYPT_BACKEND_GPGME
72 MENU_KEY_SELECT_PGP,
73 MENU_KEY_SELECT_SMIME,
74#endif
75
76#ifdef MIXMASTER
77 MENU_MIX,
78#endif
79
80
81
82 MENU_MAX
83};
84
85/* the keymap trees (one for each menu) */
86extern struct keymap_t *Keymaps[];
87
88/* dokey() records the last real key pressed */
89extern int LastKey;
90
91extern const struct mapping_t Menus[];
92
93struct binding_t
94{
95 char *name; /* name of the function */
96 int op; /* function id number */
97 char *seq; /* default key binding */
98};
99
100const struct binding_t *km_get_table (int menu);
101
102extern const struct binding_t OpGeneric[];
103extern const struct binding_t OpPost[];
104extern const struct binding_t OpMain[];
105extern const struct binding_t OpAttach[];
106extern const struct binding_t OpPager[];
107extern const struct binding_t OpCompose[];
108extern const struct binding_t OpBrowser[];
109extern const struct binding_t OpEditor[];
110extern const struct binding_t OpQuery[];
111extern const struct binding_t OpAlias[];
112
113extern const struct binding_t OpPgp[];
114
115extern const struct binding_t OpSmime[];
116
117#ifdef MIXMASTER
118extern const struct binding_t OpMix[];
119#endif
120
121#include "keymap_defs.h"
122
123#endif /* KEYMAP_H */