FS#12076 - DB stats resurrection: If the filename was changed, require
[kugel-rb.git] / apps / radio / radio_skin.c
blobb4b1933c5d9610956700695300a33be2f13a930b
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Jonathan Gordon
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
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 "tuner.h"
31 #include "action.h"
32 #include "appevents.h"
33 #include "statusbar-skinned.h"
34 #include "option_select.h"
35 #ifdef HAVE_TOUCHSCREEN
36 #include "sound.h"
37 #include "misc.h"
38 #endif
41 char* default_radio_skin(enum screen_type screen)
43 (void)screen;
44 static char default_fms[] =
45 "%s%?Ti<%Ti. |>%?Tn<%Tn|%Tf>\n"
46 "%Sx(Station:) %tf MHz\n"
47 "%?St(force fm mono)<%Sx(Force Mono)|%?ts<%Sx(Stereo)|%Sx(Mono)>>\n"
48 "%Sx(Mode:) %?tm<%Sx(Scan)|%Sx(Preset)>\n"
49 #ifdef HAVE_RADIO_RSSI
50 "%Sx(Signal strength:) %tr dBuV\n"
51 #endif
52 #if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
53 "%?Rr<%Sx(Time:) %Rh:%Rn:%Rs|%?St(prerecording time)<%pm|%Sx(Prerecord Time) %Rs>>\n"
54 #endif
55 "%pb\n"
56 #ifdef HAVE_RDS_CAP
57 "\n%s%ty\n"
58 "%s%tz\n"
59 #endif
61 return default_fms;
64 void fms_fix_displays(enum fms_exiting toggle_state)
66 int i;
67 FOR_NB_SCREENS(i)
69 struct wps_data *data = skin_get_gwps(FM_SCREEN, i)->data;
70 if (toggle_state == FMS_ENTER)
72 viewportmanager_theme_enable(i, skin_has_sbs(i, data), NULL);
73 #if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
74 skin_backdrop_show(data->backdrop_id);
75 #endif
76 screens[i].clear_display();
77 /* force statusbar/skin update since we just cleared the whole screen */
78 send_event(GUI_EVENT_ACTIONUPDATE, (void*)1);
80 else
82 screens[i].stop_scroll();
83 #if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
84 skin_backdrop_show(sb_get_backdrop(i));
85 #endif
86 viewportmanager_theme_undo(i, skin_has_sbs(i, data));
88 #ifdef HAVE_TOUCHSCREEN
89 if (i==SCREEN_MAIN && !data->touchregions)
90 touchscreen_set_mode(toggle_state == FMS_ENTER ?
91 TOUCHSCREEN_BUTTON : global_settings.touch_mode);
92 #endif
97 int fms_do_button_loop(bool update_screen)
99 int button = skin_wait_for_action(FM_SCREEN, CONTEXT_FM,
100 update_screen ? TIMEOUT_NOBLOCK : HZ/5);
101 #ifdef HAVE_TOUCHSCREEN
102 struct touchregion *region;
103 int offset;
104 if (button == ACTION_TOUCHSCREEN)
105 button = skin_get_touchaction(skin_get_gwps(FM_SCREEN, SCREEN_MAIN)->data,
106 &offset, &region);
107 switch (button)
109 case ACTION_WPS_STOP:
110 return ACTION_FM_STOP;
111 case ACTION_STD_CANCEL:
112 return ACTION_FM_EXIT;
113 case ACTION_WPS_VOLUP:
114 return ACTION_SETTINGS_INC;
115 case ACTION_WPS_VOLDOWN:
116 return ACTION_SETTINGS_DEC;
117 case ACTION_WPS_PLAY:
118 return ACTION_FM_PLAY;
119 case ACTION_STD_MENU:
120 return ACTION_FM_MENU;
121 case ACTION_TOUCH_SCROLLBAR:
122 /* TODO */
123 break;
125 #endif
126 return button;
129 struct gui_wps *fms_get(enum screen_type screen)
131 return skin_get_gwps(FM_SCREEN, screen);