From b6867dc9980d19ff6d0954a2a5c7aff7b2b713c3 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Mon, 17 May 2010 15:03:59 +0000 Subject: split the radio code into multiple files in the hope that makes it more likely for someone to want to work on! :D git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26109 a1c6a512-1295-4272-9138-f99709370657 --- apps/radio/radio_skin.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 apps/radio/radio_skin.c (limited to 'apps/radio/radio_skin.c') 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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: radio.c -1 $ + * + * Copyright (C) 2010 Jonathan Gordon + * + * 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 "config.h" +#include +#include +#include +#include "skin_engine/skin_engine.h" +#include "settings.h" +#include "radio.h" +#include "action.h" +#include "appevents.h" +#include "statusbar-skinned.h" + + +extern struct wps_state wps_state; /* from wps.c */ +static struct gui_wps fms_skin[NB_SCREENS] = {{ .data = NULL }}; +static struct wps_data fms_skin_data[NB_SCREENS] = {{ .wps_loaded = 0 }}; +static struct wps_sync_data fms_skin_sync_data = { .do_full_update = false }; + +void fms_data_load(enum screen_type screen, const char *buf, bool isfile) +{ + struct wps_data *data = fms_skin[screen].data; + int success; + success = buf && skin_data_load(screen, data, buf, isfile); + + if (!success ) /* load the default */ + { + const char default_fms[] = "%Sx|Station:| %tf\n" + "%?ts<%Sx|Stereo||%Sx|Mono|>\n" + "%?tm<%Sx|Mode:| %Sx|Scan||%Sx|Preset|: %Ti. %?Tn<%Tn|%Tf>>\n" + "%pb\n" +#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) + "%?Rr<%Sx|Time:| %Rh:%Rn:%Rs|" + "%?St|prerecording time|<%Sx|Prerecord Time| %Rs|%pm>>\n" +#endif +#ifdef HAVE_RDS_CAP + "\n%s%ty\n" + "%s%tz\n" +#endif + ; + skin_data_load(screen, data, default_fms, false); + } +} +void fms_fix_displays(enum fms_exiting toggle_state) +{ + int i; + FOR_NB_SCREENS(i) + { + if (toggle_state == FMS_ENTER) + { + viewportmanager_theme_enable(i, skin_has_sbs(i, fms_skin[i].data), NULL); +#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 + screens[i].backdrop_show(fms_skin[i].data->backdrop); +#endif + screens[i].clear_display(); + /* force statusbar/skin update since we just cleared the whole screen */ + send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); + } + else + { + screens[i].stop_scroll(); +#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 + screens[i].backdrop_show(sb_get_backdrop(i)); +#endif + viewportmanager_theme_undo(i, skin_has_sbs(i, fms_skin[i].data)); + } + } +} + + +void fms_skin_init(void) +{ + int i; + FOR_NB_SCREENS(i) + { +#ifdef HAVE_ALBUMART + fms_skin_data[i].albumart = NULL; + fms_skin_data[i].playback_aa_slot = -1; +#endif + fms_skin[i].data = &fms_skin_data[i]; + fms_skin[i].display = &screens[i]; + /* Currently no seperate wps_state needed/possible + so use the only available ( "global" ) one */ + fms_skin[i].state = &wps_state; + fms_skin[i].sync_data = &fms_skin_sync_data; + } +} + +int fms_do_button_loop(bool update_screen) +{ + return skin_wait_for_action(fms_skin, CONTEXT_FM, + update_screen ? TIMEOUT_NOBLOCK : HZ); +} + +struct gui_wps *fms_get(enum screen_type screen) +{ + return &fms_skin[screen]; +} -- cgit v1.2.3