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_DPAD_UP
|BUTTON_REL
, BUTTON_NONE
},
42 { ACTION_STD_NEXT
, BUTTON_DPAD_DOWN
|BUTTON_REL
, BUTTON_NONE
},
44 { ACTION_STD_OK
, BUTTON_DPAD_CENTER
, BUTTON_NONE
},
45 { ACTION_STD_OK
, BUTTON_DPAD_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
46 { ACTION_STD_CANCEL
, BUTTON_BACK
, BUTTON_NONE
},
47 { ACTION_STD_CANCEL
, BUTTON_BACK
|BUTTON_REPEAT
, BUTTON_BACK
},
48 { ACTION_STD_CANCEL
, BUTTON_DPAD_LEFT
|BUTTON_REL
, BUTTON_NONE
},
50 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
51 { ACTION_STD_CONTEXT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
53 /* special hack to get a redraw on activity resume, see lcd-android.c */
54 { ACTION_REDRAW
, BUTTON_FORCE_REDRAW
, BUTTON_NONE
},
57 }; /* button_context_standard */
59 static const struct button_mapping button_context_wps
[] = {
60 { ACTION_WPS_BROWSE
, BUTTON_BACK
, BUTTON_NONE
},
61 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
62 { ACTION_WPS_CONTEXT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
63 { ACTION_WPS_VOLUP
, BUTTON_VOL_UP
, BUTTON_NONE
},
64 { ACTION_WPS_VOLUP
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
65 { ACTION_WPS_VOLDOWN
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
66 { ACTION_WPS_VOLDOWN
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
69 }; /* button_context_wps */
71 static const struct button_mapping button_context_list
[] = {
72 #ifdef HAVE_VOLUME_IN_LIST
73 { ACTION_LIST_VOLUP
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
74 { ACTION_LIST_VOLUP
, BUTTON_VOL_UP
, BUTTON_NONE
},
75 { ACTION_LIST_VOLDOWN
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
76 { ACTION_LIST_VOLDOWN
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
78 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
79 }; /* button_context_list */
81 static const struct button_mapping button_context_tree
[] = {
82 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
83 }; /* button_context_tree */
85 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
86 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
89 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
90 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
93 static const struct button_mapping button_context_settings
[] = {
94 { ACTION_SETTINGS_INC
, BUTTON_DPAD_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
95 { ACTION_SETTINGS_DEC
, BUTTON_DPAD_LEFT
|BUTTON_REL
, BUTTON_NONE
},
96 { ACTION_STD_OK
, BUTTON_DPAD_CENTER
, BUTTON_NONE
},
97 { ACTION_STD_CANCEL
, BUTTON_BACK
, BUTTON_NONE
},
99 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
100 }; /* button_context_settings */
102 static const struct button_mapping button_context_settings_right_is_inc
[] = {
104 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
105 }; /* button_context_settingsgraphical */
107 static const struct button_mapping button_context_yesno
[] = {
108 { ACTION_YESNO_ACCEPT
, BUTTON_DPAD_CENTER
, BUTTON_NONE
},
110 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
111 }; /* button_context_settings_yesno */
113 static const struct button_mapping button_context_colorchooser
[] = {
114 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
115 }; /* button_context_colorchooser */
117 static const struct button_mapping button_context_eq
[] = {
118 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
119 }; /* button_context_eq */
121 /** Bookmark Screen **/
122 static const struct button_mapping button_context_bmark
[] = {
123 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
124 }; /* button_context_bmark */
126 static const struct button_mapping button_context_time
[] = {
127 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
128 }; /* button_context_time */
130 static const struct button_mapping button_context_quickscreen
[] = {
131 { ACTION_STD_CANCEL
, BUTTON_BACK
|BUTTON_REL
, BUTTON_NONE
},
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
134 }; /* button_context_quickscreen */
136 static const struct button_mapping button_context_pitchscreen
[] = {
138 { ACTION_PS_INC_SMALL
, BUTTON_DPAD_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
139 { ACTION_PS_DEC_SMALL
, BUTTON_DPAD_LEFT
|BUTTON_REL
, BUTTON_NONE
},
140 { ACTION_PS_EXIT
, BUTTON_BACK
, BUTTON_NONE
},
142 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
143 }; /* button_context_pitchcreen */
146 static const struct button_mapping button_context_radio
[] = {
147 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
)
148 }; /* button_context_radio */
150 const struct button_mapping
* target_get_context_mapping(int context
)
155 return button_context_standard
;
157 return button_context_wps
;
160 return button_context_list
;
161 case CONTEXT_MAINMENU
:
163 if (global_settings
.hold_lr_for_scroll_in_list
)
164 return button_context_listtree_scroll_without_combo
;
166 return button_context_listtree_scroll_with_combo
;
167 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
168 return button_context_tree
;
170 case CONTEXT_SETTINGS
:
171 return button_context_settings
;
172 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
173 case CONTEXT_SETTINGS_RECTRIGGER
:
174 return button_context_settings_right_is_inc
;
176 case CONTEXT_SETTINGS_COLOURCHOOSER
:
177 return button_context_colorchooser
;
178 case CONTEXT_SETTINGS_EQ
:
179 return button_context_eq
;
181 case CONTEXT_SETTINGS_TIME
:
182 return button_context_time
;
185 return button_context_radio
;
186 case CONTEXT_BOOKMARKSCREEN
:
187 return button_context_bmark
;
188 case CONTEXT_QUICKSCREEN
:
189 return button_context_quickscreen
;
190 case CONTEXT_PITCHSCREEN
:
191 return button_context_pitchscreen
;
193 return button_context_standard
;