summaryrefslogtreecommitdiff
path: root/apps/gui
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 /apps/gui
parent51743419993ca23bb78d00b195eb2773743aed39 (diff)
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
Diffstat (limited to 'apps/gui')
-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)
return retval;
}
+void skin_statusbar_changed(struct gui_wps *skin)
+{
+ if (!skin)
+ return;
+ struct wps_data *data = skin->data;
+ const struct screen *display = skin->display;
+
+ struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, data)->vp;
+ viewport_set_fullscreen(vp, display->screen_type);
+
+ if (data->wps_sb_tag)
+ { /* fix up the default viewport */
+ if (data->show_sb_on_wps)
+ {
+ bool bar_at_top =
+ statusbar_position(display->screen_type) != STATUSBAR_BOTTOM;
+
+ vp->y = bar_at_top?STATUSBAR_HEIGHT:0;
+ vp->height = display->lcdheight - STATUSBAR_HEIGHT;
+ }
+ else
+ {
+ vp->y = 0;
+ vp->height = display->lcdheight;
+ }
+ }
+
+
+}
#ifdef HAVE_LCD_BITMAP
@@ -1141,7 +1170,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
if (refresh_mode & WPS_REFRESH_STATUSBAR)
{
- gwps_draw_statusbars();
+ viewportmanager_set_statusbar(*gwps->statusbars);
}
/* Restore the default viewport */
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,
/* initial setup of wps_data */
void skin_data_init(struct wps_data *wps_data);
+
+/* call this in statusbar toggle handlers if needed */
+void skin_statusbar_changed(struct gui_wps*);
#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
unsigned int button_time_volume;
};
-
-/* Redraw statusbars if necessary */
-void gwps_draw_statusbars(void);
-
/* Returns the index of the last subline's token in the token array.
line - 0-based line number
subline - 0-based subline number within the line
@@ -332,6 +328,12 @@ struct gui_wps
struct screen *display;
struct wps_data *data;
struct wps_state *state;
+
+ /* suitable for the viewportmanager, possibly only temporary here
+ * needs to be same for all screens! can't be split up for screens
+ * due to what viewportmanager_set_statusbar() accepts
+ * (FIXME?) */
+ int *statusbars;
};
/* 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 @@
/* 3% of 30min file == 54s step size */
#define MIN_FF_REWIND_STEP 500
+/* this is for the viewportmanager */
static int wpsbars;
/* currently only one wps_state is needed */
static struct wps_state wps_state;
@@ -88,6 +89,7 @@ static struct wps_data wps_datas[NB_SCREENS];
static void wps_state_init(void);
static void track_changed_callback(void *param);
static void nextid3available_callback(void* param);
+static void statusbar_toggle_handler(void *data);
#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
@@ -543,25 +545,6 @@ static void play_hop(int direction)
#endif
}
-static void gwps_fix_statusbars(void)
-{
-#ifdef HAVE_LCD_BITMAP
- int i;
- wpsbars = VP_SB_HIDE_ALL;
- FOR_NB_SCREENS(i)
- {
- bool draw = false;
- if (gui_wps[i].data->wps_sb_tag)
- draw = gui_wps[i].data->show_sb_on_wps;
- else if (statusbar_position(i) != STATUSBAR_OFF)
- draw = true;
- if (draw)
- wpsbars |= (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
- }
-#else
- wpsbars = VP_SB_ALLSCREENS;
-#endif
-}
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
/*
@@ -585,9 +568,9 @@ static void gwps_leave_wps(void)
{
gui_wps[i].display->stop_scroll();
gui_wps[i].display->backdrop_show(BACKDROP_MAIN);
+ if (statusbar_position(i) != STATUSBAR_OFF)
+ oldbars |= VP_SB_ONSCREEN(i);
}
- if (global_settings.statusbar)
- oldbars = VP_SB_ALLSCREENS;
viewportmanager_set_statusbar(oldbars);
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
@@ -597,10 +580,6 @@ static void gwps_leave_wps(void)
send_event(GUI_EVENT_REFRESH, NULL);
}
-void gwps_draw_statusbars(void)
-{
- viewportmanager_set_statusbar(wpsbars);
-}
#ifdef HAVE_TOUCHSCREEN
int wps_get_touchaction(struct wps_data *data)
{
@@ -721,6 +700,7 @@ long gui_wps_show(void)
ab_reset_markers();
#endif
wps_state_init();
+ statusbar_toggle_handler(NULL);
while ( 1 )
{
@@ -1181,7 +1161,6 @@ long gui_wps_show(void)
{
restore = false;
restoretimer = RESTORE_WPS_INSTANTLY;
- gwps_fix_statusbars();
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
lcd_activation_set_hook(wps_lcd_activation_hook);
#endif
@@ -1269,23 +1248,22 @@ static void statusbar_toggle_handler(void *data)
{
(void)data;
int i;
- gwps_fix_statusbars();
+ wpsbars = VP_SB_HIDE_ALL;
FOR_NB_SCREENS(i)
- {
- struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, &wps_datas[i])->vp;
- bool draw = wpsbars & (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
- if (!draw)
- {
- vp->y = 0;
- vp->height = screens[i].lcdheight;
- }
- else
- {
- bool bar_at_top = statusbar_position(i) != STATUSBAR_BOTTOM;
- vp->y = bar_at_top?STATUSBAR_HEIGHT:0;
- vp->height = screens[i].lcdheight - STATUSBAR_HEIGHT;
- }
+ { /* fix viewports if needed */
+ skin_statusbar_changed(&gui_wps[i]);
+
+ bool draw = false;
+
+ /* fix up gui_wps::statusbars, so that the viewportmanager accepts it*/
+ if (gui_wps[i].data->wps_sb_tag)
+ draw = gui_wps[i].data->show_sb_on_wps;
+ else if (statusbar_position(i) != STATUSBAR_OFF)
+ draw = true;
+ if (draw)
+ wpsbars |=
+ (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
}
}
#endif
@@ -1308,7 +1286,10 @@ void gui_sync_wps_init(void)
so use the only available ( "global" ) one */
gui_wps[i].state = &wps_state;
gui_wps[i].display->backdrop_unload(BACKDROP_SKIN_WPS);
+ /* only one wpsbars needed/wanted */
+ gui_wps[i].statusbars = &wpsbars;
}
+ *(gui_wps[SCREEN_MAIN].statusbars) =VP_SB_ALLSCREENS;
#ifdef HAVE_LCD_BITMAP
add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler);
#endif