1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Jonathan Gordon
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 /* Button Code Definitions for ipod target */
28 * The format of the list is as follows
29 * { Action Code, Button code, Prereq button code }
30 * if there's no need to check the previous button's value, use BUTTON_NONE
31 * Insert LAST_ITEM_IN_LIST at the end of each mapping
34 /* CONTEXT_CUSTOM's used in this file...
36 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
41 static const struct button_mapping button_context_standard
[] = {
42 { ACTION_STD_PREV
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
43 { ACTION_STD_PREVREPEAT
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
44 { ACTION_STD_NEXT
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
45 { ACTION_STD_NEXTREPEAT
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
46 { ACTION_STD_CANCEL
, BUTTON_LEFT
, BUTTON_NONE
},
47 { ACTION_STD_OK
, BUTTON_RIGHT
, BUTTON_NONE
},
49 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
50 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
51 { ACTION_STD_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
52 { ACTION_STD_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_NONE
},
53 { ACTION_STD_CANCEL
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
56 }; /* button_context_standard */
57 static const struct button_mapping button_context_tree
[] = {
58 { ACTION_TREE_WPS
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
59 { ACTION_TREE_STOP
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_PLAY
},
61 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
62 }; /* button_context_tree */
64 static const struct button_mapping button_context_tree_scroll_lr
[] = {
65 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
66 { ACTION_STD_CANCEL
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
67 { ACTION_TREE_ROOT_INIT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_LEFT
},
68 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
69 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
70 { ACTION_NONE
, BUTTON_RIGHT
, BUTTON_NONE
},
71 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
72 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
73 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
74 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
77 static const struct button_mapping button_context_wps
[] = {
78 { ACTION_WPS_PLAY
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
79 { ACTION_WPS_STOP
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_PLAY
},
80 { ACTION_WPS_SKIPPREV
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
81 { ACTION_WPS_SEEKBACK
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
82 { ACTION_WPS_STOPSEEK
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
83 { ACTION_WPS_SKIPNEXT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
84 { ACTION_WPS_SEEKFWD
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
85 { ACTION_WPS_STOPSEEK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
86 { ACTION_WPS_VOLDOWN
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
87 { ACTION_WPS_VOLDOWN
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
88 { ACTION_WPS_VOLUP
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
89 { ACTION_WPS_VOLUP
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
90 { ACTION_WPS_BROWSE
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
91 { ACTION_WPS_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
92 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
93 { ACTION_WPS_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
96 }; /* button_context_wps */
98 static const struct button_mapping button_context_settings
[] = {
99 { ACTION_SETTINGS_INC
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
100 { ACTION_SETTINGS_INCREPEAT
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
101 { ACTION_SETTINGS_DEC
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
102 { ACTION_SETTINGS_DECREPEAT
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
103 { ACTION_STD_PREV
, BUTTON_LEFT
, BUTTON_NONE
},
104 { ACTION_STD_PREVREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
105 { ACTION_STD_NEXT
, BUTTON_RIGHT
, BUTTON_NONE
},
106 { ACTION_STD_NEXTREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
107 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
108 { ACTION_STD_CANCEL
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
110 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
111 }; /* button_context_settings */
113 static const struct button_mapping button_context_yesno
[] = {
114 { ACTION_YESNO_ACCEPT
, BUTTON_SELECT
, BUTTON_NONE
},
116 }; /* button_context_settings_yesno */
118 static const struct button_mapping button_context_bmark
[] = {
119 { ACTION_BMS_DELETE
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
120 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
121 }; /* button_context_settings_bmark */
123 static const struct button_mapping button_context_quickscreen
[] = {
124 { ACTION_QS_DOWN
, BUTTON_PLAY
, BUTTON_NONE
},
125 { ACTION_QS_DOWN
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
126 { ACTION_QS_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
127 { ACTION_QS_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
128 { ACTION_QS_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
129 { ACTION_QS_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
130 { ACTION_STD_CANCEL
, BUTTON_MENU
, BUTTON_NONE
},
132 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
133 }; /* button_context_quickscreen */
135 static const struct button_mapping button_context_pitchscreen
[] = {
136 { ACTION_PS_INC_SMALL
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
137 { ACTION_PS_INC_BIG
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
138 { ACTION_PS_DEC_SMALL
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
139 { ACTION_PS_DEC_BIG
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
140 { ACTION_PS_NUDGE_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
141 { ACTION_PS_NUDGE_LEFTOFF
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_NONE
},
142 { ACTION_PS_NUDGE_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
143 { ACTION_PS_NUDGE_RIGHTOFF
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
144 { ACTION_PS_TOGGLE_MODE
, BUTTON_PLAY
, BUTTON_NONE
},
145 { ACTION_PS_RESET
, BUTTON_MENU
, BUTTON_NONE
},
146 { ACTION_PS_EXIT
, BUTTON_SELECT
, BUTTON_NONE
},
148 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
149 }; /* button_context_pitchscreen */
151 static const struct button_mapping button_context_keyboard
[] = {
152 { ACTION_KBD_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
153 { ACTION_KBD_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
154 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
155 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
156 { ACTION_KBD_SELECT
, BUTTON_SELECT
, BUTTON_NONE
},
157 { ACTION_KBD_DONE
, BUTTON_PLAY
, BUTTON_NONE
},
158 { ACTION_KBD_ABORT
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
159 { ACTION_KBD_UP
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
160 { ACTION_KBD_UP
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
161 { ACTION_KBD_DOWN
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
162 { ACTION_KBD_DOWN
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
163 { ACTION_KBD_MORSE_INPUT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
164 { ACTION_KBD_MORSE_SELECT
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
166 }; /* button_context_keyboard */
168 const struct button_mapping button_context_recscreen
[] = {
169 { ACTION_REC_PAUSE
, BUTTON_PLAY
, BUTTON_NONE
},
171 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
)
172 }; /* button_context_recscreen */
174 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
175 const struct button_mapping
* get_context_mapping(int context
)
180 return button_context_standard
;
182 return button_context_wps
;
185 case CONTEXT_MAINMENU
:
186 if (global_settings
.hold_lr_for_scroll_in_list
)
187 return button_context_tree_scroll_lr
;
188 /* else fall through to CUSTOM|CONTEXT_TREE */
189 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
190 return button_context_tree
;
193 return button_context_standard
;
195 case CONTEXT_SETTINGS_EQ
:
196 case CONTEXT_SETTINGS_COLOURCHOOSER
:
197 case CONTEXT_SETTINGS_TIME
:
198 case CONTEXT_SETTINGS
:
199 return button_context_settings
;
200 case CONTEXT_YESNOSCREEN
:
201 return button_context_yesno
;
202 case CONTEXT_BOOKMARKSCREEN
:
203 return button_context_bmark
;
204 case CONTEXT_QUICKSCREEN
:
205 return button_context_quickscreen
;
206 case CONTEXT_PITCHSCREEN
:
207 return button_context_pitchscreen
;
208 case CONTEXT_KEYBOARD
:
209 return button_context_keyboard
;
210 case CONTEXT_RECSCREEN
:
211 return button_context_recscreen
;
213 return button_context_standard
;
215 return button_context_standard
;