1c72fcc34Sopenharmony_ci#ifndef BINDINGS_H_INCLUDED
2c72fcc34Sopenharmony_ci#define BINDINGS_H_INCLUDED
3c72fcc34Sopenharmony_ci
4c72fcc34Sopenharmony_ci#include CURSESINC
5c72fcc34Sopenharmony_ci#include <menu.h>
6c72fcc34Sopenharmony_ci#include <stdint.h>
7c72fcc34Sopenharmony_ci
8c72fcc34Sopenharmony_ci/* Commands are stored in an uint16_t and may take an unsigned numeric argument.
9c72fcc34Sopenharmony_ci * The command itself is stored in the lower 7 bits, the argument is stored
10c72fcc34Sopenharmony_ci * in the higher 9 bits.
11c72fcc34Sopenharmony_ci *
12c72fcc34Sopenharmony_ci * The value `0` is used for no (unbound) command. */
13c72fcc34Sopenharmony_ci
14c72fcc34Sopenharmony_citypedef uint16_t command_enum;
15c72fcc34Sopenharmony_ciextern command_enum mixer_bindings[KEY_MAX];
16c72fcc34Sopenharmony_ci/* No need for a 16bit type, since textbox commands don't take arguments */
17c72fcc34Sopenharmony_ciextern uint8_t textbox_bindings[KEY_MAX];
18c72fcc34Sopenharmony_ci
19c72fcc34Sopenharmony_ci#define CMD_WITH_ARG(CMD, ARG) \
20c72fcc34Sopenharmony_ci	((CMD) + ((ARG) << 9))
21c72fcc34Sopenharmony_ci
22c72fcc34Sopenharmony_ci#define CMD_GET_COMMAND(CMD) \
23c72fcc34Sopenharmony_ci	((CMD) & 0x1FF)
24c72fcc34Sopenharmony_ci
25c72fcc34Sopenharmony_ci#define CMD_GET_ARGUMENT(CMD) \
26c72fcc34Sopenharmony_ci	((CMD) >> 9)
27c72fcc34Sopenharmony_ci
28c72fcc34Sopenharmony_cienum mixer_command {
29c72fcc34Sopenharmony_ci	// `CMD % 4` should produce the channel mask
30c72fcc34Sopenharmony_ci	CMD_MIXER_CONTROL_DOWN_LEFT = 1,
31c72fcc34Sopenharmony_ci	CMD_MIXER_CONTROL_DOWN_RIGHT,
32c72fcc34Sopenharmony_ci	CMD_MIXER_CONTROL_DOWN,
33c72fcc34Sopenharmony_ci	CMD_MIXER_CONTROL_UP_LEFT = 5,
34c72fcc34Sopenharmony_ci	CMD_MIXER_CONTROL_UP_RIGHT,
35c72fcc34Sopenharmony_ci	CMD_MIXER_CONTROL_UP,
36c72fcc34Sopenharmony_ci	CMD_MIXER_CONTROL_SET_PERCENT_LEFT = 9,
37c72fcc34Sopenharmony_ci	CMD_MIXER_CONTROL_SET_PERCENT_RIGHT,
38c72fcc34Sopenharmony_ci	CMD_MIXER_CONTROL_SET_PERCENT,
39c72fcc34Sopenharmony_ci
40c72fcc34Sopenharmony_ci	// Keep those in the same order as displayed on screen
41c72fcc34Sopenharmony_ci	CMD_MIXER_HELP,
42c72fcc34Sopenharmony_ci	CMD_MIXER_SYSTEM_INFORMATION,
43c72fcc34Sopenharmony_ci	CMD_MIXER_SELECT_CARD,
44c72fcc34Sopenharmony_ci	CMD_MIXER_CLOSE,
45c72fcc34Sopenharmony_ci
46c72fcc34Sopenharmony_ci	CMD_MIXER_TOGGLE_VIEW_MODE,
47c72fcc34Sopenharmony_ci	CMD_MIXER_SET_VIEW_MODE,
48c72fcc34Sopenharmony_ci	CMD_MIXER_PREVIOUS,
49c72fcc34Sopenharmony_ci	CMD_MIXER_NEXT,
50c72fcc34Sopenharmony_ci	CMD_MIXER_FOCUS_CONTROL,
51c72fcc34Sopenharmony_ci	CMD_MIXER_TOGGLE_MUTE,
52c72fcc34Sopenharmony_ci	CMD_MIXER_TOGGLE_CAPTURE,
53c72fcc34Sopenharmony_ci	CMD_MIXER_BALANCE_CONTROL,
54c72fcc34Sopenharmony_ci	CMD_MIXER_REFRESH,
55c72fcc34Sopenharmony_ci
56c72fcc34Sopenharmony_ci	// Mouse
57c72fcc34Sopenharmony_ci	CMD_MIXER_MOUSE_CLICK_MUTE,
58c72fcc34Sopenharmony_ci	CMD_MIXER_MOUSE_CLICK_VOLUME_BAR,
59c72fcc34Sopenharmony_ci	CMD_MIXER_MOUSE_CLICK_CONTROL_ENUM,
60c72fcc34Sopenharmony_ci};
61c72fcc34Sopenharmony_ci
62c72fcc34Sopenharmony_cienum textbox_command {
63c72fcc34Sopenharmony_ci	/* Since these commands are also used by the menu widget we make use of
64c72fcc34Sopenharmony_ci	 * the menu_driver() request constants.
65c72fcc34Sopenharmony_ci	 * KEY_MAX is substracted so the value fits in 8 bits. */
66c72fcc34Sopenharmony_ci	CMD_TEXTBOX___MIN_MENU_COMMAND = MIN_MENU_COMMAND - KEY_MAX,
67c72fcc34Sopenharmony_ci	CMD_TEXTBOX_TOP = REQ_FIRST_ITEM - KEY_MAX,
68c72fcc34Sopenharmony_ci	CMD_TEXTBOX_BOTTOM = REQ_LAST_ITEM - KEY_MAX,
69c72fcc34Sopenharmony_ci	CMD_TEXTBOX_LEFT = REQ_LEFT_ITEM - KEY_MAX,
70c72fcc34Sopenharmony_ci	CMD_TEXTBOX_RIGHT = REQ_RIGHT_ITEM - KEY_MAX,
71c72fcc34Sopenharmony_ci	CMD_TEXTBOX_UP = REQ_UP_ITEM - KEY_MAX,
72c72fcc34Sopenharmony_ci	CMD_TEXTBOX_DOWN = REQ_DOWN_ITEM - KEY_MAX,
73c72fcc34Sopenharmony_ci	CMD_TEXTBOX_PAGE_DOWN = REQ_SCR_DPAGE - KEY_MAX,
74c72fcc34Sopenharmony_ci	CMD_TEXTBOX_PAGE_UP = REQ_SCR_UPAGE - KEY_MAX,
75c72fcc34Sopenharmony_ci	CMD_TEXTBOX___MAX_MENU_COMMAND = MAX_MENU_COMMAND - KEY_MAX,
76c72fcc34Sopenharmony_ci	CMD_TEXTBOX_PAGE_LEFT,
77c72fcc34Sopenharmony_ci	CMD_TEXTBOX_PAGE_RIGHT,
78c72fcc34Sopenharmony_ci	CMD_TEXTBOX_CLOSE,
79c72fcc34Sopenharmony_ci};
80c72fcc34Sopenharmony_ci
81c72fcc34Sopenharmony_ci#endif
82