Pictureflow: Don't show the playback control one targets that can't have playback...
[kugel-rb.git] / apps / keymaps / keymap-e200.c
bloba2017de6f38137cc3a620388c87e53052cfea43b
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 ****************************************************************************/
21 /* Button Code Definitions for Sandisk e200 target */
23 #include "config.h"
24 #include "action.h"
25 #include "button.h"
26 #include "settings.h"
28 /* {Action Code, Button code, Prereq button code } */
30 /*
31 * The format of the list is as follows
32 * { Action Code, Button code, Prereq button code }
33 * if there's no need to check the previous button's value, use BUTTON_NONE
34 * Insert LAST_ITEM_IN_LIST at the end of each mapping
36 static const struct button_mapping button_context_standard[] = {
37 { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
38 { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
39 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
40 { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
42 { ACTION_STD_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
43 { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
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_POWER|BUTTON_REL, BUTTON_POWER },
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_POWER|BUTTON_RIGHT, BUTTON_POWER },
69 { ACTION_WPS_ABSETA_PREVDIR, BUTTON_POWER|BUTTON_LEFT, BUTTON_POWER },
70 { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_UP, BUTTON_POWER },
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 },
83 { ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
85 { ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_UP, BUTTON_SELECT },
86 { ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_SELECT },
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_REC|BUTTON_SCROLL_BACK, BUTTON_REC },
109 { ACTION_LISTTREE_PGDOWN, BUTTON_REC|BUTTON_SCROLL_FWD, BUTTON_REC },
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_POWER|BUTTON_REL, BUTTON_POWER },
118 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
119 }; /* button_context_tree */
121 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
122 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
123 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
124 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
125 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
126 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
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 },
130 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
132 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
133 }; /* button_context_listtree_scroll_without_combo */
135 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
136 { ACTION_TREE_ROOT_INIT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
137 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC },
138 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
139 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC },
140 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
142 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
143 }; /* button_context_listtree_scroll_with_combo */
145 static const struct button_mapping button_context_yesno[] = {
146 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
148 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
149 }; /* button_context_settings_yesno */
151 static const struct button_mapping button_context_quickscreen[] = {
152 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
153 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
154 { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
155 { ACTION_QS_DOWNINV, 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_REC, BUTTON_NONE },
203 { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
204 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
205 { ACTION_PS_EXIT, BUTTON_UP, BUTTON_NONE },
207 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
208 }; /* button_context_pitchscreen */
210 /** Recording Screen **/
211 static const struct button_mapping button_context_recscreen[] = {
212 { ACTION_REC_PAUSE, BUTTON_UP|BUTTON_REL, BUTTON_UP },
213 { ACTION_STD_CANCEL, BUTTON_DOWN, BUTTON_NONE },
214 { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
215 { ACTION_STD_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT},
216 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
217 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
218 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
219 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
220 { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
221 { ACTION_STD_PREV, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
222 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
223 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
224 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
225 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
226 }; /* button_context_recscreen */
228 /** FM Radio Screen **/
229 static const struct button_mapping button_context_radio[] = {
230 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
231 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
232 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
233 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
234 { ACTION_FM_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
235 { ACTION_FM_PRESET, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
236 { ACTION_FM_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
237 { ACTION_FM_MODE, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
238 { ACTION_FM_EXIT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
239 { ACTION_FM_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
240 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
241 }; /* button_context_radio */
243 static const struct button_mapping button_context_keyboard[] = {
244 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
245 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
246 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
247 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
249 { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE },
250 { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
251 { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
252 { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
254 { ACTION_KBD_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
255 { ACTION_KBD_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
256 { ACTION_KBD_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
257 { ACTION_KBD_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
258 { ACTION_KBD_PAGE_FLIP, BUTTON_REC|BUTTON_SELECT, BUTTON_REC },
259 { ACTION_KBD_BACKSPACE, BUTTON_DOWN, BUTTON_NONE },
260 { ACTION_KBD_BACKSPACE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
261 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
262 { ACTION_KBD_DONE, BUTTON_UP, BUTTON_NONE },
263 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
265 LAST_ITEM_IN_LIST
266 }; /* button_context_keyboard */
268 static const struct button_mapping button_context_bmark[] = {
269 { ACTION_BMS_DELETE, BUTTON_REC, BUTTON_NONE },
271 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
272 }; /* button_context_bmark */
274 #ifdef HAVE_USBSTACK
275 static const struct button_mapping button_context_usb_hid[] = {
276 { ACTION_USB_HID_PLAY, BUTTON_UP, BUTTON_NONE },
277 { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE },
278 { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
279 { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
280 { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE },
281 { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
282 { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
283 { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
284 { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE },
285 { ACTION_USB_HID_MENU, BUTTON_DOWN, BUTTON_NONE },
287 LAST_ITEM_IN_LIST
288 }; /* button_context_usb_hid */
289 #endif
291 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
292 const struct button_mapping* get_context_mapping(int context)
294 switch (context)
296 case CONTEXT_STD:
297 return button_context_standard;
299 case CONTEXT_WPS:
300 return button_context_wps;
302 case CONTEXT_LIST:
303 return button_context_list;
304 case CONTEXT_TREE:
305 case CONTEXT_MAINMENU:
306 if (global_settings.hold_lr_for_scroll_in_list)
307 return button_context_listtree_scroll_without_combo;
308 else
309 return button_context_listtree_scroll_with_combo;
310 case CONTEXT_CUSTOM|CONTEXT_TREE:
311 return button_context_tree;
313 case CONTEXT_SETTINGS:
314 return button_context_settings;
315 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
316 case CONTEXT_SETTINGS_COLOURCHOOSER:
317 case CONTEXT_SETTINGS_EQ:
318 case CONTEXT_SETTINGS_RECTRIGGER:
319 return button_context_settings_right_is_inc;
321 case CONTEXT_SETTINGS_TIME:
322 return button_context_settings_time;
324 case CONTEXT_YESNOSCREEN:
325 return button_context_yesno;
326 case CONTEXT_FM:
327 return button_context_radio;
328 case CONTEXT_BOOKMARKSCREEN:
329 return button_context_bmark;
330 case CONTEXT_QUICKSCREEN:
331 return button_context_quickscreen;
332 case CONTEXT_PITCHSCREEN:
333 return button_context_pitchscreen;
334 case CONTEXT_RECSCREEN:
335 return button_context_recscreen;
336 case CONTEXT_KEYBOARD:
337 return button_context_keyboard;
338 #ifdef HAVE_USBSTACK
339 case CONTEXT_USB_HID:
340 return button_context_usb_hid;
341 #endif
342 default:
343 return button_context_standard;
345 return button_context_standard;