Theme Editor: Put together a simple GUI to test going back and forth between a tree...
[kugel-rb.git] / apps / plugins / lib / pluginlib_actions.c
blob1872a5702bcac0a2c851748d373deb3353500106
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 Jonathan Gordon
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
23 #include "plugin.h"
24 #include "action.h"
25 #include "pluginlib_actions.h"
27 #if defined(HAVE_REMOTE_LCD)
28 /* remote directions */
29 const struct button_mapping pla_remote_ctx[] =
31 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
32 (CONFIG_KEYPAD == IRIVER_H300_PAD)
33 { PLA_UP, BUTTON_RC_BITRATE, BUTTON_NONE},
34 { PLA_DOWN, BUTTON_RC_SOURCE, BUTTON_NONE},
35 { PLA_LEFT, BUTTON_RC_VOL_DOWN, BUTTON_NONE},
36 { PLA_RIGHT, BUTTON_RC_VOL_UP, BUTTON_NONE},
37 { PLA_UP_REPEAT, BUTTON_RC_BITRATE|BUTTON_REPEAT, BUTTON_NONE},
38 { PLA_DOWN_REPEAT, BUTTON_RC_SOURCE|BUTTON_REPEAT, BUTTON_NONE},
39 { PLA_LEFT_REPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
40 { PLA_RIGHT_REPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
41 #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) || \
42 (CONFIG_KEYPAD == IRIVER_H10_PAD) || \
43 (CONFIG_KEYPAD == GIGABEAT_PAD) || \
44 (CONFIG_KEYPAD == IAUDIO_M3_PAD) || \
45 (CONFIG_KEYPAD == GIGABEAT_S_PAD)
46 { PLA_UP, BUTTON_RC_FF, BUTTON_NONE},
47 { PLA_DOWN, BUTTON_RC_REW, BUTTON_NONE},
48 { PLA_LEFT, BUTTON_RC_VOL_DOWN, BUTTON_NONE},
49 { PLA_RIGHT, BUTTON_RC_VOL_UP, BUTTON_NONE},
50 { PLA_UP_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE},
51 { PLA_DOWN_REPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE},
52 { PLA_LEFT_REPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
53 { PLA_RIGHT_REPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
54 #elif (CONFIG_KEYPAD == PLAYER_PAD) || \
55 (CONFIG_KEYPAD == RECORDER_PAD)
56 { PLA_UP, BUTTON_RC_VOL_UP, BUTTON_NONE},
57 { PLA_DOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE},
58 { PLA_LEFT, BUTTON_RC_LEFT, BUTTON_NONE},
59 { PLA_RIGHT, BUTTON_RC_RIGHT, BUTTON_NONE},
60 { PLA_UP_REPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
61 { PLA_DOWN_REPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
62 { PLA_LEFT_REPEAT, BUTTON_RC_LEFT|BUTTON_REPEAT, BUTTON_NONE},
63 { PLA_RIGHT_REPEAT, BUTTON_RC_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
64 #elif (CONFIG_REMOTE_KEYPAD == MROBE_REMOTE)
65 { PLA_UP, BUTTON_RC_PLAY, BUTTON_NONE},
66 { PLA_DOWN, BUTTON_RC_DOWN, BUTTON_NONE},
67 { PLA_LEFT, BUTTON_RC_REW, BUTTON_NONE},
68 { PLA_RIGHT, BUTTON_RC_FF, BUTTON_NONE},
69 { PLA_UP_REPEAT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE},
70 { PLA_DOWN_REPEAT, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE},
71 { PLA_LEFT_REPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE},
72 { PLA_RIGHT_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE},
73 #else
74 #error pluginlib_actions: No remote directions
75 #endif
76 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_PLUGIN),
78 #endif /* HAVE_REMOTE_LCD */
80 /* these were taken from the bubbles plugin, so may need tweaking */
81 const struct button_mapping pla_main_ctx[] =
83 /* Touchscreens */
84 #ifdef HAVE_TOUCHSCREEN
85 { PLA_CANCEL, BUTTON_BOTTOMRIGHT, BUTTON_NONE},
86 { PLA_SELECT, BUTTON_CENTER, BUTTON_NONE},
87 { PLA_SELECT_REL, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE},
88 { PLA_SELECT_REPEAT, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_NONE},
89 { PLA_UP, BUTTON_TOPMIDDLE, BUTTON_NONE},
90 { PLA_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE},
91 { PLA_LEFT, BUTTON_MIDLEFT, BUTTON_NONE},
92 { PLA_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE},
93 { PLA_UP_REPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE},
94 { PLA_DOWN_REPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE},
95 { PLA_LEFT_REPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE},
96 { PLA_RIGHT_REPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE},
97 #endif
99 /* Directions */
100 #if ((CONFIG_KEYPAD == IRIVER_H100_PAD) \
101 || (CONFIG_KEYPAD == IRIVER_H300_PAD) \
102 || (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \
103 || (CONFIG_KEYPAD == GIGABEAT_PAD) \
104 || (CONFIG_KEYPAD == RECORDER_PAD) \
105 || (CONFIG_KEYPAD == ARCHOS_AV300_PAD) \
106 || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \
107 || (CONFIG_KEYPAD == ONDIO_PAD) \
108 || (CONFIG_KEYPAD == SANSA_C200_PAD) \
109 || (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
110 || (CONFIG_KEYPAD == MROBE100_PAD) \
111 || (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) \
112 || (CONFIG_KEYPAD == SANSA_CLIP_PAD) \
113 || (CONFIG_KEYPAD == CREATIVEZVM_PAD) \
114 || (CONFIG_KEYPAD == SANSA_M200_PAD)\
115 || (CONFIG_KEYPAD == SANSA_E200_PAD) \
116 || (CONFIG_KEYPAD == SANSA_FUZE_PAD) \
117 || (CONFIG_KEYPAD == SAMSUNG_YH_PAD))
118 { PLA_UP, BUTTON_UP, BUTTON_NONE },
119 { PLA_DOWN, BUTTON_DOWN, BUTTON_NONE },
120 { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
121 { PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
122 { PLA_UP_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
123 { PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
124 { PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
125 { PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
126 /* now the bad ones that don't have standard names for the directional
127 * buttons */
128 #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
129 || (CONFIG_KEYPAD == IPOD_3G_PAD) \
130 || (CONFIG_KEYPAD == IPOD_4G_PAD)
131 { PLA_UP, BUTTON_MENU, BUTTON_NONE },
132 { PLA_DOWN, BUTTON_PLAY, BUTTON_NONE },
133 { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
134 { PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
135 { PLA_UP_REPEAT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
136 { PLA_DOWN_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
137 { PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
138 { PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
139 #elif (CONFIG_KEYPAD == PLAYER_PAD)
140 { PLA_UP, BUTTON_PLAY, BUTTON_NONE },
141 { PLA_DOWN, BUTTON_STOP, BUTTON_NONE },
142 { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
143 { PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
144 { PLA_UP_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
145 { PLA_DOWN_REPEAT, BUTTON_STOP|BUTTON_REPEAT, BUTTON_NONE },
146 { PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
147 { PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
148 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
149 { PLA_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
150 { PLA_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
151 { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
152 { PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
153 { PLA_UP_REPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
154 { PLA_DOWN_REPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
155 { PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
156 { PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
157 #elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
158 { PLA_UP, BUTTON_VOL_UP, BUTTON_NONE },
159 { PLA_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
160 { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
161 { PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
162 { PLA_UP_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
163 { PLA_DOWN_REPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
164 { PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
165 { PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
166 #elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
167 { PLA_UP, BUTTON_UP, BUTTON_NONE },
168 { PLA_DOWN, BUTTON_DOWN, BUTTON_NONE },
169 { PLA_LEFT, BUTTON_PREV, BUTTON_NONE },
170 { PLA_RIGHT, BUTTON_NEXT, BUTTON_NONE },
171 { PLA_UP_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
172 { PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
173 { PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
174 { PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
175 #elif (CONFIG_KEYPAD == IAUDIO67_PAD)
176 { PLA_UP, BUTTON_STOP, BUTTON_NONE },
177 { PLA_DOWN, BUTTON_PLAY, BUTTON_NONE },
178 { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
179 { PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
180 { PLA_UP_REPEAT, BUTTON_STOP|BUTTON_REPEAT, BUTTON_NONE },
181 { PLA_DOWN_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
182 { PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
183 { PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
184 #elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
185 { PLA_UP, BUTTON_UP, BUTTON_NONE},
186 { PLA_DOWN, BUTTON_DOWN, BUTTON_NONE},
187 { PLA_LEFT, BUTTON_PREV, BUTTON_NONE},
188 { PLA_RIGHT, BUTTON_NEXT, BUTTON_NONE},
189 { PLA_UP_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE},
190 { PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE},
191 { PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE},
192 { PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE},
193 #elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
194 { PLA_UP, BUTTON_PREV, BUTTON_NONE},
195 { PLA_DOWN, BUTTON_NEXT, BUTTON_NONE},
196 { PLA_LEFT, BUTTON_VOL_DOWN, BUTTON_NONE},
197 { PLA_RIGHT, BUTTON_VOL_UP, BUTTON_NONE},
198 { PLA_UP_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE},
199 { PLA_DOWN_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE},
200 { PLA_LEFT_REPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
201 { PLA_RIGHT_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
202 #else
203 # ifndef HAVE_TOUCHSCREEN
204 # error pluginlib_actions: No directions defined
205 # endif
206 #endif
208 /* Scrollwheels */
209 #ifdef HAVE_SCROLLWHEEL
210 { PLA_SCROLL_BACK, BUTTON_SCROLL_BACK, BUTTON_NONE },
211 { PLA_SCROLL_FWD, BUTTON_SCROLL_FWD, BUTTON_NONE },
212 { PLA_SCROLL_BACK_REPEAT,BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
213 { PLA_SCROLL_FWD_REPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
214 #endif
216 /* Actions */
217 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
218 {PLA_CANCEL, BUTTON_OFF, BUTTON_NONE },
219 {PLA_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
220 {PLA_EXIT, BUTTON_ON, BUTTON_NONE },
221 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE },
222 {PLA_SELECT, BUTTON_RC_ON, BUTTON_NONE },
223 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
224 {PLA_SELECT_REL, BUTTON_RC_ON|BUTTON_REL, BUTTON_RC_ON },
225 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
226 {PLA_SELECT_REPEAT, BUTTON_RC_ON|BUTTON_REPEAT, BUTTON_NONE },
227 #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
228 || (CONFIG_KEYPAD == IPOD_3G_PAD) \
229 || (CONFIG_KEYPAD == IPOD_4G_PAD)
230 {PLA_CANCEL, BUTTON_MENU|BUTTON_SELECT, BUTTON_NONE },
231 {PLA_EXIT, BUTTON_PLAY|BUTTON_SELECT, BUTTON_NONE },
232 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE },
233 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
234 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
235 #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
236 {PLA_CANCEL, BUTTON_POWER, BUTTON_NONE },
237 {PLA_EXIT, BUTTON_PLAY|BUTTON_SELECT, BUTTON_NONE },
238 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE },
239 {PLA_SELECT, BUTTON_RC_MODE, BUTTON_NONE },
240 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
241 {PLA_SELECT_REL, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE },
242 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
243 {PLA_SELECT_REPEAT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE },
244 #elif (CONFIG_KEYPAD == GIGABEAT_PAD \
245 || CONFIG_KEYPAD == SANSA_E200_PAD \
246 || CONFIG_KEYPAD == SANSA_C200_PAD \
247 || CONFIG_KEYPAD == SANSA_CLIP_PAD \
248 || CONFIG_KEYPAD == SANSA_M200_PAD \
249 || CONFIG_KEYPAD == MROBE100_PAD \
250 || CONFIG_KEYPAD == PHILIPS_SA9200_PAD \
251 || CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)
252 {PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
253 {PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
254 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
255 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
256 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
257 #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
258 {PLA_CANCEL, BUTTON_BACK, BUTTON_NONE},
259 {PLA_EXIT, BUTTON_MENU, BUTTON_NONE},
260 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
261 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
262 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
263 #elif (CONFIG_KEYPAD == RECORDER_PAD)
264 {PLA_CANCEL, BUTTON_ON, BUTTON_NONE},
265 {PLA_EXIT, BUTTON_OFF, BUTTON_NONE},
266 {PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
267 {PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
268 {PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
269 #elif (CONFIG_KEYPAD == ARCHOS_AV300_PAD)
270 {PLA_CANCEL, BUTTON_OFF|BUTTON_REL, BUTTON_OFF},
271 {PLA_EXIT, BUTTON_OFF|BUTTON_REPEAT, BUTTON_NONE},
272 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
273 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
274 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
275 #elif (CONFIG_KEYPAD == ONDIO_PAD)
276 {PLA_CANCEL, BUTTON_OFF|BUTTON_REL, BUTTON_OFF},
277 {PLA_EXIT, BUTTON_OFF|BUTTON_REPEAT, BUTTON_NONE},
278 {PLA_SELECT, BUTTON_MENU, BUTTON_NONE},
279 {PLA_SELECT_REL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU},
280 {PLA_SELECT_REPEAT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE},
281 #elif (CONFIG_KEYPAD == PLAYER_PAD)
282 {PLA_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU},
283 {PLA_EXIT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE},
284 {PLA_SELECT, BUTTON_ON, BUTTON_NONE},
285 {PLA_SELECT_REL, BUTTON_ON|BUTTON_REL, BUTTON_ON},
286 {PLA_SELECT_REPEAT, BUTTON_ON|BUTTON_REPEAT, BUTTON_NONE},
287 #elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
288 {PLA_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME},
289 {PLA_EXIT, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE},
290 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
291 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
292 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
293 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
294 {PLA_CANCEL, BUTTON_REW, BUTTON_NONE},
295 {PLA_EXIT, BUTTON_POWER, BUTTON_NONE},
296 {PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
297 {PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
298 {PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
299 #elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
300 {PLA_CANCEL, BUTTON_EQ|BUTOTN_REL, BUTTON_EQ},
301 {PLA_EXIT, BUTTON_EQ|BUTTON_REPEAT, BUTTON_NONE},
302 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
303 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
304 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
305 #elif (CONFIG_KEYPAD == MROBE500_PAD)
306 {PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
307 {PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
308 {PLA_SELECT, BUTTON_RC_HEART, BUTTON_NONE},
309 {PLA_SELECT_REL, BUTTON_RC_HEART|BUTTON_REL, BUTTON_RC_HEART},
310 {PLA_SELECT_REPEAT, BUTTON_RC_HEART|BUTTON_REPEAT, BUTTON_NONE},
311 #elif (CONFIG_KEYPAD == COWON_D2_PAD)
312 {PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
313 {PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
314 {PLA_SELECT, BUTTON_MINUS, BUTTON_NONE},
315 {PLA_SELECT_REL, BUTTON_MINUS|BUTTON_REL, BUTTON_MINUS},
316 {PLA_SELECT_REPEAT, BUTTON_MINUS|BUTTON_MINUS, BUTTON_NONE},
317 #elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
318 {PLA_CANCEL, BUTTON_RC_REC|BUTTON_REL, BUTTON_RC_REC},
319 {PLA_EXIT, BUTTON_RC_REC|BUTTON_REPEAT, BUTTON_NONE},
320 {PLA_SELECT, BUTTON_RC_MODE, BUTTON_NONE},
321 {PLA_SELECT_REL, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE},
322 {PLA_SELECT_REPEAT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE},
323 #elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
324 {PLA_EXIT, BUTTON_POWER, BUTTON_NONE},
325 {PLA_CANCE BUTTON_MENU, BUTTON_NONE},
326 {PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
327 {PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
328 {PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
329 #elif (CONFIG_KEYPAD == IAUDIO67_PAD)
330 {PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
331 {PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
332 {PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
333 {PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
334 {PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT BUTTON_NONE},
335 #elif (CONFIG_KEYPAD == CREATIVEZVM_PAD)
336 {PLA_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK},
337 {PLA_EXIT, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE},
338 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
339 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
340 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
341 #elif (CONFIG_KEYPAD == ONDAVX747_PAD)
342 {PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
343 {PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
344 {PLA_SELECT, BUTTON_VOL_UP, BUTTON_NONE},
345 {PLA_SELECT_REL, BUTTON_VOL_UP|BUTTON_REL, BUTTON_VOL_UP},
346 {PLA_SELECT_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
347 #elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
348 {PLA_CANCEL, BUTTON_REW, BUTTON_NONE},
349 {PLA_EXIT, BUTTON_FFWD, BUTTON_NONE},
350 {PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
351 {PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
352 {PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
353 #elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
354 {PLA_CANCEL, BUTTON_MENU, BUTTON_NONE},
355 {PLA_EXIT, BUTTON_REC, BUTTON_NONE},
356 {PLA_SELECT, BUTTON_OK, BUTTON_NONE},
357 {PLA_SELECT_REL, BUTTON_OK|BUTTON_REL, BUTTON_OK },
358 {PLA_SELECT_REPEAT, BUTTON_OK|BUTTON_REPEAT, BUTTON_NONE},
359 #elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
360 {PLA_CANCEL, BUTTON_REC, BUTTON_NONE},
361 {PLA_EXIT, (BUTTON_REC|BUTTON_PLAY), BUTTON_NONE},
362 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
363 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
364 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
365 #else
366 # ifndef HAVE_TOUCHSCREEN
367 # error pluginlib_actions: No actions defined
368 # endif
369 #endif
370 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_PLUGIN),
373 static struct button_mapping **plugin_context_order;
374 static int plugin_context_count = 0;
375 static int last_context = 0; /* index into plugin_context_order
376 of the last context returned */
378 static const struct button_mapping* get_context_map(int context)
380 (void)context;
381 if (last_context<plugin_context_count)
382 return plugin_context_order[last_context++];
383 else return NULL;
386 int pluginlib_getaction(int timeout,
387 const struct button_mapping *plugin_contexts[],
388 int count)
390 plugin_context_order = (struct button_mapping **)plugin_contexts;
391 plugin_context_count = count;
392 last_context = 0;
393 return rb->get_custom_action(CONTEXT_PLUGIN,timeout,get_context_map);