diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2009-02-01 11:34:16 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2009-02-01 11:34:16 +0000 |
| commit | 80cb3551eb61cdf240cf24ad0c44016475bf2e61 (patch) | |
| tree | e9c72c90954b73807d64df59fefcdf0b1c1fc615 /apps | |
| parent | e55f2329c059434452c62af48903b4607e500e4e (diff) | |
| download | rockbox-80cb3551eb61cdf240cf24ad0c44016475bf2e61.zip rockbox-80cb3551eb61cdf240cf24ad0c44016475bf2e61.tar.gz rockbox-80cb3551eb61cdf240cf24ad0c44016475bf2e61.tar.bz2 rockbox-80cb3551eb61cdf240cf24ad0c44016475bf2e61.tar.xz | |
Statusbar handling fixes.
Fixes FS#9845 - %we/%wd wasnt working
WPS no longer resets the viewportmanger more than needed (was doing it twice/draw before)
screens can now enable/disable the statusbar easily ignoring the setting instead of needing special handling (fix for the radio screen coming soon)
minor glitch introduced in this commit... the statusbar in the WPS might disappear for a fraction of a second when it is entered, I need to track this down...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19894 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/debug_menu.c | 2 | ||||
| -rw-r--r-- | apps/gui/gwps-common.c | 39 | ||||
| -rw-r--r-- | apps/gui/gwps.c | 58 | ||||
| -rw-r--r-- | apps/gui/list.c | 2 | ||||
| -rw-r--r-- | apps/gui/viewport.c | 35 | ||||
| -rw-r--r-- | apps/gui/viewport.h | 13 | ||||
| -rw-r--r-- | apps/main.c | 2 | ||||
| -rw-r--r-- | apps/menu.c | 2 | ||||
| -rw-r--r-- | apps/menus/eq_menu.c | 2 | ||||
| -rw-r--r-- | apps/plugin.c | 6 | ||||
| -rw-r--r-- | apps/plugin.h | 6 | ||||
| -rw-r--r-- | apps/plugins/lib/oldmenuapi.c | 2 | ||||
| -rw-r--r-- | apps/plugins/star.c | 2 | ||||
| -rw-r--r-- | apps/recorder/keyboard.c | 2 | ||||
| -rw-r--r-- | apps/root_menu.c | 2 |
15 files changed, 91 insertions, 84 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 60f4761..d8fe49e 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -2739,7 +2739,7 @@ static int menu_action_callback(int btn, struct gui_synclist *lists) { if (btn == ACTION_STD_OK) { - bool oldbars = viewportmanager_set_statusbar(false); + char oldbars = viewportmanager_set_statusbar(0); menuitems[gui_synclist_get_sel_pos(lists)].function(); btn = ACTION_REDRAW; viewportmanager_set_statusbar(oldbars); diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index e07436e..2d65629 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -62,6 +62,7 @@ #endif #include "backdrop.h" #include "viewport.h" +#include "pcmbuf.h" #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ /* 3% of 30min file == 54s step size */ @@ -75,36 +76,6 @@ #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */ -/* draws the statusbar on the given wps-screen */ -#ifdef HAVE_LCD_BITMAP -static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force) -{ - (void)force; - bool draw = global_settings.statusbar; - - if (wps->data->wps_sb_tag) - draw = wps->data->show_sb_on_wps; - -#if NB_SCREENS > 1 - /* multi screen targets could show the bars on one screen but not both - * so the viewportmanager can't be used in its current form... - * Also, the WPS is a special screen so doing this is reasonable. - */ - if (draw) - { - struct gui_statusbar *bar; - bar = &statusbars.statusbars[wps->data->remote_wps?SCREEN_REMOTE:SCREEN_MAIN]; - gui_statusbar_draw(bar, force); - } -#else - viewportmanager_set_statusbar(draw); -#endif -} -#else -#define gui_wps_statusbar_draw(wps, force) viewportmanager_set_statusbar(true) -#endif -#include "pcmbuf.h" - /* fades the volume */ bool wps_fading_out = false; void fade(bool fade_in, bool updatewps) @@ -170,7 +141,6 @@ void fade(bool fade_in, bool updatewps) */ bool update_onvol_change(struct gui_wps * gwps) { - gui_wps_statusbar_draw(gwps, false); gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); #ifdef HAVE_LCD_CHARCELLS @@ -366,7 +336,6 @@ bool gui_wps_display(void) } #endif #endif - gui_wps[i].display->clear_display(); if (!gui_wps[i].data->wps_loaded) { if ( !gui_wps[i].data->num_tokens ) { @@ -481,8 +450,6 @@ bool update(struct gui_wps *gwps) gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); } - gui_wps_statusbar_draw(gwps, false); - return retcode; } @@ -1978,7 +1945,6 @@ bool gui_wps_refresh(struct gui_wps *gwps, bool update_line, new_subline_refresh; #ifdef HAVE_LCD_BITMAP - gui_wps_statusbar_draw(gwps, true); /* to find out wether the peak meter is enabled we assume it wasn't until we find a line that contains @@ -2195,7 +2161,8 @@ bool gui_wps_refresh(struct gui_wps *gwps, remote_backlight_on(); } #endif - + /* force a bars update if they are being displayed */ + viewportmanager_draw_statusbars(NULL); return true; } diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 6c387ef..1d8d725 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c @@ -115,8 +115,24 @@ static void next_track(void) audio_next(); } - - +static char fix_wps_bars(void) +{ +#ifdef HAVE_LCD_BITMAP + int i; + char wpsbars = 0; + FOR_NB_SCREENS(i) + { + bool draw = global_settings.statusbar; + if (gui_wps[i].data->wps_sb_tag) + draw = gui_wps[i].data->show_sb_on_wps; + if (draw) + wpsbars |= VP_IGNORE_SB_SETTING(i)|(1<<i); + } + return wpsbars; +#else + return 1; +#endif +} long gui_wps_show(void) { long button = 0; @@ -127,8 +143,8 @@ long gui_wps_show(void) bool update_track = false; int i; long last_left = 0, last_right = 0; + char wpsbars = 0, oldbars = 0; - viewportmanager_set_statusbar(false); wps_state_init(); #ifdef HAVE_LCD_CHARCELLS @@ -149,6 +165,7 @@ long gui_wps_show(void) ab_reset_markers(); #endif + oldbars = viewportmanager_set_statusbar(0); if(audio_status() & AUDIO_STATUS_PLAY) { wps_state.id3 = audio_current_track(); @@ -156,12 +173,13 @@ long gui_wps_show(void) if (wps_state.id3) { if (gui_wps_display()) return 0; - FOR_NB_SCREENS(i) - gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL); } restore = true; } + wpsbars = fix_wps_bars(); + viewportmanager_set_statusbar(wpsbars); + while ( 1 ) { bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false; @@ -259,20 +277,19 @@ long gui_wps_show(void) { case ACTION_WPS_CONTEXT: { - bool bars; #if LCD_DEPTH > 1 show_main_backdrop(); #endif #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 show_remote_main_backdrop(); #endif - bars = viewportmanager_set_statusbar(true); + viewportmanager_set_statusbar(oldbars); /* if music is stopped in the context menu we want to exit the wps */ if (onplay(wps_state.id3->path, FILE_ATTR_AUDIO, CONTEXT_WPS) == ONPLAY_MAINMENU || !audio_status()) return GO_TO_ROOT; - viewportmanager_set_statusbar(bars); + viewportmanager_set_statusbar(wpsbars); /* track might have changed */ update_track = true; @@ -527,7 +544,7 @@ long gui_wps_show(void) #ifdef HAVE_QUICKSCREEN case ACTION_WPS_QUICKSCREEN: { - bool bars = viewportmanager_set_statusbar(true); + viewportmanager_set_statusbar(oldbars); #if LCD_DEPTH > 1 show_main_backdrop(); #endif @@ -536,7 +553,8 @@ long gui_wps_show(void) #endif if (quick_screen_quick(button)) return SYS_USB_CONNECTED; - viewportmanager_set_statusbar(bars); + wpsbars = fix_wps_bars(); + viewportmanager_set_statusbar(wpsbars); #if LCD_DEPTH > 1 show_wps_backdrop(); #endif @@ -552,7 +570,7 @@ long gui_wps_show(void) #ifdef BUTTON_F3 case ACTION_F3: { - bool bars = viewportmanager_set_statusbar(true); + viewportmanager_set_statusbar(oldbars); #if LCD_DEPTH > 1 show_main_backdrop(); #endif @@ -562,7 +580,8 @@ long gui_wps_show(void) if (quick_screen_f3(BUTTON_F3)) return SYS_USB_CONNECTED; restore = true; - viewportmanager_set_statusbar(bars); + wpsbars = fix_wps_bars(); + viewportmanager_set_statusbar(wpsbars); } break; #endif /* BUTTON_F3 */ @@ -571,7 +590,7 @@ long gui_wps_show(void) #ifdef HAVE_PITCHSCREEN case ACTION_WPS_PITCHSCREEN: { - bool bars = viewportmanager_set_statusbar(true); + viewportmanager_set_statusbar(oldbars); #if LCD_DEPTH > 1 show_main_backdrop(); #endif @@ -587,7 +606,7 @@ long gui_wps_show(void) show_remote_wps_backdrop(); #endif restore = true; - viewportmanager_set_statusbar(bars); + viewportmanager_set_statusbar(wpsbars); } break; #endif /* HAVE_PITCHSCREEN */ @@ -613,7 +632,7 @@ long gui_wps_show(void) case ACTION_WPS_ID3SCREEN: { - bool bars = viewportmanager_set_statusbar(true); + viewportmanager_set_statusbar(oldbars); #if LCD_DEPTH > 1 show_main_backdrop(); #endif @@ -628,7 +647,7 @@ long gui_wps_show(void) show_remote_wps_backdrop(); #endif restore = true; - viewportmanager_set_statusbar(bars); + viewportmanager_set_statusbar(wpsbars); } break; @@ -645,7 +664,7 @@ long gui_wps_show(void) break; #endif case SYS_POWEROFF: - viewportmanager_set_statusbar(true); + viewportmanager_set_statusbar(oldbars); #if LCD_DEPTH > 1 show_main_backdrop(); #endif @@ -681,13 +700,10 @@ long gui_wps_show(void) if (gui_wps_display()) { exit = true; } - else if (wps_state.id3){ - FOR_NB_SCREENS(i) - gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC); - } } if (exit) { + viewportmanager_set_statusbar(oldbars); #ifdef HAVE_LCD_CHARCELLS status_set_record(false); status_set_audio(false); diff --git a/apps/gui/list.c b/apps/gui/list.c index 2107d3a..7b8c297 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -845,7 +845,7 @@ bool simplelist_show_list(struct simplelist_info *info) { struct gui_synclist lists; int action, old_line_count = simplelist_line_count; - bool oldbars = viewportmanager_set_statusbar(true); + char oldbars = viewportmanager_set_statusbar(VP_ALLSCREENS); char* (*getname)(int item, void * data, char *buffer, size_t buffer_len); int wrap = LIST_WRAP_UNLESS_HELD; if (info->get_name) diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index 24ba652..3854430 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -35,7 +35,7 @@ #include "screen_access.h" #include "appevents.h" -static bool statusbar_enabled = true; +static char statusbar_enabled = VP_ALLSCREENS; int viewport_get_nb_lines(struct viewport *vp) { @@ -47,13 +47,19 @@ int viewport_get_nb_lines(struct viewport *vp) #endif } +static bool showing_bars(enum screen_type screen) +{ + if (statusbar_enabled&(1<<screen)) + return global_settings.statusbar || (statusbar_enabled&(1<<(screen+4))); + return false; +} void viewport_set_defaults(struct viewport *vp, enum screen_type screen) { vp->x = 0; vp->width = screens[screen].lcdwidth; - vp->y = statusbar_enabled?gui_statusbar_height():0; + vp->y = showing_bars(screen)?gui_statusbar_height():0; vp->height = screens[screen].lcdheight - vp->y; #ifdef HAVE_LCD_BITMAP vp->drawmode = DRMODE_SOLID; @@ -87,17 +93,18 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen) } /* returns true if it was enabled BEFORE this call */ -bool viewportmanager_set_statusbar(bool enabled) +char viewportmanager_set_statusbar(char enabled) { - bool old = statusbar_enabled; - if (enabled -#ifdef HAVE_LCD_BITMAP - && global_settings.statusbar -#endif - ) + char old = statusbar_enabled; + if (enabled) { + int i; + FOR_NB_SCREENS(i) + { + if (showing_bars(i)) + gui_statusbar_draw(&statusbars.statusbars[i], true); + } add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_draw_statusbars); - gui_syncstatusbar_draw(&statusbars, true); } else { @@ -110,8 +117,12 @@ bool viewportmanager_set_statusbar(bool enabled) void viewportmanager_draw_statusbars(void* data) { (void)data; - if (statusbar_enabled) - gui_syncstatusbar_draw(&statusbars, false); + int i; + FOR_NB_SCREENS(i) + { + if (showing_bars(i)) + gui_statusbar_draw(&statusbars.statusbars[i], false); + } } void viewportmanager_statusbar_changed(void* data) diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h index 53f5223..0274852 100644 --- a/apps/gui/viewport.h +++ b/apps/gui/viewport.h @@ -41,7 +41,18 @@ int viewport_load_config(const char *config, struct viewport *vp); void viewport_set_defaults(struct viewport *vp, enum screen_type screen); -bool viewportmanager_set_statusbar(bool enabled); +/* viewportmanager_set_statusbar() is used to specify which screens the statusbar + * should be displayed on. + * *usually* enabled will be VP_ALLSCREENS which means display the bar if the setting + * is enabled. (and it will be on both screens) + * For the WPS (and other possible exceptions) use VP_IGNORE_SB_SETTING() to + * FORCE the statusbar on for the given screen (i.e it will show regardless of the setting + */ +#define VP_SB_ONSCREEN(screen) (1<<screen) /* turn the SB on "screen" only */ +#define VP_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1)) /* SB on for both screens */ +#define VP_IGNORE_SB_SETTING(screen) (1<<(4+screen)) +char viewportmanager_set_statusbar(char enabled); + /* callbacks for GUI_EVENT_* events */ void viewportmanager_draw_statusbars(void*data); void viewportmanager_statusbar_changed(void* data); diff --git a/apps/main.c b/apps/main.c index 8a1f0a9..89896ce 100644 --- a/apps/main.c +++ b/apps/main.c @@ -138,7 +138,7 @@ static void app_main(void) #ifdef HAVE_TOUCHSCREEN touchscreen_set_mode(TOUCHSCREEN_BUTTON); #endif - viewportmanager_set_statusbar(true); + viewportmanager_set_statusbar(VP_ALLSCREENS); add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, viewportmanager_statusbar_changed); #ifdef HAVE_USBSTACK diff --git a/apps/menu.c b/apps/menu.c index 419db3a..2ba6cb4 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -355,7 +355,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, const struct menu_item_ex *temp, *menu; int ret = 0, i; bool redraw_lists; - bool oldbars = viewportmanager_set_statusbar(!hide_bars); + char oldbars = viewportmanager_set_statusbar(hide_bars?0:VP_ALLSCREENS); const struct menu_item_ex *menu_stack[MAX_MENUS]; int menu_stack_selected_item[MAX_MENUS]; diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index 28df083..89c0e31 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c @@ -392,7 +392,7 @@ bool eq_menu_graphical(void) enum eq_type current_type; char buf[24]; int i, w, h, height, start_item, nb_eq_sliders[NB_SCREENS]; - bool barsenabled = viewportmanager_set_statusbar(false); + char barsenabled = viewportmanager_set_statusbar(0); FOR_NB_SCREENS(i) { diff --git a/apps/plugin.c b/apps/plugin.c index 98bbd29..95dec9d 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -636,7 +636,7 @@ static const struct plugin_api rockbox_api = { int plugin_load(const char* plugin, const void* parameter) { int rc; - bool oldbars; + char oldbars; struct plugin_header *hdr; #ifdef SIMULATOR void *pd; @@ -743,11 +743,11 @@ int plugin_load(const char* plugin, const void* parameter) #endif invalidate_icache(); - oldbars = viewportmanager_set_statusbar(false); + oldbars = viewportmanager_set_statusbar(0); rc = hdr->entry_point(parameter); - viewportmanager_set_statusbar(true); + viewportmanager_set_statusbar(oldbars); button_clear_queue(); diff --git a/apps/plugin.h b/apps/plugin.h index 97c3087..05e4db0 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -126,12 +126,12 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 139 +#define PLUGIN_API_VERSION 140 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 137 +#define PLUGIN_MIN_API_VERSION 140 /* plugin return codes */ enum plugin_status { @@ -312,7 +312,7 @@ struct plugin_api { int height); #endif void (*viewport_set_defaults)(struct viewport *vp, enum screen_type screen); - bool (*viewportmanager_set_statusbar)(bool enabled); + char (*viewportmanager_set_statusbar)(char enabled); /* list */ void (*gui_synclist_init)(struct gui_synclist * lists, list_get_name callback_get_item_name, void * data, diff --git a/apps/plugins/lib/oldmenuapi.c b/apps/plugins/lib/oldmenuapi.c index 9c371d5..864291f 100644 --- a/apps/plugins/lib/oldmenuapi.c +++ b/apps/plugins/lib/oldmenuapi.c @@ -94,6 +94,7 @@ int menu_show(int m) bool exit = false; int key; + char bars = rb->viewportmanager_set_statusbar(VP_ALLSCREENS); rb->gui_synclist_draw(&(menus[m].synclist)); while (!exit) { key = rb->get_action(CONTEXT_MAINMENU,HZ/2); @@ -123,6 +124,7 @@ int menu_show(int m) break; } } + rb->viewportmanager_set_statusbar(bars); return MENU_SELECTED_EXIT; } diff --git a/apps/plugins/star.c b/apps/plugins/star.c index 9311613..c4251cd 100644 --- a/apps/plugins/star.c +++ b/apps/plugins/star.c @@ -1030,7 +1030,7 @@ static int star_menu(void) } while(!menu_quit) { - switch(rb->do_menu(&menu, &selection, vp, true)) + switch(rb->do_menu(&menu, &selection, vp, false)) { case 0: menu_quit = true; diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index c7e8ad8..a5e093d 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c @@ -298,7 +298,7 @@ int kbd_input(char* text, int buflen) int morse_tick = 0; char buf[2]; #endif - bool oldbars = viewportmanager_set_statusbar(false); + char oldbars = viewportmanager_set_statusbar(0); FOR_NB_SCREENS(l) { struct keyboard_parameters *pm = ¶m[l]; diff --git a/apps/root_menu.c b/apps/root_menu.c index 5c4abf6..78f5d51 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -270,7 +270,7 @@ static int wpsscrn(void* param) show_remote_main_backdrop(); #endif /* always re-enable the statusbar after the WPS */ - viewportmanager_set_statusbar(true); + viewportmanager_set_statusbar(VP_ALLSCREENS); return ret_val; } #if CONFIG_TUNER |