Fix a bug in playlist viewer's list handling, causing superfluous redraws and

potentially leading to the wrong track being selected.

The playlist viewer should perform a bit better now.
I always felt it was slower than the otehr lists.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28131 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2010-09-20 23:10:19 +00:00
parent 1c80a1f2f0
commit aa01ee314e

View file

@ -653,18 +653,21 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename)
/* Timeout so we can determine if play status has changed */
button = get_action(CONTEXT_TREE,HZ/2);
if( (gui_synclist_do_button(&playlist_lists, &button,LIST_WRAP_UNLESS_HELD)) )
bool res = gui_synclist_do_button(&playlist_lists,
&button,
LIST_WRAP_UNLESS_HELD);
viewer.selected_track=gui_synclist_get_sel_pos(&playlist_lists);
if (res)
{
viewer.selected_track=gui_synclist_get_sel_pos(&playlist_lists);
if(playlist_buffer_needs_reload(&viewer.buffer,
viewer.selected_track))
bool reload = playlist_buffer_needs_reload(&viewer.buffer,
viewer.selected_track);
if(reload)
{
playlist_buffer_load_entries_screen(&viewer.buffer,
button==ACTION_STD_NEXT?
FORWARD
:
BACKWARD
);
gui_synclist_draw(&playlist_lists);
button == ACTION_STD_NEXT ? FORWARD : BACKWARD);
gui_synclist_draw(&playlist_lists);
}
}
switch (button)
{
@ -686,8 +689,9 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename)
case ACTION_STD_OK:
{
struct playlist_entry * current_track =
playlist_buffer_get_track(&viewer.buffer,
viewer.selected_track);
playlist_buffer_get_track(&viewer.buffer,
viewer.selected_track);
if (viewer.moving_track >= 0)
{
/* Move track */
@ -847,10 +851,11 @@ bool search_playlist(void)
break;
case ACTION_STD_OK:
playlist_start(
found_indicies[gui_synclist_get_sel_pos(&playlist_lists)]
,0);
{
int sel = gui_synclist_get_sel_pos(&playlist_lists);
playlist_start(found_indicies[sel] ,0);
exit = 1;
}
break;
default: