FS#8961 - Anti-Aliased Fonts.
[kugel-rb/myfork.git] / apps / keymaps / keymap-mr500.c
blobb1a3e4aae14510dd1e0d7b6c6102676387e4cffa
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_NONE },
142 { ACTION_YESNO_ACCEPT, BUTTON_POWER, BUTTON_NONE },
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
144 }; /* button_context_settings_yesno */
146 static const struct button_mapping button_context_colorchooser[] = {
147 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
148 }; /* button_context_colorchooser */
150 static const struct button_mapping button_context_eq[] = {
151 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
152 }; /* button_context_eq */
154 /** Bookmark Screen **/
155 static const struct button_mapping button_context_bmark[] = {
156 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
157 }; /* button_context_bmark */
159 static const struct button_mapping button_context_time[] = {
160 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
161 { ACTION_STD_OK, BUTTON_RC_HEART, BUTTON_NONE },
162 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
163 }; /* button_context_time */
165 static const struct button_mapping button_context_quickscreen[] = {
166 { ACTION_STD_CANCEL, BUTTON_RC_MODE, BUTTON_NONE },
167 { ACTION_QS_DOWNINV, BUTTON_RC_PLAY, BUTTON_NONE },
168 { ACTION_QS_DOWN, BUTTON_RC_DOWN, BUTTON_NONE },
169 { ACTION_QS_LEFT, BUTTON_RC_REW, BUTTON_NONE },
170 { ACTION_QS_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
172 LAST_ITEM_IN_LIST
173 }; /* button_context_quickscreen */
175 static const struct button_mapping button_context_pitchscreen[] = {
177 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
178 }; /* button_context_pitchcreen */
180 static const struct button_mapping button_context_keyboard[] = {
181 { ACTION_KBD_LEFT, BUTTON_RC_REW, BUTTON_NONE },
182 { ACTION_KBD_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
183 { ACTION_KBD_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
184 { ACTION_KBD_RIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
185 { ACTION_KBD_SELECT, BUTTON_RC_HEART, BUTTON_NONE },
186 { ACTION_KBD_DONE, BUTTON_RC_MODE|BUTTON_REL, BUTTON_NONE },
187 { ACTION_KBD_ABORT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
188 { ACTION_KBD_BACKSPACE, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
189 { ACTION_KBD_BACKSPACE, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
190 { ACTION_KBD_UP, BUTTON_RC_PLAY, BUTTON_NONE },
191 { ACTION_KBD_UP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
192 { ACTION_KBD_DOWN, BUTTON_RC_DOWN, BUTTON_NONE },
193 { ACTION_KBD_DOWN, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE },
195 LAST_ITEM_IN_LIST
196 }; /* button_context_keyboard */
198 const struct button_mapping* target_get_context_mapping(int context)
200 switch (context&(~CONTEXT_REMOTE))
202 case CONTEXT_STD:
203 return button_context_standard;
204 case CONTEXT_WPS:
205 return button_context_wps;
207 case CONTEXT_LIST:
208 return button_context_list;
209 case CONTEXT_MAINMENU:
210 case CONTEXT_TREE:
211 if (global_settings.hold_lr_for_scroll_in_list)
212 return button_context_listtree_scroll_without_combo;
213 else
214 return button_context_listtree_scroll_with_combo;
215 case CONTEXT_CUSTOM|CONTEXT_TREE:
216 return button_context_tree;
218 case CONTEXT_SETTINGS:
219 return button_context_settings;
220 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
221 return button_context_settings_right_is_inc;
223 case CONTEXT_SETTINGS_COLOURCHOOSER:
224 return button_context_colorchooser;
225 case CONTEXT_SETTINGS_EQ:
226 return button_context_eq;
228 case CONTEXT_SETTINGS_TIME:
229 return button_context_time;
231 case CONTEXT_YESNOSCREEN:
232 return button_context_yesno;
233 case CONTEXT_BOOKMARKSCREEN:
234 return button_context_bmark;
235 case CONTEXT_QUICKSCREEN:
236 return button_context_quickscreen;
237 case CONTEXT_PITCHSCREEN:
238 return button_context_pitchscreen;
239 case CONTEXT_KEYBOARD:
240 return button_context_keyboard;
242 return button_context_standard;