summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-03-23 03:08:56 +0000
committerThomas Martitz <kugel@rockbox.org>2009-03-23 03:08:56 +0000
commitced2724f7d513ea19ab7a0eb0a17647b81b08e4e (patch)
tree88193782f42f971950e321a331f2387757affccb
parenta3cbb57b098e627e6a87a837b2c1c749b7c50121 (diff)
downloadrockbox-ced2724f7d513ea19ab7a0eb0a17647b81b08e4e.tar.gz
rockbox-ced2724f7d513ea19ab7a0eb0a17647b81b08e4e.zip
Another wps rework:
*rename gui_wps_refresh() to gui_wps_redraw() and update() to gui_wps_update() to better describe what they do *Clear things up and differentiate better between gui_wps_redraw()/gui_wps_display()/gui_wps_update() (it wasn't so what they're supposed to do before) *cleanup gui_wps_display() and gui_wps_update() quite a bit *Remove unused/unneeded code, do some pointer copying to save binsize, and code cleanup at several places Visible changes should be small git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20483 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c228
-rw-r--r--apps/gui/gwps-common.h19
-rw-r--r--apps/gui/gwps.c32
-rw-r--r--apps/gui/gwps.h14
4 files changed, 133 insertions, 160 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 005fefd0fb..198d62d891 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -74,8 +74,6 @@
74#define TIMEOUT_UNIT (HZ/10) /* I.e. 0.1 sec */ 74#define TIMEOUT_UNIT (HZ/10) /* I.e. 0.1 sec */
75#define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */ 75#define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */
76 76
77
78/* fades the volume */
79bool wps_fading_out = false; 77bool wps_fading_out = false;
80void fade(bool fade_in, bool updatewps) 78void fade(bool fade_in, bool updatewps)
81{ 79{
@@ -100,7 +98,7 @@ void fade(bool fade_in, bool updatewps)
100 if (updatewps) 98 if (updatewps)
101 { 99 {
102 FOR_NB_SCREENS(i) 100 FOR_NB_SCREENS(i)
103 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC); 101 gui_wps_redraw(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
104 } 102 }
105 sleep(1); 103 sleep(1);
106 } 104 }
@@ -116,7 +114,7 @@ void fade(bool fade_in, bool updatewps)
116 if (updatewps) 114 if (updatewps)
117 { 115 {
118 FOR_NB_SCREENS(i) 116 FOR_NB_SCREENS(i)
119 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC); 117 gui_wps_redraw(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
120 } 118 }
121 sleep(1); 119 sleep(1);
122 } 120 }
@@ -135,12 +133,9 @@ void fade(bool fade_in, bool updatewps)
135 } 133 }
136} 134}
137 135
138/* return true if screen restore is needed
139 return false otherwise
140*/
141bool update_onvol_change(struct gui_wps * gwps) 136bool update_onvol_change(struct gui_wps * gwps)
142{ 137{
143 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); 138 gui_wps_redraw(gwps, 0, WPS_REFRESH_NON_STATIC);
144 139
145#ifdef HAVE_LCD_CHARCELLS 140#ifdef HAVE_LCD_CHARCELLS
146 splashf(0, "Vol: %3d dB", 141 splashf(0, "Vol: %3d dB",
@@ -240,7 +235,7 @@ bool ffwd_rew(int button)
240 } 235 }
241 236
242 FOR_NB_SCREENS(i) 237 FOR_NB_SCREENS(i)
243 gui_wps_refresh(&gui_wps[i], 238 gui_wps_redraw(&gui_wps[i],
244 (wps_state.wps_time_countup == false)? 239 (wps_state.wps_time_countup == false)?
245 ff_rewind_count:-ff_rewind_count, 240 ff_rewind_count:-ff_rewind_count,
246 WPS_REFRESH_PLAYER_PROGRESS | 241 WPS_REFRESH_PLAYER_PROGRESS |
@@ -259,7 +254,8 @@ bool ffwd_rew(int button)
259 audio_resume(); 254 audio_resume();
260#endif 255#endif
261#ifdef HAVE_LCD_CHARCELLS 256#ifdef HAVE_LCD_CHARCELLS
262 gui_wps_display(); 257 FOR_NB_SCREENS(i)
258 gui_wps_redraw(gwps,0, WPS_REFRESH_ALL);
263#endif 259#endif
264 exit = true; 260 exit = true;
265 break; 261 break;
@@ -278,145 +274,125 @@ bool ffwd_rew(int button)
278 return usb; 274 return usb;
279} 275}
280 276
281bool gui_wps_display(void) 277bool gui_wps_display(struct gui_wps *gwps)
282{ 278{
283 int i; 279 struct screen *display = gwps->display;
284 if (!wps_state.id3 && !(audio_status() & AUDIO_STATUS_PLAY)) 280 struct wps_data *data = gwps->data;
281 int screen = display->screen_type;
282
283 /* Update the values in the first (default) viewport - in case the user
284 has modified the statusbar or colour settings */
285#if LCD_DEPTH > 1
286 if (display->depth > 1)
285 { 287 {
286 global_status.resume_index = -1; 288 data->viewports[0].vp.fg_pattern = display->get_foreground();
287 splash(HZ, ID2P(LANG_END_PLAYLIST)); 289 data->viewports[0].vp.bg_pattern = display->get_background();
288 return true;
289 } 290 }
290 else
291 {
292 FOR_NB_SCREENS(i)
293 {
294 /* Update the values in the first (default) viewport - in case the user
295 has modified the statusbar or colour settings */
296#ifdef HAVE_LCD_BITMAP
297#if LCD_DEPTH > 1
298 if (gui_wps[i].display->depth > 1)
299 {
300 gui_wps[i].data->viewports[0].vp.fg_pattern = gui_wps[i].display->get_foreground();
301 gui_wps[i].data->viewports[0].vp.bg_pattern = gui_wps[i].display->get_background();
302 }
303#endif 291#endif
304#endif 292 display->clear_display();
305 gui_wps[i].display->clear_display(); 293 if (!data->wps_loaded) {
306 if (!gui_wps[i].data->wps_loaded) { 294 if ( !data->num_tokens ) {
307 if ( !gui_wps[i].data->num_tokens ) { 295 /* set the default wps for the main-screen */
308 /* set the default wps for the main-screen */ 296 if(screen == SCREEN_MAIN)
309 if(i == 0) 297 {
310 {
311#ifdef HAVE_LCD_BITMAP
312#if LCD_DEPTH > 1 298#if LCD_DEPTH > 1
313 unload_wps_backdrop(); 299 unload_wps_backdrop();
314#endif 300#endif
315 wps_data_load(gui_wps[i].data, 301 wps_data_load(data,
316 gui_wps[i].display, 302 display,
317 "%s%?it<%?in<%in. |>%it|%fn>\n" 303#ifdef HAVE_LCD_BITMAP
318 "%s%?ia<%ia|%?d2<%d2|(root)>>\n" 304 "%s%?it<%?in<%in. |>%it|%fn>\n"
319 "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n" 305 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
320 "\n" 306 "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n"
321 "%al%pc/%pt%ar[%pp:%pe]\n" 307 "\n"
322 "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n" 308 "%al%pc/%pt%ar[%pp:%pe]\n"
323 "%pb\n" 309 "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
324 "%pm\n", false); 310 "%pb\n"
311 "%pm\n", false);
325#else 312#else
326 wps_data_load(gui_wps[i].data, 313 "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
327 gui_wps[i].display, 314 "%pc%?ps<*|/>%pt\n", false);
328 "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
329 "%pc%?ps<*|/>%pt\n", false);
330#endif 315#endif
331 } 316 }
332#if NB_SCREENS == 2 317#ifdef HAVE_REMOTE_LCD
333 /* set the default wps for the remote-screen */ 318 /* set the default wps for the remote-screen */
334 else if(i == 1) 319 else if(screen == SCREEN_REMOTE)
335 { 320 {
336#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 321#if LCD_REMOTE_DEPTH > 1
337 unload_remote_wps_backdrop(); 322 unload_remote_wps_backdrop();
338#endif 323#endif
339 wps_data_load(gui_wps[i].data, 324 wps_data_load(data,
340 gui_wps[i].display, 325 display,
341 "%s%?ia<%ia|%?d2<%d2|(root)>>\n" 326 "%s%?ia<%ia|%?d2<%d2|(root)>>\n"
342 "%s%?it<%?in<%in. |>%it|%fn>\n" 327 "%s%?it<%?in<%in. |>%it|%fn>\n"
343 "%al%pc/%pt%ar[%pp:%pe]\n" 328 "%al%pc/%pt%ar[%pp:%pe]\n"
344 "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n" 329 "%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
345 "%pb\n", false); 330 "%pb\n", false);
346 } 331 }
347#endif 332#endif
348 }
349 }
350 } 333 }
351 } 334 }
352 yield(); 335 else
353 FOR_NB_SCREENS(i)
354 { 336 {
355 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL); 337#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
338 if (screen == SCREEN_REMOTE)
339 show_remote_wps_backdrop();
340 else if (screen == SCREEN_MAIN)
341#endif
342#if LCD_DEPTH > 1
343 show_wps_backdrop();
344#endif
356 } 345 }
357 return false; 346 return gui_wps_redraw(gwps, 0, WPS_REFRESH_ALL);
358} 347}
359 348
360bool update(struct gui_wps *gwps) 349bool gui_wps_update(struct gui_wps *gwps)
361{ 350{
362 bool track_changed = audio_has_changed_track(); 351 bool track_changed = audio_has_changed_track();
363 bool retcode = false; 352 struct mp3entry *id3 = gwps->state->id3;
364 353
365 gwps->state->nid3 = audio_next_track(); 354 gwps->state->nid3 = audio_next_track();
366 if (track_changed) 355 if (track_changed)
367 { 356 {
368 gwps->display->stop_scroll(); 357 gwps->state->id3 = id3 = audio_current_track();
369 gwps->state->id3 = audio_current_track();
370 358
371 if (cuesheet_is_enabled() && gwps->state->id3->cuesheet_type 359 if (cuesheet_is_enabled() && id3->cuesheet_type
372 && strcmp(gwps->state->id3->path, curr_cue->audio_filename)) 360 && strcmp(id3->path, curr_cue->audio_filename))
373 { 361 {
374 /* the current cuesheet isn't the right one any more */ 362 /* the current cuesheet isn't the right one any more */
375 /* We need to parse the new cuesheet */ 363 /* We need to parse the new cuesheet */
376 364
377 char cuepath[MAX_PATH]; 365 char cuepath[MAX_PATH];
378 366
379 if (look_for_cuesheet_file(gwps->state->id3->path, cuepath) && 367 if (look_for_cuesheet_file(id3->path, cuepath) &&
380 parse_cuesheet(cuepath, curr_cue)) 368 parse_cuesheet(cuepath, curr_cue))
381 { 369 {
382 gwps->state->id3->cuesheet_type = 1; 370 id3->cuesheet_type = 1;
383 strcpy(curr_cue->audio_filename, gwps->state->id3->path); 371 strcpy(curr_cue->audio_filename, id3->path);
384 } 372 }
385 373
386 cue_spoof_id3(curr_cue, gwps->state->id3); 374 cue_spoof_id3(curr_cue, id3);
387 }
388
389 if (gui_wps_display())
390 retcode = true;
391 else{
392 gui_wps_refresh(gwps, 0, WPS_REFRESH_ALL);
393 } 375 }
394 } 376 }
395 377
396 if (gwps->state->id3) 378 if (cuesheet_is_enabled() && id3->cuesheet_type
379 && (id3->elapsed < curr_cue->curr_track->offset
380 || (curr_cue->curr_track_idx < curr_cue->track_count - 1
381 && id3->elapsed >= (curr_cue->curr_track+1)->offset)))
397 { 382 {
398 if (cuesheet_is_enabled() && gwps->state->id3->cuesheet_type 383 /* We've changed tracks within the cuesheet :
399 && (gwps->state->id3->elapsed < curr_cue->curr_track->offset 384 we need to update the ID3 info and refresh the WPS */
400 || (curr_cue->curr_track_idx < curr_cue->track_count - 1
401 && gwps->state->id3->elapsed >= (curr_cue->curr_track+1)->offset)))
402 {
403 /* We've changed tracks within the cuesheet :
404 we need to update the ID3 info and refresh the WPS */
405
406 cue_find_current_track(curr_cue, gwps->state->id3->elapsed);
407 cue_spoof_id3(curr_cue, gwps->state->id3);
408 385
409 gwps->display->stop_scroll(); 386 track_changed = true;
410 if (gui_wps_display()) 387 cue_find_current_track(curr_cue, id3->elapsed);
411 retcode = true; 388 cue_spoof_id3(curr_cue, id3);
412 else
413 gui_wps_refresh(gwps, 0, WPS_REFRESH_ALL);
414 }
415 else
416 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC);
417 } 389 }
418 390
419 return retcode; 391 if (track_changed)
392 gwps->display->stop_scroll();
393
394 return gui_wps_redraw(gwps, 0,
395 track_changed ? WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC);
420} 396}
421 397
422 398
@@ -1745,7 +1721,6 @@ static void write_line(struct screen *display,
1745 int line, 1721 int line,
1746 bool scroll) 1722 bool scroll)
1747{ 1723{
1748
1749 int left_width = 0, left_xpos; 1724 int left_width = 0, left_xpos;
1750 int center_width = 0, center_xpos; 1725 int center_width = 0, center_xpos;
1751 int right_width = 0, right_xpos; 1726 int right_width = 0, right_xpos;
@@ -1898,22 +1873,23 @@ static void write_line(struct screen *display,
1898 } 1873 }
1899} 1874}
1900 1875
1901/* Refresh the WPS according to refresh_mode. */ 1876bool gui_wps_redraw(struct gui_wps *gwps,
1902bool gui_wps_refresh(struct gui_wps *gwps,
1903 int ffwd_offset, 1877 int ffwd_offset,
1904 unsigned char refresh_mode) 1878 unsigned refresh_mode)
1905{ 1879{
1906 struct wps_data *data = gwps->data; 1880 struct wps_data *data = gwps->data;
1907 struct screen *display = gwps->display; 1881 struct screen *display = gwps->display;
1908 struct wps_state *state = gwps->state; 1882 struct wps_state *state = gwps->state;
1883 struct mp3entry *id3 = state->id3;
1909 1884
1910 if(!gwps || !data || !state || !display) 1885 if(!data || !state || !display || !id3)
1886 {
1911 return false; 1887 return false;
1888 }
1912 1889
1913 int v, line, i, subline_idx; 1890 int v, line, i, subline_idx;
1914 unsigned char flags; 1891 unsigned flags;
1915 char linebuf[MAX_PATH]; 1892 char linebuf[MAX_PATH];
1916 unsigned char vp_refresh_mode;
1917 1893
1918 struct align_pos align; 1894 struct align_pos align;
1919 align.left = NULL; 1895 align.left = NULL;
@@ -1955,12 +1931,6 @@ bool gui_wps_refresh(struct gui_wps *gwps,
1955 } 1931 }
1956#endif 1932#endif
1957 1933
1958 if (!state->id3)
1959 {
1960 display->stop_scroll();
1961 return false;
1962 }
1963
1964 state->ff_rewind_count = ffwd_offset; 1934 state->ff_rewind_count = ffwd_offset;
1965 1935
1966 /* disable any viewports which are conditionally displayed */ 1936 /* disable any viewports which are conditionally displayed */
@@ -1977,8 +1947,8 @@ bool gui_wps_refresh(struct gui_wps *gwps,
1977 for (v = 0; v < data->num_viewports; v++) 1947 for (v = 0; v < data->num_viewports; v++)
1978 { 1948 {
1979 struct wps_viewport *wps_vp = &(data->viewports[v]); 1949 struct wps_viewport *wps_vp = &(data->viewports[v]);
1950 unsigned vp_refresh_mode = refresh_mode;
1980 display->set_viewport(&wps_vp->vp); 1951 display->set_viewport(&wps_vp->vp);
1981 vp_refresh_mode = refresh_mode;
1982 1952
1983#ifdef HAVE_LCD_BITMAP 1953#ifdef HAVE_LCD_BITMAP
1984 /* Set images to not to be displayed */ 1954 /* Set images to not to be displayed */
@@ -2114,7 +2084,7 @@ bool gui_wps_refresh(struct gui_wps *gwps,
2114 display->update(); 2084 display->update();
2115 2085
2116#ifdef HAVE_BACKLIGHT 2086#ifdef HAVE_BACKLIGHT
2117 if (global_settings.caption_backlight && state->id3) 2087 if (global_settings.caption_backlight)
2118 { 2088 {
2119 /* turn on backlight n seconds before track ends, and turn it off n 2089 /* turn on backlight n seconds before track ends, and turn it off n
2120 seconds into the new track. n == backlight_timeout, or 5s */ 2090 seconds into the new track. n == backlight_timeout, or 5s */
@@ -2123,14 +2093,14 @@ bool gui_wps_refresh(struct gui_wps *gwps,
2123 if ( n < 1000 ) 2093 if ( n < 1000 )
2124 n = 5000; /* use 5s if backlight is always on or off */ 2094 n = 5000; /* use 5s if backlight is always on or off */
2125 2095
2126 if (((state->id3->elapsed < 1000) || 2096 if (((id3->elapsed < 1000) ||
2127 ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && 2097 ((id3->length - id3->elapsed) < (unsigned)n)) &&
2128 (state->paused == false)) 2098 (state->paused == false))
2129 backlight_on(); 2099 backlight_on();
2130 } 2100 }
2131#endif 2101#endif
2132#ifdef HAVE_REMOTE_LCD 2102#ifdef HAVE_REMOTE_LCD
2133 if (global_settings.remote_caption_backlight && state->id3) 2103 if (global_settings.remote_caption_backlight)
2134 { 2104 {
2135 /* turn on remote backlight n seconds before track ends, and turn it 2105 /* turn on remote backlight n seconds before track ends, and turn it
2136 off n seconds into the new track. n == remote_backlight_timeout, 2106 off n seconds into the new track. n == remote_backlight_timeout,
@@ -2140,8 +2110,8 @@ bool gui_wps_refresh(struct gui_wps *gwps,
2140 if ( n < 1000 ) 2110 if ( n < 1000 )
2141 n = 5000; /* use 5s if backlight is always on or off */ 2111 n = 5000; /* use 5s if backlight is always on or off */
2142 2112
2143 if (((state->id3->elapsed < 1000) || 2113 if (((id3->elapsed < 1000) ||
2144 ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && 2114 ((id3->length - id3->elapsed) < (unsigned)n)) &&
2145 (state->paused == false)) 2115 (state->paused == false))
2146 remote_backlight_on(); 2116 remote_backlight_on();
2147 } 2117 }
diff --git a/apps/gui/gwps-common.h b/apps/gui/gwps-common.h
index 25ce435592..8752c1d162 100644
--- a/apps/gui/gwps-common.h
+++ b/apps/gui/gwps-common.h
@@ -25,14 +25,25 @@
25 25
26#include "gwps.h" 26#include "gwps.h"
27 27
28/* fades the volume, e.g. on pause or stop */
28void fade(bool fade_in, bool updatewps); 29void fade(bool fade_in, bool updatewps);
29bool gui_wps_display(void); 30
31/* Initially display the wps, can fall back to the build-in wps
32 * if the chosen wps is invalid */
33bool gui_wps_display(struct gui_wps *gui_wps);
34
35/* return true if screen restore is needed
36 return false otherwise */
30bool update_onvol_change(struct gui_wps * gwps); 37bool update_onvol_change(struct gui_wps * gwps);
31bool update(struct gui_wps *gwps); 38
39/* Update track info related stuff, handles cue sheets as well, and redraw */
40bool gui_wps_update(struct gui_wps *gwps);
41
32bool ffwd_rew(int button); 42bool ffwd_rew(int button);
33void display_keylock_text(bool locked); 43void display_keylock_text(bool locked);
34 44
35bool gui_wps_refresh(struct gui_wps *gwps, 45/* Refresh the WPS according to refresh_mode. */
46bool gui_wps_redraw(struct gui_wps *gwps,
36 int ffwd_offset, 47 int ffwd_offset,
37 unsigned char refresh_mode); 48 unsigned refresh_mode);
38#endif 49#endif
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index cbce0f5973..9057d9ead9 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -219,15 +219,8 @@ long gui_wps_show(void)
219#ifdef HAVE_LCD_CHARCELLS 219#ifdef HAVE_LCD_CHARCELLS
220 status_set_audio(true); 220 status_set_audio(true);
221 status_set_param(false); 221 status_set_param(false);
222#else
223#if LCD_DEPTH > 1
224 show_wps_backdrop();
225#endif /* LCD_DEPTH > 1 */
226#endif 222#endif
227 223
228#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
229 show_remote_wps_backdrop();
230#endif
231 gwps_fix_statusbars(); 224 gwps_fix_statusbars();
232 225
233#ifdef AB_REPEAT_ENABLE 226#ifdef AB_REPEAT_ENABLE
@@ -239,18 +232,17 @@ long gui_wps_show(void)
239 wps_state.id3 = audio_current_track(); 232 wps_state.id3 = audio_current_track();
240 wps_state.nid3 = audio_next_track(); 233 wps_state.nid3 = audio_next_track();
241 if (wps_state.id3) { 234 if (wps_state.id3) {
242 if (gui_wps_display()) 235 FOR_NB_SCREENS(i)
243 { 236 {
244 gwps_leave_wps(); 237 if (!gui_wps_display(&gui_wps[i]))
245 return 0; 238 exit = true;
246 } 239 }
247 } 240 }
248
249 restore = true;
250 } 241 }
251 242
252 while ( 1 ) 243 while ( 1 )
253 { 244 {
245 yield();
254 bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false; 246 bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false;
255 247
256 /* did someone else (i.e power thread) change audio pause mode? */ 248 /* did someone else (i.e power thread) change audio pause mode? */
@@ -295,7 +287,7 @@ long gui_wps_show(void)
295 FOR_NB_SCREENS(i) 287 FOR_NB_SCREENS(i)
296 { 288 {
297 if(gui_wps[i].data->peak_meter_enabled) 289 if(gui_wps[i].data->peak_meter_enabled)
298 gui_wps_refresh(&gui_wps[i], 0, 290 gui_wps_redraw(&gui_wps[i], 0,
299 WPS_REFRESH_PEAK_METER); 291 WPS_REFRESH_PEAK_METER);
300 next_refresh += HZ / PEAK_METER_FPS; 292 next_refresh += HZ / PEAK_METER_FPS;
301 } 293 }
@@ -392,7 +384,6 @@ long gui_wps_show(void)
392 } 384 }
393 break; 385 break;
394 386
395 /* volume up */
396 case ACTION_WPS_VOLUP: 387 case ACTION_WPS_VOLUP:
397 { 388 {
398 FOR_NB_SCREENS(i) 389 FOR_NB_SCREENS(i)
@@ -410,9 +401,7 @@ long gui_wps_show(void)
410 restoretimer = RESTORE_WPS_NEXT_SECOND; 401 restoretimer = RESTORE_WPS_NEXT_SECOND;
411 } 402 }
412 } 403 }
413 break; 404 break;
414
415 /* volume down */
416 case ACTION_WPS_VOLDOWN: 405 case ACTION_WPS_VOLDOWN:
417 { 406 {
418 FOR_NB_SCREENS(i) 407 FOR_NB_SCREENS(i)
@@ -683,7 +672,7 @@ long gui_wps_show(void)
683 { 672 {
684 FOR_NB_SCREENS(i) 673 FOR_NB_SCREENS(i)
685 { 674 {
686 if(update(&gui_wps[i])) 675 if(!gui_wps_update(&gui_wps[i]))
687 exit = true; 676 exit = true;
688 } 677 }
689 update_track = false; 678 update_track = false;
@@ -702,8 +691,11 @@ long gui_wps_show(void)
702#endif 691#endif
703 restore = false; 692 restore = false;
704 restoretimer = RESTORE_WPS_INSTANTLY; 693 restoretimer = RESTORE_WPS_INSTANTLY;
705 if (gui_wps_display()) { 694 FOR_NB_SCREENS(i)
706 exit = true; 695 {
696 screens[i].stop_scroll();
697 if (!gui_wps_redraw(&gui_wps[i], 0, WPS_REFRESH_ALL))
698 exit = true;
707 } 699 }
708 } 700 }
709 701
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index d1239c1b34..7888c3944c 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -26,13 +26,13 @@
26#include "metadata.h" 26#include "metadata.h"
27 27
28/* constants used in line_type and as refresh_mode for wps_refresh */ 28/* constants used in line_type and as refresh_mode for wps_refresh */
29#define WPS_REFRESH_STATIC (1<<0) /* line doesn't change over time */ 29#define WPS_REFRESH_STATIC (1u<<0) /* line doesn't change over time */
30#define WPS_REFRESH_DYNAMIC (1<<1) /* line may change (e.g. time flag) */ 30#define WPS_REFRESH_DYNAMIC (1u<<1) /* line may change (e.g. time flag) */
31#define WPS_REFRESH_SCROLL (1<<2) /* line scrolls */ 31#define WPS_REFRESH_SCROLL (1u<<2) /* line scrolls */
32#define WPS_REFRESH_PLAYER_PROGRESS (1<<3) /* line contains a progress bar */ 32#define WPS_REFRESH_PLAYER_PROGRESS (1u<<3) /* line contains a progress bar */
33#define WPS_REFRESH_PEAK_METER (1<<4) /* line contains a peak meter */ 33#define WPS_REFRESH_PEAK_METER (1u<<4) /* line contains a peak meter */
34#define WPS_REFRESH_STATUSBAR (1<<5) /* refresh statusbar */ 34#define WPS_REFRESH_STATUSBAR (1u<<5) /* refresh statusbar */
35#define WPS_REFRESH_ALL 0xff /* to refresh all line types */ 35#define WPS_REFRESH_ALL (0xffffffffu) /* to refresh all line types */
36 36
37/* to refresh only those lines that change over time */ 37/* to refresh only those lines that change over time */
38#define WPS_REFRESH_NON_STATIC (WPS_REFRESH_DYNAMIC| \ 38#define WPS_REFRESH_NON_STATIC (WPS_REFRESH_DYNAMIC| \