summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Louis Biasini <jlbiasini@gmail.com>2012-02-26 01:08:46 +0100
committerThomas Martitz <kugel@rockbox.org>2012-03-03 12:10:53 +0100
commita92696d40d3515d4391ffba043894ebbad80cab6 (patch)
treec25c888215d3223b1d0739f003efe77cdcc58a33
parent10c566ed94189141ba5aca287c74cd984a2010f5 (diff)
downloadrockbox-a92696d40d3515d4391ffba043894ebbad80cab6.tar.gz
rockbox-a92696d40d3515d4391ffba043894ebbad80cab6.zip
Plugin Starfield PLA integration (code + manual)
This commit changes: 1) replace all keymaps with PLA ones. 2) do the required changes to the manual in order to match code's changes. 3) add an alternative exit button (PLA_EXIT or PLA_CANCEL) Change-Id: I0cea909dd2ff44b8c5a2daba11c192965c4a02c7 Reviewed-on: http://gerrit.rockbox.org/131 Reviewed-by: Thomas Martitz <kugel@rockbox.org> Tested-by: Thomas Martitz <kugel@rockbox.org>
-rw-r--r--apps/plugins/starfield.c248
-rw-r--r--manual/plugins/starfield.tex39
2 files changed, 29 insertions, 258 deletions
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c
index b410c4134a..811e9c61ae 100644
--- a/apps/plugins/starfield.c
+++ b/apps/plugins/starfield.c
@@ -20,231 +20,28 @@
#include "plugin.h"
#include "lib/helper.h"
#include "lib/pluginlib_exit.h"
-
+#include "lib/pluginlib_actions.h"
/******************************* Globals ***********************************/
+/* this set the context to use with PLA */
+static const struct button_mapping *plugin_contexts[] = { pla_main_ctx };
/* Key assignement */
-#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
- (CONFIG_KEYPAD == IPOD_3G_PAD) || \
- (CONFIG_KEYPAD == IPOD_1G2G_PAD)
-#define STARFIELD_QUIT BUTTON_MENU
-#define STARFIELD_INCREASE_ZMOVE BUTTON_SCROLL_FWD
-#define STARFIELD_DECREASE_ZMOVE BUTTON_SCROLL_BACK
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAY
-
-#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
-#define STARFIELD_QUIT BUTTON_POWER
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAY
-
-#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
-#define STARFIELD_QUIT BUTTON_POWER
-#define STARFIELD_INCREASE_ZMOVE BUTTON_SCROLL_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_SCROLL_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAY
-
-#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
-#define STARFIELD_QUIT BUTTON_POWER
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_SELECT
-
-#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
- (CONFIG_KEYPAD == SANSA_C200_PAD) || \
- (CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
- (CONFIG_KEYPAD == SANSA_M200_PAD) || \
- (CONFIG_KEYPAD == SANSA_CONNECT_PAD)
-#define STARFIELD_QUIT BUTTON_POWER
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_SELECT
-
-#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
-#define STARFIELD_QUIT (BUTTON_HOME|BUTTON_REPEAT)
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_SELECT
-
-#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
- (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
-#define STARFIELD_QUIT BUTTON_BACK
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_SELECT
-
-#elif (CONFIG_KEYPAD == MROBE100_PAD)
-#define STARFIELD_QUIT BUTTON_POWER
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_SELECT
-
-#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
-#define STARFIELD_QUIT BUTTON_RC_REC
-#define STARFIELD_INCREASE_ZMOVE BUTTON_RC_VOL_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_RC_VOL_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RC_FF
-#define STARFIELD_DECREASE_NB_STARS BUTTON_RC_REW
-#define STARFIELD_TOGGLE_COLOR BUTTON_RC_MODE
-
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define STARFIELD_QUIT BUTTON_POWER
-#define STARFIELD_INCREASE_ZMOVE BUTTON_STOP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_PLAY
-#define STARFIELD_INCREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_TOGGLE_COLOR BUTTON_MENU
-
-#elif (CONFIG_KEYPAD == COWON_D2_PAD)
-#define STARFIELD_QUIT BUTTON_POWER
-
-#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
-#define STARFIELD_QUIT BUTTON_BACK
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_SELECT
-
-#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
-#define STARFIELD_QUIT BUTTON_POWER
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_SELECT
-
-#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
-#define STARFIELD_QUIT BUTTON_POWER
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAY
-
-#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
-#define STARFIELD_QUIT BUTTON_POWER
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_NEXT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_PREV
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAY
-
-#elif (CONFIG_KEYPAD == ONDAVX747_PAD) || (CONFIG_KEYPAD == ONDAVX777_PAD) || (CONFIG_KEYPAD == MROBE500_PAD)
-#define STARFIELD_QUIT BUTTON_POWER
-
-#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
-#define STARFIELD_QUIT BUTTON_FFWD
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAY
-
-#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
-#define STARFIELD_QUIT BUTTON_REC
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_NEXT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_PREV
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAY
-
-#elif CONFIG_KEYPAD == MPIO_HD200_PAD
-#define STARFIELD_QUIT (BUTTON_REC|BUTTON_PLAY)
-#define STARFIELD_INCREASE_ZMOVE BUTTON_VOL_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_VOL_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_FF
-#define STARFIELD_DECREASE_NB_STARS BUTTON_REW
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAY
-
-#elif CONFIG_KEYPAD == MPIO_HD300_PAD
-#define STARFIELD_QUIT (BUTTON_MENU|BUTTON_REPEAT)
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_FF
-#define STARFIELD_DECREASE_NB_STARS BUTTON_REW
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAY
-
-#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
-#define STARFIELD_QUIT BUTTON_POWER
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#define STARFIELD_INCREASE_NB_STARS BUTTON_LEFT
-#define STARFIELD_DECREASE_NB_STARS BUTTON_RIGHT
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAYPAUSE
-
-#endif
-
-#ifdef HAVE_TOUCHSCREEN
-#ifndef STARFIELD_QUIT
-#define STARFIELD_QUIT BUTTON_TOPLEFT
-#endif
-#ifndef STARFIELD_INCREASE_ZMOVE
-#define STARFIELD_INCREASE_ZMOVE BUTTON_TOPMIDDLE
-#endif
-#ifndef STARFIELD_DECREASE_ZMOVE
-#define STARFIELD_DECREASE_ZMOVE BUTTON_BOTTOMMIDDLE
-#endif
-#ifndef STARFIELD_INCREASE_NB_STARS
-#define STARFIELD_INCREASE_NB_STARS BUTTON_MIDRIGHT
-#endif
-#ifndef STARFIELD_DECREASE_NB_STARS
-#define STARFIELD_DECREASE_NB_STARS BUTTON_MIDLEFT
-#endif
-#ifndef STARFIELD_TOGGLE_COLOR
-#define STARFIELD_TOGGLE_COLOR BUTTON_CENTER
-#endif
-#endif
-
-#ifndef STARFIELD_QUIT
-#define STARFIELD_QUIT BUTTON_OFF
-#endif
-#ifndef STARFIELD_INCREASE_ZMOVE
-#define STARFIELD_INCREASE_ZMOVE BUTTON_UP
-#endif
-#ifndef STARFIELD_DECREASE_ZMOVE
-#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN
-#endif
-#ifndef STARFIELD_INCREASE_NB_STARS
-#define STARFIELD_INCREASE_NB_STARS BUTTON_RIGHT
-#endif
-#ifndef STARFIELD_DECREASE_NB_STARS
-#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
-#endif
-
-#ifndef STARFIELD_TOGGLE_COLOR
-#ifdef BUTTON_SELECT
-#define STARFIELD_TOGGLE_COLOR BUTTON_SELECT
-#else
-#define STARFIELD_TOGGLE_COLOR BUTTON_PLAY
-#endif
-#endif
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define STARFIELD_RC_QUIT BUTTON_RC_STOP
-#endif
-
+#define STARFIELD_QUIT PLA_EXIT
+#define STARFIELD_QUIT2 PLA_CANCEL
+#define STARFIELD_INCREASE_ZMOVE PLA_UP
+#define STARFIELD_INCREASE_ZMOVE_REPEAT PLA_UP_REPEAT
+#define STARFIELD_DECREASE_ZMOVE PLA_DOWN
+#define STARFIELD_DECREASE_ZMOVE_REPEAT PLA_DOWN_REPEAT
+#define STARFIELD_INCREASE_NB_STARS PLA_RIGHT
+#define STARFIELD_INCREASE_NB_STARS_REPEAT PLA_RIGHT_REPEAT
+#define STARFIELD_DECREASE_NB_STARS PLA_LEFT
+#define STARFIELD_DECREASE_NB_STARS_REPEAT PLA_LEFT_REPEAT
+#define STARFIELD_TOGGLE_COLOR PLA_SELECT
#define LCD_CENTER_X (LCD_WIDTH/2)
#define LCD_CENTER_Y (LCD_HEIGHT/2)
#define Z_MAX_DIST 100
-
#define MAX_STARS (LCD_WIDTH*LCD_HEIGHT*20)/100
#define INIT_STARS 200
#define STARFIELD_INCREASE_STEP 50
@@ -483,28 +280,31 @@ static int plugin_main(void)
}
rb->lcd_update();
- button = rb->button_get(false);
+ /*We get button from PLA this way */
+ button = pluginlib_getaction(TIMEOUT_NOBLOCK, plugin_contexts,
+ ARRAYLEN(plugin_contexts));
+
switch(button)
{
case (STARFIELD_INCREASE_ZMOVE):
- case (STARFIELD_INCREASE_ZMOVE | BUTTON_REPEAT):
+ case (STARFIELD_INCREASE_ZMOVE_REPEAT):
++(starfield.z_move);
pulse=false;
t_disp=MSG_DISP_TIME;
break;
case (STARFIELD_DECREASE_ZMOVE):
- case (STARFIELD_DECREASE_ZMOVE | BUTTON_REPEAT):
+ case (STARFIELD_DECREASE_ZMOVE_REPEAT):
--(starfield.z_move);
pulse=false;
t_disp=MSG_DISP_TIME;
break;
case(STARFIELD_INCREASE_NB_STARS):
- case(STARFIELD_INCREASE_NB_STARS | BUTTON_REPEAT):
+ case(STARFIELD_INCREASE_NB_STARS_REPEAT):
starfield_add_stars(&starfield, STARFIELD_INCREASE_STEP);
t_disp=MSG_DISP_TIME;
break;
case(STARFIELD_DECREASE_NB_STARS):
- case(STARFIELD_DECREASE_NB_STARS | BUTTON_REPEAT):
+ case(STARFIELD_DECREASE_NB_STARS_REPEAT):
starfield_del_stars(&starfield, STARFIELD_INCREASE_STEP);
t_disp=MSG_DISP_TIME;
break;
@@ -513,10 +313,8 @@ static int plugin_main(void)
starfield.color=!starfield.color;
break;
#endif
-#ifdef STARFIELD_RC_QUIT
- case STARFIELD_RC_QUIT:
-#endif
case(STARFIELD_QUIT):
+ case(STARFIELD_QUIT2):
return PLUGIN_OK;
break;
default:
diff --git a/manual/plugins/starfield.tex b/manual/plugins/starfield.tex
index 8b1fa7d64f..3169cd863a 100644
--- a/manual/plugins/starfield.tex
+++ b/manual/plugins/starfield.tex
@@ -4,46 +4,19 @@
Starfield simulation (like the classic screensaver).
\begin{btnmap}
- \opt{IPOD_4G_PAD,IPOD_3G_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD,RECORDER_PAD%
- ,ONDIO_PAD,GIGABEAT_PAD,GIGABEAT_S_PAD,MROBE100_PAD,SANSA_E200_PAD%
- ,SANSA_FUZE_PAD,SANSA_C200_PAD,IAUDIO_X5_PAD,IRIVER_H10_PAD%
- ,PBELL_VIBE500_PAD}
- {\ButtonRight\ / \ButtonLeft}
- \opt{COWON_D2_PAD}{\TouchMidRight{} / \TouchMidLeft}
- \opt{MPIO_HD200_PAD,MPIO_HD300_PAD}{\ButtonFF / \ButtonRew}
+ \PluginRight{} / \PluginLeft
\opt{HAVEREMOTEKEYMAP}{& }
& Increase / decrease number of stars\\
- \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonScrollFwd\ / \ButtonScrollBack}
- \opt{IRIVER_H100_PAD,IRIVER_H300_PAD,RECORDER_PAD,ONDIO_PAD,GIGABEAT_PAD%
- ,GIGABEAT_S_PAD,MROBE100_PAD,SANSA_E200_PAD,SANSA_FUZE_PAD%
- ,SANSA_C200_PAD,IAUDIO_X5_PAD,PBELL_VIBE500_PAD}
- {\ButtonUp\ / \ButtonDown}
- \opt{IRIVER_H10_PAD,MPIO_HD300_PAD}{\ButtonScrollUp\ / \ButtonScrollDown}
- \opt{COWON_D2_PAD}{\TouchTopMiddle{} / \TouchBottomMiddle}
- \opt{MPIO_HD200_PAD}{\ButtonVolUp / \ButtonVolDown}
+
+ \PluginUp{} / \PluginDown
\opt{HAVEREMOTEKEYMAP}{& }
& Increase / decrease speed\\
\opt{lcd_color}{%
- \opt{IRIVER_H300_PAD,SANSA_E200_PAD,SANSA_FUZE_PAD,SANSA_C200_PAD%
- ,GIGABEAT_PAD,GIGABEAT_S_PAD,MROBE100_PAD}{\ButtonSelect}%
- \opt{IPOD_4G_PAD,IPOD_3G_PAD,IAUDIO_X5_PAD,IRIVER_H10_PAD%
- ,PBELL_VIBE500_PAD,MPIO_HD200_PAD,MPIO_HD300_PAD}%
- {\ButtonPlay}%
- \opt{COWON_D2_PAD}{\TouchCenter}
+ \PluginSelect%
\opt{HAVEREMOTEKEYMAP}{& }
& Change colours\\%
}%
- \opt{IPOD_4G_PAD,IPOD_3G_PAD}{\ButtonMenu}
- \opt{IAUDIO_X5_PAD,IRIVER_H10_PAD,SANSA_E200_PAD,SANSA_C200_PAD%
- ,GIGABEAT_PAD,MROBE100_PAD,COWON_D2_PAD}{\ButtonPower}
- \opt{SANSA_FUZE_PAD}{Long \ButtonHome}
- \opt{GIGABEAT_S_PAD}{\ButtonBack}
- \opt{IRIVER_H100_PAD,IRIVER_H300_PAD,RECORDER_PAD,ONDIO_PAD}{\ButtonOff}
- \opt{PBELL_VIBE500_PAD}{\ButtonRec}
- \opt{MPIO_HD200_PAD}{\ButtonRec + \ButtonPlay}
- \opt{MPIO_HD300_PAD}{Long \ButtonMenu}
- \opt{HAVEREMOTEKEYMAP}{&
- \opt{IRIVER_RC_H100_PAD}{\ButtonRCStop}
- }
+ \PluginCancel{} or \PluginExit
+ \opt{HAVEREMOTEKEYMAP}{& }
& Quit\\
\end{btnmap}