1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 Rob Purchase
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 the Cowon D2 target */
21 /* NB: Up/Down/Left/Right are not physical buttons - touchscreen emulation */
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 static const struct button_mapping button_context_standard
[] = {
40 { ACTION_STD_PREV
, BUTTON_MINUS
, BUTTON_NONE
},
41 { ACTION_STD_PREVREPEAT
, BUTTON_MINUS
|BUTTON_REPEAT
, BUTTON_NONE
},
42 { ACTION_STD_NEXT
, BUTTON_PLUS
, BUTTON_NONE
},
43 { ACTION_STD_NEXTREPEAT
, BUTTON_PLUS
|BUTTON_REPEAT
, BUTTON_NONE
},
45 { ACTION_STD_OK
, BUTTON_MENU
|BUTTON_REL
, BUTTON_NONE
},
46 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
47 // { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
48 { ACTION_STD_CONTEXT
, BUTTON_PLUS
|BUTTON_REPEAT
, BUTTON_NONE
},
49 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
51 }; /* button_context_standard */
54 static const struct button_mapping button_context_wps
[] = {
56 { ACTION_WPS_VOLDOWN
, BUTTON_MINUS
, BUTTON_NONE
},
57 { ACTION_WPS_VOLDOWN
, BUTTON_MINUS
|BUTTON_REPEAT
, BUTTON_NONE
},
58 { ACTION_WPS_VOLUP
, BUTTON_PLUS
, BUTTON_NONE
},
59 { ACTION_WPS_VOLUP
, BUTTON_PLUS
|BUTTON_REPEAT
, BUTTON_NONE
},
60 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
62 }; /* button_context_wps */
64 static const struct button_mapping button_context_list
[] = {
65 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
66 }; /* button_context_list */
68 static const struct button_mapping button_context_tree
[] = {
69 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
70 }; /* button_context_tree */
72 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
73 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
76 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
77 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
80 static const struct button_mapping button_context_settings
[] = {
81 { ACTION_SETTINGS_INC
, BUTTON_PLUS
, BUTTON_NONE
},
82 { ACTION_SETTINGS_INCREPEAT
, BUTTON_PLUS
|BUTTON_REPEAT
, BUTTON_NONE
},
83 { ACTION_SETTINGS_DEC
, BUTTON_MINUS
, BUTTON_NONE
},
84 { ACTION_SETTINGS_DECREPEAT
, BUTTON_MINUS
|BUTTON_REPEAT
, BUTTON_NONE
},
85 { ACTION_STD_OK
, BUTTON_MENU
, BUTTON_NONE
},
86 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
88 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
89 }; /* button_context_settings */
91 static const struct button_mapping button_context_settings_right_is_inc
[] = {
93 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
94 }; /* button_context_settingsgraphical */
96 static const struct button_mapping button_context_yesno
[] = {
97 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
98 }; /* button_context_settings_yesno */
100 static const struct button_mapping button_context_colorchooser
[] = {
101 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
102 }; /* button_context_colorchooser */
104 static const struct button_mapping button_context_eq
[] = {
105 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
106 }; /* button_context_eq */
108 /** Bookmark Screen **/
109 static const struct button_mapping button_context_bmark
[] = {
110 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
111 }; /* button_context_bmark */
113 static const struct button_mapping button_context_time
[] = {
114 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
115 }; /* button_context_time */
117 static const struct button_mapping button_context_quickscreen
[] = {
119 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
120 }; /* button_context_quickscreen */
122 static const struct button_mapping button_context_pitchscreen
[] = {
124 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
125 }; /* button_context_pitchcreen */
127 static const struct button_mapping button_context_keyboard
[] = {
128 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
130 }; /* button_context_keyboard */
132 const struct button_mapping
* target_get_context_mapping(int context
)
137 return button_context_standard
;
139 return button_context_wps
;
142 return button_context_list
;
143 case CONTEXT_MAINMENU
:
145 if (global_settings
.hold_lr_for_scroll_in_list
)
146 return button_context_listtree_scroll_without_combo
;
148 return button_context_listtree_scroll_with_combo
;
149 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
150 return button_context_tree
;
152 case CONTEXT_SETTINGS
:
153 return button_context_settings
;
154 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
155 return button_context_settings_right_is_inc
;
157 case CONTEXT_SETTINGS_COLOURCHOOSER
:
158 return button_context_colorchooser
;
159 case CONTEXT_SETTINGS_EQ
:
160 return button_context_eq
;
162 case CONTEXT_SETTINGS_TIME
:
163 return button_context_time
;
165 case CONTEXT_YESNOSCREEN
:
166 return button_context_yesno
;
167 case CONTEXT_BOOKMARKSCREEN
:
168 return button_context_bmark
;
169 case CONTEXT_QUICKSCREEN
:
170 return button_context_quickscreen
;
171 case CONTEXT_PITCHSCREEN
:
172 return button_context_pitchscreen
;
173 case CONTEXT_KEYBOARD
:
174 return button_context_keyboard
;
176 return button_context_standard
;