mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
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:
parent
ee8c479dff
commit
036fb05dfd
13 changed files with 52 additions and 36 deletions
|
@ -2739,7 +2739,7 @@ static int menu_action_callback(int btn, struct gui_synclist *lists)
|
||||||
{
|
{
|
||||||
if (btn == ACTION_STD_OK)
|
if (btn == ACTION_STD_OK)
|
||||||
{
|
{
|
||||||
char oldbars = viewportmanager_set_statusbar(0);
|
int oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
|
||||||
menuitems[gui_synclist_get_sel_pos(lists)].function();
|
menuitems[gui_synclist_get_sel_pos(lists)].function();
|
||||||
btn = ACTION_REDRAW;
|
btn = ACTION_REDRAW;
|
||||||
viewportmanager_set_statusbar(oldbars);
|
viewportmanager_set_statusbar(oldbars);
|
||||||
|
|
|
@ -115,24 +115,25 @@ static void next_track(void)
|
||||||
|
|
||||||
audio_next();
|
audio_next();
|
||||||
}
|
}
|
||||||
static char fix_wps_bars(void)
|
static int fix_wps_bars(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
int i;
|
int i;
|
||||||
char wpsbars = 0;
|
int wpsbars = VP_SB_HIDE_ALL;
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
bool draw = global_settings.statusbar;
|
bool draw = global_settings.statusbar;
|
||||||
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;
|
||||||
if (draw)
|
if (draw)
|
||||||
wpsbars |= VP_IGNORE_SB_SETTING(i)|(1<<i);
|
wpsbars |= (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
|
||||||
}
|
}
|
||||||
return wpsbars;
|
return wpsbars;
|
||||||
#else
|
#else
|
||||||
return 1;
|
return VP_SB_ALLSCREENS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
long gui_wps_show(void)
|
long gui_wps_show(void)
|
||||||
{
|
{
|
||||||
long button = 0;
|
long button = 0;
|
||||||
|
@ -143,7 +144,7 @@ long gui_wps_show(void)
|
||||||
bool update_track = false;
|
bool update_track = false;
|
||||||
int i;
|
int i;
|
||||||
long last_left = 0, last_right = 0;
|
long last_left = 0, last_right = 0;
|
||||||
char wpsbars = 0, oldbars = 0;
|
int wpsbars, oldbars;
|
||||||
|
|
||||||
wps_state_init();
|
wps_state_init();
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@ long gui_wps_show(void)
|
||||||
ab_reset_markers();
|
ab_reset_markers();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
oldbars = viewportmanager_set_statusbar(0);
|
oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
|
||||||
if(audio_status() & AUDIO_STATUS_PLAY)
|
if(audio_status() & AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
wps_state.id3 = audio_current_track();
|
wps_state.id3 = audio_current_track();
|
||||||
|
|
|
@ -845,7 +845,7 @@ bool simplelist_show_list(struct simplelist_info *info)
|
||||||
{
|
{
|
||||||
struct gui_synclist lists;
|
struct gui_synclist lists;
|
||||||
int action, old_line_count = simplelist_line_count;
|
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);
|
char* (*getname)(int item, void * data, char *buffer, size_t buffer_len);
|
||||||
int wrap = LIST_WRAP_UNLESS_HELD;
|
int wrap = LIST_WRAP_UNLESS_HELD;
|
||||||
if (info->get_name)
|
if (info->get_name)
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include "screen_access.h"
|
#include "screen_access.h"
|
||||||
#include "appevents.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)
|
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)
|
static bool showing_bars(enum screen_type screen)
|
||||||
{
|
{
|
||||||
if (statusbar_enabled&(1<<screen))
|
if (statusbar_enabled & VP_SB_ONSCREEN(screen))
|
||||||
return global_settings.statusbar || (statusbar_enabled&(1<<(screen+4)));
|
return global_settings.statusbar ||
|
||||||
|
(statusbar_enabled & VP_SB_IGNORE_SETTING(screen));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,10 +93,10 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
|
||||||
#endif
|
#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)
|
if (enabled)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -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);
|
void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
|
||||||
|
|
||||||
/* viewportmanager_set_statusbar() is used to specify which screens the statusbar
|
/* Used to specify which screens the statusbar (SB) should be displayed on.
|
||||||
* should be displayed on.
|
*
|
||||||
* *usually* enabled will be VP_ALLSCREENS which means display the bar if the setting
|
* The parameter is a bit OR'ed combination of the following (screen is
|
||||||
* is enabled. (and it will be on both screens)
|
* SCREEN_MAIN or SCREEN_REMOTE from screen_access.h):
|
||||||
* 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
|
* 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_SB_HIDE_ALL 0
|
||||||
#define VP_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1)) /* SB on for both screens */
|
#define VP_SB_ONSCREEN(screen) (1<<screen)
|
||||||
#define VP_IGNORE_SB_SETTING(screen) (1<<(4+screen))
|
#define VP_SB_IGNORE_SETTING(screen) (1<<(4+screen))
|
||||||
char viewportmanager_set_statusbar(char enabled);
|
#define VP_SB_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1))
|
||||||
|
int viewportmanager_set_statusbar(int enabled);
|
||||||
|
|
||||||
/* callbacks for GUI_EVENT_* events */
|
/* callbacks for GUI_EVENT_* events */
|
||||||
void viewportmanager_draw_statusbars(void*data);
|
void viewportmanager_draw_statusbars(void*data);
|
||||||
void viewportmanager_statusbar_changed(void* data);
|
void viewportmanager_statusbar_changed(void* data);
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ static void app_main(void)
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
touchscreen_set_mode(TOUCHSCREEN_BUTTON);
|
touchscreen_set_mode(TOUCHSCREEN_BUTTON);
|
||||||
#endif
|
#endif
|
||||||
viewportmanager_set_statusbar(VP_ALLSCREENS);
|
viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
|
||||||
add_event(GUI_EVENT_STATUSBAR_TOGGLE, false,
|
add_event(GUI_EVENT_STATUSBAR_TOGGLE, false,
|
||||||
viewportmanager_statusbar_changed);
|
viewportmanager_statusbar_changed);
|
||||||
#ifdef HAVE_USBSTACK
|
#ifdef HAVE_USBSTACK
|
||||||
|
|
|
@ -355,7 +355,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
||||||
const struct menu_item_ex *temp, *menu;
|
const struct menu_item_ex *temp, *menu;
|
||||||
int ret = 0, i;
|
int ret = 0, i;
|
||||||
bool redraw_lists;
|
bool redraw_lists;
|
||||||
char oldbars = viewportmanager_set_statusbar(hide_bars?0:VP_ALLSCREENS);
|
int oldbars = viewportmanager_set_statusbar(
|
||||||
|
hide_bars ? VP_SB_HIDE_ALL : VP_SB_ALLSCREENS);
|
||||||
|
|
||||||
const struct menu_item_ex *menu_stack[MAX_MENUS];
|
const struct menu_item_ex *menu_stack[MAX_MENUS];
|
||||||
int menu_stack_selected_item[MAX_MENUS];
|
int menu_stack_selected_item[MAX_MENUS];
|
||||||
|
|
|
@ -392,7 +392,7 @@ bool eq_menu_graphical(void)
|
||||||
enum eq_type current_type;
|
enum eq_type current_type;
|
||||||
char buf[24];
|
char buf[24];
|
||||||
int i, w, h, height, start_item, nb_eq_sliders[NB_SCREENS];
|
int i, w, h, height, start_item, nb_eq_sliders[NB_SCREENS];
|
||||||
char barsenabled = viewportmanager_set_statusbar(0);
|
int barsenabled = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
|
||||||
|
|
||||||
|
|
||||||
FOR_NB_SCREENS(i) {
|
FOR_NB_SCREENS(i) {
|
||||||
|
|
|
@ -636,7 +636,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
int plugin_load(const char* plugin, const void* parameter)
|
int plugin_load(const char* plugin, const void* parameter)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char oldbars;
|
int oldbars;
|
||||||
struct plugin_header *hdr;
|
struct plugin_header *hdr;
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
void *pd;
|
void *pd;
|
||||||
|
@ -743,7 +743,7 @@ int plugin_load(const char* plugin, const void* parameter)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
invalidate_icache();
|
invalidate_icache();
|
||||||
oldbars = viewportmanager_set_statusbar(0);
|
oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
|
||||||
|
|
||||||
rc = hdr->entry_point(parameter);
|
rc = hdr->entry_point(parameter);
|
||||||
|
|
||||||
|
|
|
@ -126,12 +126,12 @@ void* plugin_get_buffer(size_t *buffer_size);
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 140
|
#define PLUGIN_API_VERSION 141
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
new function which are "waiting" at the end of the function table) */
|
new function which are "waiting" at the end of the function table) */
|
||||||
#define PLUGIN_MIN_API_VERSION 140
|
#define PLUGIN_MIN_API_VERSION 141
|
||||||
|
|
||||||
/* plugin return codes */
|
/* plugin return codes */
|
||||||
enum plugin_status {
|
enum plugin_status {
|
||||||
|
@ -312,7 +312,7 @@ struct plugin_api {
|
||||||
int height);
|
int height);
|
||||||
#endif
|
#endif
|
||||||
void (*viewport_set_defaults)(struct viewport *vp, enum screen_type screen);
|
void (*viewport_set_defaults)(struct viewport *vp, enum screen_type screen);
|
||||||
char (*viewportmanager_set_statusbar)(char enabled);
|
int (*viewportmanager_set_statusbar)(int enable_status);
|
||||||
/* list */
|
/* list */
|
||||||
void (*gui_synclist_init)(struct gui_synclist * lists,
|
void (*gui_synclist_init)(struct gui_synclist * lists,
|
||||||
list_get_name callback_get_item_name, void * data,
|
list_get_name callback_get_item_name, void * data,
|
||||||
|
|
|
@ -94,7 +94,7 @@ int menu_show(int m)
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
char bars = rb->viewportmanager_set_statusbar(VP_ALLSCREENS);
|
int bars = rb->viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
|
||||||
rb->gui_synclist_draw(&(menus[m].synclist));
|
rb->gui_synclist_draw(&(menus[m].synclist));
|
||||||
while (!exit) {
|
while (!exit) {
|
||||||
key = rb->get_action(CONTEXT_MAINMENU,HZ/2);
|
key = rb->get_action(CONTEXT_MAINMENU,HZ/2);
|
||||||
|
|
|
@ -298,7 +298,7 @@ int kbd_input(char* text, int buflen)
|
||||||
int morse_tick = 0;
|
int morse_tick = 0;
|
||||||
char buf[2];
|
char buf[2];
|
||||||
#endif
|
#endif
|
||||||
char oldbars = viewportmanager_set_statusbar(0);
|
char oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
|
||||||
FOR_NB_SCREENS(l)
|
FOR_NB_SCREENS(l)
|
||||||
{
|
{
|
||||||
struct keyboard_parameters *pm = ¶m[l];
|
struct keyboard_parameters *pm = ¶m[l];
|
||||||
|
|
|
@ -270,7 +270,7 @@ static int wpsscrn(void* param)
|
||||||
show_remote_main_backdrop();
|
show_remote_main_backdrop();
|
||||||
#endif
|
#endif
|
||||||
/* always re-enable the statusbar after the WPS */
|
/* always re-enable the statusbar after the WPS */
|
||||||
viewportmanager_set_statusbar(VP_ALLSCREENS);
|
viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
#if CONFIG_TUNER
|
#if CONFIG_TUNER
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue