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 ****************************************************************************/
23 * Button Code Definitions for archos ondio fm/sp targets
31 /* CONTEXT_CUSTOM's used in this file...
33 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
38 static const struct button_mapping button_context_standard
[] = {
39 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
40 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
41 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
42 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
44 { ACTION_STD_CONTEXT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_RIGHT
},
45 { ACTION_STD_CANCEL
, BUTTON_LEFT
, BUTTON_NONE
},
46 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
47 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
48 { ACTION_STD_CANCEL
, BUTTON_OFF
, BUTTON_NONE
},
53 static const struct button_mapping button_context_wps
[] = {
54 { ACTION_WPS_PLAY
, BUTTON_OFF
|BUTTON_REL
, BUTTON_OFF
},
55 { ACTION_WPS_SKIPNEXT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
56 { ACTION_WPS_SKIPPREV
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
57 { ACTION_WPS_SEEKBACK
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
58 { ACTION_WPS_SEEKFWD
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
59 { ACTION_WPS_STOPSEEK
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
60 { ACTION_WPS_STOPSEEK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
61 { ACTION_WPS_STOP
, BUTTON_OFF
|BUTTON_REPEAT
, BUTTON_OFF
},
62 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
, BUTTON_NONE
},
63 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
64 { ACTION_WPS_VOLUP
, BUTTON_UP
, BUTTON_NONE
},
65 { ACTION_WPS_VOLUP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
66 { ACTION_WPS_BROWSE
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
67 { ACTION_WPS_CONTEXT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
68 /* { ACTION_WPS_MENU, BUTTON_NONE, BUTTON_NONE }, we can't have that */
69 { ACTION_STD_KEYLOCK
, BUTTON_MENU
|BUTTON_DOWN
, BUTTON_NONE
},
74 static const struct button_mapping button_context_settings
[] = {
75 { ACTION_SETTINGS_INC
, BUTTON_UP
, BUTTON_NONE
},
76 { ACTION_SETTINGS_INCREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
77 { ACTION_SETTINGS_DEC
, BUTTON_DOWN
, BUTTON_NONE
},
78 { ACTION_SETTINGS_DECREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
79 { ACTION_STD_OK
, BUTTON_RIGHT
, BUTTON_NONE
},
80 { ACTION_STD_OK
, BUTTON_LEFT
, BUTTON_NONE
},
81 { ACTION_STD_CANCEL
, BUTTON_MENU
, BUTTON_NONE
},
83 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
86 static const struct button_mapping button_context_tree
[] = {
87 { ACTION_TREE_WPS
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
88 { ACTION_TREE_STOP
, BUTTON_OFF
, BUTTON_NONE
},
89 { ACTION_STD_CANCEL
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
91 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
92 }; /* button_context_listtree */
94 static const struct button_mapping button_context_tree_scroll_lr
[] = {
95 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
96 { ACTION_STD_CANCEL
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
97 { ACTION_TREE_PGLEFT
, BUTTON_MENU
|BUTTON_LEFT
, BUTTON_NONE
},
98 { ACTION_TREE_ROOT_INIT
, BUTTON_MENU
|BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_MENU
|BUTTON_LEFT
},
99 { ACTION_TREE_PGLEFT
, BUTTON_MENU
|BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
100 { ACTION_TREE_PGLEFT
, BUTTON_MENU
|BUTTON_RIGHT
|BUTTON_REL
, BUTTON_MENU
|BUTTON_RIGHT
|BUTTON_REPEAT
},
101 { ACTION_NONE
, BUTTON_RIGHT
, BUTTON_NONE
},
102 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
103 { ACTION_TREE_PGRIGHT
, BUTTON_MENU
|BUTTON_RIGHT
, BUTTON_NONE
},
104 { ACTION_TREE_PGRIGHT
, BUTTON_MENU
|BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
105 { ACTION_TREE_PGRIGHT
, BUTTON_MENU
|BUTTON_RIGHT
|BUTTON_REL
, BUTTON_MENU
|BUTTON_RIGHT
|BUTTON_REPEAT
},
107 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
110 static const struct button_mapping button_context_yesno
[] = {
111 { ACTION_YESNO_ACCEPT
, BUTTON_RIGHT
, BUTTON_NONE
},
113 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
116 static const struct button_mapping button_context_bmark
[] = {
117 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
118 { ACTION_BMS_DELETE
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_LEFT
},
120 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
121 }; /* button_context_settings_bmark */
123 static const struct button_mapping button_context_pitchscreen
[] = {
124 { ACTION_PS_INC_SMALL
, BUTTON_UP
, BUTTON_NONE
},
125 { ACTION_PS_INC_BIG
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
126 { ACTION_PS_DEC_SMALL
, BUTTON_DOWN
, BUTTON_NONE
},
127 { ACTION_PS_DEC_BIG
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
128 { ACTION_PS_NUDGE_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
129 { ACTION_PS_NUDGE_LEFTOFF
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_NONE
},
130 { ACTION_PS_NUDGE_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
131 { ACTION_PS_NUDGE_RIGHTOFF
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
132 { ACTION_PS_TOGGLE_MODE
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
133 { ACTION_PS_RESET
, BUTTON_MENU
, BUTTON_NONE
},
134 { ACTION_PS_EXIT
, BUTTON_OFF
, BUTTON_NONE
},
136 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
137 }; /* button_context_pitchscreen */
139 #ifdef HAVE_RECORDING
140 static const struct button_mapping button_context_rectrigger
[] = {
141 { ACTION_STD_OK
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
142 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_RECSCREEN
)
144 static const struct button_mapping button_context_recscreen
[] = {
145 { ACTION_REC_PAUSE
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
146 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
147 { ACTION_SETTINGS_INCREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
148 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
149 { ACTION_SETTINGS_DECREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
151 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
152 }; /* button_context_recscreen */
153 #endif /* HAVE_RECORDING */
155 static const struct button_mapping button_context_keyboard
[] = {
156 { ACTION_KBD_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
157 { ACTION_KBD_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
158 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
159 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
160 { ACTION_KBD_SELECT
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
161 { ACTION_KBD_DONE
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
162 { ACTION_KBD_ABORT
, BUTTON_OFF
, BUTTON_NONE
},
163 { ACTION_KBD_UP
, BUTTON_UP
, BUTTON_NONE
},
164 { ACTION_KBD_UP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
165 { ACTION_KBD_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
166 { ACTION_KBD_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
169 }; /* button_context_keyboard */
172 static const struct button_mapping button_context_radio
[] = {
173 { ACTION_FM_MENU
, BUTTON_MENU
| BUTTON_REPEAT
, BUTTON_NONE
},
174 { ACTION_FM_RECORD_DBLPRE
, BUTTON_MENU
, BUTTON_NONE
},
175 { ACTION_FM_RECORD
, BUTTON_MENU
| BUTTON_REL
, BUTTON_NONE
},
176 { ACTION_FM_STOP
, BUTTON_OFF
| BUTTON_REPEAT
, BUTTON_OFF
},
177 { ACTION_FM_EXIT
, BUTTON_OFF
| BUTTON_REL
, BUTTON_OFF
},
178 { ACTION_STD_PREV
, BUTTON_LEFT
, BUTTON_NONE
},
179 { ACTION_STD_PREVREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
180 { ACTION_STD_NEXT
, BUTTON_RIGHT
, BUTTON_NONE
},
181 { ACTION_STD_NEXTREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
185 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
)
190 const struct button_mapping
* get_context_mapping( int context
)
195 return button_context_standard
;
198 return button_context_wps
;
200 case CONTEXT_SETTINGS
:
201 return button_context_settings
;
203 case CONTEXT_YESNOSCREEN
:
204 return button_context_yesno
;
206 case CONTEXT_BOOKMARKSCREEN
:
207 return button_context_bmark
;
208 case CONTEXT_PITCHSCREEN
:
209 return button_context_pitchscreen
;
211 case CONTEXT_MAINMENU
:
212 if (global_settings
.hold_lr_for_scroll_in_list
)
213 return button_context_tree_scroll_lr
;
214 /* else fall through to CUSTOM|CONTEXT_TREE */
215 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
216 return button_context_tree
;
217 #ifdef HAVE_RECORDING
218 case CONTEXT_RECSCREEN
:
219 return button_context_recscreen
;
220 case CONTEXT_SETTINGS_RECTRIGGER
:
221 return button_context_rectrigger
;
223 case CONTEXT_KEYBOARD
:
224 return button_context_keyboard
;
227 return button_context_radio
;
231 return button_context_standard
;