From 20e9d56ba5507021bdde898f4b0a0eb14f2af861 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 20 May 2010 17:41:28 +0000 Subject: 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 --- apps/plugins/demystify.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'apps/plugins/demystify.c') 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 #define MIN_POLYGONS 1 /* Key assignement */ -#define DEMYSTIFY_QUIT PLA_QUIT - -#define DEMYSTIFY_INCREASE_SPEED PLA_RIGHT -#define DEMYSTIFY_DECREASE_SPEED PLA_LEFT -#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_RIGHT_REPEAT -#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_LEFT_REPEAT +#define DEMYSTIFY_QUIT PLA_CANCEL + +#ifdef HAVE_SCROLLWHEEL + +#define DEMYSTIFY_INCREASE_SPEED PLA_SCROLL_FWD +#define DEMYSTIFY_DECREASE_SPEED PLA_SCROLL_BACK +#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_SCROLL_FWD_REPEAT +#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_SCROLL_BACK_REPEAT +#else +#define DEMYSTIFY_INCREASE_SPEED PLA_RIGHT +#define DEMYSTIFY_DECREASE_SPEED PLA_LEFT +#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_RIGHT_REPEAT +#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_LEFT_REPEAT +#endif -#define DEMYSTIFY_ADD_POLYGON PLA_UP -#define DEMYSTIFY_REMOVE_POLYGON PLA_DOWN -#define DEMYSTIFY_ADD_POLYGON_REPEAT PLA_UP_REPEAT -#define DEMYSTIFY_REMOVE_POLYGON_REPEAT PLA_DOWN_REPEAT +#define DEMYSTIFY_ADD_POLYGON PLA_UP +#define DEMYSTIFY_REMOVE_POLYGON PLA_DOWN +#define DEMYSTIFY_ADD_POLYGON_REPEAT PLA_UP_REPEAT +#define DEMYSTIFY_REMOVE_POLYGON_REPEAT PLA_DOWN_REPEAT const struct button_mapping *plugin_contexts[] -= {generic_directions, generic_actions, += {pla_main_ctx, #if defined(HAVE_REMOTE_LCD) - remote_directions + pla_remote_ctx, #endif }; -#define NB_ACTION_CONTEXTS \ - sizeof(plugin_contexts)/sizeof(struct button_mapping*) + #ifdef HAVE_LCD_COLOR struct line_color { @@ -383,7 +390,7 @@ int plugin_main(void) else rb->sleep(sleep_time); action = pluginlib_getaction(TIMEOUT_NOBLOCK, - plugin_contexts, NB_ACTION_CONTEXTS); + plugin_contexts, ARRAYLEN(plugin_contexts)); switch(action) { case DEMYSTIFY_QUIT: -- cgit v1.2.3