From 04e0d6c12c6ad878b551be79a7c83c8b1784e748 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Tue, 2 Mar 2010 08:47:45 +0000 Subject: 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 --- apps/gui/skin_engine/skin_display.c | 10 +++++++--- apps/gui/skin_engine/skin_parser.c | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index df200bec5f..2d47989aa2 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -122,6 +122,10 @@ static void draw_progressbar(struct gui_wps *gwps, struct progressbar *pb = wps_vp->pb; struct mp3entry *id3 = state->id3; 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) { @@ -151,19 +155,19 @@ static void draw_progressbar(struct gui_wps *gwps, length ? elapsed + state->ff_rewind_count : 0, HORIZONTAL); 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 ? elapsed + state->ff_rewind_count : 0, HORIZONTAL); #ifdef AB_REPEAT_ENABLE if ( ab_repeat_mode_enabled() && length != 0 ) ab_draw_markers(display, length, - pb->x, pb->x + pb->width, y, pb->height); + pb->x, pb->x + pb->width, y, height); #endif if (id3 && id3->cuesheet) 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); static void draw_playlist_viewer_list(struct gui_wps *gwps, diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index a81ae5ea1f..c4f8d1a8ca 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -1124,11 +1124,6 @@ static int parse_progressbar(const char *wps_bufptr, return WPS_ERROR_INVALID_PARAM; 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, * so count them... */ int line_num = -1; @@ -1187,7 +1182,18 @@ static int parse_progressbar(const char *wps_bufptr, pb->height = height; } 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 */ pb->y = y; -- cgit v1.2.3