summaryrefslogtreecommitdiff
path: root/apps/screens.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/screens.c')
-rw-r--r--apps/screens.c157
1 files changed, 153 insertions, 4 deletions
diff --git a/apps/screens.c b/apps/screens.c
index ebb7981bd1..b0d95e0a7a 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -40,6 +40,7 @@
40#include "action.h" 40#include "action.h"
41#include "talk.h" 41#include "talk.h"
42#include "misc.h" 42#include "misc.h"
43#include "id3.h"
43 44
44#ifdef HAVE_LCD_BITMAP 45#ifdef HAVE_LCD_BITMAP
45#define BMPHEIGHT_usb_logo 32 46#define BMPHEIGHT_usb_logo 32
@@ -240,7 +241,7 @@ int charging_screen(void)
240{ 241{
241 int button; 242 int button;
242 int rc = 0; 243 int rc = 0;
243#ifdef HAVE_RECORDER_KEYPAD 244#ifdef BUTTON_OFF
244 const int offbutton = BUTTON_OFF; 245 const int offbutton = BUTTON_OFF;
245#else 246#else
246 const int offbutton = BUTTON_STOP; 247 const int offbutton = BUTTON_STOP;
@@ -263,7 +264,11 @@ int charging_screen(void)
263 status_draw(false); 264 status_draw(false);
264 charging_display_info(true); 265 charging_display_info(true);
265 button = button_get_w_tmo(HZ/3); 266 button = button_get_w_tmo(HZ/3);
267#ifdef BUTTON_ON
266 if (button == (BUTTON_ON | BUTTON_REL)) 268 if (button == (BUTTON_ON | BUTTON_REL))
269#else
270 if (button == (BUTTON_RIGHT | BUTTON_REL))
271#endif
267 rc = 3; 272 rc = 3;
268 else if (button == offbutton) 273 else if (button == offbutton)
269 rc = 2; 274 rc = 2;
@@ -286,7 +291,7 @@ int charging_screen(void)
286 0 if no key was pressed 291 0 if no key was pressed
287 1 if a key was pressed (or if ON was held down long enough to repeat) 292 1 if a key was pressed (or if ON was held down long enough to repeat)
288 2 if USB was connected */ 293 2 if USB was connected */
289int on_screen(void) 294int pitch_screen(void)
290{ 295{
291 int button; 296 int button;
292 static int pitch = 1000; 297 static int pitch = 1000;
@@ -1082,15 +1087,19 @@ bool set_time_screen(const char* string, struct tm *tm)
1082 *valptr = min; 1087 *valptr = min;
1083 say_time(cursorpos, tm); 1088 say_time(cursorpos, tm);
1084 break; 1089 break;
1090
1091#ifdef BUTTON_ON
1085 case BUTTON_ON: 1092 case BUTTON_ON:
1093#elif defined BUTTON_MENU
1094 case BUTTON_MENU:
1095#endif
1086 done = true; 1096 done = true;
1087 break; 1097 break;
1088#if (BUTTON_ON != BUTTON_OFF) /* FixMe, this is just to make the Ondio compile */ 1098
1089 case BUTTON_OFF: 1099 case BUTTON_OFF:
1090 done = true; 1100 done = true;
1091 tm->tm_year = -1; 1101 tm->tm_year = -1;
1092 break; 1102 break;
1093#endif
1094 1103
1095 default: 1104 default:
1096 if (default_event_handler(button) == SYS_USB_CONNECTED) 1105 if (default_event_handler(button) == SYS_USB_CONNECTED)
@@ -1140,3 +1149,143 @@ bool shutdown_screen(void)
1140 return false; 1149 return false;
1141} 1150}
1142#endif 1151#endif
1152
1153bool browse_id3(void)
1154{
1155 struct mp3entry* id3 = mpeg_current_track();
1156 int button;
1157 int menu_pos = 0;
1158 int menu_max = 8;
1159 bool exit = false;
1160 char scroll_text[MAX_PATH];
1161
1162 if (!(mpeg_status() & MPEG_STATUS_PLAY))
1163 return false;
1164
1165 while (!exit)
1166 {
1167 lcd_clear_display();
1168
1169 switch (menu_pos)
1170 {
1171 case 0:
1172 lcd_puts(0, 0, str(LANG_ID3_TITLE));
1173 lcd_puts_scroll(0, 1, id3->title ? id3->title :
1174 (char*)str(LANG_ID3_NO_TITLE));
1175 break;
1176
1177 case 1:
1178 lcd_puts(0, 0, str(LANG_ID3_ARTIST));
1179 lcd_puts_scroll(0, 1,
1180 id3->artist ? id3->artist :
1181 (char*)str(LANG_ID3_NO_ARTIST));
1182 break;
1183
1184 case 2:
1185 lcd_puts(0, 0, str(LANG_ID3_ALBUM));
1186 lcd_puts_scroll(0, 1, id3->album ? id3->album :
1187 (char*)str(LANG_ID3_NO_ALBUM));
1188 break;
1189
1190 case 3:
1191 lcd_puts(0, 0, str(LANG_ID3_TRACKNUM));
1192
1193 if (id3->tracknum) {
1194 snprintf(scroll_text,sizeof(scroll_text), "%d",
1195 id3->tracknum);
1196 lcd_puts_scroll(0, 1, scroll_text);
1197 }
1198 else
1199 lcd_puts_scroll(0, 1, str(LANG_ID3_NO_TRACKNUM));
1200 break;
1201
1202 case 4:
1203 lcd_puts(0, 0, str(LANG_ID3_GENRE));
1204 lcd_puts_scroll(0, 1,
1205 id3_get_genre(id3) ?
1206 id3_get_genre(id3) :
1207 (char*)str(LANG_ID3_NO_INFO));
1208 break;
1209
1210 case 5:
1211 lcd_puts(0, 0, str(LANG_ID3_YEAR));
1212 if (id3->year) {
1213 snprintf(scroll_text,sizeof(scroll_text), "%d",
1214 id3->year);
1215 lcd_puts_scroll(0, 1, scroll_text);
1216 }
1217 else
1218 lcd_puts_scroll(0, 1, str(LANG_ID3_NO_INFO));
1219 break;
1220
1221 case 6:
1222 lcd_puts(0, 0, str(LANG_ID3_LENGHT));
1223 snprintf(scroll_text,sizeof(scroll_text), "%d:%02d",
1224 id3->length / 60000,
1225 id3->length % 60000 / 1000 );
1226 lcd_puts(0, 1, scroll_text);
1227 break;
1228
1229 case 7:
1230 lcd_puts(0, 0, str(LANG_ID3_PLAYLIST));
1231 snprintf(scroll_text,sizeof(scroll_text), "%d/%d",
1232 playlist_get_display_index(), playlist_amount());
1233 lcd_puts_scroll(0, 1, scroll_text);
1234 break;
1235
1236
1237 case 8:
1238 lcd_puts(0, 0, str(LANG_ID3_BITRATE));
1239 snprintf(scroll_text,sizeof(scroll_text), "%d kbps",
1240 id3->bitrate);
1241 lcd_puts(0, 1, scroll_text);
1242 break;
1243
1244 case 9:
1245 lcd_puts(0, 0, str(LANG_ID3_FRECUENCY));
1246 snprintf(scroll_text,sizeof(scroll_text), "%d Hz",
1247 id3->frequency);
1248 lcd_puts(0, 1, scroll_text);
1249 break;
1250
1251 case 10:
1252 lcd_puts(0, 0, str(LANG_ID3_PATH));
1253 lcd_puts_scroll(0, 1, id3->path);
1254 break;
1255 }
1256 lcd_update();
1257
1258 button = button_get(true);
1259
1260 switch(button)
1261 {
1262 case SETTINGS_DEC:
1263 if (menu_pos > 0)
1264 menu_pos--;
1265 else
1266 menu_pos = menu_max;
1267 break;
1268
1269 case SETTINGS_INC:
1270 if (menu_pos < menu_max)
1271 menu_pos++;
1272 else
1273 menu_pos = 0;
1274 break;
1275
1276 case SETTINGS_CANCEL:
1277 lcd_stop_scroll();
1278 /* eat release event */
1279 button_get(true);
1280 exit = true;
1281 break;
1282
1283 default:
1284 if(default_event_handler(button) == SYS_USB_CONNECTED)
1285 return true;
1286 break;
1287 }
1288 }
1289 return false;
1290}
1291