Set list_need_reinit to false somewhere too.
[kugel-rb.git] / apps / keymaps / keymap-h10.c
blobad1ed64c5a4c9e870623c87e091d736fc5534c3f
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) Barry Wardell 2006
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 iriver H10 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_UP, BUTTON_NONE },
39 { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
40 { ACTION_STD_NEXT, BUTTON_SCROLL_DOWN, BUTTON_NONE },
41 { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
43 { ACTION_STD_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
44 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
45 { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
46 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
47 { ACTION_STD_QUICKSCREEN, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
49 /* TODO: this is a bit of a hack so that we can exit some debug screens
50 * (audio, tagcache, dircache, hwinfo, stack, ports). They don't like it
51 * when ACTION_STD_CANCEL has anything other than BUTTON_NONE for prereq.
53 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
55 LAST_ITEM_IN_LIST
56 }; /* button_context_standard */
58 static const struct button_mapping remote_button_context_standard[] = {
59 { ACTION_STD_PREV, BUTTON_RC_VOL_UP, BUTTON_NONE },
60 { ACTION_STD_PREVREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
61 { ACTION_STD_NEXT, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
62 { ACTION_STD_NEXTREPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
64 LAST_ITEM_IN_LIST
65 }; /* remote_button_context_standard */
67 static const struct button_mapping button_context_wps[] = {
68 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
69 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT,BUTTON_PLAY },
70 { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_REW},
71 { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
72 { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
73 { ACTION_WPS_SKIPNEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
74 { ACTION_WPS_SEEKFWD, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
75 { ACTION_WPS_STOPSEEK, BUTTON_FF|BUTTON_REL, BUTTON_FF|BUTTON_REPEAT },
77 { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_POWER|BUTTON_FF, BUTTON_POWER },
78 { ACTION_WPS_ABSETA_PREVDIR, BUTTON_POWER|BUTTON_REW, BUTTON_POWER },
79 { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_PLAY, BUTTON_POWER },
81 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
82 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE },
83 { ACTION_WPS_VOLUP, BUTTON_SCROLL_UP, BUTTON_NONE },
84 { ACTION_WPS_VOLUP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
86 { ACTION_WPS_BROWSE, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
87 { ACTION_WPS_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
88 { ACTION_WPS_QUICKSCREEN, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
89 { ACTION_WPS_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
90 { ACTION_WPS_VIEW_PLAYLIST, BUTTON_POWER|BUTTON_PLAY, BUTTON_NONE },
91 { ACTION_WPS_PITCHSCREEN, BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
92 { ACTION_WPS_ID3SCREEN, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY },
94 LAST_ITEM_IN_LIST
95 }; /* button_context_wps */
97 static const struct button_mapping remote_button_context_wps[] = {
98 { ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
99 { ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT,BUTTON_RC_PLAY },
100 { ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW},
101 { ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
102 { ACTION_WPS_STOPSEEK, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_REPEAT },
103 { ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
104 { ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
105 { ACTION_WPS_STOPSEEK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_REPEAT },
107 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
108 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
109 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
110 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
112 { ACTION_WPS_PITCHSCREEN, BUTTON_RC_PLAY|BUTTON_LEFT, BUTTON_RC_PLAY },
113 { ACTION_WPS_ID3SCREEN, BUTTON_RC_PLAY|BUTTON_RIGHT, BUTTON_RC_PLAY },
115 LAST_ITEM_IN_LIST
116 }; /* remote_button_context_wps */
118 static const struct button_mapping button_context_settings[] = {
119 { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE },
120 { ACTION_SETTINGS_INCREPEAT,BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
121 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE },
122 { ACTION_SETTINGS_DECREPEAT,BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
123 { ACTION_STD_PREV, BUTTON_FF, BUTTON_NONE },
124 { ACTION_STD_PREVREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
125 { ACTION_STD_NEXT, BUTTON_REW, BUTTON_NONE },
126 { ACTION_STD_NEXTREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
127 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
129 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
130 }; /* button_context_settings */
132 static const struct button_mapping button_context_list[] = {
133 { ACTION_LISTTREE_PGUP, BUTTON_REW|BUTTON_REL, BUTTON_REW },
134 { ACTION_LISTTREE_PGDOWN, BUTTON_FF|BUTTON_REL, BUTTON_FF },
136 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
137 }; /* button_context_list */
139 static const struct button_mapping remote_button_context_list[] = {
140 { ACTION_LISTTREE_PGUP, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
141 { ACTION_LISTTREE_PGDOWN, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
144 }; /* button_context_list */
146 static const struct button_mapping button_context_tree[] = {
147 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
148 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
150 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
151 }; /* button_context_tree */
153 static const struct button_mapping remote_button_context_tree[] = {
154 { ACTION_TREE_WPS, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
155 { ACTION_TREE_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
157 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
158 }; /* button_context_tree */
160 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
161 { ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
162 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
163 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
164 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
165 }; /* button_context_listtree_scroll_without_combo */
167 static const struct button_mapping remote_button_context_listtree_scroll_without_combo[] = {
168 { ACTION_TREE_ROOT_INIT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
169 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
170 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
171 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
172 }; /* button_context_listtree_scroll_without_combo */
174 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
175 { ACTION_LISTTREE_PGUP, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
176 { ACTION_LISTTREE_PGDOWN, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF },
177 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY, BUTTON_PLAY },
178 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_PLAY },
179 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY, BUTTON_REW|BUTTON_REL },
180 { ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_REW|BUTTON_PLAY },
181 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
182 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY, BUTTON_PLAY },
183 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_REL, BUTTON_FF|BUTTON_PLAY },
184 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY, BUTTON_FF|BUTTON_REL },
185 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
186 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
187 }; /* button_context_listtree_scroll_with_combo */
189 static const struct button_mapping remote_button_context_listtree_scroll_with_combo[] = {
190 { ACTION_LISTTREE_PGUP, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
191 { ACTION_LISTTREE_PGDOWN, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_RC_FF },
192 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_RC_PLAY, BUTTON_RC_PLAY },
193 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_RC_PLAY },
194 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_RC_PLAY, BUTTON_RC_REW|BUTTON_REL },
195 { ACTION_TREE_ROOT_INIT, BUTTON_RC_REW|BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_REW|BUTTON_RC_PLAY },
196 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
197 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_RC_PLAY, BUTTON_RC_PLAY },
198 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_RC_PLAY },
199 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_RC_PLAY, BUTTON_RC_FF|BUTTON_REL },
200 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
201 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
202 }; /* button_context_listtree_scroll_with_combo */
204 static const struct button_mapping button_context_yesno[] = {
205 { ACTION_YESNO_ACCEPT, BUTTON_RIGHT, BUTTON_NONE },
206 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
207 }; /* button_context_settings_yesno */
209 static const struct button_mapping button_context_quickscreen[] = {
210 { ACTION_QS_TOP, BUTTON_SCROLL_UP, BUTTON_NONE },
211 { ACTION_QS_TOP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
212 { ACTION_QS_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
213 { ACTION_QS_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
214 { ACTION_QS_LEFT, BUTTON_REW, BUTTON_NONE },
215 { ACTION_QS_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
216 { ACTION_QS_RIGHT, BUTTON_FF, BUTTON_NONE },
217 { ACTION_QS_RIGHT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
219 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
220 }; /* button_context_quickscreen */
222 static const struct button_mapping remote_button_context_quickscreen[] = {
223 { ACTION_QS_TOP, BUTTON_RC_VOL_UP, BUTTON_NONE },
224 { ACTION_QS_TOP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
225 { ACTION_QS_DOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
226 { ACTION_QS_DOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
227 { ACTION_QS_LEFT, BUTTON_RC_REW, BUTTON_NONE },
228 { ACTION_QS_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
229 { ACTION_QS_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
230 { ACTION_QS_RIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
232 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
233 }; /* button_context_quickscreen */
235 static const struct button_mapping button_context_settings_right_is_inc[] = {
236 { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE },
237 { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
238 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE },
239 { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE },
240 { ACTION_STD_PREV, BUTTON_REW, BUTTON_NONE },
241 { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
242 { ACTION_STD_NEXT, BUTTON_FF, BUTTON_NONE },
243 { ACTION_STD_NEXTREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
244 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
245 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
246 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
247 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
249 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
250 }; /* button_context_settings_right_is_inc */
252 static const struct button_mapping button_context_pitchscreen[] = {
253 { ACTION_PS_INC_SMALL, BUTTON_SCROLL_UP, BUTTON_NONE },
254 { ACTION_PS_INC_BIG, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
255 { ACTION_PS_DEC_SMALL, BUTTON_SCROLL_DOWN, BUTTON_NONE },
256 { ACTION_PS_DEC_BIG, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
257 { ACTION_PS_NUDGE_LEFT, BUTTON_REW, BUTTON_NONE },
258 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_REW|BUTTON_REL, BUTTON_NONE },
259 { ACTION_PS_NUDGE_RIGHT, BUTTON_FF, BUTTON_NONE },
260 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_FF|BUTTON_REL, BUTTON_NONE },
261 { ACTION_PS_TOGGLE_MODE, BUTTON_POWER, BUTTON_NONE },
262 { ACTION_PS_RESET, BUTTON_PLAY, BUTTON_NONE },
263 { ACTION_PS_EXIT, BUTTON_LEFT, BUTTON_NONE },
264 { ACTION_PS_SLOWER, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
265 { ACTION_PS_FASTER, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
267 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
268 }; /* button_context_pitchscreen */
270 static const struct button_mapping remote_button_context_pitchscreen[] = {
271 { ACTION_PS_INC_SMALL, BUTTON_RC_VOL_UP, BUTTON_NONE },
272 { ACTION_PS_INC_BIG, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
273 { ACTION_PS_DEC_SMALL, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
274 { ACTION_PS_DEC_BIG, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
275 { ACTION_PS_NUDGE_LEFT, BUTTON_RC_REW, BUTTON_NONE },
276 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_RC_REW|BUTTON_REL, BUTTON_NONE },
277 { ACTION_PS_NUDGE_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
278 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RC_FF|BUTTON_REL, BUTTON_NONE },
279 { ACTION_PS_RESET, BUTTON_RC_PLAY, BUTTON_NONE },
280 { ACTION_PS_SLOWER, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
281 { ACTION_PS_FASTER, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
283 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
284 }; /* button_context_pitchscreen */
286 static const struct button_mapping button_context_keyboard[] = {
287 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
288 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
289 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
290 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
291 { ACTION_KBD_SELECT, BUTTON_REW, BUTTON_NONE },
292 { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
293 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
294 { ACTION_KBD_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
295 { ACTION_KBD_UP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
296 { ACTION_KBD_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
297 { ACTION_KBD_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
298 { ACTION_KBD_MORSE_INPUT, BUTTON_REW|BUTTON_PLAY, BUTTON_NONE },
299 { ACTION_KBD_MORSE_SELECT, BUTTON_REW|BUTTON_REL, BUTTON_NONE },
301 LAST_ITEM_IN_LIST
302 }; /* button_context_keyboard */
304 static const struct button_mapping button_context_bmark[] = {
305 { ACTION_BMS_DELETE, BUTTON_REW, BUTTON_NONE },
306 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
307 }; /* button_context_bmark */
309 const struct button_mapping button_context_recscreen[] = {
310 { ACTION_REC_PAUSE, BUTTON_PLAY, BUTTON_NONE },
311 { ACTION_REC_NEWFILE, BUTTON_RIGHT, BUTTON_NONE },
312 { ACTION_STD_PREV, BUTTON_REW, BUTTON_NONE },
313 { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
314 { ACTION_STD_NEXT, BUTTON_FF, BUTTON_NONE },
315 { ACTION_STD_NEXTREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
317 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
318 }; /* button_context_recscreen */
320 static const struct button_mapping button_context_radio[] = {
321 { ACTION_FM_PRESET, BUTTON_RIGHT | BUTTON_REL, BUTTON_RIGHT },
322 { ACTION_FM_MENU, BUTTON_RIGHT | BUTTON_REPEAT, BUTTON_NONE },
323 { ACTION_FM_MODE, BUTTON_LEFT, BUTTON_NONE },
324 { ACTION_FM_STOP, BUTTON_PLAY | BUTTON_REPEAT, BUTTON_PLAY },
325 { ACTION_FM_EXIT, BUTTON_POWER, BUTTON_NONE },
326 { ACTION_FM_PLAY, BUTTON_PLAY | BUTTON_REL, BUTTON_PLAY },
327 { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE },
328 { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
329 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE },
330 { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
331 { ACTION_STD_PREV, BUTTON_REW, BUTTON_NONE },
332 { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
333 { ACTION_STD_NEXT, BUTTON_FF, BUTTON_NONE },
334 { ACTION_STD_NEXTREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
336 LAST_ITEM_IN_LIST
340 #ifdef HAVE_USBSTACK
341 static const struct button_mapping button_context_usb_hid[] = {
342 { ACTION_USB_HID_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
343 { ACTION_USB_HID_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
344 { ACTION_USB_HID_SKIPPREV, BUTTON_REW, BUTTON_NONE },
345 { ACTION_USB_HID_SKIPNEXT, BUTTON_FF, BUTTON_NONE },
346 { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_UP, BUTTON_NONE },
347 { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
348 { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
349 { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
350 { ACTION_USB_HID_MENU, BUTTON_POWER, BUTTON_NONE },
352 LAST_ITEM_IN_LIST
353 }; /* button_context_usb_hid */
355 static const struct button_mapping remote_button_context_usb_hid[] = {
356 { ACTION_USB_HID_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
357 { ACTION_USB_HID_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
358 { ACTION_USB_HID_SKIPPREV, BUTTON_RC_REW, BUTTON_NONE },
359 { ACTION_USB_HID_SKIPNEXT, BUTTON_RC_FF, BUTTON_NONE },
360 { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
361 { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
362 { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
363 { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
365 LAST_ITEM_IN_LIST
366 }; /* remote_button_context_usb_hid */
367 #endif
369 static const struct button_mapping* get_context_mapping_remote( int context )
371 context ^= CONTEXT_REMOTE;
373 switch (context)
375 case CONTEXT_STD:
376 case CONTEXT_MAINMENU:
377 return remote_button_context_standard;
379 case CONTEXT_WPS:
380 return remote_button_context_wps;
382 case CONTEXT_LIST:
383 return remote_button_context_list;
384 case CONTEXT_TREE:
385 if (global_settings.hold_lr_for_scroll_in_list)
386 return remote_button_context_listtree_scroll_without_combo;
387 else
388 return remote_button_context_listtree_scroll_with_combo;
389 case CONTEXT_CUSTOM|CONTEXT_TREE:
390 return remote_button_context_tree;
392 case CONTEXT_QUICKSCREEN:
393 return remote_button_context_quickscreen;
394 case CONTEXT_PITCHSCREEN:
395 return remote_button_context_pitchscreen;
396 case CONTEXT_RECSCREEN:
397 return button_context_recscreen;
398 #ifdef HAVE_USBSTACK
399 case CONTEXT_USB_HID:
400 return remote_button_context_usb_hid;
401 #endif
403 default:
404 return remote_button_context_standard;
408 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
409 const struct button_mapping* get_context_mapping(int context)
411 if (context&CONTEXT_REMOTE)
412 return get_context_mapping_remote(context);
414 switch (context)
416 case CONTEXT_STD:
417 return button_context_standard;
419 case CONTEXT_WPS:
420 return button_context_wps;
422 case CONTEXT_LIST:
423 return button_context_list;
424 case CONTEXT_TREE:
425 case CONTEXT_MAINMENU:
426 if (global_settings.hold_lr_for_scroll_in_list)
427 return button_context_listtree_scroll_without_combo;
428 else
429 return button_context_listtree_scroll_with_combo;
430 case CONTEXT_CUSTOM|CONTEXT_TREE:
431 return button_context_tree;
433 case CONTEXT_SETTINGS:
434 return button_context_settings;
435 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
436 case CONTEXT_SETTINGS_COLOURCHOOSER:
437 case CONTEXT_SETTINGS_EQ:
438 case CONTEXT_SETTINGS_TIME:
439 case CONTEXT_SETTINGS_RECTRIGGER:
440 return button_context_settings_right_is_inc;
442 case CONTEXT_YESNOSCREEN:
443 return button_context_yesno;
444 case CONTEXT_BOOKMARKSCREEN:
445 return button_context_bmark;
446 case CONTEXT_QUICKSCREEN:
447 return button_context_quickscreen;
448 case CONTEXT_PITCHSCREEN:
449 return button_context_pitchscreen;
450 case CONTEXT_KEYBOARD:
451 return button_context_keyboard;
452 case CONTEXT_RECSCREEN:
453 return button_context_recscreen;
454 case CONTEXT_FM:
455 return button_context_radio;
456 #ifdef HAVE_USBSTACK
457 case CONTEXT_USB_HID:
458 return button_context_usb_hid;
459 #endif
460 default:
461 return button_context_standard;
463 return button_context_standard;