ypr0: Fix graphical eq keymap.
[maemo-rb.git] / apps / keymaps / keymap-yh8xx_yh9xx.c
blobdb468a88b7859b392ad6ee9c9e2ab73919b29860
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 /* Button Code Definitions for samsung yh-820 / yh-920 / yh-925 target */
23 #include <stdio.h>
24 #include <string.h>
25 #include <stdlib.h>
27 #include "config.h"
28 #include "action.h"
29 #include "button.h"
30 #include "settings.h"
32 /*
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 /* CONTEXT_CUSTOM's used in this file...
41 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
42 CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
43 i.e where up/down is inc/dec
44 CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
49 static const struct button_mapping button_context_standard[] = {
50 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
51 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
52 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
54 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
55 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
56 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
57 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
59 { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
60 /* kludge: pressing 2 directional buttons is easy on this target */
61 { ACTION_STD_QUICKSCREEN, BUTTON_LEFT|BUTTON_DOWN|BUTTON_REPEAT,
62 BUTTON_LEFT|BUTTON_DOWN|BUTTON_REPEAT },
64 { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
66 LAST_ITEM_IN_LIST
67 }; /* button_context_standard */
69 static const struct button_mapping button_context_wps[] = {
70 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
71 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
73 { ACTION_WPS_SKIPNEXT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD },
74 { ACTION_WPS_SEEKFWD, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
75 { ACTION_WPS_STOPSEEK, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT },
77 { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
78 { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
79 { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
81 { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY },
82 { ACTION_WPS_ABSETA_PREVDIR,BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
83 { ACTION_WPS_ABRESET, BUTTON_PLAY|BUTTON_UP, BUTTON_PLAY },
85 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
86 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
87 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
88 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
90 { ACTION_WPS_BROWSE, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
92 /* these match context_standard */
93 { ACTION_WPS_MENU, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
94 { ACTION_WPS_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
95 /* kludge: pressing 2 directional buttons is easy on this target */
96 { ACTION_WPS_QUICKSCREEN, BUTTON_LEFT|BUTTON_DOWN|BUTTON_REPEAT,
97 BUTTON_LEFT|BUTTON_DOWN|BUTTON_REPEAT },
99 { ACTION_WPS_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
100 { ACTION_WPS_VIEW_PLAYLIST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
101 { ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
103 LAST_ITEM_IN_LIST
104 }; /* button_context_wps */
106 static const struct button_mapping button_context_list[] = {
107 #ifdef SAMSUNG_YH820
108 { ACTION_LISTTREE_PGUP, BUTTON_REC|BUTTON_UP, BUTTON_REC },
109 { ACTION_LISTTREE_PGDOWN, BUTTON_REC|BUTTON_DOWN, BUTTON_REC },
110 #else
111 { ACTION_LISTTREE_PGUP, BUTTON_FFWD, BUTTON_NONE },
112 { ACTION_LISTTREE_PGDOWN, BUTTON_REW, BUTTON_NONE },
113 #endif
115 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
116 }; /* button_context_list */
118 static const struct button_mapping button_context_tree[] = {
119 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
120 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
121 { ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
123 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
124 }; /* button_context_tree */
126 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
127 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE },
128 { ACTION_TREE_ROOT_INIT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_REC|BUTTON_LEFT },
129 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
130 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
131 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE)
136 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
137 { ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
138 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
139 { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
141 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE)
144 static const struct button_mapping button_context_settings[] = {
145 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
146 { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
148 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
149 { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
151 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
152 { ACTION_STD_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
153 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
155 { ACTION_STD_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
156 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
158 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
160 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
161 }; /* button_context_settings */
163 static const struct button_mapping button_context_settings_right_is_inc[] = {
164 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
165 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
167 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
168 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
170 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
171 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
173 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
174 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
176 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
178 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
179 }; /* button_context_settingsgraphical */
181 static const struct button_mapping button_context_yesno[] = {
182 { ACTION_YESNO_ACCEPT, BUTTON_RIGHT, BUTTON_NONE },
184 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
185 }; /* button_context_settings_yesno */
187 static const struct button_mapping button_context_colorchooser[] = {
188 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
190 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS)
191 }; /* button_context_settings_colorchooser */
193 static const struct button_mapping button_context_eq[] = {
194 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
196 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS)
197 }; /* button_context_settings_context_eq */
199 static const struct button_mapping button_context_bmark[] = {
200 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
202 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
203 }; /* button_context_settings_bmark */
205 static const struct button_mapping button_context_time[] = {
206 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
207 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
209 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
210 }; /* button_context_settings_bmark */
212 static const struct button_mapping button_context_quickscreen[] = {
213 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
214 { ACTION_NONE, BUTTON_LEFT|BUTTON_DOWN|BUTTON_REL,BUTTON_NONE },
216 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_UP },
217 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
219 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
220 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
222 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
223 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
225 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
226 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
228 { ACTION_STD_CANCEL, BUTTON_PLAY, BUTTON_NONE },
229 { ACTION_STD_CANCEL, BUTTON_FFWD, BUTTON_NONE },
231 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
232 }; /* button_context_quickscreen */
234 static const struct button_mapping button_context_pitchscreen[] = {
235 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
236 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
238 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
239 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
241 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
242 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
244 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
245 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
247 { ACTION_PS_TOGGLE_MODE, BUTTON_FFWD, BUTTON_NONE },
248 { ACTION_PS_RESET, BUTTON_REW, BUTTON_NONE },
249 { ACTION_PS_EXIT, BUTTON_PLAY, BUTTON_NONE },
251 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
252 }; /* button_context_pitchcreen */
254 static const struct button_mapping button_context_recscreen[] = {
255 { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
256 #ifdef SAMSUNG_YH820
257 /* the yh-820 has a rec button */
258 { ACTION_REC_NEWFILE, BUTTON_REC, BUTTON_NONE },
259 #else
260 /* the yh-920 & yh-925 have a rec switch */
261 { ACTION_REC_NEWFILE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
262 #endif
264 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
265 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
267 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
268 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
270 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
271 }; /* button_context_recscreen */
273 static const struct button_mapping button_context_keyboard[] = {
274 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
275 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
277 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
278 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
280 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
281 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
283 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
284 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
286 { ACTION_KBD_CURSOR_LEFT, BUTTON_REW|BUTTON_REL, BUTTON_FFWD },
287 { ACTION_KBD_CURSOR_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
289 { ACTION_KBD_CURSOR_RIGHT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD },
290 { ACTION_KBD_CURSOR_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
292 { ACTION_KBD_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
293 { ACTION_KBD_PAGE_FLIP, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE },
295 { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
296 { ACTION_KBD_ABORT, BUTTON_FFWD|BUTTON_PLAY, BUTTON_FFWD },
297 { ACTION_KBD_ABORT, BUTTON_FFWD|BUTTON_REW, BUTTON_FFWD },
299 LAST_ITEM_IN_LIST
300 }; /* button_context_keyboard */
302 const struct button_mapping* get_context_mapping(int context)
304 switch (context)
306 case CONTEXT_STD:
307 return button_context_standard;
308 case CONTEXT_WPS:
309 return button_context_wps;
311 case CONTEXT_LIST:
312 return button_context_list;
313 case CONTEXT_TREE:
314 case CONTEXT_MAINMENU:
315 if (global_settings.hold_lr_for_scroll_in_list)
316 return button_context_listtree_scroll_without_combo;
317 else
318 return button_context_listtree_scroll_with_combo;
319 case CONTEXT_CUSTOM|CONTEXT_TREE:
320 return button_context_tree;
322 case CONTEXT_SETTINGS:
323 return button_context_settings;
324 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
325 case CONTEXT_SETTINGS_RECTRIGGER:
326 return button_context_settings_right_is_inc;
328 case CONTEXT_SETTINGS_COLOURCHOOSER:
329 return button_context_colorchooser;
330 case CONTEXT_SETTINGS_EQ:
331 return button_context_eq;
333 case CONTEXT_SETTINGS_TIME:
334 return button_context_time;
336 case CONTEXT_YESNOSCREEN:
337 return button_context_yesno;
338 case CONTEXT_BOOKMARKSCREEN:
339 return button_context_bmark;
340 case CONTEXT_QUICKSCREEN:
341 return button_context_quickscreen;
342 case CONTEXT_PITCHSCREEN:
343 return button_context_pitchscreen;
344 case CONTEXT_RECSCREEN:
345 return button_context_recscreen;
346 case CONTEXT_KEYBOARD:
347 return button_context_keyboard;
349 return button_context_standard;