Redesigned the button handling. The code now uses symbolic function defines instead of checking for specific buttons. This makes it easier to add support for new devices with different button layouts.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5091 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2004-09-19 21:58:37 +00:00
parent 17f54a40f1
commit 6c33c51a4c
36 changed files with 1049 additions and 1163 deletions

View file

@ -181,14 +181,15 @@ int kbd_input(char* text, int buflen)
case MENU_LINE_INPUT:
switch (button_pressed)
{
case BUTTON_UP:
case BUTTON_UP | BUTTON_REPEAT:
case BUTTON_PLAY:
case BUTTON_PLAY | BUTTON_REPEAT:
if (cursor_pos<len)
cursor_pos++;
button_pressed=BUTTON_NONE;
break;
case BUTTON_DOWN:
case BUTTON_DOWN | BUTTON_REPEAT:
case BUTTON_STOP:
case BUTTON_STOP | BUTTON_REPEAT:
if (cursor_pos>0)
cursor_pos--;
button_pressed=BUTTON_NONE;
@ -199,13 +200,13 @@ int kbd_input(char* text, int buflen)
case MENU_LINE_NEWCHARS:
switch (button_pressed)
{
case BUTTON_UP:
case BUTTON_UP | BUTTON_REPEAT:
case BUTTON_PLAY:
case BUTTON_PLAY | BUTTON_REPEAT:
x=(x+1+linelen)%linelen;
button_pressed=BUTTON_NONE;
break;
case BUTTON_DOWN:
case BUTTON_DOWN | BUTTON_REPEAT:
case BUTTON_STOP:
case BUTTON_STOP | BUTTON_REPEAT:
x=(x-1+linelen)%linelen;
button_pressed=BUTTON_NONE;
break;