summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-08-26 00:06:27 +0000
committerThomas Martitz <kugel@rockbox.org>2009-08-26 00:06:27 +0000
commitaf967d77d39307d7c9faacd360b117fdaa63f64a (patch)
tree97f58bfa26f167b0a1e6b944fb6809b1cfe0cd07
parent51743419993ca23bb78d00b195eb2773743aed39 (diff)
downloadrockbox-af967d77d39307d7c9faacd360b117fdaa63f64a.tar.gz
rockbox-af967d77d39307d7c9faacd360b117fdaa63f64a.zip
Fix skin engine calling wps code to draw the statusbars (add a pointer to viewportmanager-suitable statusbar values, which are the same for all screens), and re-arrange statusbar related code slightly. No functional change.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22514 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/skin_engine/skin_display.c31
-rw-r--r--apps/gui/skin_engine/skin_engine.h3
-rw-r--r--apps/gui/skin_engine/wps_internals.h10
-rw-r--r--apps/gui/wps.c63
4 files changed, 61 insertions, 46 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 85cc65d410..e674c9becf 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -129,6 +129,35 @@ bool skin_update(struct gui_wps *gwps, unsigned int update_type)
129 return retval; 129 return retval;
130} 130}
131 131
132void skin_statusbar_changed(struct gui_wps *skin)
133{
134 if (!skin)
135 return;
136 struct wps_data *data = skin->data;
137 const struct screen *display = skin->display;
138
139 struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, data)->vp;
140 viewport_set_fullscreen(vp, display->screen_type);
141
142 if (data->wps_sb_tag)
143 { /* fix up the default viewport */
144 if (data->show_sb_on_wps)
145 {
146 bool bar_at_top =
147 statusbar_position(display->screen_type) != STATUSBAR_BOTTOM;
148
149 vp->y = bar_at_top?STATUSBAR_HEIGHT:0;
150 vp->height = display->lcdheight - STATUSBAR_HEIGHT;
151 }
152 else
153 {
154 vp->y = 0;
155 vp->height = display->lcdheight;
156 }
157 }
158
159
160}
132 161
133#ifdef HAVE_LCD_BITMAP 162#ifdef HAVE_LCD_BITMAP
134 163
@@ -1141,7 +1170,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
1141 1170
1142 if (refresh_mode & WPS_REFRESH_STATUSBAR) 1171 if (refresh_mode & WPS_REFRESH_STATUSBAR)
1143 { 1172 {
1144 gwps_draw_statusbars(); 1173 viewportmanager_set_statusbar(*gwps->statusbars);
1145 } 1174 }
1146 /* Restore the default viewport */ 1175 /* Restore the default viewport */
1147 display->set_viewport(NULL); 1176 display->set_viewport(NULL);
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h
index 3ec7b93a9d..c52f720d06 100644
--- a/apps/gui/skin_engine/skin_engine.h
+++ b/apps/gui/skin_engine/skin_engine.h
@@ -51,4 +51,7 @@ bool skin_data_load(struct wps_data *wps_data,
51 51
52/* initial setup of wps_data */ 52/* initial setup of wps_data */
53void skin_data_init(struct wps_data *wps_data); 53void skin_data_init(struct wps_data *wps_data);
54
55/* call this in statusbar toggle handlers if needed */
56void skin_statusbar_changed(struct gui_wps*);
54#endif 57#endif
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 20a9dde9f9..fbd18b9f73 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -286,10 +286,6 @@ struct wps_data
286 unsigned int button_time_volume; 286 unsigned int button_time_volume;
287}; 287};
288 288
289
290/* Redraw statusbars if necessary */
291void gwps_draw_statusbars(void);
292
293/* Returns the index of the last subline's token in the token array. 289/* Returns the index of the last subline's token in the token array.
294 line - 0-based line number 290 line - 0-based line number
295 subline - 0-based subline number within the line 291 subline - 0-based subline number within the line
@@ -332,6 +328,12 @@ struct gui_wps
332 struct screen *display; 328 struct screen *display;
333 struct wps_data *data; 329 struct wps_data *data;
334 struct wps_state *state; 330 struct wps_state *state;
331
332 /* suitable for the viewportmanager, possibly only temporary here
333 * needs to be same for all screens! can't be split up for screens
334 * due to what viewportmanager_set_statusbar() accepts
335 * (FIXME?) */
336 int *statusbars;
335}; 337};
336 338
337/* gui_wps end */ 339/* gui_wps end */
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