Fix corrupted metadata on manual track change on hwcodec.
[maemo-rb.git] / apps / keymaps / keymap-x5.c
blob235a6c6c741e88c440aea5cdca49f227df91ce8c
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 /* *
23 * Button Code Definitions for iaudio m5/x5 targets
25 * Note that button combos are incompatible on this targets, except for those
26 * with the power button. But these are discouraged because the the power button
27 * also does the hardware poweroff
29 * \TODO test!
32 #include "config.h"
33 #include "action.h"
34 #include "button.h"
35 #include "settings.h"
37 /* CONTEXT_CUSTOM's used in this file...
39 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
44 /** Keep things alphabetized for easy reference but standard contexts can
45 ** be first and sub-alphebetized.
46 **/
48 /** Standard Button Contexts **/
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_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
56 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
57 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
58 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
59 { ACTION_STD_OK, BUTTON_PLAY, BUTTON_NONE },
60 { ACTION_STD_MENU, BUTTON_REC|BUTTON_REL, BUTTON_REC },
61 { ACTION_STD_QUICKSCREEN,BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
62 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
64 LAST_ITEM_IN_LIST
65 }; /* button_context_standard */
67 static const struct button_mapping remote_button_context_standard[] = {
68 { ACTION_STD_PREV, BUTTON_RC_VOL_UP, BUTTON_NONE },
69 { ACTION_STD_PREVREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
70 { ACTION_STD_NEXT, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
71 { ACTION_STD_NEXTREPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
73 { ACTION_STD_CONTEXT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
74 { ACTION_STD_CANCEL, BUTTON_RC_REW, BUTTON_NONE },
75 { ACTION_STD_OK, BUTTON_RC_FF, BUTTON_NONE },
76 { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
77 { ACTION_STD_MENU, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
78 { ACTION_STD_QUICKSCREEN, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
80 LAST_ITEM_IN_LIST
81 }; /* remote_button_context_standard */
83 /** Bookmark Screen **/
84 static const struct button_mapping button_context_bmark[] = {
85 { ACTION_BMS_DELETE, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
87 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
88 }; /* button_context_settings_bmark */
90 static const struct button_mapping remote_button_context_bmark[] = {
91 { ACTION_BMS_DELETE, BUTTON_RC_REC|BUTTON_REPEAT, BUTTON_RC_REC },
93 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
94 }; /* button_context_settings_bmark */
96 /** FM Radio Screen **/
97 static const struct button_mapping button_context_radio[] = {
98 { ACTION_FM_MENU, BUTTON_SELECT | BUTTON_REPEAT, BUTTON_NONE },
99 { ACTION_FM_PRESET, BUTTON_SELECT | BUTTON_REL, BUTTON_SELECT },
100 { ACTION_FM_STOP, BUTTON_POWER, BUTTON_NONE },
101 { ACTION_FM_MODE, BUTTON_PLAY | BUTTON_REPEAT, BUTTON_PLAY },
102 { ACTION_FM_EXIT, BUTTON_REC | BUTTON_REL, BUTTON_REC },
103 { ACTION_FM_PLAY, BUTTON_PLAY | BUTTON_REL, BUTTON_PLAY },
104 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
105 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
106 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
108 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
109 }; /* button_context_radio */
111 static const struct button_mapping remote_button_context_radio[] = {
112 { ACTION_FM_MENU, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
113 { ACTION_FM_PRESET, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE },
114 { ACTION_FM_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
115 { ACTION_FM_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
116 { ACTION_FM_MODE, BUTTON_RC_REC|BUTTON_REPEAT, BUTTON_RC_REC },
117 { ACTION_FM_EXIT, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
118 { ACTION_STD_PREVREPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
119 { ACTION_STD_NEXT, BUTTON_RC_FF, BUTTON_NONE },
120 { ACTION_STD_NEXTREPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
122 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
123 }; /* remote_button_context_radio */
125 /** Keyboard **/
126 static const struct button_mapping button_context_keyboard[] = {
127 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
128 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
129 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
130 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
131 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
132 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
133 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
134 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
135 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
136 { ACTION_KBD_DONE, BUTTON_PLAY, BUTTON_NONE },
137 { ACTION_KBD_ABORT, BUTTON_REC, BUTTON_NONE },
138 { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
140 LAST_ITEM_IN_LIST
141 }; /* button_context_keyboard */
143 static const struct button_mapping remote_button_context_keyboard[] = {
144 { ACTION_KBD_LEFT, BUTTON_RC_REW, BUTTON_NONE },
145 { ACTION_KBD_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
146 { ACTION_KBD_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
147 { ACTION_KBD_RIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
148 { ACTION_KBD_UP, BUTTON_RC_VOL_UP, BUTTON_NONE },
149 { ACTION_KBD_UP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
150 { ACTION_KBD_DOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
151 { ACTION_KBD_DOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
152 { ACTION_KBD_PAGE_FLIP, BUTTON_RC_MODE, BUTTON_NONE },
153 { ACTION_KBD_SELECT, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
154 { ACTION_KBD_DONE, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
155 { ACTION_KBD_ABORT, BUTTON_RC_REC, BUTTON_NONE },
157 LAST_ITEM_IN_LIST
158 }; /* remote_button_context_keyboard */
160 /** Pitchscreen **/
161 static const struct button_mapping button_context_pitchscreen[] = {
162 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
163 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
164 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
165 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
166 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
167 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
168 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
169 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
170 { ACTION_PS_TOGGLE_MODE, BUTTON_SELECT, BUTTON_NONE },
171 { ACTION_PS_RESET, BUTTON_POWER, BUTTON_NONE },
172 { ACTION_PS_EXIT, BUTTON_PLAY, BUTTON_NONE },
173 { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
174 { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
176 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
177 }; /* button_context_pitchscreen */
179 static const struct button_mapping remote_button_context_pitchscreen[] = {
180 { ACTION_PS_INC_SMALL, BUTTON_RC_VOL_UP, BUTTON_NONE },
181 { ACTION_PS_INC_BIG, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
182 { ACTION_PS_DEC_SMALL, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
183 { ACTION_PS_DEC_BIG, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
184 { ACTION_PS_NUDGE_LEFT, BUTTON_RC_REW, BUTTON_NONE },
185 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_RC_REW|BUTTON_REL, BUTTON_NONE },
186 { ACTION_PS_NUDGE_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
187 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RC_FF|BUTTON_REL, BUTTON_NONE },
188 { ACTION_PS_TOGGLE_MODE, BUTTON_RC_MODE, BUTTON_NONE },
189 { ACTION_PS_RESET, BUTTON_RC_REC, BUTTON_NONE },
190 { ACTION_PS_EXIT, BUTTON_RC_PLAY, BUTTON_NONE },
191 { ACTION_PS_SLOWER, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
192 { ACTION_PS_FASTER, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
194 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
195 }; /* remote_button_context_pitchscreen */
197 /** Quickscreen **/
198 static const struct button_mapping button_context_quickscreen[] = {
199 { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE },
200 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
201 { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
202 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
203 { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
204 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
205 { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
206 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
207 { ACTION_STD_CANCEL, BUTTON_REC, BUTTON_NONE },
209 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
210 }; /* button_context_quickscreen */
212 static const struct button_mapping remote_button_context_quickscreen[] = {
213 { ACTION_QS_TOP, BUTTON_RC_VOL_UP, BUTTON_NONE },
214 { ACTION_QS_TOP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
215 { ACTION_QS_DOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
216 { ACTION_QS_DOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
217 { ACTION_QS_LEFT, BUTTON_RC_REW, BUTTON_NONE },
218 { ACTION_QS_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
219 { ACTION_QS_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
220 { ACTION_QS_RIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
221 { ACTION_STD_CANCEL, BUTTON_RC_REC, BUTTON_NONE },
223 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
224 }; /* remote_button_context_quickscreen */
226 /** Recording Screen **/
227 static const struct button_mapping button_context_recscreen[] = {
228 { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
229 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
230 { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
231 { ACTION_STD_MENU, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
232 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
233 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
234 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
235 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
237 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
238 }; /* button_context_recscreen */
240 static const struct button_mapping remote_button_context_recscreen[] = {
241 { ACTION_REC_PAUSE, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
242 { ACTION_STD_CANCEL, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
243 { ACTION_REC_NEWFILE, BUTTON_RC_REC, BUTTON_NONE },
244 { ACTION_STD_MENU, BUTTON_RC_MENU, BUTTON_NONE },
245 { ACTION_SETTINGS_INC, BUTTON_RC_FF, BUTTON_NONE },
246 { ACTION_SETTINGS_INCREPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
247 { ACTION_SETTINGS_DEC, BUTTON_RC_REW, BUTTON_NONE },
248 { ACTION_SETTINGS_DECREPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
250 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
251 }; /* remote_button_context_recscreen */
253 /** Settings - General Mappings **/
254 static const struct button_mapping button_context_settings[] = {
255 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
256 { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
257 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
258 { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
259 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
260 { ACTION_STD_CANCEL, BUTTON_REC, BUTTON_NONE },
262 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
263 }; /* button_context_settings */
265 static const struct button_mapping remote_button_context_settings[] = {
266 { ACTION_SETTINGS_INC, BUTTON_RC_VOL_UP, BUTTON_NONE },
267 { ACTION_SETTINGS_INCREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
268 { ACTION_SETTINGS_DEC, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
269 { ACTION_SETTINGS_DECREPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
270 { ACTION_STD_PREV, BUTTON_RC_REW, BUTTON_NONE },
271 { ACTION_STD_CANCEL, BUTTON_RC_REC, BUTTON_NONE },
273 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
274 }; /* remote_button_context_settings */
276 /** Settings - Using Sliders **/
277 static const struct button_mapping button_context_settings_r_is_inc[] = {
278 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
279 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
280 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
281 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
282 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
283 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
284 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
285 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
286 { ACTION_STD_CANCEL, BUTTON_REC, BUTTON_NONE },
288 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
289 }; /* button_context_settings_r_is_inc */
291 static const struct button_mapping remote_button_context_settings_r_is_inc[] = {
292 { ACTION_SETTINGS_INC, BUTTON_RC_FF, BUTTON_NONE },
293 { ACTION_SETTINGS_INCREPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
294 { ACTION_SETTINGS_DEC, BUTTON_RC_REW, BUTTON_NONE },
295 { ACTION_SETTINGS_DECREPEAT, BUTTON_RC_REW|BUTTON_REPEAT,BUTTON_NONE },
296 { ACTION_STD_CANCEL, BUTTON_RC_REC, BUTTON_NONE },
298 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
299 }; /* remote_button_context_settings_r_is_inc */
301 /** Settings - Time/Date **/
302 static const struct button_mapping button_context_settings_time[] = {
303 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
304 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
305 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
307 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
308 }; /* button_context_settings */
310 /** Tree **/
311 static const struct button_mapping button_context_tree[] = {
312 { ACTION_NONE, BUTTON_PLAY, BUTTON_NONE },
313 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
314 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
316 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
317 }; /* button_context_tree */
319 static const struct button_mapping remote_button_context_tree[] = {
320 { ACTION_NONE, BUTTON_RC_PLAY, BUTTON_NONE },
321 { ACTION_TREE_WPS, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
322 { ACTION_TREE_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
324 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
325 }; /* remote_button_context_tree */
327 static const struct button_mapping button_context_tree_scroll_lr[] = {
328 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
329 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
330 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
331 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
332 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
333 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
334 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
336 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
337 }; /* button_context_tree_scroll_lr */
339 static const struct button_mapping remote_button_context_tree_scroll_lr[] = {
340 { ACTION_NONE, BUTTON_RC_REW, BUTTON_NONE },
341 { ACTION_STD_CANCEL, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
342 { ACTION_TREE_ROOT_INIT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
343 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
344 { ACTION_NONE, BUTTON_RC_FF, BUTTON_NONE },
345 { ACTION_STD_OK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
346 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
348 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
349 }; /* remote_button_context_tree_scroll_lr */
351 /** While-Playing Screen (WPS) **/
352 static const struct button_mapping button_context_wps[] = {
353 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
354 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
355 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
356 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
357 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
358 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
359 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
360 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
362 { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
363 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
364 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
365 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
367 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
368 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
369 { ACTION_WPS_MENU, BUTTON_REC|BUTTON_REL, BUTTON_REC },
370 { ACTION_WPS_QUICKSCREEN, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
372 * Can't really do combos on M5
373 * { ACTION_WPS_VIEW_PLAYLIST, BUTTON_REC|BUTTON_SELECT, BUTTON_NONE },
376 LAST_ITEM_IN_LIST
377 }; /* button_context_wps */
379 static const struct button_mapping remote_button_context_wps[] = {
380 { ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
381 { ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
382 { ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
383 { ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
384 { ACTION_WPS_STOPSEEK, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_REPEAT },
385 { ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
386 { ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
387 { ACTION_WPS_STOPSEEK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_REPEAT },
389 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
390 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
391 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
392 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
394 { ACTION_WPS_BROWSE, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE },
395 { ACTION_WPS_CONTEXT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
396 { ACTION_WPS_MENU, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
397 { ACTION_WPS_QUICKSCREEN, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
399 LAST_ITEM_IN_LIST
400 }; /* remote_button_context_wps */
402 /** Yes/No Screen **/
403 static const struct button_mapping button_context_yesnoscreen[] = {
404 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
405 LAST_ITEM_IN_LIST
406 }; /* button_context_settings_yesnoscreen */
408 static const struct button_mapping remote_button_context_yesnoscreen[] = {
409 { ACTION_YESNO_ACCEPT, BUTTON_RC_PLAY, BUTTON_NONE },
410 LAST_ITEM_IN_LIST
411 }; /* remote_button_context_settings_yesnoscreen */
414 static const struct button_mapping* get_context_mapping_remote( int context )
416 context ^= CONTEXT_REMOTE;
418 switch (context)
420 /* anything that uses remote_button_context_standard */
421 default:
422 return remote_button_context_standard;
424 /* remote contexts with special mapping */
425 case CONTEXT_BOOKMARKSCREEN:
426 return remote_button_context_bmark;
428 case CONTEXT_FM:
429 return remote_button_context_radio;
431 case CONTEXT_KEYBOARD:
432 case CONTEXT_MORSE_INPUT:
433 return remote_button_context_keyboard;
435 case CONTEXT_PITCHSCREEN:
436 return remote_button_context_pitchscreen;
438 case CONTEXT_QUICKSCREEN:
439 return remote_button_context_quickscreen;
441 case CONTEXT_RECSCREEN:
442 return remote_button_context_recscreen;
444 case CONTEXT_SETTINGS:
445 return remote_button_context_settings;
447 case CONTEXT_SETTINGS_COLOURCHOOSER:
448 case CONTEXT_SETTINGS_EQ:
449 case CONTEXT_SETTINGS_TIME:
450 return remote_button_context_settings_r_is_inc;
452 case CONTEXT_TREE:
453 case CONTEXT_MAINMENU:
454 if (global_settings.hold_lr_for_scroll_in_list)
455 return remote_button_context_tree_scroll_lr;
456 /* else fall through to CONTEXT_TREE|CONTEXT_CUSTOM */
457 case CONTEXT_TREE|CONTEXT_CUSTOM:
458 return remote_button_context_tree;
460 case CONTEXT_WPS:
461 return remote_button_context_wps;
463 case CONTEXT_YESNOSCREEN:
464 return remote_button_context_yesnoscreen;
468 const struct button_mapping* get_context_mapping( int context )
470 if (context & CONTEXT_REMOTE)
471 return get_context_mapping_remote(context);
473 switch( context )
475 /* anything that uses button_context_standard */
476 case CONTEXT_LIST:
477 case CONTEXT_STD:
478 default:
479 return button_context_standard;
481 /* contexts with special mapping */
482 case CONTEXT_BOOKMARKSCREEN:
483 return button_context_bmark;
485 case CONTEXT_FM:
486 return button_context_radio;
488 case CONTEXT_KEYBOARD:
489 case CONTEXT_MORSE_INPUT:
490 return button_context_keyboard;
492 case CONTEXT_PITCHSCREEN:
493 return button_context_pitchscreen;
495 case CONTEXT_QUICKSCREEN:
496 return button_context_quickscreen;
498 case CONTEXT_RECSCREEN:
499 return button_context_recscreen;
501 case CONTEXT_SETTINGS:
502 return button_context_settings;
504 case CONTEXT_SETTINGS_COLOURCHOOSER:
505 case CONTEXT_SETTINGS_EQ:
506 case CONTEXT_SETTINGS_RECTRIGGER:
507 return button_context_settings_r_is_inc;
509 case CONTEXT_SETTINGS_TIME:
510 return button_context_settings_time;
512 case CONTEXT_TREE:
513 case CONTEXT_MAINMENU:
514 if (global_settings.hold_lr_for_scroll_in_list)
515 return button_context_tree_scroll_lr;
516 /* else fall through to CONTEXT_TREE|CONTEXT_CUSTOM */
517 case CONTEXT_TREE|CONTEXT_CUSTOM:
518 return button_context_tree;
520 case CONTEXT_WPS:
521 return button_context_wps;
523 case CONTEXT_YESNOSCREEN:
524 return button_context_yesnoscreen;