Another major skin backend update/hopefully bugfix:

Skins are now more self contained in the skin manager which in the future might allow on demand skin loading (i.e smaller skin buffers)
Skin backdrops are also managed more intelegently (fixes a bug where you can get a crazy backdrop loaded if a .sbs fails to load)

the rockbox_default rescue theme is now called rockbox_failsafe to better express what it actually is.

This commit hopefully/maybe fixes the heavily reported data aborts, so please check if you are getting them

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28073 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-09-14 11:56:50 +00:00
parent 0928cdf074
commit 9928e3418f
21 changed files with 417 additions and 562 deletions

View file

@ -422,7 +422,7 @@ int radio_screen(void)
{
radio_load_presets(global_settings.fmr_file);
}
fms_get(SCREEN_MAIN)->state->id3 = NULL;
skin_get_global_state()->id3 = NULL;
#ifdef HAVE_ALBUMART
radioart_init(true);
#endif
@ -469,7 +469,7 @@ int radio_screen(void)
#endif
fms_fix_displays(FMS_ENTER);
FOR_NB_SCREENS(i)
skin_update(fms_get(i), SKIN_REFRESH_ALL);
skin_update(FM_SCREEN, i, SKIN_REFRESH_ALL);
if(radio_preset_count() < 1 && yesno_pop(ID2P(LANG_FM_FIRST_AUTOSCAN)))
presets_scan(NULL);
@ -800,7 +800,7 @@ int radio_screen(void)
{
#endif
FOR_NB_SCREENS(i)
skin_update(fms_get(i), update_type);
skin_update(FM_SCREEN, i, update_type);
}
}
update_type = 0;

View file

@ -50,10 +50,6 @@ int radio_current_preset(void);
int radio_preset_count(void);
const struct fmstation *radio_get_preset(int preset);
/* skin functions */
void fms_data_load(enum screen_type screen, const char *buf, bool isfile);
void fms_skin_init(void);
/* callbacks for the radio settings */
void set_radio_region(int region);
void toggle_mono_mode(bool mono);

View file

@ -33,45 +33,37 @@
#include "option_select.h"
extern struct wps_state wps_state; /* from wps.c */
static struct gui_wps fms_skin[NB_SCREENS] = {{ .data = NULL }};
static struct wps_data fms_skin_data[NB_SCREENS] = {{ .wps_loaded = 0 }};
static struct wps_sync_data fms_skin_sync_data = { .do_full_update = false };
void fms_data_load(enum screen_type screen, const char *buf, bool isfile)
char* default_radio_skin(enum screen_type screen)
{
struct wps_data *data = fms_skin[screen].data;
int success;
success = buf && skin_data_load(screen, data, buf, isfile);
if (!success ) /* load the default */
{
const char default_fms[] = "%s%?Ti<%Ti. |>%?Tn<%Tn|%Tf>\n"
"%Sx(Station:) %tf MHz\n"
"%?St(force fm mono)<%Sx(Force Mono)|%?ts<%Sx(Stereo)|%Sx(Mono)>>\n"
"%Sx(Mode:) %?tm<%Sx(Scan)|%Sx(Preset)>\n"
(void)screen;
static char default_fms[] =
"%s%?Ti<%Ti. |>%?Tn<%Tn|%Tf>\n"
"%Sx(Station:) %tf MHz\n"
"%?St(force fm mono)<%Sx(Force Mono)|%?ts<%Sx(Stereo)|%Sx(Mono)>>\n"
"%Sx(Mode:) %?tm<%Sx(Scan)|%Sx(Preset)>\n"
#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
"%?Rr<%Sx(Time:) %Rh:%Rn:%Rs|%?St(prerecording time)<%pm|%Sx(Prerecord Time) %Rs>>\n"
"%?Rr<%Sx(Time:) %Rh:%Rn:%Rs|%?St(prerecording time)<%pm|%Sx(Prerecord Time) %Rs>>\n"
#endif
"%pb\n"
"%pb\n"
#ifdef HAVE_RDS_CAP
"\n%s%ty\n"
"%s%tz\n"
"\n%s%ty\n"
"%s%tz\n"
#endif
;
skin_data_load(screen, data, default_fms, false);
}
;
return default_fms;
}
void fms_fix_displays(enum fms_exiting toggle_state)
{
int i;
FOR_NB_SCREENS(i)
{
struct wps_data *data = skin_get_gwps(FM_SCREEN, i)->data;
if (toggle_state == FMS_ENTER)
{
viewportmanager_theme_enable(i, skin_has_sbs(i, fms_skin[i].data), NULL);
viewportmanager_theme_enable(i, skin_has_sbs(i, data), NULL);
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
screens[i].backdrop_show(fms_skin[i].data->backdrop);
skin_backdrop_show(data->backdrop_id);
#endif
screens[i].clear_display();
/* force statusbar/skin update since we just cleared the whole screen */
@ -81,46 +73,29 @@ void fms_fix_displays(enum fms_exiting toggle_state)
{
screens[i].stop_scroll();
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
screens[i].backdrop_show(sb_get_backdrop(i));
skin_backdrop_show(sb_get_backdrop(i));
#endif
viewportmanager_theme_undo(i, skin_has_sbs(i, fms_skin[i].data));
viewportmanager_theme_undo(i, skin_has_sbs(i, data));
}
}
#ifdef HAVE_TOUCHSCREEN
if (!fms_skin[SCREEN_MAIN].data->touchregions)
if (i==SCREEN_MAIN && !data->touchregions)
touchscreen_set_mode(toggle_state == FMS_ENTER ?
TOUCHSCREEN_BUTTON : global_settings.touch_mode);
#endif
}
void fms_skin_init(void)
{
int i;
FOR_NB_SCREENS(i)
{
#ifdef HAVE_ALBUMART
fms_skin_data[i].albumart = NULL;
fms_skin_data[i].playback_aa_slot = -1;
#endif
fms_skin[i].data = &fms_skin_data[i];
fms_skin[i].display = &screens[i];
/* Currently no seperate wps_state needed/possible
so use the only available ( "global" ) one */
fms_skin[i].state = &wps_state;
fms_skin[i].sync_data = &fms_skin_sync_data;
}
}
int fms_do_button_loop(bool update_screen)
{
int button = skin_wait_for_action(fms_skin, CONTEXT_FM,
int button = skin_wait_for_action(FM_SCREEN, CONTEXT_FM,
update_screen ? TIMEOUT_NOBLOCK : HZ/5);
#ifdef HAVE_TOUCHSCREEN
struct touchregion *region;
int offset;
if (button == ACTION_TOUCHSCREEN)
button = skin_get_touchaction(&fms_skin_data[SCREEN_MAIN], &offset, &region);
button = skin_get_touchaction(skin_get_gwps(FM_SCREEN, SCREEN_MAIN)->data,
&offset, &region)
switch (button)
{
case ACTION_WPS_STOP:
@ -152,5 +127,5 @@ int fms_do_button_loop(bool update_screen)
struct gui_wps *fms_get(enum screen_type screen)
{
return &fms_skin[screen];
return skin_get_gwps(FM_SCREEN, screen);
}