Fix chessbox keymap handling

Let's give the defined, yet unused keymaps some sense :)

Change-Id: I372217351f7edc35c69c8c29fba782d32c895d5b
This commit is contained in:
Sebastian Leonhardt 2015-04-23 00:07:27 +02:00 committed by Gerrit Rockbox
parent bc25437448
commit f01fb3ca59
2 changed files with 85 additions and 35 deletions

View file

@ -431,6 +431,11 @@ static struct cb_command cb_get_viewer_command (void) {
case CB_RC_QUIT:
result.type = COMMAND_QUIT;
return result;
#endif
#ifdef CB_RESTART
case CB_RESTART:
result.type = COMMAND_RESTART;
return result;
#endif
case CB_MENU:
result.type = cb_menu_viewer();
@ -575,6 +580,7 @@ static void cb_start_viewer(char* filename){
GNUChess_Initialize();
cb_drawboard();
curr_ply = selected_game->first_ply;
break;
case COMMAND_SELECT:
exit_game = true;
break;
@ -658,6 +664,11 @@ static struct cb_command cb_getcommand (void) {
case CB_RC_QUIT:
result.type = COMMAND_QUIT;
return result;
#endif
#ifdef CB_RESTART
case CB_RESTART:
result.type = COMMAND_RESTART;
return result;
#endif
case CB_MENU:
result.type = cb_menu();
@ -673,6 +684,9 @@ static struct cb_command cb_getcommand (void) {
result.type = COMMAND_PLAY;
return result;
case CB_UP:
#ifdef CB_SCROLL_UP
case CB_SCROLL_UP:
#endif
if ( !from_marked ) cb_switch ( x , y );
y++;
if ( y == 8 ) {
@ -688,6 +702,9 @@ static struct cb_command cb_getcommand (void) {
}
break;
case CB_DOWN:
#ifdef CB_SCROLL_DOWN
case CB_SCROLL_DOWN:
#endif
if ( !from_marked ) cb_switch ( x , y );
y--;
if ( y < 0 ) {
@ -703,6 +720,9 @@ static struct cb_command cb_getcommand (void) {
}
break;
case CB_LEFT:
#ifdef CB_SCROLL_LEFT
case CB_SCROLL_LEFT:
#endif
if ( !from_marked ) cb_switch ( x , y );
x--;
if ( x < 0 ) {
@ -718,6 +738,9 @@ static struct cb_command cb_getcommand (void) {
}
break;
case CB_RIGHT:
#ifdef CB_SCROLL_RIGHT
case CB_SCROLL_RIGHT:
#endif
if ( !from_marked ) cb_switch ( x , y );
x++;
if ( x == 8 ) {
@ -842,13 +865,11 @@ static void cb_play_game(void) {
cb_drawboard();
}
break;
#ifdef COMMAND_RESTART
case COMMAND_RESTART:
GNUChess_Initialize();
game = pgn_init_game();
cb_drawboard();
break;
#endif
case COMMAND_RESUME:
cb_drawboard();
break;

View file

@ -34,7 +34,6 @@
#define CB_LEVEL (BUTTON_SELECT | BUTTON_RIGHT)
#define CB_RESTART (BUTTON_SELECT | BUTTON_LEFT)
#define CB_MENU (BUTTON_SELECT | BUTTON_MENU)
#define CB_SCROLL_UP (BUTTON_SCROLL_FWD|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_SCROLL_BACK|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -50,7 +49,6 @@
#define CB_LEVEL BUTTON_REC
#define CB_RESTART (BUTTON_SELECT | BUTTON_PLAY)
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -66,9 +64,7 @@
#define CB_LEVEL BUTTON_MODE
#define CB_RESTART BUTTON_REC
#define CB_MENU BUTTON_OFF
#define CB_RC_QUIT BUTTON_RC_STOP
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -83,7 +79,6 @@
#define CB_PLAY BUTTON_PLAY
#define CB_LEVEL BUTTON_EQ
#define CB_MENU BUTTON_MODE
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -99,7 +94,6 @@
#define CB_LEVEL BUTTON_F1
#define CB_RESTART BUTTON_F3
#define CB_MENU BUTTON_OFF
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -115,7 +109,6 @@
#define CB_LEVEL BUTTON_F1
#define CB_RESTART BUTTON_F3
#define CB_MENU BUTTON_OFF
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -133,7 +126,6 @@
#define CB_LEVEL (BUTTON_MENU|BUTTON_OFF)
#define CB_RESTART (BUTTON_MENU|BUTTON_LEFT)
#define CB_MENU BUTTON_OFF
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -148,7 +140,6 @@
#define CB_PLAY BUTTON_A
#define CB_LEVEL BUTTON_MENU
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -163,7 +154,6 @@
#define CB_PLAY BUTTON_PLAY
#define CB_LEVEL BUTTON_MENU
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -179,9 +169,8 @@
#define CB_LEVEL BUTTON_FF
#define CB_RESTART (BUTTON_REW | BUTTON_PLAY)
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_SCROLL_BACK|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_SCROLL_FWD|BUTTON_REPEAT)
#define CB_SCROLL_UP (BUTTON_SCROLL_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_SCROLL_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
@ -195,9 +184,8 @@
#define CB_LEVEL BUTTON_REC
#define CB_RESTART (BUTTON_SELECT | BUTTON_REPEAT)
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_SCROLL_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_SCROLL_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_UP (BUTTON_SCROLL_FWD|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_SCROLL_BACK|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
@ -211,9 +199,8 @@
#define CB_LEVEL (BUTTON_SELECT|BUTTON_LEFT)
#define CB_RESTART (BUTTON_SELECT | BUTTON_REPEAT)
#define CB_MENU (BUTTON_HOME|BUTTON_REPEAT)
#define CB_SCROLL_UP (BUTTON_SCROLL_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_SCROLL_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_UP (BUTTON_SCROLL_FWD|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_SCROLL_BACK|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
@ -226,7 +213,6 @@
#define CB_PLAY BUTTON_VOL_UP
#define CB_LEVEL BUTTON_HOME
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -241,7 +227,6 @@
#define CB_PLAY BUTTON_VOL_UP
#define CB_LEVEL (BUTTON_SELECT | BUTTON_UP)
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -256,7 +241,6 @@
#define CB_PLAY BUTTON_VOL_UP
#define CB_LEVEL BUTTON_REC
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -273,7 +257,6 @@
#define CB_PLAY BUTTON_PLAY
#define CB_LEVEL BUTTON_DISPLAY
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
@ -289,12 +272,10 @@
#define CB_LEVEL BUTTON_RC_MENU
#define CB_RESTART (BUTTON_RC_PLAY|BUTTON_REPEAT)
#define CB_MENU BUTTON_RC_REC
#define CB_SCROLL_UP (BUTTON_RC_VOL_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_RC_VOL_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_RC_REW|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RC_FF|BUTTON_REPEAT)
#define CB_RC_QUIT BUTTON_REC
#elif CONFIG_KEYPAD == COWON_D2_PAD
@ -303,7 +284,6 @@
#define CB_MENU (BUTTON_MENU|BUTTON_REL)
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define CB_SELECT BUTTON_PLAY
#define CB_UP BUTTON_UP
#define CB_DOWN BUTTON_DOWN
@ -312,6 +292,10 @@
#define CB_PLAY BUTTON_SELECT
#define CB_LEVEL BUTTON_CUSTOM
#define CB_MENU BUTTON_MENU
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
#define CB_SELECT (BUTTON_PLAY|BUTTON_REL)
@ -332,6 +316,10 @@
#define CB_PLAY BUTTON_VIEW
#define CB_LEVEL BUTTON_PLAYLIST
#define CB_MENU BUTTON_MENU
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
#define CB_SELECT BUTTON_PLAY
@ -342,6 +330,10 @@
#define CB_PLAY BUTTON_RIGHT
#define CB_LEVEL BUTTON_LEFT
#define CB_MENU BUTTON_MENU
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_PREV|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_NEXT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
#define CB_SELECT BUTTON_PLAY
@ -352,11 +344,10 @@
#define CB_PLAY BUTTON_RIGHT
#define CB_LEVEL BUTTON_LEFT
#define CB_MENU BUTTON_MENU
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_PREV|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_NEXT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == ONDAVX747_PAD
#define CB_LEVEL BUTTON_VOL_UP
@ -376,6 +367,10 @@
#define CB_PLAY BUTTON_PLAY
#define CB_LEVEL (BUTTON_REW|BUTTON_RIGHT)
#define CB_MENU (BUTTON_REW|BUTTON_LEFT)
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
#define CB_SELECT BUTTON_OK
@ -386,6 +381,10 @@
#define CB_PLAY BUTTON_PLAY
#define CB_LEVEL BUTTON_CANCEL
#define CB_MENU BUTTON_MENU
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_PREV|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_NEXT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
#define CB_SELECT BUTTON_FUNC
@ -396,6 +395,10 @@
#define CB_PLAY BUTTON_PLAY
#define CB_LEVEL BUTTON_REC
#define CB_MENU (BUTTON_FUNC | BUTTON_REPEAT)
#define CB_SCROLL_UP (BUTTON_REW|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_FF|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_VOL_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_VOL_UP|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
#define CB_SELECT BUTTON_ENTER
@ -406,6 +409,10 @@
#define CB_PLAY BUTTON_PLAY
#define CB_LEVEL BUTTON_REC
#define CB_MENU BUTTON_MENU
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_REW|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_FF|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
#define CB_SELECT BUTTON_SELECT
@ -417,6 +424,10 @@
#define CB_LEVEL BUTTON_BOTTOMRIGHT
#define CB_RESTART (BUTTON_BACK | BUTTON_REPEAT)
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
#define CB_SELECT BUTTON_SELECT
@ -428,9 +439,8 @@
#define CB_LEVEL BUTTON_VOL_DOWN
#define CB_RESTART BUTTON_PREV
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_SCROLL_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_SCROLL_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_UP (BUTTON_SCROLL_FWD|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_SCROLL_BACK|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
@ -443,6 +453,10 @@
#define CB_PLAY BUTTON_USER
#define CB_LEVEL BUTTON_BACK
#define CB_MENU BUTTON_MENU
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == HM60X_PAD
#define CB_SELECT BUTTON_SELECT
@ -453,6 +467,10 @@
#define CB_PLAY (BUTTON_POWER | BUTTON_SELECT)
#define CB_LEVEL (BUTTON_POWER | BUTTON_LEFT)
#define CB_MENU (BUTTON_POWER | BUTTON_RIGHT)
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == HM801_PAD
#define CB_SELECT BUTTON_SELECT
@ -463,7 +481,10 @@
#define CB_PLAY BUTTON_PLAY
#define CB_LEVEL BUTTON_PREV
#define CB_MENU BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == SONY_NWZ_PAD
#define CB_SELECT BUTTON_PLAY
@ -474,6 +495,10 @@
#define CB_PLAY (BUTTON_REPEAT|BUTTON_PLAY)
#define CB_MENU BUTTON_BACK
#define CB_LEVEL BUTTON_POWER
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD
#define CB_SELECT BUTTON_SELECT
@ -484,6 +509,10 @@
#define CB_PLAY BUTTON_PLAYPAUSE
#define CB_MENU BUTTON_MENU
#define CB_LEVEL BUTTON_BACK
#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == DX50_PAD
#define CB_SELECT BUTTON_PLAY