fix DEBUGF statement to print variables that actually exist (FS#10212 by Tomer Shalev)
[kugel-rb.git] / apps / keymaps / keymap-player.c
blob82362ecedb230e1766f7e7b440b2a298f6c2ce43
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_WPS_ID3SCREEN, BUTTON_MENU|BUTTON_ON, BUTTON_NONE },
65 { ACTION_STD_KEYLOCK, BUTTON_MENU|BUTTON_STOP, 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 },
82 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
83 }; /* button_context_listtree */
85 static const struct button_mapping button_context_yesno[] = {
86 { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
88 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
89 }; /* button_context_settings_yesno */
91 static const struct button_mapping button_context_bmark[] = {
92 { ACTION_NONE, BUTTON_ON, BUTTON_NONE },
93 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_ON, BUTTON_NONE },
95 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
96 }; /* button_context_settings_bmark */
98 /*****************************************************************************
99 * Remote control mappings
100 *****************************************************************************/
102 static const struct button_mapping remote_button_context_standard[] = {
103 { ACTION_STD_PREV, BUTTON_RC_LEFT, BUTTON_NONE },
104 { ACTION_STD_NEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
105 { ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
106 { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
108 LAST_ITEM_IN_LIST
111 static const struct button_mapping remote_button_context_wps[] = {
112 { ACTION_WPS_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
113 { ACTION_WPS_SKIPNEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
114 { ACTION_WPS_SKIPPREV, BUTTON_RC_LEFT, BUTTON_NONE },
115 { ACTION_WPS_STOP, BUTTON_RC_STOP, BUTTON_NONE },
117 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
118 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
120 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
124 static const struct button_mapping* get_context_mapping_remote( int context )
126 context ^= CONTEXT_REMOTE;
128 switch (context)
130 case CONTEXT_WPS:
131 return remote_button_context_wps;
133 default:
134 return remote_button_context_standard;
138 const struct button_mapping* get_context_mapping( int context )
140 if (context&CONTEXT_REMOTE)
141 return get_context_mapping_remote(context);
143 switch (context)
145 case CONTEXT_WPS:
146 return button_context_wps;
148 case CONTEXT_SETTINGS:
149 return button_context_settings;
151 case CONTEXT_YESNOSCREEN:
152 return button_context_yesno;
154 case CONTEXT_TREE:
155 case CONTEXT_MAINMENU:
156 return button_context_tree;
157 case CONTEXT_BOOKMARKSCREEN:
158 return button_context_bmark;
159 case CONTEXT_STD:
160 case CONTEXT_LIST:
161 default:
162 return button_context_standard;