diff options
Diffstat (limited to 'apps/radio/radio_skin.c')
-rw-r--r-- | apps/radio/radio_skin.c | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/apps/radio/radio_skin.c b/apps/radio/radio_skin.c new file mode 100644 index 0000000000..f9713703ac --- /dev/null +++ b/apps/radio/radio_skin.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: radio.c -1 $ | ||
9 | * | ||
10 | * Copyright (C) 2010 Jonathan Gordon | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #include "config.h" | ||
24 | #include <stdio.h> | ||
25 | #include <stdbool.h> | ||
26 | #include <stdlib.h> | ||
27 | #include "skin_engine/skin_engine.h" | ||
28 | #include "settings.h" | ||
29 | #include "radio.h" | ||
30 | #include "action.h" | ||
31 | #include "appevents.h" | ||
32 | #include "statusbar-skinned.h" | ||
33 | |||
34 | |||
35 | extern struct wps_state wps_state; /* from wps.c */ | ||
36 | static struct gui_wps fms_skin[NB_SCREENS] = {{ .data = NULL }}; | ||
37 | static struct wps_data fms_skin_data[NB_SCREENS] = {{ .wps_loaded = 0 }}; | ||
38 | static struct wps_sync_data fms_skin_sync_data = { .do_full_update = false }; | ||
39 | |||
40 | void fms_data_load(enum screen_type screen, const char *buf, bool isfile) | ||
41 | { | ||
42 | struct wps_data *data = fms_skin[screen].data; | ||
43 | int success; | ||
44 | success = buf && skin_data_load(screen, data, buf, isfile); | ||
45 | |||
46 | if (!success ) /* load the default */ | ||
47 | { | ||
48 | const char default_fms[] = "%Sx|Station:| %tf\n" | ||
49 | "%?ts<%Sx|Stereo||%Sx|Mono|>\n" | ||
50 | "%?tm<%Sx|Mode:| %Sx|Scan||%Sx|Preset|: %Ti. %?Tn<%Tn|%Tf>>\n" | ||
51 | "%pb\n" | ||
52 | #if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) | ||
53 | "%?Rr<%Sx|Time:| %Rh:%Rn:%Rs|" | ||
54 | "%?St|prerecording time|<%Sx|Prerecord Time| %Rs|%pm>>\n" | ||
55 | #endif | ||
56 | #ifdef HAVE_RDS_CAP | ||
57 | "\n%s%ty\n" | ||
58 | "%s%tz\n" | ||
59 | #endif | ||
60 | ; | ||
61 | skin_data_load(screen, data, default_fms, false); | ||
62 | } | ||
63 | } | ||
64 | void fms_fix_displays(enum fms_exiting toggle_state) | ||
65 | { | ||
66 | int i; | ||
67 | FOR_NB_SCREENS(i) | ||
68 | { | ||
69 | if (toggle_state == FMS_ENTER) | ||
70 | { | ||
71 | viewportmanager_theme_enable(i, skin_has_sbs(i, fms_skin[i].data), NULL); | ||
72 | #if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 | ||
73 | screens[i].backdrop_show(fms_skin[i].data->backdrop); | ||
74 | #endif | ||
75 | screens[i].clear_display(); | ||
76 | /* force statusbar/skin update since we just cleared the whole screen */ | ||
77 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); | ||
78 | } | ||
79 | else | ||
80 | { | ||
81 | screens[i].stop_scroll(); | ||
82 | #if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 | ||
83 | screens[i].backdrop_show(sb_get_backdrop(i)); | ||
84 | #endif | ||
85 | viewportmanager_theme_undo(i, skin_has_sbs(i, fms_skin[i].data)); | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | |||
90 | |||
91 | void fms_skin_init(void) | ||
92 | { | ||
93 | int i; | ||
94 | FOR_NB_SCREENS(i) | ||
95 | { | ||
96 | #ifdef HAVE_ALBUMART | ||
97 | fms_skin_data[i].albumart = NULL; | ||
98 | fms_skin_data[i].playback_aa_slot = -1; | ||
99 | #endif | ||
100 | fms_skin[i].data = &fms_skin_data[i]; | ||
101 | fms_skin[i].display = &screens[i]; | ||
102 | /* Currently no seperate wps_state needed/possible | ||
103 | so use the only available ( "global" ) one */ | ||
104 | fms_skin[i].state = &wps_state; | ||
105 | fms_skin[i].sync_data = &fms_skin_sync_data; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | int fms_do_button_loop(bool update_screen) | ||
110 | { | ||
111 | return skin_wait_for_action(fms_skin, CONTEXT_FM, | ||
112 | update_screen ? TIMEOUT_NOBLOCK : HZ); | ||
113 | } | ||
114 | |||
115 | struct gui_wps *fms_get(enum screen_type screen) | ||
116 | { | ||
117 | return &fms_skin[screen]; | ||
118 | } | ||