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