FS#11686 - Kinetic list scrolling for touchscreen
[maemo-rb.git] / apps / keymaps / keymap-sa9200.c
blobadee30ec1030331fb76f031483666c6140607cb7
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 the Philips SA9200 target */
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"
33 * The format of the list is as follows
34 * { Action Code, Button code, Prereq button code }
35 * if there's no need to check the previous button's value, use BUTTON_NONE
36 * Insert LAST_ITEM_IN_LIST at the end of each mapping
39 /* CONTEXT_CUSTOM's used in this file...
41 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
42 CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
43 i.e where up/down is inc/dec
44 CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
49 static const struct button_mapping button_context_standard[] = {
50 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
51 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
52 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
53 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
55 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
56 { ACTION_STD_CANCEL, BUTTON_PREV, BUTTON_NONE },
57 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
59 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
60 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
62 { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
63 { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
64 { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
66 LAST_ITEM_IN_LIST
67 }; /* button_context_standard */
70 static const struct button_mapping button_context_wps[] = {
71 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
72 { ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
74 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
75 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
77 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
78 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
80 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
81 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
83 { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_POWER|BUTTON_NEXT, BUTTON_POWER },
84 { ACTION_WPS_ABSETA_PREVDIR,BUTTON_POWER|BUTTON_PREV, BUTTON_POWER },
85 { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_UP, BUTTON_POWER },
87 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
88 { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
89 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
90 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
92 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
93 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
94 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
95 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
97 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
98 { ACTION_WPS_BROWSE, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
100 { ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
101 { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
102 { ACTION_WPS_PITCHSCREEN, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
103 { ACTION_WPS_HOTKEY, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
104 { ACTION_WPS_ID3SCREEN, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
106 LAST_ITEM_IN_LIST
107 }; /* button_context_wps */
109 static const struct button_mapping button_context_list[] = {
110 { ACTION_LISTTREE_PGUP, BUTTON_VOL_UP|BUTTON_UP, BUTTON_VOL_UP },
111 { ACTION_LISTTREE_PGDOWN, BUTTON_VOL_DOWN|BUTTON_DOWN, BUTTON_VOL_DOWN },
113 #ifdef HAVE_VOLUME_IN_LIST
114 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
115 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
117 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
118 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
119 #endif
121 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
122 }; /* button_context_list */
124 static const struct button_mapping button_context_tree[] = {
125 { ACTION_TREE_WPS, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
126 { ACTION_TREE_STOP, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
127 { ACTION_TREE_HOTKEY, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
129 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
130 }; /* button_context_tree */
132 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
133 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
135 { ACTION_TREE_PGLEFT, BUTTON_PREV, BUTTON_NONE },
136 { ACTION_TREE_PGLEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
138 { ACTION_TREE_PGRIGHT, BUTTON_NEXT, BUTTON_NONE },
139 { ACTION_TREE_PGRIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
141 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
144 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
145 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
146 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
148 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
149 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
150 { ACTION_TREE_ROOT_INIT, BUTTON_MENU, BUTTON_NONE },
152 { ACTION_TREE_PGLEFT, BUTTON_PREV, BUTTON_NONE },
153 { ACTION_TREE_PGLEFT, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT },
155 { ACTION_TREE_PGRIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
156 { ACTION_TREE_PGRIGHT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT|BUTTON_REPEAT },
158 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
161 static const struct button_mapping button_context_settings[] = {
162 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
163 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
165 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
166 { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
168 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
169 { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
171 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
172 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
174 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
175 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
177 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
178 }; /* button_context_settings */
180 static const struct button_mapping button_context_settings_right_is_inc[] = {
181 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
182 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
184 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
185 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
187 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
188 }; /* button_context_settingsgraphical */
190 static const struct button_mapping button_context_yesno[] = {
191 { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
193 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
194 }; /* button_context_settings_yesno */
196 /** Bookmark Screen **/
197 static const struct button_mapping button_context_bmark[] = {
198 { ACTION_BMS_DELETE, BUTTON_NEXT, BUTTON_NONE },
200 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
201 }; /* button_context_bmark */
203 static const struct button_mapping button_context_quickscreen[] = {
204 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
205 { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
207 { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE },
208 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
210 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
211 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
213 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
214 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
216 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
217 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
219 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
220 }; /* button_context_quickscreen */
222 static const struct button_mapping button_context_pitchscreen[] = {
223 { ACTION_PS_RESET, BUTTON_PLAY, BUTTON_NONE },
224 { ACTION_PS_EXIT, BUTTON_MENU, BUTTON_NONE },
225 { ACTION_PS_EXIT, BUTTON_PREV, BUTTON_NONE },
226 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
228 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
229 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
231 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
232 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
234 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
235 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
237 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
238 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
240 { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
241 { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
243 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
244 }; /* button_context_pitchcreen */
246 static const struct button_mapping button_context_keyboard[] = {
247 { ACTION_KBD_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
248 { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
249 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
251 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
252 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
254 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
255 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
257 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
258 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
260 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
261 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
263 { ACTION_KBD_CURSOR_LEFT, BUTTON_PREV, BUTTON_NONE },
264 { ACTION_KBD_CURSOR_LEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
266 { ACTION_KBD_CURSOR_RIGHT, BUTTON_NEXT, BUTTON_NONE },
267 { ACTION_KBD_CURSOR_RIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
269 { ACTION_KBD_BACKSPACE, BUTTON_VOL_UP, BUTTON_NONE },
270 { ACTION_KBD_BACKSPACE, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
272 { ACTION_KBD_PAGE_FLIP, BUTTON_VOL_DOWN, BUTTON_NONE },
274 { ACTION_KBD_MORSE_INPUT, BUTTON_MENU|BUTTON_PLAY, BUTTON_NONE },
275 { ACTION_KBD_MORSE_SELECT, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
277 LAST_ITEM_IN_LIST
278 }; /* button_context_keyboard */
280 #ifdef USB_ENABLE_HID
281 static const struct button_mapping button_context_usb_hid[] = {
282 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
283 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
285 LAST_ITEM_IN_LIST
286 }; /* button_context_usb_hid */
288 static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
289 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
290 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
291 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN, BUTTON_NONE },
292 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
293 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE },
294 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
295 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP, BUTTON_NONE },
296 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
297 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
298 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
299 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
300 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
301 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
303 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
304 }; /* button_context_usb_hid_mode_multimedia */
306 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
307 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
308 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
309 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
310 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
311 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
312 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
313 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
314 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
315 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP, BUTTON_NONE },
316 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
317 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN, BUTTON_NONE },
318 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
319 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
320 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NEXT },
322 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
323 }; /* button_context_usb_hid_mode_presentation */
325 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
326 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_VOL_UP, BUTTON_NONE },
327 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
328 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
329 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
330 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_UP|BUTTON_REL, BUTTON_UP },
331 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
332 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
333 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
334 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NEXT },
335 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_UP|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_UP|BUTTON_DOWN },
336 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
337 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
338 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_LEFT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_LEFT|BUTTON_RIGHT },
339 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
340 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
341 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
343 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
344 }; /* button_context_usb_hid_mode_browser */
346 #ifdef HAVE_USB_HID_MOUSE
347 static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
348 { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
349 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
350 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
351 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
352 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
353 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
354 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
355 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
356 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_PREV, BUTTON_NONE },
357 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_PREV|BUTTON_REL, BUTTON_NONE },
358 { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_PREV|BUTTON_UP, BUTTON_NONE },
359 { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_PREV|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
360 { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_PREV|BUTTON_DOWN, BUTTON_NONE },
361 { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_PREV|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
362 { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_PREV|BUTTON_LEFT, BUTTON_NONE },
363 { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_PREV|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
364 { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_PREV|BUTTON_RIGHT, BUTTON_NONE },
365 { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_PREV|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
366 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_NEXT, BUTTON_NONE },
367 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_NEXT|BUTTON_REL, BUTTON_NONE },
368 { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_NEXT|BUTTON_UP, BUTTON_NONE },
369 { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_NEXT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
370 { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_NEXT|BUTTON_DOWN, BUTTON_NONE },
371 { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_NEXT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
372 { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_NEXT|BUTTON_LEFT, BUTTON_NONE },
373 { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_NEXT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
374 { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_NEXT|BUTTON_RIGHT, BUTTON_NONE },
375 { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_NEXT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
376 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_VOL_UP, BUTTON_NONE },
377 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
378 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
379 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
381 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
382 }; /* button_context_usb_hid_mode_mouse */
383 #endif
384 #endif
386 const struct button_mapping* get_context_mapping(int context)
388 switch (context)
390 case CONTEXT_STD:
391 return button_context_standard;
393 case CONTEXT_WPS:
394 return button_context_wps;
396 case CONTEXT_LIST:
397 return button_context_list;
399 case CONTEXT_MAINMENU:
400 case CONTEXT_TREE:
401 if (global_settings.hold_lr_for_scroll_in_list)
402 return button_context_listtree_scroll_without_combo;
403 else
404 return button_context_listtree_scroll_with_combo;
406 case CONTEXT_CUSTOM|CONTEXT_TREE:
407 return button_context_tree;
409 case CONTEXT_SETTINGS_TIME:
410 case CONTEXT_SETTINGS:
411 return button_context_settings;
413 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
414 case CONTEXT_SETTINGS_COLOURCHOOSER:
415 case CONTEXT_SETTINGS_EQ:
416 return button_context_settings_right_is_inc;
418 case CONTEXT_YESNOSCREEN:
419 return button_context_yesno;
421 case CONTEXT_BOOKMARKSCREEN:
422 return button_context_bmark;
424 case CONTEXT_QUICKSCREEN:
425 return button_context_quickscreen;
427 case CONTEXT_PITCHSCREEN:
428 return button_context_pitchscreen;
430 case CONTEXT_KEYBOARD:
431 case CONTEXT_MORSE_INPUT:
432 return button_context_keyboard;
434 #ifdef USB_ENABLE_HID
435 case CONTEXT_USB_HID:
436 return button_context_usb_hid;
437 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
438 return button_context_usb_hid_mode_multimedia;
439 case CONTEXT_USB_HID_MODE_PRESENTATION:
440 return button_context_usb_hid_mode_presentation;
441 case CONTEXT_USB_HID_MODE_BROWSER:
442 return button_context_usb_hid_mode_browser;
443 #ifdef HAVE_USB_HID_MOUSE
444 case CONTEXT_USB_HID_MODE_MOUSE:
445 return button_context_usb_hid_mode_mouse;
446 #endif
447 #endif
449 return button_context_standard;