Remote keys support for the demystify plugin (added remote_directions to the plugins actions), updated key bindings in manual
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13927 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/plugins/demystify.c b/apps/plugins/demystify.c
index 0cb06ee..1ea9806 100644
--- a/apps/plugins/demystify.c
+++ b/apps/plugins/demystify.c
@@ -47,7 +47,11 @@
#define DEMYSTIFY_REMOVE_POLYGON_REPEAT PLA_DOWN_REPEAT
const struct button_mapping *plugin_contexts[]
-= {generic_directions, generic_actions};
+= {generic_directions, generic_actions,
+#if defined(HAVE_REMOTE_LCD)
+ remote_directions
+#endif
+};
#ifdef HAVE_LCD_COLOR
struct line_color
@@ -293,8 +297,17 @@
color_randomize(color);
}
-#define COLOR_RGBPACK(color) LCD_RGBPACK((color)->current_r, (color)->current_g, (color)->current_b)
+#define COLOR_RGBPACK(color) \
+ LCD_RGBPACK((color)->current_r, (color)->current_g, (color)->current_b)
+void color_apply(struct line_color * color, struct screen * display)
+{
+ if (display->is_color){
+ unsigned foreground=
+ SCREEN_COLOR_TO_NATIVE(display,COLOR_RGBPACK(color));
+ display->set_foreground(foreground);
+ }
+}
#endif
/*
@@ -352,13 +365,8 @@
polygon_update(&leading_polygon[i], display, &move[i]);
/* Now the drawing part */
-
#ifdef HAVE_LCD_COLOR
- if (display->is_color){
- unsigned foreground=
- SCREEN_COLOR_TO_NATIVE(display,COLOR_RGBPACK(&color));
- display->set_foreground(foreground);
- }
+ color_apply(&color, display);
#endif
display->clear_display();
polygons_draw(&polygons[i], display);
@@ -373,7 +381,7 @@
else
rb->sleep(sleep_time);
- action = pluginlib_getaction(rb, TIMEOUT_NOBLOCK, plugin_contexts, 2);
+ action = pluginlib_getaction(rb, TIMEOUT_NOBLOCK, plugin_contexts, 3);
switch(action)
{
case DEMYSTIFY_QUIT:
diff --git a/apps/plugins/lib/pluginlib_actions.h b/apps/plugins/lib/pluginlib_actions.h
index 1a3ab52..a5c199d 100644
--- a/apps/plugins/lib/pluginlib_actions.h
+++ b/apps/plugins/lib/pluginlib_actions.h
@@ -45,6 +45,47 @@
LAST_PLUGINLIB_ACTION
};
+#if defined(HAVE_REMOTE_LCD)
+static const struct button_mapping remote_directions[] =
+{
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
+ (CONFIG_KEYPAD == IRIVER_H300_PAD)
+ { PLA_UP, BUTTON_RC_BITRATE, BUTTON_NONE},
+ { PLA_DOWN, BUTTON_RC_SOURCE, BUTTON_NONE},
+ { PLA_LEFT, BUTTON_RC_VOL_DOWN, BUTTON_NONE},
+ { PLA_RIGHT, BUTTON_RC_VOL_UP, BUTTON_NONE},
+ { PLA_UP_REPEAT, BUTTON_RC_BITRATE|BUTTON_REPEAT, BUTTON_NONE},
+ { PLA_DOWN_REPEAT, BUTTON_RC_SOURCE|BUTTON_REPEAT, BUTTON_NONE},
+ { PLA_LEFT_REPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
+ { PLA_RIGHT_REPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
+#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) || \
+ (CONFIG_KEYPAD == IRIVER_H10_PAD) || \
+ (CONFIG_KEYPAD == GIGABEAT_PAD)
+ { PLA_UP, BUTTON_RC_FF, BUTTON_NONE},
+ { PLA_DOWN, BUTTON_RC_REW, BUTTON_NONE},
+ { PLA_LEFT, BUTTON_RC_VOL_DOWN, BUTTON_NONE},
+ { PLA_RIGHT, BUTTON_RC_VOL_UP, BUTTON_NONE},
+ { PLA_UP_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE},
+ { PLA_DOWN_REPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE},
+ { PLA_LEFT_REPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
+ { PLA_RIGHT_REPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
+#elif (CONFIG_KEYPAD == PLAYER_PAD) || \
+ (CONFIG_KEYPAD == RECORDER_PAD)
+ { PLA_UP, BUTTON_RC_VOL_UP, BUTTON_NONE},
+ { PLA_DOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE},
+ { PLA_LEFT, BUTTON_RC_LEFT, BUTTON_NONE},
+ { PLA_RIGHT, BUTTON_RC_RIGHT, BUTTON_NONE},
+ { PLA_UP_REPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
+ { PLA_DOWN_REPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
+ { PLA_LEFT_REPEAT, BUTTON_RC_LEFT|BUTTON_REPEAT, BUTTON_NONE},
+ { PLA_RIGHT_REPEAT, BUTTON_RC_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
+#else
+ #error pluginlib_actions: Unsupported remote keypad
+#endif
+ {CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE}
+};
+#endif /* HAVE_REMOTE_LCD */
+
static const struct button_mapping generic_directions[] =
{
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \
diff --git a/manual/plugins/demystify.tex b/manual/plugins/demystify.tex
index df80b40..f2e5cd0 100644
--- a/manual/plugins/demystify.tex
+++ b/manual/plugins/demystify.tex
@@ -7,13 +7,13 @@
\opt{RECORDER_PAD,ONDIO_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD}
{\ButtonUp\ / \ButtonDown}
\opt{IPOD_4G_PAD,IPOD_3G_PAD,IAUDIO_X5_PAD,IRIVER_H10_PAD,SANSA_E200_PAD}{\ButtonRight\ / \ButtonLeft}
- & Add / remove polygon\\
+ & Increase / decrease speed\\
\opt{RECORDER_PAD,ONDIO_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD}
{\ButtonRight\ / \ButtonLeft}
\opt{IPOD_4G_PAD,IPOD_4G_PAD}{\ButtonScrollFwd\ / \ButtonScrollBack}
\opt{IRIVER_H10_PAD,SANSA_E200_PAD}{\ButtonScrollUp/\ButtonScrollDown}
\opt{IAUDIO_X5_PAD}{\ButtonUp\ / \ButtonDown}
- & Increase / decrease speed\\
+ & Add / remove polygon\\
\opt{RECORDER_PAD,ONDIO_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD}{\ButtonOff}
\opt{IPOD_4G_PAD,IPOD_4G_PAD}{\ButtonMenu}
\opt{IAUDIO_X5_PAD,IRIVER_H10_PAD,SANSA_E200_PAD}{\ButtonPower}