Accept a quick patch from Alexander Levin to neaten up the #defines and comments from my earlier commit

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19897 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2009-02-01 13:43:08 +00:00
parent ee8c479dff
commit 036fb05dfd
13 changed files with 52 additions and 36 deletions

View file

@ -115,24 +115,25 @@ static void next_track(void)
audio_next();
}
static char fix_wps_bars(void)
static int fix_wps_bars(void)
{
#ifdef HAVE_LCD_BITMAP
int i;
char wpsbars = 0;
int wpsbars = VP_SB_HIDE_ALL;
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);
wpsbars |= (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
}
return wpsbars;
#else
return 1;
return VP_SB_ALLSCREENS;
#endif
}
long gui_wps_show(void)
{
long button = 0;
@ -143,7 +144,7 @@ long gui_wps_show(void)
bool update_track = false;
int i;
long last_left = 0, last_right = 0;
char wpsbars = 0, oldbars = 0;
int wpsbars, oldbars;
wps_state_init();
@ -165,7 +166,7 @@ long gui_wps_show(void)
ab_reset_markers();
#endif
oldbars = viewportmanager_set_statusbar(0);
oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
if(audio_status() & AUDIO_STATUS_PLAY)
{
wps_state.id3 = audio_current_track();

View file

@ -845,7 +845,7 @@ bool simplelist_show_list(struct simplelist_info *info)
{
struct gui_synclist lists;
int action, old_line_count = simplelist_line_count;
char oldbars = viewportmanager_set_statusbar(VP_ALLSCREENS);
int oldbars = viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
char* (*getname)(int item, void * data, char *buffer, size_t buffer_len);
int wrap = LIST_WRAP_UNLESS_HELD;
if (info->get_name)

View file

@ -35,7 +35,7 @@
#include "screen_access.h"
#include "appevents.h"
static char statusbar_enabled = VP_ALLSCREENS;
static int statusbar_enabled = VP_SB_ALLSCREENS;
int viewport_get_nb_lines(struct viewport *vp)
{
@ -49,8 +49,9 @@ int viewport_get_nb_lines(struct viewport *vp)
static bool showing_bars(enum screen_type screen)
{
if (statusbar_enabled&(1<<screen))
return global_settings.statusbar || (statusbar_enabled&(1<<(screen+4)));
if (statusbar_enabled & VP_SB_ONSCREEN(screen))
return global_settings.statusbar ||
(statusbar_enabled & VP_SB_IGNORE_SETTING(screen));
return false;
}
@ -92,10 +93,10 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
#endif
}
/* returns true if it was enabled BEFORE this call */
char viewportmanager_set_statusbar(char enabled)
int viewportmanager_set_statusbar(int enabled)
{
char old = statusbar_enabled;
int old = statusbar_enabled;
if (enabled)
{
int i;

View file

@ -41,19 +41,32 @@ int viewport_load_config(const char *config, struct viewport *vp);
void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
/* 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
/* Used to specify which screens the statusbar (SB) should be displayed on.
*
* The parameter is a bit OR'ed combination of the following (screen is
* SCREEN_MAIN or SCREEN_REMOTE from screen_access.h):
*
* VP_SB_HIDE_ALL means "hide the SB on all screens"
* VP_SB_ONSCREEN(screen) means "display the SB on the given screen
* as specified by the SB setting for that screen"
* VP_SB_IGNORE_SETTING(screen) means "ignore the SB setting for that screen"
* VP_SB_ALLSCREENS means "VP_SB_ONSCREEN for all screens"
*
* In most cases, VP_SB_ALLSCREENS should be used which means display the SB
* as specified by the settings.
* For the WPS (and other possible exceptions) use VP_SB_IGNORE_SETTING() to
* FORCE the statusbar on for the given screen (i.e it will show regardless
* of the setting)
*
* Returns the status before the call. This value can be used to restore the
* SB "displaying rules".
*/
#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);
#define VP_SB_HIDE_ALL 0
#define VP_SB_ONSCREEN(screen) (1<<screen)
#define VP_SB_IGNORE_SETTING(screen) (1<<(4+screen))
#define VP_SB_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1))
int viewportmanager_set_statusbar(int enabled);
/* callbacks for GUI_EVENT_* events */
void viewportmanager_draw_statusbars(void*data);
void viewportmanager_statusbar_changed(void* data);