forked from len0rd/rockbox
cleanup the remote+main statusbar handling a bit, and fix the bug where the remote wps might reserve the space for the statusbar even if its disabled
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21709 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
008f611bca
commit
a06f6eedae
5 changed files with 32 additions and 41 deletions
|
|
@ -245,8 +245,8 @@ static void gwps_fix_statusbars(void)
|
||||||
bool draw = false;
|
bool draw = false;
|
||||||
if (gui_wps[i].data->wps_sb_tag)
|
if (gui_wps[i].data->wps_sb_tag)
|
||||||
draw = gui_wps[i].data->show_sb_on_wps;
|
draw = gui_wps[i].data->show_sb_on_wps;
|
||||||
else if (global_settings.statusbar)
|
else if (statusbar_position(i) != STATUSBAR_OFF)
|
||||||
wpsbars |= VP_SB_ONSCREEN(i);
|
draw = true;
|
||||||
if (draw)
|
if (draw)
|
||||||
wpsbars |= (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
|
wpsbars |= (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
|
||||||
}
|
}
|
||||||
|
|
@ -937,13 +937,7 @@ static void statusbar_toggle_handler(void *data)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool bar_at_top = true;
|
bool bar_at_top = statusbar_position(i) != STATUSBAR_BOTTOM;
|
||||||
#ifdef HAVE_REMOTE_LCD
|
|
||||||
if (i == SCREEN_REMOTE)
|
|
||||||
bar_at_top = global_settings.remote_statusbar != STATUSBAR_BOTTOM;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
bar_at_top = global_settings.statusbar != STATUSBAR_BOTTOM;
|
|
||||||
vp->y = bar_at_top?STATUSBAR_HEIGHT:0;
|
vp->y = bar_at_top?STATUSBAR_HEIGHT:0;
|
||||||
vp->height = screens[i].lcdheight - STATUSBAR_HEIGHT;
|
vp->height = screens[i].lcdheight - STATUSBAR_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -263,17 +263,10 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
|
||||||
memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info)))
|
memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info)))
|
||||||
{
|
{
|
||||||
struct viewport vp;
|
struct viewport vp;
|
||||||
bool bar_at_top = true;
|
|
||||||
viewport_set_defaults(&vp, display->screen_type);
|
viewport_set_defaults(&vp, display->screen_type);
|
||||||
vp.height = STATUSBAR_HEIGHT;
|
vp.height = STATUSBAR_HEIGHT;
|
||||||
vp.x = STATUSBAR_X_POS;
|
vp.x = STATUSBAR_X_POS;
|
||||||
#ifdef HAVE_REMOTE_LCD
|
if (statusbar_position(display->screen_type) != STATUSBAR_BOTTOM)
|
||||||
if (display->screen_type == SCREEN_REMOTE)
|
|
||||||
bar_at_top = global_settings.remote_statusbar != STATUSBAR_BOTTOM;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
bar_at_top = global_settings.statusbar != STATUSBAR_BOTTOM;
|
|
||||||
if (bar_at_top)
|
|
||||||
vp.y = 0;
|
vp.y = 0;
|
||||||
else
|
else
|
||||||
vp.y = display->lcdheight - STATUSBAR_HEIGHT;
|
vp.y = display->lcdheight - STATUSBAR_HEIGHT;
|
||||||
|
|
@ -829,3 +822,11 @@ void gui_statusbar_changed(int enabled)
|
||||||
(void)enabled;
|
(void)enabled;
|
||||||
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);
|
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_REMOTE_LCD
|
||||||
|
int statusbar_position(int screen)
|
||||||
|
{
|
||||||
|
if (screen == SCREEN_REMOTE)
|
||||||
|
return global_settings.remote_statusbar;
|
||||||
|
return global_settings.statusbar;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -99,5 +99,10 @@ struct gui_syncstatusbar
|
||||||
extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars);
|
extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars);
|
||||||
extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw);
|
extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw);
|
||||||
void gui_statusbar_changed(int enabled);
|
void gui_statusbar_changed(int enabled);
|
||||||
|
#ifndef HAVE_REMOTE_LCD
|
||||||
|
#define statusbar_position(a) (global_settings.statusbar)
|
||||||
|
#else
|
||||||
|
int statusbar_position(int screen);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /*_GUI_STATUSBAR_H_*/
|
#endif /*_GUI_STATUSBAR_H_*/
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,7 @@ static bool showing_bars(enum screen_type screen)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
bool ignore = statusbar_enabled & VP_SB_IGNORE_SETTING(screen);
|
bool ignore = statusbar_enabled & VP_SB_IGNORE_SETTING(screen);
|
||||||
#ifdef HAVE_REMOTE_LCD
|
return ignore || (statusbar_position(screen));
|
||||||
if (screen == SCREEN_REMOTE)
|
|
||||||
return global_settings.remote_statusbar || ignore;
|
|
||||||
#endif
|
|
||||||
return global_settings.statusbar || ignore;
|
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -67,24 +63,15 @@ static bool showing_bars(enum screen_type screen)
|
||||||
|
|
||||||
void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
|
void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
bool bar_at_top = true;
|
|
||||||
#endif
|
|
||||||
vp->x = 0;
|
vp->x = 0;
|
||||||
vp->width = screens[screen].lcdwidth;
|
vp->width = screens[screen].lcdwidth;
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
vp->drawmode = DRMODE_SOLID;
|
vp->drawmode = DRMODE_SOLID;
|
||||||
vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */
|
vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */
|
||||||
#ifdef HAVE_REMOTE_LCD
|
|
||||||
if (screen == SCREEN_REMOTE)
|
|
||||||
bar_at_top = global_settings.remote_statusbar != STATUSBAR_BOTTOM;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
bar_at_top = global_settings.statusbar != STATUSBAR_BOTTOM;
|
|
||||||
|
|
||||||
vp->height = screens[screen].lcdheight;
|
vp->height = screens[screen].lcdheight;
|
||||||
if (bar_at_top && showing_bars(screen))
|
if (statusbar_position(screen) != STATUSBAR_BOTTOM && showing_bars(screen))
|
||||||
vp->y = STATUSBAR_HEIGHT;
|
vp->y = STATUSBAR_HEIGHT;
|
||||||
else
|
else
|
||||||
vp->y = 0;
|
vp->y = 0;
|
||||||
|
|
|
||||||
|
|
@ -1682,16 +1682,20 @@ bool wps_data_load(struct wps_data *wps_data,
|
||||||
/* Initialise the first (default) viewport */
|
/* Initialise the first (default) viewport */
|
||||||
wps_data->viewports[0].vp.x = 0;
|
wps_data->viewports[0].vp.x = 0;
|
||||||
wps_data->viewports[0].vp.width = display->getwidth();
|
wps_data->viewports[0].vp.width = display->getwidth();
|
||||||
if (!global_settings.statusbar)
|
wps_data->viewports[0].vp.height = display->getheight();
|
||||||
|
switch (statusbar_position(display->screen_type))
|
||||||
{
|
{
|
||||||
wps_data->viewports[0].vp.y = 0;
|
case STATUSBAR_OFF:
|
||||||
wps_data->viewports[0].vp.height = display->getheight();
|
wps_data->viewports[0].vp.y = 0;
|
||||||
}
|
break;
|
||||||
else
|
case STATUSBAR_TOP:
|
||||||
{
|
wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
|
||||||
wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
|
wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT;
|
||||||
wps_data->viewports[0].vp.height = display->getheight() -
|
break;
|
||||||
STATUSBAR_HEIGHT;
|
case STATUSBAR_BOTTOM:
|
||||||
|
wps_data->viewports[0].vp.y = 0;
|
||||||
|
wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
wps_data->viewports[0].vp.font = FONT_UI;
|
wps_data->viewports[0].vp.font = FONT_UI;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue