summaryrefslogtreecommitdiff
path: root/apps/gui/wps.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/wps.c')
-rw-r--r--apps/gui/wps.c63
1 files changed, 22 insertions, 41 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index ed3bf5f6b3..cfa857099e 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -78,6 +78,7 @@
78 /* 3% of 30min file == 54s step size */ 78 /* 3% of 30min file == 54s step size */
79#define MIN_FF_REWIND_STEP 500 79#define MIN_FF_REWIND_STEP 500
80 80
81/* this is for the viewportmanager */
81static int wpsbars; 82static int wpsbars;
82/* currently only one wps_state is needed */ 83/* currently only one wps_state is needed */
83static struct wps_state wps_state; 84static struct wps_state wps_state;
@@ -88,6 +89,7 @@ static struct wps_data wps_datas[NB_SCREENS];
88static void wps_state_init(void); 89static void wps_state_init(void);
89static void track_changed_callback(void *param); 90static void track_changed_callback(void *param);
90static void nextid3available_callback(void* param); 91static void nextid3available_callback(void* param);
92static void statusbar_toggle_handler(void *data);
91 93
92 94
93#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" 95#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
@@ -543,25 +545,6 @@ static void play_hop(int direction)
543#endif 545#endif
544} 546}
545 547
546static void gwps_fix_statusbars(void)
547{
548#ifdef HAVE_LCD_BITMAP
549 int i;
550 wpsbars = VP_SB_HIDE_ALL;
551 FOR_NB_SCREENS(i)
552 {
553 bool draw = false;
554 if (gui_wps[i].data->wps_sb_tag)
555 draw = gui_wps[i].data->show_sb_on_wps;
556 else if (statusbar_position(i) != STATUSBAR_OFF)
557 draw = true;
558 if (draw)
559 wpsbars |= (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
560 }
561#else
562 wpsbars = VP_SB_ALLSCREENS;
563#endif
564}
565 548
566#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 549#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
567/* 550/*
@@ -585,9 +568,9 @@ static void gwps_leave_wps(void)
585 { 568 {
586 gui_wps[i].display->stop_scroll(); 569 gui_wps[i].display->stop_scroll();
587 gui_wps[i].display->backdrop_show(BACKDROP_MAIN); 570 gui_wps[i].display->backdrop_show(BACKDROP_MAIN);
571 if (statusbar_position(i) != STATUSBAR_OFF)
572 oldbars |= VP_SB_ONSCREEN(i);
588 } 573 }
589 if (global_settings.statusbar)
590 oldbars = VP_SB_ALLSCREENS;
591 574
592 viewportmanager_set_statusbar(oldbars); 575 viewportmanager_set_statusbar(oldbars);
593#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 576#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
@@ -597,10 +580,6 @@ static void gwps_leave_wps(void)
597 send_event(GUI_EVENT_REFRESH, NULL); 580 send_event(GUI_EVENT_REFRESH, NULL);
598} 581}
599 582
600void gwps_draw_statusbars(void)
601{
602 viewportmanager_set_statusbar(wpsbars);
603}
604#ifdef HAVE_TOUCHSCREEN 583#ifdef HAVE_TOUCHSCREEN
605int wps_get_touchaction(struct wps_data *data) 584int wps_get_touchaction(struct wps_data *data)
606{ 585{
@@ -721,6 +700,7 @@ long gui_wps_show(void)
721 ab_reset_markers(); 700 ab_reset_markers();
722#endif 701#endif
723 wps_state_init(); 702 wps_state_init();
703 statusbar_toggle_handler(NULL);
724 704
725 while ( 1 ) 705 while ( 1 )
726 { 706 {
@@ -1181,7 +1161,6 @@ long gui_wps_show(void)
1181 { 1161 {
1182 restore = false; 1162 restore = false;
1183 restoretimer = RESTORE_WPS_INSTANTLY; 1163 restoretimer = RESTORE_WPS_INSTANTLY;
1184 gwps_fix_statusbars();
1185#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 1164#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
1186 lcd_activation_set_hook(wps_lcd_activation_hook); 1165 lcd_activation_set_hook(wps_lcd_activation_hook);
1187#endif 1166#endif
@@ -1269,23 +1248,22 @@ static void statusbar_toggle_handler(void *data)
1269{ 1248{
1270 (void)data; 1249 (void)data;
1271 int i; 1250 int i;
1272 gwps_fix_statusbars();
1273 1251
1252 wpsbars = VP_SB_HIDE_ALL;
1274 FOR_NB_SCREENS(i) 1253 FOR_NB_SCREENS(i)
1275 { 1254 { /* fix viewports if needed */
1276 struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, &wps_datas[i])->vp; 1255 skin_statusbar_changed(&gui_wps[i]);
1277 bool draw = wpsbars & (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i)); 1256
1278 if (!draw) 1257 bool draw = false;
1279 { 1258
1280 vp->y = 0; 1259 /* fix up gui_wps::statusbars, so that the viewportmanager accepts it*/
1281 vp->height = screens[i].lcdheight; 1260 if (gui_wps[i].data->wps_sb_tag)
1282 } 1261 draw = gui_wps[i].data->show_sb_on_wps;
1283 else 1262 else if (statusbar_position(i) != STATUSBAR_OFF)
1284 { 1263 draw = true;
1285 bool bar_at_top = statusbar_position(i) != STATUSBAR_BOTTOM; 1264 if (draw)
1286 vp->y = bar_at_top?STATUSBAR_HEIGHT:0; 1265 wpsbars |=
1287 vp->height = screens[i].lcdheight - STATUSBAR_HEIGHT; 1266 (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
1288 }
1289 } 1267 }
1290} 1268}
1291#endif 1269#endif
@@ -1308,7 +1286,10 @@ void gui_sync_wps_init(void)
1308 so use the only available ( "global" ) one */ 1286 so use the only available ( "global" ) one */
1309 gui_wps[i].state = &wps_state; 1287 gui_wps[i].state = &wps_state;
1310 gui_wps[i].display->backdrop_unload(BACKDROP_SKIN_WPS); 1288 gui_wps[i].display->backdrop_unload(BACKDROP_SKIN_WPS);
1289 /* only one wpsbars needed/wanted */
1290 gui_wps[i].statusbars = &wpsbars;
1311 } 1291 }
1292 *(gui_wps[SCREEN_MAIN].statusbars) =VP_SB_ALLSCREENS;
1312#ifdef HAVE_LCD_BITMAP 1293#ifdef HAVE_LCD_BITMAP
1313 add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler); 1294 add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler);
1314#endif 1295#endif