1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2010-05-20 17:41:28 +00:00
parent 97365803d3
commit 20e9d56ba5
18 changed files with 477 additions and 860 deletions

View file

@ -24,8 +24,7 @@
PLUGIN_HEADER
const struct button_mapping *plugin_contexts[] = {generic_directions,
generic_actions};
const struct button_mapping *plugin_contexts[] = { pla_main_ctx };
static int current = 0;
static bool tomorrow = false;
@ -33,7 +32,8 @@ static int alarm[2] = {0, 0}, maxval[2] = {24, 60}, prev_tick = 3600 * 24;
static bool quit = false, usb = false, waiting = false, done = false;
static inline int get_button(void) {
return pluginlib_getaction(HZ/2, plugin_contexts, 2);
return pluginlib_getaction(HZ/2, plugin_contexts,
ARRAYLEN(plugin_contexts));
}
int rem_seconds(void) {
@ -125,7 +125,7 @@ enum plugin_status plugin_start(const void* parameter)
while(!quit) {
button = get_button();
if (button == PLA_QUIT)
if (button == PLA_EXIT || PLA_CANCEL)
quit = true;
FOR_NB_SCREENS(i) {
@ -157,7 +157,8 @@ enum plugin_status plugin_start(const void* parameter)
current = (current + 1) % 2;
break;
case PLA_FIRE: {
case PLA_SELECT:
case PLA_SELECT_REPEAT: {
if (rem_seconds() < 0)
tomorrow = true;