Index: apps/gui/skin_engine/skin_parser.c
===================================================================
--- apps/gui/skin_engine/skin_parser.c (revision 25508)
+++ apps/gui/skin_engine/skin_parser.c (working copy)
@@ -322,7 +322,8 @@
{ WPS_TOKEN_PROGRESSBAR, "pb", WPS_REFRESH_PLAYER_PROGRESS,
parse_progressbar },
- { WPS_TOKEN_VOLUME, "pv", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_VOLUME, "pv", WPS_REFRESH_DYNAMIC,
+ parse_progressbar },
{ WPS_TOKEN_TRACK_ELAPSED_PERCENT, "px", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_TRACK_TIME_ELAPSED, "pc", WPS_REFRESH_DYNAMIC, NULL },
@@ -900,7 +901,6 @@
/* %Vl|<label>|<rest of tags>| */
skin_vp->hidden_flags = 0;
skin_vp->label = VP_NO_LABEL;
- skin_vp->pb = NULL;
skin_vp->lines = NULL;
if (curr_line)
{
@@ -1118,7 +1118,7 @@
return skip;
}
-
+
static int parse_progressbar(const char *wps_bufptr,
struct wps_token *token,
struct wps_data *wps_data)
@@ -1153,6 +1153,7 @@
line_num++;
line = line->next;
}
+ pb->vp = vp;
pb->have_bitmap_pb = false;
pb->bm.data = NULL; /* no bitmap specified */
pb->follow_lang_direction = follow_lang_direction > 0;
@@ -1163,8 +1164,8 @@
pb->width = vp->width;
pb->height = SYSFONT_HEIGHT-2;
pb->y = -line_num - 1; /* Will be computed during the rendering */
-
- curr_vp->pb = pb;
+ if (token->type == WPS_TOKEN_VOLUME)
+ return 0; /* dont add it, let the regular token handling do the work */
add_to_ll_chain(&wps_data->progressbars, item);
return 0;
}
@@ -1220,9 +1221,10 @@
else
pb->y = -line_num - 1; /* Will be computed during the rendering */
- curr_vp->pb = pb;
add_to_ll_chain(&wps_data->progressbars, item);
-
+ if (token->type == WPS_TOKEN_VOLUME)
+ token->type = WPS_TOKEN_VOLUMEBAR;
+ pb->type = token->type;
/* Skip the rest of the line */
return skip_end_of_line(wps_bufptr)-1;
#else
@@ -2205,7 +2207,6 @@
/* Initialise the first (default) viewport */
curr_vp->label = VP_DEFAULT_LABEL;
- curr_vp->pb = NULL;
curr_vp->hidden_flags = 0;
curr_vp->lines = NULL;
Index: apps/gui/skin_engine/skin_display.c
===================================================================
--- apps/gui/skin_engine/skin_display.c (revision 25508)
+++ apps/gui/skin_engine/skin_display.c (working copy)
@@ -26,6 +26,7 @@
#include "font.h"
#include "system.h"
#include "rbunicode.h"
+#include "sound.h"
#ifdef DEBUG
#include "debug.h"
#endif
@@ -115,29 +116,35 @@
}
static void draw_progressbar(struct gui_wps *gwps,
- struct skin_viewport *wps_vp)
+ struct progressbar *pb)
{
struct screen *display = gwps->display;
+ struct viewport *vp = pb->vp;
struct wps_state *state = gwps->state;
- struct progressbar *pb = wps_vp->pb;
struct mp3entry *id3 = state->id3;
int y = pb->y, height = pb->height;
unsigned long length, elapsed;
if (height < 0)
- height = font_get(wps_vp->vp.font)->height;
+ height = font_get(vp->font)->height;
if (y < 0)
{
- int line_height = font_get(wps_vp->vp.font)->height;
+ int line_height = font_get(vp->font)->height;
/* center the pb in the line, but only if the line is higher than the pb */
int center = (line_height-height)/2;
/* if Y was not set calculate by font height,Y is -line_number-1 */
y = (-y -1)*line_height + (0 > center ? 0 : center);
}
- if (id3 && id3->length)
+ if (pb->type == WPS_TOKEN_VOLUMEBAR)
{
+ int minvol = sound_min(SOUND_VOLUME);
+ length = -minvol;
+ elapsed = global_settings.volume > 0 ? length : global_settings.volume-minvol;
+ }
+ else if (id3 && id3->length)
+ {
length = id3->length;
elapsed = id3->elapsed + state->ff_rewind_count;
}
@@ -155,7 +162,7 @@
gui_scrollbar_draw(display, pb->x, y, pb->width, height,
length, 0, elapsed, HORIZONTAL);
- if (id3 && id3->length)
+ if (pb->type == WPS_TOKEN_PROGRESSBAR && id3 && id3->length)
{
#ifdef AB_REPEAT_ENABLE
if (ab_repeat_mode_enabled())
@@ -1248,9 +1255,15 @@
/* progressbar */
if (vp_refresh_mode & WPS_REFRESH_PLAYER_PROGRESS)
{
- if (skin_viewport->pb)
+ struct skin_token_list *bar = gwps->data->progressbars;
+ while (bar)
{
- draw_progressbar(gwps, skin_viewport);
+ struct progressbar *thisbar = (struct progressbar*)bar->token->value.data;
+ if (thisbar->vp == &skin_viewport->vp)
+ {
+ draw_progressbar(gwps, thisbar);
+ }
+ bar = bar->next;
}
}
/* Now display any images in this viewport */
Index: apps/gui/skin_engine/skin_tokens.h
===================================================================
--- apps/gui/skin_engine/skin_tokens.h (revision 25508)
+++ apps/gui/skin_engine/skin_tokens.h (working copy)
@@ -202,6 +202,7 @@
#endif
/* Volume level */
WPS_TOKEN_VOLUME,
+ WPS_TOKEN_VOLUMEBAR,
/* hold */
WPS_TOKEN_MAIN_HOLD,
#ifdef HAS_REMOTE_BUTTON_HOLD
Index: apps/gui/skin_engine/wps_internals.h
===================================================================
--- apps/gui/skin_engine/wps_internals.h (revision 25508)
+++ apps/gui/skin_engine/wps_internals.h (working copy)
@@ -91,6 +91,8 @@
struct progressbar {
+ enum wps_token_type type;
+ struct viewport *vp;
/* regular pb */
short x;
/* >=0: explicitly set in the tag -> y-coord within the viewport
@@ -202,7 +204,6 @@
#define VP_INFO_LABEL '_'
struct skin_viewport {
struct viewport vp; /* The LCD viewport struct */
- struct progressbar *pb;
struct skin_line *lines;
char hidden_flags;
char label;