1
0
Fork 0
forked from len0rd/rockbox

fix %pb when the height isnt given and it is in a viewport with a user font (so the height is calculated on the font height at display time)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24991 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-03-02 08:47:45 +00:00
parent 3f09d7eed1
commit 04e0d6c12c
2 changed files with 19 additions and 9 deletions

View file

@ -122,6 +122,10 @@ static void draw_progressbar(struct gui_wps *gwps,
struct progressbar *pb = wps_vp->pb; struct progressbar *pb = wps_vp->pb;
struct mp3entry *id3 = state->id3; struct mp3entry *id3 = state->id3;
int y = pb->y; int y = pb->y;
int height = pb->height;
if (pb->height < 0 && !pb->have_bitmap_pb)
height = font_get(wps_vp->vp.font)->height;
if (y < 0) if (y < 0)
{ {
@ -151,19 +155,19 @@ static void draw_progressbar(struct gui_wps *gwps,
length ? elapsed + state->ff_rewind_count : 0, length ? elapsed + state->ff_rewind_count : 0,
HORIZONTAL); HORIZONTAL);
else else
gui_scrollbar_draw(display, pb->x, y, pb->width, pb->height, gui_scrollbar_draw(display, pb->x, y, pb->width, height,
length ? length : 1, 0, length ? length : 1, 0,
length ? elapsed + state->ff_rewind_count : 0, length ? elapsed + state->ff_rewind_count : 0,
HORIZONTAL); HORIZONTAL);
#ifdef AB_REPEAT_ENABLE #ifdef AB_REPEAT_ENABLE
if ( ab_repeat_mode_enabled() && length != 0 ) if ( ab_repeat_mode_enabled() && length != 0 )
ab_draw_markers(display, length, ab_draw_markers(display, length,
pb->x, pb->x + pb->width, y, pb->height); pb->x, pb->x + pb->width, y, height);
#endif #endif
if (id3 && id3->cuesheet) if (id3 && id3->cuesheet)
cue_draw_markers(display, state->id3->cuesheet, length, cue_draw_markers(display, state->id3->cuesheet, length,
pb->x, pb->x + pb->width, y+1, pb->height-2); pb->x, pb->x + pb->width, y+1, height-2);
} }
bool audio_peek_track(struct mp3entry* id3, int offset); bool audio_peek_track(struct mp3entry* id3, int offset);
static void draw_playlist_viewer_list(struct gui_wps *gwps, static void draw_playlist_viewer_list(struct gui_wps *gwps,

View file

@ -1124,11 +1124,6 @@ static int parse_progressbar(const char *wps_bufptr,
return WPS_ERROR_INVALID_PARAM; return WPS_ERROR_INVALID_PARAM;
struct viewport *vp = &curr_vp->vp; struct viewport *vp = &curr_vp->vp;
#ifndef __PCTOOL__
int font_height = font_get(vp->font)->height;
#else
int font_height = 8;
#endif
/* we need to know what line number (viewport relative) this pb is, /* we need to know what line number (viewport relative) this pb is,
* so count them... */ * so count them... */
int line_num = -1; int line_num = -1;
@ -1187,7 +1182,18 @@ static int parse_progressbar(const char *wps_bufptr,
pb->height = height; pb->height = height;
} }
else else
pb->height = font_height; {
if (vp->font > FONT_UI)
pb->height = -1; /* calculate at display time */
else
{
#ifndef __PCTOOL__
pb->height = font_get(vp->font)->height;
#else
pb->height = 8;
#endif
}
}
if (LIST_VALUE_PARSED(set, PB_Y)) /* y */ if (LIST_VALUE_PARSED(set, PB_Y)) /* y */
pb->y = y; pb->y = y;