summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/quickscreen.c4
-rw-r--r--apps/gui/theme_settings.c94
-rw-r--r--apps/gui/viewport.c5
3 files changed, 99 insertions, 4 deletions
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)
400 if (gui_syncquickscreen_run(&qs, button_enter)) 400 if (gui_syncquickscreen_run(&qs, button_enter))
401 { 401 {
402 settings_save(); 402 settings_save();
403 settings_apply(false); 403 settings_apply();
404 /* make sure repeat/shuffle/any other nasty ones get updated */ 404 /* make sure repeat/shuffle/any other nasty ones get updated */
405 if ( oldrepeat != global_settings.repeat_mode && 405 if ( oldrepeat != global_settings.repeat_mode &&
406 (audio_status() & AUDIO_STATUS_PLAY) ) 406 (audio_status() & AUDIO_STATUS_PLAY) )
@@ -437,7 +437,7 @@ bool quick_screen_f3(int button_enter)
437 if (gui_syncquickscreen_run(&qs, button_enter)) 437 if (gui_syncquickscreen_run(&qs, button_enter))
438 { 438 {
439 settings_save(); 439 settings_save();
440 settings_apply(false); 440 settings_apply();
441 } 441 }
442 return(0); 442 return(0);
443} 443}
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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: settings.c 24848 2010-02-22 07:25:13Z jdgordon $
9 *
10 * Copyright (C) 2002 by Stuart Martin
11 * RTC config saving code (C) 2002 by hessu@hes.iki.fi
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22#include <stdio.h>
23#include <stddef.h>
24#include <stdlib.h>
25#include <limits.h>
26#include "inttypes.h"
27#include "config.h"
28#include "action.h"
29#include "crc32.h"
30#include "settings.h"
31#include "wps.h"
32#include "file.h"
33#include "skin_engine/skin_engine.h"
34#include "skin_engine/skin_fonts.h"
35#include "statusbar-skinned.h"
36
37
38
39/* call this after loading a .wps/.rwps or other skin files, so that the
40 * skin buffer is reset properly
41 */
42struct skin_load_setting {
43 char* setting;
44 char* suffix;
45 void (*loadfunc)(enum screen_type screen, const char *buf, bool isfile);
46};
47static struct skin_load_setting skins[] = {
48 /* This determins the load order. *sbs must be loaded before any other
49 * skin on that screen */
50#ifdef HAVE_LCD_BITMAP
51 { global_settings.sbs_file, "sbs", sb_skin_data_load},
52#endif
53 { global_settings.wps_file, "wps", wps_data_load},
54#ifdef HAVE_REMOTE_LCD
55 { global_settings.rsbs_file, "rsbs", sb_skin_data_load},
56 { global_settings.rwps_file, "rwps", wps_data_load},
57#endif
58};
59
60void settings_apply_skins(void)
61{
62 char buf[MAX_PATH];
63 /* re-initialize the skin buffer before we start reloading skins */
64 skin_buffer_init();
65 enum screen_type screen = SCREEN_MAIN;
66 unsigned int i;
67#ifdef HAVE_LCD_BITMAP
68 skin_backdrop_init();
69 skin_font_init();
70 sb_skin_init();
71#endif
72 gui_sync_wps_init();
73 for (i=0; i<sizeof(skins)/sizeof(*skins); i++)
74 {
75#ifdef HAVE_REMOTE_LCD
76 screen = skins[i].suffix[0] == 'r' ? SCREEN_REMOTE : SCREEN_MAIN;
77#endif
78 if (skins[i].setting[0] && skins[i].setting[0] != '-')
79 {
80 snprintf(buf, sizeof buf, WPS_DIR "/%s.%s",
81 skins[i].setting, skins[i].suffix);
82 skins[i].loadfunc(screen, buf, true);
83 }
84 else
85 {
86 skins[i].loadfunc(screen, NULL, true);
87 }
88 }
89 viewportmanager_theme_changed(THEME_STATUSBAR);
90#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
91 FOR_NB_SCREENS(i)
92 screens[i].backdrop_show(sb_get_backdrop(i));
93#endif
94}
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)
110 110
111 if (is_theme_enabled(screen)) 111 if (is_theme_enabled(screen))
112 { 112 {
113 bool first_boot = theme_stack_top[screen] == 0;
113 /* remove the left overs from the previous screen. 114 /* remove the left overs from the previous screen.
114 * could cause a tiny flicker. Redo your screen code if that happens */ 115 * could cause a tiny flicker. Redo your screen code if that happens */
115#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 116#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
116 screens[screen].backdrop_show(sb_get_backdrop(screen)); 117 screens[screen].backdrop_show(sb_get_backdrop(screen));
117#endif 118#endif
118 if (!was_enabled[screen] || force) 119 if (!first_boot && (!was_enabled[screen] || force))
119 { 120 {
120 struct viewport deadspace, user; 121 struct viewport deadspace, user;
121 viewport_set_defaults(&user, screen); 122 viewport_set_defaults(&user, screen);
@@ -161,7 +162,7 @@ static void toggle_theme(enum screen_type screen, bool force)
161 screens[screen].update_viewport(); 162 screens[screen].update_viewport();
162 } 163 }
163 } 164 }
164 send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */ 165 send_event(GUI_EVENT_ACTIONUPDATE, (void*)!first_boot);
165 } 166 }
166 else 167 else
167 { 168 {