mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
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
This commit is contained in:
parent
5174341999
commit
af967d77d3
4 changed files with 61 additions and 46 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue