fix FS#11784 - classic_statusbar.sbs needed alignemtn fixing to show the whole time
[maemo-rb.git] / apps / keymaps / keymap-ipod.c
bloba438926dd9015890bccb87f6e79a178841abdab7
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 ipod target */
24 #include "config.h"
25 #include "action.h"
26 #include "button.h"
27 #include "settings.h"
30 * The format of the list is as follows
31 * { Action Code, Button code, Prereq button code }
32 * if there's no need to check the previous button's value, use BUTTON_NONE
33 * Insert LAST_ITEM_IN_LIST at the end of each mapping
36 /* CONTEXT_CUSTOM's used in this file...
38 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
43 static const struct button_mapping button_context_standard[] = {
44 { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
45 { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
46 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
47 { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
48 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
49 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
50 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
51 { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
52 { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
53 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
54 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
56 LAST_ITEM_IN_LIST
57 }; /* button_context_standard */
59 static const struct button_mapping button_context_tree[] = {
60 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
61 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
62 { ACTION_TREE_HOTKEY, BUTTON_SELECT|BUTTON_PLAY, BUTTON_NONE },
64 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
65 }; /* button_context_tree */
67 static const struct button_mapping button_context_tree_scroll_lr[] = {
68 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
69 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
70 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
71 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
72 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
73 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
74 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
75 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
76 }; /* button_context_tree_scroll_lr */
78 static const struct button_mapping button_context_wps[] = {
79 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
80 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
81 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
82 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
83 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
84 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
85 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
86 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
87 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
88 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
89 { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE },
90 { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
91 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
92 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
93 { ACTION_WPS_HOTKEY, BUTTON_SELECT|BUTTON_PLAY, BUTTON_NONE },
94 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
95 { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
97 LAST_ITEM_IN_LIST,
98 }; /* button_context_wps */
100 static const struct button_mapping button_context_settings[] = {
101 { ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
102 { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
103 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
104 { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
105 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
106 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
107 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
108 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
109 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
110 { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
112 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
113 }; /* button_context_settings */
115 static const struct button_mapping button_context_yesno[] = {
116 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
117 LAST_ITEM_IN_LIST
118 }; /* button_context_yesno */
120 static const struct button_mapping button_context_bmark[] = {
121 { ACTION_BMS_DELETE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
122 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
123 }; /* button_context_bmark */
125 static const struct button_mapping button_context_quickscreen[] = {
126 { ACTION_QS_TOP, BUTTON_MENU, BUTTON_NONE },
127 { ACTION_QS_TOP, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
128 { ACTION_QS_DOWN, BUTTON_PLAY, BUTTON_NONE },
129 { ACTION_QS_DOWN, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
130 { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
131 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
132 { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
133 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
134 { ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE },
136 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
137 }; /* button_context_quickscreen */
139 static const struct button_mapping button_context_pitchscreen[] = {
140 { ACTION_PS_INC_SMALL, BUTTON_SCROLL_FWD, BUTTON_NONE },
141 { ACTION_PS_INC_BIG, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
142 { ACTION_PS_DEC_SMALL, BUTTON_SCROLL_BACK, BUTTON_NONE },
143 { ACTION_PS_DEC_BIG, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
144 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
145 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
146 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
147 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
148 { ACTION_PS_TOGGLE_MODE, BUTTON_PLAY, BUTTON_NONE },
149 { ACTION_PS_RESET, BUTTON_MENU, BUTTON_NONE },
150 { ACTION_PS_EXIT, BUTTON_SELECT, BUTTON_NONE },
151 { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
152 { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
154 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
155 }; /* button_context_pitchscreen */
157 static const struct button_mapping button_context_keyboard[] = {
158 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
159 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
160 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
161 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
162 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
163 { ACTION_KBD_DONE, BUTTON_PLAY, BUTTON_NONE },
164 { ACTION_KBD_ABORT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
165 { ACTION_KBD_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
166 { ACTION_KBD_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
167 { ACTION_KBD_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
168 { ACTION_KBD_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
169 { ACTION_KBD_MORSE_INPUT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
170 { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
171 LAST_ITEM_IN_LIST
172 }; /* button_context_keyboard */
174 #ifdef HAVE_RECORDING
175 const struct button_mapping button_context_recscreen[] = {
177 { ACTION_REC_NEWFILE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
178 { ACTION_STD_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
179 { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
180 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
181 { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
182 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
183 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
184 { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
185 { ACTION_STD_PREV, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
186 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
187 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
188 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
189 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
191 LAST_ITEM_IN_LIST
192 }; /* button_context_recscreen */
193 #endif
195 /** FM Radio Screen **/
196 #if CONFIG_TUNER
197 static const struct button_mapping button_context_radio[] = {
198 { ACTION_FM_MENU, BUTTON_SELECT | BUTTON_REPEAT, BUTTON_NONE },
199 { ACTION_FM_STOP, BUTTON_PLAY | BUTTON_REPEAT, BUTTON_PLAY },
200 { ACTION_FM_MODE, BUTTON_SELECT, BUTTON_NONE },
201 { ACTION_FM_EXIT, BUTTON_MENU | BUTTON_REL, BUTTON_MENU },
202 { ACTION_FM_PLAY, BUTTON_PLAY | BUTTON_REL, BUTTON_PLAY },
203 { ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
204 { ACTION_SETTINGS_INCREPEAT,BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
205 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
206 { ACTION_SETTINGS_DECREPEAT,BUTTON_SCROLL_BACK|BUTTON_REPEAT,BUTTON_NONE },
207 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
208 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
209 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
210 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
211 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
212 }; /* button_context_radio */
213 #endif
215 #ifdef USB_ENABLE_HID
216 static const struct button_mapping button_context_usb_hid[] = {
217 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REL, BUTTON_SELECT|BUTTON_RIGHT },
218 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_SELECT|BUTTON_RIGHT },
219 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REL, BUTTON_SELECT|BUTTON_LEFT },
220 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_SELECT|BUTTON_LEFT },
222 LAST_ITEM_IN_LIST
223 }; /* button_context_usb_hid */
225 static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
226 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
227 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
228 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_FWD, BUTTON_NONE },
229 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
230 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
231 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
232 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
233 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
234 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
235 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
237 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
238 }; /* button_context_usb_hid_mode_multimedia */
240 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
241 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
242 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
243 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
244 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
245 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
246 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
247 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
248 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
249 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
250 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
251 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
252 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
253 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
254 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
256 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
257 }; /* button_context_usb_hid_mode_presentation */
259 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
260 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
261 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
262 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
263 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
264 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
265 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
266 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
267 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
268 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_PLAY|BUTTON_MENU|BUTTON_REPEAT, BUTTON_PLAY|BUTTON_MENU },
269 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
270 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
271 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_SELECT|BUTTON_MENU|BUTTON_REPEAT, BUTTON_SELECT|BUTTON_MENU },
272 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
273 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
274 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_SELECT|BUTTON_PLAY },
276 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
277 }; /* button_context_usb_hid_mode_browser */
279 #ifdef HAVE_USB_HID_MOUSE
280 static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
281 { ACTION_USB_HID_MOUSE_UP, BUTTON_MENU, BUTTON_NONE },
282 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
283 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_PLAY, BUTTON_NONE },
284 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
285 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
286 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
287 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
288 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
289 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
290 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
291 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
292 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
293 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
294 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
296 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
297 }; /* button_context_usb_hid_mode_mouse */
298 #endif
299 #endif
301 #if BUTTON_REMOTE != 0
302 /*****************************************************************************
303 * Remote control mappings
304 *****************************************************************************/
306 static const struct button_mapping remote_button_context_standard[] = {
307 { ACTION_STD_PREV, BUTTON_RC_LEFT, BUTTON_NONE },
308 { ACTION_STD_NEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
309 { ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
310 { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
312 LAST_ITEM_IN_LIST
313 }; /* remote_button_context_standard */
315 static const struct button_mapping remote_button_context_wps[] = {
316 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
317 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
318 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
319 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
321 { ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
322 { ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
323 { ACTION_WPS_SKIPNEXT, BUTTON_RC_RIGHT|BUTTON_REL, BUTTON_RC_RIGHT },
324 { ACTION_WPS_SEEKFWD, BUTTON_RC_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
325 { ACTION_WPS_STOPSEEK, BUTTON_RC_RIGHT|BUTTON_REL, BUTTON_RC_RIGHT|BUTTON_REPEAT },
326 { ACTION_WPS_SKIPPREV, BUTTON_RC_LEFT|BUTTON_REL, BUTTON_RC_LEFT },
327 { ACTION_WPS_SEEKBACK, BUTTON_RC_LEFT|BUTTON_REPEAT, BUTTON_NONE },
328 { ACTION_WPS_STOPSEEK, BUTTON_RC_LEFT|BUTTON_REL, BUTTON_RC_LEFT|BUTTON_REPEAT },
330 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
331 }; /* remote_button_context_wps */
333 static const struct button_mapping remote_button_context_tree[] = {
334 { ACTION_TREE_WPS, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
335 { ACTION_TREE_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
337 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
338 }; /* remote_button_context_tree */
340 #if CONFIG_TUNER
341 static const struct button_mapping remote_button_context_radio[] = {
342 { ACTION_FM_STOP, BUTTON_RC_PLAY | BUTTON_REPEAT, BUTTON_NONE },
343 { ACTION_FM_PLAY, BUTTON_RC_PLAY | BUTTON_REL, BUTTON_RC_PLAY },
344 { ACTION_STD_NEXT, BUTTON_RC_RIGHT|BUTTON_REL, BUTTON_RC_RIGHT },
345 { ACTION_STD_NEXTREPEAT, BUTTON_RC_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
346 { ACTION_STD_PREV, BUTTON_RC_LEFT|BUTTON_REL, BUTTON_RC_LEFT },
347 { ACTION_STD_PREVREPEAT, BUTTON_RC_LEFT|BUTTON_REPEAT, BUTTON_NONE },
349 LAST_ITEM_IN_LIST
350 }; /* remote_button_context_radio */
351 #endif
353 static const struct button_mapping* get_context_mapping_remote( int context )
355 context ^= CONTEXT_REMOTE;
357 switch (context)
359 case CONTEXT_WPS:
360 return remote_button_context_wps;
361 case CONTEXT_TREE:
362 case CONTEXT_CUSTOM|CONTEXT_TREE:
363 return remote_button_context_tree;
365 #if CONFIG_TUNER
366 case CONTEXT_FM:
367 return remote_button_context_radio;
368 #endif
369 default:
370 return remote_button_context_standard;
373 #endif /* BUTTON_REMOTE != 0 */
375 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
376 const struct button_mapping* get_context_mapping(int context)
378 #if BUTTON_REMOTE != 0
379 if (context&CONTEXT_REMOTE)
380 return get_context_mapping_remote(context);
381 #endif
383 switch (context)
385 case CONTEXT_STD:
386 return button_context_standard;
387 case CONTEXT_WPS:
388 return button_context_wps;
390 case CONTEXT_TREE:
391 case CONTEXT_MAINMENU:
392 if (global_settings.hold_lr_for_scroll_in_list)
393 return button_context_tree_scroll_lr;
394 /* else fall through to CUSTOM|CONTEXT_TREE */
395 case CONTEXT_CUSTOM|CONTEXT_TREE:
396 return button_context_tree;
398 case CONTEXT_LIST:
399 return button_context_standard;
401 case CONTEXT_SETTINGS_EQ:
402 case CONTEXT_SETTINGS_COLOURCHOOSER:
403 case CONTEXT_SETTINGS_TIME:
404 case CONTEXT_SETTINGS:
405 case CONTEXT_SETTINGS_RECTRIGGER:
406 return button_context_settings;
407 case CONTEXT_YESNOSCREEN:
408 return button_context_yesno;
409 case CONTEXT_BOOKMARKSCREEN:
410 return button_context_bmark;
411 case CONTEXT_QUICKSCREEN:
412 return button_context_quickscreen;
413 case CONTEXT_PITCHSCREEN:
414 return button_context_pitchscreen;
415 case CONTEXT_KEYBOARD:
416 case CONTEXT_MORSE_INPUT:
417 return button_context_keyboard;
418 #ifdef HAVE_RECORDING
419 case CONTEXT_RECSCREEN:
420 return button_context_recscreen;
421 #endif
422 #if CONFIG_TUNER
423 case CONTEXT_FM:
424 return button_context_radio;
425 #endif
426 #ifdef USB_ENABLE_HID
427 case CONTEXT_USB_HID:
428 return button_context_usb_hid;
429 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
430 return button_context_usb_hid_mode_multimedia;
431 case CONTEXT_USB_HID_MODE_PRESENTATION:
432 return button_context_usb_hid_mode_presentation;
433 case CONTEXT_USB_HID_MODE_BROWSER:
434 return button_context_usb_hid_mode_browser;
435 #ifdef HAVE_USB_HID_MOUSE
436 case CONTEXT_USB_HID_MODE_MOUSE:
437 return button_context_usb_hid_mode_mouse;
438 #endif
439 #endif
440 default:
441 return button_context_standard;
443 return button_context_standard;