blob: efcc3ad81ba7920ac600d7ed510f03cd21874832 [file] [log] [blame]
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
Michael Sevakis55e899c2006-10-12 18:13:23 +00008 * $Id$
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +00009 *
10 * Copyright (C) 2006 Jonathan Gordon
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * 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.
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22/* *
23 * Button Code Definitions for iaudio x5 targets
24 *
25 * \TODO test!
26 */
27
28#include "config.h"
29#include "action.h"
30#include "button.h"
31#include "settings.h"
32
33/* CONTEXT_CUSTOM's used in this file...
34
Jonathan Gordond12f81d2006-08-21 07:03:15 +000035CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000036
37
38*/
39
Michael Sevakis6c9b1d42006-10-12 17:49:46 +000040/** Keep things alphabetized for easy reference but standard contexts can
41 ** be first and sub-alphebetized.
42 **/
43
44/** Standard Button Contexts **/
Jens Arnolda0f31132006-12-12 07:55:17 +000045static const struct button_mapping button_context_standard[] = {
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000046 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
47 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
48 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
49 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +000050
51 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000052 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
53 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
54 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
55 { ACTION_STD_OK, BUTTON_PLAY, BUTTON_NONE },
56 { ACTION_STD_MENU, BUTTON_REC|BUTTON_REL, BUTTON_REC },
57 { ACTION_STD_QUICKSCREEN,BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
58 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
59
60 LAST_ITEM_IN_LIST
Rani Hodcbe44272006-09-23 02:10:00 +000061}; /* button_context_standard */
62
Jens Arnolda0f31132006-12-12 07:55:17 +000063static const struct button_mapping remote_button_context_standard[] = {
Rani Hodcbe44272006-09-23 02:10:00 +000064 { ACTION_STD_PREV, BUTTON_RC_REW, BUTTON_NONE },
65 { ACTION_STD_PREVREPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
66 { ACTION_STD_NEXT, BUTTON_RC_FF, BUTTON_NONE },
67 { ACTION_STD_NEXTREPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +000068
Rani Hodcbe44272006-09-23 02:10:00 +000069 { ACTION_STD_CONTEXT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
70 { ACTION_STD_CANCEL, BUTTON_RC_MODE, BUTTON_NONE },
71 { ACTION_STD_OK, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
72 { ACTION_STD_MENU, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
73 { ACTION_STD_QUICKSCREEN, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
74
75 LAST_ITEM_IN_LIST
76}; /* remote_button_context_standard */
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000077
Michael Sevakis6c9b1d42006-10-12 17:49:46 +000078/** Bookmark Screen **/
Jens Arnolda0f31132006-12-12 07:55:17 +000079static const struct button_mapping button_context_bmark[] = {
Jonathan Gordon53a93be2006-12-03 01:22:13 +000080 { ACTION_BMS_DELETE, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +000081
Magnus Holmgrene676b812007-05-26 10:44:38 +000082 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
Michael Sevakis6c9b1d42006-10-12 17:49:46 +000083}; /* button_context_settings_bmark */
84
85/** FM Radio Screen **/
Jens Arnolda0f31132006-12-12 07:55:17 +000086static const struct button_mapping button_context_radio[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +000087 { ACTION_FM_MENU, BUTTON_SELECT | BUTTON_REPEAT, BUTTON_NONE },
88 { ACTION_FM_PRESET, BUTTON_SELECT | BUTTON_REL, BUTTON_SELECT },
89 { ACTION_FM_STOP, BUTTON_POWER, BUTTON_NONE },
90 { ACTION_FM_MODE, BUTTON_PLAY | BUTTON_REPEAT, BUTTON_PLAY },
91 { ACTION_FM_EXIT, BUTTON_REC | BUTTON_REL, BUTTON_REC },
92 { ACTION_FM_PLAY, BUTTON_PLAY | BUTTON_REL, BUTTON_PLAY },
93 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
94 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
95 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
96
97 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
98}; /* button_context_radio */
99
100/** Keyboard **/
Jens Arnolda0f31132006-12-12 07:55:17 +0000101static const struct button_mapping button_context_keyboard[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000102 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
103 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
104 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
105 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
106 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
107 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
108 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
109 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
110 { ACTION_KBD_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
111 { ACTION_KBD_DONE, BUTTON_PLAY, BUTTON_NONE },
112 { ACTION_KBD_ABORT, BUTTON_REC, BUTTON_NONE },
113
114 LAST_ITEM_IN_LIST
115}; /* button_context_keyboard */
116
Michael Sevakisd17a3832007-03-07 07:41:47 +0000117static const struct button_mapping remote_button_context_keyboard[] = {
118 { ACTION_KBD_LEFT, BUTTON_RC_REW, BUTTON_NONE },
119 { ACTION_KBD_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
120 { ACTION_KBD_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
121 { ACTION_KBD_RIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
122 { ACTION_KBD_SELECT_REM, BUTTON_RC_REC|BUTTON_REL, BUTTON_NONE },
Michael Sevakis6915ae52007-03-07 08:14:18 +0000123 { ACTION_KBD_SELECT_REM, BUTTON_RC_MENU|BUTTON_REL, BUTTON_NONE },
Michael Sevakisd17a3832007-03-07 07:41:47 +0000124 { ACTION_KBD_DONE, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
125 { ACTION_KBD_ABORT, BUTTON_RC_MODE, BUTTON_NONE },
126 { ACTION_KBD_UP, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
127 { ACTION_KBD_UP, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
128 { ACTION_KBD_DOWN, BUTTON_RC_VOL_UP, BUTTON_NONE },
129 { ACTION_KBD_DOWN, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
130
131 LAST_ITEM_IN_LIST
132}; /* button_context_keyboard_h100remote */
133
Jens Arnolda0f31132006-12-12 07:55:17 +0000134static const struct button_mapping remote_button_context_mainmenu[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000135 { ACTION_STD_CANCEL, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
136 { ACTION_STD_OK, BUTTON_RC_VOL_UP, BUTTON_NONE },
137
138 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
139}; /* remote_button_context_mainmenu */
140
141/** Pitchscreen **/
Jens Arnolda0f31132006-12-12 07:55:17 +0000142static const struct button_mapping button_context_pitchscreen[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000143 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
144 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
145 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
146 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
147 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
148 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
149 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
150 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
Linus Nielsen Feltzing3b998402006-11-06 09:19:40 +0000151 { ACTION_PS_TOGGLE_MODE, BUTTON_SELECT, BUTTON_NONE },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000152 { ACTION_PS_RESET, BUTTON_POWER, BUTTON_NONE },
153 { ACTION_PS_EXIT, BUTTON_PLAY, BUTTON_NONE },
154
155 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
156}; /* button_context_pitchscreen */
157
Jens Arnolda0f31132006-12-12 07:55:17 +0000158static const struct button_mapping remote_button_context_pitchscreen[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000159 { ACTION_PS_INC_SMALL, BUTTON_RC_VOL_UP, BUTTON_NONE },
160 { ACTION_PS_INC_BIG, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
161 { ACTION_PS_DEC_SMALL, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
162 { ACTION_PS_DEC_BIG, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
163 { ACTION_PS_NUDGE_LEFT, BUTTON_RC_REW, BUTTON_NONE },
164 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_RC_REW|BUTTON_REL, BUTTON_NONE },
165 { ACTION_PS_NUDGE_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
166 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RC_FF|BUTTON_REL, BUTTON_NONE },
167 { ACTION_PS_RESET, BUTTON_RC_MODE, BUTTON_NONE },
168 { ACTION_PS_EXIT, BUTTON_RC_PLAY, BUTTON_NONE },
169
170 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
171}; /* remote_button_context_pitchscreen */
172
173/** Quickscreen **/
Jens Arnolda0f31132006-12-12 07:55:17 +0000174static const struct button_mapping button_context_quickscreen[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000175 { ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE },
176 { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
177 { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
178 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
179 { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
180 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
181 { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
182 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
183 { ACTION_STD_CANCEL, BUTTON_REC, BUTTON_NONE },
184
185 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
186}; /* button_context_quickscreen */
187
Jens Arnolda0f31132006-12-12 07:55:17 +0000188static const struct button_mapping remote_button_context_quickscreen[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000189 { ACTION_QS_DOWNINV, BUTTON_RC_VOL_UP, BUTTON_NONE },
190 { ACTION_QS_DOWNINV, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
191 { ACTION_QS_DOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
192 { ACTION_QS_DOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
193 { ACTION_QS_LEFT, BUTTON_RC_REW, BUTTON_NONE },
194 { ACTION_QS_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
195 { ACTION_QS_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
196 { ACTION_QS_RIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
197
198 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
199}; /* remote_button_context_quickscreen */
200
201/** Recording Screen **/
Jens Arnolda0f31132006-12-12 07:55:17 +0000202static const struct button_mapping button_context_recscreen[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000203 { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
204 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
205 { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
206 { ACTION_STD_MENU, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
207 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
Linus Nielsen Feltzing236cdae2007-11-26 11:51:39 +0000208 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000209 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
Linus Nielsen Feltzing236cdae2007-11-26 11:51:39 +0000210 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000211
212 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
213}; /* button_context_recscreen */
214
215/** Settings - General Mappings **/
Jens Arnolda0f31132006-12-12 07:55:17 +0000216static const struct button_mapping button_context_settings[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000217 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
218 { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
219 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
220 { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
221 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
222 { ACTION_STD_CANCEL, BUTTON_REC, BUTTON_NONE },
223
224 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
225}; /* button_context_settings */
226
227/** Settings - Using Sliders **/
Jens Arnolda0f31132006-12-12 07:55:17 +0000228static const struct button_mapping button_context_settings_r_is_inc[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000229 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
230 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
231 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
232 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
233 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
234 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
235 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
236 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
237 { ACTION_STD_CANCEL, BUTTON_REC, BUTTON_NONE },
238
239 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
240}; /* button_context_settings_r_is_inc */
241
Jens Arnolda0f31132006-12-12 07:55:17 +0000242static const struct button_mapping remote_button_context_settings_r_is_inc[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000243 { ACTION_SETTINGS_INC, BUTTON_RC_VOL_UP, BUTTON_NONE },
244 { ACTION_SETTINGS_INCREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
245 { ACTION_SETTINGS_DEC, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
246 { ACTION_SETTINGS_DECREPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
247 { ACTION_STD_PREV, BUTTON_RC_REW, BUTTON_NONE },
248 { ACTION_STD_PREVREPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
249 { ACTION_STD_NEXT, BUTTON_RC_FF, BUTTON_NONE },
250 { ACTION_STD_NEXTREPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
251
252 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
253}; /* remote_button_context_settings_r_is_inc */
254
255/** Settings - Time/Date **/
Jens Arnolda0f31132006-12-12 07:55:17 +0000256static const struct button_mapping button_context_settings_time[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000257 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
258 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
259 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
260
261 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
262}; /* button_context_settings */
263
264/** Tree **/
Jens Arnolda0f31132006-12-12 07:55:17 +0000265static const struct button_mapping button_context_tree[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000266 { ACTION_NONE, BUTTON_PLAY, BUTTON_NONE },
267 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
268 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
269
270 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
271}; /* button_context_tree */
272
Jens Arnolda0f31132006-12-12 07:55:17 +0000273static const struct button_mapping remote_button_context_tree[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000274 { ACTION_STD_CANCEL, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
275 { ACTION_STD_OK, BUTTON_RC_VOL_UP, BUTTON_NONE },
276 { ACTION_NONE, BUTTON_RC_MODE, BUTTON_NONE },
277 { ACTION_TREE_WPS, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE },
278
279 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
280}; /* remote_button_context_tree */
281
Jens Arnolda0f31132006-12-12 07:55:17 +0000282static const struct button_mapping button_context_tree_scroll_lr[] = {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000283 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
284 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
285 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
286 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
287 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
288 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
289 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
290 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
291 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
292
293 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
294}; /* button_context_tree_scroll_lr */
295
296/** While-Playing Screen (WPS) **/
Jens Arnolda0f31132006-12-12 07:55:17 +0000297static const struct button_mapping button_context_wps[] = {
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000298 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
299 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
300 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
Jens Arnold1fdb5bf2006-08-16 00:32:45 +0000301 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000302 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
303 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
Jens Arnold1fdb5bf2006-08-16 00:32:45 +0000304 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000305 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000306
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000307 { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
Jens Arnold1fdb5bf2006-08-16 00:32:45 +0000308 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000309 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
Jens Arnold1fdb5bf2006-08-16 00:32:45 +0000310 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000311
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000312 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
313 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
314 { ACTION_WPS_MENU, BUTTON_REC|BUTTON_REL, BUTTON_REC },
315 { ACTION_WPS_QUICKSCREEN, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000316
317 LAST_ITEM_IN_LIST
Rani Hodcbe44272006-09-23 02:10:00 +0000318}; /* button_context_wps */
319
Jens Arnolda0f31132006-12-12 07:55:17 +0000320static const struct button_mapping remote_button_context_wps[] = {
Rani Hodcbe44272006-09-23 02:10:00 +0000321 { ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
322 { ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
323 { ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
324 { ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
325 { ACTION_WPS_STOPSEEK, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_REPEAT },
326 { ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
327 { ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
328 { ACTION_WPS_STOPSEEK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_REPEAT },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000329
Rani Hodcbe44272006-09-23 02:10:00 +0000330 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
331 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
332 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
333 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000334
Rani Hodcbe44272006-09-23 02:10:00 +0000335 { ACTION_WPS_BROWSE, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE },
336 { ACTION_WPS_CONTEXT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
337 { ACTION_WPS_MENU, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
338 { ACTION_WPS_QUICKSCREEN, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000339
Rani Hodcbe44272006-09-23 02:10:00 +0000340 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
341}; /* remote_button_context_wps */
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000342
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000343/** Yes/No Screen **/
Jens Arnolda0f31132006-12-12 07:55:17 +0000344static const struct button_mapping button_context_yesnoscreen[] = {
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000345 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
Linus Nielsen Feltzing1d1c59e2006-08-22 08:33:51 +0000346 LAST_ITEM_IN_LIST
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000347}; /* button_context_settings_yesnoscreen */
Martin Scarratta9823652006-09-22 12:18:58 +0000348
Linus Nielsen Feltzinge5f1fe92006-08-17 14:33:05 +0000349static const struct button_mapping* get_context_mapping_remote( int context )
350{
351 context ^= CONTEXT_REMOTE;
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000352
Linus Nielsen Feltzinge5f1fe92006-08-17 14:33:05 +0000353 switch (context)
354 {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000355 /* anything that uses remote_button_context_standard */
356 default:
357 return remote_button_context_standard;
358
359 /* remote contexts with special mapping */
Michael Sevakisd17a3832007-03-07 07:41:47 +0000360 case CONTEXT_KEYBOARD:
361 return remote_button_context_keyboard;
362
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000363 case CONTEXT_MAINMENU:
364 return remote_button_context_mainmenu;
365
366 case CONTEXT_PITCHSCREEN:
367 return remote_button_context_pitchscreen;
368
369 case CONTEXT_QUICKSCREEN:
370 return remote_button_context_quickscreen;
371
372 case CONTEXT_SETTINGS_COLOURCHOOSER:
373 case CONTEXT_SETTINGS_EQ:
374 case CONTEXT_SETTINGS_TIME:
375 return remote_button_context_settings_r_is_inc;
376
Linus Nielsen Feltzinge5f1fe92006-08-17 14:33:05 +0000377 case CONTEXT_TREE:
378 return remote_button_context_tree;
379
380 case CONTEXT_WPS:
381 return remote_button_context_wps;
Linus Nielsen Feltzinge5f1fe92006-08-17 14:33:05 +0000382 }
383}
384
Jens Arnold1fdb5bf2006-08-16 00:32:45 +0000385const struct button_mapping* get_context_mapping( int context )
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000386{
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000387 if (context & CONTEXT_REMOTE)
Linus Nielsen Feltzinge5f1fe92006-08-17 14:33:05 +0000388 return get_context_mapping_remote(context);
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000389
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000390 switch( context )
391 {
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000392 /* anything that uses button_context_standard */
393 case CONTEXT_LIST:
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000394 case CONTEXT_STD:
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000395 default:
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000396 return button_context_standard;
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000397
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000398 /* contexts with special mapping */
399 case CONTEXT_BOOKMARKSCREEN:
400 return button_context_bmark;
401
402 case CONTEXT_FM:
403 return button_context_radio;
404
405 case CONTEXT_KEYBOARD:
406 return button_context_keyboard;
407
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000408
409 case CONTEXT_PITCHSCREEN:
410 return button_context_pitchscreen;
411
412 case CONTEXT_QUICKSCREEN:
413 return button_context_quickscreen;
414
415 case CONTEXT_RECSCREEN:
416 return button_context_recscreen;
Linus Nielsen Feltzing0fec0f52006-08-16 20:09:29 +0000417
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000418 case CONTEXT_SETTINGS:
419 return button_context_settings;
420
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000421 case CONTEXT_SETTINGS_COLOURCHOOSER:
422 case CONTEXT_SETTINGS_EQ:
Jonathan Gordonff469ab2008-05-28 10:55:39 +0000423 case CONTEXT_SETTINGS_RECTRIGGER:
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000424 return button_context_settings_r_is_inc;
425
426 case CONTEXT_SETTINGS_TIME:
427 return button_context_settings_time;
428
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000429 case CONTEXT_TREE:
Jonathan Gordona053e582007-04-08 01:33:01 +0000430 case CONTEXT_MAINMENU:
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000431 if (global_settings.hold_lr_for_scroll_in_list)
432 return button_context_tree_scroll_lr;
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000433 /* else fall through to CONTEXT_TREE|CONTEXT_CUSTOM */
434 case CONTEXT_TREE|CONTEXT_CUSTOM:
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000435 return button_context_tree;
Martin Scarratt0ba22042006-08-22 13:21:13 +0000436
Michael Sevakis6c9b1d42006-10-12 17:49:46 +0000437 case CONTEXT_WPS:
438 return button_context_wps;
439
440 case CONTEXT_YESNOSCREEN:
441 return button_context_yesnoscreen;
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000442 }
443}