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.c77
1 files changed, 69 insertions, 8 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 53b568ad53..8e08343d82 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -129,7 +129,10 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
129 struct wps_state *state = gwps->state; 129 struct wps_state *state = gwps->state;
130 struct mp3entry *id3 = state->id3; 130 struct mp3entry *id3 = state->id3;
131 int y = pb->y, height = pb->height; 131 int y = pb->y, height = pb->height;
132 unsigned long length, elapsed; 132 unsigned long length, end;
133 int flags = HORIZONTAL;
134
135 int drawn_length, drawn_end;
133 136
134 if (height < 0) 137 if (height < 0)
135 height = font_get(vp->font)->height; 138 height = font_get(vp->font)->height;
@@ -148,39 +151,62 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
148 int minvol = sound_min(SOUND_VOLUME); 151 int minvol = sound_min(SOUND_VOLUME);
149 int maxvol = sound_max(SOUND_VOLUME); 152 int maxvol = sound_max(SOUND_VOLUME);
150 length = maxvol-minvol; 153 length = maxvol-minvol;
151 elapsed = global_settings.volume-minvol; 154 end = global_settings.volume-minvol;
152 } 155 }
153 else if (pb->type == SKIN_TOKEN_BATTERY_PERCENTBAR) 156 else if (pb->type == SKIN_TOKEN_BATTERY_PERCENTBAR)
154 { 157 {
155 length = 100; 158 length = 100;
156 elapsed = battery_level(); 159 end = battery_level();
157 } 160 }
158#if CONFIG_TUNER 161#if CONFIG_TUNER
159 else if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF)) 162 else if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF))
160 { 163 {
161 int min = fm_region_data[global_settings.fm_region].freq_min; 164 int min = fm_region_data[global_settings.fm_region].freq_min;
162 elapsed = radio_current_frequency() - min; 165 end = radio_current_frequency() - min;
163 length = fm_region_data[global_settings.fm_region].freq_max - min; 166 length = fm_region_data[global_settings.fm_region].freq_max - min;
164 } 167 }
165#endif 168#endif
166 else if (id3 && id3->length) 169 else if (id3 && id3->length)
167 { 170 {
168 length = id3->length; 171 length = id3->length;
169 elapsed = id3->elapsed + state->ff_rewind_count; 172 end = id3->elapsed + state->ff_rewind_count;
170 } 173 }
171 else 174 else
172 { 175 {
173 length = 1; 176 length = 1;
174 elapsed = 0; 177 end = 0;
178 }
179
180 if (pb->nofill)
181 {
182 drawn_length = 1;
183 drawn_end = 0;
184 }
185 else
186 {
187 drawn_length = length;
188 drawn_end = end;
189 }
190
191 if (!pb->horizontal)
192 {
193 /* we want to fill upwards which is technically inverted. */
194 flags = VERTICAL|INVERTFILL;
195 }
196
197 if (pb->invert_fill_direction)
198 {
199 flags ^= INVERTFILL;
175 } 200 }
176 201
202
177 if (pb->have_bitmap_pb) 203 if (pb->have_bitmap_pb)
178 gui_bitmap_scrollbar_draw(display, &pb->bm, 204 gui_bitmap_scrollbar_draw(display, &pb->bm,
179 pb->x, y, pb->width, pb->bm.height, 205 pb->x, y, pb->width, pb->bm.height,
180 length, 0, elapsed, HORIZONTAL); 206 drawn_length, 0, drawn_end, flags);
181 else 207 else
182 gui_scrollbar_draw(display, pb->x, y, pb->width, height, 208 gui_scrollbar_draw(display, pb->x, y, pb->width, height,
183 length, 0, elapsed, HORIZONTAL); 209 drawn_length, 0, drawn_end, flags);
184 210
185 if (pb->type == SKIN_TOKEN_PROGRESSBAR) 211 if (pb->type == SKIN_TOKEN_PROGRESSBAR)
186 { 212 {
@@ -203,6 +229,41 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
203 } 229 }
204#endif 230#endif
205 } 231 }
232
233 if (pb->slider)
234 {
235 int x = pb->x, y = pb->y;
236 int width = pb->width;
237 int height = pb->height;
238 struct gui_img *img = pb->slider;
239
240 if (flags&VERTICAL)
241 {
242 y += pb->height*end/length;
243 height = img->bm.height;
244 }
245 else
246 {
247 x += pb->width*end/length;
248 width = img->bm.width;
249 }
250#if LCD_DEPTH > 1
251 if(img->bm.format == FORMAT_MONO) {
252#endif
253 display->mono_bitmap_part(img->bm.data,
254 0, 0,
255 img->bm.width, x,
256 y, width, height);
257#if LCD_DEPTH > 1
258 } else {
259 display->transparent_bitmap_part((fb_data *)img->bm.data,
260 0, 0,
261 STRIDE(display->screen_type,
262 img->bm.width, img->bm.height),
263 x, y, width, height);
264 }
265#endif
266 }
206} 267}
207 268
208/* clears the area where the image was shown */ 269/* clears the area where the image was shown */