quick fix for FS#8729
[Rockbox.git] / apps / keymaps / keymap-player.c
blob1062a23dd3231de512f22cfdf7418dd5ce9abf7b
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2006 Jonathan Gordon
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
17 ****************************************************************************/
19 /* *
20 * Button Code Definitions for archos player targets
24 #include "config.h"
25 #include "action.h"
26 #include "button.h"
28 static const struct button_mapping button_context_standard[] = {
29 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
30 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
31 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
32 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
34 { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
35 { ACTION_STD_CANCEL, BUTTON_STOP, BUTTON_NONE },
36 { ACTION_STD_OK, BUTTON_ON, BUTTON_NONE },
37 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
38 { ACTION_STD_MENU, BUTTON_MENU, BUTTON_NONE },
40 LAST_ITEM_IN_LIST
43 static const struct button_mapping button_context_wps[] = {
44 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
45 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
46 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
47 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
48 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
49 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
50 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
51 { ACTION_WPS_STOP, BUTTON_STOP, BUTTON_NONE },
53 { ACTION_WPS_VOLDOWN, BUTTON_MENU|BUTTON_LEFT, BUTTON_NONE },
54 { ACTION_WPS_VOLDOWN, BUTTON_MENU|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
55 { ACTION_WPS_VOLUP, BUTTON_MENU|BUTTON_RIGHT, BUTTON_NONE },
56 { ACTION_WPS_VOLUP, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
58 { ACTION_WPS_BROWSE, BUTTON_ON|BUTTON_REL, BUTTON_ON },
59 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
60 { ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
61 { ACTION_WPS_ID3SCREEN, BUTTON_MENU|BUTTON_ON, BUTTON_NONE },
62 { ACTION_STD_KEYLOCK, BUTTON_MENU|BUTTON_STOP, BUTTON_NONE },
64 LAST_ITEM_IN_LIST
67 static const struct button_mapping button_context_settings[] = {
68 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
69 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
70 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
71 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
73 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
76 static const struct button_mapping button_context_tree[] = {
77 { ACTION_TREE_WPS, BUTTON_ON, BUTTON_NONE },
79 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
80 }; /* button_context_listtree */
82 static const struct button_mapping button_context_yesno[] = {
83 { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
85 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
86 }; /* button_context_settings_yesno */
88 static const struct button_mapping button_context_bmark[] = {
89 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_ON, BUTTON_PLAY },
90 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_ON, BUTTON_ON },
92 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
93 }; /* button_context_settings_bmark */
95 /*****************************************************************************
96 * Remote control mappings
97 *****************************************************************************/
99 static const struct button_mapping remote_button_context_standard[] = {
100 { ACTION_STD_PREV, BUTTON_RC_LEFT, BUTTON_NONE },
101 { ACTION_STD_NEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
102 { ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
103 { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
105 LAST_ITEM_IN_LIST
108 static const struct button_mapping remote_button_context_wps[] = {
109 { ACTION_WPS_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
110 { ACTION_WPS_SKIPNEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
111 { ACTION_WPS_SKIPPREV, BUTTON_RC_LEFT, BUTTON_NONE },
112 { ACTION_WPS_STOP, BUTTON_RC_STOP, BUTTON_NONE },
114 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
115 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
117 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
121 static const struct button_mapping* get_context_mapping_remote( int context )
123 context ^= CONTEXT_REMOTE;
125 switch (context)
127 case CONTEXT_WPS:
128 return remote_button_context_wps;
130 default:
131 return remote_button_context_standard;
135 const struct button_mapping* get_context_mapping( int context )
137 if (context&CONTEXT_REMOTE)
138 return get_context_mapping_remote(context);
140 switch (context)
142 case CONTEXT_WPS:
143 return button_context_wps;
145 case CONTEXT_SETTINGS:
146 return button_context_settings;
148 case CONTEXT_YESNOSCREEN:
149 return button_context_yesno;
151 case CONTEXT_TREE:
152 case CONTEXT_MAINMENU:
153 return button_context_tree;
154 case CONTEXT_BOOKMARKSCREEN:
155 return button_context_bmark;
156 case CONTEXT_STD:
157 case CONTEXT_LIST:
158 default:
159 return button_context_standard;