From 6479e4c95eafcdc13fc49bebe6dc24a8ea3b6d15 Mon Sep 17 00:00:00 2001 From: Ben Basha Date: Wed, 1 Feb 2006 15:34:25 +0000 Subject: WPS tag update for Progress Bar to allow resizing and screen placing git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8523 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 27 +++++++++++++++++++++++++-- apps/gui/gwps.h | 3 +++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index d6d765f418..ca839a9bfa 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -510,6 +510,26 @@ static char* get_tag(struct wps_data* wps_data, wps_data->full_line_progressbar=0; return buf; #else + char *p=strchr(tag, '|'); + if (p) { + wps_data->progress_height=atoi(++p); + p=strchr(p, '|'); + if (p) { + wps_data->progress_start=atoi(++p); + p=strchr(p, '|'); + if (p) + wps_data->progress_end=atoi(++p); + else + wps_data->progress_end=NULL; + }else { + wps_data->progress_start=0; + wps_data->progress_end=NULL; + } + }else { + wps_data->progress_height=6; + wps_data->progress_start=0; + wps_data->progress_end=NULL; + } return "\x01"; #endif case 'f': /* full-line progress bar */ @@ -1449,9 +1469,12 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, /* progress */ if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) { -#define PROGRESS_BAR_HEIGHT 6 /* this should probably be defined elsewhere; config-*.h perhaps? */ int sby = i*h + offset + (h > 7 ? (h - 6) / 2 : 1); - gui_scrollbar_draw(display, 0, sby, display->width, +#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, state->id3->length?state->id3->length:1, 0, state->id3->length?state->id3->elapsed + state->ff_rewind_count:0, diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 8cd4c8f63e..7cb1cde7eb 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h @@ -309,6 +309,9 @@ struct wps_data unsigned short time_mult[WPS_MAX_LINES][WPS_MAX_SUBLINES]; long subline_expire_time[WPS_MAX_LINES]; int curr_subline[WPS_MAX_LINES]; + int progress_height; + int progress_start; + int progress_end; bool wps_loaded; bool peak_meter_enabled; }; -- cgit v1.2.3