summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-02-01 13:43:08 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-02-01 13:43:08 +0000
commit036fb05dfdfb98615bf4f8841b8f8b0a1bbfb8d1 (patch)
tree406697049f3b4f1176948b5eaf9d3cb2a30dd0ff
parentee8c479dff7f4eb208901dc1da38a79cbd588414 (diff)
downloadrockbox-036fb05dfdfb98615bf4f8841b8f8b0a1bbfb8d1.tar.gz
rockbox-036fb05dfdfb98615bf4f8841b8f8b0a1bbfb8d1.zip
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
-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)
2739{ 2739{
2740 if (btn == ACTION_STD_OK) 2740 if (btn == ACTION_STD_OK)
2741 { 2741 {
2742 char oldbars = viewportmanager_set_statusbar(0); 2742 int oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
2743 menuitems[gui_synclist_get_sel_pos(lists)].function(); 2743 menuitems[gui_synclist_get_sel_pos(lists)].function();
2744 btn = ACTION_REDRAW; 2744 btn = ACTION_REDRAW;
2745 viewportmanager_set_statusbar(oldbars); 2745 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)
115 115
116 audio_next(); 116 audio_next();
117} 117}
118static char fix_wps_bars(void) 118static int fix_wps_bars(void)
119{ 119{
120#ifdef HAVE_LCD_BITMAP 120#ifdef HAVE_LCD_BITMAP
121 int i; 121 int i;
122 char wpsbars = 0; 122 int wpsbars = VP_SB_HIDE_ALL;
123 FOR_NB_SCREENS(i) 123 FOR_NB_SCREENS(i)
124 { 124 {
125 bool draw = global_settings.statusbar; 125 bool draw = global_settings.statusbar;
126 if (gui_wps[i].data->wps_sb_tag) 126 if (gui_wps[i].data->wps_sb_tag)
127 draw = gui_wps[i].data->show_sb_on_wps; 127 draw = gui_wps[i].data->show_sb_on_wps;
128 if (draw) 128 if (draw)
129 wpsbars |= VP_IGNORE_SB_SETTING(i)|(1<<i); 129 wpsbars |= (VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
130 } 130 }
131 return wpsbars; 131 return wpsbars;
132#else 132#else
133 return 1; 133 return VP_SB_ALLSCREENS;
134#endif 134#endif
135} 135}
136
136long gui_wps_show(void) 137long gui_wps_show(void)
137{ 138{
138 long button = 0; 139 long button = 0;
@@ -143,7 +144,7 @@ long gui_wps_show(void)
143 bool update_track = false; 144 bool update_track = false;
144 int i; 145 int i;
145 long last_left = 0, last_right = 0; 146 long last_left = 0, last_right = 0;
146 char wpsbars = 0, oldbars = 0; 147 int wpsbars, oldbars;
147 148
148 wps_state_init(); 149 wps_state_init();
149 150
@@ -165,7 +166,7 @@ long gui_wps_show(void)
165 ab_reset_markers(); 166 ab_reset_markers();
166#endif 167#endif
167 168
168 oldbars = viewportmanager_set_statusbar(0); 169 oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
169 if(audio_status() & AUDIO_STATUS_PLAY) 170 if(audio_status() & AUDIO_STATUS_PLAY)
170 { 171 {
171 wps_state.id3 = audio_current_track(); 172 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)
845{ 845{
846 struct gui_synclist lists; 846 struct gui_synclist lists;
847 int action, old_line_count = simplelist_line_count; 847 int action, old_line_count = simplelist_line_count;
848 char oldbars = viewportmanager_set_statusbar(VP_ALLSCREENS); 848 int oldbars = viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
849 char* (*getname)(int item, void * data, char *buffer, size_t buffer_len); 849 char* (*getname)(int item, void * data, char *buffer, size_t buffer_len);
850 int wrap = LIST_WRAP_UNLESS_HELD; 850 int wrap = LIST_WRAP_UNLESS_HELD;
851 if (info->get_name) 851 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 @@
35#include "screen_access.h" 35#include "screen_access.h"
36#include "appevents.h" 36#include "appevents.h"
37 37
38static char statusbar_enabled = VP_ALLSCREENS; 38static int statusbar_enabled = VP_SB_ALLSCREENS;
39 39
40int viewport_get_nb_lines(struct viewport *vp) 40int viewport_get_nb_lines(struct viewport *vp)
41{ 41{
@@ -49,8 +49,9 @@ int viewport_get_nb_lines(struct viewport *vp)
49 49
50static bool showing_bars(enum screen_type screen) 50static bool showing_bars(enum screen_type screen)
51{ 51{
52 if (statusbar_enabled&(1<<screen)) 52 if (statusbar_enabled & VP_SB_ONSCREEN(screen))
53 return global_settings.statusbar || (statusbar_enabled&(1<<(screen+4))); 53 return global_settings.statusbar ||
54 (statusbar_enabled & VP_SB_IGNORE_SETTING(screen));
54 return false; 55 return false;
55} 56}
56 57
@@ -92,10 +93,10 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
92#endif 93#endif
93} 94}
94 95
95/* returns true if it was enabled BEFORE this call */ 96
96char viewportmanager_set_statusbar(char enabled) 97int viewportmanager_set_statusbar(int enabled)
97{ 98{
98 char old = statusbar_enabled; 99 int old = statusbar_enabled;
99 if (enabled) 100 if (enabled)
100 { 101 {
101 int i; 102 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);
41 41
42void viewport_set_defaults(struct viewport *vp, enum screen_type screen); 42void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
43 43
44/* viewportmanager_set_statusbar() is used to specify which screens the statusbar 44/* Used to specify which screens the statusbar (SB) should be displayed on.
45 * should be displayed on. 45 *
46 * *usually* enabled will be VP_ALLSCREENS which means display the bar if the setting 46 * The parameter is a bit OR'ed combination of the following (screen is
47 * is enabled. (and it will be on both screens) 47 * SCREEN_MAIN or SCREEN_REMOTE from screen_access.h):
48 * For the WPS (and other possible exceptions) use VP_IGNORE_SB_SETTING() to 48 *
49 * FORCE the statusbar on for the given screen (i.e it will show regardless of the setting 49 * VP_SB_HIDE_ALL means "hide the SB on all screens"
50 * VP_SB_ONSCREEN(screen) means "display the SB on the given screen
51 * as specified by the SB setting for that screen"
52 * VP_SB_IGNORE_SETTING(screen) means "ignore the SB setting for that screen"
53 * VP_SB_ALLSCREENS means "VP_SB_ONSCREEN for all screens"
54 *
55 * In most cases, VP_SB_ALLSCREENS should be used which means display the SB
56 * as specified by the settings.
57 * For the WPS (and other possible exceptions) use VP_SB_IGNORE_SETTING() to
58 * FORCE the statusbar on for the given screen (i.e it will show regardless
59 * of the setting)
60 *
61 * Returns the status before the call. This value can be used to restore the
62 * SB "displaying rules".
50 */ 63 */
51#define VP_SB_ONSCREEN(screen) (1<<screen) /* turn the SB on "screen" only */ 64#define VP_SB_HIDE_ALL 0
52#define VP_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1)) /* SB on for both screens */ 65#define VP_SB_ONSCREEN(screen) (1<<screen)
53#define VP_IGNORE_SB_SETTING(screen) (1<<(4+screen)) 66#define VP_SB_IGNORE_SETTING(screen) (1<<(4+screen))
54char viewportmanager_set_statusbar(char enabled); 67#define VP_SB_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1))
68int viewportmanager_set_statusbar(int enabled);
55 69
56/* callbacks for GUI_EVENT_* events */ 70/* callbacks for GUI_EVENT_* events */
57void viewportmanager_draw_statusbars(void*data); 71void viewportmanager_draw_statusbars(void*data);
58void viewportmanager_statusbar_changed(void* data); 72void viewportmanager_statusbar_changed(void* data);
59
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)
138#ifdef HAVE_TOUCHSCREEN 138#ifdef HAVE_TOUCHSCREEN
139 touchscreen_set_mode(TOUCHSCREEN_BUTTON); 139 touchscreen_set_mode(TOUCHSCREEN_BUTTON);
140#endif 140#endif
141 viewportmanager_set_statusbar(VP_ALLSCREENS); 141 viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
142 add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, 142 add_event(GUI_EVENT_STATUSBAR_TOGGLE, false,
143 viewportmanager_statusbar_changed); 143 viewportmanager_statusbar_changed);
144#ifdef HAVE_USBSTACK 144#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,
355 const struct menu_item_ex *temp, *menu; 355 const struct menu_item_ex *temp, *menu;
356 int ret = 0, i; 356 int ret = 0, i;
357 bool redraw_lists; 357 bool redraw_lists;
358 char oldbars = viewportmanager_set_statusbar(hide_bars?0:VP_ALLSCREENS); 358 int oldbars = viewportmanager_set_statusbar(
359 hide_bars ? VP_SB_HIDE_ALL : VP_SB_ALLSCREENS);
359 360
360 const struct menu_item_ex *menu_stack[MAX_MENUS]; 361 const struct menu_item_ex *menu_stack[MAX_MENUS];
361 int menu_stack_selected_item[MAX_MENUS]; 362 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)
392 enum eq_type current_type; 392 enum eq_type current_type;
393 char buf[24]; 393 char buf[24];
394 int i, w, h, height, start_item, nb_eq_sliders[NB_SCREENS]; 394 int i, w, h, height, start_item, nb_eq_sliders[NB_SCREENS];
395 char barsenabled = viewportmanager_set_statusbar(0); 395 int barsenabled = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
396 396
397 397
398 FOR_NB_SCREENS(i) { 398 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 = {
636int plugin_load(const char* plugin, const void* parameter) 636int plugin_load(const char* plugin, const void* parameter)
637{ 637{
638 int rc; 638 int rc;
639 char oldbars; 639 int oldbars;
640 struct plugin_header *hdr; 640 struct plugin_header *hdr;
641#ifdef SIMULATOR 641#ifdef SIMULATOR
642 void *pd; 642 void *pd;
@@ -743,7 +743,7 @@ int plugin_load(const char* plugin, const void* parameter)
743#endif 743#endif
744 744
745 invalidate_icache(); 745 invalidate_icache();
746 oldbars = viewportmanager_set_statusbar(0); 746 oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
747 747
748 rc = hdr->entry_point(parameter); 748 rc = hdr->entry_point(parameter);
749 749
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);
126#define PLUGIN_MAGIC 0x526F634B /* RocK */ 126#define PLUGIN_MAGIC 0x526F634B /* RocK */
127 127
128/* increase this every time the api struct changes */ 128/* increase this every time the api struct changes */
129#define PLUGIN_API_VERSION 140 129#define PLUGIN_API_VERSION 141
130 130
131/* update this to latest version if a change to the api struct breaks 131/* update this to latest version if a change to the api struct breaks
132 backwards compatibility (and please take the opportunity to sort in any 132 backwards compatibility (and please take the opportunity to sort in any
133 new function which are "waiting" at the end of the function table) */ 133 new function which are "waiting" at the end of the function table) */
134#define PLUGIN_MIN_API_VERSION 140 134#define PLUGIN_MIN_API_VERSION 141
135 135
136/* plugin return codes */ 136/* plugin return codes */
137enum plugin_status { 137enum plugin_status {
@@ -312,7 +312,7 @@ struct plugin_api {
312 int height); 312 int height);
313#endif 313#endif
314 void (*viewport_set_defaults)(struct viewport *vp, enum screen_type screen); 314 void (*viewport_set_defaults)(struct viewport *vp, enum screen_type screen);
315 char (*viewportmanager_set_statusbar)(char enabled); 315 int (*viewportmanager_set_statusbar)(int enable_status);
316 /* list */ 316 /* list */
317 void (*gui_synclist_init)(struct gui_synclist * lists, 317 void (*gui_synclist_init)(struct gui_synclist * lists,
318 list_get_name callback_get_item_name, void * data, 318 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)
94 bool exit = false; 94 bool exit = false;
95 int key; 95 int key;
96 96
97 char bars = rb->viewportmanager_set_statusbar(VP_ALLSCREENS); 97 int bars = rb->viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
98 rb->gui_synclist_draw(&(menus[m].synclist)); 98 rb->gui_synclist_draw(&(menus[m].synclist));
99 while (!exit) { 99 while (!exit) {
100 key = rb->get_action(CONTEXT_MAINMENU,HZ/2); 100 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)
298 int morse_tick = 0; 298 int morse_tick = 0;
299 char buf[2]; 299 char buf[2];
300#endif 300#endif
301 char oldbars = viewportmanager_set_statusbar(0); 301 char oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
302 FOR_NB_SCREENS(l) 302 FOR_NB_SCREENS(l)
303 { 303 {
304 struct keyboard_parameters *pm = &param[l]; 304 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)
270 show_remote_main_backdrop(); 270 show_remote_main_backdrop();
271#endif 271#endif
272 /* always re-enable the statusbar after the WPS */ 272 /* always re-enable the statusbar after the WPS */
273 viewportmanager_set_statusbar(VP_ALLSCREENS); 273 viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
274 return ret_val; 274 return ret_val;
275} 275}
276#if CONFIG_TUNER 276#if CONFIG_TUNER