1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2010 Maurus Cuelenaere
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 Android targets */
34 * The format of the list is as follows
35 * { Action Code, Button code, Prereq button code }
36 * if there's no need to check the previous button's value, use BUTTON_NONE
37 * Insert LAST_ITEM_IN_LIST at the end of each mapping
40 static const struct button_mapping button_context_standard
[] = {
41 { ACTION_STD_PREV
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
42 { ACTION_STD_PREVREPEAT
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
43 { ACTION_STD_NEXT
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
44 { ACTION_STD_NEXTREPEAT
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
46 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
47 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
48 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
49 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
51 { ACTION_STD_OK
, BUTTON_CENTER
|BUTTON_REL
, BUTTON_CENTER
},
52 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
53 { ACTION_STD_CANCEL
, BUTTON_LEFT
, BUTTON_NONE
},
54 { ACTION_STD_CANCEL
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
56 { ACTION_STD_CONTEXT
, BUTTON_MENU
, BUTTON_NONE
},
59 }; /* button_context_standard */
61 static const struct button_mapping button_context_wps
[] = {
62 { ACTION_WPS_BROWSE
, BUTTON_BACK
, BUTTON_NONE
},
63 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
64 { ACTION_WPS_CONTEXT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
66 { ACTION_WPS_VOLUP
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
67 { ACTION_WPS_VOLUP
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
68 { ACTION_WPS_VOLDOWN
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
69 { ACTION_WPS_VOLDOWN
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
72 }; /* button_context_wps */
74 static const struct button_mapping button_context_list
[] = {
75 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
76 }; /* button_context_list */
78 static const struct button_mapping button_context_tree
[] = {
79 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
80 }; /* button_context_tree */
82 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
83 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
86 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
87 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
90 static const struct button_mapping button_context_settings
[] = {
91 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
, BUTTON_NONE
},
92 { ACTION_SETTINGS_INCREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
93 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
94 { ACTION_SETTINGS_DECREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
95 { ACTION_STD_OK
, BUTTON_CENTER
, BUTTON_NONE
},
96 { ACTION_STD_CANCEL
, BUTTON_BACK
, BUTTON_NONE
},
97 { ACTION_SETTINGS_INC
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
98 { ACTION_SETTINGS_INCREPEAT
,BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
99 { ACTION_SETTINGS_DEC
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
100 { ACTION_SETTINGS_DECREPEAT
,BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
102 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
103 }; /* button_context_settings */
105 static const struct button_mapping button_context_settings_right_is_inc
[] = {
106 { ACTION_SETTINGS_INC
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
107 { ACTION_SETTINGS_INCREPEAT
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
108 { ACTION_SETTINGS_DEC
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
109 { ACTION_SETTINGS_DECREPEAT
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
,BUTTON_NONE
},
111 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
112 }; /* button_context_settingsgraphical */
114 static const struct button_mapping button_context_yesno
[] = {
115 { ACTION_YESNO_ACCEPT
, BUTTON_CENTER
, BUTTON_NONE
},
117 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
118 }; /* button_context_settings_yesno */
120 static const struct button_mapping button_context_colorchooser
[] = {
121 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
122 }; /* button_context_colorchooser */
124 static const struct button_mapping button_context_eq
[] = {
125 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
126 }; /* button_context_eq */
128 /** Bookmark Screen **/
129 static const struct button_mapping button_context_bmark
[] = {
130 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
131 }; /* button_context_bmark */
133 static const struct button_mapping button_context_time
[] = {
134 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
135 }; /* button_context_time */
137 static const struct button_mapping button_context_quickscreen
[] = {
138 { ACTION_STD_CANCEL
, BUTTON_BACK
|BUTTON_REL
, BUTTON_NONE
},
140 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
141 }; /* button_context_quickscreen */
143 static const struct button_mapping button_context_pitchscreen
[] = {
145 { ACTION_PS_INC_SMALL
, BUTTON_RIGHT
, BUTTON_NONE
},
146 { ACTION_PS_INC_BIG
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
147 { ACTION_PS_DEC_SMALL
, BUTTON_LEFT
, BUTTON_NONE
},
148 { ACTION_PS_DEC_BIG
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
149 { ACTION_PS_EXIT
, BUTTON_BACK
, BUTTON_NONE
},
151 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
152 }; /* button_context_pitchcreen */
154 static const struct button_mapping button_context_keyboard
[] = {
155 { ACTION_KBD_PAGE_FLIP
, BUTTON_MENU
, BUTTON_NONE
},
156 { ACTION_KBD_CURSOR_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
157 { ACTION_KBD_CURSOR_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
158 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
159 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
161 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
162 }; /* button_context_keyboard */
164 static const struct button_mapping button_context_radio
[] = {
165 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
)
166 }; /* button_context_radio */
168 const struct button_mapping
* target_get_context_mapping(int context
)
173 return button_context_standard
;
175 return button_context_wps
;
178 return button_context_list
;
179 case CONTEXT_MAINMENU
:
181 if (global_settings
.hold_lr_for_scroll_in_list
)
182 return button_context_listtree_scroll_without_combo
;
184 return button_context_listtree_scroll_with_combo
;
185 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
186 return button_context_tree
;
188 case CONTEXT_SETTINGS
:
189 return button_context_settings
;
190 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
191 case CONTEXT_SETTINGS_RECTRIGGER
:
192 return button_context_settings_right_is_inc
;
194 case CONTEXT_SETTINGS_COLOURCHOOSER
:
195 return button_context_colorchooser
;
196 case CONTEXT_SETTINGS_EQ
:
197 return button_context_eq
;
199 case CONTEXT_SETTINGS_TIME
:
200 return button_context_time
;
202 case CONTEXT_YESNOSCREEN
:
203 return button_context_yesno
;
205 return button_context_radio
;
206 case CONTEXT_BOOKMARKSCREEN
:
207 return button_context_bmark
;
208 case CONTEXT_QUICKSCREEN
:
209 return button_context_quickscreen
;
210 case CONTEXT_PITCHSCREEN
:
211 return button_context_pitchscreen
;
212 case CONTEXT_KEYBOARD
:
213 return button_context_keyboard
;
215 return button_context_standard
;