From 4c6b3551b585590e21639d09198b0777b25bf04f Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Fri, 26 Feb 2010 08:01:41 +0000 Subject: split the theme settings apply() sutff out of settings_apply(). this should fix splashes not being loc'ed, statusbar over the splash (fixed in sim, not on my mini2g though), and the supposed boot time slowdown. What this also does is remove a bunch of unnecessary settings_Apply()'s from the ipod accessory code, and causes all non-skin settings to get applied each time (this includes font and langs which we wernt doing to stop disk access) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24922 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/quickscreen.c | 4 +- apps/gui/theme_settings.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++ apps/gui/viewport.c | 5 ++- 3 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 apps/gui/theme_settings.c (limited to 'apps/gui') diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index d092f0b04a..1a22f69341 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -400,7 +400,7 @@ bool quick_screen_quick(int button_enter) if (gui_syncquickscreen_run(&qs, button_enter)) { settings_save(); - settings_apply(false); + settings_apply(); /* make sure repeat/shuffle/any other nasty ones get updated */ if ( oldrepeat != global_settings.repeat_mode && (audio_status() & AUDIO_STATUS_PLAY) ) @@ -437,7 +437,7 @@ bool quick_screen_f3(int button_enter) if (gui_syncquickscreen_run(&qs, button_enter)) { settings_save(); - settings_apply(false); + settings_apply(); } return(0); } diff --git a/apps/gui/theme_settings.c b/apps/gui/theme_settings.c new file mode 100644 index 0000000000..23e7a5bbaf --- /dev/null +++ b/apps/gui/theme_settings.c @@ -0,0 +1,94 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: settings.c 24848 2010-02-22 07:25:13Z jdgordon $ + * + * Copyright (C) 2002 by Stuart Martin + * RTC config saving code (C) 2002 by hessu@hes.iki.fi + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include +#include +#include +#include +#include "inttypes.h" +#include "config.h" +#include "action.h" +#include "crc32.h" +#include "settings.h" +#include "wps.h" +#include "file.h" +#include "skin_engine/skin_engine.h" +#include "skin_engine/skin_fonts.h" +#include "statusbar-skinned.h" + + + +/* call this after loading a .wps/.rwps or other skin files, so that the + * skin buffer is reset properly + */ +struct skin_load_setting { + char* setting; + char* suffix; + void (*loadfunc)(enum screen_type screen, const char *buf, bool isfile); +}; +static struct skin_load_setting skins[] = { + /* This determins the load order. *sbs must be loaded before any other + * skin on that screen */ +#ifdef HAVE_LCD_BITMAP + { global_settings.sbs_file, "sbs", sb_skin_data_load}, +#endif + { global_settings.wps_file, "wps", wps_data_load}, +#ifdef HAVE_REMOTE_LCD + { global_settings.rsbs_file, "rsbs", sb_skin_data_load}, + { global_settings.rwps_file, "rwps", wps_data_load}, +#endif +}; + +void settings_apply_skins(void) +{ + char buf[MAX_PATH]; + /* re-initialize the skin buffer before we start reloading skins */ + skin_buffer_init(); + enum screen_type screen = SCREEN_MAIN; + unsigned int i; +#ifdef HAVE_LCD_BITMAP + skin_backdrop_init(); + skin_font_init(); + sb_skin_init(); +#endif + gui_sync_wps_init(); + for (i=0; i 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 + FOR_NB_SCREENS(i) + screens[i].backdrop_show(sb_get_backdrop(i)); +#endif +} diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index 6e4d9913c4..9b35c86c17 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -110,12 +110,13 @@ static void toggle_theme(enum screen_type screen, bool force) if (is_theme_enabled(screen)) { + bool first_boot = theme_stack_top[screen] == 0; /* remove the left overs from the previous screen. * could cause a tiny flicker. Redo your screen code if that happens */ #if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 screens[screen].backdrop_show(sb_get_backdrop(screen)); #endif - if (!was_enabled[screen] || force) + if (!first_boot && (!was_enabled[screen] || force)) { struct viewport deadspace, user; viewport_set_defaults(&user, screen); @@ -161,7 +162,7 @@ static void toggle_theme(enum screen_type screen, bool force) screens[screen].update_viewport(); } } - send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */ + send_event(GUI_EVENT_ACTIONUPDATE, (void*)!first_boot); } else { -- cgit v1.2.3