From 6190a0d68d4979a9933c6007b69686a08ec4f457 Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Mon, 14 May 2007 17:34:52 +0000 Subject: [PATCH] Add an item to the WPS context menu to browse a currently playing cuesheet. The menu that appears allows changing tracks within the cuesheet. It was already reachable by selecting the right cuesheet file in the file browser, but this makes it easier to use (and should help users noticing that possibility because many seemed to ignore this viewer existed). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13388 a1c6a512-1295-4272-9138-f99709370657 --- apps/cuesheet.c | 2 +- apps/cuesheet.h | 5 ++++- apps/lang/english.lang | 14 ++++++++++++++ apps/onplay.c | 29 ++++++++++++++++++++++++++++- 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/apps/cuesheet.c b/apps/cuesheet.c index afd0ba1ea6..9bac3681f3 100644 --- a/apps/cuesheet.c +++ b/apps/cuesheet.c @@ -253,7 +253,7 @@ static char *list_get_name_cb(int selected_item, return buffer; } -static void browse_cuesheet(struct cuesheet *cue) +void browse_cuesheet(struct cuesheet *cue) { struct gui_synclist lists; int action; diff --git a/apps/cuesheet.h b/apps/cuesheet.h index ed1207f810..51e38605ca 100644 --- a/apps/cuesheet.h +++ b/apps/cuesheet.h @@ -66,7 +66,10 @@ bool parse_cuesheet(char *file, struct cuesheet *cue); /* reads a cuesheet to find the audio track associated to it */ bool get_trackname_from_cuesheet(char *filename, char *buf); -/* displays a cuesheet to the screen (it is stored in the plugin buffer) */ +/* display a cuesheet struct */ +void browse_cuesheet(struct cuesheet *cue); + +/* display a cuesheet file after parsing and loading it to the plugin buffer */ bool display_cuesheet_content(char* filename); /* finds the index of the current track played within a cuesheet */ diff --git a/apps/lang/english.lang b/apps/lang/english.lang index e8dcf4867d..502c9f8900 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -10806,3 +10806,17 @@ *: "Playlist Viewer Settings" + + id: LANG_BROWSE_CUESHEET + desc: + user: + + *: "Browse Cuesheet" + + + *: "Browse Cuesheet" + + + *: "Browse Cuesheet" + + diff --git a/apps/onplay.c b/apps/onplay.c index 244cd77987..ae25ae37d0 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -64,6 +64,7 @@ #ifdef HAVE_TAGCACHE #include "tagtree.h" #endif +#include "cuesheet.h" #if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) #include "backdrop.h" @@ -925,6 +926,32 @@ MENUITEM_FUNCTION_DYNTEXT(rating_item, 0, set_rating_inline, ratingitem_callback, Icon_Questionmark); #endif +static bool view_cue(void) +{ + struct mp3entry* id3 = audio_current_track(); + if(id3 && cuesheet_is_enabled() && id3->cuesheet_type) + { + browse_cuesheet(curr_cue); + } + return false; +} +static int view_cue_item_callback(int action,const struct menu_item_ex *this_item) +{ + (void)this_item; + struct mp3entry* id3 = audio_current_track(); + switch (action) + { + case ACTION_REQUEST_MENUITEM: + if (!selected_file || !cuesheet_is_enabled() + || !id3 || !id3->cuesheet_type) + return ACTION_EXIT_MENUITEM; + break; + } + return action; +} +MENUITEM_FUNCTION(view_cue_item, 0, ID2P(LANG_BROWSE_CUESHEET), + view_cue, NULL, view_cue_item_callback, Icon_NOICON); + /* CONTEXT_WPS items */ MENUITEM_FUNCTION(browse_id3_item, 0, ID2P(LANG_MENU_SHOW_ID3_INFO), browse_id3, NULL, NULL, Icon_NOICON); @@ -1038,7 +1065,7 @@ MAKE_ONPLAYMENU( wps_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE), #ifdef HAVE_TAGCACHE &rating_item, #endif - &bookmark_menu, &browse_id3_item, + &bookmark_menu, &browse_id3_item, &view_cue_item, #ifdef HAVE_PITCHSCREEN &pitch_screen_item, #endif