1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Stuart Martin
11 * RTC config saving code (C) 2002 by hessu@hes.iki.fi
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.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
33 #include "skin_engine/skin_engine.h"
34 #include "skin_engine/skin_fonts.h"
35 #include "statusbar-skinned.h"
36 #include "bootchart.h"
39 /* call this after loading a .wps/.rwps or other skin files, so that the
40 * skin buffer is reset properly
42 struct skin_load_setting
{
45 void (*loadfunc
)(enum screen_type screen
, const char *buf
, bool isfile
);
48 static const struct skin_load_setting skins
[] = {
49 /* This determins the load order. *sbs must be loaded before any other
50 * skin on that screen */
51 #ifdef HAVE_LCD_BITMAP
52 { global_settings
.sbs_file
, "sbs", sb_skin_data_load
},
54 { global_settings
.wps_file
, "wps", wps_data_load
},
55 #ifdef HAVE_REMOTE_LCD
56 { global_settings
.rsbs_file
, "rsbs", sb_skin_data_load
},
57 { global_settings
.rwps_file
, "rwps", wps_data_load
},
61 void settings_apply_skins(void)
64 /* re-initialize the skin buffer before we start reloading skins */
66 enum screen_type screen
= SCREEN_MAIN
;
68 #ifdef HAVE_LCD_BITMAP
72 for (i
=0; i
<ARRAYLEN(skins
); i
++)
74 #ifdef HAVE_REMOTE_LCD
75 screen
= skins
[i
].suffix
[0] == 'r' ? SCREEN_REMOTE
: SCREEN_MAIN
;
77 CHART2(">skin load ", skins
[i
].suffix
);
78 if (skins
[i
].setting
[0] && skins
[i
].setting
[0] != '-')
80 snprintf(buf
, sizeof buf
, WPS_DIR
"/%s.%s",
81 skins
[i
].setting
, skins
[i
].suffix
);
82 skins
[i
].loadfunc(screen
, buf
, true);
86 skins
[i
].loadfunc(screen
, NULL
, true);
88 CHART2("<skin load ", skins
[i
].suffix
);
90 viewportmanager_theme_changed(THEME_STATUSBAR
);
91 #if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
93 screens
[i
].backdrop_show(sb_get_backdrop(i
));