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