Reduce reciprocal table size a bit on Nano 2nd Gen as well (fix red).
[kugel-rb.git] / apps / keymaps / keymap-h10.c
blob315f28c213e5d7fa42ad4ff80dad08137b1718e0
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 USB_ENABLE_HID
341 static const struct button_mapping button_context_usb_hid[] = {
342 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
343 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
345 LAST_ITEM_IN_LIST
346 }; /* button_context_usb_hid */
348 static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
349 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
350 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
351 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
352 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
353 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
354 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
355 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
356 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
357 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
358 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
360 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
361 }; /* button_context_usb_hid_mode_multimedia */
363 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
364 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
365 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
366 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
367 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
368 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
369 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF },
370 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
371 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
372 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_UP, BUTTON_NONE },
373 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
374 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_DOWN, BUTTON_NONE },
375 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
376 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
377 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
379 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
380 }; /* button_context_usb_hid_mode_presentation */
382 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
383 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
384 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
385 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
386 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
387 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_REW|BUTTON_REL, BUTTON_REW },
388 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_FF|BUTTON_REL, BUTTON_FF },
389 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
390 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF },
391 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_REW|BUTTON_FF|BUTTON_REPEAT, BUTTON_REW|BUTTON_FF },
392 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
393 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
394 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_LEFT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_LEFT|BUTTON_RIGHT },
395 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
396 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
397 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
399 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
400 }; /* button_context_usb_hid_mode_browser */
402 #ifdef HAVE_USB_HID_MOUSE
403 static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
404 { ACTION_USB_HID_MOUSE_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
405 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
406 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
407 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
408 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
409 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
410 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
411 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
412 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_PLAY, BUTTON_NONE },
413 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
414 { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_PLAY|BUTTON_SCROLL_UP, BUTTON_NONE },
415 { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_PLAY|BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
416 { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_PLAY|BUTTON_SCROLL_DOWN, BUTTON_NONE },
417 { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_PLAY|BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
418 { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_PLAY|BUTTON_LEFT, BUTTON_NONE },
419 { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_PLAY|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
420 { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE },
421 { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_PLAY|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
422 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_REW, BUTTON_NONE },
423 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
424 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_FF, BUTTON_NONE },
425 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
427 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
428 }; /* button_context_usb_hid_mode_mouse */
429 #endif
430 #endif
432 static const struct button_mapping* get_context_mapping_remote( int context )
434 context ^= CONTEXT_REMOTE;
436 switch (context)
438 case CONTEXT_STD:
439 case CONTEXT_MAINMENU:
440 return remote_button_context_standard;
442 case CONTEXT_WPS:
443 return remote_button_context_wps;
445 case CONTEXT_LIST:
446 return remote_button_context_list;
447 case CONTEXT_TREE:
448 if (global_settings.hold_lr_for_scroll_in_list)
449 return remote_button_context_listtree_scroll_without_combo;
450 else
451 return remote_button_context_listtree_scroll_with_combo;
452 case CONTEXT_CUSTOM|CONTEXT_TREE:
453 return remote_button_context_tree;
455 case CONTEXT_QUICKSCREEN:
456 return remote_button_context_quickscreen;
457 case CONTEXT_PITCHSCREEN:
458 return remote_button_context_pitchscreen;
459 case CONTEXT_RECSCREEN:
460 return button_context_recscreen;
461 default:
462 return remote_button_context_standard;
466 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
467 const struct button_mapping* get_context_mapping(int context)
469 if (context&CONTEXT_REMOTE)
470 return get_context_mapping_remote(context);
472 switch (context)
474 case CONTEXT_STD:
475 return button_context_standard;
477 case CONTEXT_WPS:
478 return button_context_wps;
480 case CONTEXT_LIST:
481 return button_context_list;
482 case CONTEXT_TREE:
483 case CONTEXT_MAINMENU:
484 if (global_settings.hold_lr_for_scroll_in_list)
485 return button_context_listtree_scroll_without_combo;
486 else
487 return button_context_listtree_scroll_with_combo;
488 case CONTEXT_CUSTOM|CONTEXT_TREE:
489 return button_context_tree;
491 case CONTEXT_SETTINGS:
492 return button_context_settings;
493 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
494 case CONTEXT_SETTINGS_COLOURCHOOSER:
495 case CONTEXT_SETTINGS_EQ:
496 case CONTEXT_SETTINGS_TIME:
497 case CONTEXT_SETTINGS_RECTRIGGER:
498 return button_context_settings_right_is_inc;
500 case CONTEXT_YESNOSCREEN:
501 return button_context_yesno;
502 case CONTEXT_BOOKMARKSCREEN:
503 return button_context_bmark;
504 case CONTEXT_QUICKSCREEN:
505 return button_context_quickscreen;
506 case CONTEXT_PITCHSCREEN:
507 return button_context_pitchscreen;
508 case CONTEXT_KEYBOARD:
509 case CONTEXT_MORSE_INPUT:
510 return button_context_keyboard;
511 case CONTEXT_RECSCREEN:
512 return button_context_recscreen;
513 case CONTEXT_FM:
514 return button_context_radio;
515 #ifdef USB_ENABLE_HID
516 case CONTEXT_USB_HID:
517 return button_context_usb_hid;
518 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
519 return button_context_usb_hid_mode_multimedia;
520 case CONTEXT_USB_HID_MODE_PRESENTATION:
521 return button_context_usb_hid_mode_presentation;
522 case CONTEXT_USB_HID_MODE_BROWSER:
523 return button_context_usb_hid_mode_browser;
524 #ifdef HAVE_USB_HID_MOUSE
525 case CONTEXT_USB_HID_MODE_MOUSE:
526 return button_context_usb_hid_mode_mouse;
527 #endif
528 #endif
529 default:
530 return button_context_standard;
532 return button_context_standard;