1
0
Fork 0
forked from len0rd/rockbox

Small progressbar fixes: Fix vertical positioning (when using non-default height). Add some checks for a reasonable size, as bad values can cause problems. Some code cleanup.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8611 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Magnus Holmgren 2006-02-07 20:22:47 +00:00
parent 8f369c2d22
commit 566ce5f951

View file

@ -576,15 +576,20 @@ static char* get_tag(struct wps_data* wps_data,
if (p)
wps_data->progress_end=atoi(++p);
else
wps_data->progress_end=NULL;
wps_data->progress_end=0;
}else {
wps_data->progress_start=0;
wps_data->progress_end=NULL;
wps_data->progress_end=0;
}
if (wps_data->progress_height<3)
wps_data->progress_height=3;
if (wps_data->progress_end<wps_data->progress_start+3)
wps_data->progress_end=0;
}else {
wps_data->progress_height=6;
wps_data->progress_start=0;
wps_data->progress_end=NULL;
wps_data->progress_end=0;
}
return "\x01";
#endif
@ -1525,20 +1530,22 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
/* progress */
if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS)
{
int sby = i*h + offset + (h > 7 ? (h - 6) / 2 : 1);
#define PROGRESS_BAR_HEIGHT gwps->data->progress_height /* this should probably be defined elsewhere; config-*.h perhaps? */
if (!gwps->data->progress_end)
gwps->data->progress_end=gwps->display->width;
gui_scrollbar_draw(display, gwps->data->progress_start, sby,
gwps->data->progress_end-gwps->data->progress_start,
PROGRESS_BAR_HEIGHT,
int sb_y = i*h + offset + ((h > data->progress_height + 1)
? (h - data->progress_height) / 2 : 1);
if (!data->progress_end)
data->progress_end=display->width;
gui_scrollbar_draw(display, data->progress_start, sb_y,
data->progress_end-data->progress_start,
data->progress_height,
state->id3->length?state->id3->length:1, 0,
state->id3->length?state->id3->elapsed + state->ff_rewind_count:0,
HORIZONTAL);
#ifdef AB_REPEAT_ENABLE
if ( ab_repeat_mode_enabled() )
ab_draw_markers(display, state->id3->length, 0, sby,
PROGRESS_BAR_HEIGHT);
ab_draw_markers(display, state->id3->length, 0, sb_y,
data->progress_height);
#endif
update_line = true;
}