* Onda VX747: add browse screen, pitchscreen, context menu, quickscreen, rewind...
[kugel-rb.git] / apps / keymaps / keymap-ondio.c
blob5e561172987e3e9b1f1b1f2a13a587465a32f430
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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 /* *
23 * Button Code Definitions for archos ondio fm/sp targets
26 #include "config.h"
27 #include "action.h"
28 #include "button.h"
29 #include "settings.h"
31 /* CONTEXT_CUSTOM's used in this file...
33 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
38 static const struct button_mapping button_context_standard[] = {
39 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
40 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
41 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
42 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
44 { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
45 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
46 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
47 { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
48 { ACTION_STD_CANCEL, BUTTON_OFF, BUTTON_NONE },
50 LAST_ITEM_IN_LIST
53 static const struct button_mapping button_context_wps[] = {
54 { ACTION_WPS_PLAY, BUTTON_OFF|BUTTON_REL, BUTTON_OFF },
55 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
56 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
57 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
58 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
59 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
60 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
61 { ACTION_WPS_STOP, BUTTON_OFF|BUTTON_REPEAT, BUTTON_OFF },
62 { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
63 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
64 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
65 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
66 { ACTION_WPS_BROWSE, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
67 { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
68 /* { ACTION_WPS_MENU, BUTTON_NONE, BUTTON_NONE }, we can't have that */
69 { ACTION_STD_KEYLOCK, BUTTON_MENU|BUTTON_DOWN, BUTTON_NONE },
70 /* { ACTION_WPS_VIEW_PLAYLIST,BUTTON_NONE, BUTTON_NONE }, can't have this either */
72 LAST_ITEM_IN_LIST
75 static const struct button_mapping button_context_settings[] = {
76 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
77 { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
78 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
79 { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
80 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
81 { ACTION_STD_OK, BUTTON_LEFT, BUTTON_NONE },
82 { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
84 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
87 static const struct button_mapping button_context_tree[] = {
88 { ACTION_TREE_WPS, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
89 { ACTION_TREE_STOP, BUTTON_OFF, BUTTON_NONE },
90 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
92 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
93 }; /* button_context_listtree */
95 static const struct button_mapping button_context_tree_scroll_lr[] = {
96 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
97 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
98 { ACTION_TREE_PGLEFT, BUTTON_MENU|BUTTON_LEFT, BUTTON_NONE },
99 { ACTION_TREE_ROOT_INIT, BUTTON_MENU|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_MENU|BUTTON_LEFT },
100 { ACTION_TREE_PGLEFT, BUTTON_MENU|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
101 { ACTION_TREE_PGLEFT, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REL, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REPEAT },
102 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
103 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
104 { ACTION_TREE_PGRIGHT, BUTTON_MENU|BUTTON_RIGHT, BUTTON_NONE },
105 { ACTION_TREE_PGRIGHT, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
106 { ACTION_TREE_PGRIGHT, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REL, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REPEAT },
108 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
111 static const struct button_mapping button_context_yesno[] = {
112 { ACTION_YESNO_ACCEPT, BUTTON_RIGHT, BUTTON_NONE },
114 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
117 static const struct button_mapping button_context_bmark[] = {
118 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
119 { ACTION_BMS_DELETE, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
121 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
122 }; /* button_context_settings_bmark */
124 static const struct button_mapping button_context_pitchscreen[] = {
125 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
126 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
127 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
128 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
129 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
130 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
131 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
132 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
133 { ACTION_PS_TOGGLE_MODE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
134 { ACTION_PS_RESET, BUTTON_MENU, BUTTON_NONE },
135 { ACTION_PS_EXIT, BUTTON_OFF, BUTTON_NONE },
137 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
138 }; /* button_context_pitchscreen */
140 #ifdef HAVE_RECORDING
141 static const struct button_mapping button_context_rectrigger[] = {
142 { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_RECSCREEN)
145 static const struct button_mapping button_context_recscreen[] = {
146 { ACTION_REC_PAUSE, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
147 { ACTION_SETTINGS_INC, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
148 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
149 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
150 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
152 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
153 }; /* button_context_recscreen */
154 #endif /* HAVE_RECORDING */
156 static const struct button_mapping button_context_keyboard[] = {
157 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
158 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
159 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
160 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
161 { ACTION_KBD_SELECT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
162 { ACTION_KBD_DONE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
163 { ACTION_KBD_ABORT, BUTTON_OFF, BUTTON_NONE },
164 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
165 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
166 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
167 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
169 LAST_ITEM_IN_LIST
170 }; /* button_context_keyboard */
172 #if CONFIG_TUNER
173 static const struct button_mapping button_context_radio[] = {
174 { ACTION_FM_MENU, BUTTON_MENU | BUTTON_REPEAT, BUTTON_NONE },
175 { ACTION_FM_RECORD_DBLPRE, BUTTON_MENU, BUTTON_NONE},
176 { ACTION_FM_RECORD, BUTTON_MENU | BUTTON_REL, BUTTON_NONE },
177 { ACTION_FM_STOP, BUTTON_OFF | BUTTON_REPEAT, BUTTON_OFF },
178 { ACTION_FM_EXIT, BUTTON_OFF | BUTTON_REL, BUTTON_OFF },
179 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
180 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
181 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
182 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
186 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
189 #endif
191 const struct button_mapping* get_context_mapping( int context )
193 switch( context )
195 case CONTEXT_STD:
196 return button_context_standard;
198 case CONTEXT_WPS:
199 return button_context_wps;
201 case CONTEXT_SETTINGS:
202 return button_context_settings;
204 case CONTEXT_YESNOSCREEN:
205 return button_context_yesno;
207 case CONTEXT_BOOKMARKSCREEN:
208 return button_context_bmark;
209 case CONTEXT_PITCHSCREEN:
210 return button_context_pitchscreen;
211 case CONTEXT_TREE:
212 case CONTEXT_MAINMENU:
213 if (global_settings.hold_lr_for_scroll_in_list)
214 return button_context_tree_scroll_lr;
215 /* else fall through to CUSTOM|CONTEXT_TREE */
216 case CONTEXT_CUSTOM|CONTEXT_TREE:
217 return button_context_tree;
218 #ifdef HAVE_RECORDING
219 case CONTEXT_RECSCREEN:
220 return button_context_recscreen;
221 case CONTEXT_SETTINGS_RECTRIGGER:
222 return button_context_rectrigger;
223 #endif
224 case CONTEXT_KEYBOARD:
225 return button_context_keyboard;
226 #if CONFIG_TUNER
227 case CONTEXT_FM:
228 return button_context_radio;
229 #endif
230 case CONTEXT_LIST:
231 default:
232 return button_context_standard;