summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine/skin_display.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/skin_engine/skin_display.c')
-rw-r--r--apps/gui/skin_engine/skin_display.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 845ea18608..de070d830f 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -26,6 +26,7 @@
26#include "font.h" 26#include "font.h"
27#include "system.h" 27#include "system.h"
28#include "rbunicode.h" 28#include "rbunicode.h"
29#include "sound.h"
29#ifdef DEBUG 30#ifdef DEBUG
30#include "debug.h" 31#include "debug.h"
31#endif 32#endif
@@ -115,28 +116,35 @@ void skin_statusbar_changed(struct gui_wps *skin)
115} 116}
116 117
117static void draw_progressbar(struct gui_wps *gwps, 118static void draw_progressbar(struct gui_wps *gwps,
118 struct skin_viewport *wps_vp) 119 struct progressbar *pb)
119{ 120{
120 struct screen *display = gwps->display; 121 struct screen *display = gwps->display;
122 struct viewport *vp = pb->vp;
121 struct wps_state *state = gwps->state; 123 struct wps_state *state = gwps->state;
122 struct progressbar *pb = wps_vp->pb;
123 struct mp3entry *id3 = state->id3; 124 struct mp3entry *id3 = state->id3;
124 int y = pb->y, height = pb->height; 125 int y = pb->y, height = pb->height;
125 unsigned long length, elapsed; 126 unsigned long length, elapsed;
126 127
127 if (height < 0) 128 if (height < 0)
128 height = font_get(wps_vp->vp.font)->height; 129 height = font_get(vp->font)->height;
129 130
130 if (y < 0) 131 if (y < 0)
131 { 132 {
132 int line_height = font_get(wps_vp->vp.font)->height; 133 int line_height = font_get(vp->font)->height;
133 /* center the pb in the line, but only if the line is higher than the pb */ 134 /* center the pb in the line, but only if the line is higher than the pb */
134 int center = (line_height-height)/2; 135 int center = (line_height-height)/2;
135 /* if Y was not set calculate by font height,Y is -line_number-1 */ 136 /* if Y was not set calculate by font height,Y is -line_number-1 */
136 y = (-y -1)*line_height + (0 > center ? 0 : center); 137 y = (-y -1)*line_height + (0 > center ? 0 : center);
137 } 138 }
138 139
139 if (id3 && id3->length) 140 if (pb->type == WPS_TOKEN_VOLUMEBAR)
141 {
142 int minvol = sound_min(SOUND_VOLUME);
143 int maxvol = sound_max(SOUND_VOLUME);
144 length = maxvol-minvol;
145 elapsed = global_settings.volume-minvol;
146 }
147 else if (id3 && id3->length)
140 { 148 {
141 length = id3->length; 149 length = id3->length;
142 elapsed = id3->elapsed + state->ff_rewind_count; 150 elapsed = id3->elapsed + state->ff_rewind_count;
@@ -155,7 +163,7 @@ static void draw_progressbar(struct gui_wps *gwps,
155 gui_scrollbar_draw(display, pb->x, y, pb->width, height, 163 gui_scrollbar_draw(display, pb->x, y, pb->width, height,
156 length, 0, elapsed, HORIZONTAL); 164 length, 0, elapsed, HORIZONTAL);
157 165
158 if (id3 && id3->length) 166 if (pb->type == WPS_TOKEN_PROGRESSBAR && id3 && id3->length)
159 { 167 {
160#ifdef AB_REPEAT_ENABLE 168#ifdef AB_REPEAT_ENABLE
161 if (ab_repeat_mode_enabled()) 169 if (ab_repeat_mode_enabled())
@@ -1248,9 +1256,15 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
1248 /* progressbar */ 1256 /* progressbar */
1249 if (vp_refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) 1257 if (vp_refresh_mode & WPS_REFRESH_PLAYER_PROGRESS)
1250 { 1258 {
1251 if (skin_viewport->pb) 1259 struct skin_token_list *bar = gwps->data->progressbars;
1260 while (bar)
1252 { 1261 {
1253 draw_progressbar(gwps, skin_viewport); 1262 struct progressbar *thisbar = (struct progressbar*)bar->token->value.data;
1263 if (thisbar->vp == &skin_viewport->vp)
1264 {
1265 draw_progressbar(gwps, thisbar);
1266 }
1267 bar = bar->next;
1254 } 1268 }
1255 } 1269 }
1256 /* Now display any images in this viewport */ 1270 /* Now display any images in this viewport */