1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 /* Button Code Definitions for the toshiba gigabeat target */
33 * The format of the list is as follows
34 * { Action Code, Button code, Prereq button code }
35 * if there's no need to check the previous button's value, use BUTTON_NONE
36 * Insert LAST_ITEM_IN_LIST at the end of each mapping
39 /* CONTEXT_CUSTOM's used in this file...
41 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
42 CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
43 i.e where up/down is inc/dec
44 CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
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_CANCEL
, BUTTON_LEFT
, BUTTON_NONE
},
57 { ACTION_STD_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
,BUTTON_SELECT
},
59 { ACTION_STD_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
60 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
62 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
63 { ACTION_STD_OK
, BUTTON_RIGHT
, BUTTON_NONE
},
66 }; /* button_context_standard */
69 static const struct button_mapping button_context_wps
[] = {
70 { ACTION_WPS_PLAY
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
71 { ACTION_WPS_STOP
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
73 { ACTION_WPS_SKIPNEXT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
74 { ACTION_WPS_SKIPPREV
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
76 { ACTION_WPS_SEEKBACK
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
77 { ACTION_WPS_SEEKFWD
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
78 { ACTION_WPS_STOPSEEK
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
79 { ACTION_WPS_STOPSEEK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
81 { ACTION_WPS_ABSETB_NEXTDIR
, BUTTON_PLAY
|BUTTON_RIGHT
, BUTTON_NONE
},
82 { ACTION_WPS_ABSETA_PREVDIR
, BUTTON_PLAY
|BUTTON_LEFT
, BUTTON_NONE
},
83 { ACTION_WPS_ABRESET
, BUTTON_PLAY
|BUTTON_SELECT
, BUTTON_NONE
},
85 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
86 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
, BUTTON_NONE
},
87 { ACTION_WPS_VOLUP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
88 { ACTION_WPS_VOLUP
, BUTTON_UP
, BUTTON_NONE
},
90 { ACTION_WPS_PITCHSCREEN
, BUTTON_PLAY
|BUTTON_UP
, BUTTON_PLAY
},
91 { ACTION_WPS_VIEW_PLAYLIST
, BUTTON_PLAY
|BUTTON_DOWN
, BUTTON_PLAY
},
93 { ACTION_WPS_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
94 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
95 { ACTION_WPS_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
97 { ACTION_WPS_ID3SCREEN
, BUTTON_PLAY
|BUTTON_MENU
, BUTTON_NONE
},
98 { ACTION_WPS_BROWSE
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
101 }; /* button_context_wps */
103 static const struct button_mapping button_context_list
[] = {
104 { ACTION_LISTTREE_PGUP
, BUTTON_PLAY
|BUTTON_UP
, BUTTON_PLAY
},
105 { ACTION_LISTTREE_PGUP
, BUTTON_UP
|BUTTON_REL
, BUTTON_PLAY
|BUTTON_UP
},
106 { ACTION_LISTTREE_PGUP
, BUTTON_PLAY
|BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
107 { ACTION_LISTTREE_PGDOWN
, BUTTON_PLAY
|BUTTON_DOWN
, BUTTON_PLAY
},
108 { ACTION_LISTTREE_PGDOWN
, BUTTON_DOWN
|BUTTON_REL
, BUTTON_PLAY
|BUTTON_DOWN
},
109 { ACTION_LISTTREE_PGDOWN
, BUTTON_PLAY
|BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
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_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
116 { ACTION_TREE_STOP
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
118 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
119 }; /* button_context_tree */
121 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
122 { ACTION_NONE
, BUTTON_PLAY
, BUTTON_NONE
},
123 { ACTION_TREE_PGLEFT
, BUTTON_PLAY
|BUTTON_LEFT
, BUTTON_PLAY
},
124 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_PLAY
|BUTTON_LEFT
},
125 { ACTION_TREE_PGLEFT
, BUTTON_PLAY
|BUTTON_LEFT
, BUTTON_LEFT
|BUTTON_REL
},
126 { ACTION_TREE_ROOT_INIT
, BUTTON_PLAY
|BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_PLAY
|BUTTON_LEFT
},
127 { ACTION_TREE_PGLEFT
, BUTTON_PLAY
|BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
128 { ACTION_TREE_PGRIGHT
, BUTTON_PLAY
|BUTTON_RIGHT
, BUTTON_PLAY
},
129 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_PLAY
|BUTTON_RIGHT
},
130 { ACTION_TREE_PGRIGHT
, BUTTON_PLAY
|BUTTON_RIGHT
, BUTTON_RIGHT
|BUTTON_REL
},
131 { ACTION_TREE_PGRIGHT
, BUTTON_PLAY
|BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
132 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
135 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
136 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
137 { ACTION_STD_CANCEL
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
138 { ACTION_TREE_ROOT_INIT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_LEFT
},
139 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
140 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
141 { ACTION_NONE
, BUTTON_RIGHT
, BUTTON_NONE
},
142 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
143 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
144 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
145 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
148 static const struct button_mapping button_context_settings
[] = {
149 { ACTION_SETTINGS_INC
, BUTTON_UP
, BUTTON_NONE
},
150 { ACTION_SETTINGS_INCREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
151 { ACTION_SETTINGS_DEC
, BUTTON_DOWN
, BUTTON_NONE
},
152 { ACTION_SETTINGS_DECREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
153 { ACTION_STD_PREV
, BUTTON_LEFT
, BUTTON_NONE
},
154 { ACTION_STD_PREVREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
155 { ACTION_STD_NEXT
, BUTTON_RIGHT
, BUTTON_NONE
},
156 { ACTION_STD_NEXTREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
157 { ACTION_SETTINGS_RESET
, BUTTON_PLAY
, BUTTON_NONE
},
159 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
160 }; /* button_context_settings */
162 static const struct button_mapping button_context_settings_right_is_inc
[] = {
163 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
, BUTTON_NONE
},
164 { ACTION_SETTINGS_INCREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
165 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
166 { ACTION_SETTINGS_DECREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
167 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
168 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
169 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
170 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
171 { ACTION_SETTINGS_RESET
, BUTTON_PLAY
, BUTTON_NONE
},
173 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
174 }; /* button_context_settingsgraphical */
176 static const struct button_mapping button_context_yesno
[] = {
177 { ACTION_YESNO_ACCEPT
, BUTTON_SELECT
, BUTTON_NONE
},
178 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
179 }; /* button_context_settings_yesno */
181 static const struct button_mapping button_context_colorchooser
[] = {
182 { ACTION_STD_OK
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_NONE
},
183 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
184 }; /* button_context_colorchooser */
186 static const struct button_mapping button_context_eq
[] = {
187 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
188 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
189 }; /* button_context_eq */
191 /** Bookmark Screen **/
192 static const struct button_mapping button_context_bmark
[] = {
193 { ACTION_BMS_DELETE
, BUTTON_PLAY
, BUTTON_NONE
},
195 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
196 }; /* button_context_bmark */
198 static const struct button_mapping button_context_time
[] = {
199 { ACTION_STD_CANCEL
, BUTTON_LEFT
, BUTTON_NONE
},
200 { ACTION_STD_OK
, BUTTON_PLAY
, BUTTON_NONE
},
201 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
202 }; /* button_context_time */
204 static const struct button_mapping button_context_quickscreen
[] = {
205 { ACTION_QS_DOWNINV
, BUTTON_UP
, BUTTON_NONE
},
206 { ACTION_QS_DOWNINV
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
207 { ACTION_QS_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
208 { ACTION_QS_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
209 { ACTION_QS_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
210 { ACTION_QS_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
211 { ACTION_QS_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
212 { ACTION_QS_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
213 { ACTION_STD_CANCEL
, BUTTON_MENU
, BUTTON_NONE
},
215 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
216 }; /* button_context_quickscreen */
218 static const struct button_mapping button_context_pitchscreen
[] = {
219 { ACTION_PS_INC_SMALL
, BUTTON_UP
, BUTTON_NONE
},
220 { ACTION_PS_INC_BIG
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
221 { ACTION_PS_DEC_SMALL
, BUTTON_DOWN
, BUTTON_NONE
},
222 { ACTION_PS_DEC_BIG
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
223 { ACTION_PS_NUDGE_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
224 { ACTION_PS_NUDGE_LEFTOFF
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_NONE
},
225 { ACTION_PS_NUDGE_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
226 { ACTION_PS_NUDGE_RIGHTOFF
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
227 { ACTION_PS_TOGGLE_MODE
, BUTTON_MENU
, BUTTON_NONE
},
228 { ACTION_PS_RESET
, BUTTON_PLAY
, BUTTON_NONE
},
229 { ACTION_PS_EXIT
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
230 { ACTION_PS_SLOWER
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
231 { ACTION_PS_FASTER
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
233 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
234 }; /* button_context_pitchcreen */
236 static const struct button_mapping button_context_keyboard
[] = {
237 { ACTION_KBD_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
238 { ACTION_KBD_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
239 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
240 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
241 { ACTION_KBD_CURSOR_LEFT
, BUTTON_PLAY
|BUTTON_LEFT
, BUTTON_NONE
},
242 { ACTION_KBD_CURSOR_LEFT
, BUTTON_PLAY
|BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
243 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_PLAY
|BUTTON_RIGHT
, BUTTON_NONE
},
244 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_PLAY
|BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
245 { ACTION_KBD_SELECT
, BUTTON_SELECT
, BUTTON_NONE
},
246 { ACTION_KBD_PAGE_FLIP
, BUTTON_PLAY
|BUTTON_MENU
, BUTTON_NONE
},
247 { ACTION_KBD_DONE
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
248 { ACTION_KBD_ABORT
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
249 { ACTION_KBD_BACKSPACE
, BUTTON_MENU
, BUTTON_NONE
},
250 { ACTION_KBD_BACKSPACE
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
251 { ACTION_KBD_UP
, BUTTON_UP
, BUTTON_NONE
},
252 { ACTION_KBD_UP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
253 { ACTION_KBD_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
254 { ACTION_KBD_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
255 // { ACTION_KBD_MORSE_INPUT, BUTTON_PLAY|BUTTON_POWER, BUTTON_NONE },
256 { ACTION_KBD_MORSE_SELECT
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
259 }; /* button_context_keyboard */
262 const struct button_mapping
* get_context_mapping(int context
)
267 return button_context_standard
;
269 return button_context_wps
;
272 return button_context_list
;
273 case CONTEXT_MAINMENU
:
275 if (global_settings
.hold_lr_for_scroll_in_list
)
276 return button_context_listtree_scroll_without_combo
;
278 return button_context_listtree_scroll_with_combo
;
279 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
280 return button_context_tree
;
282 case CONTEXT_SETTINGS
:
283 return button_context_settings
;
284 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
285 return button_context_settings_right_is_inc
;
287 case CONTEXT_SETTINGS_COLOURCHOOSER
:
288 return button_context_colorchooser
;
289 case CONTEXT_SETTINGS_EQ
:
290 return button_context_eq
;
292 case CONTEXT_SETTINGS_TIME
:
293 return button_context_time
;
295 case CONTEXT_YESNOSCREEN
:
296 return button_context_yesno
;
297 case CONTEXT_BOOKMARKSCREEN
:
298 return button_context_bmark
;
299 case CONTEXT_QUICKSCREEN
:
300 return button_context_quickscreen
;
301 case CONTEXT_PITCHSCREEN
:
302 return button_context_pitchscreen
;
303 case CONTEXT_KEYBOARD
:
304 return button_context_keyboard
;
306 return button_context_standard
;