skin tags: fix the id3 track/disc numbers in conditionals
[maemo-rb.git] / apps / radio / radio_skin.c
blob521890c9bd484d43f3e2f5fa577c16d9565b0a42
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 FOR_NB_SCREENS(i)
68 struct wps_data *data = skin_get_gwps(FM_SCREEN, i)->data;
69 if (toggle_state == FMS_ENTER)
71 viewportmanager_theme_enable(i, skin_has_sbs(i, data), NULL);
72 #ifdef HAVE_BACKDROP_IMAGE
73 skin_backdrop_show(data->backdrop_id);
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);
79 else
81 screens[i].stop_scroll();
82 #ifdef HAVE_BACKDROP_IMAGE
83 skin_backdrop_show(sb_get_backdrop(i));
84 #endif
85 viewportmanager_theme_undo(i, skin_has_sbs(i, data));
87 #ifdef HAVE_TOUCHSCREEN
88 if (i==SCREEN_MAIN && !data->touchregions)
89 touchscreen_set_mode(toggle_state == FMS_ENTER ?
90 TOUCHSCREEN_BUTTON : global_settings.touch_mode);
91 #endif
96 int fms_do_button_loop(bool update_screen)
98 int button = skin_wait_for_action(FM_SCREEN, CONTEXT_FM,
99 update_screen ? TIMEOUT_NOBLOCK : HZ/5);
100 #ifdef HAVE_TOUCHSCREEN
101 struct touchregion *region;
102 int offset;
103 if (button == ACTION_TOUCHSCREEN)
104 button = skin_get_touchaction(skin_get_gwps(FM_SCREEN, SCREEN_MAIN)->data,
105 &offset, &region);
106 switch (button)
108 case ACTION_WPS_STOP:
109 return ACTION_FM_STOP;
110 case ACTION_STD_CANCEL:
111 return ACTION_FM_EXIT;
112 case ACTION_WPS_VOLUP:
113 return ACTION_SETTINGS_INC;
114 case ACTION_WPS_VOLDOWN:
115 return ACTION_SETTINGS_DEC;
116 case ACTION_WPS_PLAY:
117 return ACTION_FM_PLAY;
118 case ACTION_STD_MENU:
119 return ACTION_FM_MENU;
120 case ACTION_TOUCH_SCROLLBAR:
121 /* TODO */
122 break;
124 #endif
125 return button;