iPod: First attempt to implement sensible button mappings. Changes to all targets to replace a small number of references to raw button codes (BUTTON_???) with their abstract equivalents.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7983 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2005-11-19 03:19:12 +00:00
parent a807fca49b
commit fe772405be
10 changed files with 106 additions and 77 deletions

View file

@ -473,7 +473,7 @@ bool bookmark_autoload(const char* file)
switch(key)
{
#ifdef HAVE_LCD_BITMAP
case BUTTON_DOWN:
case BOOKMARK_DOWN:
return bookmark_load(global_bookmark_file_name, false);
#endif
case SETTINGS_OK:
@ -567,21 +567,6 @@ static int get_bookmark_count(const char* bookmark_file_name)
}
#if CONFIG_KEYPAD == ONDIO_PAD
#define BOOKMARK_SELECT_PRE BUTTON_RIGHT
#define BOOKMARK_SELECT (BUTTON_RIGHT | BUTTON_REL)
#define BOOKMARK_DELETE (BUTTON_RIGHT | BUTTON_REPEAT)
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
(CONFIG_KEYPAD == IRIVER_H300_PAD)
#define BOOKMARK_SELECT BUTTON_SELECT
#define BOOKMARK_DELETE (BUTTON_ON | BUTTON_SELECT)
#else /* player, recorder, gmini */
#define BOOKMARK_SELECT BUTTON_PLAY
#define BOOKMARK_DELETE (BUTTON_ON | BUTTON_PLAY)
#endif
/* ----------------------------------------------------------------------- */
/* This displays a the bookmarks in a file and allows the user to */
/* select one to play. */

View file

@ -21,6 +21,31 @@
#include <stdbool.h>
#if CONFIG_KEYPAD == ONDIO_PAD
#define BOOKMARK_SELECT_PRE BUTTON_RIGHT
#define BOOKMARK_SELECT (BUTTON_RIGHT | BUTTON_REL)
#define BOOKMARK_DELETE (BUTTON_RIGHT | BUTTON_REPEAT)
#define BOOKMARK_DOWN BUTTON_DOWN
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
(CONFIG_KEYPAD == IRIVER_H300_PAD)
#define BOOKMARK_SELECT BUTTON_SELECT
#define BOOKMARK_DELETE (BUTTON_ON | BUTTON_SELECT)
#define BOOKMARK_DOWN BUTTON_DOWN
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_NANO_PAD)
#define BOOKMARK_SELECT BUTTON_SELECT
#define BOOKMARK_DELETE (BUTTON_RIGHT | BUTTON_REPEAT)
#define BOOKMARK_DOWN BUTTON_SCROLL_FWD
#else /* player, recorder, gmini */
#define BOOKMARK_SELECT BUTTON_PLAY
#define BOOKMARK_DELETE (BUTTON_ON | BUTTON_PLAY)
#define BOOKMARK_DOWN BUTTON_DOWN
#endif
bool bookmark_load_menu(void);
bool bookmark_autobookmark(void);
bool bookmark_create_menu(void);

View file

@ -170,25 +170,25 @@
#define WPS_KEYLOCK (BUTTON_MENU | BUTTON_DOWN)
#define WPS_ID3 (BUTTON_MENU | BUTTON_ON)
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_NANO_PAD)
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_NANO_PAD)
/* TODO: Check WPS button assignments */
#define WPS_NEXT (BUTTON_RIGHT | BUTTON_REL)
#define WPS_NEXT_PRE BUTTON_RIGHT
#define WPS_PREV (BUTTON_LEFT | BUTTON_REL)
#define WPS_PREV_PRE BUTTON_LEFT
#define WPS_FFWD (BUTTON_RIGHT | BUTTON_REPEAT)
#define WPS_REW (BUTTON_LEFT | BUTTON_REPEAT)
#define WPS_INCVOL BUTTON_UP
#define WPS_DECVOL BUTTON_DOWN
#define WPS_PAUSE BUTTON_OFF
/* #define WPS_MENU iPod can't have both main menu and context menu in wps */
#define WPS_BROWSE (BUTTON_MENU | BUTTON_REL)
#define WPS_BROWSE_PRE BUTTON_MENU
#define WPS_KEYLOCK (BUTTON_MENU | BUTTON_DOWN)
#define WPS_EXIT (BUTTON_OFF | BUTTON_REPEAT)
#define WPS_CONTEXT (BUTTON_MENU | BUTTON_REPEAT)
#define WPS_NEXT (BUTTON_NEXT | BUTTON_REL)
#define WPS_NEXT_PRE BUTTON_PREV
#define WPS_PREV (BUTTON_PREV | BUTTON_REL)
#define WPS_PREV_PRE BUTTON_PREV
#define WPS_FFWD (BUTTON_NEXT | BUTTON_REPEAT)
#define WPS_REW (BUTTON_PREV | BUTTON_REPEAT)
#define WPS_INCVOL BUTTON_SCROLL_FWD
#define WPS_DECVOL BUTTON_SCROLL_BACK
#define WPS_PAUSE BUTTON_PLAY | BUTTON_REL
#define WPS_MENU (BUTTON_MENU | BUTTON_REL)
#define WPS_BROWSE (BUTTON_SELECT | BUTTON_REL)
#define WPS_BROWSE_PRE BUTTON_SELECT
#define WPS_EXIT (BUTTON_PLAY | BUTTON_REPEAT)
#define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT)
#endif

View file

@ -65,9 +65,10 @@
#define LIST_NEXT BUTTON_DOWN
#define LIST_PREV BUTTON_UP
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_NANO_PAD)
#define LIST_NEXT BUTTON_DOWN
#define LIST_PREV BUTTON_UP
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_NANO_PAD)
#define LIST_NEXT BUTTON_SCROLL_FWD
#define LIST_PREV BUTTON_SCROLL_BACK
#elif CONFIG_KEYPAD == GMINI100_PAD
#define LIST_NEXT BUTTON_DOWN

View file

@ -53,13 +53,13 @@
#define SELECT_CANCEL BUTTON_STOP
#define SELECT_CANCEL2 BUTTON_MENU
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_NANO_PAD)
#define SELECT_INC BUTTON_UP
#define SELECT_DEC BUTTON_DOWN
#define SELECT_OK BUTTON_RIGHT
#define SELECT_OK2 BUTTON_LEFT
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_NANO_PAD)
#define SELECT_INC BUTTON_SCROLL_FWD
#define SELECT_DEC BUTTON_SCROLL_BACK
#define SELECT_OK BUTTON_SELECT
#define SELECT_OK2 BUTTON_RIGHT
#define SELECT_CANCEL BUTTON_MENU
#define SELECT_CANCEL2 BUTTON_OFF
#elif CONFIG_KEYPAD == ONDIO_PAD
#define SELECT_INC BUTTON_UP

View file

@ -30,8 +30,8 @@
#define DBX_SELECT BUTTON_MENU
#define DBX_STOP BUTTON_OFF
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_NANO_PAD)
#define DBX_SELECT BUTTON_MENU
#define DBX_STOP BUTTON_OFF
#define DBX_SELECT BUTTON_SELECT
#define DBX_STOP BUTTON_MENU
#elif CONFIG_KEYPAD == PLAYER_PAD
#define DBX_SELECT BUTTON_PLAY
#define DBX_STOP BUTTON_STOP

View file

@ -54,6 +54,10 @@
#define KBD_DONE (BUTTON_ON | BUTTON_REL)
#define KBD_ABORT BUTTON_OFF
#define KBD_BACKSPACE BUTTON_REC
#define KBD_LEFT BUTTON_LEFT
#define KBD_RIGHT BUTTON_RIGHT
#define KBD_UP BUTTON_UP
#define KBD_DOWN BUTTON_DOWN
#elif CONFIG_KEYPAD == RECORDER_PAD
#define KBD_CURSOR_RIGHT (BUTTON_ON | BUTTON_RIGHT)
@ -63,6 +67,10 @@
#define KBD_DONE BUTTON_F2
#define KBD_ABORT BUTTON_OFF
#define KBD_BACKSPACE BUTTON_F3
#define KBD_LEFT BUTTON_LEFT
#define KBD_RIGHT BUTTON_RIGHT
#define KBD_UP BUTTON_UP
#define KBD_DOWN BUTTON_DOWN
#elif CONFIG_KEYPAD == ONDIO_PAD /* restricted Ondio keypad */
#define KBD_MODES /* Ondio uses 2 modes, picker and line edit */
@ -70,6 +78,10 @@
#define KBD_SELECT_PRE BUTTON_MENU
#define KBD_DONE (BUTTON_MENU | BUTTON_REPEAT)
#define KBD_ABORT BUTTON_OFF
#define KBD_LEFT BUTTON_LEFT
#define KBD_RIGHT BUTTON_RIGHT
#define KBD_UP BUTTON_UP
#define KBD_DOWN BUTTON_DOWN
#elif CONFIG_KEYPAD == GMINI100_PAD
#define KBD_CURSOR_RIGHT (BUTTON_MENU | BUTTON_RIGHT)
@ -80,17 +92,23 @@
#define KBD_DONE (BUTTON_PLAY | BUTTON_REPEAT)
#define KBD_ABORT BUTTON_OFF
#define KBD_BACKSPACE (BUTTON_MENU | BUTTON_PLAY)
#define KBD_LEFT BUTTON_LEFT
#define KBD_RIGHT BUTTON_RIGHT
#define KBD_UP BUTTON_UP
#define KBD_DOWN BUTTON_DOWN
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_NANO_PAD)
/* TODO: Check keyboard.c button mappings - this is a copy of Ondio */
#define KBD_MODES /* Ondio uses 2 modes, picker and line edit */
#define KBD_SELECT (BUTTON_MENU | BUTTON_REL) /* backspace in line edit */
#define KBD_SELECT_PRE BUTTON_MENU
#define KBD_DONE (BUTTON_MENU | BUTTON_REPEAT)
#define KBD_ABORT BUTTON_OFF
#define KBD_MODES /* iPod uses 2 modes, picker and line edit */
#define KBD_SELECT (BUTTON_SELECT | BUTTON_REL) /* backspace in line edit */
#define KBD_SELECT_PRE BUTTON_SELECT
#define KBD_DONE (BUTTON_SELECT | BUTTON_REPEAT)
#define KBD_ABORT BUTTON_MENU
#define KBD_LEFT BUTTON_PREV
#define KBD_RIGHT BUTTON_NEXT
#define KBD_UP BUTTON_SCROLL_BACK
#define KBD_DOWN BUTTON_SCROLL_FWD
#endif
@ -252,8 +270,8 @@ int kbd_input(char* text, int buflen)
break;
#endif
case BUTTON_RIGHT:
case BUTTON_RIGHT | BUTTON_REPEAT:
case KBD_RIGHT:
case KBD_RIGHT | BUTTON_REPEAT:
#ifdef KBD_MODES
if (line_edit) /* right doubles as cursor_right in line_edit */
{
@ -282,8 +300,8 @@ int kbd_input(char* text, int buflen)
}
break;
case BUTTON_LEFT:
case BUTTON_LEFT | BUTTON_REPEAT:
case KBD_LEFT:
case KBD_LEFT | BUTTON_REPEAT:
#ifdef KBD_MODES
if (line_edit) /* left doubles as cursor_left in line_edit */
{
@ -312,8 +330,8 @@ int kbd_input(char* text, int buflen)
}
break;
case BUTTON_DOWN:
case BUTTON_DOWN | BUTTON_REPEAT:
case KBD_DOWN:
case KBD_DOWN | BUTTON_REPEAT:
#ifdef KBD_MODES
if (line_edit)
{
@ -336,8 +354,8 @@ int kbd_input(char* text, int buflen)
kbd_spellchar(line[y][x]);
break;
case BUTTON_UP:
case BUTTON_UP | BUTTON_REPEAT:
case KBD_UP:
case KBD_UP | BUTTON_REPEAT:
#ifdef KBD_MODES
if (line_edit)
{

View file

@ -79,10 +79,11 @@
#define SETTINGS_CANCEL BUTTON_OFF
#define SETTINGS_CANCEL2 BUTTON_MENU
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_NANO_PAD)
#define SETTINGS_INC BUTTON_RIGHT
#define SETTINGS_DEC BUTTON_LEFT
#define SETTINGS_OK BUTTON_PLAY
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_NANO_PAD)
#define SETTINGS_INC BUTTON_SCROLL_FWD
#define SETTINGS_DEC BUTTON_SCROLL_BACK
#define SETTINGS_OK BUTTON_SELECT
#define SETTINGS_CANCEL BUTTON_MENU
#endif

View file

@ -997,11 +997,7 @@ static bool add_dir(char* dirname, int len, int fd)
DIRCACHED* dir;
/* check for user abort */
#ifdef BUTTON_STOP
if (button_get(false) == BUTTON_STOP)
#else
if (button_get(false) == BUTTON_OFF)
#endif
if (button_get(false) == TREE_ABORT)
return true;
dir = opendir_cached(dirname);

View file

@ -30,6 +30,7 @@
#define TREE_NEXT BUTTON_DOWN
#define TREE_PREV BUTTON_UP
#define TREE_EXIT BUTTON_LEFT
#define TREE_ABORT BUTTON_OFF
#define TREE_ENTER BUTTON_RIGHT
#define TREE_RUN (BUTTON_SELECT | BUTTON_REL)
#define TREE_RUN_PRE BUTTON_SELECT
@ -63,6 +64,7 @@
#define TREE_NEXT BUTTON_DOWN
#define TREE_PREV BUTTON_UP
#define TREE_EXIT BUTTON_LEFT
#define TREE_ABORT BUTTON_OFF
#define TREE_ENTER BUTTON_RIGHT
#define TREE_RUN (BUTTON_PLAY | BUTTON_REL)
#define TREE_RUN_PRE BUTTON_PLAY
@ -86,6 +88,7 @@
#define TREE_NEXT BUTTON_RIGHT
#define TREE_PREV BUTTON_LEFT
#define TREE_EXIT BUTTON_STOP
#define TREE_ABORT BUTTON_STOP
#define TREE_RUN (BUTTON_PLAY | BUTTON_REL)
#define TREE_RUN_PRE BUTTON_PLAY
#define TREE_MENU BUTTON_MENU
@ -104,6 +107,7 @@
#define TREE_NEXT BUTTON_DOWN
#define TREE_PREV BUTTON_UP
#define TREE_EXIT BUTTON_LEFT
#define TREE_ABORT BUTTON_OFF
#define TREE_RUN (BUTTON_RIGHT | BUTTON_REL)
#define TREE_RUN_PRE BUTTON_RIGHT
#define TREE_MENU (BUTTON_MENU | BUTTON_REPEAT)
@ -130,22 +134,21 @@
#define TREE_CONTEXT2 (BUTTON_ON | BUTTON_PLAY)
#define TREE_POWER_BTN BUTTON_ON
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_NANO_PAD)
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_NANO_PAD)
/* TODO: Check Tree button assignments */
#define TREE_NEXT BUTTON_DOWN
#define TREE_PREV BUTTON_UP
#define TREE_NEXT BUTTON_SCROLL_FWD
#define TREE_PREV BUTTON_SCROLL_BACK
#define TREE_EXIT BUTTON_LEFT
#define TREE_RUN (BUTTON_RIGHT | BUTTON_REL)
#define TREE_RUN_PRE BUTTON_RIGHT
#define TREE_ABORT BUTTON_LEFT
#define TREE_ENTER BUTTON_RIGHT
#define TREE_RUN (BUTTON_SELECT | BUTTON_REL)
#define TREE_RUN_PRE BUTTON_SELECT
#define TREE_MENU (BUTTON_MENU | BUTTON_REPEAT)
#define TREE_MENU_PRE BUTTON_MENU
#define TREE_WPS (BUTTON_MENU | BUTTON_REL)
#define TREE_WPS_PRE BUTTON_MENU
#define TREE_CONTEXT (BUTTON_RIGHT | BUTTON_REPEAT)
#define TREE_POWER_BTN BUTTON_OFF
#define TREE_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT)
#endif