FS#8961 - Anti-Aliased Fonts.
[kugel-rb.git] / apps / keymaps / keymap-c100.c
blobe40a2df61ed1e59c97294ae1629c6ca1cf447039
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Mark Arigo
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 ****************************************************************************/
21 /* Button Code Definitions for Sandisk c100 target */
23 #include "config.h"
24 #include "action.h"
25 #include "button.h"
26 #include "settings.h"
28 /* {Action Code, Button code, Prereq button code } */
30 /*
31 * The format of the list is as follows
32 * { Action Code, Button code, Prereq button code }
33 * if there's no need to check the previous button's value, use BUTTON_NONE
34 * Insert LAST_ITEM_IN_LIST at the end of each mapping
36 static const struct button_mapping button_context_standard[] = {
37 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
38 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
39 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
40 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
41 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
42 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
43 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
44 { ACTION_STD_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
45 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
46 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
48 LAST_ITEM_IN_LIST
49 }; /* button_context_standard */
52 static const struct button_mapping button_context_wps[] = {
53 { ACTION_WPS_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
54 { ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
55 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
56 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
57 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
59 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
60 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
61 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL,BUTTON_RIGHT|BUTTON_REPEAT },
63 { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_POWER|BUTTON_RIGHT, BUTTON_POWER },
64 { ACTION_WPS_ABSETA_PREVDIR,BUTTON_POWER|BUTTON_LEFT, BUTTON_POWER },
65 { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_UP, BUTTON_POWER },
67 { ACTION_WPS_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
68 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
69 { ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_VOLUP, BUTTON_SELECT },
70 { ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_VOLDOWN, BUTTON_SELECT },
71 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
72 { ACTION_WPS_VIEW_PLAYLIST, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
73 { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
75 LAST_ITEM_IN_LIST
76 }; /* button_context_wps */
78 static const struct button_mapping button_context_settings[] = {
79 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
80 { ACTION_SETTINGS_RESET, BUTTON_SELECT, BUTTON_NONE },
81 { ACTION_SETTINGS_INC, BUTTON_VOLUP, BUTTON_NONE },
82 { ACTION_SETTINGS_INCREPEAT,BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
83 { ACTION_SETTINGS_DEC, BUTTON_VOLDOWN, BUTTON_NONE },
84 { ACTION_SETTINGS_DECREPEAT,BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
85 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
86 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
87 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
88 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
90 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
91 }; /* button_context_settings */
93 static const struct button_mapping button_context_list[] = {
94 #ifdef HAVE_VOLUME_IN_LIST
95 { ACTION_LIST_VOLUP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
96 { ACTION_LIST_VOLUP, BUTTON_VOLUP, BUTTON_NONE },
97 { ACTION_LIST_VOLDOWN, BUTTON_VOLDOWN, BUTTON_NONE },
98 { ACTION_LIST_VOLDOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
99 #endif
101 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
102 }; /* button_context_list */
104 static const struct button_mapping button_context_tree[] = {
105 { ACTION_TREE_WPS, BUTTON_UP|BUTTON_REL, BUTTON_UP },
106 { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
108 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
109 }; /* button_context_tree */
111 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
112 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
113 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
114 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
115 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
116 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
117 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
118 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
119 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
120 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
122 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
123 }; /* button_context_listtree_scroll_without_combo */
125 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
126 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
128 // { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC },
129 // { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
131 // { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC },
132 // { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
134 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
135 }; /* button_context_listtree_scroll_with_combo */
137 static const struct button_mapping button_context_yesno[] = {
138 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
140 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
141 }; /* button_context_settings_yesno */
143 static const struct button_mapping button_context_quickscreen[] = {
144 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
145 { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
146 { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
147 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
148 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
149 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
150 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
151 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
152 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
154 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
155 }; /* button_context_quickscreen */
157 static const struct button_mapping button_context_settings_right_is_inc[] = {
158 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
159 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
160 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
161 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
162 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
164 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
165 }; /* button_context_settings_right_is_inc */
167 static const struct button_mapping button_context_pitchscreen[] = {
168 { ACTION_PS_INC_SMALL, BUTTON_VOLUP, BUTTON_NONE },
169 { ACTION_PS_INC_BIG, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
170 { ACTION_PS_DEC_SMALL, BUTTON_VOLDOWN, BUTTON_NONE },
171 { ACTION_PS_DEC_BIG, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
172 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
173 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
174 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
175 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
176 { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
177 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
178 { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
179 { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
181 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
182 }; /* button_context_pitchscreen */
184 /** FM Radio Screen **/
185 #if CONFIG_TUNER
186 static const struct button_mapping button_context_radio[] = {
187 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
188 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
189 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
190 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
191 { ACTION_FM_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
192 { ACTION_FM_PRESET, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
193 { ACTION_FM_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
194 { ACTION_FM_MODE, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
195 { ACTION_FM_EXIT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
196 { ACTION_FM_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
198 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
199 }; /* button_context_radio */
200 #endif
202 static const struct button_mapping button_context_keyboard[] = {
203 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
204 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
205 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
206 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
208 // { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE },
209 // { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
210 // { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
211 // { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
213 { ACTION_KBD_UP, BUTTON_VOLUP, BUTTON_NONE },
214 { ACTION_KBD_UP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
215 { ACTION_KBD_DOWN, BUTTON_VOLDOWN, BUTTON_NONE },
216 { ACTION_KBD_DOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
218 // { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN, BUTTON_NONE },
219 // { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN|BUTTON_REPEAT,BUTTON_NONE },
220 // { ACTION_KBD_PAGE_FLIP, BUTTON_REC|BUTTON_SELECT, BUTTON_REC },
222 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
223 { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
224 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
226 LAST_ITEM_IN_LIST
227 }; /* button_context_keyboard */
229 static const struct button_mapping button_context_bmark[] = {
230 // { ACTION_BMS_DELETE, BUTTON_REC, BUTTON_NONE },
232 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
233 }; /* button_context_bmark */
235 #ifdef HAVE_USBSTACK
236 static const struct button_mapping button_context_usb_hid[] = {
237 { ACTION_USB_HID_PLAY, BUTTON_UP, BUTTON_NONE },
238 { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE },
239 { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
240 { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
241 { ACTION_USB_HID_MUTE, BUTTON_VOLDOWN, BUTTON_NONE },
242 { ACTION_USB_HID_MENU, BUTTON_DOWN, BUTTON_NONE },
244 LAST_ITEM_IN_LIST
245 }; /* button_context_usb_hid */
246 #endif
248 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
249 const struct button_mapping* get_context_mapping(int context)
251 switch (context)
253 case CONTEXT_STD:
254 return button_context_standard;
256 case CONTEXT_WPS:
257 return button_context_wps;
259 case CONTEXT_LIST:
260 return button_context_list;
261 case CONTEXT_TREE:
262 case CONTEXT_MAINMENU:
263 if (global_settings.hold_lr_for_scroll_in_list)
264 return button_context_listtree_scroll_without_combo;
265 else
266 return button_context_listtree_scroll_with_combo;
267 case CONTEXT_CUSTOM|CONTEXT_TREE:
268 return button_context_tree;
270 case CONTEXT_SETTINGS:
271 case CONTEXT_SETTINGS_TIME:
272 return button_context_settings;
273 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
274 case CONTEXT_SETTINGS_COLOURCHOOSER:
275 case CONTEXT_SETTINGS_EQ:
276 return button_context_settings_right_is_inc;
278 case CONTEXT_YESNOSCREEN:
279 return button_context_yesno;
280 #if CONFIG_TUNER
281 case CONTEXT_FM:
282 return button_context_radio;
283 #endif
284 case CONTEXT_BOOKMARKSCREEN:
285 return button_context_bmark;
286 case CONTEXT_QUICKSCREEN:
287 return button_context_quickscreen;
288 case CONTEXT_PITCHSCREEN:
289 return button_context_pitchscreen;
290 #ifdef HAVE_RECORDING
291 case CONTEXT_RECSCREEN:
292 return button_context_recscreen;
293 #endif
294 case CONTEXT_KEYBOARD:
295 return button_context_keyboard;
296 #ifdef HAVE_USBSTACK
297 case CONTEXT_USB_HID:
298 return button_context_usb_hid;
299 #endif
300 default:
301 return button_context_standard;
303 return button_context_standard;