Remote button mappings for archos player & recorders. Made keymap-internal stuff static for better optimisation.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10620 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-08-16 20:12:27 +00:00
parent 0fec0f540c
commit f39add3d19
2 changed files with 109 additions and 21 deletions

View file

@ -25,7 +25,7 @@
#include "action.h"
#include "button.h"
const struct button_mapping button_context_standard[] = {
static const struct button_mapping button_context_standard[] = {
{ ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
@ -39,7 +39,7 @@ const struct button_mapping button_context_standard[] = {
LAST_ITEM_IN_LIST
};
const struct button_mapping button_context_wps[] = {
static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_PLAY, BUTTON_PLAY, BUTTON_NONE },
{ ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
{ ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
@ -59,37 +59,77 @@ const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
{ ACTION_WPS_ID3SCREEN, BUTTON_MENU|BUTTON_ON, BUTTON_NONE },
LAST_ITEM_IN_LIST
};
const struct button_mapping button_context_settings[] = {
{ ACTION_SETTINGS_INC, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_SETTINGS_INCREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
static const struct button_mapping button_context_settings[] = {
{ ACTION_SETTINGS_INC, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_SETTINGS_INCREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_SETTINGS_DEC, BUTTON_RIGHT, BUTTON_NONE },
{ ACTION_SETTINGS_DECREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST
};
const struct button_mapping button_context_tree[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_ON, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_listtree */
const struct button_mapping button_context_yesno[] = {
static const struct button_mapping button_context_yesno[] = {
{ ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_settings_yesno */
/*****************************************************************************
* Remote control mappings
*****************************************************************************/
static const struct button_mapping remote_button_context_standard[] = {
{ ACTION_STD_PREV, BUTTON_RC_LEFT, BUTTON_NONE },
{ ACTION_STD_NEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
{ ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
LAST_ITEM_IN_LIST
};
static const struct button_mapping remote_button_context_wps[] = {
{ ACTION_WPS_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
{ ACTION_WPS_SKIPNEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
{ ACTION_WPS_SKIPPREV, BUTTON_RC_LEFT, BUTTON_NONE },
{ ACTION_WPS_STOP, BUTTON_RC_STOP, BUTTON_NONE },
{ ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
{ ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
LAST_ITEM_IN_LIST
};
static const struct button_mapping* get_context_mapping_remote( int context )
{
context ^= CONTEXT_REMOTE;
switch (context)
{
case CONTEXT_WPS:
return remote_button_context_wps;
default:
return remote_button_context_standard;
}
}
const struct button_mapping* get_context_mapping( int context )
{
switch( context )
if (context&CONTEXT_REMOTE)
return get_context_mapping_remote(context);
switch (context)
{
case CONTEXT_STD:
return button_context_standard;
case CONTEXT_WPS:
return button_context_wps;
@ -102,6 +142,7 @@ const struct button_mapping* get_context_mapping( int context )
case CONTEXT_TREE:
return button_context_tree;
case CONTEXT_STD:
case CONTEXT_LIST:
case CONTEXT_MAINMENU:
default:

View file

@ -34,7 +34,7 @@ CONTEXT_CUSTOM|1 = the standard list/tree defines (without directions)
*/
const struct button_mapping button_context_standard[] = {
static const struct button_mapping button_context_standard[] = {
{ ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
{ ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
@ -55,7 +55,7 @@ const struct button_mapping button_context_standard[] = {
LAST_ITEM_IN_LIST
};
const struct button_mapping button_context_wps[] = {
static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_PLAY, BUTTON_PLAY, BUTTON_NONE },
{ ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
{ ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
@ -79,7 +79,7 @@ const struct button_mapping button_context_wps[] = {
LAST_ITEM_IN_LIST
};
const struct button_mapping button_context_settings[] = {
static const struct button_mapping button_context_settings[] = {
{ ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
{ ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
@ -88,13 +88,14 @@ const struct button_mapping button_context_settings[] = {
LAST_ITEM_IN_LIST
};
const struct button_mapping button_context_tree[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_PLAY, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_OFF, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_listtree */
const struct button_mapping button_context_tree_scroll_lr[] = {
static const struct button_mapping button_context_tree_scroll_lr[] = {
{ ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
@ -106,12 +107,12 @@ const struct button_mapping button_context_tree_scroll_lr[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1),
};
const struct button_mapping button_context_yesno[] = {
static const struct button_mapping button_context_yesno[] = {
{ ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
LAST_ITEM_IN_LIST
};
const struct button_mapping button_context_quickscreen[] = {
static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE },
{ ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
@ -125,7 +126,7 @@ const struct button_mapping button_context_quickscreen[] = {
LAST_ITEM_IN_LIST
}; /* button_context_quickscreen */
const struct button_mapping button_context_pitchscreen[] = {
static const struct button_mapping button_context_pitchscreen[] = {
{ ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
{ ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
@ -140,8 +141,51 @@ const struct button_mapping button_context_pitchscreen[] = {
LAST_ITEM_IN_LIST
}; /* button_context_pitchcreen */
/*****************************************************************************
* Remote control mappings
*****************************************************************************/
static const struct button_mapping remote_button_context_standard[] = {
{ ACTION_STD_PREV, BUTTON_RC_LEFT, BUTTON_NONE },
{ ACTION_STD_NEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
{ ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
LAST_ITEM_IN_LIST
};
static const struct button_mapping remote_button_context_wps[] = {
{ ACTION_WPS_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
{ ACTION_WPS_SKIPNEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
{ ACTION_WPS_SKIPPREV, BUTTON_RC_LEFT, BUTTON_NONE },
{ ACTION_WPS_STOP, BUTTON_RC_STOP, BUTTON_NONE },
{ ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
{ ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
LAST_ITEM_IN_LIST
};
static const struct button_mapping* get_context_mapping_remote( int context )
{
context ^= CONTEXT_REMOTE;
switch (context)
{
case CONTEXT_WPS:
return remote_button_context_wps;
default:
return remote_button_context_standard;
}
}
const struct button_mapping* get_context_mapping( int context )
{
if (context&CONTEXT_REMOTE)
return get_context_mapping_remote(context);
switch( context )
{
case CONTEXT_WPS:
@ -152,17 +196,20 @@ const struct button_mapping* get_context_mapping( int context )
case CONTEXT_YESNOSCREEN:
return button_context_yesno;
case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen;
case CONTEXT_TREE:
if (global_settings.hold_lr_for_scroll_in_list)
return button_context_tree_scroll_lr;
/* else fall through to CUSTOM|1 */
case CONTEXT_CUSTOM|1:
return button_context_tree;
case CONTEXT_QUICKSCREEN:
return button_context_quickscreen;
case CONTEXT_STD:
case CONTEXT_LIST:
case CONTEXT_MAINMENU: