Index: apps/gui/skin_engine/skin_parser.c =================================================================== --- apps/gui/skin_engine/skin_parser.c (revision 24192) +++ apps/gui/skin_engine/skin_parser.c (working copy) @@ -144,6 +144,8 @@ #ifdef HAVE_LCD_BITMAP static int parse_viewport_display(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); +static int parse_playlistview(const char *wps_bufptr, + struct wps_token *token, struct wps_data *wps_data); static int parse_viewport(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); static int parse_statusbar_enable(const char *wps_bufptr, @@ -354,6 +356,7 @@ { WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC, parse_viewport_display }, + { WPS_VIEWPORT_CUSTOMLIST, "Vp", WPS_REFRESH_STATIC, parse_playlistview }, { WPS_NO_TOKEN, "V", 0, parse_viewport }, #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) @@ -695,6 +698,22 @@ return 1; } +static int parse_playlistview(const char *wps_bufptr, + struct wps_token *token, struct wps_data *wps_data) +{ + /* %Vp|||line text */ + struct playlistviewer *viewer = skin_buffer_alloc(sizeof(struct playlistviewer)); + if (!viewer) + return WPS_ERROR_INVALID_PARAM; + viewer->vp = &curr_vp->vp; + viewer->show_icons = true; + viewer->start_offset = 1; + viewer->text = ""; + token->value.data = (void*)viewer; + + return 0; +} + static int parse_viewport(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data) Index: apps/gui/skin_engine/skin_display.c =================================================================== --- apps/gui/skin_engine/skin_display.c (revision 24192) +++ apps/gui/skin_engine/skin_display.c (working copy) @@ -34,6 +34,8 @@ #include "statusbar.h" #include "scrollbar.h" #include "screen_access.h" +#include "playlist.h" +#include "playback.h" #ifdef HAVE_LCD_BITMAP #include "peakmeter.h" @@ -162,7 +164,54 @@ cue_draw_markers(display, state->id3->cuesheet, length, pb->x, pb->x + pb->width, y+1, pb->height-2); } +bool audio_peek_track(struct mp3entry* id3, int offset); +static void draw_playlist_viewer_list(struct gui_wps *gwps, + struct playlistviewer *viewer) +{ + int lines = viewport_get_nb_lines(viewer->vp); + int line_height = font_get(viewer->vp->font)->height; + int cur_playlist_pos = playlist_get_display_index(); + int start_item = MAX(0, cur_playlist_pos + viewer->start_offset); + int i; + + struct mp3entry *pid3, id3; + char buf[MAX_PATH], timebuf[16]; + + + gwps->display->set_viewport(viewer->vp); + for(i=start_item; (i-start_item)length); + snprintf(buf, sizeof(buf), "%d: %s %s",i, pid3->title, timebuf); + } + else + { + snprintf(buf, sizeof(buf), "%d: %s", i, strrchr(playlist_peek(i-cur_playlist_pos), '/')); + } + + gwps->display->putsxy(0, (i-start_item)*line_height, buf ); + } +} + /* clears the area where the image was shown */ static void clear_image_pos(struct gui_wps *gwps, struct gui_img *img) { @@ -584,6 +633,9 @@ } } break; + case WPS_VIEWPORT_CUSTOMLIST: + draw_playlist_viewer_list(gwps, data->tokens[i].value.data); + break; default: { /* get the value of the tag and copy it to the buffer */ Index: apps/gui/skin_engine/skin_tokens.h =================================================================== --- apps/gui/skin_engine/skin_tokens.h (revision 24192) +++ apps/gui/skin_engine/skin_tokens.h (working copy) @@ -52,6 +52,7 @@ /* Viewport display */ WPS_VIEWPORT_ENABLE, + WPS_VIEWPORT_CUSTOMLIST, /* Battery */ TOKEN_MARKER_BATTERY, Index: apps/gui/skin_engine/wps_internals.h =================================================================== --- apps/gui/skin_engine/wps_internals.h (revision 24192) +++ apps/gui/skin_engine/wps_internals.h (working copy) @@ -224,7 +224,15 @@ }; #endif +struct playlistviewer { + struct viewport *vp; + bool show_icons; + int start_offset; + char *text; /* almost certainly need to change this */ +}; + + #ifdef HAVE_ALBUMART struct skin_albumart { /* Album art support */ Index: apps/playback.c =================================================================== --- apps/playback.c (revision 24192) +++ apps/playback.c (working copy) @@ -629,6 +629,23 @@ return NULL; } +bool audio_peek_track(struct mp3entry* id3, int offset) +{ + int next_idx; + int new_offset = ci.new_track + wps_offset + offset; + + if (!audio_have_tracks()) + return false; + next_idx = (track_ridx + new_offset) & MAX_TRACK_MASK; + + if (tracks[next_idx].id3_hid >= 0) + { + bufread(tracks[next_idx].id3_hid, sizeof(struct mp3entry), id3); + return true; + } + return false; +} + #ifdef HAVE_ALBUMART int playback_current_aa_hid(int slot) { Index: apps/playback.h =================================================================== --- apps/playback.h (revision 24192) +++ apps/playback.h (working copy) @@ -64,6 +64,7 @@ void audio_set_crossfade(int enable); #endif + enum { AUDIO_WANT_PLAYBACK = 0,