Prepare new maemo release
[maemo-rb.git] / apps / keymaps / keymap-player.c
blobbcfb4869df7d0c868909e1195e2f3125c2761c48
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 player targets
27 #include "config.h"
28 #include "action.h"
29 #include "button.h"
31 static const struct button_mapping button_context_standard[] = {
32 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
33 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
34 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
35 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
37 { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
38 { ACTION_STD_CANCEL, BUTTON_STOP, BUTTON_NONE },
39 { ACTION_STD_OK, BUTTON_ON, BUTTON_NONE },
40 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
41 { ACTION_STD_MENU, BUTTON_MENU, BUTTON_NONE },
43 LAST_ITEM_IN_LIST
46 static const struct button_mapping button_context_wps[] = {
47 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
48 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
49 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
50 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
51 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
52 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
53 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
54 { ACTION_WPS_STOP, BUTTON_STOP, BUTTON_NONE },
56 { ACTION_WPS_VOLDOWN, BUTTON_MENU|BUTTON_LEFT, BUTTON_NONE },
57 { ACTION_WPS_VOLDOWN, BUTTON_MENU|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
58 { ACTION_WPS_VOLUP, BUTTON_MENU|BUTTON_RIGHT, BUTTON_NONE },
59 { ACTION_WPS_VOLUP, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
61 { ACTION_WPS_BROWSE, BUTTON_ON|BUTTON_REL, BUTTON_ON },
62 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
63 { ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
64 { ACTION_STD_KEYLOCK, BUTTON_MENU|BUTTON_STOP, BUTTON_NONE },
65 { ACTION_WPS_HOTKEY, BUTTON_MENU|BUTTON_ON, BUTTON_NONE },
67 LAST_ITEM_IN_LIST
70 static const struct button_mapping button_context_settings[] = {
71 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
72 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
73 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
74 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
76 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
79 static const struct button_mapping button_context_tree[] = {
80 { ACTION_TREE_WPS, BUTTON_ON, BUTTON_NONE },
81 { ACTION_TREE_HOTKEY, BUTTON_MENU|BUTTON_ON, BUTTON_NONE },
83 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
84 }; /* button_context_listtree */
86 static const struct button_mapping button_context_yesno[] = {
87 { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
89 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
90 }; /* button_context_settings_yesno */
92 static const struct button_mapping button_context_bmark[] = {
93 { ACTION_NONE, BUTTON_ON, BUTTON_NONE },
94 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_ON, BUTTON_NONE },
96 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
97 }; /* button_context_settings_bmark */
99 /*****************************************************************************
100 * Remote control mappings
101 *****************************************************************************/
103 static const struct button_mapping remote_button_context_standard[] = {
104 { ACTION_STD_PREV, BUTTON_RC_LEFT, BUTTON_NONE },
105 { ACTION_STD_NEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
106 { ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
107 { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
109 LAST_ITEM_IN_LIST
112 static const struct button_mapping remote_button_context_wps[] = {
113 { ACTION_WPS_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
114 { ACTION_WPS_SKIPNEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
115 { ACTION_WPS_SKIPPREV, BUTTON_RC_LEFT, BUTTON_NONE },
116 { ACTION_WPS_STOP, BUTTON_RC_STOP, BUTTON_NONE },
118 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
119 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
121 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
125 static const struct button_mapping* get_context_mapping_remote( int context )
127 context ^= CONTEXT_REMOTE;
129 switch (context)
131 case CONTEXT_WPS:
132 return remote_button_context_wps;
134 default:
135 return remote_button_context_standard;
139 const struct button_mapping* get_context_mapping( int context )
141 if (context&CONTEXT_REMOTE)
142 return get_context_mapping_remote(context);
144 switch (context)
146 case CONTEXT_WPS:
147 return button_context_wps;
149 case CONTEXT_SETTINGS:
150 return button_context_settings;
152 case CONTEXT_YESNOSCREEN:
153 return button_context_yesno;
155 case CONTEXT_TREE:
156 case CONTEXT_MAINMENU:
157 return button_context_tree;
158 case CONTEXT_BOOKMARKSCREEN:
159 return button_context_bmark;
160 case CONTEXT_STD:
161 case CONTEXT_LIST:
162 default:
163 return button_context_standard;