2010-05-17 15:03:59 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2010-05-17 21:42:07 +00:00
|
|
|
* $Id$
|
2010-05-17 15:03:59 +00:00
|
|
|
*
|
|
|
|
* 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 <stdio.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "skin_engine/skin_engine.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "radio.h"
|
2010-11-11 21:13:29 +00:00
|
|
|
#include "tuner.h"
|
2010-05-17 15:03:59 +00:00
|
|
|
#include "action.h"
|
|
|
|
#include "appevents.h"
|
|
|
|
#include "statusbar-skinned.h"
|
2010-09-06 13:33:49 +00:00
|
|
|
#include "option_select.h"
|
2011-01-13 10:56:23 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
#include "sound.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#endif
|
2010-05-17 15:03:59 +00:00
|
|
|
|
|
|
|
|
2010-09-14 11:56:50 +00:00
|
|
|
char* default_radio_skin(enum screen_type screen)
|
2010-05-17 15:03:59 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
(void)screen;
|
|
|
|
static char default_fms[] =
|
|
|
|
"%s%?Ti<%Ti. |>%?Tn<%Tn|%Tf>\n"
|
|
|
|
"%Sx(Station:) %tf MHz\n"
|
|
|
|
"%?St(force fm mono)<%Sx(Force Mono)|%?ts<%Sx(Stereo)|%Sx(Mono)>>\n"
|
|
|
|
"%Sx(Mode:) %?tm<%Sx(Scan)|%Sx(Preset)>\n"
|
2010-11-11 21:13:29 +00:00
|
|
|
#ifdef HAVE_RADIO_RSSI
|
|
|
|
"%Sx(Signal strength:) %tr dBuV\n"
|
|
|
|
#endif
|
2010-05-17 15:03:59 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
|
2010-09-14 11:56:50 +00:00
|
|
|
"%?Rr<%Sx(Time:) %Rh:%Rn:%Rs|%?St(prerecording time)<%pm|%Sx(Prerecord Time) %Rs>>\n"
|
2010-05-26 05:58:46 +00:00
|
|
|
#endif
|
2010-09-14 11:56:50 +00:00
|
|
|
"%pb\n"
|
2010-05-17 15:03:59 +00:00
|
|
|
#ifdef HAVE_RDS_CAP
|
2010-09-14 11:56:50 +00:00
|
|
|
"\n%s%ty\n"
|
|
|
|
"%s%tz\n"
|
2010-05-17 15:03:59 +00:00
|
|
|
#endif
|
2010-09-14 11:56:50 +00:00
|
|
|
;
|
|
|
|
return default_fms;
|
2010-05-17 15:03:59 +00:00
|
|
|
}
|
2010-09-14 11:56:50 +00:00
|
|
|
|
2010-05-17 15:03:59 +00:00
|
|
|
void fms_fix_displays(enum fms_exiting toggle_state)
|
|
|
|
{
|
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
struct wps_data *data = skin_get_gwps(FM_SCREEN, i)->data;
|
2010-05-17 15:03:59 +00:00
|
|
|
if (toggle_state == FMS_ENTER)
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
viewportmanager_theme_enable(i, skin_has_sbs(i, data), NULL);
|
2011-11-19 13:46:25 +00:00
|
|
|
#ifdef HAVE_BACKDROP_IMAGE
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_backdrop_show(data->backdrop_id);
|
2010-05-17 15:03:59 +00:00
|
|
|
#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();
|
2011-11-19 13:46:25 +00:00
|
|
|
#ifdef HAVE_BACKDROP_IMAGE
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_backdrop_show(sb_get_backdrop(i));
|
2010-05-17 15:03:59 +00:00
|
|
|
#endif
|
2010-09-14 11:56:50 +00:00
|
|
|
viewportmanager_theme_undo(i, skin_has_sbs(i, data));
|
2010-05-17 15:03:59 +00:00
|
|
|
}
|
2010-08-04 12:00:18 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2010-09-14 12:21:56 +00:00
|
|
|
if (i==SCREEN_MAIN && !data->touchregions)
|
|
|
|
touchscreen_set_mode(toggle_state == FMS_ENTER ?
|
|
|
|
TOUCHSCREEN_BUTTON : global_settings.touch_mode);
|
2010-08-04 12:00:18 +00:00
|
|
|
#endif
|
2010-09-14 12:21:56 +00:00
|
|
|
}
|
2010-05-17 15:03:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int fms_do_button_loop(bool update_screen)
|
|
|
|
{
|
2013-03-14 15:40:23 +00:00
|
|
|
int button = skin_wait_for_action(FM_SCREEN, CONTEXT_FM|ALLOW_SOFTLOCK,
|
2010-08-16 12:07:46 +00:00
|
|
|
update_screen ? TIMEOUT_NOBLOCK : HZ/5);
|
2010-06-21 06:04:19 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2010-09-06 13:33:49 +00:00
|
|
|
struct touchregion *region;
|
2010-06-21 06:04:19 +00:00
|
|
|
int offset;
|
|
|
|
if (button == ACTION_TOUCHSCREEN)
|
2010-09-14 11:56:50 +00:00
|
|
|
button = skin_get_touchaction(skin_get_gwps(FM_SCREEN, SCREEN_MAIN)->data,
|
2010-09-14 12:40:42 +00:00
|
|
|
&offset, ®ion);
|
2010-06-21 06:04:19 +00:00
|
|
|
switch (button)
|
|
|
|
{
|
|
|
|
case ACTION_WPS_STOP:
|
|
|
|
return ACTION_FM_STOP;
|
|
|
|
case ACTION_STD_CANCEL:
|
|
|
|
return ACTION_FM_EXIT;
|
|
|
|
case ACTION_WPS_VOLUP:
|
|
|
|
return ACTION_SETTINGS_INC;
|
|
|
|
case ACTION_WPS_VOLDOWN:
|
|
|
|
return ACTION_SETTINGS_DEC;
|
|
|
|
case ACTION_WPS_PLAY:
|
|
|
|
return ACTION_FM_PLAY;
|
|
|
|
case ACTION_STD_MENU:
|
|
|
|
return ACTION_FM_MENU;
|
2011-03-27 07:30:23 +00:00
|
|
|
case ACTION_TOUCH_SCROLLBAR:
|
2010-06-21 06:04:19 +00:00
|
|
|
/* TODO */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return button;
|
2010-05-17 15:03:59 +00:00
|
|
|
}
|
|
|
|
|