Make table headers bold; fix a typo
[kugel-rb.git] / apps / gui / theme_settings.c
blob7f4046c70b1d8aa7deb10a7789ed52ebd4b7cd52
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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 ****************************************************************************/
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 #if CONFIG_TUNER
34 #include "radio.h"
35 #endif
36 #include "skin_engine/skin_engine.h"
37 #include "skin_engine/skin_fonts.h"
38 #include "statusbar-skinned.h"
39 #include "bootchart.h"
42 /* call this after loading a .wps/.rwps or other skin files, so that the
43 * skin buffer is reset properly
45 struct skin_load_setting {
46 char* setting;
47 char* suffix;
48 void (*loadfunc)(enum screen_type screen, const char *buf, bool isfile);
51 static const struct skin_load_setting skins[] = {
52 /* This determins the load order. *sbs must be loaded before any other
53 * skin on that screen */
54 #ifdef HAVE_LCD_BITMAP
55 { global_settings.sbs_file, "sbs", sb_skin_data_load},
56 #endif
57 { global_settings.wps_file, "wps", wps_data_load},
58 #if CONFIG_TUNER
59 { global_settings.fms_file, "fms", fms_data_load},
60 #endif
61 #ifdef HAVE_REMOTE_LCD
62 { global_settings.rsbs_file, "rsbs", sb_skin_data_load},
63 { global_settings.rwps_file, "rwps", wps_data_load},
64 #if CONFIG_TUNER
65 { global_settings.rfms_file, "rfms", fms_data_load},
66 #endif
67 #endif
70 void settings_apply_skins(void)
72 char buf[MAX_PATH];
73 /* re-initialize the skin buffer before we start reloading skins */
74 skin_buffer_init();
75 enum screen_type screen = SCREEN_MAIN;
76 unsigned int i;
77 #ifdef HAVE_LCD_BITMAP
78 skin_backdrop_init();
79 skin_font_init();
80 #endif
81 #if CONFIG_TUNER
82 fms_skin_init();
83 #endif
84 for (i=0; i<ARRAYLEN(skins); i++)
86 #ifdef HAVE_REMOTE_LCD
87 screen = skins[i].suffix[0] == 'r' ? SCREEN_REMOTE : SCREEN_MAIN;
88 #endif
89 CHART2(">skin load ", skins[i].suffix);
90 if (skins[i].setting[0] && skins[i].setting[0] != '-')
92 snprintf(buf, sizeof buf, WPS_DIR "/%s.%s",
93 skins[i].setting, skins[i].suffix);
94 skins[i].loadfunc(screen, buf, true);
96 else
98 skins[i].loadfunc(screen, NULL, true);
100 CHART2("<skin load ", skins[i].suffix);
102 viewportmanager_theme_changed(THEME_STATUSBAR);
103 #if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
104 FOR_NB_SCREENS(i)
105 screens[i].backdrop_show(sb_get_backdrop(i));
106 #endif