FS#12076 - DB stats resurrection: If the filename was changed, require
[kugel-rb.git] / apps / keymaps / keymap-fuze.c
blobe829bef8fbea6538776ce8856332375aa5579d02
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) Thomas Martitz 2008
11 * Copyright (C) Barry Wardell 2006
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
22 /* Button Code Definitions for Sandisk Fuze target */
24 #include "config.h"
25 #include "action.h"
26 #include "button.h"
27 #include "settings.h"
29 /* {Action Code, Button code, Prereq button code } */
31 /*
32 * The format of the list is as follows
33 * { Action Code, Button code, Prereq button code }
34 * if there's no need to check the previous button's value, use BUTTON_NONE
35 * Insert LAST_ITEM_IN_LIST at the end of each mapping
37 static const struct button_mapping button_context_standard[] = {
38 { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
39 { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
40 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
41 { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
43 { ACTION_STD_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
45 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
46 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
47 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
49 { ACTION_STD_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
50 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
52 LAST_ITEM_IN_LIST
53 }; /* button_context_standard */
56 static const struct button_mapping button_context_wps[] = {
57 { ACTION_WPS_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
58 { ACTION_WPS_STOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
60 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
61 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
62 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
64 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
65 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
66 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
68 { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_HOME|BUTTON_RIGHT, BUTTON_HOME },
69 { ACTION_WPS_ABSETA_PREVDIR, BUTTON_HOME|BUTTON_LEFT, BUTTON_HOME },
70 { ACTION_WPS_ABRESET, BUTTON_HOME|BUTTON_UP, BUTTON_HOME },
72 { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE },
73 { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT,BUTTON_NONE },
74 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
75 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT,BUTTON_NONE },
77 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
79 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
80 { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
82 { ACTION_WPS_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
84 { ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_UP, BUTTON_SELECT },
85 { ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_SELECT },
86 { ACTION_WPS_HOTKEY, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
88 LAST_ITEM_IN_LIST
89 }; /* button_context_wps */
91 static const struct button_mapping button_context_settings[] = {
92 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
93 { ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
94 { ACTION_SETTINGS_INCREPEAT,BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
95 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
96 { ACTION_SETTINGS_DECREPEAT,BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
98 { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_UP },
99 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
100 { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
101 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
102 { ACTION_SETTINGS_RESET, BUTTON_SELECT, BUTTON_NONE },
104 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
105 }; /* button_context_settings */
107 static const struct button_mapping button_context_list[] = {
108 { ACTION_LISTTREE_PGUP, BUTTON_HOME|BUTTON_SCROLL_BACK, BUTTON_HOME },
109 { ACTION_LISTTREE_PGDOWN, BUTTON_HOME|BUTTON_SCROLL_FWD, BUTTON_HOME },
111 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
112 }; /* button_context_list */
114 static const struct button_mapping button_context_tree[] = {
115 { ACTION_TREE_WPS, BUTTON_UP|BUTTON_REL, BUTTON_UP },
116 { ACTION_TREE_STOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
117 { ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
119 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
120 }; /* button_context_tree */
122 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
123 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
124 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
125 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
126 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
127 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
128 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
129 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
131 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
132 }; /* button_context_listtree_scroll_without_combo */
134 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
135 { ACTION_TREE_PGLEFT, BUTTON_HOME|BUTTON_LEFT, BUTTON_NONE },
136 { ACTION_TREE_ROOT_INIT,BUTTON_HOME|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_HOME|BUTTON_LEFT },
137 { ACTION_TREE_PGLEFT, BUTTON_HOME|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
138 { ACTION_TREE_PGRIGHT, BUTTON_HOME|BUTTON_RIGHT, BUTTON_NONE },
139 { ACTION_TREE_PGRIGHT, BUTTON_HOME|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
141 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
142 }; /* button_context_listtree_scroll_with_combo */
144 static const struct button_mapping button_context_yesno[] = {
145 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
147 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
148 }; /* button_context_settings_yesno */
150 static const struct button_mapping button_context_quickscreen[] = {
151 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
152 { ACTION_STD_CANCEL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
153 { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE },
154 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
155 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
156 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
157 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
158 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
159 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
160 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
161 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
163 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
164 }; /* button_context_quickscreen */
166 static const struct button_mapping button_context_settings_right_is_inc[] = {
167 { ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
168 { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
169 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
170 { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT,BUTTON_NONE },
172 { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_UP },
173 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
174 { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
175 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
176 { ACTION_NONE, BUTTON_SELECT, BUTTON_NONE },
177 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
178 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
179 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
181 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
182 }; /* button_context_settings_right_is_inc */
184 static const struct button_mapping button_context_settings_time[] = {
185 { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
186 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
187 { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
188 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
190 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
191 }; /* button_context_settings_time */
193 static const struct button_mapping button_context_pitchscreen[] = {
194 { ACTION_PS_INC_SMALL, BUTTON_SCROLL_FWD, BUTTON_NONE },
195 { ACTION_PS_INC_BIG, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
196 { ACTION_PS_DEC_SMALL, BUTTON_SCROLL_BACK, BUTTON_NONE },
197 { ACTION_PS_DEC_BIG, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
198 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
199 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
200 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
201 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
202 { ACTION_PS_TOGGLE_MODE, BUTTON_HOME|BUTTON_REL, BUTTON_NONE },
203 { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
204 { ACTION_PS_EXIT, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE },
205 { ACTION_PS_EXIT, BUTTON_UP, BUTTON_NONE },
206 { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
207 { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
209 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
210 }; /* button_context_pitchscreen */
212 #ifdef HAVE_RECORDING
213 /** Recording Screen **/
214 static const struct button_mapping button_context_recscreen[] = {
215 { ACTION_REC_PAUSE, BUTTON_UP|BUTTON_REL, BUTTON_UP },
216 { ACTION_STD_CANCEL, BUTTON_DOWN, BUTTON_NONE },
217 { ACTION_REC_NEWFILE, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
218 { ACTION_STD_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT},
219 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
220 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
221 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
222 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
223 { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
224 { ACTION_STD_PREV, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
225 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
226 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
227 { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
228 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
229 }; /* button_context_recscreen */
230 #endif
232 /** FM Radio Screen **/
233 static const struct button_mapping button_context_radio[] = {
234 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
235 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
236 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
237 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
238 { ACTION_FM_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
239 { ACTION_FM_STOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
240 { ACTION_FM_MODE, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
241 { ACTION_FM_EXIT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
242 { ACTION_FM_EXIT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
243 { ACTION_FM_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
244 { ACTION_FM_PRESET, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
245 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
246 }; /* button_context_radio */
248 static const struct button_mapping button_context_keyboard[] = {
249 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
250 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
251 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
252 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
254 { ACTION_KBD_CURSOR_LEFT, BUTTON_HOME|BUTTON_LEFT, BUTTON_NONE },
255 { ACTION_KBD_CURSOR_LEFT, BUTTON_HOME|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
256 { ACTION_KBD_CURSOR_RIGHT, BUTTON_HOME|BUTTON_RIGHT, BUTTON_NONE },
257 { ACTION_KBD_CURSOR_RIGHT, BUTTON_HOME|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
259 { ACTION_KBD_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
260 { ACTION_KBD_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
261 { ACTION_KBD_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
262 { ACTION_KBD_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
263 { ACTION_KBD_PAGE_FLIP, BUTTON_HOME|BUTTON_SELECT, BUTTON_HOME },
264 { ACTION_KBD_BACKSPACE, BUTTON_DOWN, BUTTON_NONE },
265 { ACTION_KBD_BACKSPACE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
266 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
267 { ACTION_KBD_DONE, BUTTON_UP, BUTTON_NONE },
268 { ACTION_KBD_ABORT, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE },
269 { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
271 LAST_ITEM_IN_LIST
272 }; /* button_context_keyboard */
274 static const struct button_mapping button_context_bmark[] = {
275 { ACTION_BMS_DELETE, BUTTON_HOME, BUTTON_NONE },
277 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
278 }; /* button_context_bmark */
280 #ifdef USB_ENABLE_HID
281 static const struct button_mapping button_context_usb_hid[] = {
282 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
283 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
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_SCROLL_BACK, BUTTON_NONE },
290 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
291 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_FWD, BUTTON_NONE },
292 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
293 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
294 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_UP|BUTTON_REL, BUTTON_UP },
295 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
296 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
297 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
299 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
300 }; /* button_context_usb_hid_mode_multimedia */
302 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
303 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_UP|BUTTON_REL, BUTTON_UP },
304 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
305 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
306 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
307 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
308 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
309 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
310 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
311 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
312 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
313 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
314 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
315 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
316 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
318 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
319 }; /* button_context_usb_hid_mode_presentation */
321 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
322 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
323 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
324 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
325 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
326 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_UP|BUTTON_REL, BUTTON_UP },
327 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
328 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
329 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
330 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
331 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_UP|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_UP|BUTTON_DOWN },
332 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
333 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
334 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
335 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
336 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
337 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
339 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
340 }; /* button_context_usb_hid_mode_browser */
342 #ifdef HAVE_USB_HID_MOUSE
343 static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
344 { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
345 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
346 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
347 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
348 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
349 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
350 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
351 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
352 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
353 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
354 { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_SELECT|BUTTON_UP, BUTTON_NONE },
355 { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_SELECT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
356 { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
357 { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_SELECT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
358 { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_SELECT|BUTTON_LEFT, BUTTON_NONE },
359 { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
360 { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_NONE },
361 { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
362 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_POWER, BUTTON_NONE },
363 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
364 { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_POWER|BUTTON_UP, BUTTON_NONE },
365 { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_POWER|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
366 { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_POWER|BUTTON_DOWN, BUTTON_NONE },
367 { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_POWER|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
368 { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE },
369 { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
370 { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
371 { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
372 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
373 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
374 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
375 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
377 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
378 }; /* button_context_usb_hid_mode_mouse */
379 #endif
380 #endif
382 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
383 const struct button_mapping* get_context_mapping(int context)
385 switch (context)
387 case CONTEXT_STD:
388 return button_context_standard;
390 case CONTEXT_WPS:
391 return button_context_wps;
393 case CONTEXT_LIST:
394 return button_context_list;
395 case CONTEXT_TREE:
396 case CONTEXT_MAINMENU:
397 if (global_settings.hold_lr_for_scroll_in_list)
398 return button_context_listtree_scroll_without_combo;
399 else
400 return button_context_listtree_scroll_with_combo;
401 case CONTEXT_CUSTOM|CONTEXT_TREE:
402 return button_context_tree;
404 case CONTEXT_SETTINGS:
405 return button_context_settings;
406 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
407 case CONTEXT_SETTINGS_COLOURCHOOSER:
408 case CONTEXT_SETTINGS_EQ:
409 case CONTEXT_SETTINGS_RECTRIGGER:
410 return button_context_settings_right_is_inc;
412 case CONTEXT_SETTINGS_TIME:
413 return button_context_settings_time;
415 case CONTEXT_YESNOSCREEN:
416 return button_context_yesno;
417 case CONTEXT_FM:
418 return button_context_radio;
419 case CONTEXT_BOOKMARKSCREEN:
420 return button_context_bmark;
421 case CONTEXT_QUICKSCREEN:
422 return button_context_quickscreen;
423 case CONTEXT_PITCHSCREEN:
424 return button_context_pitchscreen;
425 #ifdef HAVE_RECORDING
426 case CONTEXT_RECSCREEN:
427 return button_context_recscreen;
428 #endif
429 case CONTEXT_KEYBOARD:
430 case CONTEXT_MORSE_INPUT:
431 return button_context_keyboard;
432 #ifdef USB_ENABLE_HID
433 case CONTEXT_USB_HID:
434 return button_context_usb_hid;
435 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
436 return button_context_usb_hid_mode_multimedia;
437 case CONTEXT_USB_HID_MODE_PRESENTATION:
438 return button_context_usb_hid_mode_presentation;
439 case CONTEXT_USB_HID_MODE_BROWSER:
440 return button_context_usb_hid_mode_browser;
441 #ifdef HAVE_USB_HID_MOUSE
442 case CONTEXT_USB_HID_MODE_MOUSE:
443 return button_context_usb_hid_mode_mouse;
444 #endif
445 #endif
446 default:
447 return button_context_standard;
449 return button_context_standard;