FS#10824 - viewport/statusbar API rework.
Hopefully the only user visible changes are: - fm and recording screens go by the statusbar setting (sbs or inbuilt) - plugins go back to using the theme as they should for menus and lists - splash screens might get cut a bit... entirely theme and splash dependant.. if there is a problematic one we can look at it later. - hopefully nothing more than very minor screen flickerings... let me know exactly where they are so they can be fixed New GUI screen rules: * Screens assume that the theme (sbs+ui viewport+ maybe background image) are always enabled. They may be disabled on a per display basis, but MUST be re-enabled on exit * Screens must not be coded in a way that requires a statusbar of any type.. the inbuilt bar will be removed shortly. ALWAYS RESPECT THE USERS SETTINGS unless the screen requires the full display to fit. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23904 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
85aad9b397
commit
b2eb44ce0e
24 changed files with 292 additions and 426 deletions
|
@ -50,7 +50,6 @@ enum {
|
||||||
enum {
|
enum {
|
||||||
GUI_EVENT_STATUSBAR_TOGGLE = (EVENT_CLASS_GUI|1),
|
GUI_EVENT_STATUSBAR_TOGGLE = (EVENT_CLASS_GUI|1),
|
||||||
GUI_EVENT_ACTIONUPDATE,
|
GUI_EVENT_ACTIONUPDATE,
|
||||||
GUI_EVENT_REFRESH,
|
|
||||||
GUI_EVENT_THEME_CHANGED,
|
GUI_EVENT_THEME_CHANGED,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2652,13 +2652,15 @@ static const struct the_menu_item menuitems[] = {
|
||||||
};
|
};
|
||||||
static int menu_action_callback(int btn, struct gui_synclist *lists)
|
static int menu_action_callback(int btn, struct gui_synclist *lists)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
if (btn == ACTION_STD_OK)
|
if (btn == ACTION_STD_OK)
|
||||||
{
|
{
|
||||||
int oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
|
FOR_NB_SCREENS(i)
|
||||||
|
viewportmanager_theme_enable(i, false, NULL);
|
||||||
menuitems[gui_synclist_get_sel_pos(lists)].function();
|
menuitems[gui_synclist_get_sel_pos(lists)].function();
|
||||||
btn = ACTION_REDRAW;
|
btn = ACTION_REDRAW;
|
||||||
send_event(GUI_EVENT_REFRESH, NULL);
|
FOR_NB_SCREENS(i)
|
||||||
viewportmanager_set_statusbar(oldbars);
|
viewportmanager_theme_undo(i);
|
||||||
}
|
}
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,9 +528,6 @@ int ft_enter(struct tree_context* c)
|
||||||
splash(0, ID2P(LANG_WAIT));
|
splash(0, ID2P(LANG_WAIT));
|
||||||
if (!settings_load_config(buf,true))
|
if (!settings_load_config(buf,true))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* redraw the UI in case the user setting changed apparence */
|
|
||||||
send_event(GUI_EVENT_REFRESH, tree_drawlists);
|
|
||||||
splash(HZ, ID2P(LANG_SETTINGS_LOADED));
|
splash(HZ, ID2P(LANG_SETTINGS_LOADED));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -652,8 +649,6 @@ int ft_enter(struct tree_context* c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
send_event(GUI_EVENT_REFRESH, tree_drawlists);
|
|
||||||
|
|
||||||
if ( play ) {
|
if ( play ) {
|
||||||
/* the resume_index must always be the index in the
|
/* the resume_index must always be the index in the
|
||||||
shuffled list in case shuffle is enabled */
|
shuffled list in case shuffle is enabled */
|
||||||
|
|
|
@ -822,14 +822,17 @@ static const char* simplelist_static_getname(int item,
|
||||||
bool simplelist_show_list(struct simplelist_info *info)
|
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, i;
|
||||||
int oldbars = viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
|
|
||||||
const char* (*getname)(int item, void * data, char *buffer, size_t buffer_len);
|
const 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)
|
||||||
getname = info->get_name;
|
getname = info->get_name;
|
||||||
else
|
else
|
||||||
getname = simplelist_static_getname;
|
getname = simplelist_static_getname;
|
||||||
|
|
||||||
|
FOR_NB_SCREENS(i)
|
||||||
|
viewportmanager_theme_enable(i, true, NULL);
|
||||||
|
|
||||||
gui_synclist_init(&lists, getname, info->callback_data,
|
gui_synclist_init(&lists, getname, info->callback_data,
|
||||||
info->scroll_all, info->selection_size, NULL);
|
info->scroll_all, info->selection_size, NULL);
|
||||||
|
|
||||||
|
@ -904,7 +907,8 @@ bool simplelist_show_list(struct simplelist_info *info)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
talk_shutup();
|
talk_shutup();
|
||||||
viewportmanager_set_statusbar(oldbars);
|
FOR_NB_SCREENS(i)
|
||||||
|
viewportmanager_theme_undo(i);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1084,11 +1084,6 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
data->peak_meter_enabled = enable_pm;
|
data->peak_meter_enabled = enable_pm;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (refresh_mode & WPS_REFRESH_STATUSBAR)
|
|
||||||
{
|
|
||||||
viewportmanager_set_statusbar(gwps->sync_data->statusbars);
|
|
||||||
}
|
|
||||||
/* Restore the default viewport */
|
/* Restore the default viewport */
|
||||||
display->set_viewport(NULL);
|
display->set_viewport(NULL);
|
||||||
|
|
||||||
|
|
|
@ -204,12 +204,15 @@ void splashf(int ticks, const char *fmt, ...)
|
||||||
fmt = P2STR((unsigned char *)fmt);
|
fmt = P2STR((unsigned char *)fmt);
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
|
viewportmanager_theme_enable(i, false, NULL);
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
splash_internal(&(screens[i]), fmt, ap);
|
splash_internal(&(screens[i]), fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
if (ticks)
|
if (ticks)
|
||||||
sleep(ticks);
|
sleep(ticks);
|
||||||
|
FOR_NB_SCREENS(i)
|
||||||
|
viewportmanager_theme_undo(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void splash(int ticks, const char *str)
|
void splash(int ticks, const char *str)
|
||||||
|
|
|
@ -41,7 +41,7 @@ static struct wps_data sb_skin_data[NB_SCREENS] = {{ .wps_loaded = 0 }};
|
||||||
static struct wps_sync_data sb_skin_sync_data = { .do_full_update = false };
|
static struct wps_sync_data sb_skin_sync_data = { .do_full_update = false };
|
||||||
|
|
||||||
/* initial setup of wps_data */
|
/* initial setup of wps_data */
|
||||||
static void sb_skin_update(void*);
|
|
||||||
static bool loaded_ok[NB_SCREENS] = { false };
|
static bool loaded_ok[NB_SCREENS] = { false };
|
||||||
static int update_delay = DEFAULT_UPDATE_DELAY;
|
static int update_delay = DEFAULT_UPDATE_DELAY;
|
||||||
|
|
||||||
|
@ -68,9 +68,6 @@ void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile)
|
||||||
vp->hidden_flags = VP_NEVER_VISIBLE;
|
vp->hidden_flags = VP_NEVER_VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
|
||||||
remove_event(GUI_EVENT_ACTIONUPDATE, sb_skin_update);
|
|
||||||
|
|
||||||
loaded_ok[screen] = success;
|
loaded_ok[screen] = success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +93,6 @@ struct viewport *sb_skin_get_info_vp(enum screen_type screen)
|
||||||
|
|
||||||
inline bool sb_skin_get_state(enum screen_type screen)
|
inline bool sb_skin_get_state(enum screen_type screen)
|
||||||
{
|
{
|
||||||
int skinbars = sb_skin[screen].sync_data->statusbars;
|
|
||||||
/* Temp fix untill the hardcoded bar is removed */
|
/* Temp fix untill the hardcoded bar is removed */
|
||||||
int bar_setting = global_settings.statusbar;
|
int bar_setting = global_settings.statusbar;
|
||||||
#if NB_SCREENS > 1
|
#if NB_SCREENS > 1
|
||||||
|
@ -106,72 +102,21 @@ inline bool sb_skin_get_state(enum screen_type screen)
|
||||||
switch (bar_setting)
|
switch (bar_setting)
|
||||||
{
|
{
|
||||||
case STATUSBAR_CUSTOM:
|
case STATUSBAR_CUSTOM:
|
||||||
return loaded_ok[screen] && (skinbars & VP_SB_ONSCREEN(screen));
|
return loaded_ok[screen];
|
||||||
case STATUSBAR_TOP:
|
case STATUSBAR_TOP:
|
||||||
case STATUSBAR_BOTTOM:
|
case STATUSBAR_BOTTOM:
|
||||||
|
return true;
|
||||||
case STATUSBAR_OFF:
|
case STATUSBAR_OFF:
|
||||||
return (viewportmanager_get_statusbar()&VP_SB_ONSCREEN(screen));
|
return false;
|
||||||
}
|
}
|
||||||
return false; /* Should never actually get here */
|
return false; /* Should never actually get here */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sb_skin_update(enum screen_type screen, bool force)
|
||||||
static void do_update_callback(void *param)
|
|
||||||
{
|
|
||||||
(void)param;
|
|
||||||
/* the WPS handles changing the actual id3 data in the id3 pointers
|
|
||||||
* we imported, we just want a full update */
|
|
||||||
sb_skin_sync_data.do_full_update = true;
|
|
||||||
/* force timeout in wps main loop, so that the update is instantly */
|
|
||||||
queue_post(&button_queue, BUTTON_NONE, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void sb_skin_set_state(int state, enum screen_type screen)
|
|
||||||
{
|
|
||||||
sb_skin[screen].sync_data->do_full_update = true;
|
|
||||||
int skinbars = sb_skin[screen].sync_data->statusbars;
|
|
||||||
if (state && loaded_ok[screen])
|
|
||||||
{
|
|
||||||
skinbars |= VP_SB_ONSCREEN(screen);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
skinbars &= ~VP_SB_ONSCREEN(screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (skinbars)
|
|
||||||
{
|
|
||||||
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
|
||||||
add_event(LCD_EVENT_ACTIVATION, false, do_update_callback);
|
|
||||||
#endif
|
|
||||||
add_event(PLAYBACK_EVENT_TRACK_CHANGE, false,
|
|
||||||
do_update_callback);
|
|
||||||
add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, false,
|
|
||||||
do_update_callback);
|
|
||||||
add_event(GUI_EVENT_ACTIONUPDATE, false, sb_skin_update);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
|
||||||
remove_event(LCD_EVENT_ACTIVATION, do_update_callback);
|
|
||||||
#endif
|
|
||||||
remove_event(PLAYBACK_EVENT_TRACK_CHANGE, do_update_callback);
|
|
||||||
remove_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, do_update_callback);
|
|
||||||
remove_event(GUI_EVENT_ACTIONUPDATE, sb_skin_update);
|
|
||||||
}
|
|
||||||
|
|
||||||
sb_skin[screen].sync_data->statusbars = skinbars;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sb_skin_update(void* param)
|
|
||||||
{
|
{
|
||||||
static long next_update = 0;
|
static long next_update = 0;
|
||||||
int i;
|
int i = screen;
|
||||||
int forced_draw = param || sb_skin[SCREEN_MAIN].sync_data->do_full_update;
|
if (TIME_AFTER(current_tick, next_update) || force)
|
||||||
if (TIME_AFTER(current_tick, next_update) || forced_draw)
|
|
||||||
{
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
{
|
{
|
||||||
if (sb_skin_get_state(i))
|
if (sb_skin_get_state(i))
|
||||||
{
|
{
|
||||||
|
@ -180,13 +125,22 @@ static void sb_skin_update(void* param)
|
||||||
* so still update those */
|
* so still update those */
|
||||||
if (lcd_active() || (i != SCREEN_MAIN))
|
if (lcd_active() || (i != SCREEN_MAIN))
|
||||||
#endif
|
#endif
|
||||||
skin_update(&sb_skin[i], forced_draw?
|
skin_update(&sb_skin[i], force?
|
||||||
WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC);
|
WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next_update = current_tick + update_delay; /* don't update too often */
|
next_update = current_tick + update_delay; /* don't update too often */
|
||||||
sb_skin[SCREEN_MAIN].sync_data->do_full_update = false;
|
sb_skin[SCREEN_MAIN].sync_data->do_full_update = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void do_sbs_update_callback(void *param)
|
||||||
|
{
|
||||||
|
(void)param;
|
||||||
|
/* the WPS handles changing the actual id3 data in the id3 pointers
|
||||||
|
* we imported, we just want a full update */
|
||||||
|
sb_skin_sync_data.do_full_update = true;
|
||||||
|
/* force timeout in wps main loop, so that the update is instantly */
|
||||||
|
queue_post(&button_queue, BUTTON_NONE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sb_skin_set_update_delay(int delay)
|
void sb_skin_set_update_delay(int delay)
|
||||||
|
@ -209,7 +163,6 @@ void sb_skin_init(void)
|
||||||
/* Currently no seperate wps_state needed/possible
|
/* Currently no seperate wps_state needed/possible
|
||||||
so use the only available ( "global" ) one */
|
so use the only available ( "global" ) one */
|
||||||
sb_skin[i].state = &wps_state;
|
sb_skin[i].state = &wps_state;
|
||||||
sb_skin_sync_data.statusbars = VP_SB_HIDE_ALL;
|
|
||||||
sb_skin[i].sync_data = &sb_skin_sync_data;
|
sb_skin[i].sync_data = &sb_skin_sync_data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,9 @@ void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile);
|
||||||
|
|
||||||
/* probably temporary, to shut the classic statusbar up */
|
/* probably temporary, to shut the classic statusbar up */
|
||||||
bool sb_skin_get_state(enum screen_type screen);
|
bool sb_skin_get_state(enum screen_type screen);
|
||||||
void sb_skin_set_state(int state, enum screen_type screen);
|
|
||||||
void sb_skin_init(void);
|
void sb_skin_init(void);
|
||||||
struct viewport *sb_skin_get_info_vp(enum screen_type screen);
|
struct viewport *sb_skin_get_info_vp(enum screen_type screen);
|
||||||
|
void sb_skin_update(enum screen_type screen, bool force);
|
||||||
|
|
||||||
void sb_skin_set_update_delay(int delay);
|
void sb_skin_set_update_delay(int delay);
|
||||||
|
|
||||||
|
@ -48,4 +48,5 @@ void sb_skin_set_update_delay(int delay);
|
||||||
#define sb_skin_set_state(a,b)
|
#define sb_skin_set_state(a,b)
|
||||||
#define sb_skin_get_state(a)
|
#define sb_skin_get_state(a)
|
||||||
#endif
|
#endif
|
||||||
|
void do_sbs_update_callback(void *param);
|
||||||
#endif /* __STATUSBAR_SKINNED_H__ */
|
#endif /* __STATUSBAR_SKINNED_H__ */
|
||||||
|
|
|
@ -150,7 +150,7 @@ static void usb_screen_fix_viewports(struct screen *screen,
|
||||||
|
|
||||||
viewport_set_defaults(parent, screen->screen_type);
|
viewport_set_defaults(parent, screen->screen_type);
|
||||||
if (parent->width < logo_width || parent->height < logo_height)
|
if (parent->width < logo_width || parent->height < logo_height)
|
||||||
viewport_set_fullscreen(parent, screen->screen_type);
|
viewportmanager_theme_enable(screen->screen_type, false, parent);
|
||||||
|
|
||||||
*logo = *parent;
|
*logo = *parent;
|
||||||
logo->x = parent->x + parent->width - logo_width;
|
logo->x = parent->x + parent->width - logo_width;
|
||||||
|
@ -180,8 +180,6 @@ static void usb_screen_fix_viewports(struct screen *screen,
|
||||||
static void usb_screens_draw(struct usb_screen_vps_t *usb_screen_vps_ar)
|
static void usb_screens_draw(struct usb_screen_vps_t *usb_screen_vps_ar)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int usb_bars = VP_SB_ALLSCREENS; /* force statusbars */
|
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
#ifdef HAVE_LCD_REMOTE
|
#ifdef HAVE_LCD_REMOTE
|
||||||
lcd_remote_clear_display();
|
lcd_remote_clear_display();
|
||||||
|
@ -236,18 +234,12 @@ static void usb_screens_draw(struct usb_screen_vps_t *usb_screen_vps_ar)
|
||||||
|
|
||||||
screen->update_viewport();
|
screen->update_viewport();
|
||||||
screen->set_viewport(NULL);
|
screen->set_viewport(NULL);
|
||||||
|
|
||||||
/* force statusbar by ignoring the setting */
|
|
||||||
usb_bars |= VP_SB_IGNORE_SETTING(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
viewportmanager_set_statusbar(usb_bars);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_usb_screen_run(void)
|
void gui_usb_screen_run(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int old_bars = viewportmanager_get_statusbar();
|
|
||||||
struct usb_screen_vps_t usb_screen_vps_ar[NB_SCREENS];
|
struct usb_screen_vps_t usb_screen_vps_ar[NB_SCREENS];
|
||||||
#if defined HAVE_TOUCHSCREEN
|
#if defined HAVE_TOUCHSCREEN
|
||||||
enum touchscreen_mode old_mode = touchscreen_get_mode();
|
enum touchscreen_mode old_mode = touchscreen_get_mode();
|
||||||
|
@ -319,9 +311,8 @@ void gui_usb_screen_run(void)
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
screens[i].backlight_on();
|
screens[i].backlight_on();
|
||||||
|
viewportmanager_theme_undo(i);
|
||||||
}
|
}
|
||||||
viewportmanager_set_statusbar(old_bars);
|
|
||||||
send_event(GUI_EVENT_REFRESH, NULL);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /* !defined(USB_NONE) */
|
#endif /* !defined(USB_NONE) */
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include "screen_access.h"
|
#include "screen_access.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "panic.h"
|
||||||
|
#include "viewport.h"
|
||||||
|
|
||||||
/*some short cuts for fg/bg/line selector handling */
|
/*some short cuts for fg/bg/line selector handling */
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
@ -38,10 +40,6 @@
|
||||||
#define BG_FALLBACK LCD_DEFAULT_BG
|
#define BG_FALLBACK LCD_DEFAULT_BG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
static void set_default_align_flags(struct viewport *vp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* all below isn't needed for pc tools (i.e. checkwps/wps editor)
|
/* all below isn't needed for pc tools (i.e. checkwps/wps editor)
|
||||||
* only viewport_parse_viewport() is */
|
* only viewport_parse_viewport() is */
|
||||||
#ifndef __PCTOOL__
|
#ifndef __PCTOOL__
|
||||||
|
@ -56,25 +54,146 @@ static void set_default_align_flags(struct viewport *vp);
|
||||||
#endif
|
#endif
|
||||||
#include "statusbar-skinned.h"
|
#include "statusbar-skinned.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "viewport.h"
|
||||||
|
|
||||||
|
#define VPSTACK_DEPTH 16
|
||||||
static int statusbar_enabled = 0;
|
struct viewport_stack_item
|
||||||
|
{
|
||||||
|
struct viewport* vp;
|
||||||
|
bool enabled;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
static struct {
|
static void viewportmanager_redraw(void* data);
|
||||||
struct viewport* vp;
|
|
||||||
int active[NB_SCREENS];
|
|
||||||
} ui_vp_info;
|
|
||||||
|
|
||||||
|
static int theme_stack_top[NB_SCREENS]; /* the last item added */
|
||||||
|
static struct viewport_stack_item theme_stack[NB_SCREENS][VPSTACK_DEPTH];
|
||||||
|
static bool is_theme_enabled(enum screen_type screen);
|
||||||
|
|
||||||
|
static void toggle_theme(void)
|
||||||
|
{
|
||||||
|
bool enable_event = false;
|
||||||
|
static bool was_enabled[NB_SCREENS] = {false};
|
||||||
|
int i;
|
||||||
|
FOR_NB_SCREENS(i)
|
||||||
|
{
|
||||||
|
enable_event = enable_event || is_theme_enabled(i);
|
||||||
|
}
|
||||||
|
if (enable_event)
|
||||||
|
{
|
||||||
|
add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw);
|
||||||
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||||
|
add_event(LCD_EVENT_ACTIVATION, false, do_sbs_update_callback);
|
||||||
|
#endif
|
||||||
|
add_event(PLAYBACK_EVENT_TRACK_CHANGE, false,
|
||||||
|
do_sbs_update_callback);
|
||||||
|
add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, false,
|
||||||
|
do_sbs_update_callback);
|
||||||
|
|
||||||
|
/* remove the left overs from the previous screen.
|
||||||
|
* could cause a tiny flicker. Redo your screen code if that happens */
|
||||||
|
FOR_NB_SCREENS(i)
|
||||||
|
{
|
||||||
|
if (!was_enabled[i])
|
||||||
|
{
|
||||||
|
struct viewport deadspace, user;
|
||||||
|
viewport_set_defaults(&user, i);
|
||||||
|
deadspace = user; /* get colours and everything */
|
||||||
|
/* above */
|
||||||
|
deadspace.x = 0;
|
||||||
|
deadspace.y = 0;
|
||||||
|
deadspace.width = screens[i].lcdwidth;
|
||||||
|
deadspace.height = user.y;
|
||||||
|
if (deadspace.width && deadspace.height)
|
||||||
|
{
|
||||||
|
screens[i].set_viewport(&deadspace);
|
||||||
|
screens[i].clear_viewport();
|
||||||
|
screens[i].update_viewport();
|
||||||
|
}
|
||||||
|
/* below */
|
||||||
|
deadspace.y = user.y + user.height;
|
||||||
|
deadspace.height = screens[i].lcdheight - deadspace.y;
|
||||||
|
if (deadspace.width && deadspace.height)
|
||||||
|
{
|
||||||
|
screens[i].set_viewport(&deadspace);
|
||||||
|
screens[i].clear_viewport();
|
||||||
|
screens[i].update_viewport();
|
||||||
|
}
|
||||||
|
/* left */
|
||||||
|
deadspace.x = 0;
|
||||||
|
deadspace.y = 0;
|
||||||
|
deadspace.width = user.x;
|
||||||
|
deadspace.height = screens[i].lcdheight;
|
||||||
|
if (deadspace.width && deadspace.height)
|
||||||
|
{
|
||||||
|
screens[i].set_viewport(&deadspace);
|
||||||
|
screens[i].clear_viewport();
|
||||||
|
screens[i].update_viewport();
|
||||||
|
}
|
||||||
|
/* below */
|
||||||
|
deadspace.x = user.x + user.width;
|
||||||
|
deadspace.width = screens[i].lcdwidth - deadspace.x;
|
||||||
|
if (deadspace.width && deadspace.height)
|
||||||
|
{
|
||||||
|
screens[i].set_viewport(&deadspace);
|
||||||
|
screens[i].clear_viewport();
|
||||||
|
screens[i].update_viewport();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FOR_NB_SCREENS(i)
|
||||||
|
screens[i].stop_scroll();
|
||||||
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||||
|
remove_event(LCD_EVENT_ACTIVATION, do_sbs_update_callback);
|
||||||
|
#endif
|
||||||
|
remove_event(PLAYBACK_EVENT_TRACK_CHANGE, do_sbs_update_callback);
|
||||||
|
remove_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, do_sbs_update_callback);
|
||||||
|
remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw);
|
||||||
|
}
|
||||||
|
|
||||||
|
FOR_NB_SCREENS(i)
|
||||||
|
was_enabled[i] = is_theme_enabled(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
void viewportmanager_theme_enable(enum screen_type screen, bool enable,
|
||||||
|
struct viewport *viewport)
|
||||||
|
{
|
||||||
|
int top = ++theme_stack_top[screen];
|
||||||
|
if (top >= VPSTACK_DEPTH-1)
|
||||||
|
panicf("Stack overflow... viewportmanager");
|
||||||
|
theme_stack[screen][top].enabled = enable;
|
||||||
|
theme_stack[screen][top].vp = viewport;
|
||||||
|
toggle_theme();
|
||||||
|
/* then be nice and set the viewport up */
|
||||||
|
if (viewport)
|
||||||
|
viewport_set_defaults(viewport, screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void viewportmanager_theme_undo(enum screen_type screen)
|
||||||
|
{
|
||||||
|
int top = --theme_stack_top[screen];
|
||||||
|
if (top < 0)
|
||||||
|
panicf("Stack underflow... viewportmanager");
|
||||||
|
|
||||||
|
toggle_theme();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool is_theme_enabled(enum screen_type screen)
|
||||||
|
{
|
||||||
|
int top = theme_stack_top[screen];
|
||||||
|
return theme_stack[screen][top].enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool custom_vp_loaded_ok[NB_SCREENS];
|
||||||
static struct viewport custom_vp[NB_SCREENS];
|
static struct viewport custom_vp[NB_SCREENS];
|
||||||
|
|
||||||
/* callbacks for GUI_EVENT_* events */
|
|
||||||
static void viewportmanager_ui_vp_changed(void *param);
|
|
||||||
static void viewportmanager_call_draw_func(void *param);
|
|
||||||
static void statusbar_toggled(void* param);
|
|
||||||
static unsigned viewport_init_ui_vp(void);
|
static unsigned viewport_init_ui_vp(void);
|
||||||
#endif
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
static void viewportmanager_redraw(void* data);
|
|
||||||
|
|
||||||
int viewport_get_nb_lines(const struct viewport *vp)
|
int viewport_get_nb_lines(const struct viewport *vp)
|
||||||
{
|
{
|
||||||
|
@ -86,85 +205,36 @@ int viewport_get_nb_lines(const struct viewport *vp)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool showing_bars(enum screen_type screen)
|
|
||||||
{
|
|
||||||
if (statusbar_enabled & VP_SB_ONSCREEN(screen))
|
|
||||||
{
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
int ignore;
|
|
||||||
ignore = statusbar_enabled & VP_SB_IGNORE_SETTING(screen);
|
|
||||||
return ignore || (statusbar_position(screen) != STATUSBAR_OFF);
|
|
||||||
#else
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void viewportmanager_init(void)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggled);
|
|
||||||
#endif
|
|
||||||
viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
|
|
||||||
}
|
|
||||||
|
|
||||||
int viewportmanager_get_statusbar(void)
|
|
||||||
{
|
|
||||||
return statusbar_enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
int viewportmanager_set_statusbar(const int enabled)
|
|
||||||
{
|
|
||||||
int old = statusbar_enabled;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
statusbar_enabled = enabled;
|
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
{
|
|
||||||
if (showing_bars(i)
|
|
||||||
&& statusbar_position(i) != STATUSBAR_CUSTOM)
|
|
||||||
{
|
|
||||||
add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw);
|
|
||||||
gui_statusbar_draw(&statusbars.statusbars[i], true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
{
|
|
||||||
sb_skin_set_state(showing_bars(i)
|
|
||||||
&& statusbar_position(i) == STATUSBAR_CUSTOM, i);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void viewportmanager_redraw(void* data)
|
static void viewportmanager_redraw(void* data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
if (showing_bars(i)
|
#ifdef HAVE_LCD_BITMAP
|
||||||
&& statusbar_position(i) != STATUSBAR_CUSTOM)
|
if (statusbar_position(i) == STATUSBAR_CUSTOM)
|
||||||
|
sb_skin_update(i, NULL != data);
|
||||||
|
else if (statusbar_position(i) != STATUSBAR_OFF)
|
||||||
|
#endif
|
||||||
gui_statusbar_draw(&statusbars.statusbars[i], NULL != data);
|
gui_statusbar_draw(&statusbars.statusbars[i], NULL != data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
|
|
||||||
static void statusbar_toggled(void* param)
|
void viewportmanager_init()
|
||||||
{
|
{
|
||||||
(void)param;
|
#ifdef HAVE_LCD_BITMAP
|
||||||
/* update vp manager for the new setting and reposition vps
|
int i;
|
||||||
* if necessary */
|
FOR_NB_SCREENS(i)
|
||||||
viewportmanager_theme_changed(THEME_STATUSBAR);
|
{
|
||||||
|
theme_stack_top[i] = -1; /* the next call fixes this to 0 */
|
||||||
|
/* We always want the theme enabled by default... */
|
||||||
|
viewportmanager_theme_enable(i, true, NULL);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
void viewportmanager_theme_changed(const int which)
|
void viewportmanager_theme_changed(const int which)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -177,90 +247,24 @@ void viewportmanager_theme_changed(const int which)
|
||||||
#endif
|
#endif
|
||||||
if (which & THEME_UI_VIEWPORT)
|
if (which & THEME_UI_VIEWPORT)
|
||||||
{
|
{
|
||||||
int retval = viewport_init_ui_vp();
|
viewport_init_ui_vp();
|
||||||
/* reset the ui viewport */
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
ui_vp_info.active[i] = retval & BIT_N(i);
|
|
||||||
/* and point to it */
|
|
||||||
ui_vp_info.vp = custom_vp;
|
|
||||||
}
|
}
|
||||||
else if (which & THEME_LANGUAGE)
|
if (which & THEME_LANGUAGE)
|
||||||
{ /* THEME_UI_VIEWPORT handles rtl already */
|
{
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
set_default_align_flags(&custom_vp[i]);
|
|
||||||
}
|
}
|
||||||
if (which & THEME_STATUSBAR)
|
if (which & THEME_STATUSBAR)
|
||||||
{
|
{
|
||||||
statusbar_enabled = 0;
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
if (statusbar_position(i) != STATUSBAR_OFF)
|
/* This can probably be done better...
|
||||||
statusbar_enabled |= VP_SB_ONSCREEN(i);
|
* disable the theme so it's forced to do a full redraw */
|
||||||
}
|
viewportmanager_theme_enable(i, false, NULL);
|
||||||
|
viewportmanager_theme_undo(i);
|
||||||
viewportmanager_set_statusbar(statusbar_enabled);
|
|
||||||
|
|
||||||
/* reposition viewport to fit statusbar, only if not using the ui vp */
|
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
{
|
|
||||||
if (!ui_vp_info.active[i])
|
|
||||||
viewport_set_fullscreen(&custom_vp[i], i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int event_add = 0;
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
{
|
|
||||||
event_add |= ui_vp_info.active[i];
|
|
||||||
event_add |= (statusbar_position(i) == STATUSBAR_CUSTOM);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add one of those to ensure the draw function is called always */
|
|
||||||
if (event_add)
|
|
||||||
{
|
|
||||||
add_event(GUI_EVENT_REFRESH, false, viewportmanager_ui_vp_changed);
|
|
||||||
remove_event(GUI_EVENT_REFRESH, viewportmanager_call_draw_func);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
add_event(GUI_EVENT_REFRESH, false, viewportmanager_call_draw_func);
|
|
||||||
remove_event(GUI_EVENT_REFRESH, viewportmanager_ui_vp_changed);
|
|
||||||
}
|
|
||||||
|
|
||||||
send_event(GUI_EVENT_THEME_CHANGED, NULL);
|
send_event(GUI_EVENT_THEME_CHANGED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* simply calls a function that draws stuff, this exists to ensure the
|
|
||||||
* drawing function call in the GUI_EVENT_REFRESH event
|
|
||||||
*
|
|
||||||
* param should be 'void func(void)' */
|
|
||||||
static void viewportmanager_call_draw_func(void *param)
|
|
||||||
{
|
|
||||||
/* cast param to a function */
|
|
||||||
void (*draw_func)(void) = ((void(*)(void))param);
|
|
||||||
/* call the passed function which will redraw the content of
|
|
||||||
* the current screen */
|
|
||||||
if (draw_func != NULL)
|
|
||||||
draw_func();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void viewportmanager_ui_vp_changed(void *param)
|
|
||||||
{
|
|
||||||
/* if the user changed the theme, we need to initiate a full redraw */
|
|
||||||
int i;
|
|
||||||
/* start with clearing the screen */
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
screens[i].clear_display();
|
|
||||||
/* redraw the statusbar if it was enabled */
|
|
||||||
send_event(GUI_EVENT_ACTIONUPDATE, (void*)true);
|
|
||||||
/* call redraw function */
|
|
||||||
viewportmanager_call_draw_func(param);
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
screens[i].update();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (re)parse the UI vp from the settings
|
* (re)parse the UI vp from the settings
|
||||||
* - Returns
|
* - Returns
|
||||||
|
@ -270,7 +274,7 @@ static void viewportmanager_ui_vp_changed(void *param)
|
||||||
static unsigned viewport_init_ui_vp(void)
|
static unsigned viewport_init_ui_vp(void)
|
||||||
{
|
{
|
||||||
int screen;
|
int screen;
|
||||||
unsigned ret = 0;
|
const char *ret = NULL;
|
||||||
char *setting;
|
char *setting;
|
||||||
FOR_NB_SCREENS(screen)
|
FOR_NB_SCREENS(screen)
|
||||||
{
|
{
|
||||||
|
@ -281,14 +285,12 @@ static unsigned viewport_init_ui_vp(void)
|
||||||
#endif
|
#endif
|
||||||
setting = global_settings.ui_vp_config;
|
setting = global_settings.ui_vp_config;
|
||||||
|
|
||||||
|
ret = viewport_parse_viewport(&custom_vp[screen], screen,
|
||||||
|
setting, ',');
|
||||||
|
|
||||||
if (!(viewport_parse_viewport(&custom_vp[screen], screen,
|
custom_vp_loaded_ok[screen] = ret?true:false;
|
||||||
setting, ',')))
|
|
||||||
viewport_set_fullscreen(&custom_vp[screen], screen);
|
|
||||||
else
|
|
||||||
ret |= BIT_N(screen);
|
|
||||||
}
|
}
|
||||||
return ret;
|
return true; /* meh fixme */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
|
@ -301,6 +303,16 @@ bool viewport_point_within_vp(const struct viewport *vp,
|
||||||
return (is_x && is_y);
|
return (is_x && is_y);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_TOUCHSCREEN */
|
#endif /* HAVE_TOUCHSCREEN */
|
||||||
|
|
||||||
|
static void set_default_align_flags(struct viewport *vp)
|
||||||
|
{
|
||||||
|
vp->flags &= ~VP_FLAG_ALIGNMENT_MASK;
|
||||||
|
#ifndef __PCTOOL__
|
||||||
|
if (UNLIKELY(lang_is_rtl()))
|
||||||
|
vp->flags |= VP_FLAG_ALIGN_RIGHT;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* HAVE_LCD_BITMAP */
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
#endif /* __PCTOOL__ */
|
#endif /* __PCTOOL__ */
|
||||||
|
|
||||||
|
@ -363,11 +375,17 @@ void viewport_set_defaults(struct viewport *vp,
|
||||||
#if defined(HAVE_LCD_BITMAP) && !defined(__PCTOOL__)
|
#if defined(HAVE_LCD_BITMAP) && !defined(__PCTOOL__)
|
||||||
|
|
||||||
struct viewport *sbs_area = NULL, *user_setting = NULL;
|
struct viewport *sbs_area = NULL, *user_setting = NULL;
|
||||||
|
if (!is_theme_enabled(screen))
|
||||||
|
{
|
||||||
|
viewport_set_fullscreen(vp, screen);
|
||||||
|
return;
|
||||||
|
}
|
||||||
/* get the two viewports */
|
/* get the two viewports */
|
||||||
if (ui_vp_info.active[screen])
|
if (custom_vp_loaded_ok[screen])
|
||||||
user_setting = &ui_vp_info.vp[screen];
|
user_setting = &custom_vp[screen];
|
||||||
if (sb_skin_get_state(screen))
|
if (sb_skin_get_state(screen))
|
||||||
sbs_area = sb_skin_get_info_vp(screen);
|
sbs_area = sb_skin_get_info_vp(screen);
|
||||||
|
|
||||||
/* have both? get their intersection */
|
/* have both? get their intersection */
|
||||||
if (sbs_area && user_setting)
|
if (sbs_area && user_setting)
|
||||||
{
|
{
|
||||||
|
@ -380,6 +398,7 @@ void viewport_set_defaults(struct viewport *vp,
|
||||||
{
|
{
|
||||||
/* copy from ui vp first (for other field),fix coordinates after */
|
/* copy from ui vp first (for other field),fix coordinates after */
|
||||||
*vp = *user_setting;
|
*vp = *user_setting;
|
||||||
|
set_default_align_flags(vp);
|
||||||
vp->x = MAX(a->x, b->x);
|
vp->x = MAX(a->x, b->x);
|
||||||
vp->y = MAX(a->y, b->y);
|
vp->y = MAX(a->y, b->y);
|
||||||
vp->width = MIN(a->x + a->width, b->x + b->width) - vp->x;
|
vp->width = MIN(a->x + a->width, b->x + b->width) - vp->x;
|
||||||
|
@ -405,16 +424,6 @@ void viewport_set_defaults(struct viewport *vp,
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
|
||||||
static void set_default_align_flags(struct viewport *vp)
|
|
||||||
{
|
|
||||||
vp->flags &= ~VP_FLAG_ALIGNMENT_MASK;
|
|
||||||
#ifndef __PCTOOL__
|
|
||||||
if (UNLIKELY(lang_is_rtl()))
|
|
||||||
vp->flags |= VP_FLAG_ALIGN_RIGHT;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* viewport_parse_viewport(struct viewport *vp,
|
const char* viewport_parse_viewport(struct viewport *vp,
|
||||||
enum screen_type screen,
|
enum screen_type screen,
|
||||||
const char *bufptr,
|
const char *bufptr,
|
||||||
|
|
|
@ -31,60 +31,30 @@
|
||||||
/* return the number of text lines in the vp viewport */
|
/* return the number of text lines in the vp viewport */
|
||||||
int viewport_get_nb_lines(const struct viewport *vp);
|
int viewport_get_nb_lines(const struct viewport *vp);
|
||||||
|
|
||||||
void viewport_set_defaults(struct viewport *vp,
|
|
||||||
const enum screen_type screen);
|
|
||||||
|
|
||||||
/* 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 THEME_STATUSBAR (BIT_N(0))
|
#define THEME_STATUSBAR (BIT_N(0))
|
||||||
#define THEME_UI_VIEWPORT (BIT_N(1))
|
#define THEME_UI_VIEWPORT (BIT_N(1))
|
||||||
#define THEME_BUTTONBAR (BIT_N(2))
|
#define THEME_BUTTONBAR (BIT_N(2))
|
||||||
#define THEME_LANGUAGE (BIT_N(3))
|
#define THEME_LANGUAGE (BIT_N(3))
|
||||||
#define THEME_ALL (~(0u))
|
#define THEME_ALL (~(0u))
|
||||||
|
|
||||||
#define VP_SB_HIDE_ALL 0
|
|
||||||
#define VP_SB_ONSCREEN(screen) BIT_N(screen)
|
|
||||||
#define VP_SB_IGNORE_SETTING(screen) BIT_N(4+screen)
|
|
||||||
#define VP_SB_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1))
|
|
||||||
|
|
||||||
#ifndef __PCTOOL__
|
#ifndef __PCTOOL__
|
||||||
/*
|
/*
|
||||||
* Initialize the viewportmanager, which in turns initializes the UI vp and
|
* Initialize the viewportmanager, which in turns initializes the UI vp and
|
||||||
* statusbar stuff
|
* statusbar stuff
|
||||||
*/
|
*/
|
||||||
void viewportmanager_init(void);
|
void viewportmanager_init(void);
|
||||||
int viewportmanager_get_statusbar(void);
|
|
||||||
int viewportmanager_set_statusbar(const int enabled);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
void viewport_set_defaults(struct viewport *vp,
|
||||||
* Initializes the given viewport with maximum dimensions minus status- and
|
const enum screen_type screen);
|
||||||
* buttonbar
|
|
||||||
*/
|
|
||||||
void viewport_set_fullscreen(struct viewport *vp,
|
void viewport_set_fullscreen(struct viewport *vp,
|
||||||
const enum screen_type screen);
|
const enum screen_type screen);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
void viewportmanager_theme_enable(enum screen_type screen, bool enable,
|
||||||
|
struct viewport *viewport);
|
||||||
|
|
||||||
|
void viewportmanager_theme_undo(enum screen_type screen);
|
||||||
|
|
||||||
/* call this when a theme changed */
|
/* call this when a theme changed */
|
||||||
void viewportmanager_theme_changed(const int);
|
void viewportmanager_theme_changed(const int);
|
||||||
|
@ -95,9 +65,9 @@ bool viewport_point_within_vp(const struct viewport *vp,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* HAVE_LCD_CHARCELL */
|
#else /* HAVE_LCD_CHARCELL */
|
||||||
#define viewport_set_current_vp(a)
|
|
||||||
#define viewport_get_current_vp() NULL
|
|
||||||
#define viewportmanager_theme_changed(a)
|
#define viewportmanager_theme_changed(a)
|
||||||
|
#define viewportmanager_theme_enable(...)
|
||||||
|
#define viewportmanager_theme_undo(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __PCTOOL__ */
|
#endif /* __PCTOOL__ */
|
||||||
|
|
|
@ -88,9 +88,6 @@ static struct wps_sync_data wps_sync_data = { .do_full_update = false
|
||||||
static void wps_state_init(void);
|
static void wps_state_init(void);
|
||||||
static void track_changed_callback(void *param);
|
static void track_changed_callback(void *param);
|
||||||
static void nextid3available_callback(void* param);
|
static void nextid3available_callback(void* param);
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
static void statusbar_toggle_handler(void *data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
|
#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
|
@ -562,24 +559,21 @@ static void wps_lcd_activation_hook(void *param)
|
||||||
|
|
||||||
static void gwps_leave_wps(void)
|
static void gwps_leave_wps(void)
|
||||||
{
|
{
|
||||||
int i, oldbars = VP_SB_HIDE_ALL;
|
int i;
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
gui_wps[i].display->stop_scroll();
|
gui_wps[i].display->stop_scroll();
|
||||||
gui_wps[i].display->backdrop_show(BACKDROP_MAIN);
|
gui_wps[i].display->backdrop_show(BACKDROP_MAIN);
|
||||||
if (statusbar_position(i) != STATUSBAR_OFF)
|
viewportmanager_theme_undo(i);
|
||||||
oldbars |= VP_SB_ONSCREEN(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
viewportmanager_set_statusbar(oldbars);
|
|
||||||
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||||
/* Play safe and unregister the hook */
|
/* Play safe and unregister the hook */
|
||||||
remove_event(LCD_EVENT_ACTIVATION, wps_lcd_activation_hook);
|
remove_event(LCD_EVENT_ACTIVATION, wps_lcd_activation_hook);
|
||||||
#endif
|
#endif
|
||||||
/* unhandle statusbar update delay */
|
/* unhandle statusbar update delay */
|
||||||
sb_skin_set_update_delay(DEFAULT_UPDATE_DELAY);
|
sb_skin_set_update_delay(DEFAULT_UPDATE_DELAY);
|
||||||
send_event(GUI_EVENT_REFRESH, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -591,6 +585,14 @@ static void gwps_enter_wps(void)
|
||||||
{
|
{
|
||||||
struct gui_wps *gwps = &gui_wps[i];
|
struct gui_wps *gwps = &gui_wps[i];
|
||||||
struct screen *display = gwps->display;
|
struct screen *display = gwps->display;
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
bool draw = false;
|
||||||
|
if (gui_wps[i].data->wps_sb_tag)
|
||||||
|
draw = gui_wps[i].data->show_sb_on_wps;
|
||||||
|
else if (statusbar_position(i) != STATUSBAR_OFF)
|
||||||
|
draw = true;
|
||||||
|
#endif
|
||||||
|
viewportmanager_theme_enable(i, draw, NULL);
|
||||||
|
|
||||||
display->stop_scroll();
|
display->stop_scroll();
|
||||||
/* Update the values in the first (default) viewport - in case the user
|
/* Update the values in the first (default) viewport - in case the user
|
||||||
|
@ -725,8 +727,6 @@ long gui_wps_show(void)
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
status_set_audio(true);
|
status_set_audio(true);
|
||||||
status_set_param(false);
|
status_set_param(false);
|
||||||
#else
|
|
||||||
statusbar_toggle_handler(NULL);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AB_REPEAT_ENABLE
|
#ifdef AB_REPEAT_ENABLE
|
||||||
|
@ -1176,8 +1176,8 @@ long gui_wps_show(void)
|
||||||
sb_skin_set_update_delay(0);
|
sb_skin_set_update_delay(0);
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
gui_wps[i].display->backdrop_show(BACKDROP_SKIN_WPS);
|
gui_wps[i].display->backdrop_show(BACKDROP_SKIN_WPS);
|
||||||
send_event(GUI_EVENT_REFRESH, gwps_enter_wps);
|
|
||||||
wps_sync_data.do_full_update = update = false;
|
wps_sync_data.do_full_update = update = false;
|
||||||
|
gwps_enter_wps();
|
||||||
}
|
}
|
||||||
else if (wps_sync_data.do_full_update || update)
|
else if (wps_sync_data.do_full_update || update)
|
||||||
{
|
{
|
||||||
|
@ -1271,33 +1271,6 @@ static void wps_state_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
static void statusbar_toggle_handler(void *data)
|
|
||||||
{
|
|
||||||
(void)data;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
int *wpsbars = &wps_sync_data.statusbars;
|
|
||||||
*wpsbars = VP_SB_HIDE_ALL;
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
{ /* fix viewports if needed */
|
|
||||||
skin_statusbar_changed(&gui_wps[i]);
|
|
||||||
|
|
||||||
bool draw = false;
|
|
||||||
|
|
||||||
/* fix up gui_wps::statusbars, so that the viewportmanager accepts it*/
|
|
||||||
if (gui_wps[i].data->wps_sb_tag)
|
|
||||||
draw = gui_wps[i].data->show_sb_on_wps;
|
|
||||||
else if (statusbar_position(i) != STATUSBAR_OFF)
|
|
||||||
draw = true;
|
|
||||||
if (draw)
|
|
||||||
*wpsbars |=
|
|
||||||
(VP_SB_ONSCREEN(i) | VP_SB_IGNORE_SETTING(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void gui_sync_wps_init(void)
|
void gui_sync_wps_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1315,11 +1288,7 @@ void gui_sync_wps_init(void)
|
||||||
gui_wps[i].display->backdrop_unload(BACKDROP_SKIN_WPS);
|
gui_wps[i].display->backdrop_unload(BACKDROP_SKIN_WPS);
|
||||||
/* must point to the same struct for both screens */
|
/* must point to the same struct for both screens */
|
||||||
gui_wps[i].sync_data = &wps_sync_data;
|
gui_wps[i].sync_data = &wps_sync_data;
|
||||||
gui_wps[i].sync_data->statusbars = VP_SB_ALLSCREENS;
|
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ static void init(void)
|
||||||
storage_init();
|
storage_init();
|
||||||
settings_reset();
|
settings_reset();
|
||||||
settings_load(SETTINGS_ALL);
|
settings_load(SETTINGS_ALL);
|
||||||
settings_apply(true);
|
settings_apply(false);
|
||||||
init_dircache(true);
|
init_dircache(true);
|
||||||
init_dircache(false);
|
init_dircache(false);
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
|
@ -367,6 +367,8 @@ static void init(void)
|
||||||
|
|
||||||
audio_init();
|
audio_init();
|
||||||
button_clear_queue(); /* Empty the keyboard buffer */
|
button_clear_queue(); /* Empty the keyboard buffer */
|
||||||
|
|
||||||
|
settings_apply(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -560,7 +562,7 @@ static void init(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
settings_apply(true);
|
settings_apply(false);
|
||||||
init_dircache(false);
|
init_dircache(false);
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
init_tagcache();
|
init_tagcache();
|
||||||
|
@ -625,6 +627,8 @@ static void init(void)
|
||||||
#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
|
#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
|
||||||
check_bootfile(false); /* remember write time and filesize */
|
check_bootfile(false); /* remember write time and filesize */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
settings_apply(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CPU_PP
|
#ifdef CPU_PP
|
||||||
|
|
|
@ -343,8 +343,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;
|
||||||
int oldbars = viewportmanager_get_statusbar();
|
FOR_NB_SCREENS(i)
|
||||||
viewportmanager_set_statusbar(hide_bars ? VP_SB_HIDE_ALL : oldbars);
|
viewportmanager_theme_enable(i, true/*!hide_bars*/, NULL);
|
||||||
|
|
||||||
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];
|
||||||
|
@ -686,7 +686,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
||||||
*start_selected = get_menu_selection(
|
*start_selected = get_menu_selection(
|
||||||
gui_synclist_get_sel_pos(&lists), menu);
|
gui_synclist_get_sel_pos(&lists), menu);
|
||||||
}
|
}
|
||||||
viewportmanager_set_statusbar(oldbars);
|
FOR_NB_SCREENS(i)
|
||||||
|
viewportmanager_theme_undo(i);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,8 @@ 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];
|
||||||
int barsenabled = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
|
FOR_NB_SCREENS(i)
|
||||||
|
viewportmanager_theme_enable(i, false, NULL);
|
||||||
|
|
||||||
|
|
||||||
FOR_NB_SCREENS(i) {
|
FOR_NB_SCREENS(i) {
|
||||||
|
@ -570,12 +571,13 @@ bool eq_menu_graphical(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset screen settings */
|
/* Reset screen settings */
|
||||||
FOR_NB_SCREENS(i) {
|
FOR_NB_SCREENS(i)
|
||||||
|
{
|
||||||
screens[i].setfont(FONT_UI);
|
screens[i].setfont(FONT_UI);
|
||||||
screens[i].clear_display();
|
screens[i].clear_display();
|
||||||
screens[i].set_viewport(NULL);
|
screens[i].set_viewport(NULL);
|
||||||
|
viewportmanager_theme_undo(i);
|
||||||
}
|
}
|
||||||
viewportmanager_set_statusbar(barsenabled);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ static int clear_main_backdrop(void)
|
||||||
global_settings.backdrop_file[0]=0;
|
global_settings.backdrop_file[0]=0;
|
||||||
backdrop_unload(BACKDROP_MAIN);
|
backdrop_unload(BACKDROP_MAIN);
|
||||||
backdrop_show(BACKDROP_MAIN);
|
backdrop_show(BACKDROP_MAIN);
|
||||||
send_event(GUI_EVENT_REFRESH, NULL);
|
|
||||||
settings_save();
|
settings_save();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -164,11 +163,6 @@ static int statusbar_callback_ex(int action,const struct menu_item_ex *this_item
|
||||||
case ACTION_EXIT_MENUITEM:
|
case ACTION_EXIT_MENUITEM:
|
||||||
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);
|
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);
|
||||||
send_event(GUI_EVENT_ACTIONUPDATE, (void*)true);
|
send_event(GUI_EVENT_ACTIONUPDATE, (void*)true);
|
||||||
if ((old_bar[screen] == STATUSBAR_CUSTOM)
|
|
||||||
|| (statusbar_position(screen) == STATUSBAR_CUSTOM))
|
|
||||||
send_event(GUI_EVENT_REFRESH, NULL);
|
|
||||||
else
|
|
||||||
gui_statusbar_changed(screen, old_bar[screen]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ACTION_REDRAW;
|
return ACTION_REDRAW;
|
||||||
|
|
|
@ -230,7 +230,6 @@ static const struct plugin_api rockbox_api = {
|
||||||
lcd_remote_bitmap,
|
lcd_remote_bitmap,
|
||||||
#endif
|
#endif
|
||||||
viewport_set_defaults,
|
viewport_set_defaults,
|
||||||
viewportmanager_set_statusbar,
|
|
||||||
|
|
||||||
/* list */
|
/* list */
|
||||||
gui_synclist_init,
|
gui_synclist_init,
|
||||||
|
@ -680,8 +679,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, i;
|
||||||
int oldbars;
|
|
||||||
struct plugin_header *hdr;
|
struct plugin_header *hdr;
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
void *pd;
|
void *pd;
|
||||||
|
@ -787,7 +785,8 @@ int plugin_load(const char* plugin, const void* parameter)
|
||||||
lcd_remote_update();
|
lcd_remote_update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
|
FOR_NB_SCREENS(i)
|
||||||
|
viewportmanager_theme_enable(i, false, NULL);
|
||||||
|
|
||||||
cpucache_invalidate();
|
cpucache_invalidate();
|
||||||
|
|
||||||
|
@ -834,12 +833,8 @@ int plugin_load(const char* plugin, const void* parameter)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
viewportmanager_set_statusbar(oldbars);
|
FOR_NB_SCREENS(i)
|
||||||
|
viewportmanager_theme_undo(i);
|
||||||
if (rc != PLUGIN_GOTO_WPS)
|
|
||||||
{
|
|
||||||
send_event(GUI_EVENT_REFRESH, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pfn_tsr_exit == NULL)
|
if (pfn_tsr_exit == NULL)
|
||||||
plugin_loaded = false;
|
plugin_loaded = false;
|
||||||
|
|
|
@ -135,12 +135,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 175
|
#define PLUGIN_API_VERSION 176
|
||||||
|
|
||||||
/* 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 173
|
#define PLUGIN_MIN_API_VERSION 176
|
||||||
|
|
||||||
/* plugin return codes */
|
/* plugin return codes */
|
||||||
enum plugin_status {
|
enum plugin_status {
|
||||||
|
@ -335,7 +335,6 @@ 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);
|
||||||
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,
|
||||||
|
|
|
@ -291,10 +291,10 @@ int kbd_input(char* text, int buflen)
|
||||||
unsigned char morse_code = 0;
|
unsigned char morse_code = 0;
|
||||||
int morse_tick = 0;
|
int morse_tick = 0;
|
||||||
#endif
|
#endif
|
||||||
int 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];
|
||||||
|
viewportmanager_theme_enable(l, false, NULL);
|
||||||
#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 96
|
#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 96
|
||||||
struct screen *sc = &screens[l];
|
struct screen *sc = &screens[l];
|
||||||
|
|
||||||
|
@ -1126,9 +1126,9 @@ int kbd_input(char* text, int buflen)
|
||||||
#endif /* HAVE_MORSE_INPUT && KBD_TOGGLE_INPUT */
|
#endif /* HAVE_MORSE_INPUT && KBD_TOGGLE_INPUT */
|
||||||
|
|
||||||
FOR_NB_SCREENS(l)
|
FOR_NB_SCREENS(l)
|
||||||
|
{
|
||||||
screens[l].setfont(FONT_UI);
|
screens[l].setfont(FONT_UI);
|
||||||
viewportmanager_set_statusbar(oldbars);
|
viewportmanager_theme_undo(l);
|
||||||
send_event(GUI_EVENT_REFRESH, NULL);
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -494,7 +494,6 @@ int radio_screen(void)
|
||||||
int button_timeout = current_tick + (2*HZ);
|
int button_timeout = current_tick + (2*HZ);
|
||||||
#endif
|
#endif
|
||||||
struct viewport vp[NB_SCREENS];
|
struct viewport vp[NB_SCREENS];
|
||||||
int oldbars = 0, fmbars = VP_SB_ALLSCREENS;
|
|
||||||
#ifdef HAVE_BUTTONBAR
|
#ifdef HAVE_BUTTONBAR
|
||||||
struct gui_buttonbar buttonbar;
|
struct gui_buttonbar buttonbar;
|
||||||
gui_buttonbar_init(&buttonbar);
|
gui_buttonbar_init(&buttonbar);
|
||||||
|
@ -505,9 +504,6 @@ int radio_screen(void)
|
||||||
in_screen = true;
|
in_screen = true;
|
||||||
|
|
||||||
/* always display status bar in radio screen for now */
|
/* always display status bar in radio screen for now */
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
fmbars |= VP_SB_IGNORE_SETTING(i);
|
|
||||||
oldbars = viewportmanager_set_statusbar(fmbars);
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
viewport_set_defaults(&vp[i], i);
|
viewport_set_defaults(&vp[i], i);
|
||||||
|
@ -761,12 +757,12 @@ int radio_screen(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_FM_MENU:
|
case ACTION_FM_MENU:
|
||||||
viewportmanager_set_statusbar(oldbars);
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
|
{
|
||||||
screens[i].scroll_stop(&vp[i]);
|
screens[i].scroll_stop(&vp[i]);
|
||||||
|
}
|
||||||
radio_menu();
|
radio_menu();
|
||||||
curr_preset = find_preset(curr_freq);
|
curr_preset = find_preset(curr_freq);
|
||||||
viewportmanager_set_statusbar(fmbars);
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
screens[i].set_viewport(&vp[i]);
|
screens[i].set_viewport(&vp[i]);
|
||||||
|
@ -798,9 +794,7 @@ int radio_screen(void)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
viewportmanager_set_statusbar(oldbars);
|
|
||||||
handle_radio_presets();
|
handle_radio_presets();
|
||||||
viewportmanager_set_statusbar(fmbars);
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
screens[i].set_viewport(&vp[i]);
|
screens[i].set_viewport(&vp[i]);
|
||||||
|
@ -932,11 +926,8 @@ int radio_screen(void)
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
screens[i].set_viewport(&vp[i]);
|
screens[i].set_viewport(&vp[i]);
|
||||||
peak_meter_screen(&screens[i],0,
|
peak_meter_screen(&screens[i],0, fh*(top_of_screen + 4),fh);
|
||||||
STATUSBAR_HEIGHT + fh*(top_of_screen + 4),
|
screens[i].update_rect(0, fh*(top_of_screen + 4),
|
||||||
fh);
|
|
||||||
screens[i].update_rect(0,
|
|
||||||
STATUSBAR_HEIGHT + fh*(top_of_screen + 4),
|
|
||||||
screens[i].getwidth(), fh);
|
screens[i].getwidth(), fh);
|
||||||
screens[i].set_viewport(NULL);
|
screens[i].set_viewport(NULL);
|
||||||
}
|
}
|
||||||
|
@ -1134,8 +1125,9 @@ int radio_screen(void)
|
||||||
cpu_idle_mode(false);
|
cpu_idle_mode(false);
|
||||||
#endif
|
#endif
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
|
{
|
||||||
screens[i].scroll_stop(&vp[i]);
|
screens[i].scroll_stop(&vp[i]);
|
||||||
viewportmanager_set_statusbar(oldbars);
|
}
|
||||||
in_screen = false;
|
in_screen = false;
|
||||||
#if CONFIG_CODEC != SWCODEC
|
#if CONFIG_CODEC != SWCODEC
|
||||||
return have_recorded;
|
return have_recorded;
|
||||||
|
|
|
@ -1019,7 +1019,6 @@ bool recording_screen(bool no_source)
|
||||||
int peak_l, peak_r;
|
int peak_l, peak_r;
|
||||||
int balance = 0;
|
int balance = 0;
|
||||||
#endif
|
#endif
|
||||||
int oldbars, recbars = VP_SB_ALLSCREENS;
|
|
||||||
int i;
|
int i;
|
||||||
int pm_x[NB_SCREENS]; /* peakmeter (and trigger bar) x pos */
|
int pm_x[NB_SCREENS]; /* peakmeter (and trigger bar) x pos */
|
||||||
int pm_y[NB_SCREENS]; /* peakmeter y pos */
|
int pm_y[NB_SCREENS]; /* peakmeter y pos */
|
||||||
|
@ -1081,9 +1080,6 @@ bool recording_screen(bool no_source)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* viewport init and calculations that only needs to be done once */
|
/* viewport init and calculations that only needs to be done once */
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
recbars |= VP_SB_IGNORE_SETTING(i);
|
|
||||||
oldbars = viewportmanager_set_statusbar(recbars);
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
struct viewport *v;
|
struct viewport *v;
|
||||||
|
@ -1123,6 +1119,9 @@ bool recording_screen(bool no_source)
|
||||||
gui_synclist_init(&lists, reclist_get_name, NULL, false, 1, vp_list);
|
gui_synclist_init(&lists, reclist_get_name, NULL, false, 1, vp_list);
|
||||||
gui_synclist_set_title(&lists, NULL, Icon_NOICON);
|
gui_synclist_set_title(&lists, NULL, Icon_NOICON);
|
||||||
|
|
||||||
|
|
||||||
|
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
|
||||||
|
|
||||||
/* start of the loop: we stay in this loop until user quits recscreen */
|
/* start of the loop: we stay in this loop until user quits recscreen */
|
||||||
while(done <= 0)
|
while(done <= 0)
|
||||||
{
|
{
|
||||||
|
@ -1576,7 +1575,6 @@ bool recording_screen(bool no_source)
|
||||||
/* led is restored at begin of loop / end of function */
|
/* led is restored at begin of loop / end of function */
|
||||||
led(false);
|
led(false);
|
||||||
#endif
|
#endif
|
||||||
viewportmanager_set_statusbar(oldbars);
|
|
||||||
if (recording_menu(no_source))
|
if (recording_menu(no_source))
|
||||||
{
|
{
|
||||||
done = 1;
|
done = 1;
|
||||||
|
@ -1590,7 +1588,6 @@ bool recording_screen(bool no_source)
|
||||||
done = -1;
|
done = -1;
|
||||||
/* the init is now done at the beginning of the loop */
|
/* the init is now done at the beginning of the loop */
|
||||||
}
|
}
|
||||||
viewportmanager_set_statusbar(recbars);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1602,7 +1599,6 @@ bool recording_screen(bool no_source)
|
||||||
/* led is restored at begin of loop / end of function */
|
/* led is restored at begin of loop / end of function */
|
||||||
led(false);
|
led(false);
|
||||||
#endif
|
#endif
|
||||||
viewportmanager_set_statusbar(oldbars);
|
|
||||||
if (f2_rec_screen())
|
if (f2_rec_screen())
|
||||||
{
|
{
|
||||||
rec_status |= RCSTAT_HAVE_RECORDED;
|
rec_status |= RCSTAT_HAVE_RECORDED;
|
||||||
|
@ -1610,7 +1606,6 @@ bool recording_screen(bool no_source)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
update_countdown = 0; /* Update immediately */
|
update_countdown = 0; /* Update immediately */
|
||||||
viewportmanager_set_statusbar(recbars);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1626,7 +1621,6 @@ bool recording_screen(bool no_source)
|
||||||
/* led is restored at begin of loop / end of function */
|
/* led is restored at begin of loop / end of function */
|
||||||
led(false);
|
led(false);
|
||||||
#endif
|
#endif
|
||||||
viewportmanager_set_statusbar(oldbars);
|
|
||||||
if (f3_rec_screen())
|
if (f3_rec_screen())
|
||||||
{
|
{
|
||||||
rec_status |= RCSTAT_HAVE_RECORDED;
|
rec_status |= RCSTAT_HAVE_RECORDED;
|
||||||
|
@ -1634,7 +1628,6 @@ bool recording_screen(bool no_source)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
update_countdown = 0; /* Update immediately */
|
update_countdown = 0; /* Update immediately */
|
||||||
viewportmanager_set_statusbar(recbars);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_KEYPAD == RECORDER_PAD */
|
#endif /* CONFIG_KEYPAD == RECORDER_PAD */
|
||||||
|
@ -1920,8 +1913,6 @@ rec_abort:
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].setfont(FONT_UI);
|
screens[i].setfont(FONT_UI);
|
||||||
|
|
||||||
viewportmanager_set_statusbar(oldbars);
|
|
||||||
send_event(GUI_EVENT_REFRESH, NULL);
|
|
||||||
|
|
||||||
/* if the directory was created or recording happened, make sure the
|
/* if the directory was created or recording happened, make sure the
|
||||||
browser is updated */
|
browser is updated */
|
||||||
|
|
|
@ -235,7 +235,6 @@ static int browser(void* param)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
send_event(GUI_EVENT_REFRESH, NULL);
|
|
||||||
if (!tagcache_is_usable())
|
if (!tagcache_is_usable())
|
||||||
return GO_TO_PREVIOUS;
|
return GO_TO_PREVIOUS;
|
||||||
filter = SHOW_ID3DB;
|
filter = SHOW_ID3DB;
|
||||||
|
|
|
@ -905,8 +905,7 @@ int calibrate(void)
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
|
|
||||||
/* hide the statusbar */
|
/* hide the statusbar */
|
||||||
int old_statusbar = viewportmanager_get_statusbar();
|
viewportmanager_theme_enable(SCREEN_MAIN, false, NULL);
|
||||||
viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
|
|
||||||
|
|
||||||
touchscreen_disable_mapping(); /* set raw mode */
|
touchscreen_disable_mapping(); /* set raw mode */
|
||||||
touchscreen_set_mode(TOUCHSCREEN_POINT);
|
touchscreen_set_mode(TOUCHSCREEN_POINT);
|
||||||
|
@ -931,7 +930,7 @@ int calibrate(void)
|
||||||
sizeof(struct touchscreen_parameter));
|
sizeof(struct touchscreen_parameter));
|
||||||
|
|
||||||
touchscreen_set_mode(old_mode);
|
touchscreen_set_mode(old_mode);
|
||||||
viewportmanager_set_statusbar(old_statusbar);
|
viewportmanager_theme_undo(SCREEN_MAIN);
|
||||||
|
|
||||||
settings_save();
|
settings_save();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -788,7 +788,6 @@ static int dirbrowse()
|
||||||
}
|
}
|
||||||
onplay_result = onplay(buf, attr, curr_context);
|
onplay_result = onplay(buf, attr, curr_context);
|
||||||
}
|
}
|
||||||
send_event(GUI_EVENT_REFRESH, tree_drawlists);
|
|
||||||
switch (onplay_result)
|
switch (onplay_result)
|
||||||
{
|
{
|
||||||
case ONPLAY_MAINMENU:
|
case ONPLAY_MAINMENU:
|
||||||
|
|
Loading…
Reference in a new issue