1
/*
2
 * Copyright 2008-2011 Various Authors
3
 * Copyright 2004-2006 Timo Hirvonen
4
 *
5
 * keys.[ch] by Frank Terbeck <ft@bewatermyfriend.org>
6
 *
7
 * This program is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU General Public License as
9
 * published by the Free Software Foundation; either version 2 of the
10
 * License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful, but
13
 * WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#ifndef KEYS_H
22
#define KEYS_H
23
24
#include "uchar.h"
25
26
enum key_context {
27
	CTX_BROWSER,
28
	CTX_COMMON,
29
	CTX_FILTERS,
30
	CTX_LIBRARY,
31
	CTX_PLAYLIST,
32
	CTX_QUEUE,
33
	CTX_SETTINGS,
34
};
35
#define NR_CTXS (CTX_SETTINGS + 1)
36
37
struct key {
38
	const char *name;
39
	int key;
40
	uchar ch;
41
};
42
43
struct binding {
44
	struct binding *next;
45
	const struct key *key;
46
	enum key_context ctx;
47
	char cmd[];
48
};
49
50
extern const char * const key_context_names[NR_CTXS + 1];
51
extern const struct key key_table[];
52
extern struct binding *key_bindings[NR_CTXS];
53
54
void show_binding(const char *context, const char *key);
55
int key_bind(const char *context, const char *key, const char *cmd, int force);
56
int key_unbind(const char *context, const char *key, int force);
57
58
void normal_mode_ch(uchar ch);
59
void normal_mode_key(int key);
60
61
#endif