summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/debug_menu.c2
-rw-r--r--apps/gui/gwps.c13
-rw-r--r--apps/gui/list.c2
-rw-r--r--apps/gui/viewport.c13
-rw-r--r--apps/gui/viewport.h35
-rw-r--r--apps/main.c2
-rw-r--r--apps/menu.c3
-rw-r--r--apps/menus/eq_menu.c2
-rw-r--r--apps/plugin.c4
-rw-r--r--apps/plugin.h6
-rw-r--r--apps/plugins/lib/oldmenuapi.c2
-rw-r--r--apps/recorder/keyboard.c2
-rw-r--r--apps/root_menu.c2
13 files changed, 52 insertions, 36 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index d8fe49e5ac..ca1085d67e 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)
{
- char oldbars = viewportmanager_set_statusbar(0);
+ int oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
menuitems[gui_synclist_get_sel_pos(lists)].function();
btn = ACTION_REDRAW;
viewportmanager_set_statusbar(oldbars);
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 1d8d7255bf..7ba9862895 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -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();
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 7b8c2975c1..2923ec33c4 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;
- 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)
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 3f3729116b..dbf9cc4e73 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -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;
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h
index 02748527a4..9d5237bd28 100644
--- a/apps/gui/viewport.h
+++ b/apps/gui/viewport.h
@@ -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);
-
diff --git a/apps/main.c b/apps/main.c
index 89896ce398..94a9231d7f 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(VP_ALLSCREENS);
+ viewportmanager_set_statusbar(VP_SB_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 2ba6cb4d35..b6d95a57d1 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -355,7 +355,8 @@ 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;
- 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];
int menu_stack_selected_item[MAX_MENUS];
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index 89c0e31128..1b386816c2 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];
- char barsenabled = viewportmanager_set_statusbar(0);
+ int barsenabled = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
FOR_NB_SCREENS(i) {
diff --git a/apps/plugin.c b/apps/plugin.c
index 95dec9d767..8828d10aa7 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;
- char oldbars;
+ int oldbars;
struct plugin_header *hdr;
#ifdef SIMULATOR
void *pd;
@@ -743,7 +743,7 @@ int plugin_load(const char* plugin, const void* parameter)
#endif
invalidate_icache();
- oldbars = viewportmanager_set_statusbar(0);
+ oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
rc = hdr->entry_point(parameter);
diff --git a/apps/plugin.h b/apps/plugin.h
index 05e4db00a9..2017bf3e5b 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 140
+#define PLUGIN_API_VERSION 141
/* 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 140
+#define PLUGIN_MIN_API_VERSION 141
/* 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);
- char (*viewportmanager_set_statusbar)(char enabled);
+ int (*viewportmanager_set_statusbar)(int enable_status);
/* 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 864291fd4d..f14edabd38 100644
--- a/apps/plugins/lib/oldmenuapi.c
+++ b/apps/plugins/lib/oldmenuapi.c
@@ -94,7 +94,7 @@ int menu_show(int m)
bool exit = false;
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));
while (!exit) {
key = rb->get_action(CONTEXT_MAINMENU,HZ/2);
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index a5e093d541..02b1759a8a 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
- char oldbars = viewportmanager_set_statusbar(0);
+ char oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
FOR_NB_SCREENS(l)
{
struct keyboard_parameters *pm = &param[l];
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 78f5d514b2..8c88375d1a 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(VP_ALLSCREENS);
+ viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
return ret_val;
}
#if CONFIG_TUNER