All pastes #1324441 Raw Edit

Jemand

public text v1 · immutable
#1324441 ·published 2009-02-01 13:34 UTC
rendered paste body
Index: apps/recorder/keyboard.c
===================================================================
--- apps/recorder/keyboard.c	(Revision 19896)
+++ apps/recorder/keyboard.c	(Arbeitskopie)
@@ -7,7 +7,7 @@
  *                     \/            \/     \/    \/            \/
  * $Id$
  *
- * Copyright (C) 2002 by Bj�rn Stenberg
+ * Copyright (C) 2002 by Björn Stenberg
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -298,7 +298,7 @@
     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];
Index: apps/plugins/lib/oldmenuapi.c
===================================================================
--- apps/plugins/lib/oldmenuapi.c	(Revision 19896)
+++ apps/plugins/lib/oldmenuapi.c	(Arbeitskopie)
@@ -94,7 +94,7 @@
     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);
Index: apps/gui/list.c
===================================================================
--- apps/gui/list.c	(Revision 19896)
+++ apps/gui/list.c	(Arbeitskopie)
@@ -845,7 +845,7 @@
 {
     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)
Index: apps/gui/viewport.c
===================================================================
--- apps/gui/viewport.c	(Revision 19896)
+++ apps/gui/viewport.c	(Arbeitskopie)
@@ -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 @@
 
 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 @@
 #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;
Index: apps/gui/gwps.c
===================================================================
--- apps/gui/gwps.c	(Revision 19896)
+++ apps/gui/gwps.c	(Arbeitskopie)
@@ -115,24 +115,25 @@
 
     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 @@
     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 @@
     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();
Index: apps/gui/viewport.h
===================================================================
--- apps/gui/viewport.h	(Revision 19896)
+++ apps/gui/viewport.h	(Arbeitskopie)
@@ -41,19 +41,32 @@
 
 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);
-
Index: apps/menu.c
===================================================================
--- apps/menu.c	(Revision 19896)
+++ apps/menu.c	(Arbeitskopie)
@@ -355,7 +355,8 @@
     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];
Index: apps/menus/eq_menu.c
===================================================================
--- apps/menus/eq_menu.c	(Revision 19896)
+++ apps/menus/eq_menu.c	(Arbeitskopie)
@@ -392,7 +392,7 @@
     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) {
Index: apps/plugin.c
===================================================================
--- apps/plugin.c	(Revision 19896)
+++ apps/plugin.c	(Arbeitskopie)
@@ -636,7 +636,7 @@
 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 @@
 #endif
 
     invalidate_icache();
-    oldbars = viewportmanager_set_statusbar(0);
+    oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
 
     rc = hdr->entry_point(parameter);
     
Index: apps/plugin.h
===================================================================
--- apps/plugin.h	(Revision 19896)
+++ apps/plugin.h	(Arbeitskopie)
@@ -126,12 +126,12 @@
 #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 @@
                               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,
Index: apps/root_menu.c
===================================================================
--- apps/root_menu.c	(Revision 19896)
+++ apps/root_menu.c	(Arbeitskopie)
@@ -270,7 +270,7 @@
     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
Index: apps/debug_menu.c
===================================================================
--- apps/debug_menu.c	(Revision 19896)
+++ apps/debug_menu.c	(Arbeitskopie)
@@ -2739,7 +2739,7 @@
 {
     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);
Index: apps/main.c
===================================================================
--- apps/main.c	(Revision 19896)
+++ apps/main.c	(Arbeitskopie)
@@ -138,7 +138,7 @@
 #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