Few more fixes, notably make audiobufend static.
[kugel-rb.git] / apps / keymaps / keymap-touchscreen.c
blob9825c92e7d5fb0baa5d06e6ac00f3c00eac1a264
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 /* Button Code Definitions for touchscreen targets */
23 #include <stdio.h>
24 #include <string.h>
25 #include <stdlib.h>
27 #include "config.h"
28 #include "action.h"
29 #include "button.h"
30 #include "settings.h"
32 const struct button_mapping* target_get_context_mapping(int context);
33 /* How this file is used:
34 get_context_mapping() at the bottom of the file is called by action.c as usual.
35 if the context is for the remote control its then passed straight to
36 target_get_context_mapping().
37 These tables are only used for the touchscreen buttons, so at the end of each
38 CONTEXT_CUSTOM2 is OR'ed with the context and then sent to target_get_context_mapping()
39 (NOTE: CONTEXT_CUSTOM2 will be stripped before being sent to make it easier.)
40 In the target keymap, remember to |CONTEXT_CUSTOM2 in the LAST_ITEM_IN_LIST__NEXTLIST() macro
41 to speed it up a tiny bit... if you dont it will go through these tables first before going
42 back to the target file.
46 /* touchscreen "buttons"
47 screen is split into a 3x3 grid for buttons...
48 BUTTON_TOPLEFT BUTTON_TOPMIDDLE BUTTON_TOPRIGHT
49 BUTTON_MIDLEFT BUTTON_CENTER BUTTON_MIDRIGHT
50 BUTTON_BOTTOMLEFT BUTTON_BOTTOMMIDDLE BUTTON_BOTTOMRIGHT
53 static const struct button_mapping button_context_standard[] = {
54 { ACTION_STD_PREV, BUTTON_TOPMIDDLE, BUTTON_NONE },
55 { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
56 { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
57 { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
59 { ACTION_STD_OK, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
60 { ACTION_STD_OK, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
61 { ACTION_STD_CANCEL, BUTTON_MIDLEFT, BUTTON_NONE },
62 { ACTION_STD_CANCEL, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
64 { ACTION_STD_MENU, BUTTON_TOPLEFT, BUTTON_NONE },
65 { ACTION_STD_QUICKSCREEN, BUTTON_BOTTOMLEFT, BUTTON_NONE },
66 { ACTION_STD_CONTEXT, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
67 { ACTION_STD_CONTEXT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
69 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_STD)
70 }; /* button_context_standard */
72 static const struct button_mapping button_context_wps[] = {
74 { ACTION_WPS_PLAY, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
75 { ACTION_WPS_STOP, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
77 { ACTION_WPS_SKIPPREV, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_MIDLEFT },
78 { ACTION_WPS_SEEKBACK, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
79 { ACTION_WPS_STOPSEEK, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_MIDLEFT|BUTTON_REPEAT },
81 { ACTION_WPS_SKIPNEXT, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
82 { ACTION_WPS_SEEKFWD, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
83 { ACTION_WPS_STOPSEEK, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT|BUTTON_REPEAT },
85 { ACTION_WPS_VOLUP, BUTTON_TOPMIDDLE, BUTTON_NONE },
86 { ACTION_WPS_VOLUP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
87 { ACTION_WPS_VOLDOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
88 { ACTION_WPS_VOLDOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
90 { ACTION_WPS_BROWSE, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_TOPRIGHT },
91 { ACTION_WPS_CONTEXT, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT },
93 { ACTION_WPS_MENU, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_TOPLEFT },
94 { ACTION_WPS_QUICKSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT },
95 #ifdef HAVE_HOTKEY
96 { ACTION_WPS_HOTKEY, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
97 #else
98 { ACTION_WPS_VIEW_PLAYLIST, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
99 #endif
100 { ACTION_WPS_REC, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_TOPLEFT },
101 { ACTION_WPS_PITCHSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
102 { ACTION_WPS_ID3SCREEN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
104 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_WPS)
105 }; /* button_context_wps */
107 static const struct button_mapping button_context_list[] = {
108 #if 0
109 /* this is all to show how the poor-mans-gestures can be used... */
110 { ACTION_LISTTREE_PGUP, BUTTON_TOPRIGHT, BUTTON_NONE},
111 { ACTION_LISTTREE_PGUP, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT},
112 { ACTION_STD_NEXTREPEAT, BUTTON_CENTER, BUTTON_TOPMIDDLE},
113 { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE, BUTTON_CENTER},
114 { ACTION_NONE, BUTTON_TOPMIDDLE, BUTTON_NONE },
115 { ACTION_NONE, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
116 { ACTION_STD_PREV, BUTTON_TOPMIDDLE|BUTTON_REL, BUTTON_NONE },
117 { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE|BUTTON_REL, BUTTON_NONE },
118 { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE},
119 { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT},
120 { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE, BUTTON_CENTER},
121 { ACTION_STD_PREVREPEAT, BUTTON_CENTER, BUTTON_BOTTOMMIDDLE},
122 #endif
123 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_LIST)
124 }; /* button_context_list */
126 static const struct button_mapping button_context_tree[] = {
127 { ACTION_TREE_WPS, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_TOPRIGHT },
128 { ACTION_TREE_STOP, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
129 #ifdef HAVE_HOTKEY
130 // { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
131 #endif
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE)
134 }; /* button_context_tree */
136 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
137 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
140 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
141 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
144 static const struct button_mapping button_context_settings[] = {
145 { ACTION_SETTINGS_INC, BUTTON_TOPMIDDLE, BUTTON_NONE },
146 { ACTION_SETTINGS_INCREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
147 { ACTION_SETTINGS_DEC, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
148 { ACTION_SETTINGS_DECREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
149 { ACTION_SETTINGS_RESET, BUTTON_CENTER, BUTTON_NONE },
151 { ACTION_STD_PREV, BUTTON_MIDLEFT, BUTTON_NONE },
152 { ACTION_STD_PREVREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
153 { ACTION_STD_NEXT, BUTTON_MIDRIGHT, BUTTON_NONE },
154 { ACTION_STD_NEXTREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
155 { ACTION_STD_CANCEL, BUTTON_TOPLEFT, BUTTON_NONE },
157 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS)
158 }; /* button_context_settings */
160 static const struct button_mapping button_context_settings_right_is_inc[] = {
161 { ACTION_NONE, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
162 { ACTION_NONE, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
163 { ACTION_SETTINGS_INC, BUTTON_MIDRIGHT, BUTTON_NONE },
164 { ACTION_SETTINGS_INCREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
165 { ACTION_SETTINGS_DEC, BUTTON_MIDLEFT, BUTTON_NONE },
166 { ACTION_SETTINGS_DECREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
167 { ACTION_SETTINGS_RESET, BUTTON_CENTER, BUTTON_NONE },
169 { ACTION_STD_CANCEL, BUTTON_TOPLEFT, BUTTON_NONE },
171 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_SETTINGS)
172 }; /* button_context_settingsgraphical */
174 static const struct button_mapping button_context_yesno[] = {
175 { ACTION_YESNO_ACCEPT, BUTTON_TOPRIGHT, BUTTON_NONE },
176 { ACTION_YESNO_ACCEPT, BUTTON_BOTTOMLEFT, BUTTON_NONE },
177 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_YESNOSCREEN)
178 }; /* button_context_settings_yesno */
180 static const struct button_mapping button_context_colorchooser[] = {
181 { ACTION_STD_OK, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
182 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_COLOURCHOOSER),
183 }; /* button_context_colorchooser */
185 static const struct button_mapping button_context_eq[] = {
186 /* override the std context since we're using MIDRIGHT for settings inc */
187 { ACTION_NONE, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
188 { ACTION_NONE, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
189 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_EQ),
190 }; /* button_context_eq */
192 /* Bookmark Screen */
193 static const struct button_mapping button_context_bmark[] = {
194 { ACTION_BMS_DELETE, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
196 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_BOOKMARKSCREEN),
197 }; /* button_context_bmark */
199 static const struct button_mapping button_context_time[] = {
200 { ACTION_SETTINGS_INC, BUTTON_TOPMIDDLE, BUTTON_NONE },
201 { ACTION_SETTINGS_INCREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
202 { ACTION_SETTINGS_DEC, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
203 { ACTION_SETTINGS_DECREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
204 { ACTION_STD_PREV, BUTTON_MIDLEFT, BUTTON_NONE },
205 { ACTION_STD_PREVREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
206 { ACTION_STD_NEXT, BUTTON_MIDRIGHT, BUTTON_NONE },
207 { ACTION_STD_NEXTREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
208 { ACTION_STD_OK, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
209 { ACTION_STD_CANCEL, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_TOPLEFT },
210 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_TIME),
211 }; /* button_context_time */
213 static const struct button_mapping button_context_quickscreen[] = {
214 /* override ACTION_STD_CANCEL from standard context */
215 { ACTION_NONE, BUTTON_MIDLEFT, BUTTON_NONE },
217 { ACTION_STD_CANCEL, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
218 { ACTION_STD_CANCEL, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_NONE },
219 { ACTION_STD_CANCEL, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_NONE },
220 { ACTION_STD_CANCEL, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_NONE },
221 { ACTION_STD_CANCEL, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_NONE },
222 { ACTION_QS_TOP, BUTTON_TOPMIDDLE|BUTTON_REL, BUTTON_NONE },
223 { ACTION_QS_TOP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
224 { ACTION_QS_DOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REL, BUTTON_NONE },
225 { ACTION_QS_DOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
226 { ACTION_QS_LEFT, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_NONE },
227 { ACTION_QS_LEFT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
228 { ACTION_QS_RIGHT, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_NONE },
229 { ACTION_QS_RIGHT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
230 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_QUICKSCREEN)
231 }; /* button_context_quickscreen */
233 static const struct button_mapping button_context_pitchscreen[] = {
235 { ACTION_PS_INC_SMALL, BUTTON_TOPMIDDLE, BUTTON_NONE },
236 { ACTION_PS_INC_BIG, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
237 { ACTION_PS_DEC_SMALL, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
238 { ACTION_PS_DEC_BIG, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
239 { ACTION_PS_NUDGE_LEFT, BUTTON_MIDLEFT, BUTTON_NONE },
240 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_NONE },
241 { ACTION_PS_NUDGE_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE },
242 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_NONE },
243 { ACTION_PS_TOGGLE_MODE, BUTTON_TOPRIGHT, BUTTON_NONE },
244 { ACTION_PS_TOGGLE_MODE, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
245 { ACTION_PS_RESET, BUTTON_CENTER, BUTTON_NONE },
246 { ACTION_PS_EXIT, BUTTON_TOPLEFT, BUTTON_NONE },
247 { ACTION_PS_EXIT, BUTTON_BOTTOMLEFT, BUTTON_NONE },
248 { ACTION_PS_SLOWER, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
249 { ACTION_PS_FASTER, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
250 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_PITCHSCREEN)
251 }; /* button_context_pitchcreen */
253 static const struct button_mapping button_context_keyboard[] = {
255 { ACTION_KBD_LEFT, BUTTON_MIDLEFT, BUTTON_NONE },
256 { ACTION_KBD_LEFT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
257 { ACTION_KBD_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE },
258 { ACTION_KBD_RIGHT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
259 { ACTION_KBD_CURSOR_LEFT, BUTTON_TOPLEFT, BUTTON_NONE },
260 { ACTION_KBD_CURSOR_LEFT, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_NONE },
261 { ACTION_KBD_CURSOR_RIGHT, BUTTON_TOPRIGHT, BUTTON_NONE },
262 { ACTION_KBD_CURSOR_RIGHT, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_NONE },
263 { ACTION_KBD_SELECT, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
264 { ACTION_KBD_DONE, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
265 { ACTION_KBD_ABORT, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
266 { ACTION_KBD_BACKSPACE, BUTTON_BOTTOMLEFT, BUTTON_NONE },
267 { ACTION_KBD_BACKSPACE, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE },
268 { ACTION_KBD_UP, BUTTON_TOPMIDDLE, BUTTON_NONE },
269 { ACTION_KBD_UP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
270 { ACTION_KBD_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
271 { ACTION_KBD_DOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
273 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_KEYBOARD)
274 }; /* button_context_keyboard */
276 static const struct button_mapping button_context_radio[] = {
277 { ACTION_STD_PREV, BUTTON_MIDLEFT, BUTTON_NONE },
278 { ACTION_STD_PREVREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
279 { ACTION_STD_NEXT, BUTTON_MIDRIGHT, BUTTON_NONE },
280 { ACTION_STD_NEXTREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
281 { ACTION_FM_MENU, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
282 { ACTION_FM_PRESET, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
283 { ACTION_FM_STOP, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_NONE },
284 { ACTION_FM_EXIT, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_NONE },
285 { ACTION_FM_MODE, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT },
286 { ACTION_FM_PLAY, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_NONE },
287 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_FM)
288 }; /* button_context_radio */
290 #ifdef USB_ENABLE_HID
291 static const struct button_mapping button_context_usb_hid[] = {
292 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_TOPLEFT },
293 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_TOPLEFT },
295 LAST_ITEM_IN_LIST
296 }; /* button_context_usb_hid */
298 static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
299 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
300 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
301 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_TOPMIDDLE, BUTTON_NONE },
302 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
303 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
304 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_TOPRIGHT },
305 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT },
306 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT },
307 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
309 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
310 }; /* button_context_usb_hid_mode_multimedia */
312 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
313 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_TOPRIGHT },
314 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT },
315 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_MIDLEFT },
316 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
317 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_MIDLEFT },
318 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
319 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
320 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
321 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_TOPMIDDLE|BUTTON_REL, BUTTON_TOPMIDDLE },
322 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_TOPMIDDLE },
323 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_BOTTOMMIDDLE|BUTTON_REL, BUTTON_BOTTOMMIDDLE },
324 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_BOTTOMMIDDLE },
325 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
326 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
328 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
329 }; /* button_context_usb_hid_mode_presentation */
331 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
332 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_TOPMIDDLE, BUTTON_NONE },
333 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
334 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
335 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
336 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT },
337 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
338 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
339 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_TOPRIGHT|BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT|BUTTON_BOTTOMRIGHT },
340 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_MIDLEFT },
341 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
342 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
343 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_MIDLEFT },
344 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
345 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
347 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
348 }; /* button_context_usb_hid_mode_browser */
350 #ifdef HAVE_USB_HID_MOUSE
351 static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
352 { ACTION_USB_HID_MOUSE_UP, BUTTON_TOPMIDDLE, BUTTON_NONE },
353 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
354 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
355 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT,BUTTON_NONE },
356 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_MIDLEFT, BUTTON_NONE },
357 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
358 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE },
359 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
360 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_CENTER, BUTTON_NONE },
361 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE },
362 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_TOPRIGHT, BUTTON_NONE },
363 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_NONE },
364 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
365 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE },
367 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
368 }; /* button_context_usb_hid_mode_mouse */
369 #endif
370 #endif
372 const struct button_mapping* get_context_mapping(int context)
374 if (context & CONTEXT_CUSTOM2
375 #if BUTTON_REMOTE != 0
376 || context & CONTEXT_REMOTE
377 #endif
380 return target_get_context_mapping(context & ~CONTEXT_CUSTOM2);
383 switch (context)
385 case CONTEXT_STD:
386 return button_context_standard;
387 case CONTEXT_WPS:
388 return button_context_wps;
390 case CONTEXT_LIST:
391 return button_context_list;
392 case CONTEXT_MAINMENU:
393 case CONTEXT_TREE:
394 if (global_settings.hold_lr_for_scroll_in_list)
395 return button_context_listtree_scroll_without_combo;
396 else
397 return button_context_listtree_scroll_with_combo;
398 case CONTEXT_CUSTOM|CONTEXT_TREE:
399 return button_context_tree;
401 case CONTEXT_SETTINGS:
402 return button_context_settings;
403 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
404 return button_context_settings_right_is_inc;
406 case CONTEXT_SETTINGS_COLOURCHOOSER:
407 return button_context_colorchooser;
408 case CONTEXT_SETTINGS_EQ:
409 return button_context_eq;
411 case CONTEXT_SETTINGS_TIME:
412 return button_context_time;
414 case CONTEXT_YESNOSCREEN:
415 return button_context_yesno;
416 case CONTEXT_FM:
417 return button_context_radio;
418 case CONTEXT_BOOKMARKSCREEN:
419 return button_context_bmark;
420 case CONTEXT_QUICKSCREEN:
421 return button_context_quickscreen;
422 case CONTEXT_PITCHSCREEN:
423 return button_context_pitchscreen;
424 case CONTEXT_KEYBOARD:
425 case CONTEXT_MORSE_INPUT:
426 return button_context_keyboard;
427 #ifdef USB_ENABLE_HID
428 case CONTEXT_USB_HID:
429 return button_context_usb_hid;
430 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
431 return button_context_usb_hid_mode_multimedia;
432 case CONTEXT_USB_HID_MODE_PRESENTATION:
433 return button_context_usb_hid_mode_presentation;
434 case CONTEXT_USB_HID_MODE_BROWSER:
435 return button_context_usb_hid_mode_browser;
436 #ifdef HAVE_USB_HID_MOUSE
437 case CONTEXT_USB_HID_MODE_MOUSE:
438 return button_context_usb_hid_mode_mouse;
439 #endif
440 #endif
441 default:
442 return button_context_standard;
444 return button_context_standard;