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