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 ****************************************************************************/
22 /* Button Code Definitions for the Olympus M:robe 500 target */
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_RC_PLAY
, BUTTON_NONE
},
41 { ACTION_STD_PREVREPEAT
, BUTTON_RC_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
42 { ACTION_STD_NEXT
, BUTTON_RC_DOWN
, BUTTON_NONE
},
43 { ACTION_STD_NEXTREPEAT
, BUTTON_RC_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
45 { ACTION_STD_OK
, BUTTON_RC_HEART
|BUTTON_REL
, BUTTON_RC_HEART
},
46 { ACTION_STD_OK
, BUTTON_RC_FF
, BUTTON_NONE
},
47 { ACTION_STD_OK
, BUTTON_RC_FF
|BUTTON_REPEAT
, BUTTON_RC_FF
},
49 { ACTION_STD_MENU
, BUTTON_RC_MODE
, BUTTON_NONE
},
50 { ACTION_STD_QUICKSCREEN
, BUTTON_RC_MODE
|BUTTON_REPEAT
, BUTTON_NONE
},
51 { ACTION_STD_CONTEXT
, BUTTON_RC_HEART
|BUTTON_REPEAT
, BUTTON_RC_HEART
},
52 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
53 { ACTION_STD_CANCEL
, BUTTON_RC_REW
, BUTTON_NONE
},
54 { ACTION_STD_CANCEL
, BUTTON_RC_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
56 }; /* button_context_standard */
58 static const struct button_mapping button_context_wps
[] = {
59 { ACTION_WPS_PLAY
, BUTTON_RC_PLAY
|BUTTON_REL
, BUTTON_RC_PLAY
},
60 { ACTION_WPS_STOP
, BUTTON_RC_DOWN
|BUTTON_REL
, BUTTON_RC_DOWN
},
62 { ACTION_WPS_SKIPNEXT
, BUTTON_RC_FF
|BUTTON_REL
, BUTTON_RC_FF
},
63 { ACTION_WPS_SKIPPREV
, BUTTON_RC_REW
|BUTTON_REL
, BUTTON_RC_REW
},
65 { ACTION_WPS_SEEKBACK
, BUTTON_RC_REW
|BUTTON_REPEAT
,BUTTON_NONE
},
66 { ACTION_WPS_SEEKFWD
, BUTTON_RC_FF
|BUTTON_REPEAT
, BUTTON_NONE
},
68 { ACTION_WPS_STOPSEEK
, BUTTON_RC_REW
|BUTTON_REL
,
69 BUTTON_RC_REW
|BUTTON_REPEAT
},
71 { ACTION_WPS_STOPSEEK
, BUTTON_RC_FF
|BUTTON_REL
,
72 BUTTON_RC_FF
|BUTTON_REPEAT
},
74 { ACTION_WPS_VOLDOWN
, BUTTON_RC_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
75 { ACTION_WPS_VOLDOWN
, BUTTON_RC_VOL_DOWN
, BUTTON_NONE
},
76 { ACTION_WPS_VOLUP
, BUTTON_RC_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
77 { ACTION_WPS_VOLUP
, BUTTON_RC_VOL_UP
, BUTTON_NONE
},
79 { ACTION_WPS_QUICKSCREEN
, BUTTON_RC_MODE
|BUTTON_REPEAT
, BUTTON_RC_MODE
},
80 { ACTION_WPS_MENU
, BUTTON_RC_MODE
|BUTTON_REL
, BUTTON_RC_MODE
},
81 { ACTION_WPS_MENU
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
82 { ACTION_WPS_CONTEXT
, BUTTON_RC_HEART
|BUTTON_REPEAT
, BUTTON_RC_HEART
},
84 { ACTION_WPS_BROWSE
, BUTTON_RC_HEART
|BUTTON_REL
, BUTTON_RC_HEART
},
87 }; /* button_context_wps */
89 static const struct button_mapping button_context_list
[] = {
90 #ifdef HAVE_VOLUME_IN_LIST
91 { ACTION_LIST_VOLUP
, BUTTON_RC_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
92 { ACTION_LIST_VOLUP
, BUTTON_RC_VOL_UP
, BUTTON_NONE
},
93 { ACTION_LIST_VOLDOWN
, BUTTON_RC_VOL_DOWN
, BUTTON_NONE
},
94 { ACTION_LIST_VOLDOWN
, BUTTON_RC_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
96 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
97 }; /* button_context_list */
99 static const struct button_mapping button_context_tree
[] = {
100 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
101 }; /* button_context_tree */
103 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
104 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
107 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
108 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
111 static const struct button_mapping button_context_settings
[] = {
113 { ACTION_SETTINGS_INC
, BUTTON_RC_PLAY
, BUTTON_NONE
},
114 { ACTION_SETTINGS_INCREPEAT
, BUTTON_RC_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
115 { ACTION_SETTINGS_DEC
, BUTTON_RC_DOWN
, BUTTON_NONE
},
116 { ACTION_SETTINGS_DECREPEAT
, BUTTON_RC_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
117 { ACTION_STD_PREV
, BUTTON_RC_REW
, BUTTON_NONE
},
118 { ACTION_STD_PREVREPEAT
, BUTTON_RC_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
119 { ACTION_STD_NEXT
, BUTTON_RC_FF
, BUTTON_NONE
},
120 { ACTION_STD_NEXTREPEAT
, BUTTON_RC_FF
|BUTTON_REPEAT
, BUTTON_NONE
},
121 { ACTION_SETTINGS_RESET
, BUTTON_RC_MODE
, BUTTON_NONE
},
123 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
124 }; /* button_context_settings */
126 static const struct button_mapping button_context_settings_right_is_inc
[] = {
127 { ACTION_SETTINGS_INC
, BUTTON_RC_FF
, BUTTON_NONE
},
128 { ACTION_SETTINGS_INCREPEAT
, BUTTON_RC_FF
|BUTTON_REPEAT
, BUTTON_NONE
},
129 { ACTION_SETTINGS_DEC
, BUTTON_RC_REW
, BUTTON_NONE
},
130 { ACTION_SETTINGS_DECREPEAT
, BUTTON_RC_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
131 { ACTION_STD_PREV
, BUTTON_RC_PLAY
, BUTTON_NONE
},
132 { ACTION_STD_PREVREPEAT
, BUTTON_RC_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
133 { ACTION_STD_NEXT
, BUTTON_RC_DOWN
, BUTTON_NONE
},
134 { ACTION_STD_NEXTREPEAT
, BUTTON_RC_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
135 { ACTION_SETTINGS_RESET
, BUTTON_RC_MODE
, BUTTON_NONE
},
137 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
138 }; /* button_context_settingsgraphical */
140 static const struct button_mapping button_context_yesno
[] = {
141 { ACTION_YESNO_ACCEPT
, BUTTON_RC_PLAY
, BUTTON_NONE
},
142 { ACTION_YESNO_ACCEPT
, BUTTON_POWER
, BUTTON_NONE
},
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
144 }; /* button_context_settings_yesno */
146 static const struct button_mapping button_context_colorchooser
[] = {
147 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
148 }; /* button_context_colorchooser */
150 static const struct button_mapping button_context_eq
[] = {
151 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
152 }; /* button_context_eq */
154 /** Bookmark Screen **/
155 static const struct button_mapping button_context_bmark
[] = {
156 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
157 }; /* button_context_bmark */
159 static const struct button_mapping button_context_time
[] = {
160 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
161 { ACTION_STD_OK
, BUTTON_RC_HEART
, BUTTON_NONE
},
162 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
163 }; /* button_context_time */
165 static const struct button_mapping button_context_quickscreen
[] = {
166 { ACTION_STD_CANCEL
, BUTTON_RC_MODE
, BUTTON_NONE
},
167 { ACTION_QS_TOP
, BUTTON_RC_PLAY
, BUTTON_NONE
},
168 { ACTION_QS_DOWN
, BUTTON_RC_DOWN
, BUTTON_NONE
},
169 { ACTION_QS_LEFT
, BUTTON_RC_REW
, BUTTON_NONE
},
170 { ACTION_QS_RIGHT
, BUTTON_RC_FF
, BUTTON_NONE
},
173 }; /* button_context_quickscreen */
175 static const struct button_mapping button_context_pitchscreen
[] = {
177 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
178 }; /* button_context_pitchcreen */
180 static const struct button_mapping button_context_keyboard
[] = {
181 { ACTION_KBD_LEFT
, BUTTON_RC_REW
, BUTTON_NONE
},
182 { ACTION_KBD_LEFT
, BUTTON_RC_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
183 { ACTION_KBD_RIGHT
, BUTTON_RC_FF
, BUTTON_NONE
},
184 { ACTION_KBD_RIGHT
, BUTTON_RC_FF
|BUTTON_REPEAT
, BUTTON_NONE
},
185 { ACTION_KBD_SELECT
, BUTTON_RC_HEART
, BUTTON_NONE
},
186 { ACTION_KBD_DONE
, BUTTON_RC_MODE
|BUTTON_REL
, BUTTON_NONE
},
187 { ACTION_KBD_ABORT
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
188 { ACTION_KBD_BACKSPACE
, BUTTON_RC_VOL_DOWN
, BUTTON_NONE
},
189 { ACTION_KBD_BACKSPACE
, BUTTON_RC_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
190 { ACTION_KBD_UP
, BUTTON_RC_PLAY
, BUTTON_NONE
},
191 { ACTION_KBD_UP
, BUTTON_RC_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
192 { ACTION_KBD_DOWN
, BUTTON_RC_DOWN
, BUTTON_NONE
},
193 { ACTION_KBD_DOWN
, BUTTON_RC_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
194 { ACTION_KBD_MORSE_SELECT
, BUTTON_RC_HEART
|BUTTON_REL
, BUTTON_NONE
},
197 }; /* button_context_keyboard */
199 const struct button_mapping
* target_get_context_mapping(int context
)
201 switch (context
&(~CONTEXT_REMOTE
))
204 return button_context_standard
;
206 return button_context_wps
;
209 return button_context_list
;
210 case CONTEXT_MAINMENU
:
212 if (global_settings
.hold_lr_for_scroll_in_list
)
213 return button_context_listtree_scroll_without_combo
;
215 return button_context_listtree_scroll_with_combo
;
216 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
217 return button_context_tree
;
219 case CONTEXT_SETTINGS
:
220 return button_context_settings
;
221 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
222 return button_context_settings_right_is_inc
;
224 case CONTEXT_SETTINGS_COLOURCHOOSER
:
225 return button_context_colorchooser
;
226 case CONTEXT_SETTINGS_EQ
:
227 return button_context_eq
;
229 case CONTEXT_SETTINGS_TIME
:
230 return button_context_time
;
232 case CONTEXT_YESNOSCREEN
:
233 return button_context_yesno
;
234 case CONTEXT_BOOKMARKSCREEN
:
235 return button_context_bmark
;
236 case CONTEXT_QUICKSCREEN
:
237 return button_context_quickscreen
;
238 case CONTEXT_PITCHSCREEN
:
239 return button_context_pitchscreen
;
240 case CONTEXT_KEYBOARD
:
241 case CONTEXT_MORSE_INPUT
:
242 return button_context_keyboard
;
244 return button_context_standard
;