diff options
Diffstat (limited to 'apps/gui/statusbar.c')
-rw-r--r-- | apps/gui/statusbar.c | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 024ade330f..1a724406ef 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "powermgmt.h" | 34 | #include "powermgmt.h" |
35 | #include "usb.h" | 35 | #include "usb.h" |
36 | #include "led.h" | 36 | #include "led.h" |
37 | #include "screen_access.h" | ||
37 | 38 | ||
38 | #include "status.h" /* needed for battery_state global var */ | 39 | #include "status.h" /* needed for battery_state global var */ |
39 | #include "action.h" /* for keys_locked */ | 40 | #include "action.h" /* for keys_locked */ |
@@ -172,13 +173,23 @@ static void gui_statusbar_init(struct gui_statusbar * bar) | |||
172 | #endif | 173 | #endif |
173 | } | 174 | } |
174 | 175 | ||
176 | #define GET_RECT(vp, vals,display) do { \ | ||
177 | viewport_set_fullscreen(&(vp), (display)->screen_type); \ | ||
178 | (vp).height = STATUSBAR_HEIGHT; \ | ||
179 | (vp).x = STATUSBAR_X_POS; \ | ||
180 | if ((vals) != STATUSBAR_BOTTOM) \ | ||
181 | (vp).y = 0; \ | ||
182 | else \ | ||
183 | (vp).y = (display)->lcdheight - STATUSBAR_HEIGHT; \ | ||
184 | } while(0) | ||
185 | |||
175 | void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | 186 | void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) |
176 | { | 187 | { |
177 | struct screen * display = bar->display; | 188 | struct screen * display = bar->display; |
178 | 189 | ||
179 | #ifdef HAVE_LCD_CHARCELLS | 190 | #ifdef HAVE_LCD_CHARCELLS |
180 | int val; | 191 | int val; |
181 | (void)force_redraw; /* players always "redraw" */ | 192 | (void)force_redraw; /* The Player always has "redraw" */ |
182 | #endif /* HAVE_LCD_CHARCELLS */ | 193 | #endif /* HAVE_LCD_CHARCELLS */ |
183 | 194 | ||
184 | bar->info.battlevel = battery_level(); | 195 | bar->info.battlevel = battery_level(); |
@@ -263,13 +274,8 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
263 | memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info))) | 274 | memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info))) |
264 | { | 275 | { |
265 | struct viewport vp; | 276 | struct viewport vp; |
266 | viewport_set_fullscreen(&vp, display->screen_type); | 277 | |
267 | vp.height = STATUSBAR_HEIGHT; | 278 | GET_RECT(vp,statusbar_position(display->screen_type),display); |
268 | vp.x = STATUSBAR_X_POS; | ||
269 | if (statusbar_position(display->screen_type) != STATUSBAR_BOTTOM) | ||
270 | vp.y = 0; | ||
271 | else | ||
272 | vp.y = display->lcdheight - STATUSBAR_HEIGHT; | ||
273 | display->set_viewport(&vp); | 279 | display->set_viewport(&vp); |
274 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 280 | display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
275 | display->fillrect(0, 0, display->getwidth(), STATUSBAR_HEIGHT); | 281 | display->fillrect(0, 0, display->getwidth(), STATUSBAR_HEIGHT); |
@@ -816,11 +822,33 @@ void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, | |||
816 | } | 822 | } |
817 | } | 823 | } |
818 | 824 | ||
819 | void gui_statusbar_changed(int enabled) | 825 | #ifdef HAVE_LCD_BITMAP |
826 | void gui_statusbar_changed( enum screen_type screen, | ||
827 | enum statusbar_values old) | ||
820 | { | 828 | { |
821 | (void)enabled; | 829 | /* clear and update the statusbar area to remove old parts */ |
822 | send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL); | 830 | enum statusbar_values bar; |
831 | #ifdef HAVE_REMOTE_LCD | ||
832 | if (screen == SCREEN_REMOTE) | ||
833 | bar = global_settings.remote_statusbar; | ||
834 | else | ||
835 | #endif | ||
836 | bar = global_settings.statusbar; | ||
837 | |||
838 | struct screen *display = &screens[screen]; | ||
839 | struct viewport vp; | ||
840 | |||
841 | if (old != STATUSBAR_OFF && old != bar) | ||
842 | { | ||
843 | GET_RECT(vp, old, display); | ||
844 | display->set_viewport(&vp); | ||
845 | display->clear_viewport(); | ||
846 | display->update_viewport(); | ||
847 | display->set_viewport(NULL); | ||
848 | } | ||
823 | } | 849 | } |
850 | #endif | ||
851 | |||
824 | #ifdef HAVE_REMOTE_LCD | 852 | #ifdef HAVE_REMOTE_LCD |
825 | int statusbar_position(int screen) | 853 | int statusbar_position(int screen) |
826 | { | 854 | { |