Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 1 | /***************************************************************************
|
| 2 | * __________ __ ___.
|
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
| 7 | * \/ \/ \/ \/ \/
|
| 8 | * $Id$
|
| 9 | *
|
| 10 | * Copyright (C) 2008 by Maurus Cuelenaere
|
| 11 | *
|
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 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. |
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 16 | *
|
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
| 18 | * KIND, either express or implied.
|
| 19 | *
|
| 20 | ****************************************************************************/
|
| 21 |
|
| 22 | /* Button Code Definitions for the Creative Zen Vision:M target */
|
| 23 | #include <stdio.h>
|
| 24 | #include <string.h>
|
| 25 | #include <stdlib.h>
|
| 26 |
|
| 27 | #include "config.h"
|
| 28 | #include "action.h"
|
| 29 | #include "button.h"
|
| 30 | #include "settings.h"
|
| 31 |
|
| 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
|
| 37 | */
|
| 38 |
|
| 39 | /* CONTEXT_CUSTOM's used in this file...
|
| 40 |
|
| 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
|
| 45 |
|
| 46 | */
|
| 47 |
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 48 | static const struct button_mapping button_context_standard[] = {
|
| 49 | { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
|
| 50 | { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
| 51 | { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
|
| 52 | { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
| 53 |
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 54 | { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
|
| 55 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 56 |
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 57 | { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 58 |
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 59 | { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
|
| 60 | { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 61 |
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 62 | { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
|
| 63 | { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 64 |
|
| 65 | LAST_ITEM_IN_LIST
|
| 66 | }; /* button_context_standard */
|
| 67 |
|
| 68 |
|
| 69 | static const struct button_mapping button_context_wps[] = {
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 70 | { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
| 71 | { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
|
| 72 |
|
| 73 | { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
|
| 74 | { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
|
| 75 |
|
| 76 | { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
| 77 | { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
| 78 | { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
|
| 79 | { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
|
| 80 |
|
| 81 | //{ ACTION_WPS_ABSETB_NEXTDIR,BUTTON_RIGHT, BUTTON_CUSTOM },
|
| 82 | //{ ACTION_WPS_ABSETA_PREVDIR,BUTTON_LEFT, BUTTON_CUSTOM },
|
| 83 | //{ ACTION_WPS_ABRESET, BUTTON_CUSTOM|BUTTON_REPEAT, BUTTON_NONE },
|
| 84 |
|
| 85 | { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
| 86 | { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
|
| 87 | { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
| 88 | { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
|
| 89 |
|
| 90 | { ACTION_WPS_PITCHSCREEN, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
|
| 91 |
|
| 92 | { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
|
| 93 | { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
|
| 94 | { ACTION_WPS_MENU, BUTTON_POWER, BUTTON_NONE },
|
| 95 | { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
|
| 96 |
|
| 97 | { ACTION_WPS_ID3SCREEN, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
|
| 98 | { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_BACK },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 99 | LAST_ITEM_IN_LIST
|
| 100 | }; /* button_context_wps */
|
| 101 |
|
| 102 | static const struct button_mapping button_context_list[] = {
|
| 103 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
| 104 | }; /* button_context_list */
|
| 105 |
|
| 106 | static const struct button_mapping button_context_tree[] = {
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 107 | { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
| 108 | { ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
|
| 109 | { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
|
| 110 | { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 111 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
|
| 112 | }; /* button_context_tree */
|
| 113 |
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 114 | static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 115 | { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
|
| 116 | { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
|
| 117 | { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
|
| 118 | { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
| 119 | { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
|
| 120 | { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
|
| 121 | { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
|
| 122 | { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
| 123 | { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 124 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
|
| 125 | };
|
| 126 |
|
| 127 | static const struct button_mapping button_context_settings[] = {
|
| 128 | { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
|
| 129 | { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
|
| 130 | { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
|
| 131 | { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
|
| 132 | { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
|
| 133 | { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
|
| 134 | { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
|
| 135 | { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 136 | { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 137 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
| 138 | }; /* button_context_settings */
|
| 139 |
|
| 140 | static const struct button_mapping button_context_settings_right_is_inc[] = {
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 141 | { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
|
| 142 | { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
| 143 | { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
|
| 144 | { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
| 145 | { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
|
| 146 | { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
| 147 | { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
|
| 148 | { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
| 149 | { ACTION_SETTINGS_RESET, BUTTON_BACK, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 150 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
| 151 | }; /* button_context_settingsgraphical */
|
| 152 |
|
| 153 | static const struct button_mapping button_context_yesno[] = {
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 154 | { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 155 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
| 156 | }; /* button_context_settings_yesno */
|
| 157 |
|
| 158 | static const struct button_mapping button_context_colorchooser[] = {
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 159 | { ACTION_STD_OK, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 160 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
|
| 161 | }; /* button_context_colorchooser */
|
| 162 |
|
| 163 | static const struct button_mapping button_context_eq[] = {
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 164 | { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 165 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
|
| 166 | }; /* button_context_eq */
|
| 167 |
|
| 168 | /** Bookmark Screen **/
|
| 169 | static const struct button_mapping button_context_bmark[] = {
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 170 | { ACTION_BMS_DELETE, BUTTON_BACK, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 171 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
| 172 | }; /* button_context_bmark */
|
| 173 |
|
| 174 | static const struct button_mapping button_context_time[] = {
|
| 175 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
|
| 176 | }; /* button_context_time */
|
| 177 |
|
| 178 | static const struct button_mapping button_context_quickscreen[] = {
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 179 | { ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE },
|
| 180 | { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
| 181 | { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
|
| 182 | { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
| 183 | { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
|
| 184 | { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
| 185 | { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
|
| 186 | { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
| 187 | { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 188 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
| 189 | }; /* button_context_quickscreen */
|
| 190 |
|
| 191 | static const struct button_mapping button_context_pitchscreen[] = {
|
| 192 |
|
| 193 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
| 194 | }; /* button_context_pitchcreen */
|
| 195 |
|
| 196 | static const struct button_mapping button_context_keyboard[] = {
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 197 | { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
|
| 198 | { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
| 199 | { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
|
| 200 | { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
| 201 | { ACTION_KBD_CURSOR_LEFT, BUTTON_CUSTOM, BUTTON_NONE },
|
| 202 | { ACTION_KBD_CURSOR_LEFT, BUTTON_CUSTOM|BUTTON_REPEAT, BUTTON_NONE },
|
| 203 | { ACTION_KBD_CURSOR_RIGHT, BUTTON_PLAY, BUTTON_NONE },
|
| 204 | { ACTION_KBD_CURSOR_RIGHT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
|
| 205 | { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
|
| 206 | { ACTION_KBD_PAGE_FLIP, BUTTON_BACK|BUTTON_MENU, BUTTON_NONE },
|
| 207 | { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
| 208 | { ACTION_KBD_ABORT, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
|
| 209 | { ACTION_KBD_BACKSPACE, BUTTON_MENU, BUTTON_NONE },
|
| 210 | { ACTION_KBD_BACKSPACE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
|
| 211 | { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
|
| 212 | { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
| 213 | { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
|
| 214 | { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 215 | LAST_ITEM_IN_LIST
|
| 216 | }; /* button_context_keyboard */
|
| 217 |
|
| 218 | const struct button_mapping* get_context_mapping(int context)
|
| 219 | {
|
| 220 | switch (context&~CONTEXT_REMOTE)
|
| 221 | {
|
| 222 | case CONTEXT_STD:
|
| 223 | return button_context_standard;
|
| 224 | case CONTEXT_WPS:
|
| 225 | return button_context_wps;
|
| 226 | case CONTEXT_LIST:
|
| 227 | return button_context_list;
|
| 228 | case CONTEXT_MAINMENU:
|
| 229 | case CONTEXT_TREE:
|
Maurus Cuelenaere | ed5f1ed | 2008-05-03 14:43:43 +0000 | [diff] [blame] | 230 | return button_context_listtree_scroll_without_combo;
|
Maurus Cuelenaere | 95167e0 | 2008-04-24 20:08:28 +0000 | [diff] [blame] | 231 | case CONTEXT_CUSTOM|CONTEXT_TREE:
|
| 232 | return button_context_tree;
|
| 233 | case CONTEXT_SETTINGS:
|
| 234 | return button_context_settings;
|
| 235 | case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
|
| 236 | return button_context_settings_right_is_inc;
|
| 237 | case CONTEXT_SETTINGS_COLOURCHOOSER:
|
| 238 | return button_context_colorchooser;
|
| 239 | case CONTEXT_SETTINGS_EQ:
|
| 240 | return button_context_eq;
|
| 241 | case CONTEXT_SETTINGS_TIME:
|
| 242 | return button_context_time;
|
| 243 | case CONTEXT_YESNOSCREEN:
|
| 244 | return button_context_yesno;
|
| 245 | case CONTEXT_BOOKMARKSCREEN:
|
| 246 | return button_context_bmark;
|
| 247 | case CONTEXT_QUICKSCREEN:
|
| 248 | return button_context_quickscreen;
|
| 249 | case CONTEXT_PITCHSCREEN:
|
| 250 | return button_context_pitchscreen;
|
| 251 | case CONTEXT_KEYBOARD:
|
| 252 | return button_context_keyboard;
|
| 253 | }
|
| 254 | return button_context_standard;
|
| 255 | }
|