diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/statusbar.c | 50 | ||||
-rw-r--r-- | apps/gui/statusbar.h | 9 | ||||
-rw-r--r-- | apps/menus/display_menu.c | 34 | ||||
-rw-r--r-- | apps/settings.h | 4 | ||||
-rw-r--r-- | apps/settings_list.c | 4 |
5 files changed, 80 insertions, 21 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 | { |
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index c2829a029b..169b76b15a 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h | |||
@@ -54,6 +54,9 @@ struct status_info { | |||
54 | 54 | ||
55 | }; | 55 | }; |
56 | 56 | ||
57 | /* statusbar visibility/position, used for settings also */ | ||
58 | enum statusbar_values { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM }; | ||
59 | |||
57 | struct gui_statusbar | 60 | struct gui_statusbar |
58 | { | 61 | { |
59 | long battery_icon_switch_tick; | 62 | long battery_icon_switch_tick; |
@@ -97,8 +100,10 @@ struct gui_syncstatusbar | |||
97 | }; | 100 | }; |
98 | 101 | ||
99 | extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars); | 102 | extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars); |
100 | extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw); | 103 | extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, |
101 | void gui_statusbar_changed(int enabled); | 104 | bool force_redraw); |
105 | void gui_statusbar_changed(enum screen_type screen, | ||
106 | enum statusbar_values old); | ||
102 | #if !defined(HAVE_REMOTE_LCD) || defined(__PCTOOL__) | 107 | #if !defined(HAVE_REMOTE_LCD) || defined(__PCTOOL__) |
103 | #define statusbar_position(a) (global_settings.statusbar) | 108 | #define statusbar_position(a) (global_settings.statusbar) |
104 | #else | 109 | #else |
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index 24e36e5fca..0b2769831e 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "screens.h" | 40 | #include "screens.h" |
41 | #endif | 41 | #endif |
42 | #include "viewport.h" | 42 | #include "viewport.h" |
43 | #include "statusbar.h" /* statusbar_vals enum*/ | ||
43 | 44 | ||
44 | #ifdef HAVE_BACKLIGHT | 45 | #ifdef HAVE_BACKLIGHT |
45 | static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) | 46 | static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) |
@@ -307,23 +308,50 @@ MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON, | |||
307 | /***********************************/ | 308 | /***********************************/ |
308 | /* BARS MENU */ | 309 | /* BARS MENU */ |
309 | #ifdef HAVE_LCD_BITMAP | 310 | #ifdef HAVE_LCD_BITMAP |
310 | static int statusbar_callback(int action,const struct menu_item_ex *this_item) | 311 | static int statusbar_callback_ex(int action,const struct menu_item_ex *this_item, |
312 | enum screen_type screen) | ||
311 | { | 313 | { |
312 | (void)this_item; | 314 | (void)this_item; |
315 | /* we save the old statusbar value here, so the old statusbars can get | ||
316 | * removed and cleared from the display properly on exiting | ||
317 | * (in gui_statusbar_changed() ) */ | ||
318 | static enum statusbar_values old_bar[NB_SCREENS]; | ||
313 | switch (action) | 319 | switch (action) |
314 | { | 320 | { |
321 | case ACTION_ENTER_MENUITEM: | ||
322 | #ifdef HAVE_REMOTE_LCD | ||
323 | if (screen == SCREEN_REMOTE) | ||
324 | old_bar[screen] = global_settings.remote_statusbar; | ||
325 | else | ||
326 | #endif | ||
327 | old_bar[screen] = global_settings.statusbar; | ||
328 | break; | ||
315 | case ACTION_EXIT_MENUITEM: | 329 | case ACTION_EXIT_MENUITEM: |
330 | gui_statusbar_changed(screen, old_bar[screen]); | ||
316 | send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL); | 331 | send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL); |
317 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)true); | 332 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)true); |
318 | break; | 333 | break; |
319 | } | 334 | } |
320 | return action; | 335 | return action; |
321 | } | 336 | } |
337 | |||
338 | #ifdef HAVE_REMOTE_LCD | ||
339 | static int statusbar_callback_remote(int action,const struct menu_item_ex *this_item) | ||
340 | { | ||
341 | return statusbar_callback_ex(action, this_item, SCREEN_REMOTE); | ||
342 | } | ||
343 | #endif | ||
344 | static int statusbar_callback(int action,const struct menu_item_ex *this_item) | ||
345 | { | ||
346 | return statusbar_callback_ex(action, this_item, SCREEN_MAIN); | ||
347 | } | ||
322 | MENUITEM_SETTING(scrollbar_item, &global_settings.scrollbar, NULL); | 348 | MENUITEM_SETTING(scrollbar_item, &global_settings.scrollbar, NULL); |
323 | MENUITEM_SETTING(scrollbar_width, &global_settings.scrollbar_width, NULL); | 349 | MENUITEM_SETTING(scrollbar_width, &global_settings.scrollbar_width, NULL); |
324 | MENUITEM_SETTING(statusbar, &global_settings.statusbar, statusbar_callback); | 350 | MENUITEM_SETTING(statusbar, &global_settings.statusbar, |
351 | statusbar_callback); | ||
325 | #ifdef HAVE_REMOTE_LCD | 352 | #ifdef HAVE_REMOTE_LCD |
326 | MENUITEM_SETTING(remote_statusbar, &global_settings.remote_statusbar, statusbar_callback); | 353 | MENUITEM_SETTING(remote_statusbar, &global_settings.remote_statusbar, |
354 | statusbar_callback_remote); | ||
327 | #endif | 355 | #endif |
328 | #if CONFIG_KEYPAD == RECORDER_PAD | 356 | #if CONFIG_KEYPAD == RECORDER_PAD |
329 | MENUITEM_SETTING(buttonbar, &global_settings.buttonbar, NULL); | 357 | MENUITEM_SETTING(buttonbar, &global_settings.buttonbar, NULL); |
diff --git a/apps/settings.h b/apps/settings.h index cbd7b6d3b3..1365736ecf 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <stddef.h> | 26 | #include <stddef.h> |
27 | #include "inttypes.h" | 27 | #include "inttypes.h" |
28 | #include "config.h" | 28 | #include "config.h" |
29 | #include "statusbar.h" /* for the statusbar values */ | ||
29 | #include "button.h" | 30 | #include "button.h" |
30 | #if CONFIG_CODEC == SWCODEC | 31 | #if CONFIG_CODEC == SWCODEC |
31 | #include "audio.h" | 32 | #include "audio.h" |
@@ -156,9 +157,6 @@ enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE, REPLAYGAIN_OF | |||
156 | /* show path types */ | 157 | /* show path types */ |
157 | enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL }; | 158 | enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL }; |
158 | 159 | ||
159 | /* statusbar visibility/position */ | ||
160 | enum { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM }; | ||
161 | |||
162 | /* scrollbar visibility/position */ | 160 | /* scrollbar visibility/position */ |
163 | enum { SCROLLBAR_OFF = 0, SCROLLBAR_LEFT, SCROLLBAR_RIGHT }; | 161 | enum { SCROLLBAR_OFF = 0, SCROLLBAR_LEFT, SCROLLBAR_RIGHT }; |
164 | 162 | ||
diff --git a/apps/settings_list.c b/apps/settings_list.c index 450d0eada4..23424f94cc 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -604,12 +604,12 @@ const struct settings_list settings[] = { | |||
604 | #endif | 604 | #endif |
605 | CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar, | 605 | CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar, |
606 | LANG_STATUS_BAR, STATUSBAR_TOP, "statusbar","off,top,bottom", | 606 | LANG_STATUS_BAR, STATUSBAR_TOP, "statusbar","off,top,bottom", |
607 | gui_statusbar_changed, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP), | 607 | NULL, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP), |
608 | ID2P(LANG_STATUSBAR_BOTTOM)), | 608 | ID2P(LANG_STATUSBAR_BOTTOM)), |
609 | #ifdef HAVE_REMOTE_LCD | 609 | #ifdef HAVE_REMOTE_LCD |
610 | CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, remote_statusbar, | 610 | CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, remote_statusbar, |
611 | LANG_REMOTE_STATUSBAR, STATUSBAR_TOP, "remote statusbar","off,top,bottom", | 611 | LANG_REMOTE_STATUSBAR, STATUSBAR_TOP, "remote statusbar","off,top,bottom", |
612 | gui_statusbar_changed, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP), | 612 | NULL, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP), |
613 | ID2P(LANG_STATUSBAR_BOTTOM)), | 613 | ID2P(LANG_STATUSBAR_BOTTOM)), |
614 | #endif | 614 | #endif |
615 | CHOICE_SETTING(F_TEMPVAR, scrollbar, | 615 | CHOICE_SETTING(F_TEMPVAR, scrollbar, |