summaryrefslogtreecommitdiff
path: root/apps/plugins/demystify.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-05-20 17:41:28 +0000
committerThomas Martitz <kugel@rockbox.org>2010-05-20 17:41:28 +0000
commit20e9d56ba5507021bdde898f4b0a0eb14f2af861 (patch)
tree20a1ff36d0cc0f530bc7c7648b1bca2f9127a5c8 /apps/plugins/demystify.c
parent97365803d390e44155fc41657bd03a7b121956aa (diff)
downloadrockbox-20e9d56ba5507021bdde898f4b0a0eb14f2af861.tar.gz
rockbox-20e9d56ba5507021bdde898f4b0a0eb14f2af861.zip
S#10387 - Rework pluginlib actions
It changes pluginlib actions to contain only a single and simple context (and other one for remote directional buttons), consisting of 7(9) buttons: up/down/left/right, select OR short select and long select, exit and cancel (plus 2 for scrollwheel targets). This ensures contexts don't clash with other contexts and simplifies them, at the expense of reduced versatility. However, the versatility made it largely unusable due to the great number of targets. This should allow for using pluginlib actions safely for the most simple plugins (e.g. almost all demos). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26202 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/demystify.c')
-rw-r--r--apps/plugins/demystify.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/apps/plugins/demystify.c b/apps/plugins/demystify.c
index 5f44e11f3d..468f1806ce 100644
--- a/apps/plugins/demystify.c
+++ b/apps/plugins/demystify.c
@@ -37,26 +37,33 @@ PLUGIN_HEADER
37#define MIN_POLYGONS 1 37#define MIN_POLYGONS 1
38 38
39/* Key assignement */ 39/* Key assignement */
40#define DEMYSTIFY_QUIT PLA_QUIT 40#define DEMYSTIFY_QUIT PLA_CANCEL
41 41
42#define DEMYSTIFY_INCREASE_SPEED PLA_RIGHT 42#ifdef HAVE_SCROLLWHEEL
43#define DEMYSTIFY_DECREASE_SPEED PLA_LEFT 43
44#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_RIGHT_REPEAT 44#define DEMYSTIFY_INCREASE_SPEED PLA_SCROLL_FWD
45#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_LEFT_REPEAT 45#define DEMYSTIFY_DECREASE_SPEED PLA_SCROLL_BACK
46#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_SCROLL_FWD_REPEAT
47#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_SCROLL_BACK_REPEAT
48#else
49#define DEMYSTIFY_INCREASE_SPEED PLA_RIGHT
50#define DEMYSTIFY_DECREASE_SPEED PLA_LEFT
51#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_RIGHT_REPEAT
52#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_LEFT_REPEAT
53#endif
46 54
47#define DEMYSTIFY_ADD_POLYGON PLA_UP 55#define DEMYSTIFY_ADD_POLYGON PLA_UP
48#define DEMYSTIFY_REMOVE_POLYGON PLA_DOWN 56#define DEMYSTIFY_REMOVE_POLYGON PLA_DOWN
49#define DEMYSTIFY_ADD_POLYGON_REPEAT PLA_UP_REPEAT 57#define DEMYSTIFY_ADD_POLYGON_REPEAT PLA_UP_REPEAT
50#define DEMYSTIFY_REMOVE_POLYGON_REPEAT PLA_DOWN_REPEAT 58#define DEMYSTIFY_REMOVE_POLYGON_REPEAT PLA_DOWN_REPEAT
51 59
52const struct button_mapping *plugin_contexts[] 60const struct button_mapping *plugin_contexts[]
53= {generic_directions, generic_actions, 61= {pla_main_ctx,
54#if defined(HAVE_REMOTE_LCD) 62#if defined(HAVE_REMOTE_LCD)
55 remote_directions 63 pla_remote_ctx,
56#endif 64#endif
57}; 65};
58#define NB_ACTION_CONTEXTS \ 66
59 sizeof(plugin_contexts)/sizeof(struct button_mapping*)
60#ifdef HAVE_LCD_COLOR 67#ifdef HAVE_LCD_COLOR
61struct line_color 68struct line_color
62{ 69{
@@ -383,7 +390,7 @@ int plugin_main(void)
383 else 390 else
384 rb->sleep(sleep_time); 391 rb->sleep(sleep_time);
385 action = pluginlib_getaction(TIMEOUT_NOBLOCK, 392 action = pluginlib_getaction(TIMEOUT_NOBLOCK,
386 plugin_contexts, NB_ACTION_CONTEXTS); 393 plugin_contexts, ARRAYLEN(plugin_contexts));
387 switch(action) 394 switch(action)
388 { 395 {
389 case DEMYSTIFY_QUIT: 396 case DEMYSTIFY_QUIT: