Simplify conditions in the manual (should also be done for other features)
[kugel-rb/myfork.git] / apps / keymaps / keymap-mr500.c
blobaa04461b64a106ca6c5560710de667e8407a78fc
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 the Olympus M:robe 500 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"
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 static const struct button_mapping button_context_standard[] = {
40 { ACTION_STD_PREV, BUTTON_RC_PLAY, BUTTON_NONE },
41 { ACTION_STD_PREVREPEAT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
42 { ACTION_STD_NEXT, BUTTON_RC_DOWN, BUTTON_NONE },
43 { ACTION_STD_NEXTREPEAT, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE },
45 { ACTION_STD_OK, BUTTON_RC_HEART|BUTTON_REL, BUTTON_RC_HEART },
46 { ACTION_STD_OK, BUTTON_RC_FF, BUTTON_NONE },
47 { ACTION_STD_OK, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_RC_FF },
49 { ACTION_STD_MENU, BUTTON_RC_MODE, BUTTON_NONE },
50 { ACTION_STD_QUICKSCREEN, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE },
51 { ACTION_STD_CONTEXT, BUTTON_RC_HEART|BUTTON_REPEAT, BUTTON_RC_HEART },
52 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
53 { ACTION_STD_CANCEL, BUTTON_RC_REW, BUTTON_NONE },
54 { ACTION_STD_CANCEL, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
55 LAST_ITEM_IN_LIST
56 }; /* button_context_standard */
58 static const struct button_mapping button_context_wps[] = {
59 { ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
60 { ACTION_WPS_STOP, BUTTON_RC_DOWN|BUTTON_REL, BUTTON_RC_DOWN },
62 { ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
63 { ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
65 { ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT,BUTTON_NONE },
66 { ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
68 { ACTION_WPS_STOPSEEK, BUTTON_RC_REW|BUTTON_REL,
69 BUTTON_RC_REW|BUTTON_REPEAT},
71 { ACTION_WPS_STOPSEEK, BUTTON_RC_FF|BUTTON_REL,
72 BUTTON_RC_FF|BUTTON_REPEAT},
74 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
75 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
76 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
77 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
79 { ACTION_WPS_QUICKSCREEN, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
80 { ACTION_WPS_MENU, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE },
81 { ACTION_WPS_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
82 { ACTION_WPS_CONTEXT, BUTTON_RC_HEART|BUTTON_REPEAT, BUTTON_RC_HEART },
84 { ACTION_WPS_BROWSE, BUTTON_RC_HEART|BUTTON_REL, BUTTON_RC_HEART },
86 LAST_ITEM_IN_LIST
87 }; /* button_context_wps */
89 static const struct button_mapping button_context_list[] = {
90 #ifdef HAVE_VOLUME_IN_LIST
91 { ACTION_LIST_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
92 { ACTION_LIST_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
93 { ACTION_LIST_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
94 { ACTION_LIST_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
95 #endif
96 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
97 }; /* button_context_list */
99 static const struct button_mapping button_context_tree[] = {
100 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
101 }; /* button_context_tree */
103 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
104 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
107 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
108 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
111 static const struct button_mapping button_context_settings[] = {
113 { ACTION_SETTINGS_INC, BUTTON_RC_PLAY, BUTTON_NONE },
114 { ACTION_SETTINGS_INCREPEAT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
115 { ACTION_SETTINGS_DEC, BUTTON_RC_DOWN, BUTTON_NONE },
116 { ACTION_SETTINGS_DECREPEAT, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE },
117 { ACTION_STD_PREV, BUTTON_RC_REW, BUTTON_NONE },
118 { ACTION_STD_PREVREPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
119 { ACTION_STD_NEXT, BUTTON_RC_FF, BUTTON_NONE },
120 { ACTION_STD_NEXTREPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
121 { ACTION_SETTINGS_RESET, BUTTON_RC_MODE, BUTTON_NONE },
123 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
124 }; /* button_context_settings */
126 static const struct button_mapping button_context_settings_right_is_inc[] = {
127 { ACTION_SETTINGS_INC, BUTTON_RC_FF, BUTTON_NONE },
128 { ACTION_SETTINGS_INCREPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
129 { ACTION_SETTINGS_DEC, BUTTON_RC_REW, BUTTON_NONE },
130 { ACTION_SETTINGS_DECREPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
131 { ACTION_STD_PREV, BUTTON_RC_PLAY, BUTTON_NONE },
132 { ACTION_STD_PREVREPEAT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
133 { ACTION_STD_NEXT, BUTTON_RC_DOWN, BUTTON_NONE },
134 { ACTION_STD_NEXTREPEAT, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE },
135 { ACTION_SETTINGS_RESET, BUTTON_RC_MODE, BUTTON_NONE },
137 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
138 }; /* button_context_settingsgraphical */
140 static const struct button_mapping button_context_yesno[] = {
141 { ACTION_YESNO_ACCEPT, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_NONE },
142 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
143 }; /* button_context_settings_yesno */
145 static const struct button_mapping button_context_colorchooser[] = {
146 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
147 }; /* button_context_colorchooser */
149 static const struct button_mapping button_context_eq[] = {
150 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
151 }; /* button_context_eq */
153 /** Bookmark Screen **/
154 static const struct button_mapping button_context_bmark[] = {
155 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
156 }; /* button_context_bmark */
158 static const struct button_mapping button_context_time[] = {
159 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
160 { ACTION_STD_OK, BUTTON_RC_HEART, BUTTON_NONE },
161 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
162 }; /* button_context_time */
164 static const struct button_mapping button_context_quickscreen[] = {
165 { ACTION_STD_CANCEL, BUTTON_RC_MODE, BUTTON_NONE },
166 { ACTION_QS_DOWNINV, BUTTON_RC_PLAY, BUTTON_NONE },
167 { ACTION_QS_DOWN, BUTTON_RC_DOWN, BUTTON_NONE },
168 { ACTION_QS_LEFT, BUTTON_RC_REW, BUTTON_NONE },
169 { ACTION_QS_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
171 LAST_ITEM_IN_LIST
172 }; /* button_context_quickscreen */
174 static const struct button_mapping button_context_pitchscreen[] = {
176 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
177 }; /* button_context_pitchcreen */
179 static const struct button_mapping button_context_keyboard[] = {
180 { ACTION_KBD_LEFT, BUTTON_RC_REW, BUTTON_NONE },
181 { ACTION_KBD_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
182 { ACTION_KBD_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
183 { ACTION_KBD_RIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
184 { ACTION_KBD_SELECT, BUTTON_RC_HEART, BUTTON_NONE },
185 { ACTION_KBD_DONE, BUTTON_RC_MODE|BUTTON_REL, BUTTON_NONE },
186 { ACTION_KBD_ABORT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
187 { ACTION_KBD_BACKSPACE, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
188 { ACTION_KBD_BACKSPACE, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
189 { ACTION_KBD_UP, BUTTON_RC_PLAY, BUTTON_NONE },
190 { ACTION_KBD_UP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
191 { ACTION_KBD_DOWN, BUTTON_RC_DOWN, BUTTON_NONE },
192 { ACTION_KBD_DOWN, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE },
194 LAST_ITEM_IN_LIST
195 }; /* button_context_keyboard */
197 const struct button_mapping* target_get_context_mapping(int context)
199 switch (context&(~CONTEXT_REMOTE))
201 case CONTEXT_STD:
202 return button_context_standard;
203 case CONTEXT_WPS:
204 return button_context_wps;
206 case CONTEXT_LIST:
207 return button_context_list;
208 case CONTEXT_MAINMENU:
209 case CONTEXT_TREE:
210 if (global_settings.hold_lr_for_scroll_in_list)
211 return button_context_listtree_scroll_without_combo;
212 else
213 return button_context_listtree_scroll_with_combo;
214 case CONTEXT_CUSTOM|CONTEXT_TREE:
215 return button_context_tree;
217 case CONTEXT_SETTINGS:
218 return button_context_settings;
219 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
220 return button_context_settings_right_is_inc;
222 case CONTEXT_SETTINGS_COLOURCHOOSER:
223 return button_context_colorchooser;
224 case CONTEXT_SETTINGS_EQ:
225 return button_context_eq;
227 case CONTEXT_SETTINGS_TIME:
228 return button_context_time;
230 case CONTEXT_YESNOSCREEN:
231 return button_context_yesno;
232 case CONTEXT_BOOKMARKSCREEN:
233 return button_context_bmark;
234 case CONTEXT_QUICKSCREEN:
235 return button_context_quickscreen;
236 case CONTEXT_PITCHSCREEN:
237 return button_context_pitchscreen;
238 case CONTEXT_KEYBOARD:
239 return button_context_keyboard;
241 return button_context_standard;