From 0709a190ca06e9db3e199619e279b269210ee83d Mon Sep 17 00:00:00 2001 From: Patrick Hallen Date: Fri, 13 Mar 2009 18:11:20 +0100 Subject: [PATCH] Make it possible to switch to the song viewer from anywhere. --- src/command.c | 10 ++++------ src/command.h | 2 +- src/screen.c | 5 +++++ src/screen_browser.c | 2 +- src/screen_help.c | 2 +- src/screen_list.h | 3 +++ src/screen_lyrics.c | 2 +- src/screen_play.c | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/command.c b/src/command.c index add5722..53baf26 100644 --- a/src/command.c +++ b/src/command.c @@ -160,11 +160,6 @@ static command_definition_t cmds[] = { { { '"', 0, 0 }, 0, CMD_GO_PARENT_DIRECTORY, "go-parent-directory", N_("Go to parent directory") }, -#ifdef ENABLE_SONG_SCREEN - { { 'i', 0, 0 }, 0, CMD_VIEW, "view", - N_("View the song") }, -#endif - { { 'G', 0, 0 }, 0, CMD_LOCATE, "locate", N_("Locate song in browser") }, @@ -224,7 +219,10 @@ static command_definition_t cmds[] = { { {'m', 0, 0 }, 0, CMD_SEARCH_MODE, "search-mode", N_("Change search mode") }, #endif - +#ifdef ENABLE_SONG_SCREEN + { { 'i', 0, 0 }, 0, CMD_SCREEN_SONG, "view", + N_("View the selected and the currently playing song") }, +#endif #ifdef ENABLE_LYRICS_SCREEN { {'7', F7, 0 }, 0, CMD_SCREEN_LYRICS, "screen-lyrics", N_("Lyrics screen") }, diff --git a/src/command.h b/src/command.h index a714582..b3b98c8 100644 --- a/src/command.h +++ b/src/command.h @@ -87,6 +87,7 @@ typedef enum { CMD_SCREEN_FILE, CMD_SCREEN_ARTIST, CMD_SCREEN_SEARCH, + CMD_SCREEN_SONG, CMD_SCREEN_KEYDEF, CMD_SCREEN_HELP, CMD_SCREEN_LYRICS, @@ -95,7 +96,6 @@ typedef enum { CMD_INTERRUPT, CMD_GO_ROOT_DIRECTORY, CMD_GO_PARENT_DIRECTORY, - CMD_VIEW, CMD_LOCATE, CMD_QUIT } command_t; diff --git a/src/screen.c b/src/screen.c index 5c92042..57b22cf 100644 --- a/src/screen.c +++ b/src/screen.c @@ -843,6 +843,11 @@ screen_cmd(mpdclient_t *c, command_t cmd) screen_switch(&screen_artist, c); break; #endif +#ifdef ENABLE_SONG_SCREEN + case CMD_SCREEN_SONG: + screen_switch(&screen_song, c); + break; +#endif #ifdef ENABLE_KEYDEF_SCREEN case CMD_SCREEN_KEYDEF: screen_switch(&screen_keydef, c); diff --git a/src/screen_browser.c b/src/screen_browser.c index 325b4f4..b118a7e 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -479,7 +479,7 @@ browser_cmd(struct screen_browser *browser, #endif #ifdef ENABLE_SONG_SCREEN - case CMD_VIEW: + case CMD_SCREEN_SONG: entry = browser_get_selected(browser); if (entry == NULL || entry->entity == NULL || entry->entity->type != MPD_INFO_ENTITY_TYPE_SONG) diff --git a/src/screen_help.c b/src/screen_help.c index f4f07ff..4283ca3 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -100,7 +100,7 @@ static help_text_row_t help_text[] = { { 0, CMD_LIST_JUMP, NULL }, { 0, CMD_TOGGLE_FIND_WRAP, NULL }, { 0, CMD_LOCATE, NULL }, - { 0, CMD_VIEW, NULL }, + { 0, CMD_SCREEN_SONG, NULL }, { 0, CMD_NONE, NULL }, { 0, CMD_QUIT, NULL }, diff --git a/src/screen_list.h b/src/screen_list.h index 665e41e..2f9cffd 100644 --- a/src/screen_list.h +++ b/src/screen_list.h @@ -37,6 +37,9 @@ extern const struct screen_functions screen_help; #ifdef ENABLE_SEARCH_SCREEN extern const struct screen_functions screen_search; #endif +#ifdef ENABLE_SONG_SCREEN +extern const struct screen_functions screen_song; +#endif #ifdef ENABLE_KEYDEF_SCREEN extern const struct screen_functions screen_keydef; #endif diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index b9896f1..1cb392f 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -248,7 +248,7 @@ lyrics_cmd(mpdclient_t *c, command_t cmd) return true; #ifdef ENABLE_SONG_SCREEN - case CMD_VIEW: + case CMD_SCREEN_SONG: if (current.song != NULL) { screen_song_switch(c, current.song); return true; diff --git a/src/screen_play.c b/src/screen_play.c index ceb37c4..4201fb8 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -702,7 +702,7 @@ play_cmd(mpdclient_t *c, command_t cmd) #endif #ifdef ENABLE_SONG_SCREEN - case CMD_VIEW: + case CMD_SCREEN_SONG: if (lw->selected < playlist_length(&c->playlist)) { screen_song_switch(c, playlist_get(&c->playlist, lw->selected)); return true; -- 2.30.2